@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,108 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
Data table component for displaying tabular data with sortable and filterable columns.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- Displaying structured data in rows and columns
|
|
7
|
+
- Data grids with custom cell rendering
|
|
8
|
+
- Lists that need column alignment, sorting indicators, or filtering
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
| Prop | Type | Default | Description |
|
|
13
|
+
|------|------|---------|-------------|
|
|
14
|
+
| `columns` | `array` | `[]` | Column definitions (see Column Object below) |
|
|
15
|
+
| `data` | `array` | `[]` | Array of row data objects |
|
|
16
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
17
|
+
|
|
18
|
+
### Column Object
|
|
19
|
+
|
|
20
|
+
| Property | Type | Description |
|
|
21
|
+
|----------|------|-------------|
|
|
22
|
+
| `key` | `string` | Data key to access from row objects |
|
|
23
|
+
| `label` | `string` | Column header text |
|
|
24
|
+
| `icon` | `string` | Phosphor icon name for header |
|
|
25
|
+
| `align` | `string` | Cell alignment: `"left"`, `"center"`, `"right"` |
|
|
26
|
+
| `sortable` | `boolean` | Show sort indicator in header |
|
|
27
|
+
| `filterable` | `boolean` | Show filter icon in header |
|
|
28
|
+
| `className` | `string` | Additional class for column cells |
|
|
29
|
+
| `render` | `function` | Custom render: `(row, rowIndex, colIndex) => ReactNode` |
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
### Basic table
|
|
34
|
+
```jsx
|
|
35
|
+
<Table
|
|
36
|
+
columns={[
|
|
37
|
+
{ key: "name", label: "Name" },
|
|
38
|
+
{ key: "email", label: "Email" },
|
|
39
|
+
{ key: "role", label: "Role" },
|
|
40
|
+
]}
|
|
41
|
+
data={[
|
|
42
|
+
{ name: "Alice Johnson", email: "alice@example.com", role: "Admin" },
|
|
43
|
+
{ name: "Bob Smith", email: "bob@example.com", role: "Editor" },
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### With custom cell rendering
|
|
49
|
+
```jsx
|
|
50
|
+
<Table
|
|
51
|
+
columns={[
|
|
52
|
+
{
|
|
53
|
+
key: "user",
|
|
54
|
+
label: "User",
|
|
55
|
+
render: (row) => (
|
|
56
|
+
<Flex gap="8" alignItems="center">
|
|
57
|
+
<Avatar initials={row.initials} size="small" />
|
|
58
|
+
<span>{row.name}</span>
|
|
59
|
+
</Flex>
|
|
60
|
+
),
|
|
61
|
+
},
|
|
62
|
+
{ key: "email", label: "Email" },
|
|
63
|
+
{
|
|
64
|
+
key: "status",
|
|
65
|
+
label: "Status",
|
|
66
|
+
render: (row) => <Status label={row.status} variant={row.statusColor} />,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: "actions",
|
|
70
|
+
label: "",
|
|
71
|
+
align: "right",
|
|
72
|
+
render: (row) => (
|
|
73
|
+
<Button icon="DotsThree" layout="icon-only" appearance="ghost" size="small" />
|
|
74
|
+
),
|
|
75
|
+
},
|
|
76
|
+
]}
|
|
77
|
+
data={users}
|
|
78
|
+
/>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### With sortable/filterable headers
|
|
82
|
+
```jsx
|
|
83
|
+
<Table
|
|
84
|
+
columns={[
|
|
85
|
+
{ key: "name", label: "Name", sortable: true },
|
|
86
|
+
{ key: "date", label: "Date", sortable: true, icon: "Calendar" },
|
|
87
|
+
{ key: "category", label: "Category", filterable: true },
|
|
88
|
+
{ key: "amount", label: "Amount", align: "right", sortable: true },
|
|
89
|
+
]}
|
|
90
|
+
data={transactions}
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Composition
|
|
95
|
+
|
|
96
|
+
- Use `Avatar`, `Tag`, `Status`, `Badge`, `Button` inside custom `render` functions
|
|
97
|
+
- Wrap in `Card` for bordered table sections
|
|
98
|
+
- Pair with `Pagination` below the table for large datasets
|
|
99
|
+
- Inside `UDS.Main` for page-level data tables
|
|
100
|
+
|
|
101
|
+
## Do's and Don'ts
|
|
102
|
+
|
|
103
|
+
✅ **Do**: Use `render` function for complex cell content (avatars, tags, action buttons)
|
|
104
|
+
✅ **Do**: Align numeric columns to the right with `align: "right"`
|
|
105
|
+
✅ **Do**: Use `Flex` inside render functions for multi-element cells
|
|
106
|
+
|
|
107
|
+
❌ **Don't**: Put very wide content in cells without considering responsive behavior
|
|
108
|
+
❌ **Don't**: Use `render` AND `key` for the same column — `render` takes precedence
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Icon from "../Icon/Icon";
|
|
3
|
+
import "./Table.scss";
|
|
4
|
+
|
|
5
|
+
const BASE_CLASS = "uds-table";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Table component for displaying tabular data
|
|
9
|
+
* @param {array} columns - Array of column definitions
|
|
10
|
+
* @param {array} data - Array of data rows
|
|
11
|
+
* @param {string} className - Additional CSS classes
|
|
12
|
+
* @param {object} props - Additional props to pass to the table element
|
|
13
|
+
*/
|
|
14
|
+
export default function Table({
|
|
15
|
+
columns = [],
|
|
16
|
+
data = [],
|
|
17
|
+
className = "",
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const classNames = [BASE_CLASS, className].filter(Boolean).join(" ");
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={`${BASE_CLASS}__wrapper`}>
|
|
24
|
+
<table className={classNames} {...props}>
|
|
25
|
+
{columns.length > 0 && (
|
|
26
|
+
<thead className={`${BASE_CLASS}__head`}>
|
|
27
|
+
<tr className={`${BASE_CLASS}__row`}>
|
|
28
|
+
{columns.map((column, index) => (
|
|
29
|
+
<TableCell
|
|
30
|
+
key={column.key || index}
|
|
31
|
+
type="header"
|
|
32
|
+
column={column}
|
|
33
|
+
index={index}
|
|
34
|
+
/>
|
|
35
|
+
))}
|
|
36
|
+
</tr>
|
|
37
|
+
</thead>
|
|
38
|
+
)}
|
|
39
|
+
<tbody className={`${BASE_CLASS}__body`}>
|
|
40
|
+
{data.map((row, rowIndex) => (
|
|
41
|
+
<tr key={rowIndex} className={`${BASE_CLASS}__row`}>
|
|
42
|
+
{columns.map((column, colIndex) => (
|
|
43
|
+
<TableCell
|
|
44
|
+
key={column.key || colIndex}
|
|
45
|
+
type="cell"
|
|
46
|
+
column={column}
|
|
47
|
+
row={row}
|
|
48
|
+
rowIndex={rowIndex}
|
|
49
|
+
colIndex={colIndex}
|
|
50
|
+
/>
|
|
51
|
+
))}
|
|
52
|
+
</tr>
|
|
53
|
+
))}
|
|
54
|
+
</tbody>
|
|
55
|
+
</table>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* TableCell component - flexible cell that can render different content types
|
|
62
|
+
* @param {string} type - Cell type: 'header' or 'cell'
|
|
63
|
+
* @param {object} column - Column definition
|
|
64
|
+
* @param {object} row - Row data (for data cells)
|
|
65
|
+
* @param {number} rowIndex - Row index
|
|
66
|
+
* @param {number} colIndex - Column index
|
|
67
|
+
*/
|
|
68
|
+
function TableCell({ type, column, row, rowIndex, colIndex }) {
|
|
69
|
+
const isHeader = type === "header";
|
|
70
|
+
const Element = isHeader ? "th" : "td";
|
|
71
|
+
const cellValue = isHeader
|
|
72
|
+
? column.label
|
|
73
|
+
: (row?.[column.key] ?? column.render?.(row, rowIndex, colIndex));
|
|
74
|
+
|
|
75
|
+
const classNames = [
|
|
76
|
+
`${BASE_CLASS}__cell`,
|
|
77
|
+
isHeader && `${BASE_CLASS}__cell--header`,
|
|
78
|
+
column.align && `${BASE_CLASS}__cell--${column.align}`,
|
|
79
|
+
column.className,
|
|
80
|
+
]
|
|
81
|
+
.filter(Boolean)
|
|
82
|
+
.join(" ");
|
|
83
|
+
|
|
84
|
+
// Handle different cell content types
|
|
85
|
+
const renderCellContent = () => {
|
|
86
|
+
// If column has a render function, use it
|
|
87
|
+
if (!isHeader && column.render) {
|
|
88
|
+
return column.render(row, rowIndex, colIndex);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// If cellValue is already a React element, return it
|
|
92
|
+
if (React.isValidElement(cellValue)) {
|
|
93
|
+
return cellValue;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Handle header cells with icons
|
|
97
|
+
if (isHeader) {
|
|
98
|
+
return (
|
|
99
|
+
<div className={`${BASE_CLASS}__cell-content`}>
|
|
100
|
+
{column.icon && (
|
|
101
|
+
<Icon
|
|
102
|
+
name={column.icon}
|
|
103
|
+
size={16}
|
|
104
|
+
appearance="regular"
|
|
105
|
+
className={`${BASE_CLASS}__cell-icon`}
|
|
106
|
+
/>
|
|
107
|
+
)}
|
|
108
|
+
{column.label && (
|
|
109
|
+
<span className={`${BASE_CLASS}__cell-label`}>{column.label}</span>
|
|
110
|
+
)}
|
|
111
|
+
{column.sortable && (
|
|
112
|
+
<Icon
|
|
113
|
+
name="CaretUpDown"
|
|
114
|
+
size={16}
|
|
115
|
+
appearance="regular"
|
|
116
|
+
className={`${BASE_CLASS}__cell-sort-icon`}
|
|
117
|
+
/>
|
|
118
|
+
)}
|
|
119
|
+
{column.filterable && (
|
|
120
|
+
<Icon
|
|
121
|
+
name="Funnel"
|
|
122
|
+
size={16}
|
|
123
|
+
appearance="regular"
|
|
124
|
+
className={`${BASE_CLASS}__cell-filter-icon`}
|
|
125
|
+
/>
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Handle data cells
|
|
132
|
+
return (
|
|
133
|
+
<div className={`${BASE_CLASS}__cell-content`}>
|
|
134
|
+
{cellValue != null ? String(cellValue) : ""}
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return <Element className={classNames}>{renderCellContent()}</Element>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Export TableCell for external use if needed
|
|
143
|
+
Table.Cell = TableCell;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@use "../../styles/typography" as *;
|
|
2
|
+
|
|
3
|
+
.uds-table {
|
|
4
|
+
width: 100%;
|
|
5
|
+
border-collapse: collapse;
|
|
6
|
+
border-spacing: 0;
|
|
7
|
+
|
|
8
|
+
&__wrapper {
|
|
9
|
+
width: 100%;
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
border: var(--uds-border-width-1) solid var(--uds-border-primary);
|
|
12
|
+
border-radius: var(--uds-radius-4);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__head {
|
|
16
|
+
background-color: var(--uds-surface-secondary);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__body {
|
|
20
|
+
background-color: var(--uds-surface-primary);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__row {
|
|
24
|
+
border-bottom: var(--uds-border-width-1) solid var(--uds-border-primary);
|
|
25
|
+
transition: background-color var(--uds-animation-duration-200)
|
|
26
|
+
var(--uds-animation-ease-standard);
|
|
27
|
+
|
|
28
|
+
&:last-child {
|
|
29
|
+
border-bottom: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:hover:not(.uds-table__row--header) {
|
|
33
|
+
background-color: var(--uds-surface-tertiary);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__cell {
|
|
38
|
+
@include uds-body-14-medium;
|
|
39
|
+
padding: var(--uds-spacing-12) var(--uds-spacing-16);
|
|
40
|
+
text-align: left;
|
|
41
|
+
vertical-align: middle;
|
|
42
|
+
color: var(--uds-text-primary);
|
|
43
|
+
|
|
44
|
+
&--header {
|
|
45
|
+
@include uds-body-14-semibold;
|
|
46
|
+
color: var(--uds-text-primary);
|
|
47
|
+
background-color: var(--uds-surface-secondary);
|
|
48
|
+
user-select: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--left {
|
|
52
|
+
text-align: left;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&--center {
|
|
56
|
+
text-align: center;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&--right {
|
|
60
|
+
text-align: right;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__cell-content {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: var(--uds-gap-8);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&__cell-label {
|
|
71
|
+
flex: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__cell-icon {
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
color: var(--uds-text-secondary);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&__cell-sort-icon,
|
|
80
|
+
&__cell-filter-icon {
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
color: var(--uds-text-tertiary);
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
transition: color var(--uds-animation-duration-200) var(--uds-animation-ease-standard);
|
|
85
|
+
|
|
86
|
+
&:hover {
|
|
87
|
+
color: var(--uds-text-primary);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Table";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Icon from "../Icon/Icon";
|
|
3
|
+
import Badge from "../Badge/Badge";
|
|
4
|
+
|
|
5
|
+
const BASE_CLASS = "uds-tabs-item";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TabItem component - A single tab item building block
|
|
9
|
+
* Can be used standalone or assembled into a Tabs component
|
|
10
|
+
*
|
|
11
|
+
* @param {string} label - The text content of the tab
|
|
12
|
+
* @param {string} appearance - Visual style variant: 'underline', 'block', or 'block-inverted'
|
|
13
|
+
* @param {boolean} active - Whether the tab is currently active
|
|
14
|
+
* @param {string|boolean} icon - Icon name to display (or false/undefined for no icon)
|
|
15
|
+
* @param {number|string|boolean} tag - Badge count to display (or false/undefined for no badge)
|
|
16
|
+
* @param {string} tagVariant - Badge color variant (default: 'red')
|
|
17
|
+
* @param {string} className - Additional CSS classes
|
|
18
|
+
* @param {function} onClick - Click handler function
|
|
19
|
+
* @param {object} props - Additional props to pass to the tab element
|
|
20
|
+
*/
|
|
21
|
+
export default function TabItem({
|
|
22
|
+
label,
|
|
23
|
+
appearance = "underline",
|
|
24
|
+
active = false,
|
|
25
|
+
icon,
|
|
26
|
+
tag,
|
|
27
|
+
tagVariant = "red",
|
|
28
|
+
className = "",
|
|
29
|
+
onClick,
|
|
30
|
+
...props
|
|
31
|
+
}) {
|
|
32
|
+
const classNames = [BASE_CLASS, active && `active`, className]
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join(" ");
|
|
35
|
+
|
|
36
|
+
const Element = onClick ? "button" : "div";
|
|
37
|
+
|
|
38
|
+
const hasIcon = !!icon && typeof icon === "string";
|
|
39
|
+
const hasTag = !!tag && (typeof tag === "number" || typeof tag === "string");
|
|
40
|
+
|
|
41
|
+
// Ensure label is a string, not an object
|
|
42
|
+
let labelText = "";
|
|
43
|
+
if (label != null) {
|
|
44
|
+
if (typeof label === "string") {
|
|
45
|
+
labelText = label;
|
|
46
|
+
} else if (typeof label !== "object") {
|
|
47
|
+
// Only convert non-objects to string
|
|
48
|
+
labelText = String(label);
|
|
49
|
+
}
|
|
50
|
+
// If label is an object, labelText remains empty string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Filter out any object values from props to prevent rendering objects
|
|
54
|
+
const safeProps = {};
|
|
55
|
+
if (props) {
|
|
56
|
+
Object.keys(props).forEach(key => {
|
|
57
|
+
const value = props[key];
|
|
58
|
+
// Only include props that are not objects (or are React elements)
|
|
59
|
+
if (value == null || typeof value !== "object" || React.isValidElement(value)) {
|
|
60
|
+
safeProps[key] = value;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Element
|
|
67
|
+
className={classNames}
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
role={onClick ? "tab" : undefined}
|
|
70
|
+
aria-selected={onClick ? active : undefined}
|
|
71
|
+
{...safeProps}
|
|
72
|
+
>
|
|
73
|
+
{hasIcon && (
|
|
74
|
+
<Icon name={icon} size={16} appearance="bold" />
|
|
75
|
+
)}
|
|
76
|
+
{labelText && <span>{labelText}</span>}
|
|
77
|
+
{hasTag && <Badge count={tag} variant={tagVariant} />}
|
|
78
|
+
</Element>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
Tab navigation component for switching between content views.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- Switching between related content views without page navigation
|
|
7
|
+
- Organizing content into logical sections (e.g., Details / Activity / Settings)
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
### Tabs (container)
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| `children` | `ReactNode` | — | `Tab` components |
|
|
16
|
+
| `activeTab` | `string` | — | Currently active tab ID |
|
|
17
|
+
| `onChange` | `function` | — | Callback `(tabId: string) => void` |
|
|
18
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
19
|
+
|
|
20
|
+
### Tab
|
|
21
|
+
|
|
22
|
+
| Prop | Type | Default | Description |
|
|
23
|
+
|------|------|---------|-------------|
|
|
24
|
+
| `id` | `string` | — | Tab identifier |
|
|
25
|
+
| `label` | `string` | — | Tab label text |
|
|
26
|
+
| `icon` | `string` | — | Phosphor icon name |
|
|
27
|
+
| `badge` | `number` | — | Badge count on tab |
|
|
28
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
```jsx
|
|
33
|
+
const [activeTab, setActiveTab] = useState("details");
|
|
34
|
+
|
|
35
|
+
<Tabs activeTab={activeTab} onChange={setActiveTab}>
|
|
36
|
+
<Tab id="details" label="Details" />
|
|
37
|
+
<Tab id="activity" label="Activity" badge={3} />
|
|
38
|
+
<Tab id="settings" label="Settings" icon="Gear" />
|
|
39
|
+
</Tabs>
|
|
40
|
+
|
|
41
|
+
{activeTab === "details" && <DetailsPanel />}
|
|
42
|
+
{activeTab === "activity" && <ActivityFeed />}
|
|
43
|
+
{activeTab === "settings" && <SettingsForm />}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Import
|
|
47
|
+
```jsx
|
|
48
|
+
import { Tabs, Tab } from "@mich8060/chg-design-system";
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Note
|
|
52
|
+
- Only manages tab header navigation — you render the corresponding content conditionally
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Tabs from './Tabs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Figma Code Connect for Tabs component
|
|
6
|
+
*
|
|
7
|
+
* Simple execution version of tabs with various appearances and configurations
|
|
8
|
+
*/
|
|
9
|
+
export default function TabsFigma({
|
|
10
|
+
tabs = 6,
|
|
11
|
+
appearance = 'underline',
|
|
12
|
+
activeTab = 1,
|
|
13
|
+
fill = true,
|
|
14
|
+
}) {
|
|
15
|
+
const tabsCount = Math.min(Math.max(parseInt(tabs) || 6, 2), 6);
|
|
16
|
+
const activeIndex = Math.min(Math.max(parseInt(activeTab) || 1, 1), tabsCount) - 1;
|
|
17
|
+
|
|
18
|
+
const tabLabels = Array.from({ length: tabsCount }, (_, i) => ({
|
|
19
|
+
label: `Tab ${i + 1}`,
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Tabs
|
|
24
|
+
tabs={tabLabels}
|
|
25
|
+
appearance={appearance}
|
|
26
|
+
activeTab={activeIndex}
|
|
27
|
+
fill={fill}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|