diff --git a/packages/components/.parcelrc b/packages/components/.parcelrc deleted file mode 100644 index db2d15099d..0000000000 --- a/packages/components/.parcelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@parcel/config-default", - "transformers": { - "*.{js,mjs,jsm,jsx,es6,cjs,ts,tsx}": [ - "@parcel/transformer-js", - "@parcel/transformer-react-refresh-wrap" - ] - } -} diff --git a/packages/components/news/6467.internal b/packages/components/news/6467.internal new file mode 100644 index 0000000000..97beb403a0 --- /dev/null +++ b/packages/components/news/6467.internal @@ -0,0 +1 @@ +Replace `parcel` with `tsup`. Better types, better tsconfig. Move to ESM. @sneridagh diff --git a/packages/components/package.json b/packages/components/package.json index d76dbe9972..846ac78695 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -16,23 +16,20 @@ "bugs": { "url": "https://github.com/plone/components/issues" }, + "type": "module", "files": [ "dist", "src", "README.md" ], - "source": "./src/index.ts", - "main": "./dist/main.js", - "module": "./dist/module.mjs", - "types": "./dist/index.d.ts", + "main": "./dist/index.js", "exports": { + "./package.json": "./package.json", ".": { - "types": "./dist/index.d.ts", - "import": "./dist/module.mjs", - "require": "./dist/main.js" + "import": "./dist/index.js", + "default": "./dist/index.cjs" }, - "./dist/*.css": "./dist/*.css", - "./src/*": "./src/*" + "./dist/*.css": "./dist/*.css" }, "homepage": "https://plone.org", "keywords": [ @@ -45,12 +42,13 @@ "quanta" ], "scripts": { - "build": "parcel build && pnpm build:css", - "build:force": "parcel build --no-cache && pnpm build:css", + "build": "tsup && pnpm build:css", + "build:force": "tsup && pnpm build:css", "build:css": "pnpm build:basic && pnpm build:quanta", "build:basic": "lightningcss --browserslist --bundle --sourcemap src/styles/basic/main.css -o basic.css && mv basic.css* dist/.", "build:quanta": "lightningcss --browserslist --bundle --sourcemap src/styles/quanta/main.css -o quanta.css && mv quanta.css* dist/.", - "check-ts": "tsc --project tsconfig.json", + "check:exports": "attw --pack .", + "check:ts": "tsc --project tsconfig.json", "test": "vitest --passWithNoTests", "coverage": "vitest run --coverage --no-threads", "lint": "pnpm eslint && pnpm prettier && pnpm stylelint && pnpm check-ts", @@ -77,12 +75,7 @@ "not dead" ], "devDependencies": { - "@parcel/config-default": "^2.12.0", - "@parcel/core": "^2.12.0", - "@parcel/packager-ts": "^2.12.0", - "@parcel/transformer-js": "^2.12.0", - "@parcel/transformer-react-refresh-wrap": "^2.12.0", - "@parcel/transformer-typescript-types": "^2.12.0", + "@arethetypeswrong/cli": "^0.16.4", "@plone/types": "workspace: *", "@react-types/shared": "^3.22.0", "@storybook/addon-essentials": "^8.0.4", @@ -107,9 +100,9 @@ "jsdom": "^22.1.0", "lightningcss": "^1.24.0", "lightningcss-cli": "^1.24.0", - "parcel": "^2.12.0", "release-it": "17.1.1", "storybook": "^8.0.4", + "tsup": "^8.3.5", "typescript": "^5.6.3", "vite": "^5.4.8", "vitest": "^2.1.3", diff --git a/packages/components/src/components/BlockToolbar/BlockToolbar.tsx b/packages/components/src/components/BlockToolbar/BlockToolbar.tsx index 62f1b47922..f76ba5ef83 100644 --- a/packages/components/src/components/BlockToolbar/BlockToolbar.tsx +++ b/packages/components/src/components/BlockToolbar/BlockToolbar.tsx @@ -1,5 +1,8 @@ import React from 'react'; -import { Toolbar as RACToolbar, ToolbarProps } from 'react-aria-components'; +import { + Toolbar as RACToolbar, + type ToolbarProps, +} from 'react-aria-components'; export function BlockToolbar(props: ToolbarProps) { return ; diff --git a/packages/components/src/components/Button/Button.tsx b/packages/components/src/components/Button/Button.tsx index 9e8c76b371..c466e8a1dd 100644 --- a/packages/components/src/components/Button/Button.tsx +++ b/packages/components/src/components/Button/Button.tsx @@ -1,5 +1,5 @@ -import React, { forwardRef, ForwardedRef } from 'react'; -import { Button as RACButton, ButtonProps } from 'react-aria-components'; +import React, { forwardRef, type ForwardedRef } from 'react'; +import { Button as RACButton, type ButtonProps } from 'react-aria-components'; export const Button = forwardRef(function _Button( props: ButtonProps, diff --git a/packages/components/src/components/Calendar/Calendar.tsx b/packages/components/src/components/Calendar/Calendar.tsx index 37f3b489c4..faf32a12d7 100644 --- a/packages/components/src/components/Calendar/Calendar.tsx +++ b/packages/components/src/components/Calendar/Calendar.tsx @@ -4,8 +4,8 @@ import { Calendar as RACCalendar, CalendarCell, CalendarGrid, - CalendarProps as RACCalendarProps, - DateValue, + type CalendarProps as RACCalendarProps, + type DateValue, Heading, Text, } from 'react-aria-components'; diff --git a/packages/components/src/components/Checkbox/Checkbox.tsx b/packages/components/src/components/Checkbox/Checkbox.tsx index a24407dd5b..47eaca3ef5 100644 --- a/packages/components/src/components/Checkbox/Checkbox.tsx +++ b/packages/components/src/components/Checkbox/Checkbox.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Checkbox as RACCheckbox, - CheckboxProps as RACCheckboxProps, + type CheckboxProps as RACCheckboxProps, } from 'react-aria-components'; interface CheckboxProps extends RACCheckboxProps { diff --git a/packages/components/src/components/CheckboxGroup/CheckboxGroup.tsx b/packages/components/src/components/CheckboxGroup/CheckboxGroup.tsx index 0c29059708..d0106355dd 100644 --- a/packages/components/src/components/CheckboxGroup/CheckboxGroup.tsx +++ b/packages/components/src/components/CheckboxGroup/CheckboxGroup.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { CheckboxGroup as RACCheckboxGroup, - CheckboxGroupProps as RACCheckboxGroupProps, + type CheckboxGroupProps as RACCheckboxGroupProps, FieldError, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface CheckboxGroupProps diff --git a/packages/components/src/components/ColorArea/ColorArea.tsx b/packages/components/src/components/ColorArea/ColorArea.tsx index 8464766f70..3f060b6721 100644 --- a/packages/components/src/components/ColorArea/ColorArea.tsx +++ b/packages/components/src/components/ColorArea/ColorArea.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { ColorArea as RACColorArea, - ColorAreaProps, + type ColorAreaProps, ColorThumb, } from 'react-aria-components'; diff --git a/packages/components/src/components/ColorField/ColorField.tsx b/packages/components/src/components/ColorField/ColorField.tsx index fff7c0f912..ac3f00f62e 100644 --- a/packages/components/src/components/ColorField/ColorField.tsx +++ b/packages/components/src/components/ColorField/ColorField.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; import { ColorField as RACColorField, - ColorFieldProps as RACColorFieldProps, + type ColorFieldProps as RACColorFieldProps, FieldError, Input, Label, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface ColorFieldProps extends RACColorFieldProps { diff --git a/packages/components/src/components/ColorPicker/ColorPicker.tsx b/packages/components/src/components/ColorPicker/ColorPicker.tsx index b5256e24c2..4bedc19b43 100644 --- a/packages/components/src/components/ColorPicker/ColorPicker.tsx +++ b/packages/components/src/components/ColorPicker/ColorPicker.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { Button, ColorPicker as RACColorPicker, - ColorPickerProps as RACColorPickerProps, + type ColorPickerProps as RACColorPickerProps, Dialog, DialogTrigger, Popover, diff --git a/packages/components/src/components/ColorSlider/ColorSlider.tsx b/packages/components/src/components/ColorSlider/ColorSlider.tsx index 55b81b9351..de9afa32c2 100644 --- a/packages/components/src/components/ColorSlider/ColorSlider.tsx +++ b/packages/components/src/components/ColorSlider/ColorSlider.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { ColorSlider as RACColorSlider, - ColorSliderProps as RACColorSliderProps, + type ColorSliderProps as RACColorSliderProps, ColorThumb, Label, SliderOutput, diff --git a/packages/components/src/components/ColorSwatch/ColorSwatch.tsx b/packages/components/src/components/ColorSwatch/ColorSwatch.tsx index b80a13c31c..1415622497 100644 --- a/packages/components/src/components/ColorSwatch/ColorSwatch.tsx +++ b/packages/components/src/components/ColorSwatch/ColorSwatch.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { ColorSwatch as RACColorSwatch, - ColorSwatchProps, + type ColorSwatchProps, } from 'react-aria-components'; export function ColorSwatch(props: ColorSwatchProps) { diff --git a/packages/components/src/components/ColorSwatchPicker/ColorSwatchPicker.tsx b/packages/components/src/components/ColorSwatchPicker/ColorSwatchPicker.tsx index 9ecdc9dac1..2d1598980a 100644 --- a/packages/components/src/components/ColorSwatchPicker/ColorSwatchPicker.tsx +++ b/packages/components/src/components/ColorSwatchPicker/ColorSwatchPicker.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { ColorSwatchPicker as AriaColorSwatchPicker, ColorSwatchPickerItem as AriaColorSwatchPickerItem, - ColorSwatchPickerItemProps, - ColorSwatchPickerProps, + type ColorSwatchPickerItemProps, + type ColorSwatchPickerProps, } from 'react-aria-components'; import { ColorSwatch } from '../ColorSwatch/ColorSwatch'; diff --git a/packages/components/src/components/ColorWheel/ColorWheel.tsx b/packages/components/src/components/ColorWheel/ColorWheel.tsx index a9dff1f543..fd601243bb 100644 --- a/packages/components/src/components/ColorWheel/ColorWheel.tsx +++ b/packages/components/src/components/ColorWheel/ColorWheel.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { ColorThumb, ColorWheel as AriaColorWheel, - ColorWheelProps as AriaColorWheelProps, + type ColorWheelProps as AriaColorWheelProps, ColorWheelTrack, } from 'react-aria-components'; diff --git a/packages/components/src/components/ComboBox/ComboBox.tsx b/packages/components/src/components/ComboBox/ComboBox.tsx index f3cc54422c..dae5e3767d 100644 --- a/packages/components/src/components/ComboBox/ComboBox.tsx +++ b/packages/components/src/components/ComboBox/ComboBox.tsx @@ -2,16 +2,16 @@ import React from 'react'; import { Button, ComboBox as RACComboBox, - ComboBoxProps as RACComboBoxProps, + type ComboBoxProps as RACComboBoxProps, FieldError, Input, Label, ListBox, ListBoxItem, - ListBoxItemProps, + type ListBoxItemProps, Popover, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface ComboBoxProps diff --git a/packages/components/src/components/DateField/DateField.tsx b/packages/components/src/components/DateField/DateField.tsx index 8f41e0a680..6bbca4b9c8 100644 --- a/packages/components/src/components/DateField/DateField.tsx +++ b/packages/components/src/components/DateField/DateField.tsx @@ -1,14 +1,14 @@ import React from 'react'; import { DateField as RACDateField, - DateFieldProps as RACDateFieldProps, + type DateFieldProps as RACDateFieldProps, DateInput, DateSegment, - DateValue, + type DateValue, FieldError, Label, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface DateFieldProps diff --git a/packages/components/src/components/DatePicker/DatePicker.tsx b/packages/components/src/components/DatePicker/DatePicker.tsx index b49bc7e493..9db14f1278 100644 --- a/packages/components/src/components/DatePicker/DatePicker.tsx +++ b/packages/components/src/components/DatePicker/DatePicker.tsx @@ -6,9 +6,9 @@ import { CalendarGrid, DateInput, DatePicker as RACDatePicker, - DatePickerProps as RACDatePickerProps, + type DatePickerProps as RACDatePickerProps, DateSegment, - DateValue, + type DateValue, Dialog, FieldError, Group, @@ -16,7 +16,7 @@ import { Label, Popover, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface DatePickerProps diff --git a/packages/components/src/components/DateRangePicker/DateRangePicker.tsx b/packages/components/src/components/DateRangePicker/DateRangePicker.tsx index 55b76c5fde..9a00fd0a44 100644 --- a/packages/components/src/components/DateRangePicker/DateRangePicker.tsx +++ b/packages/components/src/components/DateRangePicker/DateRangePicker.tsx @@ -5,9 +5,9 @@ import { CalendarGrid, DateInput, DateRangePicker as RACDateRangePicker, - DateRangePickerProps as RACDateRangePickerProps, + type DateRangePickerProps as RACDateRangePickerProps, DateSegment, - DateValue, + type DateValue, Dialog, FieldError, Group, @@ -16,7 +16,7 @@ import { Popover, RangeCalendar, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface DateRangePickerProps diff --git a/packages/components/src/components/Dialog/Dialog.tsx b/packages/components/src/components/Dialog/Dialog.tsx index 39de5afd8e..503f87f9d5 100644 --- a/packages/components/src/components/Dialog/Dialog.tsx +++ b/packages/components/src/components/Dialog/Dialog.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Dialog as RACDialog, DialogProps } from 'react-aria-components'; +import { Dialog as RACDialog, type DialogProps } from 'react-aria-components'; export function Dialog(props: DialogProps) { return ; diff --git a/packages/components/src/components/Disclosure/Disclosure.tsx b/packages/components/src/components/Disclosure/Disclosure.tsx index 8e062a8d61..1820159bee 100644 --- a/packages/components/src/components/Disclosure/Disclosure.tsx +++ b/packages/components/src/components/Disclosure/Disclosure.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { UNSTABLE_Disclosure as RACDisclosure, - DisclosureProps, + type DisclosureProps, } from 'react-aria-components'; /** diff --git a/packages/components/src/components/DisclosureGroup/DisclosureGroup.tsx b/packages/components/src/components/DisclosureGroup/DisclosureGroup.tsx index 4196e558c6..7588d0d580 100644 --- a/packages/components/src/components/DisclosureGroup/DisclosureGroup.tsx +++ b/packages/components/src/components/DisclosureGroup/DisclosureGroup.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { UNSTABLE_DisclosureGroup as RACDisclosureGroup, - DisclosureGroupProps, + type DisclosureGroupProps, } from 'react-aria-components'; /** diff --git a/packages/components/src/components/Form/Form.tsx b/packages/components/src/components/Form/Form.tsx index f2f2e9b70a..03fd907bef 100644 --- a/packages/components/src/components/Form/Form.tsx +++ b/packages/components/src/components/Form/Form.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Form as RACForm, FormProps } from 'react-aria-components'; +import { Form as RACForm, type FormProps } from 'react-aria-components'; export function Form(props: FormProps) { return ; diff --git a/packages/components/src/components/GridList/GridList.tsx b/packages/components/src/components/GridList/GridList.tsx index d195b71cfd..088235641d 100644 --- a/packages/components/src/components/GridList/GridList.tsx +++ b/packages/components/src/components/GridList/GridList.tsx @@ -3,8 +3,8 @@ import { Button, GridList as RACGridList, GridListItem as RACGridListItem, - GridListItemProps, - GridListProps, + type GridListItemProps, + type GridListProps, } from 'react-aria-components'; import { Checkbox } from '../Checkbox/Checkbox'; diff --git a/packages/components/src/components/Icon/Icon.tsx b/packages/components/src/components/Icon/Icon.tsx index 0056688024..c55a91521e 100644 --- a/packages/components/src/components/Icon/Icon.tsx +++ b/packages/components/src/components/Icon/Icon.tsx @@ -1,4 +1,4 @@ -import React, { ReactElement } from 'react'; +import React, { type ReactElement } from 'react'; import type { AriaLabelingProps, DOMProps, @@ -7,7 +7,7 @@ import type { } from '@react-types/shared'; import { baseStyleProps, - StyleHandlers, + type StyleHandlers, useSlotProps, useStyleProps, } from '@react-spectrum/utils'; diff --git a/packages/components/src/components/ListBox/ListBox.tsx b/packages/components/src/components/ListBox/ListBox.tsx index ac90dbe68f..244efb16a4 100644 --- a/packages/components/src/components/ListBox/ListBox.tsx +++ b/packages/components/src/components/ListBox/ListBox.tsx @@ -2,8 +2,8 @@ import React from 'react'; import { ListBox as RACListBox, ListBoxItem as RACListBoxItem, - ListBoxItemProps, - ListBoxProps, + type ListBoxItemProps, + type ListBoxProps, } from 'react-aria-components'; export function ListBox({ diff --git a/packages/components/src/components/Menu/Menu.tsx b/packages/components/src/components/Menu/Menu.tsx index db153971a6..14834205cd 100644 --- a/packages/components/src/components/Menu/Menu.tsx +++ b/packages/components/src/components/Menu/Menu.tsx @@ -2,12 +2,12 @@ import React from 'react'; import { Menu as RACMenu, MenuItem as RACMenuItem, - MenuItemProps, - MenuProps, + type MenuItemProps, + type MenuProps, MenuTrigger, - MenuTriggerProps, + type MenuTriggerProps, Popover, - PressEvent, + type PressEvent, } from 'react-aria-components'; import { Button } from '../Button/Button'; diff --git a/packages/components/src/components/Meter/Meter.tsx b/packages/components/src/components/Meter/Meter.tsx index fb06f8c57c..71da9815c6 100644 --- a/packages/components/src/components/Meter/Meter.tsx +++ b/packages/components/src/components/Meter/Meter.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Label, Meter as RACMeter, - MeterProps as RACMeterProps, + type MeterProps as RACMeterProps, } from 'react-aria-components'; export interface MeterProps extends RACMeterProps { diff --git a/packages/components/src/components/Modal/Modal.tsx b/packages/components/src/components/Modal/Modal.tsx index 83eb2e061c..2ef1c970cb 100644 --- a/packages/components/src/components/Modal/Modal.tsx +++ b/packages/components/src/components/Modal/Modal.tsx @@ -1,5 +1,8 @@ import React from 'react'; -import { Modal as RACModal, ModalOverlayProps } from 'react-aria-components'; +import { + Modal as RACModal, + type ModalOverlayProps, +} from 'react-aria-components'; export function Modal(props: ModalOverlayProps) { return ; diff --git a/packages/components/src/components/NumberField/NumberField.tsx b/packages/components/src/components/NumberField/NumberField.tsx index 98781966fe..462910c32d 100644 --- a/packages/components/src/components/NumberField/NumberField.tsx +++ b/packages/components/src/components/NumberField/NumberField.tsx @@ -5,9 +5,9 @@ import { Input, Label, NumberField as RACNumberField, - NumberFieldProps as RACNumberFieldProps, + type NumberFieldProps as RACNumberFieldProps, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; import { Button } from '../Button/Button'; import { AddIcon } from '../Icons/AddIcon'; diff --git a/packages/components/src/components/Popover/Popover.tsx b/packages/components/src/components/Popover/Popover.tsx index a79c3d1418..8a0614c9b6 100644 --- a/packages/components/src/components/Popover/Popover.tsx +++ b/packages/components/src/components/Popover/Popover.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { OverlayArrow, Popover as RACPopover, - PopoverProps as RACPopoverProps, + type PopoverProps as RACPopoverProps, } from 'react-aria-components'; import { Dialog } from '../Dialog/Dialog'; diff --git a/packages/components/src/components/ProgressBar/ProgressBar.tsx b/packages/components/src/components/ProgressBar/ProgressBar.tsx index cb72f500f5..2fa1f49ca8 100644 --- a/packages/components/src/components/ProgressBar/ProgressBar.tsx +++ b/packages/components/src/components/ProgressBar/ProgressBar.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Label, ProgressBar as RACProgressBar, - ProgressBarProps as RACProgressBarProps, + type ProgressBarProps as RACProgressBarProps, } from 'react-aria-components'; export interface ProgressBarProps extends RACProgressBarProps { diff --git a/packages/components/src/components/RadioGroup/RadioGroup.tsx b/packages/components/src/components/RadioGroup/RadioGroup.tsx index 90fea840d4..7090d0f15a 100644 --- a/packages/components/src/components/RadioGroup/RadioGroup.tsx +++ b/packages/components/src/components/RadioGroup/RadioGroup.tsx @@ -3,9 +3,9 @@ import { FieldError, Label, RadioGroup as RACRadioGroup, - RadioGroupProps as RACRadioGroupProps, + type RadioGroupProps as RACRadioGroupProps, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface RadioGroupProps extends Omit { diff --git a/packages/components/src/components/RangeCalendar/RangeCalendar.tsx b/packages/components/src/components/RangeCalendar/RangeCalendar.tsx index 7881028477..63e32cdcab 100644 --- a/packages/components/src/components/RangeCalendar/RangeCalendar.tsx +++ b/packages/components/src/components/RangeCalendar/RangeCalendar.tsx @@ -3,10 +3,10 @@ import { Button, CalendarCell, CalendarGrid, - DateValue, + type DateValue, Heading, RangeCalendar as RACRangeCalendar, - RangeCalendarProps as RACRangeCalendarProps, + type RangeCalendarProps as RACRangeCalendarProps, Text, } from 'react-aria-components'; diff --git a/packages/components/src/components/SearchField/SearchField.tsx b/packages/components/src/components/SearchField/SearchField.tsx index 57f7946d4f..dc5c3964b3 100644 --- a/packages/components/src/components/SearchField/SearchField.tsx +++ b/packages/components/src/components/SearchField/SearchField.tsx @@ -5,9 +5,9 @@ import { Input, Label, SearchField as RACSearchField, - SearchFieldProps as RACSearchFieldProps, + type SearchFieldProps as RACSearchFieldProps, Text, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; export interface SearchFieldProps extends RACSearchFieldProps { diff --git a/packages/components/src/components/Select/Select.stories.tsx b/packages/components/src/components/Select/Select.stories.tsx index 97842eda90..7adb2e0afc 100644 --- a/packages/components/src/components/Select/Select.stories.tsx +++ b/packages/components/src/components/Select/Select.stories.tsx @@ -4,11 +4,6 @@ import type { Meta, StoryObj } from '@storybook/react'; import '../../styles/basic/Select.css'; -export interface SelectItemObject { - label: string; - value: string; -} - // More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction const meta = { title: 'Forms/Select', diff --git a/packages/components/src/components/Select/Select.tsx b/packages/components/src/components/Select/Select.tsx index d57402e238..5cb8f71488 100644 --- a/packages/components/src/components/Select/Select.tsx +++ b/packages/components/src/components/Select/Select.tsx @@ -5,15 +5,15 @@ import { Label, ListBox, ListBoxItem, - ListBoxItemProps, + type ListBoxItemProps, Popover, PopoverContext, Select as RACSelect, - SelectProps as RACSelectProps, + type SelectProps as RACSelectProps, SelectValue, Text, useContextProps, - ValidationResult, + type ValidationResult, } from 'react-aria-components'; import { ChevrondownIcon } from '../Icons/ChevrondownIcon'; @@ -43,7 +43,7 @@ export interface SelectProps * the data. * */ -export function Select({ +export function Select({ label, description, errorMessage, @@ -73,7 +73,7 @@ export function Select({ {children} ) : ( - {(item: SelectItemObject) => ( + {(item) => ( {item.value} )} @@ -85,6 +85,11 @@ export function Select({ ); } +export type SelectItemObject = { + label: string; + value: string; +}; + export function SelectItem(props: ListBoxItemProps) { return ; } diff --git a/packages/components/src/components/Slider/Slider.tsx b/packages/components/src/components/Slider/Slider.tsx index f09e907195..4fab667edf 100644 --- a/packages/components/src/components/Slider/Slider.tsx +++ b/packages/components/src/components/Slider/Slider.tsx @@ -3,7 +3,7 @@ import { Label, Slider as RACSlider, SliderOutput, - SliderProps as RACSliderProps, + type SliderProps as RACSliderProps, SliderThumb, SliderTrack, } from 'react-aria-components'; diff --git a/packages/components/src/components/Switch/Switch.tsx b/packages/components/src/components/Switch/Switch.tsx index 5f0f2d0b64..0cd187b092 100644 --- a/packages/components/src/components/Switch/Switch.tsx +++ b/packages/components/src/components/Switch/Switch.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Switch as RACSwitch, - SwitchProps as RACSwitchProps, + type SwitchProps as RACSwitchProps, } from 'react-aria-components'; export interface SwitchProps extends Omit { diff --git a/packages/components/src/components/Tabs/Tabs.tsx b/packages/components/src/components/Tabs/Tabs.tsx index a0d4ab8cfd..7190ee2cee 100644 --- a/packages/components/src/components/Tabs/Tabs.tsx +++ b/packages/components/src/components/Tabs/Tabs.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Tabs as RACTabs, TabsProps } from 'react-aria-components'; +import { Tabs as RACTabs, type TabsProps } from 'react-aria-components'; export function Tabs(props: TabsProps) { return ; diff --git a/packages/components/src/components/TagGroup/TagGroup.tsx b/packages/components/src/components/TagGroup/TagGroup.tsx index 1424dea383..05230519f1 100644 --- a/packages/components/src/components/TagGroup/TagGroup.tsx +++ b/packages/components/src/components/TagGroup/TagGroup.tsx @@ -4,10 +4,10 @@ import { Label, Tag as RACTag, TagGroup as RACTagGroup, - TagGroupProps as RACTagGroupProps, + type TagGroupProps as RACTagGroupProps, TagList, - TagListProps, - TagProps, + type TagListProps, + type TagProps, Text, } from 'react-aria-components'; diff --git a/packages/components/src/components/TextAreaField/TextAreaField.tsx b/packages/components/src/components/TextAreaField/TextAreaField.tsx index e79f5e78bb..76ee55ea8d 100644 --- a/packages/components/src/components/TextAreaField/TextAreaField.tsx +++ b/packages/components/src/components/TextAreaField/TextAreaField.tsx @@ -5,8 +5,8 @@ import { Label, Text, TextField as RACTextField, - TextFieldProps as RACTextFieldProps, - ValidationResult, + type TextFieldProps as RACTextFieldProps, + type ValidationResult, } from 'react-aria-components'; export interface TextAreaFieldProps extends RACTextFieldProps { diff --git a/packages/components/src/components/TextField/TextField.tsx b/packages/components/src/components/TextField/TextField.tsx index 2b29fa3e79..1190aea2a1 100644 --- a/packages/components/src/components/TextField/TextField.tsx +++ b/packages/components/src/components/TextField/TextField.tsx @@ -5,8 +5,8 @@ import { Label, Text, TextField as RACTextField, - TextFieldProps as RACTextFieldProps, - ValidationResult, + type TextFieldProps as RACTextFieldProps, + type ValidationResult, } from 'react-aria-components'; export interface TextFieldProps extends RACTextFieldProps { diff --git a/packages/components/src/components/TimeField/TimeField.tsx b/packages/components/src/components/TimeField/TimeField.tsx index 4133c46c1c..c92e531326 100644 --- a/packages/components/src/components/TimeField/TimeField.tsx +++ b/packages/components/src/components/TimeField/TimeField.tsx @@ -6,9 +6,9 @@ import { Label, Text, TimeField as RACTimeField, - TimeFieldProps as RACTimeFieldProps, - TimeValue, - ValidationResult, + type TimeFieldProps as RACTimeFieldProps, + type TimeValue, + type ValidationResult, } from 'react-aria-components'; export interface TimeFieldProps diff --git a/packages/components/src/components/ToggleButton/ToggleButton.tsx b/packages/components/src/components/ToggleButton/ToggleButton.tsx index f7599fd6af..546d47fc2b 100644 --- a/packages/components/src/components/ToggleButton/ToggleButton.tsx +++ b/packages/components/src/components/ToggleButton/ToggleButton.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { ToggleButton as RACToggleButton, - ToggleButtonProps, + type ToggleButtonProps, } from 'react-aria-components'; export function ToggleButton(props: ToggleButtonProps) { diff --git a/packages/components/src/components/Toolbar/Toolbar.tsx b/packages/components/src/components/Toolbar/Toolbar.tsx index f2b151bcce..b99af182f4 100644 --- a/packages/components/src/components/Toolbar/Toolbar.tsx +++ b/packages/components/src/components/Toolbar/Toolbar.tsx @@ -1,5 +1,8 @@ import React from 'react'; -import { Toolbar as RACToolbar, ToolbarProps } from 'react-aria-components'; +import { + Toolbar as RACToolbar, + type ToolbarProps, +} from 'react-aria-components'; export function Toolbar(props: ToolbarProps) { return ; diff --git a/packages/components/src/components/Tooltip/Tooltip.tsx b/packages/components/src/components/Tooltip/Tooltip.tsx index 17213e6ce3..b629c5f39e 100644 --- a/packages/components/src/components/Tooltip/Tooltip.tsx +++ b/packages/components/src/components/Tooltip/Tooltip.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { OverlayArrow, Tooltip as RACTooltip, - TooltipProps as RACTooltipProps, + type TooltipProps as RACTooltipProps, } from 'react-aria-components'; export interface TooltipProps extends Omit { diff --git a/packages/components/src/components/quanta/Select/Select.tsx b/packages/components/src/components/quanta/Select/Select.tsx index 6e43494084..0f446c6b7d 100644 --- a/packages/components/src/components/quanta/Select/Select.tsx +++ b/packages/components/src/components/quanta/Select/Select.tsx @@ -1,8 +1,15 @@ import React from 'react'; import { SelectContext, PopoverContext } from 'react-aria-components'; -import { Select, SelectItem, SelectProps } from '../../Select/Select'; +import { + Select, + SelectItem, + type SelectProps, + type SelectItemObject, +} from '../../Select/Select'; -export function QuantaSelect(props: SelectProps) { +export function QuantaSelect( + props: SelectProps, +) { return ( diff --git a/packages/components/src/components/quanta/TextAreaField/TextAreaField.tsx b/packages/components/src/components/quanta/TextAreaField/TextAreaField.tsx index 449dd56d6d..b092fa86aa 100644 --- a/packages/components/src/components/quanta/TextAreaField/TextAreaField.tsx +++ b/packages/components/src/components/quanta/TextAreaField/TextAreaField.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { TextFieldContext } from 'react-aria-components'; import { TextAreaField, - TextAreaFieldProps, + type TextAreaFieldProps, } from '../../TextAreaField/TextAreaField'; export function QuantaTextAreaField(props: TextAreaFieldProps) { diff --git a/packages/components/src/components/quanta/TextField/TextField.tsx b/packages/components/src/components/quanta/TextField/TextField.tsx index eb222e5078..08e8ae7df9 100644 --- a/packages/components/src/components/quanta/TextField/TextField.tsx +++ b/packages/components/src/components/quanta/TextField/TextField.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { TextFieldContext } from 'react-aria-components'; -import { TextField, TextFieldProps } from '../../TextField/TextField'; +import { TextField, type TextFieldProps } from '../../TextField/TextField'; export function QuantaTextField(props: TextFieldProps) { return ( diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index 7bb0a59429..c682dc35d7 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -1,20 +1,25 @@ { "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": false, - "skipLibCheck": true, "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "ESNext", - "moduleResolution": "Node", + "skipLibCheck": true, + "target": "es2022", + "allowJs": true, "resolveJsonModule": true, + "moduleDetection": "force", "isolatedModules": true, + "verbatimModuleSyntax": true, + + "strict": true, + "noImplicitOverride": true, + + "lib": ["es2022", "dom", "dom.iterable"], + "module": "preserve", "noEmit": true, - "jsx": "react", + + "jsx": "react-jsx", + + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true }, "include": ["src", "./setupTesting.ts"], "exclude": [ diff --git a/packages/components/tsup.config.ts b/packages/components/tsup.config.ts new file mode 100644 index 0000000000..82b88a425c --- /dev/null +++ b/packages/components/tsup.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entryPoints: ['src/index.ts'], + format: ['cjs', 'esm'], + dts: true, + outDir: 'dist', + clean: true, +}); diff --git a/packages/components/vite.config.mts b/packages/components/vite.config.ts similarity index 100% rename from packages/components/vite.config.mts rename to packages/components/vite.config.ts diff --git a/packages/components/vitest.config.mts b/packages/components/vitest.config.ts similarity index 100% rename from packages/components/vitest.config.mts rename to packages/components/vitest.config.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a1570cd860..ffd7a3055d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -477,24 +477,9 @@ importers: specifier: ^16.8.0 || ^17.0.0 || ^18.0.0 version: 18.2.0(react@18.2.0) devDependencies: - '@parcel/config-default': - specifier: ^2.12.0 - version: 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.10))(@swc/helpers@0.5.10)(postcss@8.4.47)(relateurl@0.2.7)(srcset@4.0.0)(terser@5.30.3)(typescript@5.6.3) - '@parcel/core': - specifier: ^2.12.0 - version: 2.12.0(@swc/helpers@0.5.10) - '@parcel/packager-ts': - specifier: ^2.12.0 - version: 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.10))(@swc/helpers@0.5.10) - '@parcel/transformer-js': - specifier: ^2.12.0 - version: 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.10)) - '@parcel/transformer-react-refresh-wrap': - specifier: ^2.12.0 - version: 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.10))(@swc/helpers@0.5.10) - '@parcel/transformer-typescript-types': - specifier: ^2.12.0 - version: 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.10))(@swc/helpers@0.5.10)(typescript@5.6.3) + '@arethetypeswrong/cli': + specifier: ^0.16.4 + version: 0.16.4 '@plone/types': specifier: 'workspace: *' version: link:../types @@ -567,15 +552,15 @@ importers: lightningcss-cli: specifier: ^1.24.0 version: 1.24.1 - parcel: - specifier: ^2.12.0 - version: 2.12.0(@swc/helpers@0.5.10)(postcss@8.4.47)(relateurl@0.2.7)(srcset@4.0.0)(terser@5.30.3)(typescript@5.6.3) release-it: specifier: 17.1.1 version: 17.1.1(typescript@5.6.3) storybook: specifier: ^8.0.4 version: 8.0.8(@babel/preset-env@7.24.4(@babel/core@7.24.4))(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + tsup: + specifier: ^8.3.5 + version: 8.3.5(@microsoft/api-extractor@7.43.0(@types/node@20.12.7))(@swc/core@1.4.16(@swc/helpers@0.5.10))(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.6.3) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -7209,10 +7194,6 @@ packages: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - ansi-regex@6.0.1: - resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} - engines: {node: '>=12'} - ansi-regex@6.1.0: resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} engines: {node: '>=12'} @@ -17654,7 +17635,7 @@ snapshots: dependencies: '@arethetypeswrong/core': 0.16.4 chalk: 4.1.2 - cli-table3: 0.6.4 + cli-table3: 0.6.5 commander: 10.0.1 marked: 9.1.6 marked-terminal: 7.2.1(marked@9.1.6) @@ -17681,12 +17662,12 @@ snapshots: '@babel/code-frame@7.24.2': dependencies: '@babel/highlight': 7.24.2 - picocolors: 1.1.0 + picocolors: 1.1.1 '@babel/code-frame@7.25.7': dependencies: '@babel/highlight': 7.25.7 - picocolors: 1.1.0 + picocolors: 1.1.1 '@babel/compat-data@7.24.4': {} @@ -17931,14 +17912,14 @@ snapshots: '@babel/helper-validator-identifier': 7.22.20 chalk: 2.4.2 js-tokens: 4.0.0 - picocolors: 1.1.0 + picocolors: 1.1.1 '@babel/highlight@7.25.7': dependencies: '@babel/helper-validator-identifier': 7.25.7 chalk: 2.4.2 js-tokens: 4.0.0 - picocolors: 1.1.0 + picocolors: 1.1.1 '@babel/parser@7.24.4': dependencies: @@ -20937,7 +20918,7 @@ snapshots: browserslist: 4.23.0 json5: 2.2.3 nullthrows: 1.1.1 - semver: 7.6.0 + semver: 7.6.3 transitivePeerDependencies: - '@parcel/core' - '@swc/helpers' @@ -20964,7 +20945,7 @@ snapshots: posthtml: 0.16.6 posthtml-parser: 0.10.2 posthtml-render: 3.0.0 - semver: 7.6.0 + semver: 7.6.3 srcset: 4.0.0 transitivePeerDependencies: - '@parcel/core' @@ -20993,7 +20974,7 @@ snapshots: browserslist: 4.23.0 nullthrows: 1.1.1 regenerator-runtime: 0.13.11 - semver: 7.6.0 + semver: 7.6.3 '@parcel/transformer-json@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.10))(@swc/helpers@0.5.10)': dependencies: @@ -21012,7 +20993,7 @@ snapshots: clone: 2.1.2 nullthrows: 1.1.1 postcss-value-parser: 4.2.0 - semver: 7.6.0 + semver: 7.6.3 transitivePeerDependencies: - '@parcel/core' - '@swc/helpers' @@ -21025,7 +21006,7 @@ snapshots: posthtml: 0.16.6 posthtml-parser: 0.10.2 posthtml-render: 3.0.0 - semver: 7.6.0 + semver: 7.6.3 transitivePeerDependencies: - '@parcel/core' - '@swc/helpers' @@ -21055,7 +21036,7 @@ snapshots: posthtml: 0.16.6 posthtml-parser: 0.10.2 posthtml-render: 3.0.0 - semver: 7.6.0 + semver: 7.6.3 transitivePeerDependencies: - '@parcel/core' - '@swc/helpers' @@ -22978,7 +22959,7 @@ snapshots: magic-string: 0.30.10 path-browserify: 1.0.1 process: 0.11.10 - semver: 7.6.0 + semver: 7.6.3 style-loader: 3.3.1(webpack@5.90.1(esbuild@0.20.2)) terser-webpack-plugin: 5.3.6(esbuild@0.20.2)(webpack@5.90.1(esbuild@0.20.2)) ts-dedent: 2.2.0 @@ -23041,7 +23022,7 @@ snapshots: prettier: 3.2.5 prompts: 2.4.2 read-pkg-up: 7.0.1 - semver: 7.6.0 + semver: 7.6.3 strip-json-comments: 3.1.1 tempy: 1.0.1 tiny-invariant: 1.3.3 @@ -23158,7 +23139,7 @@ snapshots: '@types/semver': 7.5.8 better-opn: 3.0.2 chalk: 4.1.2 - cli-table3: 0.6.4 + cli-table3: 0.6.5 compression: 1.7.4 detect-port: 1.5.1 express: 4.19.2 @@ -23299,7 +23280,7 @@ snapshots: react-docgen: 7.0.3 react-dom: 18.2.0(react@18.2.0) resolve: 1.22.8 - semver: 7.6.0 + semver: 7.6.3 tsconfig-paths: 4.2.0 webpack: 5.90.1(esbuild@0.20.2) optionalDependencies: @@ -24459,7 +24440,7 @@ snapshots: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.6.3) eslint: 8.57.0 eslint-scope: 5.1.1 - semver: 7.6.0 + semver: 7.6.3 transitivePeerDependencies: - supports-color - typescript @@ -25072,8 +25053,6 @@ snapshots: ansi-regex@5.0.1: {} - ansi-regex@6.0.1: {} - ansi-regex@6.1.0: {} ansi-styles@2.2.1: {} @@ -26310,7 +26289,7 @@ snapshots: chokidar@3.6.0: dependencies: anymatch: 3.1.3 - braces: 3.0.3 + braces: 3.0.2 glob-parent: 5.1.2 is-binary-path: 2.1.0 is-glob: 4.0.3 @@ -34329,7 +34308,7 @@ snapshots: postcss@8.4.47: dependencies: nanoid: 3.3.7 - picocolors: 1.1.0 + picocolors: 1.1.1 source-map-js: 1.2.1 posthtml-parser@0.10.2: @@ -36796,7 +36775,7 @@ snapshots: strip-ansi@7.1.0: dependencies: - ansi-regex: 6.0.1 + ansi-regex: 6.1.0 strip-bom-buf@1.0.0: dependencies: @@ -37777,13 +37756,13 @@ snapshots: dependencies: browserslist: 4.23.0 escalade: 3.1.2 - picocolors: 1.1.0 + picocolors: 1.1.1 update-browserslist-db@1.1.1(browserslist@4.24.0): dependencies: browserslist: 4.24.0 escalade: 3.2.0 - picocolors: 1.1.0 + picocolors: 1.1.1 update-notifier@5.1.0: dependencies: @@ -37815,7 +37794,7 @@ snapshots: is-yarn-global: 0.4.1 latest-version: 7.0.0 pupa: 3.1.0 - semver: 7.5.4 + semver: 7.6.3 semver-diff: 4.0.0 xdg-basedir: 5.1.0 @@ -38081,7 +38060,7 @@ snapshots: cac: 6.7.14 debug: 4.3.4(supports-color@8.1.1) pathe: 1.1.2 - picocolors: 1.1.0 + picocolors: 1.1.1 vite: 5.4.9(@types/node@20.12.7)(less@3.11.1)(lightningcss@1.24.1)(sass@1.75.0)(terser@5.30.3) transitivePeerDependencies: - '@types/node'