@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,504 @@
|
|
|
1
|
+
import React, { useState, useMemo, useCallback } from "react";
|
|
2
|
+
import Button from "../Button/Button";
|
|
3
|
+
import "./Calendar.scss";
|
|
4
|
+
|
|
5
|
+
const BASE_CLASS = "uds-calendar";
|
|
6
|
+
|
|
7
|
+
const DAYS_OF_WEEK = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
8
|
+
const DAYS_SHORT = ["S", "M", "T", "W", "T", "F", "S"];
|
|
9
|
+
const MONTHS = [
|
|
10
|
+
"January", "February", "March", "April", "May", "June",
|
|
11
|
+
"July", "August", "September", "October", "November", "December",
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
/* ── Date helpers ──────────────────────────────────────────────────── */
|
|
15
|
+
|
|
16
|
+
function normalizeDate(date) {
|
|
17
|
+
const d = new Date(date);
|
|
18
|
+
d.setHours(0, 0, 0, 0);
|
|
19
|
+
return d;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function toDateKey(date) {
|
|
23
|
+
const y = date.getFullYear();
|
|
24
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
25
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
26
|
+
return `${y}-${m}-${d}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function daysBetween(a, b) {
|
|
30
|
+
return Math.round((b - a) / 86400000);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* ── Normalize event dates ─────────────────────────────────────────── */
|
|
34
|
+
|
|
35
|
+
function normalizeEvent(evt) {
|
|
36
|
+
const start = normalizeDate(evt.startDate || evt.date);
|
|
37
|
+
const end = evt.endDate ? normalizeDate(evt.endDate) : start;
|
|
38
|
+
const isMultiDay = daysBetween(start, end) > 0;
|
|
39
|
+
const isAllDay = evt.allDay || isMultiDay;
|
|
40
|
+
return { ...evt, _start: start, _end: end, _isMultiDay: isMultiDay, _isAllDay: isAllDay };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ── Lane assignment (greedy first-fit) ────────────────────────────── */
|
|
44
|
+
|
|
45
|
+
function assignLanes(segments) {
|
|
46
|
+
const sorted = [...segments].sort(
|
|
47
|
+
(a, b) => a.startCol - b.startCol || b.span - a.span
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const lanes = [];
|
|
51
|
+
|
|
52
|
+
return sorted.map((seg) => {
|
|
53
|
+
let lane = 0;
|
|
54
|
+
while (lane < lanes.length && lanes[lane] > seg.startCol) {
|
|
55
|
+
lane++;
|
|
56
|
+
}
|
|
57
|
+
if (lane === lanes.length) lanes.push(0);
|
|
58
|
+
lanes[lane] = seg.startCol + seg.span;
|
|
59
|
+
return { ...seg, lane };
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* ── Inline Event Bar ──────────────────────────────────────────────── */
|
|
64
|
+
|
|
65
|
+
function EventBar({ title, type, status, startCap, endCap, onClick }) {
|
|
66
|
+
const showContent = startCap;
|
|
67
|
+
const Element = onClick ? "button" : "div";
|
|
68
|
+
|
|
69
|
+
const classNames = [
|
|
70
|
+
`${BASE_CLASS}__event-bar`,
|
|
71
|
+
`${BASE_CLASS}__event-bar--${type}`,
|
|
72
|
+
`${BASE_CLASS}__event-bar--${status}`,
|
|
73
|
+
!startCap && `${BASE_CLASS}__event-bar--no-start-cap`,
|
|
74
|
+
!endCap && `${BASE_CLASS}__event-bar--no-end-cap`,
|
|
75
|
+
!showContent && `${BASE_CLASS}__event-bar--bar-only`,
|
|
76
|
+
]
|
|
77
|
+
.filter(Boolean)
|
|
78
|
+
.join(" ");
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Element
|
|
82
|
+
className={classNames}
|
|
83
|
+
onClick={onClick}
|
|
84
|
+
type={onClick ? "button" : undefined}
|
|
85
|
+
title={title}
|
|
86
|
+
>
|
|
87
|
+
{status === "pending" && (
|
|
88
|
+
<span className={`${BASE_CLASS}__event-bar-pattern`} aria-hidden="true" />
|
|
89
|
+
)}
|
|
90
|
+
{showContent && (
|
|
91
|
+
<span className={`${BASE_CLASS}__event-bar-label`}>{title}</span>
|
|
92
|
+
)}
|
|
93
|
+
</Element>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* ── Calendar Component ────────────────────────────────────────────── */
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Calendar — A full-size calendar component with multi-day spanning events.
|
|
101
|
+
*
|
|
102
|
+
* Events support `startDate` + `endDate` for multi-day spans across
|
|
103
|
+
* days, weeks, and months. Renders lightweight inline event bars.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} view - "month" (default) or "week"
|
|
106
|
+
* @param {Date} defaultDate - Initial date to display (default: today)
|
|
107
|
+
* @param {Date} value - Selected date (controlled)
|
|
108
|
+
* @param {Array} events - Event objects (see docs for shape)
|
|
109
|
+
* @param {function} onDateSelect - (date: Date) => void
|
|
110
|
+
* @param {function} onEventClick - (event, e) => void
|
|
111
|
+
* @param {number} maxEventsPerDay - Max event rows per cell (default: 3)
|
|
112
|
+
* @param {boolean} showWeekNumbers - Show ISO week number column
|
|
113
|
+
* @param {string} size - "default" or "compact"
|
|
114
|
+
* @param {string} className - Additional CSS classes
|
|
115
|
+
*/
|
|
116
|
+
export default function Calendar({
|
|
117
|
+
view = "month",
|
|
118
|
+
defaultDate,
|
|
119
|
+
value,
|
|
120
|
+
events = [],
|
|
121
|
+
onDateSelect,
|
|
122
|
+
onEventClick,
|
|
123
|
+
maxEventsPerDay = 3,
|
|
124
|
+
showWeekNumbers = false,
|
|
125
|
+
size = "default",
|
|
126
|
+
className = "",
|
|
127
|
+
...rest
|
|
128
|
+
}) {
|
|
129
|
+
const [currentDate, setCurrentDate] = useState(
|
|
130
|
+
defaultDate ? normalizeDate(defaultDate) : normalizeDate(new Date())
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const today = useMemo(() => normalizeDate(new Date()), []);
|
|
134
|
+
const year = currentDate.getFullYear();
|
|
135
|
+
const monthIndex = currentDate.getMonth();
|
|
136
|
+
|
|
137
|
+
// ── Normalize all events ────────────────────────────────────────
|
|
138
|
+
const normalizedEvents = useMemo(
|
|
139
|
+
() => events.map(normalizeEvent),
|
|
140
|
+
[events]
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
// ── Build 6-row month grid ──────────────────────────────────────
|
|
144
|
+
const calendarWeeks = useMemo(() => {
|
|
145
|
+
const firstOfMonth = new Date(year, monthIndex, 1);
|
|
146
|
+
const startDay = firstOfMonth.getDay();
|
|
147
|
+
const daysInMonth = new Date(year, monthIndex + 1, 0).getDate();
|
|
148
|
+
const daysInPrevMonth = new Date(year, monthIndex, 0).getDate();
|
|
149
|
+
|
|
150
|
+
const weeks = [];
|
|
151
|
+
let dayCounter = 1;
|
|
152
|
+
let nextMonthDay = 1;
|
|
153
|
+
|
|
154
|
+
for (let w = 0; w < 6; w++) {
|
|
155
|
+
const row = [];
|
|
156
|
+
for (let dow = 0; dow < 7; dow++) {
|
|
157
|
+
const idx = w * 7 + dow;
|
|
158
|
+
if (idx < startDay) {
|
|
159
|
+
const prevDay = daysInPrevMonth - startDay + 1 + idx;
|
|
160
|
+
row.push({ date: normalizeDate(new Date(year, monthIndex - 1, prevDay)), isCurrentMonth: false });
|
|
161
|
+
} else if (dayCounter <= daysInMonth) {
|
|
162
|
+
row.push({ date: normalizeDate(new Date(year, monthIndex, dayCounter)), isCurrentMonth: true });
|
|
163
|
+
dayCounter++;
|
|
164
|
+
} else {
|
|
165
|
+
row.push({ date: normalizeDate(new Date(year, monthIndex + 1, nextMonthDay)), isCurrentMonth: false });
|
|
166
|
+
nextMonthDay++;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
weeks.push(row);
|
|
170
|
+
}
|
|
171
|
+
return weeks;
|
|
172
|
+
}, [year, monthIndex]);
|
|
173
|
+
|
|
174
|
+
// ── Week view grid ──────────────────────────────────────────────
|
|
175
|
+
const weekDays = useMemo(() => {
|
|
176
|
+
if (view !== "week") return [];
|
|
177
|
+
const start = new Date(currentDate);
|
|
178
|
+
start.setDate(start.getDate() - start.getDay());
|
|
179
|
+
return Array.from({ length: 7 }, (_, i) => {
|
|
180
|
+
const d = new Date(start);
|
|
181
|
+
d.setDate(d.getDate() + i);
|
|
182
|
+
return normalizeDate(d);
|
|
183
|
+
});
|
|
184
|
+
}, [view, currentDate]);
|
|
185
|
+
|
|
186
|
+
// ── Compute event layout for a week row ─────────────────────────
|
|
187
|
+
const computeWeekLayout = useCallback(
|
|
188
|
+
(weekDates) => {
|
|
189
|
+
const weekStart = weekDates[0];
|
|
190
|
+
const weekEnd = weekDates[6];
|
|
191
|
+
|
|
192
|
+
const spanningEvents = [];
|
|
193
|
+
const timedByDay = Array.from({ length: 7 }, () => []);
|
|
194
|
+
|
|
195
|
+
normalizedEvents.forEach((evt) => {
|
|
196
|
+
if (evt._end < weekStart || evt._start > weekEnd) return;
|
|
197
|
+
|
|
198
|
+
if (evt._isAllDay || evt._isMultiDay) {
|
|
199
|
+
const clipStart = evt._start < weekStart ? weekStart : evt._start;
|
|
200
|
+
const clipEnd = evt._end > weekEnd ? weekEnd : evt._end;
|
|
201
|
+
const startCol = daysBetween(weekStart, clipStart);
|
|
202
|
+
const endCol = daysBetween(weekStart, clipEnd);
|
|
203
|
+
const span = endCol - startCol + 1;
|
|
204
|
+
|
|
205
|
+
spanningEvents.push({
|
|
206
|
+
event: evt,
|
|
207
|
+
startCol,
|
|
208
|
+
span,
|
|
209
|
+
isStart: evt._start >= weekStart,
|
|
210
|
+
isEnd: evt._end <= weekEnd,
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
const col = daysBetween(weekStart, evt._start);
|
|
214
|
+
if (col >= 0 && col < 7) {
|
|
215
|
+
timedByDay[col].push(evt);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
timedByDay.forEach((arr) =>
|
|
221
|
+
arr.sort((a, b) => (a.startTime || "").localeCompare(b.startTime || ""))
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
const segments = assignLanes(spanningEvents);
|
|
225
|
+
const maxLane = segments.length > 0 ? Math.max(...segments.map((s) => s.lane)) + 1 : 0;
|
|
226
|
+
|
|
227
|
+
return { segments, timedByDay, maxLane };
|
|
228
|
+
},
|
|
229
|
+
[normalizedEvents]
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
// ── Precompute layouts for all visible weeks ────────────────────
|
|
233
|
+
const weekLayouts = useMemo(() => {
|
|
234
|
+
if (view === "month") {
|
|
235
|
+
return calendarWeeks.map((week) =>
|
|
236
|
+
computeWeekLayout(week.map((c) => c.date))
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
if (view === "week") {
|
|
240
|
+
return [computeWeekLayout(weekDays)];
|
|
241
|
+
}
|
|
242
|
+
return [];
|
|
243
|
+
}, [view, calendarWeeks, weekDays, computeWeekLayout]);
|
|
244
|
+
|
|
245
|
+
// ── ISO week number ─────────────────────────────────────────────
|
|
246
|
+
const getWeekNumber = useCallback((date) => {
|
|
247
|
+
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
248
|
+
const dayNum = d.getUTCDay() || 7;
|
|
249
|
+
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
|
|
250
|
+
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
|
|
251
|
+
return Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
|
|
252
|
+
}, []);
|
|
253
|
+
|
|
254
|
+
// ── Navigation ──────────────────────────────────────────────────
|
|
255
|
+
const handlePrev = () => {
|
|
256
|
+
if (view === "week") {
|
|
257
|
+
setCurrentDate((d) => { const n = new Date(d); n.setDate(n.getDate() - 7); return n; });
|
|
258
|
+
} else {
|
|
259
|
+
setCurrentDate(new Date(year, monthIndex - 1, 1));
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const handleNext = () => {
|
|
264
|
+
if (view === "week") {
|
|
265
|
+
setCurrentDate((d) => { const n = new Date(d); n.setDate(n.getDate() + 7); return n; });
|
|
266
|
+
} else {
|
|
267
|
+
setCurrentDate(new Date(year, monthIndex + 1, 1));
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const handleToday = () => setCurrentDate(normalizeDate(new Date()));
|
|
272
|
+
|
|
273
|
+
// ── Helpers ─────────────────────────────────────────────────────
|
|
274
|
+
const isToday = (date) => date.getTime() === today.getTime();
|
|
275
|
+
const isSelected = (date) => value && date.getTime() === normalizeDate(value).getTime();
|
|
276
|
+
|
|
277
|
+
const handleDateClick = (date) => {
|
|
278
|
+
if (onDateSelect) onDateSelect(date);
|
|
279
|
+
};
|
|
280
|
+
const handleEventClick = (evt, e) => {
|
|
281
|
+
e.stopPropagation();
|
|
282
|
+
if (onEventClick) onEventClick(evt, e);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// ── Header title ────────────────────────────────────────────────
|
|
286
|
+
const headerTitle = useMemo(() => {
|
|
287
|
+
if (view === "week" && weekDays.length === 7) {
|
|
288
|
+
const s = weekDays[0];
|
|
289
|
+
const e = weekDays[6];
|
|
290
|
+
if (s.getMonth() === e.getMonth()) {
|
|
291
|
+
return `${MONTHS[s.getMonth()]} ${s.getDate()}–${e.getDate()}, ${s.getFullYear()}`;
|
|
292
|
+
}
|
|
293
|
+
return `${MONTHS[s.getMonth()].slice(0, 3)} ${s.getDate()} – ${MONTHS[e.getMonth()].slice(0, 3)} ${e.getDate()}, ${e.getFullYear()}`;
|
|
294
|
+
}
|
|
295
|
+
return `${MONTHS[monthIndex]} ${year}`;
|
|
296
|
+
}, [view, weekDays, monthIndex, year]);
|
|
297
|
+
|
|
298
|
+
// ── Render a week row ───────────────────────────────────────────
|
|
299
|
+
const renderWeekRow = (dates, cells, layout, weekIdx) => {
|
|
300
|
+
const { segments, timedByDay, maxLane } = layout;
|
|
301
|
+
|
|
302
|
+
// Build lane grid: lanes[lane][col] = segment | null
|
|
303
|
+
const laneGrid = Array.from({ length: maxLane }, () => Array(7).fill(null));
|
|
304
|
+
segments.forEach((seg) => {
|
|
305
|
+
for (let c = seg.startCol; c < seg.startCol + seg.span; c++) {
|
|
306
|
+
laneGrid[seg.lane][c] = seg;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
// For each cell, compute total event count and overflow
|
|
311
|
+
const cellEventCounts = dates.map((_, col) => {
|
|
312
|
+
let count = 0;
|
|
313
|
+
for (let lane = 0; lane < maxLane; lane++) {
|
|
314
|
+
if (laneGrid[lane][col]) count++;
|
|
315
|
+
}
|
|
316
|
+
count += timedByDay[col].length;
|
|
317
|
+
return count;
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
const maxRows = maxEventsPerDay;
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<div key={weekIdx} className={`${BASE_CLASS}__week-row`}>
|
|
324
|
+
{showWeekNumbers && (
|
|
325
|
+
<div className={`${BASE_CLASS}__week-number`}>
|
|
326
|
+
{getWeekNumber(dates[0])}
|
|
327
|
+
</div>
|
|
328
|
+
)}
|
|
329
|
+
<div className={`${BASE_CLASS}__week-content`}>
|
|
330
|
+
{/* Day number strip */}
|
|
331
|
+
<div className={`${BASE_CLASS}__day-strip`}>
|
|
332
|
+
{dates.map((date, col) => {
|
|
333
|
+
const cell = cells ? cells[col] : null;
|
|
334
|
+
const isOutside = cell ? !cell.isCurrentMonth : false;
|
|
335
|
+
return (
|
|
336
|
+
<div
|
|
337
|
+
key={toDateKey(date)}
|
|
338
|
+
className={[
|
|
339
|
+
`${BASE_CLASS}__day-cell`,
|
|
340
|
+
isOutside && `${BASE_CLASS}__day-cell--outside`,
|
|
341
|
+
isToday(date) && `${BASE_CLASS}__day-cell--today`,
|
|
342
|
+
isSelected(date) && `${BASE_CLASS}__day-cell--selected`,
|
|
343
|
+
].filter(Boolean).join(" ")}
|
|
344
|
+
onClick={() => handleDateClick(date)}
|
|
345
|
+
role="button"
|
|
346
|
+
tabIndex={0}
|
|
347
|
+
onKeyDown={(e) => {
|
|
348
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
349
|
+
e.preventDefault();
|
|
350
|
+
handleDateClick(date);
|
|
351
|
+
}
|
|
352
|
+
}}
|
|
353
|
+
aria-label={`${date.getDate()} ${MONTHS[date.getMonth()]} ${date.getFullYear()}`}
|
|
354
|
+
>
|
|
355
|
+
<span
|
|
356
|
+
className={[
|
|
357
|
+
`${BASE_CLASS}__day-number`,
|
|
358
|
+
isToday(date) && `${BASE_CLASS}__day-number--today`,
|
|
359
|
+
].filter(Boolean).join(" ")}
|
|
360
|
+
>
|
|
361
|
+
{date.getDate()}
|
|
362
|
+
</span>
|
|
363
|
+
</div>
|
|
364
|
+
);
|
|
365
|
+
})}
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
{/* Events overlay — absolutely positioned over day cells */}
|
|
369
|
+
<div className={`${BASE_CLASS}__events-overlay`}>
|
|
370
|
+
{/* Event lanes (spanning / all-day events) */}
|
|
371
|
+
{Array.from({ length: Math.min(maxLane, maxRows) }, (_, laneIdx) => (
|
|
372
|
+
<div key={`lane-${laneIdx}`} className={`${BASE_CLASS}__event-lane`}>
|
|
373
|
+
{(() => {
|
|
374
|
+
const rendered = [];
|
|
375
|
+
let col = 0;
|
|
376
|
+
while (col < 7) {
|
|
377
|
+
const seg = laneGrid[laneIdx][col];
|
|
378
|
+
if (seg && col === seg.startCol) {
|
|
379
|
+
rendered.push(
|
|
380
|
+
<div
|
|
381
|
+
key={seg.event.id || `seg-${col}`}
|
|
382
|
+
className={`${BASE_CLASS}__event-slot`}
|
|
383
|
+
style={{ gridColumn: `${col + 1} / ${col + seg.span + 1}` }}
|
|
384
|
+
>
|
|
385
|
+
<EventBar
|
|
386
|
+
title={seg.event.title}
|
|
387
|
+
type={seg.event.type || "travel"}
|
|
388
|
+
status={seg.event.status || "active"}
|
|
389
|
+
startCap={seg.isStart}
|
|
390
|
+
endCap={seg.isEnd}
|
|
391
|
+
onClick={onEventClick ? (e) => handleEventClick(seg.event, e) : undefined}
|
|
392
|
+
/>
|
|
393
|
+
</div>
|
|
394
|
+
);
|
|
395
|
+
col += seg.span;
|
|
396
|
+
} else if (seg && col !== seg.startCol) {
|
|
397
|
+
col++;
|
|
398
|
+
} else {
|
|
399
|
+
rendered.push(
|
|
400
|
+
<div
|
|
401
|
+
key={`empty-${col}`}
|
|
402
|
+
className={`${BASE_CLASS}__event-slot ${BASE_CLASS}__event-slot--empty`}
|
|
403
|
+
style={{ gridColumn: `${col + 1}` }}
|
|
404
|
+
/>
|
|
405
|
+
);
|
|
406
|
+
col++;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return rendered;
|
|
410
|
+
})()}
|
|
411
|
+
</div>
|
|
412
|
+
))}
|
|
413
|
+
|
|
414
|
+
{/* Timed events row */}
|
|
415
|
+
<div className={`${BASE_CLASS}__timed-row`}>
|
|
416
|
+
{dates.map((date, col) => {
|
|
417
|
+
const usedLanes = Math.min(maxLane, maxRows);
|
|
418
|
+
const remainingSlots = Math.max(0, maxRows - usedLanes);
|
|
419
|
+
const visibleTimed = timedByDay[col].slice(0, remainingSlots);
|
|
420
|
+
const totalEvents = cellEventCounts[col];
|
|
421
|
+
const overflowCount = totalEvents - maxRows;
|
|
422
|
+
|
|
423
|
+
return (
|
|
424
|
+
<div key={toDateKey(date)} className={`${BASE_CLASS}__timed-col`}>
|
|
425
|
+
{visibleTimed.map((evt) => (
|
|
426
|
+
<EventBar
|
|
427
|
+
key={evt.id || evt.title}
|
|
428
|
+
title={evt.startTime ? `${evt.startTime} ${evt.title}` : evt.title}
|
|
429
|
+
type={evt.type || "travel"}
|
|
430
|
+
status={evt.status || "active"}
|
|
431
|
+
startCap
|
|
432
|
+
endCap
|
|
433
|
+
onClick={onEventClick ? (e) => handleEventClick(evt, e) : undefined}
|
|
434
|
+
/>
|
|
435
|
+
))}
|
|
436
|
+
{overflowCount > 0 && (
|
|
437
|
+
<span className={`${BASE_CLASS}__more`}>
|
|
438
|
+
+{overflowCount} more
|
|
439
|
+
</span>
|
|
440
|
+
)}
|
|
441
|
+
</div>
|
|
442
|
+
);
|
|
443
|
+
})}
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// ── Root class ──────────────────────────────────────────────────
|
|
452
|
+
const rootClass = [
|
|
453
|
+
BASE_CLASS,
|
|
454
|
+
size === "compact" && `${BASE_CLASS}--compact`,
|
|
455
|
+
view === "week" && `${BASE_CLASS}--week`,
|
|
456
|
+
className,
|
|
457
|
+
].filter(Boolean).join(" ");
|
|
458
|
+
|
|
459
|
+
// ── RENDER ──────────────────────────────────────────────────────
|
|
460
|
+
return (
|
|
461
|
+
<div className={rootClass} {...rest}>
|
|
462
|
+
{/* Header */}
|
|
463
|
+
<div className={`${BASE_CLASS}__header`}>
|
|
464
|
+
<div className={`${BASE_CLASS}__header-left`}>
|
|
465
|
+
<h2 className={`${BASE_CLASS}__title`}>{headerTitle}</h2>
|
|
466
|
+
</div>
|
|
467
|
+
<div className={`${BASE_CLASS}__header-right`}>
|
|
468
|
+
<Button label="Today" appearance="outline" size="small" onClick={handleToday} />
|
|
469
|
+
<Button icon="CaretLeft" appearance="ghost" size="small" layout="icon-only" onClick={handlePrev} aria-label={view === "week" ? "Previous week" : "Previous month"} />
|
|
470
|
+
<Button icon="CaretRight" appearance="ghost" size="small" layout="icon-only" onClick={handleNext} aria-label={view === "week" ? "Next week" : "Next month"} />
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
|
|
474
|
+
{/* Weekday header */}
|
|
475
|
+
<div className={`${BASE_CLASS}__weekday-row`}>
|
|
476
|
+
{showWeekNumbers && <div className={`${BASE_CLASS}__week-number-header`}>Wk</div>}
|
|
477
|
+
{(size === "compact" ? DAYS_SHORT : DAYS_OF_WEEK).map((day, i) => (
|
|
478
|
+
<div key={i} className={`${BASE_CLASS}__weekday`}>{day}</div>
|
|
479
|
+
))}
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
{/* Month view */}
|
|
483
|
+
{view === "month" && (
|
|
484
|
+
<div className={`${BASE_CLASS}__grid`}>
|
|
485
|
+
{calendarWeeks.map((week, idx) =>
|
|
486
|
+
renderWeekRow(
|
|
487
|
+
week.map((c) => c.date),
|
|
488
|
+
week,
|
|
489
|
+
weekLayouts[idx],
|
|
490
|
+
idx
|
|
491
|
+
)
|
|
492
|
+
)}
|
|
493
|
+
</div>
|
|
494
|
+
)}
|
|
495
|
+
|
|
496
|
+
{/* Week view */}
|
|
497
|
+
{view === "week" && weekLayouts.length > 0 && (
|
|
498
|
+
<div className={`${BASE_CLASS}__grid`}>
|
|
499
|
+
{renderWeekRow(weekDays, null, weekLayouts[0], 0)}
|
|
500
|
+
</div>
|
|
501
|
+
)}
|
|
502
|
+
</div>
|
|
503
|
+
);
|
|
504
|
+
}
|