@mich8060/unified-design-system 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.lib.md +103 -0
- package/README.md +265 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +103 -0
- package/dist/package.json +49 -0
- package/dist/styles.css +20544 -0
- package/dist/uds-components.es.js +67031 -0
- package/dist/uds-components.es.js.map +1 -0
- package/dist/uds-components.umd.js +67048 -0
- package/dist/uds-components.umd.js.map +1 -0
- package/package.json +158 -0
- package/src/styles/_typography.scss +932 -0
- package/src/styles/_utilities.scss +3738 -0
- package/src/styles/_variables.scss +620 -0
- package/src/styles/prism-custom.css +204 -0
- package/src/styles/prism-custom.scss +205 -0
- package/src/styles/tokens.css +1463 -0
- package/src/styles/tokens.scss +1116 -0
- package/src/ui/Accordion/Accordion.ai.md +69 -0
- package/src/ui/Accordion/Accordion.scss +87 -0
- package/src/ui/Accordion/Accordion.spec.ts +25 -0
- package/src/ui/Accordion/Accordion.stories.tsx +46 -0
- package/src/ui/Accordion/Accordion.test.tsx +54 -0
- package/src/ui/Accordion/Accordion.tsx +73 -0
- package/src/ui/Accordion/Accordion.types.ts +15 -0
- package/src/ui/Accordion/index.js +1 -0
- package/src/ui/ActionMenu/ActionMenu.ai.md +106 -0
- package/src/ui/ActionMenu/ActionMenu.jsx +437 -0
- package/src/ui/ActionMenu/ActionMenu.scss +252 -0
- package/src/ui/ActionMenu/ActionMenu.spec.ts +12 -0
- package/src/ui/ActionMenu/ActionMenu.stories.jsx +14 -0
- package/src/ui/ActionMenu/ActionMenu.stories.tsx +124 -0
- package/src/ui/ActionMenu/ActionMenu.test.tsx +1 -0
- package/src/ui/ActionMenu/ActionMenu.tsx +6 -0
- package/src/ui/ActionMenu/ActionMenu.types.ts +3 -0
- package/src/ui/ActionMenu/index.js +1 -0
- package/src/ui/Avatar/Avatar.ai.md +54 -0
- package/src/ui/Avatar/Avatar.jsx +49 -0
- package/src/ui/Avatar/Avatar.scss +87 -0
- package/src/ui/Avatar/Avatar.spec.ts +12 -0
- package/src/ui/Avatar/Avatar.stories.jsx +14 -0
- package/src/ui/Avatar/Avatar.stories.tsx +14 -0
- package/src/ui/Avatar/Avatar.test.tsx +1 -0
- package/src/ui/Avatar/Avatar.tsx +6 -0
- package/src/ui/Avatar/Avatar.types.ts +3 -0
- package/src/ui/Avatar/index.js +1 -0
- package/src/ui/Badge/Badge.ai.md +37 -0
- package/src/ui/Badge/Badge.jsx +64 -0
- package/src/ui/Badge/Badge.scss +84 -0
- package/src/ui/Badge/Badge.spec.ts +12 -0
- package/src/ui/Badge/Badge.stories.jsx +14 -0
- package/src/ui/Badge/Badge.stories.tsx +14 -0
- package/src/ui/Badge/Badge.test.tsx +1 -0
- package/src/ui/Badge/Badge.tsx +6 -0
- package/src/ui/Badge/Badge.types.ts +3 -0
- package/src/ui/Badge/index.js +1 -0
- package/src/ui/Branding/Branding.ai.md +81 -0
- package/src/ui/Branding/Branding.jsx +127 -0
- package/src/ui/Branding/Branding.scss +57 -0
- package/src/ui/Branding/Branding.spec.ts +12 -0
- package/src/ui/Branding/Branding.stories.jsx +14 -0
- package/src/ui/Branding/Branding.stories.tsx +14 -0
- package/src/ui/Branding/Branding.test.tsx +1 -0
- package/src/ui/Branding/Branding.tsx +6 -0
- package/src/ui/Branding/Branding.types.ts +3 -0
- package/src/ui/Branding/index.js +1 -0
- package/src/ui/Breadcrumb/Breadcrumb.ai.md +50 -0
- package/src/ui/Breadcrumb/Breadcrumb.jsx +167 -0
- package/src/ui/Breadcrumb/Breadcrumb.scss +46 -0
- package/src/ui/Breadcrumb/Breadcrumb.spec.ts +12 -0
- package/src/ui/Breadcrumb/Breadcrumb.stories.jsx +26 -0
- package/src/ui/Breadcrumb/Breadcrumb.stories.tsx +14 -0
- package/src/ui/Breadcrumb/Breadcrumb.test.tsx +1 -0
- package/src/ui/Breadcrumb/Breadcrumb.tsx +6 -0
- package/src/ui/Breadcrumb/Breadcrumb.types.ts +3 -0
- package/src/ui/Breadcrumb/index.js +2 -0
- package/src/ui/Button/Button.ai.md +122 -0
- package/src/ui/Button/Button.figma.tsx +49 -0
- package/src/ui/Button/Button.scss +188 -0
- package/src/ui/Button/Button.spec.ts +52 -0
- package/src/ui/Button/Button.stories.tsx +199 -0
- package/src/ui/Button/Button.test.tsx +85 -0
- package/src/ui/Button/Button.tsx +131 -0
- package/src/ui/Button/Button.types.ts +32 -0
- package/src/ui/Button/index.js +1 -0
- package/src/ui/Calendar/Calendar.ai.md +151 -0
- package/src/ui/Calendar/Calendar.jsx +504 -0
- package/src/ui/Calendar/Calendar.scss +451 -0
- package/src/ui/Calendar/Calendar.spec.ts +12 -0
- package/src/ui/Calendar/Calendar.stories.jsx +14 -0
- package/src/ui/Calendar/Calendar.stories.tsx +14 -0
- package/src/ui/Calendar/Calendar.test.tsx +1 -0
- package/src/ui/Calendar/Calendar.tsx +6 -0
- package/src/ui/Calendar/Calendar.types.ts +3 -0
- package/src/ui/Calendar/index.js +1 -0
- package/src/ui/Card/Card.ai.md +41 -0
- package/src/ui/Card/Card.jsx +25 -0
- package/src/ui/Card/Card.scss +47 -0
- package/src/ui/Card/Card.spec.ts +12 -0
- package/src/ui/Card/Card.stories.jsx +28 -0
- package/src/ui/Card/Card.stories.tsx +14 -0
- package/src/ui/Card/Card.test.tsx +1 -0
- package/src/ui/Card/Card.tsx +6 -0
- package/src/ui/Card/Card.types.ts +3 -0
- package/src/ui/Card/index.js +1 -0
- package/src/ui/Checkbox/Checkbox.ai.md +50 -0
- package/src/ui/Checkbox/Checkbox.jsx +73 -0
- package/src/ui/Checkbox/Checkbox.scss +115 -0
- package/src/ui/Checkbox/Checkbox.spec.ts +12 -0
- package/src/ui/Checkbox/Checkbox.stories.jsx +14 -0
- package/src/ui/Checkbox/Checkbox.stories.tsx +14 -0
- package/src/ui/Checkbox/Checkbox.test.tsx +1 -0
- package/src/ui/Checkbox/Checkbox.tsx +6 -0
- package/src/ui/Checkbox/Checkbox.types.ts +3 -0
- package/src/ui/Checkbox/index.js +1 -0
- package/src/ui/Chip/Chip.ai.md +43 -0
- package/src/ui/Chip/Chip.jsx +102 -0
- package/src/ui/Chip/Chip.scss +118 -0
- package/src/ui/Chip/Chip.spec.ts +12 -0
- package/src/ui/Chip/Chip.stories.jsx +14 -0
- package/src/ui/Chip/Chip.stories.tsx +14 -0
- package/src/ui/Chip/Chip.test.tsx +1 -0
- package/src/ui/Chip/Chip.tsx +6 -0
- package/src/ui/Chip/Chip.types.ts +3 -0
- package/src/ui/Chip/index.js +1 -0
- package/src/ui/Datepicker/Datepicker.ai.md +45 -0
- package/src/ui/Datepicker/Datepicker.jsx +330 -0
- package/src/ui/Datepicker/Datepicker.scss +206 -0
- package/src/ui/Datepicker/Datepicker.spec.ts +12 -0
- package/src/ui/Datepicker/Datepicker.stories.jsx +14 -0
- package/src/ui/Datepicker/Datepicker.stories.tsx +14 -0
- package/src/ui/Datepicker/Datepicker.test.tsx +1 -0
- package/src/ui/Datepicker/Datepicker.tsx +6 -0
- package/src/ui/Datepicker/Datepicker.types.ts +3 -0
- package/src/ui/Datepicker/index.js +2 -0
- package/src/ui/Divider/Divider.ai.md +34 -0
- package/src/ui/Divider/Divider.jsx +89 -0
- package/src/ui/Divider/Divider.scss +116 -0
- package/src/ui/Divider/Divider.spec.ts +12 -0
- package/src/ui/Divider/Divider.stories.jsx +14 -0
- package/src/ui/Divider/Divider.stories.tsx +14 -0
- package/src/ui/Divider/Divider.test.tsx +1 -0
- package/src/ui/Divider/Divider.tsx +6 -0
- package/src/ui/Divider/Divider.types.ts +3 -0
- package/src/ui/Divider/index.js +1 -0
- package/src/ui/DotStatus/DotStatus.ai.md +36 -0
- package/src/ui/DotStatus/DotStatus.jsx +64 -0
- package/src/ui/DotStatus/DotStatus.scss +87 -0
- package/src/ui/DotStatus/DotStatus.spec.ts +12 -0
- package/src/ui/DotStatus/DotStatus.stories.jsx +14 -0
- package/src/ui/DotStatus/DotStatus.stories.tsx +14 -0
- package/src/ui/DotStatus/DotStatus.test.tsx +1 -0
- package/src/ui/DotStatus/DotStatus.tsx +6 -0
- package/src/ui/DotStatus/DotStatus.types.ts +3 -0
- package/src/ui/DotStatus/index.js +1 -0
- package/src/ui/Dropdown/Dropdown.ai.md +118 -0
- package/src/ui/Dropdown/Dropdown.scss +129 -0
- package/src/ui/Dropdown/Dropdown.spec.ts +54 -0
- package/src/ui/Dropdown/Dropdown.stories.tsx +59 -0
- package/src/ui/Dropdown/Dropdown.test.tsx +37 -0
- package/src/ui/Dropdown/Dropdown.tsx +119 -0
- package/src/ui/Dropdown/Dropdown.types.ts +25 -0
- package/src/ui/Dropdown/index.js +1 -0
- package/src/ui/EventCard/EventCard.ai.md +101 -0
- package/src/ui/EventCard/EventCard.jsx +92 -0
- package/src/ui/EventCard/EventCard.scss +186 -0
- package/src/ui/EventCard/EventCard.spec.ts +12 -0
- package/src/ui/EventCard/EventCard.stories.jsx +14 -0
- package/src/ui/EventCard/EventCard.stories.tsx +14 -0
- package/src/ui/EventCard/EventCard.test.tsx +1 -0
- package/src/ui/EventCard/EventCard.tsx +6 -0
- package/src/ui/EventCard/EventCard.types.ts +3 -0
- package/src/ui/EventCard/index.js +1 -0
- package/src/ui/Field/Field.ai.md +69 -0
- package/src/ui/Field/Field.jsx +89 -0
- package/src/ui/Field/Field.scss +76 -0
- package/src/ui/Field/Field.spec.ts +12 -0
- package/src/ui/Field/Field.stories.jsx +14 -0
- package/src/ui/Field/Field.stories.tsx +14 -0
- package/src/ui/Field/Field.test.tsx +1 -0
- package/src/ui/Field/Field.tsx +6 -0
- package/src/ui/Field/Field.types.ts +3 -0
- package/src/ui/Field/index.js +1 -0
- package/src/ui/FileUpload/FileUpload.ai.md +38 -0
- package/src/ui/FileUpload/FileUpload.figma.tsx +28 -0
- package/src/ui/FileUpload/FileUpload.jsx +153 -0
- package/src/ui/FileUpload/FileUpload.scss +78 -0
- package/src/ui/FileUpload/FileUpload.spec.ts +12 -0
- package/src/ui/FileUpload/FileUpload.stories.jsx +14 -0
- package/src/ui/FileUpload/FileUpload.stories.tsx +14 -0
- package/src/ui/FileUpload/FileUpload.test.tsx +1 -0
- package/src/ui/FileUpload/FileUpload.tsx +6 -0
- package/src/ui/FileUpload/FileUpload.types.ts +3 -0
- package/src/ui/FileUpload/index.js +2 -0
- package/src/ui/Flex/Flex.ai.md +130 -0
- package/src/ui/Flex/Flex.jsx +53 -0
- package/src/ui/Flex/Flex.scss +119 -0
- package/src/ui/Flex/Flex.spec.ts +12 -0
- package/src/ui/Flex/Flex.stories.jsx +14 -0
- package/src/ui/Flex/Flex.stories.tsx +14 -0
- package/src/ui/Flex/Flex.test.tsx +1 -0
- package/src/ui/Flex/Flex.tsx +6 -0
- package/src/ui/Flex/Flex.types.ts +3 -0
- package/src/ui/Flex/index.js +1 -0
- package/src/ui/Icon/Icon.ai.md +46 -0
- package/src/ui/Icon/Icon.figma.tsx +22 -0
- package/src/ui/Icon/Icon.jsx +47 -0
- package/src/ui/Icon/Icon.scss +1 -0
- package/src/ui/Icon/Icon.spec.ts +12 -0
- package/src/ui/Icon/Icon.stories.jsx +14 -0
- package/src/ui/Icon/Icon.stories.tsx +14 -0
- package/src/ui/Icon/Icon.test.tsx +1 -0
- package/src/ui/Icon/Icon.tsx +6 -0
- package/src/ui/Icon/Icon.types.ts +3 -0
- package/src/ui/Icon/index.js +1 -0
- package/src/ui/ImageAspect/ImageAspect.ai.md +37 -0
- package/src/ui/ImageAspect/ImageAspect.jsx +56 -0
- package/src/ui/ImageAspect/ImageAspect.scss +62 -0
- package/src/ui/ImageAspect/ImageAspect.spec.ts +12 -0
- package/src/ui/ImageAspect/ImageAspect.stories.jsx +14 -0
- package/src/ui/ImageAspect/ImageAspect.stories.tsx +14 -0
- package/src/ui/ImageAspect/ImageAspect.test.tsx +1 -0
- package/src/ui/ImageAspect/ImageAspect.tsx +6 -0
- package/src/ui/ImageAspect/ImageAspect.types.ts +3 -0
- package/src/ui/ImageAspect/index.js +1 -0
- package/src/ui/Input/Input.ai.md +89 -0
- package/src/ui/Input/Input.figma.tsx +35 -0
- package/src/ui/Input/Input.scss +126 -0
- package/src/ui/Input/Input.spec.ts +54 -0
- package/src/ui/Input/Input.stories.tsx +72 -0
- package/src/ui/Input/Input.test.tsx +70 -0
- package/src/ui/Input/Input.tsx +91 -0
- package/src/ui/Input/Input.types.ts +22 -0
- package/src/ui/Input/index.js +2 -0
- package/src/ui/Key/Key.ai.md +31 -0
- package/src/ui/Key/Key.jsx +37 -0
- package/src/ui/Key/Key.scss +31 -0
- package/src/ui/Key/Key.spec.ts +12 -0
- package/src/ui/Key/Key.stories.jsx +14 -0
- package/src/ui/Key/Key.stories.tsx +14 -0
- package/src/ui/Key/Key.test.tsx +1 -0
- package/src/ui/Key/Key.tsx +6 -0
- package/src/ui/Key/Key.types.ts +3 -0
- package/src/ui/Key/index.js +1 -0
- package/src/ui/Menu/Menu.jsx +232 -0
- package/src/ui/Menu/Menu.scss +370 -0
- package/src/ui/Menu/Menu.spec.ts +12 -0
- package/src/ui/Menu/Menu.stories.jsx +41 -0
- package/src/ui/Menu/Menu.stories.tsx +14 -0
- package/src/ui/Menu/Menu.test.tsx +1 -0
- package/src/ui/Menu/Menu.tsx +6 -0
- package/src/ui/Menu/Menu.types.ts +3 -0
- package/src/ui/Menu/index.js +1 -0
- package/src/ui/MicroCalendar/MicroCalendar.ai.md +35 -0
- package/src/ui/MicroCalendar/MicroCalendar.jsx +393 -0
- package/src/ui/MicroCalendar/MicroCalendar.scss +289 -0
- package/src/ui/MicroCalendar/MicroCalendar.spec.ts +12 -0
- package/src/ui/MicroCalendar/MicroCalendar.stories.jsx +14 -0
- package/src/ui/MicroCalendar/MicroCalendar.stories.tsx +14 -0
- package/src/ui/MicroCalendar/MicroCalendar.test.tsx +1 -0
- package/src/ui/MicroCalendar/MicroCalendar.tsx +6 -0
- package/src/ui/MicroCalendar/MicroCalendar.types.ts +3 -0
- package/src/ui/MicroCalendar/index.js +1 -0
- package/src/ui/Modal/Modal.ai.md +150 -0
- package/src/ui/Modal/Modal.jsx +173 -0
- package/src/ui/Modal/Modal.scss +179 -0
- package/src/ui/Modal/Modal.spec.ts +12 -0
- package/src/ui/Modal/Modal.stories.jsx +14 -0
- package/src/ui/Modal/Modal.stories.tsx +14 -0
- package/src/ui/Modal/Modal.test.tsx +1 -0
- package/src/ui/Modal/Modal.tsx +6 -0
- package/src/ui/Modal/Modal.types.ts +3 -0
- package/src/ui/Modal/index.js +1 -0
- package/src/ui/Pagination/Pagination.ai.md +30 -0
- package/src/ui/Pagination/Pagination.jsx +237 -0
- package/src/ui/Pagination/Pagination.scss +182 -0
- package/src/ui/Pagination/Pagination.spec.ts +12 -0
- package/src/ui/Pagination/Pagination.stories.jsx +14 -0
- package/src/ui/Pagination/Pagination.stories.tsx +14 -0
- package/src/ui/Pagination/Pagination.test.tsx +1 -0
- package/src/ui/Pagination/Pagination.tsx +6 -0
- package/src/ui/Pagination/Pagination.types.ts +3 -0
- package/src/ui/Pagination/index.js +1 -0
- package/src/ui/PillToggle/PillToggle.ai.md +44 -0
- package/src/ui/PillToggle/PillToggle.jsx +56 -0
- package/src/ui/PillToggle/PillToggle.scss +84 -0
- package/src/ui/PillToggle/PillToggle.spec.ts +12 -0
- package/src/ui/PillToggle/PillToggle.stories.jsx +14 -0
- package/src/ui/PillToggle/PillToggle.stories.tsx +14 -0
- package/src/ui/PillToggle/PillToggle.test.tsx +1 -0
- package/src/ui/PillToggle/PillToggle.tsx +6 -0
- package/src/ui/PillToggle/PillToggle.types.ts +3 -0
- package/src/ui/PillToggle/index.js +1 -0
- package/src/ui/Playground/Playground.ai.md +96 -0
- package/src/ui/Playground/Playground.jsx +524 -0
- package/src/ui/Playground/Playground.scss +310 -0
- package/src/ui/Playground/Playground.spec.ts +12 -0
- package/src/ui/Playground/Playground.stories.jsx +14 -0
- package/src/ui/Playground/Playground.stories.tsx +14 -0
- package/src/ui/Playground/Playground.test.tsx +1 -0
- package/src/ui/Playground/Playground.tsx +6 -0
- package/src/ui/Playground/Playground.types.ts +3 -0
- package/src/ui/Playground/index.js +2 -0
- package/src/ui/ProgressCircle/ProgressCircle.ai.md +36 -0
- package/src/ui/ProgressCircle/ProgressCircle.jsx +147 -0
- package/src/ui/ProgressCircle/ProgressCircle.scss +143 -0
- package/src/ui/ProgressCircle/ProgressCircle.spec.ts +12 -0
- package/src/ui/ProgressCircle/ProgressCircle.stories.jsx +14 -0
- package/src/ui/ProgressCircle/ProgressCircle.stories.tsx +14 -0
- package/src/ui/ProgressCircle/ProgressCircle.test.tsx +1 -0
- package/src/ui/ProgressCircle/ProgressCircle.tsx +6 -0
- package/src/ui/ProgressCircle/ProgressCircle.types.ts +3 -0
- package/src/ui/ProgressCircle/index.js +1 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.ai.md +27 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.jsx +92 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.scss +133 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.spec.ts +12 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.stories.jsx +14 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.stories.tsx +14 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.test.tsx +1 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.tsx +6 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.types.ts +3 -0
- package/src/ui/ProgressIndicator/index.js +1 -0
- package/src/ui/Radio/Radio.ai.md +53 -0
- package/src/ui/Radio/Radio.jsx +57 -0
- package/src/ui/Radio/Radio.scss +89 -0
- package/src/ui/Radio/Radio.spec.ts +12 -0
- package/src/ui/Radio/Radio.stories.jsx +14 -0
- package/src/ui/Radio/Radio.stories.tsx +14 -0
- package/src/ui/Radio/Radio.test.tsx +1 -0
- package/src/ui/Radio/Radio.tsx +6 -0
- package/src/ui/Radio/Radio.types.ts +3 -0
- package/src/ui/Radio/index.js +1 -0
- package/src/ui/Slider/Slider.ai.md +33 -0
- package/src/ui/Slider/Slider.jsx +283 -0
- package/src/ui/Slider/Slider.scss +156 -0
- package/src/ui/Slider/Slider.spec.ts +12 -0
- package/src/ui/Slider/Slider.stories.jsx +14 -0
- package/src/ui/Slider/Slider.stories.tsx +14 -0
- package/src/ui/Slider/Slider.test.tsx +1 -0
- package/src/ui/Slider/Slider.tsx +6 -0
- package/src/ui/Slider/Slider.types.ts +3 -0
- package/src/ui/Slider/index.js +1 -0
- package/src/ui/Status/Status.ai.md +36 -0
- package/src/ui/Status/Status.jsx +66 -0
- package/src/ui/Status/Status.scss +90 -0
- package/src/ui/Status/Status.spec.ts +12 -0
- package/src/ui/Status/Status.stories.jsx +14 -0
- package/src/ui/Status/Status.stories.tsx +14 -0
- package/src/ui/Status/Status.test.tsx +1 -0
- package/src/ui/Status/Status.tsx +6 -0
- package/src/ui/Status/Status.types.ts +3 -0
- package/src/ui/Status/index.js +1 -0
- package/src/ui/Steps/Steps.ai.md +56 -0
- package/src/ui/Steps/Steps.jsx +201 -0
- package/src/ui/Steps/Steps.scss +240 -0
- package/src/ui/Steps/Steps.spec.ts +12 -0
- package/src/ui/Steps/Steps.stories.jsx +14 -0
- package/src/ui/Steps/Steps.stories.tsx +14 -0
- package/src/ui/Steps/Steps.test.tsx +1 -0
- package/src/ui/Steps/Steps.tsx +6 -0
- package/src/ui/Steps/Steps.types.ts +3 -0
- package/src/ui/Steps/index.js +1 -0
- package/src/ui/Table/Table.ai.md +108 -0
- package/src/ui/Table/Table.jsx +143 -0
- package/src/ui/Table/Table.scss +90 -0
- package/src/ui/Table/Table.spec.ts +12 -0
- package/src/ui/Table/Table.stories.jsx +14 -0
- package/src/ui/Table/Table.stories.tsx +14 -0
- package/src/ui/Table/Table.test.tsx +1 -0
- package/src/ui/Table/Table.tsx +6 -0
- package/src/ui/Table/Table.types.ts +3 -0
- package/src/ui/Table/index.js +1 -0
- package/src/ui/Tabs/TabItem.jsx +80 -0
- package/src/ui/Tabs/Tabs.ai.md +52 -0
- package/src/ui/Tabs/Tabs.figma.tsx +30 -0
- package/src/ui/Tabs/Tabs.jsx +318 -0
- package/src/ui/Tabs/Tabs.scss +164 -0
- package/src/ui/Tabs/Tabs.spec.ts +12 -0
- package/src/ui/Tabs/Tabs.stories.jsx +18 -0
- package/src/ui/Tabs/Tabs.stories.tsx +14 -0
- package/src/ui/Tabs/Tabs.test.tsx +1 -0
- package/src/ui/Tabs/Tabs.tsx +6 -0
- package/src/ui/Tabs/Tabs.types.ts +3 -0
- package/src/ui/Tabs/index.js +3 -0
- package/src/ui/Tag/Tag.ai.md +59 -0
- package/src/ui/Tag/Tag.figma.tsx +29 -0
- package/src/ui/Tag/Tag.jsx +93 -0
- package/src/ui/Tag/Tag.scss +258 -0
- package/src/ui/Tag/Tag.spec.ts +12 -0
- package/src/ui/Tag/Tag.stories.jsx +14 -0
- package/src/ui/Tag/Tag.stories.tsx +14 -0
- package/src/ui/Tag/Tag.test.tsx +1 -0
- package/src/ui/Tag/Tag.tsx +6 -0
- package/src/ui/Tag/Tag.types.ts +3 -0
- package/src/ui/Tag/index.js +2 -0
- package/src/ui/Textarea/Textarea.ai.md +40 -0
- package/src/ui/Textarea/Textarea.figma.tsx +35 -0
- package/src/ui/Textarea/Textarea.jsx +68 -0
- package/src/ui/Textarea/Textarea.scss +71 -0
- package/src/ui/Textarea/Textarea.spec.ts +12 -0
- package/src/ui/Textarea/Textarea.stories.jsx +14 -0
- package/src/ui/Textarea/Textarea.stories.tsx +14 -0
- package/src/ui/Textarea/Textarea.test.tsx +1 -0
- package/src/ui/Textarea/Textarea.tsx +6 -0
- package/src/ui/Textarea/Textarea.types.ts +3 -0
- package/src/ui/Textarea/index.js +2 -0
- package/src/ui/Toast/Toast.ai.md +47 -0
- package/src/ui/Toast/Toast.jsx +75 -0
- package/src/ui/Toast/Toast.scss +132 -0
- package/src/ui/Toast/Toast.spec.ts +12 -0
- package/src/ui/Toast/Toast.stories.jsx +14 -0
- package/src/ui/Toast/Toast.stories.tsx +14 -0
- package/src/ui/Toast/Toast.test.tsx +1 -0
- package/src/ui/Toast/Toast.tsx +6 -0
- package/src/ui/Toast/Toast.types.ts +3 -0
- package/src/ui/Toast/index.js +2 -0
- package/src/ui/Toggle/Toggle.ai.md +37 -0
- package/src/ui/Toggle/Toggle.jsx +73 -0
- package/src/ui/Toggle/Toggle.scss +139 -0
- package/src/ui/Toggle/Toggle.spec.ts +12 -0
- package/src/ui/Toggle/Toggle.stories.jsx +14 -0
- package/src/ui/Toggle/Toggle.stories.tsx +14 -0
- package/src/ui/Toggle/Toggle.test.tsx +1 -0
- package/src/ui/Toggle/Toggle.tsx +6 -0
- package/src/ui/Toggle/Toggle.types.ts +3 -0
- package/src/ui/Toggle/index.js +1 -0
- package/src/ui/Tooltip/Tooltip.ai.md +33 -0
- package/src/ui/Tooltip/Tooltip.figma.tsx +24 -0
- package/src/ui/Tooltip/Tooltip.jsx +125 -0
- package/src/ui/Tooltip/Tooltip.scss +80 -0
- package/src/ui/Tooltip/Tooltip.spec.ts +12 -0
- package/src/ui/Tooltip/Tooltip.stories.jsx +14 -0
- package/src/ui/Tooltip/Tooltip.stories.tsx +14 -0
- package/src/ui/Tooltip/Tooltip.test.tsx +1 -0
- package/src/ui/Tooltip/Tooltip.tsx +6 -0
- package/src/ui/Tooltip/Tooltip.types.ts +3 -0
- package/src/ui/Tooltip/index.js +2 -0
- package/src/ui/UDS/UDS.jsx +52 -0
- package/src/ui/UDS/UDS.scss +49 -0
- package/src/ui/UDS/UDS.spec.ts +12 -0
- package/src/ui/UDS/UDS.stories.jsx +22 -0
- package/src/ui/UDS/UDS.stories.tsx +14 -0
- package/src/ui/UDS/UDS.test.tsx +1 -0
- package/src/ui/UDS/UDS.tsx +6 -0
- package/src/ui/UDS/UDS.types.ts +3 -0
- package/src/ui/UDS/index.js +1 -0
- package/src/ui/_spec/createMetaFromSpec.ts +35 -0
- package/src/ui/_spec/createStoryArgsFromSpec.ts +8 -0
- package/src/ui/_spec/generated/spec-props-reference.md +55 -0
- package/src/ui/_spec/specStorySync.test.ts +73 -0
- package/src/ui/_spec/types.ts +21 -0
- package/src/ui/index.js +66 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
+
import "./Tooltip.scss";
|
|
3
|
+
|
|
4
|
+
const BASE_CLASS = "uds-tooltip";
|
|
5
|
+
|
|
6
|
+
const placementClassMap = {
|
|
7
|
+
top: "top",
|
|
8
|
+
bottom: "bottom",
|
|
9
|
+
left: "left",
|
|
10
|
+
right: "right",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Tooltip component that displays a message when hovering over its children
|
|
15
|
+
* @param {ReactNode} children - The element that triggers the tooltip
|
|
16
|
+
* @param {string} content - The tooltip message text
|
|
17
|
+
* @param {string} placement - Tooltip placement: 'top', 'bottom', 'left', 'right' (default: 'top')
|
|
18
|
+
* @param {boolean} disabled - Whether the tooltip is disabled
|
|
19
|
+
* @param {string} className - Additional CSS classes
|
|
20
|
+
* @param {object} props - Additional props to pass to the wrapper element
|
|
21
|
+
*/
|
|
22
|
+
export default function Tooltip({
|
|
23
|
+
children,
|
|
24
|
+
content,
|
|
25
|
+
placement = "top",
|
|
26
|
+
disabled = false,
|
|
27
|
+
className = "",
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
30
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
31
|
+
const wrapperRef = useRef(null);
|
|
32
|
+
const tooltipRef = useRef(null);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!isVisible || !tooltipRef.current || !wrapperRef.current) return;
|
|
36
|
+
|
|
37
|
+
const tooltip = tooltipRef.current;
|
|
38
|
+
const wrapper = wrapperRef.current;
|
|
39
|
+
const rect = wrapper.getBoundingClientRect();
|
|
40
|
+
const tooltipRect = tooltip.getBoundingClientRect();
|
|
41
|
+
|
|
42
|
+
// Position the tooltip based on placement
|
|
43
|
+
let top = 0;
|
|
44
|
+
let left = 0;
|
|
45
|
+
|
|
46
|
+
switch (placement) {
|
|
47
|
+
case "top":
|
|
48
|
+
top = rect.top - tooltipRect.height - 8;
|
|
49
|
+
left = rect.left + rect.width / 2 - tooltipRect.width / 2;
|
|
50
|
+
break;
|
|
51
|
+
case "bottom":
|
|
52
|
+
top = rect.bottom + 8;
|
|
53
|
+
left = rect.left + rect.width / 2 - tooltipRect.width / 2;
|
|
54
|
+
break;
|
|
55
|
+
case "left":
|
|
56
|
+
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
57
|
+
left = rect.left - tooltipRect.width - 8;
|
|
58
|
+
break;
|
|
59
|
+
case "right":
|
|
60
|
+
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
61
|
+
left = rect.right + 8;
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Keep tooltip within viewport
|
|
68
|
+
const viewportWidth = window.innerWidth;
|
|
69
|
+
const viewportHeight = window.innerHeight;
|
|
70
|
+
|
|
71
|
+
if (left < 8) left = 8;
|
|
72
|
+
if (left + tooltipRect.width > viewportWidth - 8) {
|
|
73
|
+
left = viewportWidth - tooltipRect.width - 8;
|
|
74
|
+
}
|
|
75
|
+
if (top < 8) top = 8;
|
|
76
|
+
if (top + tooltipRect.height > viewportHeight - 8) {
|
|
77
|
+
top = viewportHeight - tooltipRect.height - 8;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
tooltip.style.top = `${top}px`;
|
|
81
|
+
tooltip.style.left = `${left}px`;
|
|
82
|
+
}, [isVisible, placement]);
|
|
83
|
+
|
|
84
|
+
if (!content || disabled) {
|
|
85
|
+
return <>{children}</>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const handleMouseEnter = () => {
|
|
89
|
+
setIsVisible(true);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleMouseLeave = () => {
|
|
93
|
+
setIsVisible(false);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const classNames = [
|
|
97
|
+
BASE_CLASS,
|
|
98
|
+
placementClassMap[placement] &&
|
|
99
|
+
`${BASE_CLASS}--${placementClassMap[placement]}`,
|
|
100
|
+
className,
|
|
101
|
+
]
|
|
102
|
+
.filter(Boolean)
|
|
103
|
+
.join(" ");
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div
|
|
107
|
+
ref={wrapperRef}
|
|
108
|
+
className={classNames}
|
|
109
|
+
onMouseEnter={handleMouseEnter}
|
|
110
|
+
onMouseLeave={handleMouseLeave}
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
{children}
|
|
114
|
+
{isVisible && (
|
|
115
|
+
<div
|
|
116
|
+
ref={tooltipRef}
|
|
117
|
+
className={`${BASE_CLASS}__content`}
|
|
118
|
+
role="tooltip"
|
|
119
|
+
>
|
|
120
|
+
{content}
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@use "../../styles/typography" as *;
|
|
2
|
+
|
|
3
|
+
.uds-tooltip {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
|
|
7
|
+
&__content {
|
|
8
|
+
@include uds-body-14;
|
|
9
|
+
position: fixed;
|
|
10
|
+
z-index: var(--uds-elevation-tooltip);
|
|
11
|
+
padding: var(--uds-spacing-8) var(--uds-spacing-12);
|
|
12
|
+
background: var(--uds-surface-inverse, #1f2937);
|
|
13
|
+
color: var(--uds-text-inverse, #ffffff);
|
|
14
|
+
border-radius: var(--uds-radius-4);
|
|
15
|
+
box-shadow: var(--uds-shadow-light-200);
|
|
16
|
+
max-width: 280px;
|
|
17
|
+
word-wrap: break-word;
|
|
18
|
+
white-space: normal;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
animation: tooltipFadeIn var(--uds-animation-duration-200) var(--uds-animation-ease-standard);
|
|
21
|
+
|
|
22
|
+
// Arrow
|
|
23
|
+
&::before {
|
|
24
|
+
content: "";
|
|
25
|
+
position: absolute;
|
|
26
|
+
width: 0;
|
|
27
|
+
height: 0;
|
|
28
|
+
border-style: solid;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Top placement (arrow pointing down)
|
|
33
|
+
&--top &__content::before {
|
|
34
|
+
bottom: -6px;
|
|
35
|
+
left: 50%;
|
|
36
|
+
transform: translateX(-50%);
|
|
37
|
+
border-width: 6px 6px 0 6px;
|
|
38
|
+
border-color: var(--uds-surface-inverse, #1f2937) transparent transparent
|
|
39
|
+
transparent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Bottom placement (arrow pointing up)
|
|
43
|
+
&--bottom &__content::before {
|
|
44
|
+
top: -6px;
|
|
45
|
+
left: 50%;
|
|
46
|
+
transform: translateX(-50%);
|
|
47
|
+
border-width: 0 6px 6px 6px;
|
|
48
|
+
border-color: transparent transparent var(--uds-surface-inverse, #1f2937)
|
|
49
|
+
transparent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Left placement (arrow pointing right)
|
|
53
|
+
&--left &__content::before {
|
|
54
|
+
right: -6px;
|
|
55
|
+
top: 50%;
|
|
56
|
+
transform: translateY(-50%);
|
|
57
|
+
border-width: 6px 0 6px 6px;
|
|
58
|
+
border-color: transparent transparent transparent
|
|
59
|
+
var(--uds-surface-inverse, #1f2937);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Right placement (arrow pointing left)
|
|
63
|
+
&--right &__content::before {
|
|
64
|
+
left: -6px;
|
|
65
|
+
top: 50%;
|
|
66
|
+
transform: translateY(-50%);
|
|
67
|
+
border-width: 6px 6px 6px 0;
|
|
68
|
+
border-color: transparent var(--uds-surface-inverse, #1f2937) transparent
|
|
69
|
+
transparent;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@keyframes tooltipFadeIn {
|
|
74
|
+
from {
|
|
75
|
+
opacity: 0;
|
|
76
|
+
}
|
|
77
|
+
to {
|
|
78
|
+
opacity: 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./UDS.scss";
|
|
3
|
+
|
|
4
|
+
function UDS({ children, className = "", ...props }) {
|
|
5
|
+
return (
|
|
6
|
+
<div className={`uds--container ${className}`.trim()} {...props}>
|
|
7
|
+
{children}
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
UDS.Menu = function UDSMenu({ children, ...props }) {
|
|
13
|
+
return (
|
|
14
|
+
<div className="uds--menu" {...props}>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
UDS.Content = function UDSContent({ children, ...props }) {
|
|
21
|
+
return (
|
|
22
|
+
<div className="uds--content" {...props}>
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
UDS.Listview = function UDSListview({ children, ...props }) {
|
|
29
|
+
return (
|
|
30
|
+
<div className="uds--listview" {...props}>
|
|
31
|
+
{children}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
UDS.Main = function UDSMain({ children, ...props }) {
|
|
37
|
+
return (
|
|
38
|
+
<div className="uds--main" {...props}>
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
UDS.Panel = function UDSPanel({ children, ...props }) {
|
|
45
|
+
return (
|
|
46
|
+
<div className="uds--panel" {...props}>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default UDS;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.uds {
|
|
2
|
+
&--container {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
min-height: 800px;
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&--content {
|
|
10
|
+
display: flex;
|
|
11
|
+
position: relative;
|
|
12
|
+
width: 100%;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
padding-left: 64px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&--listview {
|
|
18
|
+
background-color: var(--uds-surface-primary);
|
|
19
|
+
border-right: solid var(--uds-border-width-1) var(--uds-border-primary);
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
width: 360px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&--main {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex: 1;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
min-width: 0;
|
|
32
|
+
overflow-y: auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&--panel {
|
|
36
|
+
background-color: var(--uds-surface-secondary);
|
|
37
|
+
border-left: solid var(--uds-border-width-1) var(--uds-border-primary);
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
position: absolute;
|
|
43
|
+
right: 0;
|
|
44
|
+
top: 0;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
width: 360px;
|
|
47
|
+
z-index: 100;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import UDS from "./UDS";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/UDS",
|
|
5
|
+
component: UDS,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "fullscreen",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<UDS style={{ height: "520px" }}>
|
|
15
|
+
<UDS.Menu>Menu</UDS.Menu>
|
|
16
|
+
<UDS.Content>
|
|
17
|
+
<UDS.Main>Main content</UDS.Main>
|
|
18
|
+
</UDS.Content>
|
|
19
|
+
<UDS.Panel>Panel</UDS.Panel>
|
|
20
|
+
</UDS>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./UDS";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SpecMetaInput } from "./types";
|
|
2
|
+
|
|
3
|
+
export function createMetaFromSpec<TArgs extends Record<string, unknown>>({
|
|
4
|
+
title,
|
|
5
|
+
component,
|
|
6
|
+
defaults,
|
|
7
|
+
options,
|
|
8
|
+
argTypes = {},
|
|
9
|
+
parameters = {},
|
|
10
|
+
tags = ["autodocs"],
|
|
11
|
+
}: SpecMetaInput<TArgs>) {
|
|
12
|
+
const mergedArgTypes: Record<string, Record<string, unknown>> = {
|
|
13
|
+
...argTypes,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
if (options) {
|
|
17
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
18
|
+
const existing = mergedArgTypes[key] || {};
|
|
19
|
+
mergedArgTypes[key] = {
|
|
20
|
+
...existing,
|
|
21
|
+
control: existing.control || "select",
|
|
22
|
+
options: Array.isArray(value) ? [...value] : value,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
title,
|
|
29
|
+
component,
|
|
30
|
+
tags,
|
|
31
|
+
args: defaults,
|
|
32
|
+
argTypes: mergedArgTypes,
|
|
33
|
+
parameters,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Spec Props Reference
|
|
2
|
+
|
|
3
|
+
> Auto-generated from component specs. Do not edit manually.
|
|
4
|
+
|
|
5
|
+
## Button
|
|
6
|
+
|
|
7
|
+
Source: `src/ui/Button/Button.spec.ts`
|
|
8
|
+
|
|
9
|
+
| Prop | Default | Options |
|
|
10
|
+
|------|---------|---------|
|
|
11
|
+
| label | `Button` | - |
|
|
12
|
+
| icon | `Plus` | - |
|
|
13
|
+
| appearance | `primary` | `primary | soft | outline | text | ghost | disabled | destructive` |
|
|
14
|
+
| layout | `label-only` | `label-only | icon-left | icon-right | icon-only | only` |
|
|
15
|
+
| size | `default` | `large | default | small | xsmall` |
|
|
16
|
+
|
|
17
|
+
## Accordion
|
|
18
|
+
|
|
19
|
+
Source: `src/ui/Accordion/Accordion.spec.ts`
|
|
20
|
+
|
|
21
|
+
| Prop | Default | Options |
|
|
22
|
+
|------|---------|---------|
|
|
23
|
+
| expandedFirst | `false` | `[false,true]` |
|
|
24
|
+
|
|
25
|
+
## Input
|
|
26
|
+
|
|
27
|
+
Source: `src/ui/Input/Input.spec.ts`
|
|
28
|
+
|
|
29
|
+
| Prop | Default | Options |
|
|
30
|
+
|------|---------|---------|
|
|
31
|
+
| value | `""` | - |
|
|
32
|
+
| placeholder | `Type here...` | - |
|
|
33
|
+
| type | `text` | - |
|
|
34
|
+
| size | `default` | `compact | default` |
|
|
35
|
+
| state | `default` | `default | focused | error | disabled` |
|
|
36
|
+
| disabled | `false` | - |
|
|
37
|
+
| iconPosition | `right` | `left | right` |
|
|
38
|
+
| icon | `MagnifyingGlass` | - |
|
|
39
|
+
| label | `Search` | - |
|
|
40
|
+
|
|
41
|
+
## Dropdown
|
|
42
|
+
|
|
43
|
+
Source: `src/ui/Dropdown/Dropdown.spec.ts`
|
|
44
|
+
|
|
45
|
+
| Prop | Default | Options |
|
|
46
|
+
|------|---------|---------|
|
|
47
|
+
| options | `[{"value":"apple","label":"Apple"},{"value":"orange","label":"Orange"},{"value":"banana","label":"Banana"}]` | - |
|
|
48
|
+
| value | `apple` | - |
|
|
49
|
+
| placeholder | `Select an option` | - |
|
|
50
|
+
| size | `default` | `compact | default` |
|
|
51
|
+
| state | `default` | `default | focused | error | disabled` |
|
|
52
|
+
| placement | `bottom-start` | - |
|
|
53
|
+
| disabled | `false` | - |
|
|
54
|
+
| label | `Fruit` | - |
|
|
55
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describe, test } from "@jest/globals";
|
|
2
|
+
import accordionMeta, {
|
|
3
|
+
Default as AccordionDefaultStory,
|
|
4
|
+
FirstExpanded as AccordionFirstExpandedStory,
|
|
5
|
+
} from "../Accordion/Accordion.stories";
|
|
6
|
+
import { ACCORDION_STORY_SPEC } from "../Accordion/Accordion.spec";
|
|
7
|
+
import buttonMeta from "../Button/Button.stories";
|
|
8
|
+
import {
|
|
9
|
+
BUTTON_APPEARANCES,
|
|
10
|
+
BUTTON_DEFAULTS,
|
|
11
|
+
BUTTON_LAYOUTS,
|
|
12
|
+
BUTTON_SIZES,
|
|
13
|
+
} from "../Button/Button.spec";
|
|
14
|
+
import dropdownMeta from "../Dropdown/Dropdown.stories";
|
|
15
|
+
import { DROPDOWN_STORY_SPEC } from "../Dropdown/Dropdown.spec";
|
|
16
|
+
import inputMeta from "../Input/Input.stories";
|
|
17
|
+
import { INPUT_STORY_SPEC } from "../Input/Input.spec";
|
|
18
|
+
|
|
19
|
+
const getArgTypeOptions = (meta: unknown, key: string): unknown[] => {
|
|
20
|
+
const options = (meta as { argTypes?: Record<string, { options?: unknown[] }> }).argTypes?.[
|
|
21
|
+
key
|
|
22
|
+
]?.options;
|
|
23
|
+
return Array.isArray(options) ? options : [];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
describe("Spec-to-story sync checks", () => {
|
|
27
|
+
test("Button story meta uses spec defaults and options", () => {
|
|
28
|
+
const meta = buttonMeta as { args?: Record<string, unknown> };
|
|
29
|
+
expect(meta.args?.appearance).toBe(BUTTON_DEFAULTS.appearance);
|
|
30
|
+
expect(meta.args?.layout).toBe(BUTTON_DEFAULTS.layout);
|
|
31
|
+
expect(meta.args?.size).toBe(BUTTON_DEFAULTS.size);
|
|
32
|
+
|
|
33
|
+
expect(getArgTypeOptions(buttonMeta, "appearance")).toEqual([...BUTTON_APPEARANCES]);
|
|
34
|
+
expect(getArgTypeOptions(buttonMeta, "layout")).toEqual([...BUTTON_LAYOUTS]);
|
|
35
|
+
expect(getArgTypeOptions(buttonMeta, "size")).toEqual([...BUTTON_SIZES]);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("Input story meta uses spec defaults and options", () => {
|
|
39
|
+
const meta = inputMeta as { args?: Record<string, unknown> };
|
|
40
|
+
expect(meta.args).toEqual({ ...INPUT_STORY_SPEC.defaults });
|
|
41
|
+
expect(getArgTypeOptions(inputMeta, "size")).toEqual([...INPUT_STORY_SPEC.options.size]);
|
|
42
|
+
expect(getArgTypeOptions(inputMeta, "state")).toEqual([...INPUT_STORY_SPEC.options.state]);
|
|
43
|
+
expect(getArgTypeOptions(inputMeta, "iconPosition")).toEqual([
|
|
44
|
+
...INPUT_STORY_SPEC.options.iconPosition,
|
|
45
|
+
]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("Dropdown story meta uses spec defaults and options", () => {
|
|
49
|
+
const meta = dropdownMeta as { args?: Record<string, unknown> };
|
|
50
|
+
expect(meta.args).toEqual({ ...DROPDOWN_STORY_SPEC.defaults });
|
|
51
|
+
expect(getArgTypeOptions(dropdownMeta, "size")).toEqual([
|
|
52
|
+
...DROPDOWN_STORY_SPEC.options.size,
|
|
53
|
+
]);
|
|
54
|
+
expect(getArgTypeOptions(dropdownMeta, "state")).toEqual([
|
|
55
|
+
...DROPDOWN_STORY_SPEC.options.state,
|
|
56
|
+
]);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("Accordion stories map directly to spec story variants", () => {
|
|
60
|
+
const meta = accordionMeta as { args?: Record<string, unknown> };
|
|
61
|
+
expect(meta.args).toEqual({ ...ACCORDION_STORY_SPEC.defaults });
|
|
62
|
+
|
|
63
|
+
expect((AccordionDefaultStory as { args: Record<string, unknown> }).args).toEqual({
|
|
64
|
+
...ACCORDION_STORY_SPEC.defaults,
|
|
65
|
+
...ACCORDION_STORY_SPEC.stories.default,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
expect((AccordionFirstExpandedStory as { args: Record<string, unknown> }).args).toEqual({
|
|
69
|
+
...ACCORDION_STORY_SPEC.defaults,
|
|
70
|
+
...ACCORDION_STORY_SPEC.stories.firstExpanded,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type SpecOptions<TArgs extends Record<string, unknown>> = Partial<
|
|
2
|
+
Record<keyof TArgs, readonly unknown[]>
|
|
3
|
+
>;
|
|
4
|
+
|
|
5
|
+
export type StoryExample<TArgs extends Record<string, unknown>> = Partial<TArgs>;
|
|
6
|
+
|
|
7
|
+
export interface StorySpec<TArgs extends Record<string, unknown>> {
|
|
8
|
+
defaults: TArgs;
|
|
9
|
+
options?: SpecOptions<TArgs>;
|
|
10
|
+
stories: Record<string, StoryExample<TArgs>>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SpecMetaInput<TArgs extends Record<string, unknown>> {
|
|
14
|
+
title: string;
|
|
15
|
+
component: unknown;
|
|
16
|
+
defaults: TArgs;
|
|
17
|
+
options?: SpecOptions<TArgs>;
|
|
18
|
+
argTypes?: Record<string, Record<string, unknown>>;
|
|
19
|
+
parameters?: Record<string, unknown>;
|
|
20
|
+
tags?: string[];
|
|
21
|
+
}
|