@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,124 @@
|
|
|
1
|
+
import ActionMenu from "./ActionMenu";
|
|
2
|
+
import Button from "../Button/Button";
|
|
3
|
+
|
|
4
|
+
const DEFAULT_ITEMS = [
|
|
5
|
+
{ label: "Edit", icon: "PencilSimple", onClick: () => {} },
|
|
6
|
+
{ label: "Duplicate", icon: "Copy", onClick: () => {} },
|
|
7
|
+
{ divider: true },
|
|
8
|
+
{ label: "Delete", icon: "Trash", destructive: true, onClick: () => {} },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const NESTED_ITEMS = [
|
|
12
|
+
{
|
|
13
|
+
label: "Share",
|
|
14
|
+
icon: "ShareNetwork",
|
|
15
|
+
items: [
|
|
16
|
+
{ label: "Copy Link", icon: "Link", onClick: () => {} },
|
|
17
|
+
{ label: "Email", icon: "EnvelopeSimple", onClick: () => {} },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Notifications",
|
|
22
|
+
icon: "Bell",
|
|
23
|
+
type: "toggle",
|
|
24
|
+
checked: true,
|
|
25
|
+
onChange: () => {},
|
|
26
|
+
},
|
|
27
|
+
{ divider: true },
|
|
28
|
+
{ label: "Archive", icon: "Archive", onClick: () => {} },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
title: "Components/ActionMenu",
|
|
33
|
+
component: ActionMenu,
|
|
34
|
+
tags: ["autodocs"],
|
|
35
|
+
args: {
|
|
36
|
+
trigger: <Button appearance="ghost" layout="icon-only" icon="DotsThree" />,
|
|
37
|
+
items: DEFAULT_ITEMS,
|
|
38
|
+
placement: "bottom-end",
|
|
39
|
+
fullWidth: false,
|
|
40
|
+
disabled: false,
|
|
41
|
+
className: "",
|
|
42
|
+
menuClassName: "",
|
|
43
|
+
},
|
|
44
|
+
argTypes: {
|
|
45
|
+
trigger: {
|
|
46
|
+
control: false,
|
|
47
|
+
description:
|
|
48
|
+
"Element that opens the menu. Use a Button for the best keyboard and visual behavior.",
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: "ReactNode" },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
items: {
|
|
54
|
+
control: "object",
|
|
55
|
+
description:
|
|
56
|
+
"Array of menu items. Each item can include label, icon, onClick, shortcut, active, destructive, disabled, divider, nested items, or toggle fields (type, checked, onChange).",
|
|
57
|
+
table: {
|
|
58
|
+
type: {
|
|
59
|
+
summary:
|
|
60
|
+
"Array<{ label?: string; icon?: string; onClick?: fn; shortcut?: string; active?: boolean; destructive?: boolean; disabled?: boolean; divider?: boolean; items?: MenuItem[]; type?: 'toggle'; checked?: boolean; onChange?: (checked: boolean) => void; }>",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
placement: {
|
|
65
|
+
control: "select",
|
|
66
|
+
options: [
|
|
67
|
+
"bottom-start",
|
|
68
|
+
"bottom-end",
|
|
69
|
+
"top-start",
|
|
70
|
+
"top-end",
|
|
71
|
+
"right-start",
|
|
72
|
+
"right-end",
|
|
73
|
+
"left-start",
|
|
74
|
+
"left-end",
|
|
75
|
+
],
|
|
76
|
+
description: "Position of the menu relative to the trigger.",
|
|
77
|
+
},
|
|
78
|
+
fullWidth: {
|
|
79
|
+
control: "boolean",
|
|
80
|
+
description: "When true, menu width matches the trigger width.",
|
|
81
|
+
},
|
|
82
|
+
disabled: {
|
|
83
|
+
control: "boolean",
|
|
84
|
+
description: "Disables opening and interaction for the whole menu.",
|
|
85
|
+
},
|
|
86
|
+
onOpenChange: {
|
|
87
|
+
action: "open changed",
|
|
88
|
+
description: "Called when open state changes: (isOpen: boolean) => void.",
|
|
89
|
+
},
|
|
90
|
+
className: {
|
|
91
|
+
control: "text",
|
|
92
|
+
description: "Extra class names applied to the root wrapper.",
|
|
93
|
+
},
|
|
94
|
+
menuClassName: {
|
|
95
|
+
control: "text",
|
|
96
|
+
description: "Extra class names applied to the floating menu panel.",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
parameters: {
|
|
100
|
+
layout: "padded",
|
|
101
|
+
docs: {
|
|
102
|
+
description: {
|
|
103
|
+
component:
|
|
104
|
+
"ActionMenu is a contextual dropdown for grouped actions. Start with a Button trigger and pass an `items` array with menu rows, optional dividers, nested submenus, or toggle rows.",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const Default = {};
|
|
111
|
+
|
|
112
|
+
export const WithNestedItems = {
|
|
113
|
+
args: {
|
|
114
|
+
items: NESTED_ITEMS,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const FullWidth = {
|
|
119
|
+
args: {
|
|
120
|
+
fullWidth: true,
|
|
121
|
+
placement: "bottom-start",
|
|
122
|
+
trigger: <Button appearance="soft">Choose action</Button>,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ActionMenu";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
User photo or initials display with optional online status indicator.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- User profile pictures in navigation, lists, comments, or cards
|
|
7
|
+
- Contact lists, team member displays, or assigned user indicators
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Values | Description |
|
|
12
|
+
|------|------|---------|--------|-------------|
|
|
13
|
+
| `src` | `string` | — | Image URL | User photo URL |
|
|
14
|
+
| `initials` | `string` | — | e.g., `"JD"`, `"AB"` | Initials to display when no photo |
|
|
15
|
+
| `name` | `string` | — | — | Full name (auto-generates initials if `initials` not provided) |
|
|
16
|
+
| `status` | `boolean` | `false` | — | Show green online status dot |
|
|
17
|
+
| `size` | `string` | `"default"` | `"small"`, `"default"`, `"large"` | Avatar size |
|
|
18
|
+
| `alt` | `string` | `""` | — | Alt text for image |
|
|
19
|
+
| `className` | `string` | `""` | — | Additional CSS classes |
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
### With photo
|
|
24
|
+
```jsx
|
|
25
|
+
<Avatar src="/photos/user.jpg" alt="John Doe" status />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### With initials
|
|
29
|
+
```jsx
|
|
30
|
+
<Avatar initials="JD" />
|
|
31
|
+
<Avatar name="Jane Smith" /> {/* Auto-generates "JS" */}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Size variants
|
|
35
|
+
```jsx
|
|
36
|
+
<Avatar initials="SM" size="small" />
|
|
37
|
+
<Avatar initials="MD" />
|
|
38
|
+
<Avatar initials="LG" size="large" />
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### In a user list
|
|
42
|
+
```jsx
|
|
43
|
+
<Flex gap="8" alignItems="center">
|
|
44
|
+
<Avatar src={user.photo} size="small" status={user.online} />
|
|
45
|
+
<span>{user.name}</span>
|
|
46
|
+
<Tag label={user.role} color="blue" />
|
|
47
|
+
</Flex>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Composition
|
|
51
|
+
- Inside `Table` custom render functions for user columns
|
|
52
|
+
- In `UDS.Sidebar` for user account section
|
|
53
|
+
- Combined with `Status` or `Badge` for richer user indicators
|
|
54
|
+
- Inside `Card` for profile cards
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./Avatar.scss";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Avatar component for displaying user photos or initials
|
|
6
|
+
* @param {string} src - Image source URL for user photo
|
|
7
|
+
* @param {string} initials - Initials to display (e.g., "EB", "JD")
|
|
8
|
+
* @param {boolean} status - Whether to show the status indicator (green dot)
|
|
9
|
+
* @param {string} size - Size of the avatar: 'small', 'default', 'large' (default: 'default')
|
|
10
|
+
* @param {string} className - Additional CSS classes
|
|
11
|
+
* @param {string} alt - Alt text for the image
|
|
12
|
+
* @param {object} props - Additional props to pass to the avatar container
|
|
13
|
+
*/
|
|
14
|
+
export default function Avatar({
|
|
15
|
+
src,
|
|
16
|
+
initials,
|
|
17
|
+
status = false,
|
|
18
|
+
size = "default",
|
|
19
|
+
className = "",
|
|
20
|
+
alt = "",
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
// Generate initials from name if provided but no initials
|
|
24
|
+
const getInitials = () => {
|
|
25
|
+
if (initials) return initials;
|
|
26
|
+
if (props.name) {
|
|
27
|
+
const names = props.name.trim().split(/\s+/);
|
|
28
|
+
if (names.length >= 2) {
|
|
29
|
+
return (names[0][0] + names[names.length - 1][0]).toUpperCase();
|
|
30
|
+
}
|
|
31
|
+
return names[0][0].toUpperCase();
|
|
32
|
+
}
|
|
33
|
+
return "?";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const sizeClass = size !== "default" ? `avatar--${size}` : "";
|
|
37
|
+
const classes = ["avatar", sizeClass, className].filter(Boolean).join(" ");
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className={classes} {...props}>
|
|
41
|
+
{src ? (
|
|
42
|
+
<img src={src} alt={alt || "User avatar"} className="avatar__image" />
|
|
43
|
+
) : (
|
|
44
|
+
<span className="avatar__initials">{getInitials()}</span>
|
|
45
|
+
)}
|
|
46
|
+
{status && <span className="avatar__status" aria-label="Online status" />}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
@use "../../styles/typography" as *;
|
|
2
|
+
|
|
3
|
+
.avatar {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
width: 48px;
|
|
9
|
+
height: 48px;
|
|
10
|
+
border-radius: 9999px;
|
|
11
|
+
background: var(--uds-surface-brand-quaternary, #004b88);
|
|
12
|
+
|
|
13
|
+
// ── Size: small ─────────────────────────────────────
|
|
14
|
+
&--small {
|
|
15
|
+
width: 32px;
|
|
16
|
+
height: 32px;
|
|
17
|
+
|
|
18
|
+
.avatar__initials {
|
|
19
|
+
font-size: 12px;
|
|
20
|
+
line-height: 16px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.avatar__status {
|
|
24
|
+
width: 8px;
|
|
25
|
+
height: 8px;
|
|
26
|
+
border-width: 1.5px;
|
|
27
|
+
bottom: 1px;
|
|
28
|
+
right: 1px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ── Size: large ─────────────────────────────────────
|
|
33
|
+
&--large {
|
|
34
|
+
width: 64px;
|
|
35
|
+
height: 64px;
|
|
36
|
+
|
|
37
|
+
.avatar__initials {
|
|
38
|
+
font-size: 18px;
|
|
39
|
+
line-height: 24px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.avatar__status {
|
|
43
|
+
width: 16px;
|
|
44
|
+
height: 16px;
|
|
45
|
+
border-width: 2.5px;
|
|
46
|
+
bottom: 3px;
|
|
47
|
+
right: 3px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── Element: image ──────────────────────────────────
|
|
52
|
+
&__image {
|
|
53
|
+
border-radius: 9999px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
object-fit: cover;
|
|
57
|
+
object-position: center;
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ── Element: initials ───────────────────────────────
|
|
62
|
+
&__initials {
|
|
63
|
+
@include uds-body-14-bold;
|
|
64
|
+
color: var(--uds-text-inverse);
|
|
65
|
+
line-height: 20px;
|
|
66
|
+
text-align: center;
|
|
67
|
+
user-select: none;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ── Element: status dot ─────────────────────────────
|
|
76
|
+
&__status {
|
|
77
|
+
position: absolute;
|
|
78
|
+
bottom: 2px;
|
|
79
|
+
right: 2px;
|
|
80
|
+
width: 12px;
|
|
81
|
+
height: 12px;
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
background-color: var(--uds-color-accent-green-500, #23c55e);
|
|
84
|
+
border: 2px solid var(--uds-border-inverse, #ffffff);
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Avatar";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
|
|
3
|
+
Numeric badge indicator for counts, notifications, and status numbers.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- Notification counts on navigation items or icons
|
|
7
|
+
- Unread message counts, item quantities
|
|
8
|
+
- Any numeric indicator that overlays or accompanies another element
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
| Prop | Type | Default | Values | Description |
|
|
13
|
+
|------|------|---------|--------|-------------|
|
|
14
|
+
| `count` | `number\|string` | — | — | Number to display (renders nothing if 0 or falsy) |
|
|
15
|
+
| `variant` | `string` | `"red"` | `"red"`, `"orange"`, `"yellow"`, `"green"`, `"dark-green"`, `"blue"`, `"dark-blue"`, `"purple"`, `"pink"`, `"gray"`, `"outline"` | Color variant |
|
|
16
|
+
| `maxCount` | `number` | `99` | — | Max before showing "99+" |
|
|
17
|
+
| `className` | `string` | `""` | — | Additional CSS classes |
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
<Badge count={5} />
|
|
23
|
+
<Badge count={150} maxCount={99} /> {/* Shows "99+" */}
|
|
24
|
+
<Badge count={3} variant="blue" />
|
|
25
|
+
<Badge count={12} variant="green" />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### With navigation item
|
|
29
|
+
```jsx
|
|
30
|
+
<Flex gap="8" alignItems="center">
|
|
31
|
+
<Icon name="Bell" size={20} />
|
|
32
|
+
<Badge count={notifications.length} />
|
|
33
|
+
</Flex>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Note
|
|
37
|
+
- Returns `null` when `count` is 0 or falsy — safe to always render
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./Badge.scss";
|
|
3
|
+
|
|
4
|
+
const BASE_CLASS = "uds-badge";
|
|
5
|
+
|
|
6
|
+
const variantClassMap = {
|
|
7
|
+
red: "red",
|
|
8
|
+
orange: "orange",
|
|
9
|
+
yellow: "yellow",
|
|
10
|
+
green: "green",
|
|
11
|
+
"dark-green": "dark-green",
|
|
12
|
+
blue: "blue",
|
|
13
|
+
"dark-blue": "dark-blue",
|
|
14
|
+
purple: "purple",
|
|
15
|
+
pink: "pink",
|
|
16
|
+
gray: "gray",
|
|
17
|
+
outline: "outline",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Badge component for displaying badges
|
|
22
|
+
* @param {number|string} count - The count to display (will be formatted with + if over maxCount)
|
|
23
|
+
* @param {string} variant - Color variant: 'red', 'orange', 'yellow', 'green', 'dark-green', 'blue', 'dark-blue', 'purple', 'pink', 'gray', 'outline'
|
|
24
|
+
* @param {number} maxCount - Maximum count to display before showing "+" (default: 99)
|
|
25
|
+
* @param {string} className - Additional CSS classes
|
|
26
|
+
* @param {object} props - Additional props to pass to the badge element
|
|
27
|
+
*/
|
|
28
|
+
export default function Badge({
|
|
29
|
+
count,
|
|
30
|
+
variant = "red",
|
|
31
|
+
maxCount = 99,
|
|
32
|
+
className = "",
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
// Format the count: if over maxCount, show maxCount+
|
|
36
|
+
const formatCount = (num) => {
|
|
37
|
+
const numCount = typeof num === "number" ? num : parseInt(num, 10);
|
|
38
|
+
if (isNaN(numCount)) return "0";
|
|
39
|
+
if (numCount > maxCount) {
|
|
40
|
+
return `${maxCount}+`;
|
|
41
|
+
}
|
|
42
|
+
return numCount.toString();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const formattedCount = formatCount(count);
|
|
46
|
+
|
|
47
|
+
const classNames = [
|
|
48
|
+
BASE_CLASS,
|
|
49
|
+
variantClassMap[variant] && `${BASE_CLASS}--${variantClassMap[variant]}`,
|
|
50
|
+
className,
|
|
51
|
+
]
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(" ");
|
|
54
|
+
|
|
55
|
+
if (!count || count === 0) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<span className={classNames} {...props}>
|
|
61
|
+
{formattedCount}
|
|
62
|
+
</span>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@use "../../styles/typography" as *;
|
|
2
|
+
|
|
3
|
+
.uds-badge {
|
|
4
|
+
@include uds-body-12-semibold;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
min-width: 24px;
|
|
9
|
+
height: 20px;
|
|
10
|
+
padding-inline: var(--uds-spacing-6);
|
|
11
|
+
padding-block: var(--uds-spacing-2);
|
|
12
|
+
border-radius: 999px; // Fully rounded pill shape
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
line-height: 1;
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
|
|
18
|
+
// Variant styles
|
|
19
|
+
&--red {
|
|
20
|
+
background-color: #ef4444; // Red
|
|
21
|
+
color: #ffffff;
|
|
22
|
+
border: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&--orange {
|
|
26
|
+
background-color: #f97316; // Orange
|
|
27
|
+
color: #ffffff;
|
|
28
|
+
border: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--yellow {
|
|
32
|
+
background-color: #eab308; // Yellow
|
|
33
|
+
color: #000000;
|
|
34
|
+
border: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&--green {
|
|
38
|
+
background-color: #22c55e; // Light green
|
|
39
|
+
color: #000000;
|
|
40
|
+
border: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&--dark-green {
|
|
44
|
+
background-color: #16a34a; // Dark green
|
|
45
|
+
color: #ffffff;
|
|
46
|
+
border: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--blue {
|
|
50
|
+
background-color: #3b82f6; // Light blue
|
|
51
|
+
color: #ffffff;
|
|
52
|
+
border: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&--dark-blue {
|
|
56
|
+
background-color: #2563eb; // Dark blue
|
|
57
|
+
color: #ffffff;
|
|
58
|
+
border: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--purple {
|
|
62
|
+
background-color: #a855f7; // Purple
|
|
63
|
+
color: #ffffff;
|
|
64
|
+
border: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&--pink {
|
|
68
|
+
background-color: #ec4899; // Pink/Magenta
|
|
69
|
+
color: #ffffff;
|
|
70
|
+
border: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&--gray {
|
|
74
|
+
background-color: #1f2937; // Dark gray/Black
|
|
75
|
+
color: #ffffff;
|
|
76
|
+
border: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&--outline {
|
|
80
|
+
background-color: #f3f4f6; // Light gray
|
|
81
|
+
color: #111827; // Dark gray/black
|
|
82
|
+
border: var(--uds-border-width-1) solid #d1d5db; // Slightly darker gray
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Badge";
|