@heliosgraphics/ui 2.0.0-alpha.100
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.md +21 -0
- package/components/Alert/Alert.meta.ts +45 -0
- package/components/Alert/Alert.module.css +41 -0
- package/components/Alert/Alert.tsx +54 -0
- package/components/Alert/Alert.types.ts +15 -0
- package/components/Alert/index.ts +1 -0
- package/components/Breadcrumb/Breadcrumb.meta.ts +17 -0
- package/components/Breadcrumb/Breadcrumb.tsx +55 -0
- package/components/Breadcrumb/Breadcrumb.types.ts +13 -0
- package/components/Breadcrumb/index.ts +2 -0
- package/components/Browser/Browser.meta.ts +27 -0
- package/components/Browser/Browser.module.css +3 -0
- package/components/Browser/Browser.tsx +16 -0
- package/components/Browser/Browser.types.ts +9 -0
- package/components/Browser/index.ts +1 -0
- package/components/Button/Button.meta.ts +46 -0
- package/components/Button/Button.module.css +337 -0
- package/components/Button/Button.spec.tsx +6 -0
- package/components/Button/Button.tsx +207 -0
- package/components/Button/Button.types.ts +30 -0
- package/components/Button/index.ts +2 -0
- package/components/ButtonGroup/ButtonGroup.meta.ts +37 -0
- package/components/ButtonGroup/ButtonGroup.module.css +55 -0
- package/components/ButtonGroup/ButtonGroup.spec.tsx +6 -0
- package/components/ButtonGroup/ButtonGroup.tsx +41 -0
- package/components/ButtonGroup/ButtonGroup.types.ts +11 -0
- package/components/ButtonGroup/index.ts +2 -0
- package/components/Checkbox/Checkbox.meta.ts +54 -0
- package/components/Checkbox/Checkbox.module.css +99 -0
- package/components/Checkbox/Checkbox.tsx +80 -0
- package/components/Checkbox/Checkbox.types.ts +17 -0
- package/components/Checkbox/index.ts +1 -0
- package/components/Clock/Clock.meta.ts +14 -0
- package/components/Clock/Clock.module.css +27 -0
- package/components/Clock/Clock.tsx +66 -0
- package/components/Clock/Clock.types.ts +1 -0
- package/components/Clock/Clock.utils.ts +16 -0
- package/components/Clock/index.ts +1 -0
- package/components/Column/Column.meta.ts +22 -0
- package/components/Column/Column.tsx +21 -0
- package/components/Column/Column.types.ts +8 -0
- package/components/Column/index.ts +2 -0
- package/components/Confirm/Confirm.meta.ts +51 -0
- package/components/Confirm/Confirm.tsx +40 -0
- package/components/Confirm/Confirm.types.ts +17 -0
- package/components/Confirm/index.ts +1 -0
- package/components/DatePicker/DatePicker.meta.ts +25 -0
- package/components/DatePicker/DatePicker.module.css +72 -0
- package/components/DatePicker/DatePicker.tsx +126 -0
- package/components/DatePicker/DatePicker.types.ts +8 -0
- package/components/DatePicker/DatePicker.utils.ts +53 -0
- package/components/DatePicker/index.ts +1 -0
- package/components/Debug/Debug.meta.ts +22 -0
- package/components/Debug/Debug.module.css +17 -0
- package/components/Debug/Debug.tsx +48 -0
- package/components/Debug/Debug.types.ts +6 -0
- package/components/Debug/Debug.utils.ts +23 -0
- package/components/Debug/index.ts +1 -0
- package/components/Details/Details.meta.ts +22 -0
- package/components/Details/Details.module.css +36 -0
- package/components/Details/Details.tsx +21 -0
- package/components/Details/Details.types.ts +8 -0
- package/components/Details/index.ts +1 -0
- package/components/Dialog/Dialog.meta.ts +48 -0
- package/components/Dialog/Dialog.module.css +109 -0
- package/components/Dialog/Dialog.tsx +100 -0
- package/components/Dialog/Dialog.types.ts +13 -0
- package/components/Dialog/index.ts +1 -0
- package/components/Donut/Donut.meta.ts +25 -0
- package/components/Donut/Donut.module.css +8 -0
- package/components/Donut/Donut.tsx +63 -0
- package/components/Donut/Donut.types.ts +12 -0
- package/components/Donut/Donut.utils.ts +11 -0
- package/components/Donut/index.ts +2 -0
- package/components/Dot/Dot.meta.ts +26 -0
- package/components/Dot/Dot.module.css +24 -0
- package/components/Dot/Dot.spec.tsx +6 -0
- package/components/Dot/Dot.tsx +46 -0
- package/components/Dot/Dot.types.ts +8 -0
- package/components/Dot/index.ts +1 -0
- package/components/Dropdown/Dropdown.meta.ts +30 -0
- package/components/Dropdown/Dropdown.module.css +92 -0
- package/components/Dropdown/Dropdown.tsx +117 -0
- package/components/Dropdown/Dropdown.types.ts +10 -0
- package/components/Dropdown/index.ts +2 -0
- package/components/Fieldset/Fieldset.meta.ts +18 -0
- package/components/Fieldset/Fieldset.module.css +3 -0
- package/components/Fieldset/Fieldset.tsx +14 -0
- package/components/Fieldset/Fieldset.types.ts +7 -0
- package/components/Fieldset/index.ts +1 -0
- package/components/Flex/Flex.meta.ts +47 -0
- package/components/Flex/Flex.tsx +40 -0
- package/components/Flex/Flex.types.ts +38 -0
- package/components/Flex/Flex.utils.spec.ts +97 -0
- package/components/Flex/Flex.utils.ts +162 -0
- package/components/Flex/index.ts +4 -0
- package/components/Grid/Grid.meta.ts +22 -0
- package/components/Grid/Grid.tsx +17 -0
- package/components/Grid/Grid.types.ts +8 -0
- package/components/Grid/index.ts +1 -0
- package/components/Heading/Heading.meta.ts +23 -0
- package/components/Heading/Heading.module.css +19 -0
- package/components/Heading/Heading.tsx +69 -0
- package/components/Heading/Heading.types.ts +9 -0
- package/components/Heading/components/H0/H0.meta.ts +11 -0
- package/components/Heading/components/H0/H0.module.css +4 -0
- package/components/Heading/components/H0/H0.tsx +12 -0
- package/components/Heading/components/H0/H0.types.ts +3 -0
- package/components/Heading/components/H0/index.ts +1 -0
- package/components/Heading/components/H1/H1.meta.ts +11 -0
- package/components/Heading/components/H1/H1.tsx +9 -0
- package/components/Heading/components/H1/H1.types.ts +3 -0
- package/components/Heading/components/H1/index.ts +1 -0
- package/components/Heading/components/H2/H2.meta.ts +11 -0
- package/components/Heading/components/H2/H2.tsx +9 -0
- package/components/Heading/components/H2/H2.types.ts +3 -0
- package/components/Heading/components/H2/index.ts +1 -0
- package/components/Heading/components/H3/H3.meta.ts +11 -0
- package/components/Heading/components/H3/H3.tsx +9 -0
- package/components/Heading/components/H3/H3.types.ts +3 -0
- package/components/Heading/components/H3/index.ts +1 -0
- package/components/Heading/components/H4/H4.meta.ts +11 -0
- package/components/Heading/components/H4/H4.tsx +9 -0
- package/components/Heading/components/H4/H4.types.ts +3 -0
- package/components/Heading/components/H4/index.ts +1 -0
- package/components/Heading/components/H5/H5.meta.ts +11 -0
- package/components/Heading/components/H5/H5.tsx +9 -0
- package/components/Heading/components/H5/H5.types.ts +3 -0
- package/components/Heading/components/H5/index.ts +1 -0
- package/components/Heading/components/H6/H6.meta.ts +11 -0
- package/components/Heading/components/H6/H6.tsx +9 -0
- package/components/Heading/components/H6/H6.types.ts +3 -0
- package/components/Heading/components/H6/index.ts +1 -0
- package/components/Heading/index.ts +2 -0
- package/components/Icon/Icon.meta.ts +28 -0
- package/components/Icon/Icon.module.css +22 -0
- package/components/Icon/Icon.tsx +32 -0
- package/components/Icon/Icon.types.ts +9 -0
- package/components/Icon/index.ts +1 -0
- package/components/Input/Input.meta.ts +53 -0
- package/components/Input/Input.module.css +82 -0
- package/components/Input/Input.tsx +124 -0
- package/components/Input/Input.types.ts +28 -0
- package/components/Input/index.ts +1 -0
- package/components/Layout/Layout.meta.ts +19 -0
- package/components/Layout/Layout.module.css +7 -0
- package/components/Layout/Layout.tsx +33 -0
- package/components/Layout/Layout.types.ts +19 -0
- package/components/Layout/components/LayoutAside/LayoutAside.meta.ts +15 -0
- package/components/Layout/components/LayoutAside/LayoutAside.module.css +40 -0
- package/components/Layout/components/LayoutAside/LayoutAside.tsx +27 -0
- package/components/Layout/components/LayoutAside/LayoutAside.types.ts +14 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideContent/LayoutAsideContent.meta.ts +15 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideContent/LayoutAsideContent.module.css +5 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideContent/LayoutAsideContent.tsx +19 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideContent/LayoutAsideContent.types.ts +5 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideContent/index.ts +1 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/LayoutAsideFooter.meta.ts +15 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/LayoutAsideFooter.module.css +10 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/LayoutAsideFooter.tsx +19 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/LayoutAsideFooter.types.ts +5 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/index.ts +1 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/LayoutAsideToggle.meta.ts +14 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/LayoutAsideToggle.tsx +31 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/LayoutAsideToggle.types.ts +1 -0
- package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/index.ts +1 -0
- package/components/Layout/components/LayoutAside/index.ts +13 -0
- package/components/Layout/components/LayoutMain/LayoutMain.meta.ts +15 -0
- package/components/Layout/components/LayoutMain/LayoutMain.module.css +15 -0
- package/components/Layout/components/LayoutMain/LayoutMain.tsx +23 -0
- package/components/Layout/components/LayoutMain/LayoutMain.types.ts +12 -0
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.meta.ts +15 -0
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.module.css +4 -0
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.tsx +49 -0
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.types.ts +5 -0
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.utils.ts +65 -0
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/index.ts +1 -0
- package/components/Layout/components/LayoutMain/index.ts +9 -0
- package/components/Layout/components/LayoutNavigation/LayoutNavigation.meta.ts +15 -0
- package/components/Layout/components/LayoutNavigation/LayoutNavigation.module.css +12 -0
- package/components/Layout/components/LayoutNavigation/LayoutNavigation.tsx +24 -0
- package/components/Layout/components/LayoutNavigation/LayoutNavigation.types.ts +5 -0
- package/components/Layout/components/LayoutNavigation/index.ts +1 -0
- package/components/Layout/components/LayoutSubNavigation/LayoutSubNavigation.meta.ts +15 -0
- package/components/Layout/components/LayoutSubNavigation/LayoutSubNavigation.module.css +12 -0
- package/components/Layout/components/LayoutSubNavigation/LayoutSubNavigation.tsx +24 -0
- package/components/Layout/components/LayoutSubNavigation/LayoutSubNavigation.types.ts +5 -0
- package/components/Layout/components/LayoutSubNavigation/index.ts +1 -0
- package/components/Layout/index.ts +17 -0
- package/components/Loading/Loading.meta.ts +20 -0
- package/components/Loading/Loading.module.css +65 -0
- package/components/Loading/Loading.tsx +57 -0
- package/components/Loading/Loading.types.ts +7 -0
- package/components/Loading/index.ts +1 -0
- package/components/Markdown/Markdown.meta.ts +28 -0
- package/components/Markdown/Markdown.module.css +274 -0
- package/components/Markdown/Markdown.tsx +27 -0
- package/components/Markdown/Markdown.types.ts +7 -0
- package/components/Markdown/Markdown.utils.spec.ts +11 -0
- package/components/Markdown/Markdown.utils.ts +10 -0
- package/components/Markdown/index.ts +1 -0
- package/components/Masonry/Masonry.meta.ts +24 -0
- package/components/Masonry/Masonry.tsx +49 -0
- package/components/Masonry/Masonry.types.ts +10 -0
- package/components/Masonry/index.ts +1 -0
- package/components/Menu/Menu.meta.ts +15 -0
- package/components/Menu/Menu.tsx +18 -0
- package/components/Menu/Menu.types.ts +15 -0
- package/components/Menu/components/MenuCategory/MenuCategory.meta.ts +32 -0
- package/components/Menu/components/MenuCategory/MenuCategory.module.css +73 -0
- package/components/Menu/components/MenuCategory/MenuCategory.tsx +88 -0
- package/components/Menu/components/MenuCategory/MenuCategory.types.ts +10 -0
- package/components/Menu/components/MenuCategory/index.ts +1 -0
- package/components/Menu/components/MenuFilter/MenuFilter.meta.ts +24 -0
- package/components/Menu/components/MenuFilter/MenuFilter.module.css +11 -0
- package/components/Menu/components/MenuFilter/MenuFilter.tsx +25 -0
- package/components/Menu/components/MenuFilter/MenuFilter.types.ts +7 -0
- package/components/Menu/components/MenuFilter/index.ts +1 -0
- package/components/Menu/components/MenuItem/MenuItem.meta.ts +42 -0
- package/components/Menu/components/MenuItem/MenuItem.module.css +37 -0
- package/components/Menu/components/MenuItem/MenuItem.tsx +73 -0
- package/components/Menu/components/MenuItem/MenuItem.types.ts +12 -0
- package/components/Menu/components/MenuItem/index.ts +1 -0
- package/components/Menu/index.ts +14 -0
- package/components/Overlay/Overlay.meta.ts +25 -0
- package/components/Overlay/Overlay.module.css +85 -0
- package/components/Overlay/Overlay.tsx +47 -0
- package/components/Overlay/Overlay.types.ts +9 -0
- package/components/Overlay/index.ts +1 -0
- package/components/Pie/Pie.meta.ts +23 -0
- package/components/Pie/Pie.module.css +5 -0
- package/components/Pie/Pie.tsx +47 -0
- package/components/Pie/Pie.types.ts +12 -0
- package/components/Pie/index.ts +2 -0
- package/components/Pill/Pill.meta.ts +64 -0
- package/components/Pill/Pill.module.css +64 -0
- package/components/Pill/Pill.tsx +89 -0
- package/components/Pill/Pill.types.ts +19 -0
- package/components/Pill/index.ts +1 -0
- package/components/Placeholder/Placeholder.meta.ts +25 -0
- package/components/Placeholder/Placeholder.module.css +3 -0
- package/components/Placeholder/Placeholder.tsx +24 -0
- package/components/Placeholder/Placeholder.types.ts +7 -0
- package/components/Placeholder/index.ts +1 -0
- package/components/Progress/Progress.meta.ts +35 -0
- package/components/Progress/Progress.module.css +22 -0
- package/components/Progress/Progress.tsx +30 -0
- package/components/Progress/Progress.types.ts +9 -0
- package/components/Progress/index.ts +1 -0
- package/components/Radio/Radio.meta.ts +21 -0
- package/components/Radio/Radio.module.css +101 -0
- package/components/Radio/Radio.tsx +73 -0
- package/components/Radio/Radio.types.ts +8 -0
- package/components/Radio/index.ts +1 -0
- package/components/Range/Range.meta.ts +26 -0
- package/components/Range/Range.module.css +68 -0
- package/components/Range/Range.tsx +49 -0
- package/components/Range/Range.types.ts +13 -0
- package/components/Range/index.ts +1 -0
- package/components/Segments/Segments.meta.ts +27 -0
- package/components/Segments/Segments.module.css +46 -0
- package/components/Segments/Segments.tsx +79 -0
- package/components/Segments/Segments.types.ts +15 -0
- package/components/Segments/Segments.utils.ts +19 -0
- package/components/Segments/components/SegmentButton/SegmentButton.meta.ts +32 -0
- package/components/Segments/components/SegmentButton/SegmentButton.module.css +34 -0
- package/components/Segments/components/SegmentButton/SegmentButton.tsx +61 -0
- package/components/Segments/components/SegmentButton/SegmentButton.types.ts +10 -0
- package/components/Segments/components/SegmentButton/index.ts +1 -0
- package/components/Segments/index.ts +9 -0
- package/components/Select/Select.meta.ts +43 -0
- package/components/Select/Select.module.css +76 -0
- package/components/Select/Select.tsx +53 -0
- package/components/Select/Select.types.ts +18 -0
- package/components/Select/index.ts +2 -0
- package/components/Separator/Separator.meta.ts +69 -0
- package/components/Separator/Separator.module.css +11 -0
- package/components/Separator/Separator.spec.tsx +6 -0
- package/components/Separator/Separator.tsx +36 -0
- package/components/Separator/Separator.types.ts +10 -0
- package/components/Separator/components/HRMarkup/HRMarkup.meta.ts +15 -0
- package/components/Separator/components/HRMarkup/HRMarkup.tsx +10 -0
- package/components/Separator/components/HRMarkup/HRMarkup.types.ts +5 -0
- package/components/Separator/components/HRMarkup/index.ts +1 -0
- package/components/Separator/components/HorizontalSeparator/HorizontalSeparator.meta.ts +22 -0
- package/components/Separator/components/HorizontalSeparator/HorizontalSeparator.module.css +22 -0
- package/components/Separator/components/HorizontalSeparator/HorizontalSeparator.tsx +22 -0
- package/components/Separator/components/HorizontalSeparator/HorizontalSeparator.types.ts +3 -0
- package/components/Separator/components/HorizontalSeparator/index.ts +1 -0
- package/components/Separator/components/VerticalSeparator/VerticalSeparator.meta.ts +22 -0
- package/components/Separator/components/VerticalSeparator/VerticalSeparator.module.css +20 -0
- package/components/Separator/components/VerticalSeparator/VerticalSeparator.tsx +22 -0
- package/components/Separator/components/VerticalSeparator/VerticalSeparator.types.ts +3 -0
- package/components/Separator/components/VerticalSeparator/index.ts +1 -0
- package/components/Separator/index.ts +1 -0
- package/components/Setup/Setup.global.css +14 -0
- package/components/Setup/Setup.meta.ts +22 -0
- package/components/Setup/Setup.tsx +53 -0
- package/components/Setup/Setup.types.ts +13 -0
- package/components/Setup/Setup.utils.ts +61 -0
- package/components/Setup/css/core.colors-helpers.css +322 -0
- package/components/Setup/css/core.colors.css +428 -0
- package/components/Setup/css/core.scale.css +49 -0
- package/components/Setup/css/core.setup.css +28 -0
- package/components/Setup/css/core.typography.css +57 -0
- package/components/Setup/css/feat.atomics.css +126 -0
- package/components/Setup/css/feat.markdown.css +39 -0
- package/components/Setup/css/feat.responsive.css +590 -0
- package/components/Setup/index.ts +1 -0
- package/components/Shimmer/Shimmer.meta.ts +32 -0
- package/components/Shimmer/Shimmer.module.css +24 -0
- package/components/Shimmer/Shimmer.tsx +31 -0
- package/components/Shimmer/Shimmer.types.ts +7 -0
- package/components/Shimmer/index.ts +1 -0
- package/components/Slider/Slider.meta.ts +22 -0
- package/components/Slider/Slider.module.css +49 -0
- package/components/Slider/Slider.tsx +18 -0
- package/components/Slider/Slider.types.ts +6 -0
- package/components/Slider/index.ts +1 -0
- package/components/Spacer/Spacer.meta.ts +17 -0
- package/components/Spacer/Spacer.tsx +8 -0
- package/components/Spacer/Spacer.types.ts +3 -0
- package/components/Spacer/index.ts +1 -0
- package/components/Table/Table.meta.ts +36 -0
- package/components/Table/Table.module.css +53 -0
- package/components/Table/Table.tsx +21 -0
- package/components/Table/Table.types.ts +8 -0
- package/components/Table/index.ts +1 -0
- package/components/Tabs/Tabs.meta.ts +24 -0
- package/components/Tabs/Tabs.module.css +43 -0
- package/components/Tabs/Tabs.tsx +63 -0
- package/components/Tabs/Tabs.types.ts +14 -0
- package/components/Tabs/index.ts +1 -0
- package/components/Text/Text.meta.ts +38 -0
- package/components/Text/Text.module.css +41 -0
- package/components/Text/Text.tsx +59 -0
- package/components/Text/Text.types.ts +20 -0
- package/components/Text/Text.utils.spec.ts +13 -0
- package/components/Text/Text.utils.ts +50 -0
- package/components/Text/components/Div/Div.meta.ts +11 -0
- package/components/Text/components/Div/Div.tsx +9 -0
- package/components/Text/components/Div/Div.types.ts +3 -0
- package/components/Text/components/Div/index.ts +1 -0
- package/components/Text/components/Micro/Micro.meta.ts +11 -0
- package/components/Text/components/Micro/Micro.tsx +9 -0
- package/components/Text/components/Micro/Micro.types.ts +3 -0
- package/components/Text/components/Micro/index.ts +1 -0
- package/components/Text/components/P/P.meta.ts +11 -0
- package/components/Text/components/P/P.tsx +9 -0
- package/components/Text/components/P/P.types.ts +3 -0
- package/components/Text/components/P/index.ts +1 -0
- package/components/Text/components/Small/Small.meta.ts +11 -0
- package/components/Text/components/Small/Small.tsx +9 -0
- package/components/Text/components/Small/Small.types.ts +3 -0
- package/components/Text/components/Small/index.ts +1 -0
- package/components/Text/components/Tiny/Tiny.meta.ts +11 -0
- package/components/Text/components/Tiny/Tiny.tsx +9 -0
- package/components/Text/components/Tiny/Tiny.types.ts +3 -0
- package/components/Text/components/Tiny/index.ts +1 -0
- package/components/Text/index.ts +2 -0
- package/components/Textarea/Textarea.meta.ts +26 -0
- package/components/Textarea/Textarea.module.css +52 -0
- package/components/Textarea/Textarea.tsx +68 -0
- package/components/Textarea/Textarea.types.ts +16 -0
- package/components/Textarea/index.ts +1 -0
- package/components/Tile/Tile.meta.ts +24 -0
- package/components/Tile/Tile.module.css +35 -0
- package/components/Tile/Tile.tsx +70 -0
- package/components/Tile/Tile.types.ts +16 -0
- package/components/Tile/index.ts +1 -0
- package/components/Timestamp/Timestamp.meta.ts +22 -0
- package/components/Timestamp/Timestamp.tsx +21 -0
- package/components/Timestamp/Timestamp.types.ts +6 -0
- package/components/Timestamp/index.ts +1 -0
- package/components/Toggle/Toggle.meta.ts +40 -0
- package/components/Toggle/Toggle.module.css +137 -0
- package/components/Toggle/Toggle.tsx +62 -0
- package/components/Toggle/Toggle.types.ts +9 -0
- package/components/Toggle/index.ts +1 -0
- package/components/Tooltip/Tooltip.meta.ts +78 -0
- package/components/Tooltip/Tooltip.module.css +63 -0
- package/components/Tooltip/Tooltip.tsx +115 -0
- package/components/Tooltip/Tooltip.types.ts +31 -0
- package/components/Tooltip/Tooltip.utils.ts +14 -0
- package/components/Tooltip/components/TooltipContent/TooltipContent.meta.ts +12 -0
- package/components/Tooltip/components/TooltipContent/TooltipContent.tsx +27 -0
- package/components/Tooltip/components/TooltipContent/TooltipContent.types.ts +3 -0
- package/components/Tooltip/components/TooltipContent/index.ts +1 -0
- package/components/Tooltip/components/TooltipTrigger/TooltipTrigger.meta.ts +12 -0
- package/components/Tooltip/components/TooltipTrigger/TooltipTrigger.tsx +19 -0
- package/components/Tooltip/components/TooltipTrigger/TooltipTrigger.types.ts +3 -0
- package/components/Tooltip/components/TooltipTrigger/index.ts +1 -0
- package/components/Tooltip/index.ts +6 -0
- package/components/shared/InputLabel/InputLabel.meta.ts +22 -0
- package/components/shared/InputLabel/InputLabel.module.css +14 -0
- package/components/shared/InputLabel/InputLabel.tsx +20 -0
- package/components/shared/InputLabel/InputLabel.types.ts +6 -0
- package/components/shared/InputLabel/index.ts +1 -0
- package/components/shared/ResultList/ResultList.meta.ts +20 -0
- package/components/shared/ResultList/ResultList.module.css +71 -0
- package/components/shared/ResultList/ResultList.tsx +67 -0
- package/components/shared/ResultList/ResultList.types.ts +19 -0
- package/components/shared/ResultList/index.ts +2 -0
- package/constants/animations.ts +5 -0
- package/constants/colors.ts +14 -0
- package/constants/components.ts +101 -0
- package/constants/emphasis.ts +3 -0
- package/constants/hooks.ts +1 -0
- package/constants/icons.ts +4 -0
- package/constants/intentions.ts +28 -0
- package/constants/meta.ts +60 -0
- package/constants/positions.ts +3 -0
- package/constants/scale.ts +5 -0
- package/constants/scope.ts +151 -0
- package/contexts/LayoutContext/LayoutContext.tsx +93 -0
- package/contexts/LayoutContext/LayoutContext.types.ts +11 -0
- package/contexts/LayoutContext/index.ts +2 -0
- package/globals.d.ts +14 -0
- package/hooks/useChatScroll.tsx +98 -0
- package/hooks/useDebounce.tsx +19 -0
- package/hooks/useIntersection.tsx +19 -0
- package/hooks/useInterval.tsx +27 -0
- package/hooks/useKeyPress.tsx +33 -0
- package/hooks/useLayoutContext.tsx +23 -0
- package/hooks/usePrevious.tsx +13 -0
- package/hooks/usePrint.tsx +31 -0
- package/hooks/useResizeObserver.tsx +38 -0
- package/hooks/useTheme.tsx +40 -0
- package/index.ts +96 -0
- package/package.json +67 -0
- package/types/colors.ts +13 -0
- package/types/icons.ts +3 -0
- package/types/intentions.ts +13 -0
- package/types/meta.ts +24 -0
- package/types/positions.ts +3 -0
- package/types/scale.ts +29 -0
- package/types/scope.ts +67 -0
- package/types/themes.ts +2 -0
- package/types/typography.ts +1 -0
- package/utils/colors.ts +11 -0
- package/utils/date.ts +54 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, type FC, type MouseEvent } from "react"
|
|
4
|
+
import styles from "./Dialog.module.css"
|
|
5
|
+
import { Button } from "../Button"
|
|
6
|
+
import { ButtonGroup } from "../ButtonGroup"
|
|
7
|
+
import { Heading } from "../Heading"
|
|
8
|
+
import { Flex } from "../Flex"
|
|
9
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
10
|
+
import type { DialogProps } from "./Dialog.types"
|
|
11
|
+
|
|
12
|
+
export const Dialog: FC<DialogProps> = ({
|
|
13
|
+
title,
|
|
14
|
+
children,
|
|
15
|
+
isNarrow,
|
|
16
|
+
isOpen,
|
|
17
|
+
isCentered,
|
|
18
|
+
onClose,
|
|
19
|
+
hasNoPadding,
|
|
20
|
+
role,
|
|
21
|
+
}) => {
|
|
22
|
+
const dialogRef = useRef<HTMLDialogElement | null>(null)
|
|
23
|
+
const triggerRef = useRef<Element | null>(null)
|
|
24
|
+
const onCloseRef = useRef<() => void>(onClose)
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
onCloseRef.current = onClose
|
|
28
|
+
}, [onClose])
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
dialogRef?.current?.scrollTo?.(0, 0)
|
|
32
|
+
|
|
33
|
+
if (!isOpen) return
|
|
34
|
+
|
|
35
|
+
triggerRef.current = document.activeElement
|
|
36
|
+
document.documentElement.style.overflow = "hidden"
|
|
37
|
+
|
|
38
|
+
if (!dialogRef.current?.open) {
|
|
39
|
+
dialogRef?.current?.showModal?.()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (): void => {
|
|
43
|
+
document.documentElement.style.overflow = ""
|
|
44
|
+
|
|
45
|
+
const trigger = triggerRef.current
|
|
46
|
+
if (trigger && trigger instanceof HTMLElement) {
|
|
47
|
+
trigger.focus()
|
|
48
|
+
}
|
|
49
|
+
triggerRef.current = null
|
|
50
|
+
}
|
|
51
|
+
}, [isOpen])
|
|
52
|
+
|
|
53
|
+
const onCancel = (event: React.SyntheticEvent<HTMLDialogElement>): void => {
|
|
54
|
+
event.preventDefault()
|
|
55
|
+
onCloseRef.current()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!isOpen) return null
|
|
59
|
+
|
|
60
|
+
const onDialogClose = (event: MouseEvent<HTMLDialogElement>): boolean | void | Promise<void> => {
|
|
61
|
+
const isDialog: boolean = (event?.target as HTMLDialogElement)?.tagName === "DIALOG"
|
|
62
|
+
|
|
63
|
+
return isDialog && onClose()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const dialogClasses: string = getClasses(styles.dialog, "ui-scrollbar", "elevation-lg", {
|
|
67
|
+
[styles.dialogCentered]: isCentered,
|
|
68
|
+
[styles.dialogNarrow]: isNarrow,
|
|
69
|
+
})
|
|
70
|
+
const dialogFlexClasses: string = getClasses(styles.dialog__header, "sticky top-0 z-50 ui-bg-glass")
|
|
71
|
+
const dialogContentClasses: string = getClasses(styles.dialog__content, {
|
|
72
|
+
[styles.dialog__contentNoPadding]: hasNoPadding,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<dialog
|
|
77
|
+
ref={dialogRef}
|
|
78
|
+
className={dialogClasses}
|
|
79
|
+
onClick={onDialogClose}
|
|
80
|
+
onCancel={onCancel}
|
|
81
|
+
role={role}
|
|
82
|
+
aria-modal="true"
|
|
83
|
+
data-ui-component="Dialog"
|
|
84
|
+
>
|
|
85
|
+
{!!title && (
|
|
86
|
+
<Flex isBetween={true} isYCentered={true} padding={8} className={dialogFlexClasses}>
|
|
87
|
+
<Heading level={5} fontWeight="medium">
|
|
88
|
+
{title}
|
|
89
|
+
</Heading>
|
|
90
|
+
<ButtonGroup>
|
|
91
|
+
<Button icon="x" intent="neutral" value="Close dialog" onClick={onClose} size="small" isIconOnly={true} />
|
|
92
|
+
</ButtonGroup>
|
|
93
|
+
</Flex>
|
|
94
|
+
)}
|
|
95
|
+
<div className={dialogContentClasses}>{children}</div>
|
|
96
|
+
</dialog>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
Dialog.displayName = "Dialog"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react"
|
|
2
|
+
|
|
3
|
+
export interface DialogBaseProps {
|
|
4
|
+
isCentered?: boolean
|
|
5
|
+
isNarrow?: boolean
|
|
6
|
+
isOpen?: boolean
|
|
7
|
+
hasNoPadding?: boolean
|
|
8
|
+
onClose: (_?: unknown) => Promise<void> | void
|
|
9
|
+
role?: "dialog" | "alertdialog"
|
|
10
|
+
title?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type DialogProps = PropsWithChildren<DialogBaseProps>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Dialog } from "./Dialog"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HeliosAttributeMeta } from "../../types/meta"
|
|
2
|
+
import type { DonutBaseProps } from "./Donut.types"
|
|
3
|
+
|
|
4
|
+
export const meta: HeliosAttributeMeta<DonutBaseProps> = {
|
|
5
|
+
_extends: ["PropsWithChildren"],
|
|
6
|
+
_patterns: [
|
|
7
|
+
{
|
|
8
|
+
id: "ui-donut-default",
|
|
9
|
+
description: "default",
|
|
10
|
+
content: `<Donut size={DONUT_SIZE} percentage={PERCENTAGE} color={COLOR}/>`,
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
_status: "experimental",
|
|
14
|
+
_category: "core",
|
|
15
|
+
color: {
|
|
16
|
+
type: "HeliosColorType",
|
|
17
|
+
},
|
|
18
|
+
percentage: {
|
|
19
|
+
type: "number",
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
type: "DonutSizeType",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
2
|
+
import { getDonutBorderSize } from "./Donut.utils"
|
|
3
|
+
import { Flex } from "../Flex"
|
|
4
|
+
import styles from "./Donut.module.css"
|
|
5
|
+
import type { DonutProps } from "./Donut.types"
|
|
6
|
+
import type { FC } from "react"
|
|
7
|
+
|
|
8
|
+
export const Donut: FC<DonutProps> = ({ children, size, percentage = 0, color }) => {
|
|
9
|
+
const borderSize: number = getDonutBorderSize(size)
|
|
10
|
+
const actualSize: number = size - borderSize
|
|
11
|
+
const cSize = size / 2
|
|
12
|
+
const rSize = actualSize / 2
|
|
13
|
+
const dashSize = 100 - percentage
|
|
14
|
+
const donutColor: string = `hsl(var(--${color}-hue), var(--${color}-saturation), 50%)`
|
|
15
|
+
|
|
16
|
+
const donutClasses: string = getClasses(styles.donut, "relative")
|
|
17
|
+
const donutContainerStyle: object = {
|
|
18
|
+
height: size + "px",
|
|
19
|
+
width: size + "px",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Flex style={donutContainerStyle} className={donutClasses} isCentered={true} data-ui-component="Donut">
|
|
24
|
+
<Flex className="absolute top-0 left-0 z-50" style={donutContainerStyle} isCentered={true}>
|
|
25
|
+
{children}
|
|
26
|
+
</Flex>
|
|
27
|
+
<svg
|
|
28
|
+
className={styles.donut__svg}
|
|
29
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
+
viewBox={`0 0 ${size} ${size}`}
|
|
31
|
+
height={size}
|
|
32
|
+
width={size}
|
|
33
|
+
role="img"
|
|
34
|
+
aria-label={`Donut chart: ${percentage}%`}
|
|
35
|
+
>
|
|
36
|
+
<title>{`${percentage}%`}</title>
|
|
37
|
+
<circle
|
|
38
|
+
fill="none"
|
|
39
|
+
strokeWidth={borderSize}
|
|
40
|
+
stroke={donutColor}
|
|
41
|
+
cx={cSize}
|
|
42
|
+
cy={cSize}
|
|
43
|
+
r={rSize}
|
|
44
|
+
style={{ opacity: 0.25 }}
|
|
45
|
+
/>
|
|
46
|
+
<circle
|
|
47
|
+
fill="none"
|
|
48
|
+
strokeWidth={borderSize}
|
|
49
|
+
stroke={donutColor}
|
|
50
|
+
pathLength={100}
|
|
51
|
+
strokeDasharray={100}
|
|
52
|
+
strokeDashoffset={dashSize}
|
|
53
|
+
strokeLinecap="round"
|
|
54
|
+
cx={cSize}
|
|
55
|
+
cy={cSize}
|
|
56
|
+
r={rSize}
|
|
57
|
+
/>
|
|
58
|
+
</svg>
|
|
59
|
+
</Flex>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
Donut.displayName = "Donut"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react"
|
|
2
|
+
import type { HeliosColorType } from "../../types/colors"
|
|
3
|
+
|
|
4
|
+
export type DonutSizeType = 32 | 48 | 64 | 96 | 128
|
|
5
|
+
|
|
6
|
+
export interface DonutBaseProps {
|
|
7
|
+
color: HeliosColorType
|
|
8
|
+
percentage: number
|
|
9
|
+
size: DonutSizeType
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type DonutProps = PropsWithChildren<DonutBaseProps>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DonutSizeType } from "./Donut.types"
|
|
2
|
+
|
|
3
|
+
export const getDonutBorderSize = (size: DonutSizeType = 32): number => {
|
|
4
|
+
if (size === 32) return 4
|
|
5
|
+
if (size === 48) return 6
|
|
6
|
+
if (size === 64) return 8
|
|
7
|
+
if (size === 96) return 10
|
|
8
|
+
if (size === 128) return 12
|
|
9
|
+
|
|
10
|
+
return 16
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HeliosAttributeMeta } from "../../types/meta"
|
|
2
|
+
import type { DotProps } from "./Dot.types"
|
|
3
|
+
|
|
4
|
+
export const meta: HeliosAttributeMeta<DotProps> = {
|
|
5
|
+
_patterns: [
|
|
6
|
+
{
|
|
7
|
+
id: "ui-dot-default",
|
|
8
|
+
description: "default",
|
|
9
|
+
content: `<Dot size={SCALE} color={COLOR} colorAccent={COLOR_ACCENT}/>`,
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
_status: "nominal",
|
|
13
|
+
_category: "core",
|
|
14
|
+
color: {
|
|
15
|
+
type: "HeliosColorType",
|
|
16
|
+
default: "blue",
|
|
17
|
+
},
|
|
18
|
+
colorAccent: {
|
|
19
|
+
type: "HeliosColorType",
|
|
20
|
+
isOptional: true,
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
type: "HeliosScale",
|
|
24
|
+
default: 8,
|
|
25
|
+
},
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.dot {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
|
|
6
|
+
--dot-color: var(--ui-bg-blue);
|
|
7
|
+
--dot-color-accent: var(--ui-bg-soft-blue);
|
|
8
|
+
|
|
9
|
+
transition: all var(--speed-lg) var(--ease-in-out-sine);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dot svg {
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 0;
|
|
15
|
+
left: 0;
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
height: 100%;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.dot svg circle {
|
|
23
|
+
transform-origin: 50% 50%;
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useId } from "react"
|
|
4
|
+
import styles from "./Dot.module.css"
|
|
5
|
+
import type { DotProps } from "./Dot.types"
|
|
6
|
+
import type { FC, CSSProperties } from "react"
|
|
7
|
+
|
|
8
|
+
export const Dot: FC<DotProps> = ({ colorAccent, size = 8, color = "blue" }) => {
|
|
9
|
+
const dotId: string = useId()
|
|
10
|
+
|
|
11
|
+
const dotColor: string = `var(--ui-bg-${color})`
|
|
12
|
+
const dotColorAccent: string = colorAccent ? `var(--ui-bg-soft-${colorAccent})` : ""
|
|
13
|
+
|
|
14
|
+
const dotStyle: CSSProperties = {
|
|
15
|
+
height: size + "px",
|
|
16
|
+
maxHeight: size + "px",
|
|
17
|
+
maxWidth: size + "px",
|
|
18
|
+
minWidth: size + "px",
|
|
19
|
+
width: size + "px",
|
|
20
|
+
"--dot-color": dotColor,
|
|
21
|
+
"--dot-color-accent": dotColorAccent,
|
|
22
|
+
} as CSSProperties & {
|
|
23
|
+
"--dot-color": string
|
|
24
|
+
"--dot-color-accent": string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className={styles.dot} style={dotStyle} data-ui-component="Dot">
|
|
29
|
+
<svg width="100%" height="100%" viewBox="0 0 20 20" aria-hidden={true}>
|
|
30
|
+
{colorAccent ? (
|
|
31
|
+
<>
|
|
32
|
+
<linearGradient id={dotId}>
|
|
33
|
+
<stop stopColor="var(--dot-color)" offset="0%" />
|
|
34
|
+
<stop stopColor="var(--dot-color-accent)" offset="100%" />
|
|
35
|
+
</linearGradient>
|
|
36
|
+
<circle fill={`url(#${dotId})`} cx={10} cy={10} r={10} />
|
|
37
|
+
</>
|
|
38
|
+
) : (
|
|
39
|
+
<circle fill="var(--dot-color)" cx={10} cy={10} r={10} />
|
|
40
|
+
)}
|
|
41
|
+
</svg>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Dot.displayName = "Dot"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Dot } from "./Dot"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HeliosAttributeMeta } from "../../types/meta"
|
|
2
|
+
import type { DropdownProps } from "./Dropdown.types"
|
|
3
|
+
|
|
4
|
+
export const meta: HeliosAttributeMeta<DropdownProps> = {
|
|
5
|
+
_patterns: [
|
|
6
|
+
{
|
|
7
|
+
id: "ui-dropdown-buttongroup",
|
|
8
|
+
description: "dropdown",
|
|
9
|
+
content: `<Dropdown items={RESULT_LIST_ITEMS} isDisabled={IS_DISABLED} position={POSITION}><Button value="Dropdown Example" intent={INTENT} icon={ICON} size={SIZE} /></Dropdown>`,
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
_status: "nominal",
|
|
13
|
+
_category: "pattern",
|
|
14
|
+
children: {
|
|
15
|
+
type: "ReactElement<unknown>",
|
|
16
|
+
},
|
|
17
|
+
items: {
|
|
18
|
+
type: "Array<ResultItem>",
|
|
19
|
+
},
|
|
20
|
+
isDisabled: {
|
|
21
|
+
type: "boolean",
|
|
22
|
+
description: "Dropdown won't be triggered on click.",
|
|
23
|
+
isOptional: true,
|
|
24
|
+
},
|
|
25
|
+
position: {
|
|
26
|
+
type: "HeliosPositionType",
|
|
27
|
+
isOptional: true,
|
|
28
|
+
default: "bottom-left",
|
|
29
|
+
},
|
|
30
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
.dropdown {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
display: inline-block;
|
|
5
|
+
user-select: none;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dropdownOpen [data-ui-component="Icon"] {
|
|
9
|
+
transition: transform 96ms ease-in-out;
|
|
10
|
+
transform: rotate(180deg);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dropdownDisabled {
|
|
14
|
+
cursor: not-allowed;
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dropdownBottomLeft .dropdown__nav,
|
|
19
|
+
.dropdownBottomRight .dropdown__nav {
|
|
20
|
+
margin-top: 8px;
|
|
21
|
+
|
|
22
|
+
transform: translateY(-6px);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dropdownBottomLeft .dropdown__nav {
|
|
26
|
+
left: 0;
|
|
27
|
+
top: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.dropdownBottomRight .dropdown__nav {
|
|
31
|
+
right: 0;
|
|
32
|
+
top: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dropdownTopLeft .dropdown__nav,
|
|
36
|
+
.dropdownTopRight .dropdown__nav {
|
|
37
|
+
margin-bottom: 8px;
|
|
38
|
+
|
|
39
|
+
transform: translateY(6px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dropdownTopLeft .dropdown__nav {
|
|
43
|
+
bottom: 100%;
|
|
44
|
+
left: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dropdownTopRight .dropdown__nav {
|
|
48
|
+
bottom: 100%;
|
|
49
|
+
right: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dropdown__nav {
|
|
53
|
+
position: absolute;
|
|
54
|
+
z-index: var(--z-index-8);
|
|
55
|
+
|
|
56
|
+
display: none;
|
|
57
|
+
min-width: 240px;
|
|
58
|
+
opacity: 0;
|
|
59
|
+
|
|
60
|
+
transition:
|
|
61
|
+
display 96ms ease-in-out allow-discrete,
|
|
62
|
+
transform 96ms ease-in-out,
|
|
63
|
+
opacity 96ms ease-in-out;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.dropdown__navActive {
|
|
68
|
+
display: block;
|
|
69
|
+
opacity: 1;
|
|
70
|
+
|
|
71
|
+
transform: translateY(0);
|
|
72
|
+
|
|
73
|
+
pointer-events: all;
|
|
74
|
+
|
|
75
|
+
@starting-style {
|
|
76
|
+
opacity: 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.dropdownBottomLeft .dropdown__navActive,
|
|
81
|
+
.dropdownBottomRight .dropdown__navActive {
|
|
82
|
+
@starting-style {
|
|
83
|
+
transform: translateY(-6px);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.dropdownTopLeft .dropdown__navActive,
|
|
88
|
+
.dropdownTopRight .dropdown__navActive {
|
|
89
|
+
@starting-style {
|
|
90
|
+
transform: translateY(6px);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useMemo, useState, useRef, type FC } from "react"
|
|
4
|
+
import { ANIMATION_FAST } from "../../constants/animations"
|
|
5
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
6
|
+
import { ResultList } from "../shared/ResultList"
|
|
7
|
+
import styles from "./Dropdown.module.css"
|
|
8
|
+
import type { KeyboardEvent, MouseEvent } from "react"
|
|
9
|
+
import type { DropdownProps } from "./Dropdown.types"
|
|
10
|
+
|
|
11
|
+
export const Dropdown: FC<DropdownProps> = ({ children, items, isDisabled, position = "bottom-left" }) => {
|
|
12
|
+
const hoverStateRef = useRef<boolean>(false)
|
|
13
|
+
const resultListRef = useRef<HTMLOListElement | null>(null)
|
|
14
|
+
const hideTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
15
|
+
const isMountedRef = useRef<boolean>(true)
|
|
16
|
+
|
|
17
|
+
const [isVisible, setVisible] = useState<boolean>(false)
|
|
18
|
+
const [isHovering, setHovering] = useState<boolean>(false)
|
|
19
|
+
const [navHeight, setNavHeight] = useState<number>(0)
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (resultListRef?.current) {
|
|
23
|
+
setNavHeight(resultListRef?.current?.offsetHeight ?? 0)
|
|
24
|
+
}
|
|
25
|
+
}, [isVisible, items?.length])
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
isMountedRef.current = true
|
|
29
|
+
|
|
30
|
+
return (): void => {
|
|
31
|
+
isMountedRef.current = false
|
|
32
|
+
if (hideTimeoutRef.current) globalThis.clearTimeout(hideTimeoutRef.current)
|
|
33
|
+
hideTimeoutRef.current = null
|
|
34
|
+
}
|
|
35
|
+
}, [])
|
|
36
|
+
|
|
37
|
+
hoverStateRef.current = isHovering
|
|
38
|
+
|
|
39
|
+
if (isDisabled) {
|
|
40
|
+
return children
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const dropdownClasses: string = getClasses(styles.dropdown, {
|
|
44
|
+
[styles.dropdownBottomLeft]: position === "bottom-left" || !position,
|
|
45
|
+
[styles.dropdownBottomRight]: position === "bottom-right",
|
|
46
|
+
[styles.dropdownTopLeft]: position === "top-left",
|
|
47
|
+
[styles.dropdownTopRight]: position === "top-right",
|
|
48
|
+
[styles.dropdownOpen]: isVisible,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const mouseEnter = (_event: MouseEvent<HTMLDivElement>): void => {
|
|
52
|
+
if (hideTimeoutRef.current) {
|
|
53
|
+
globalThis.clearTimeout(hideTimeoutRef.current)
|
|
54
|
+
hideTimeoutRef.current = null
|
|
55
|
+
}
|
|
56
|
+
setHovering(true)
|
|
57
|
+
}
|
|
58
|
+
const mouseLeave = (_event: MouseEvent<HTMLDivElement>): void => {
|
|
59
|
+
setHovering(false)
|
|
60
|
+
hideTimeoutRef.current = setTimeout(() => {
|
|
61
|
+
if (isMountedRef.current && !hoverStateRef.current) setVisible(false)
|
|
62
|
+
hideTimeoutRef.current = null
|
|
63
|
+
}, ANIMATION_FAST)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const onSetVisible = (): void => setVisible(!isVisible)
|
|
67
|
+
|
|
68
|
+
const onKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {
|
|
69
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
70
|
+
event.preventDefault()
|
|
71
|
+
onSetVisible()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const navClasses: string = getClasses(styles.dropdown__nav, isVisible && styles.dropdown__navActive)
|
|
76
|
+
|
|
77
|
+
const itemsWithClose = useMemo(
|
|
78
|
+
() =>
|
|
79
|
+
items?.map((item) => {
|
|
80
|
+
if (item.isDisabled) return item
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
...item,
|
|
84
|
+
onClick: (event: MouseEvent<HTMLElement>): void => {
|
|
85
|
+
item.onClick?.(event)
|
|
86
|
+
setVisible(false)
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
[items],
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<div className={dropdownClasses} onMouseEnter={mouseEnter} onMouseLeave={mouseLeave} data-ui-component="Dropdown">
|
|
95
|
+
<div
|
|
96
|
+
role="button"
|
|
97
|
+
tabIndex={0}
|
|
98
|
+
onClick={onSetVisible}
|
|
99
|
+
onKeyDown={onKeyDown}
|
|
100
|
+
aria-expanded={isVisible}
|
|
101
|
+
aria-haspopup="listbox"
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</div>
|
|
105
|
+
<nav
|
|
106
|
+
className={navClasses}
|
|
107
|
+
style={{
|
|
108
|
+
height: `${navHeight}px`,
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<ResultList ref={resultListRef} items={itemsWithClose} />
|
|
112
|
+
</nav>
|
|
113
|
+
</div>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
Dropdown.displayName = "Dropdown"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ResultItem } from "../shared/ResultList/ResultList.types"
|
|
2
|
+
import type { HeliosPositionType } from "../../types/positions"
|
|
3
|
+
import type { ReactElement } from "react"
|
|
4
|
+
|
|
5
|
+
export interface DropdownProps {
|
|
6
|
+
children: ReactElement<unknown>
|
|
7
|
+
items: Array<ResultItem>
|
|
8
|
+
isDisabled?: boolean
|
|
9
|
+
position?: HeliosPositionType
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HeliosAttributeMeta } from "../../types/meta"
|
|
2
|
+
import type { FieldsetBaseProps } from "./Fieldset.types"
|
|
3
|
+
|
|
4
|
+
export const meta: HeliosAttributeMeta<FieldsetBaseProps> = {
|
|
5
|
+
_extends: ["PropsWithChildren"],
|
|
6
|
+
_patterns: [
|
|
7
|
+
{
|
|
8
|
+
id: "ui-fieldset-default",
|
|
9
|
+
description: "default",
|
|
10
|
+
content: `<Fieldset legend="User Details">{CHILDREN}</Fieldset>`,
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
_status: "experimental",
|
|
14
|
+
_category: "core",
|
|
15
|
+
legend: {
|
|
16
|
+
type: "string",
|
|
17
|
+
},
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styles from "./Fieldset.module.css"
|
|
2
|
+
import type { FC } from "react"
|
|
3
|
+
import type { FieldsetProps } from "./Fieldset.types"
|
|
4
|
+
|
|
5
|
+
export const Fieldset: FC<FieldsetProps> = ({ children, legend }) => {
|
|
6
|
+
return (
|
|
7
|
+
<fieldset className={styles.fieldset} data-ui-component="Fieldset">
|
|
8
|
+
<legend>{legend}</legend>
|
|
9
|
+
{children}
|
|
10
|
+
</fieldset>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
Fieldset.displayName = "Fieldset"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fieldset } from "./Fieldset"
|