@eylulg/ui 1.2.0 → 2.0.1
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/README.md +172 -223
- package/dist/components/{Avatar → atoms/Avatar}/Avatar.d.ts +3 -1
- package/dist/components/{Avatar → atoms/Avatar}/Avatar.js +4 -4
- package/dist/components/atoms/Avatar/Avatar.js.map +1 -0
- package/dist/components/{Avatar → atoms/Avatar}/index.d.ts +1 -1
- package/dist/components/atoms/Avatar/index.js +2 -0
- package/dist/components/{Badge → atoms/Badge}/Badge.d.ts +10 -6
- package/dist/components/{Badge → atoms/Badge}/Badge.js +12 -16
- package/dist/components/atoms/Badge/Badge.js.map +1 -0
- package/dist/components/atoms/Badge/index.d.ts +2 -0
- package/dist/components/atoms/BrandLoader/BrandLoader.d.ts +14 -0
- package/dist/components/atoms/BrandLoader/BrandLoader.js +57 -0
- package/dist/components/atoms/BrandLoader/BrandLoader.js.map +1 -0
- package/dist/components/atoms/BrandLoader/index.d.ts +2 -0
- package/dist/components/atoms/BrandLoader/index.js +2 -0
- package/dist/{chrome → components/atoms/BrandLogo}/BrandLogo.d.ts +1 -1
- package/dist/{chrome → components/atoms/BrandLogo}/BrandLogo.js +3 -4
- package/dist/components/atoms/BrandLogo/BrandLogo.js.map +1 -0
- package/dist/components/atoms/BrandLogo/index.d.ts +2 -0
- package/dist/components/atoms/BrandLogo/index.js +1 -0
- package/dist/components/{Button → atoms/Button}/Button.d.ts +13 -9
- package/dist/components/atoms/Button/Button.js +88 -0
- package/dist/components/atoms/Button/Button.js.map +1 -0
- package/dist/components/{Button → atoms/Button}/buttonStyles.d.ts +4 -6
- package/dist/components/atoms/Button/buttonStyles.js +25 -0
- package/dist/components/atoms/Button/buttonStyles.js.map +1 -0
- package/dist/components/atoms/Button/index.d.ts +2 -0
- package/dist/components/atoms/Button/index.js +4 -0
- package/dist/components/{Checkbox → atoms/Checkbox}/Checkbox.js +10 -14
- package/dist/components/atoms/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/atoms/IconButton/IconButton.d.ts +21 -0
- package/dist/components/atoms/IconButton/IconButton.js +43 -0
- package/dist/components/atoms/IconButton/IconButton.js.map +1 -0
- package/dist/components/{Kbd → atoms/Kbd}/Kbd.d.ts +2 -2
- package/dist/components/{Kbd → atoms/Kbd}/Kbd.js +9 -8
- package/dist/components/atoms/Kbd/Kbd.js.map +1 -0
- package/dist/components/atoms/NavItem/NavItem.d.ts +24 -0
- package/dist/components/atoms/NavItem/NavItem.js +42 -0
- package/dist/components/atoms/NavItem/NavItem.js.map +1 -0
- package/dist/components/atoms/NavItem/index.d.ts +2 -0
- package/dist/components/atoms/NavItem/index.js +1 -0
- package/dist/components/{ProgressBar → atoms/ProgressBar}/ProgressBar.d.ts +2 -2
- package/dist/components/{ProgressBar → atoms/ProgressBar}/ProgressBar.js +6 -5
- package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/atoms/ProgressBar/index.d.ts +2 -0
- package/dist/components/{Skeleton → atoms/Skeleton}/Skeleton.js +3 -5
- package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/{Spinner → atoms/Spinner}/Spinner.js +2 -2
- package/dist/components/atoms/Spinner/Spinner.js.map +1 -0
- package/dist/components/{Switch → atoms/Switch}/Switch.d.ts +3 -3
- package/dist/components/atoms/Switch/Switch.js +35 -0
- package/dist/components/atoms/Switch/Switch.js.map +1 -0
- package/dist/components/atoms/TextLink/TextLink.d.ts +18 -0
- package/dist/components/atoms/TextLink/TextLink.js +21 -0
- package/dist/components/atoms/TextLink/TextLink.js.map +1 -0
- package/dist/components/atoms/TextLink/index.d.ts +2 -0
- package/dist/components/atoms/TextLink/index.js +1 -0
- package/dist/components/{Tooltip → atoms/Tooltip}/Tooltip.js +4 -4
- package/dist/components/atoms/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/{Tooltip → atoms/Tooltip}/TooltipOverlay.js +2 -2
- package/dist/components/atoms/Tooltip/TooltipOverlay.js.map +1 -0
- package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/Breadcrumbs.js +5 -4
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/{Card → molecules/Card}/Card.d.ts +3 -1
- package/dist/components/{Card → molecules/Card}/Card.js +21 -13
- package/dist/components/molecules/Card/Card.js.map +1 -0
- package/dist/components/molecules/Card/index.d.ts +2 -0
- package/dist/components/{CodeBlock → molecules/CodeBlock}/CodeBlock.d.ts +7 -5
- package/dist/components/{CodeBlock → molecules/CodeBlock}/CodeBlock.js +20 -12
- package/dist/components/molecules/CodeBlock/CodeBlock.js.map +1 -0
- package/dist/components/{Combobox → molecules/Combobox}/Combobox.d.ts +4 -1
- package/dist/components/molecules/Combobox/Combobox.js +91 -0
- package/dist/components/molecules/Combobox/Combobox.js.map +1 -0
- package/dist/components/{DatePicker → molecules/DatePicker}/DatePicker.d.ts +7 -4
- package/dist/components/molecules/DatePicker/DatePicker.js +138 -0
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/molecules/Dialog/Dialog.d.ts +20 -0
- package/dist/components/{Dialog → molecules/Dialog}/Dialog.js +7 -7
- package/dist/components/molecules/Dialog/Dialog.js.map +1 -0
- package/dist/components/molecules/Dialog/DialogOverlay.d.ts +3 -0
- package/dist/components/molecules/Dialog/DialogOverlay.js +60 -0
- package/dist/components/molecules/Dialog/DialogOverlay.js.map +1 -0
- package/dist/components/molecules/Drawer/Drawer.d.ts +21 -0
- package/dist/components/{Drawer → molecules/Drawer}/Drawer.js +7 -7
- package/dist/components/molecules/Drawer/Drawer.js.map +1 -0
- package/dist/components/{Drawer → molecules/Drawer}/DrawerOverlay.d.ts +1 -1
- package/dist/components/molecules/Drawer/DrawerOverlay.js +66 -0
- package/dist/components/molecules/Drawer/DrawerOverlay.js.map +1 -0
- package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenu.d.ts +8 -9
- package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenu.js +8 -20
- package/dist/components/molecules/DropdownMenu/DropdownMenu.js.map +1 -0
- package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenuParts.d.ts +1 -1
- package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenuParts.js +17 -28
- package/dist/components/molecules/DropdownMenu/DropdownMenuParts.js.map +1 -0
- package/dist/components/{EmptyState → molecules/EmptyState}/EmptyState.d.ts +3 -4
- package/dist/components/{EmptyState → molecules/EmptyState}/EmptyState.js +6 -5
- package/dist/components/molecules/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/{FileDropZone → molecules/FileDropZone}/FileDropZone.d.ts +1 -1
- package/dist/components/{FileDropZone → molecules/FileDropZone}/FileDropZone.js +6 -5
- package/dist/components/molecules/FileDropZone/FileDropZone.js.map +1 -0
- package/dist/components/{Input → molecules/Input}/Input.d.ts +8 -6
- package/dist/components/molecules/Input/Input.js +45 -0
- package/dist/components/molecules/Input/Input.js.map +1 -0
- package/dist/components/molecules/Input/index.d.ts +2 -0
- package/dist/components/{Pagination → molecules/Pagination}/Pagination.d.ts +6 -2
- package/dist/components/{Pagination → molecules/Pagination}/Pagination.js +44 -34
- package/dist/components/molecules/Pagination/Pagination.js.map +1 -0
- package/dist/components/molecules/Pagination/index.d.ts +2 -0
- package/dist/components/molecules/Pagination/index.js +2 -0
- package/dist/components/{Popover → molecules/Popover}/Popover.d.ts +1 -1
- package/dist/components/{Popover → molecules/Popover}/Popover.js +7 -7
- package/dist/components/molecules/Popover/Popover.js.map +1 -0
- package/dist/components/{Popover → molecules/Popover}/PopoverOverlay.js +5 -4
- package/dist/components/molecules/Popover/PopoverOverlay.js.map +1 -0
- package/dist/components/molecules/RadioGroup/RadioGroup.js +43 -0
- package/dist/components/molecules/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/{SegmentedControl → molecules/SegmentedControl}/SegmentedControl.d.ts +6 -7
- package/dist/components/molecules/SegmentedControl/SegmentedControl.js +71 -0
- package/dist/components/molecules/SegmentedControl/SegmentedControl.js.map +1 -0
- package/dist/components/molecules/SegmentedControl/index.d.ts +2 -0
- package/dist/components/{Select → molecules/Select}/Select.d.ts +4 -1
- package/dist/components/molecules/Select/Select.js +58 -0
- package/dist/components/molecules/Select/Select.js.map +1 -0
- package/dist/components/molecules/Stat/Stat.d.ts +36 -0
- package/dist/components/molecules/Stat/Stat.js +85 -0
- package/dist/components/molecules/Stat/Stat.js.map +1 -0
- package/dist/components/molecules/Stat/index.d.ts +2 -0
- package/dist/components/molecules/Stat/index.js +2 -0
- package/dist/components/{Tabs → molecules/Tabs}/Tabs.js +5 -5
- package/dist/components/molecules/Tabs/Tabs.js.map +1 -0
- package/dist/components/molecules/Tag/Tag.js +49 -0
- package/dist/components/molecules/Tag/Tag.js.map +1 -0
- package/dist/components/{Textarea → molecules/Textarea}/Textarea.d.ts +3 -11
- package/dist/components/molecules/Textarea/Textarea.js +29 -0
- package/dist/components/molecules/Textarea/Textarea.js.map +1 -0
- package/dist/components/molecules/Textarea/index.d.ts +2 -0
- package/dist/components/{Toast → molecules/Toast}/Toast.d.ts +12 -8
- package/dist/components/{Toast → molecules/Toast}/Toast.js +13 -18
- package/dist/components/molecules/Toast/Toast.js.map +1 -0
- package/dist/components/molecules/Toast/ToastItem.d.ts +6 -0
- package/dist/components/{Toast → molecules/Toast}/ToastItem.js +25 -27
- package/dist/components/molecules/Toast/ToastItem.js.map +1 -0
- package/dist/components/{Toast → molecules/Toast}/index.d.ts +1 -1
- package/dist/components/{Chart → organisms/Chart}/BarChart.d.ts +1 -1
- package/dist/components/organisms/Chart/BarChart.js +304 -0
- package/dist/components/organisms/Chart/BarChart.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/ChartFrame.d.ts +2 -2
- package/dist/components/{Chart → organisms/Chart}/ChartFrame.js +14 -18
- package/dist/components/organisms/Chart/ChartFrame.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/ChartLegend.d.ts +3 -2
- package/dist/components/{Chart → organisms/Chart}/ChartLegend.js +2 -2
- package/dist/components/organisms/Chart/ChartLegend.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/ChartTable.js +8 -12
- package/dist/components/organisms/Chart/ChartTable.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/ChartTooltip.d.ts +3 -2
- package/dist/components/{Chart → organisms/Chart}/ChartTooltip.js +3 -3
- package/dist/components/organisms/Chart/ChartTooltip.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/HeatGrid.d.ts +6 -3
- package/dist/components/organisms/Chart/HeatGrid.js +235 -0
- package/dist/components/organisms/Chart/HeatGrid.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/LineChart.d.ts +1 -1
- package/dist/components/organisms/Chart/LineChart.js +227 -0
- package/dist/components/organisms/Chart/LineChart.js.map +1 -0
- package/dist/components/organisms/Chart/Sparkline.d.ts +14 -0
- package/dist/components/organisms/Chart/Sparkline.js +39 -0
- package/dist/components/organisms/Chart/Sparkline.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/format.d.ts +2 -0
- package/dist/components/{Chart → organisms/Chart}/format.js +6 -4
- package/dist/components/organisms/Chart/format.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/geometry.js +1 -1
- package/dist/components/organisms/Chart/geometry.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/index.d.ts +2 -2
- package/dist/components/{Chart → organisms/Chart}/index.js +2 -2
- package/dist/components/{Chart → organisms/Chart}/interaction.d.ts +10 -6
- package/dist/components/{Chart → organisms/Chart}/interaction.js +13 -10
- package/dist/components/organisms/Chart/interaction.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/labels.js +1 -1
- package/dist/components/organisms/Chart/labels.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/scale.js +1 -1
- package/dist/components/organisms/Chart/scale.js.map +1 -0
- package/dist/components/organisms/Chart/series.d.ts +30 -0
- package/dist/components/organisms/Chart/series.js +108 -0
- package/dist/components/organisms/Chart/series.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/summary.js +2 -5
- package/dist/components/organisms/Chart/summary.js.map +1 -0
- package/dist/components/{Chart → organisms/Chart}/types.d.ts +2 -2
- package/dist/components/{Chart → organisms/Chart}/useElementWidth.js +1 -1
- package/dist/components/organisms/Chart/useElementWidth.js.map +1 -0
- package/dist/components/{CommandPalette → organisms/CommandPalette}/CommandPalette.d.ts +7 -8
- package/dist/components/{CommandPalette → organisms/CommandPalette}/CommandPalette.js +4 -10
- package/dist/components/organisms/CommandPalette/CommandPalette.js.map +1 -0
- package/dist/components/organisms/CommandPalette/CommandPaletteOverlay.d.ts +4 -0
- package/dist/components/organisms/CommandPalette/CommandPaletteOverlay.js +150 -0
- package/dist/components/organisms/CommandPalette/CommandPaletteOverlay.js.map +1 -0
- package/dist/components/{CommandPalette → organisms/CommandPalette}/index.d.ts +1 -1
- package/dist/components/{PageHeader → organisms/PageHeader}/PageHeader.js +5 -5
- package/dist/components/organisms/PageHeader/PageHeader.js.map +1 -0
- package/dist/{chrome → components/organisms/SidebarNav}/SidebarNav.d.ts +1 -1
- package/dist/{chrome → components/organisms/SidebarNav}/SidebarNav.js +18 -26
- package/dist/components/organisms/SidebarNav/SidebarNav.js.map +1 -0
- package/dist/components/organisms/SidebarNav/index.d.ts +2 -0
- package/dist/components/organisms/SidebarNav/index.js +2 -0
- package/dist/components/organisms/SiteFooter/SiteFooter.d.ts +33 -0
- package/dist/components/organisms/SiteFooter/SiteFooter.js +87 -0
- package/dist/components/organisms/SiteFooter/SiteFooter.js.map +1 -0
- package/dist/components/organisms/SiteFooter/index.d.ts +2 -0
- package/dist/components/organisms/SiteFooter/index.js +1 -0
- package/dist/components/{Table → organisms/Table}/Table.d.ts +9 -6
- package/dist/components/{Table → organisms/Table}/Table.js +36 -23
- package/dist/components/organisms/Table/Table.js.map +1 -0
- package/dist/components/organisms/ThemeToggle/ThemeToggle.d.ts +36 -0
- package/dist/components/organisms/ThemeToggle/ThemeToggle.js +88 -0
- package/dist/components/organisms/ThemeToggle/ThemeToggle.js.map +1 -0
- package/dist/components/organisms/ThemeToggle/ThemeToggleMenu.d.ts +14 -0
- package/dist/components/organisms/ThemeToggle/ThemeToggleMenu.js +50 -0
- package/dist/components/organisms/ThemeToggle/ThemeToggleMenu.js.map +1 -0
- package/dist/components/organisms/ThemeToggle/index.d.ts +2 -0
- package/dist/components/organisms/ThemeToggle/index.js +2 -0
- package/dist/components/organisms/ThemeToggle/themeChoices.d.ts +7 -0
- package/dist/components/organisms/ThemeToggle/themeChoices.js +17 -0
- package/dist/components/organisms/ThemeToggle/themeChoices.js.map +1 -0
- package/dist/components/organisms/TopNav/TopNav.d.ts +51 -0
- package/dist/components/organisms/TopNav/TopNav.js +148 -0
- package/dist/components/organisms/TopNav/TopNav.js.map +1 -0
- package/dist/components/organisms/TopNav/index.d.ts +2 -0
- package/dist/components/organisms/TopNav/index.js +2 -0
- package/dist/{chrome → components/templates/AppShell}/AppShell.d.ts +10 -6
- package/dist/{chrome → components/templates/AppShell}/AppShell.js +12 -17
- package/dist/components/templates/AppShell/AppShell.js.map +1 -0
- package/dist/components/templates/AppShell/index.d.ts +2 -0
- package/dist/components/templates/AppShell/index.js +1 -0
- package/dist/{chrome → data}/projects.d.ts +13 -6
- package/dist/{chrome → data}/projects.js +43 -14
- package/dist/data/projects.js.map +1 -0
- package/dist/fonts.css +27 -2
- package/dist/index.d.ts +56 -38
- package/dist/index.js +55 -42
- package/dist/internal/Field.d.ts +16 -11
- package/dist/internal/Field.js +30 -23
- package/dist/internal/Field.js.map +1 -1
- package/dist/internal/OverlayParts.d.ts +43 -0
- package/dist/internal/OverlayParts.js +43 -0
- package/dist/internal/OverlayParts.js.map +1 -0
- package/dist/internal/PreloadOnIntent.d.ts +2 -3
- package/dist/internal/PreloadOnIntent.js +3 -3
- package/dist/internal/PreloadOnIntent.js.map +1 -1
- package/dist/{chrome → internal}/brandLogoPath.js +1 -2
- package/dist/internal/brandLogoPath.js.map +1 -0
- package/dist/internal/button.d.ts +7 -0
- package/dist/internal/button.js +19 -0
- package/dist/internal/button.js.map +1 -0
- package/dist/internal/control.d.ts +32 -0
- package/dist/internal/control.js +59 -0
- package/dist/internal/control.js.map +1 -0
- package/dist/internal/focusRing.d.ts +7 -1
- package/dist/internal/focusRing.js +8 -3
- package/dist/internal/focusRing.js.map +1 -1
- package/dist/internal/layout.d.ts +9 -0
- package/dist/internal/layout.js +13 -0
- package/dist/internal/layout.js.map +1 -0
- package/dist/internal/lazyModule.d.ts +8 -2
- package/dist/internal/lazyModule.js +20 -6
- package/dist/internal/lazyModule.js.map +1 -1
- package/dist/internal/link.d.ts +3 -0
- package/dist/internal/link.js +10 -0
- package/dist/internal/link.js.map +1 -0
- package/dist/internal/listParts.d.ts +12 -0
- package/dist/internal/listParts.js +32 -0
- package/dist/internal/listParts.js.map +1 -0
- package/dist/internal/surfaces.d.ts +11 -5
- package/dist/internal/surfaces.js +13 -7
- package/dist/internal/surfaces.js.map +1 -1
- package/dist/internal/toggle.d.ts +8 -0
- package/dist/internal/toggle.js +22 -0
- package/dist/internal/toggle.js.map +1 -0
- package/dist/internal/types.d.ts +2 -5
- package/dist/{chrome → router}/Anchor.js +1 -2
- package/dist/{chrome → router}/Anchor.js.map +1 -1
- package/dist/{chrome → router}/LinkRouter.js +1 -1
- package/dist/{chrome → router}/LinkRouter.js.map +1 -1
- package/dist/{chrome → router}/types.d.ts +3 -3
- package/dist/styles/themes/variants.d.ts +0 -12
- package/dist/styles/themes/variants.js +3 -43
- package/dist/styles/themes/variants.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{chrome → theme}/themeScript.d.ts +2 -5
- package/dist/{chrome → theme}/themeScript.js +4 -7
- package/dist/theme/themeScript.js.map +1 -0
- package/dist/{chrome → theme}/useTheme.js +1 -1
- package/dist/theme/useTheme.js.map +1 -0
- package/dist/theme.css +87 -56
- package/dist/tokens.css +42 -48
- package/dist/utils/cx.d.ts +0 -12
- package/dist/utils/cx.js +18 -10
- package/dist/utils/cx.js.map +1 -1
- package/package.json +147 -107
- package/dist/chrome/AppShell.js.map +0 -1
- package/dist/chrome/BrandLogo.js.map +0 -1
- package/dist/chrome/BrandMark.d.ts +0 -12
- package/dist/chrome/BrandMark.js +0 -40
- package/dist/chrome/BrandMark.js.map +0 -1
- package/dist/chrome/MobileMenu.d.ts +0 -19
- package/dist/chrome/MobileMenu.js +0 -52
- package/dist/chrome/MobileMenu.js.map +0 -1
- package/dist/chrome/ProjectSwitcher.d.ts +0 -30
- package/dist/chrome/ProjectSwitcher.js +0 -64
- package/dist/chrome/ProjectSwitcher.js.map +0 -1
- package/dist/chrome/ProjectSwitcherMenu.d.ts +0 -13
- package/dist/chrome/ProjectSwitcherMenu.js +0 -50
- package/dist/chrome/ProjectSwitcherMenu.js.map +0 -1
- package/dist/chrome/SidebarNav.js.map +0 -1
- package/dist/chrome/SiteFooter.d.ts +0 -37
- package/dist/chrome/SiteFooter.js +0 -105
- package/dist/chrome/SiteFooter.js.map +0 -1
- package/dist/chrome/TextSizeToggle.d.ts +0 -11
- package/dist/chrome/TextSizeToggle.js +0 -38
- package/dist/chrome/TextSizeToggle.js.map +0 -1
- package/dist/chrome/ThemeToggle.d.ts +0 -26
- package/dist/chrome/ThemeToggle.js +0 -100
- package/dist/chrome/ThemeToggle.js.map +0 -1
- package/dist/chrome/ThemeToggleMenu.d.ts +0 -16
- package/dist/chrome/ThemeToggleMenu.js +0 -42
- package/dist/chrome/ThemeToggleMenu.js.map +0 -1
- package/dist/chrome/TopNav.d.ts +0 -42
- package/dist/chrome/TopNav.js +0 -117
- package/dist/chrome/TopNav.js.map +0 -1
- package/dist/chrome/brandLogoPath.js.map +0 -1
- package/dist/chrome/index.d.ts +0 -28
- package/dist/chrome/index.js +0 -15
- package/dist/chrome/projects.js.map +0 -1
- package/dist/chrome/themeChoices.d.ts +0 -6
- package/dist/chrome/themeChoices.js +0 -18
- package/dist/chrome/themeChoices.js.map +0 -1
- package/dist/chrome/themeScript.js.map +0 -1
- package/dist/chrome/useTextSize.d.ts +0 -16
- package/dist/chrome/useTextSize.js +0 -64
- package/dist/chrome/useTextSize.js.map +0 -1
- package/dist/chrome/useTheme.js.map +0 -1
- package/dist/components/Avatar/Avatar.js.map +0 -1
- package/dist/components/Avatar/index.js +0 -2
- package/dist/components/Badge/Badge.js.map +0 -1
- package/dist/components/Badge/index.d.ts +0 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +0 -1
- package/dist/components/Button/Button.js +0 -73
- package/dist/components/Button/Button.js.map +0 -1
- package/dist/components/Button/buttonStyles.js +0 -32
- package/dist/components/Button/buttonStyles.js.map +0 -1
- package/dist/components/Button/index.d.ts +0 -2
- package/dist/components/Button/index.js +0 -4
- package/dist/components/Card/Card.js.map +0 -1
- package/dist/components/Card/index.d.ts +0 -2
- package/dist/components/Chart/BarChart.js +0 -327
- package/dist/components/Chart/BarChart.js.map +0 -1
- package/dist/components/Chart/ChartFrame.js.map +0 -1
- package/dist/components/Chart/ChartLegend.js.map +0 -1
- package/dist/components/Chart/ChartTable.js.map +0 -1
- package/dist/components/Chart/ChartTooltip.js.map +0 -1
- package/dist/components/Chart/HeatGrid.js +0 -256
- package/dist/components/Chart/HeatGrid.js.map +0 -1
- package/dist/components/Chart/LineChart.js +0 -248
- package/dist/components/Chart/LineChart.js.map +0 -1
- package/dist/components/Chart/format.js.map +0 -1
- package/dist/components/Chart/geometry.js.map +0 -1
- package/dist/components/Chart/interaction.js.map +0 -1
- package/dist/components/Chart/labels.js.map +0 -1
- package/dist/components/Chart/scale.js.map +0 -1
- package/dist/components/Chart/series.d.ts +0 -14
- package/dist/components/Chart/series.js +0 -72
- package/dist/components/Chart/series.js.map +0 -1
- package/dist/components/Chart/summary.js.map +0 -1
- package/dist/components/Chart/useElementWidth.js.map +0 -1
- package/dist/components/Checkbox/Checkbox.js.map +0 -1
- package/dist/components/CodeBlock/CodeBlock.js.map +0 -1
- package/dist/components/Combobox/Combobox.js +0 -106
- package/dist/components/Combobox/Combobox.js.map +0 -1
- package/dist/components/CommandPalette/CommandPalette.js.map +0 -1
- package/dist/components/CommandPalette/CommandPaletteOverlay.d.ts +0 -11
- package/dist/components/CommandPalette/CommandPaletteOverlay.js +0 -180
- package/dist/components/CommandPalette/CommandPaletteOverlay.js.map +0 -1
- package/dist/components/DatePicker/DatePicker.js +0 -142
- package/dist/components/DatePicker/DatePicker.js.map +0 -1
- package/dist/components/Dialog/Dialog.d.ts +0 -37
- package/dist/components/Dialog/Dialog.js.map +0 -1
- package/dist/components/Dialog/DialogOverlay.d.ts +0 -3
- package/dist/components/Dialog/DialogOverlay.js +0 -72
- package/dist/components/Dialog/DialogOverlay.js.map +0 -1
- package/dist/components/Drawer/Drawer.d.ts +0 -36
- package/dist/components/Drawer/Drawer.js.map +0 -1
- package/dist/components/Drawer/DrawerOverlay.js +0 -71
- package/dist/components/Drawer/DrawerOverlay.js.map +0 -1
- package/dist/components/DropdownMenu/DropdownMenu.js.map +0 -1
- package/dist/components/DropdownMenu/DropdownMenuParts.js.map +0 -1
- package/dist/components/EmptyState/EmptyState.js.map +0 -1
- package/dist/components/FileDropZone/FileDropZone.js.map +0 -1
- package/dist/components/IconButton/IconButton.d.ts +0 -17
- package/dist/components/IconButton/IconButton.js +0 -37
- package/dist/components/IconButton/IconButton.js.map +0 -1
- package/dist/components/Input/Input.js +0 -43
- package/dist/components/Input/Input.js.map +0 -1
- package/dist/components/Input/index.d.ts +0 -2
- package/dist/components/Kbd/Kbd.js.map +0 -1
- package/dist/components/PageHeader/PageHeader.js.map +0 -1
- package/dist/components/Pagination/Pagination.js.map +0 -1
- package/dist/components/Pagination/index.d.ts +0 -2
- package/dist/components/Pagination/index.js +0 -2
- package/dist/components/Popover/Popover.js.map +0 -1
- package/dist/components/Popover/PopoverOverlay.js.map +0 -1
- package/dist/components/ProgressBar/ProgressBar.js.map +0 -1
- package/dist/components/ProgressBar/index.d.ts +0 -2
- package/dist/components/RadioGroup/RadioGroup.js +0 -46
- package/dist/components/RadioGroup/RadioGroup.js.map +0 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +0 -55
- package/dist/components/SegmentedControl/SegmentedControl.js.map +0 -1
- package/dist/components/SegmentedControl/index.d.ts +0 -2
- package/dist/components/Select/Select.js +0 -64
- package/dist/components/Select/Select.js.map +0 -1
- package/dist/components/Skeleton/Skeleton.js.map +0 -1
- package/dist/components/Spinner/Spinner.js.map +0 -1
- package/dist/components/Stat/Stat.d.ts +0 -49
- package/dist/components/Stat/Stat.js +0 -125
- package/dist/components/Stat/Stat.js.map +0 -1
- package/dist/components/Stat/index.d.ts +0 -2
- package/dist/components/Stat/index.js +0 -2
- package/dist/components/Switch/Switch.js +0 -39
- package/dist/components/Switch/Switch.js.map +0 -1
- package/dist/components/Table/Table.js.map +0 -1
- package/dist/components/Tabs/Tabs.js.map +0 -1
- package/dist/components/Tag/Tag.js +0 -48
- package/dist/components/Tag/Tag.js.map +0 -1
- package/dist/components/Textarea/Textarea.js +0 -30
- package/dist/components/Textarea/Textarea.js.map +0 -1
- package/dist/components/Textarea/index.d.ts +0 -2
- package/dist/components/Toast/Toast.js.map +0 -1
- package/dist/components/Toast/ToastItem.d.ts +0 -6
- package/dist/components/Toast/ToastItem.js.map +0 -1
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/Tooltip/TooltipOverlay.js.map +0 -1
- package/dist/internal/LazyDialogTrigger.d.ts +0 -8
- package/dist/internal/LazyDialogTrigger.js +0 -15
- package/dist/internal/LazyDialogTrigger.js.map +0 -1
- package/dist/internal/Spinner.d.ts +0 -3
- package/dist/internal/Spinner.js +0 -14
- package/dist/internal/Spinner.js.map +0 -1
- package/dist/internal/useLazyMenuTrigger.d.ts +0 -23
- package/dist/internal/useLazyMenuTrigger.js +0 -47
- package/dist/internal/useLazyMenuTrigger.js.map +0 -1
- package/dist/utils/cxLite.d.ts +0 -12
- package/dist/utils/cxLite.js +0 -23
- package/dist/utils/cxLite.js.map +0 -1
- /package/dist/components/{Badge → atoms/Badge}/index.js +0 -0
- /package/dist/components/{Checkbox → atoms/Checkbox}/Checkbox.d.ts +0 -0
- /package/dist/components/{Checkbox → atoms/Checkbox}/index.d.ts +0 -0
- /package/dist/components/{Checkbox → atoms/Checkbox}/index.js +0 -0
- /package/dist/components/{IconButton → atoms/IconButton}/index.d.ts +0 -0
- /package/dist/components/{IconButton → atoms/IconButton}/index.js +0 -0
- /package/dist/components/{Kbd → atoms/Kbd}/index.d.ts +0 -0
- /package/dist/components/{Kbd → atoms/Kbd}/index.js +0 -0
- /package/dist/components/{ProgressBar → atoms/ProgressBar}/index.js +0 -0
- /package/dist/components/{Skeleton → atoms/Skeleton}/Skeleton.d.ts +0 -0
- /package/dist/components/{Skeleton → atoms/Skeleton}/index.d.ts +0 -0
- /package/dist/components/{Skeleton → atoms/Skeleton}/index.js +0 -0
- /package/dist/components/{Spinner → atoms/Spinner}/Spinner.d.ts +0 -0
- /package/dist/components/{Spinner → atoms/Spinner}/index.d.ts +0 -0
- /package/dist/components/{Spinner → atoms/Spinner}/index.js +0 -0
- /package/dist/components/{Switch → atoms/Switch}/index.d.ts +0 -0
- /package/dist/components/{Switch → atoms/Switch}/index.js +0 -0
- /package/dist/components/{Tooltip → atoms/Tooltip}/Tooltip.d.ts +0 -0
- /package/dist/components/{Tooltip → atoms/Tooltip}/TooltipOverlay.d.ts +0 -0
- /package/dist/components/{Tooltip → atoms/Tooltip}/index.d.ts +0 -0
- /package/dist/components/{Tooltip → atoms/Tooltip}/index.js +0 -0
- /package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/Breadcrumbs.d.ts +0 -0
- /package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/index.d.ts +0 -0
- /package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/index.js +0 -0
- /package/dist/components/{Card → molecules/Card}/index.js +0 -0
- /package/dist/components/{CodeBlock → molecules/CodeBlock}/index.d.ts +0 -0
- /package/dist/components/{CodeBlock → molecules/CodeBlock}/index.js +0 -0
- /package/dist/components/{Combobox → molecules/Combobox}/index.d.ts +0 -0
- /package/dist/components/{Combobox → molecules/Combobox}/index.js +0 -0
- /package/dist/components/{DatePicker → molecules/DatePicker}/index.d.ts +0 -0
- /package/dist/components/{DatePicker → molecules/DatePicker}/index.js +0 -0
- /package/dist/components/{Dialog → molecules/Dialog}/index.d.ts +0 -0
- /package/dist/components/{Dialog → molecules/Dialog}/index.js +0 -0
- /package/dist/components/{Drawer → molecules/Drawer}/index.d.ts +0 -0
- /package/dist/components/{Drawer → molecules/Drawer}/index.js +0 -0
- /package/dist/components/{DropdownMenu → molecules/DropdownMenu}/index.d.ts +0 -0
- /package/dist/components/{DropdownMenu → molecules/DropdownMenu}/index.js +0 -0
- /package/dist/components/{EmptyState → molecules/EmptyState}/index.d.ts +0 -0
- /package/dist/components/{EmptyState → molecules/EmptyState}/index.js +0 -0
- /package/dist/components/{FileDropZone → molecules/FileDropZone}/index.d.ts +0 -0
- /package/dist/components/{FileDropZone → molecules/FileDropZone}/index.js +0 -0
- /package/dist/components/{Input → molecules/Input}/index.js +0 -0
- /package/dist/components/{Popover → molecules/Popover}/PopoverOverlay.d.ts +0 -0
- /package/dist/components/{Popover → molecules/Popover}/index.d.ts +0 -0
- /package/dist/components/{Popover → molecules/Popover}/index.js +0 -0
- /package/dist/components/{RadioGroup → molecules/RadioGroup}/RadioGroup.d.ts +0 -0
- /package/dist/components/{RadioGroup → molecules/RadioGroup}/index.d.ts +0 -0
- /package/dist/components/{RadioGroup → molecules/RadioGroup}/index.js +0 -0
- /package/dist/components/{SegmentedControl → molecules/SegmentedControl}/index.js +0 -0
- /package/dist/components/{Select → molecules/Select}/index.d.ts +0 -0
- /package/dist/components/{Select → molecules/Select}/index.js +0 -0
- /package/dist/components/{Tabs → molecules/Tabs}/Tabs.d.ts +0 -0
- /package/dist/components/{Tabs → molecules/Tabs}/index.d.ts +0 -0
- /package/dist/components/{Tabs → molecules/Tabs}/index.js +0 -0
- /package/dist/components/{Tag → molecules/Tag}/Tag.d.ts +0 -0
- /package/dist/components/{Tag → molecules/Tag}/index.d.ts +0 -0
- /package/dist/components/{Tag → molecules/Tag}/index.js +0 -0
- /package/dist/components/{Textarea → molecules/Textarea}/index.js +0 -0
- /package/dist/components/{Toast → molecules/Toast}/index.js +0 -0
- /package/dist/components/{Chart → organisms/Chart}/ChartTable.d.ts +0 -0
- /package/dist/components/{Chart → organisms/Chart}/geometry.d.ts +0 -0
- /package/dist/components/{Chart → organisms/Chart}/labels.d.ts +0 -0
- /package/dist/components/{Chart → organisms/Chart}/scale.d.ts +0 -0
- /package/dist/components/{Chart → organisms/Chart}/summary.d.ts +0 -0
- /package/dist/components/{Chart → organisms/Chart}/useElementWidth.d.ts +0 -0
- /package/dist/components/{CommandPalette → organisms/CommandPalette}/index.js +0 -0
- /package/dist/components/{PageHeader → organisms/PageHeader}/PageHeader.d.ts +0 -0
- /package/dist/components/{PageHeader → organisms/PageHeader}/index.d.ts +0 -0
- /package/dist/components/{PageHeader → organisms/PageHeader}/index.js +0 -0
- /package/dist/components/{Table → organisms/Table}/index.d.ts +0 -0
- /package/dist/components/{Table → organisms/Table}/index.js +0 -0
- /package/dist/{chrome → internal}/brandLogoPath.d.ts +0 -0
- /package/dist/{chrome → router}/Anchor.d.ts +0 -0
- /package/dist/{chrome → router}/LinkRouter.d.ts +0 -0
- /package/dist/{chrome → theme}/useTheme.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,37 +1,30 @@
|
|
|
1
1
|
# @eylulg/ui
|
|
2
2
|
|
|
3
3
|
[](https://github.com/eylulg/ui/actions/workflows/ci.yml)
|
|
4
|
-
[](https://eylulg.github.io/ui/)
|
|
5
4
|
[](./LICENSE)
|
|
6
5
|
|
|
7
|
-
The
|
|
8
|
-
React
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
colour only: the brand colour and its scale. Scales are generated in oklch with the
|
|
30
|
-
same lightness per step, so contrast is the same in every variant, and a test checks WCAG AA
|
|
31
|
-
for every text token in light and dark.
|
|
32
|
-
- **Accessibility is tested, not assumed.** Tests cover the behaviour this library adds on top of
|
|
33
|
-
React Aria, and every component has an axe audit in both themes. Storybook runs axe on every
|
|
34
|
-
story, including colour contrast.
|
|
6
|
+
The component library behind all of [Eylül's projects](https://eylulg.github.io/): React 19
|
|
7
|
+
components built on React Aria Components, Tailwind CSS 4 design tokens, nine theme variants and
|
|
8
|
+
the shared page frame (top nav, sidebar, theme toggle, footer), all organised by atomic level.
|
|
9
|
+
|
|
10
|
+
Storybook: https://eylulg.github.io/ui/
|
|
11
|
+
|
|
12
|
+
## Decisions
|
|
13
|
+
|
|
14
|
+
- React Aria Components handle behaviour. Keyboard handling, focus and ARIA come from React Aria,
|
|
15
|
+
so this library only adds the API and the styling. It means a `Button` carries about 12 kB gzip
|
|
16
|
+
of React Aria ([performance](./docs/performance.md)).
|
|
17
|
+
- Tailwind 4 tokens handle theming. Components use semantic tokens (`text-primary`,
|
|
18
|
+
`bg-elevated`, `border-control`) that point at colour scales. Dark mode and a new brand colour
|
|
19
|
+
mean redefining variables, not changing components.
|
|
20
|
+
- A variant changes colour only. Each project imports one variant file. Fonts, density, shape
|
|
21
|
+
and spacing are the same everywhere. A test checks WCAG AA for every text token in light and
|
|
22
|
+
dark, in every variant.
|
|
23
|
+
- Overlays load on first open. Menus, dialogs, drawers, popovers, tooltips and the command
|
|
24
|
+
palette fetch their code when the trigger is hovered, focused or pressed. The cost is a short
|
|
25
|
+
wait on a slow first open.
|
|
26
|
+
- Accessibility is tested. Each component has an axe run in light and dark, and Storybook
|
|
27
|
+
runs axe on every story.
|
|
35
28
|
|
|
36
29
|
## Install
|
|
37
30
|
|
|
@@ -39,16 +32,13 @@ projects feel like one product family.
|
|
|
39
32
|
npm install @eylulg/ui react-aria-components lucide-react
|
|
40
33
|
```
|
|
41
34
|
|
|
42
|
-
`react`, `react-dom` 19 and `lucide-react` are peer dependencies. The fonts (Inter, Manrope,
|
|
43
|
-
JetBrains Mono)
|
|
44
|
-
|
|
45
|
-
copy of React with a linked checkout, with Vite and Next.js examples, is in
|
|
46
|
-
[docs/consuming.md](./docs/consuming.md).
|
|
35
|
+
`react`, `react-dom` (19) and `lucide-react` are peer dependencies. The fonts (Inter, Manrope,
|
|
36
|
+
JetBrains Mono) ship with the package. [docs/consuming.md](./docs/consuming.md) covers Vite,
|
|
37
|
+
Next.js and linking a local checkout.
|
|
47
38
|
|
|
48
39
|
## Usage
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
own Tailwind entry so they also become utilities in your markup:
|
|
41
|
+
In an app that runs Tailwind 4, import the tokens and one variant into your own Tailwind entry:
|
|
52
42
|
|
|
53
43
|
```css
|
|
54
44
|
@import 'tailwindcss';
|
|
@@ -57,20 +47,17 @@ own Tailwind entry so they also become utilities in your markup:
|
|
|
57
47
|
@source '../node_modules/@eylulg/ui/dist';
|
|
58
48
|
```
|
|
59
49
|
|
|
60
|
-
Without Tailwind, import the compiled stylesheet and a variant once
|
|
50
|
+
Without Tailwind, import the compiled stylesheet and a variant once at the root:
|
|
61
51
|
|
|
62
52
|
```ts
|
|
63
53
|
import '@eylulg/ui/styles.css';
|
|
64
54
|
import '@eylulg/ui/themes/workspace.css';
|
|
65
55
|
```
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
the fonts, import `@eylulg/ui/fonts.css` first. A
|
|
70
|
-
browser downloads only the fonts a page uses; without the file every theme names its fonts and
|
|
71
|
-
falls back to the system font.
|
|
57
|
+
`@eylulg/ui/tokens.css` is a third option: custom properties only, for apps that style themselves.
|
|
58
|
+
`@eylulg/ui/fonts.css` loads the bundled fonts; without it the themes fall back to the system font.
|
|
72
59
|
|
|
73
|
-
|
|
60
|
+
Import components from a per component entry point or from the index:
|
|
74
61
|
|
|
75
62
|
```tsx
|
|
76
63
|
import { Button } from '@eylulg/ui/button';
|
|
@@ -92,19 +79,12 @@ export function InviteDialog() {
|
|
|
92
79
|
}
|
|
93
80
|
```
|
|
94
81
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Dark mode is class based. `ThemeToggle` writes `dark-mode` on `<html>`; the theme also accepts
|
|
98
|
-
`dark`, on `<html>` or on any container. Put `themeInitScript` in `<head>` to avoid a flash of the
|
|
99
|
-
wrong theme (see [docs/consuming.md](./docs/consuming.md)).
|
|
82
|
+
Dark mode is class based. `ThemeToggle` writes `dark-mode` on `<html>`; `dark` works too, on
|
|
83
|
+
`<html>` or any container. Put `themeInitScript` in `<head>` to avoid a flash of the wrong theme.
|
|
100
84
|
|
|
101
85
|
## Theme variants
|
|
102
86
|
|
|
103
|
-
|
|
104
|
-
warm brown in dark), the shape (14px buttons and inputs, 20px cards, 24px page panels), the
|
|
105
|
-
spacing, the fonts (Manrope for headings, Inter for text, JetBrains Mono for code only), the
|
|
106
|
-
default text size, the density, the status colours and the semantic tokens. A variant changes
|
|
107
|
-
colour only. Import exactly one, after `theme.css`.
|
|
87
|
+
Import exactly one, after `theme.css`.
|
|
108
88
|
|
|
109
89
|
| Variant | Import | Project | Colour | Light | Dark |
|
|
110
90
|
| ---------------- | -------------------------------------- | --------------------- | ---------- | --------- | --------- |
|
|
@@ -118,97 +98,98 @@ colour only. Import exactly one, after `theme.css`.
|
|
|
118
98
|
| `sudoku` | `@eylulg/ui/themes/sudoku.css` | Sudoku | Ink | `#293647` | `#c4d2e5` |
|
|
119
99
|
| `assistant` | `@eylulg/ui/themes/assistant.css` | Assistant Studio | Plum | `#824d85` | `#deb0e0` |
|
|
120
100
|
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
the
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
`px-control-x`, `py-item-y`, `px-cell-x` and `p-card`. The values are the same in every theme.
|
|
134
|
-
- **Live switching.** `@eylulg/ui/themes/all.css` holds every variant under
|
|
135
|
-
`[data-ui-variant="<name>"]` only, so a page can switch themes by changing one attribute, or show
|
|
136
|
-
several projects side by side. The portfolio's theme picker and Storybook use it.
|
|
137
|
-
- **Typed matrix.** `import { variants, variantNames } from '@eylulg/ui/themes'` gives tools the
|
|
138
|
-
same data, including seeds and the generated scales.
|
|
139
|
-
|
|
140
|
-
## Overriding the brand
|
|
141
|
-
|
|
142
|
-
To change a single decision rather than switch variant, set `--color-brand-seed` and
|
|
143
|
-
`--color-brand-seed-dark` after the library CSS, or override one semantic variable such as
|
|
144
|
-
`--ui-bg-brand-solid`. Keep the light seed at 4.5:1 or more against white and the dark seed at
|
|
145
|
-
4.5:1 against the dark page.
|
|
101
|
+
- Each variant has one seed per mode. The brand scale (`--color-brand-25` to `950`) is
|
|
102
|
+
generated from it in oklch, with the same lightness at each step. `npm run themes` regenerates
|
|
103
|
+
the CSS from `src/styles/themes/variants.ts`.
|
|
104
|
+
- `npm run contrast` checks text tokens at 4.5:1 and icons, solid fills, control
|
|
105
|
+
borders, focus rings, the logo and chart series at 3:1, in light and dark, for every variant.
|
|
106
|
+
- `@eylulg/ui/themes/all.css` scopes every variant to
|
|
107
|
+
`[data-ui-variant="<name>"]`, so a page can switch variants by changing one attribute.
|
|
108
|
+
- For a typed matrix, `import { variants, variantNames } from '@eylulg/ui/themes'` returns the
|
|
109
|
+
seeds and scales.
|
|
110
|
+
- To change one decision instead of a variant, set `--color-brand-seed` and
|
|
111
|
+
`--color-brand-seed-dark` after the library CSS. Keep the light seed at 4.5:1 against white and
|
|
112
|
+
the dark seed at 4.5:1 against the dark page.
|
|
146
113
|
|
|
147
114
|
## Components
|
|
148
115
|
|
|
149
|
-
| Component | Import |
|
|
150
|
-
| ----------------------------- | ------------------------------ |
|
|
151
|
-
| `Avatar` | `@eylulg/ui/avatar` |
|
|
152
|
-
| `Badge` | `@eylulg/ui/badge` |
|
|
153
|
-
| `Breadcrumbs` | `@eylulg/ui/breadcrumbs` |
|
|
154
|
-
| `Button` | `@eylulg/ui/button` |
|
|
155
|
-
| `Card` | `@eylulg/ui/card` |
|
|
156
|
-
| `Charts` | `@eylulg/ui/chart` |
|
|
157
|
-
| `Checkbox` | `@eylulg/ui/checkbox` |
|
|
158
|
-
| `CodeBlock` | `@eylulg/ui/code-block` |
|
|
159
|
-
| `Combobox` | `@eylulg/ui/combobox` |
|
|
160
|
-
| `CommandPalette` | `@eylulg/ui/command-palette` |
|
|
161
|
-
| `DatePicker, DateRangePicker` | `@eylulg/ui/date-picker` |
|
|
162
|
-
| `Dialog` | `@eylulg/ui/dialog` |
|
|
163
|
-
| `Drawer` | `@eylulg/ui/drawer` |
|
|
164
|
-
| `DropdownMenu` | `@eylulg/ui/dropdown-menu` |
|
|
165
|
-
| `EmptyState` | `@eylulg/ui/empty-state` |
|
|
166
|
-
| `FileDropZone` | `@eylulg/ui/file-drop-zone` |
|
|
167
|
-
| `IconButton` | `@eylulg/ui/icon-button` |
|
|
168
|
-
| `Input` | `@eylulg/ui/input` |
|
|
169
|
-
| `Kbd` | `@eylulg/ui/kbd` |
|
|
170
|
-
| `PageHeader` | `@eylulg/ui/page-header` |
|
|
171
|
-
| `Pagination` | `@eylulg/ui/pagination` |
|
|
172
|
-
| `Popover` | `@eylulg/ui/popover` |
|
|
173
|
-
| `ProgressBar` | `@eylulg/ui/progress-bar` |
|
|
174
|
-
| `RadioGroup` | `@eylulg/ui/radio-group` |
|
|
175
|
-
| `SegmentedControl` | `@eylulg/ui/segmented-control` |
|
|
176
|
-
| `Select` | `@eylulg/ui/select` |
|
|
177
|
-
| `Skeleton` | `@eylulg/ui/skeleton` |
|
|
178
|
-
| `Spinner` | `@eylulg/ui/spinner` |
|
|
179
|
-
| `Stat` | `@eylulg/ui/stat` |
|
|
180
|
-
| `Switch` | `@eylulg/ui/switch` |
|
|
181
|
-
| `Table` | `@eylulg/ui/table` |
|
|
182
|
-
| `Tabs` | `@eylulg/ui/tabs` |
|
|
183
|
-
| `Tag` | `@eylulg/ui/tag` |
|
|
184
|
-
| `Textarea` | `@eylulg/ui/textarea` |
|
|
185
|
-
| `Toast` | `@eylulg/ui/toast` |
|
|
186
|
-
| `Tooltip` | `@eylulg/ui/tooltip` |
|
|
187
|
-
| `cx` | `@eylulg/ui/cx` |
|
|
188
|
-
|
|
189
|
-
Icons come from
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
116
|
+
| Component | Import | Notes |
|
|
117
|
+
| ----------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------- |
|
|
118
|
+
| `Avatar` | `@eylulg/ui/avatar` | Image with initials fallback, status, sizes, `AvatarGroup` |
|
|
119
|
+
| `Badge` | `@eylulg/ui/badge` | Nine tones, dot, icon |
|
|
120
|
+
| `Breadcrumbs` | `@eylulg/ui/breadcrumbs` | Current page, router links |
|
|
121
|
+
| `Button` | `@eylulg/ui/button` | Five variants, three sizes, loading, icons, renders a link with `href`, `buttonStyles()` |
|
|
122
|
+
| `Card` | `@eylulg/ui/card` | Header, body and footer slots, interactive card as one link or button |
|
|
123
|
+
| `Charts` | `@eylulg/ui/chart` | `LineChart`, `BarChart`, `HeatGrid`, `Sparkline` in plain SVG (see below) |
|
|
124
|
+
| `Checkbox` | `@eylulg/ui/checkbox` | Indeterminate, hint, invalid |
|
|
125
|
+
| `CodeBlock` | `@eylulg/ui/code-block` | Labelled, keyboard scrollable, optional copy button |
|
|
126
|
+
| `Combobox` | `@eylulg/ui/combobox` | Async loading, sections, empty state |
|
|
127
|
+
| `CommandPalette` | `@eylulg/ui/command-palette` | Search, groups, shortcuts, `useCommandPaletteShortcut`, nested pages |
|
|
128
|
+
| `DatePicker, DateRangePicker` | `@eylulg/ui/date-picker` | Segmented input, calendar popover |
|
|
129
|
+
| `Dialog` | `@eylulg/ui/dialog` | Focus trap and restore, `alertdialog` role, three sizes |
|
|
130
|
+
| `Drawer` | `@eylulg/ui/drawer` | Left, right or bottom sheet |
|
|
131
|
+
| `DropdownMenu` | `@eylulg/ui/dropdown-menu` | Sections, checkbox and radio items, shortcuts, submenus |
|
|
132
|
+
| `EmptyState` | `@eylulg/ui/empty-state` | Icon, title, description, actions |
|
|
133
|
+
| `FileDropZone` | `@eylulg/ui/file-drop-zone` | Drop or pick files, accepted types checked on both paths |
|
|
134
|
+
| `IconButton` | `@eylulg/ui/icon-button` | Takes an icon element; `aria-label` is required outside a React Aria slot |
|
|
135
|
+
| `Input` | `@eylulg/ui/input` | Label, hint, error, icons |
|
|
136
|
+
| `Kbd` | `@eylulg/ui/kbd` | Keys and key combinations |
|
|
137
|
+
| `PageHeader` | `@eylulg/ui/page-header` | Title, description, actions, breadcrumbs |
|
|
138
|
+
| `Pagination` | `@eylulg/ui/pagination` | Buttons, or links with `getPageHref` |
|
|
139
|
+
| `Popover` | `@eylulg/ui/popover` | Non modal panel |
|
|
140
|
+
| `ProgressBar` | `@eylulg/ui/progress-bar` | Tones, value label, indeterminate |
|
|
141
|
+
| `RadioGroup` | `@eylulg/ui/radio-group` | Vertical or horizontal |
|
|
142
|
+
| `SegmentedControl` | `@eylulg/ui/segmented-control` | One of a few views, icons |
|
|
143
|
+
| `Select` | `@eylulg/ui/select` | Static or dynamic items, typeahead, option descriptions |
|
|
144
|
+
| `Skeleton` | `@eylulg/ui/skeleton` | Text, circle and rectangle |
|
|
145
|
+
| `Spinner` | `@eylulg/ui/spinner` | Decorative, or announced with a label |
|
|
146
|
+
| `Stat` | `@eylulg/ui/stat` | Label, value, detail line and a trend announced in words; put it in a `Card` |
|
|
147
|
+
| `Switch` | `@eylulg/ui/switch` | Two sizes, hint |
|
|
148
|
+
| `Table` | `@eylulg/ui/table` | Sortable columns, row selection, sticky header, empty state |
|
|
149
|
+
| `Tabs` | `@eylulg/ui/tabs` | Horizontal or vertical |
|
|
150
|
+
| `Tag` | `@eylulg/ui/tag` | Removable, selectable |
|
|
151
|
+
| `Textarea` | `@eylulg/ui/textarea` | Label, hint, error, optional resize |
|
|
152
|
+
| `Toast` | `@eylulg/ui/toast` | `ToastProvider` and `useToast`, five tones, one `action` button |
|
|
153
|
+
| `Tooltip` | `@eylulg/ui/tooltip` | Hover and focus, Escape, four placements |
|
|
154
|
+
| `cx` | `@eylulg/ui/cx` | Class joiner that resolves Tailwind conflicts with tailwind-merge |
|
|
155
|
+
|
|
156
|
+
Icons come from `lucide-react`, a peer dependency. Every icon prop takes an element, for example
|
|
157
|
+
`icon={<Plus />}`, so it works from a Next.js server component. The library re-exports none.
|
|
158
|
+
|
|
159
|
+
**API conventions.**
|
|
160
|
+
|
|
161
|
+
- Semantic colour is one prop, `tone`. Its values are `neutral`, `brand`, `success`, `warning` or `error`. Badge
|
|
162
|
+
adds the categorical hues `blue`, `purple`, `pink` and `indigo`. `Badge`, `ProgressBar` and
|
|
163
|
+
`Toast` take it; `DropdownMenuItem` takes `isDestructive`.
|
|
164
|
+
- Booleans read as `isX`, `allowsX` or `shouldX`. Examples are `CodeBlock` `allowsCopy`, `Textarea`
|
|
165
|
+
`allowsResize`, `Kbd` `isDecorative`, `CommandPalette` `shouldCloseOnAction`.
|
|
166
|
+
- `label` is visible text. An accessible name is `aria-label` (`CodeBlock`, `ToastProvider`,
|
|
167
|
+
`CommandPalette`, `ThemeToggle`).
|
|
168
|
+
- Built-in English text is one flat prop per part with an English default. `ThemeToggle`
|
|
169
|
+
has `lightLabel`, `darkLabel`, `systemLabel`; `TopNav` `portfolioLabel`, `openMenuLabel`,
|
|
170
|
+
`closeMenuLabel`; `ToastProvider` `dismissLabel`; `Pagination` `previousLabel`, `nextLabel`,
|
|
171
|
+
`pageLabel(page)`; `Stat` `upLabel`, `downLabel`, `neutralLabel`. `Chart` keeps one `labels`
|
|
172
|
+
object. Buttons inside React Aria's `Combobox`, `Tag` and `DatePicker` are named in the user's
|
|
173
|
+
language by React Aria.
|
|
174
|
+
- `ControlSize` (`sm`, `md`, `lg`) is the one size type for buttons, fields and segmented controls.
|
|
175
|
+
- `TextLink` and `NavItem` take `target`, `rel`, `aria-label` and `title`. With `target='_blank'`
|
|
176
|
+
and no `rel`, `rel` is `noreferrer`.
|
|
177
|
+
- `@eylulg/ui/brand-logo-path` exports the logo outline as a string, with no framework code.
|
|
178
|
+
|
|
179
|
+
**Toast.** React Aria's toast API is still exported as `UNSTABLE_`, so Toast is built in this
|
|
180
|
+
library. It is a labelled region with a polite live list. Timers pause while a toast is hovered or
|
|
181
|
+
focused. When a toast that holds focus closes, focus returns to the control you came from.
|
|
182
|
+
|
|
183
|
+
**Card.** An interactive card (`href` or `onPress`) stretches its title link over the whole card.
|
|
184
|
+
Actions in `CardHeader` and `CardFooter` stay separate tab stops. A control inside `CardBody`
|
|
185
|
+
needs `relative z-10` to be clickable.
|
|
201
186
|
|
|
202
187
|
## Charts
|
|
203
188
|
|
|
204
|
-
`@eylulg/ui/chart` draws
|
|
205
|
-
series over dates, numbers or names. `BarChart` is vertical or horizontal, grouped or stacked.
|
|
206
|
-
`HeatGrid` is a matrix of rows by columns, either states such as pass and fail (a fill and a
|
|
207
|
-
distinct icon per state) or numbers (five shades of one hue). `ChartLegend` is the legend the
|
|
208
|
-
charts use, exported for your own layouts.
|
|
189
|
+
`@eylulg/ui/chart` draws with plain SVG and has no chart library behind it.
|
|
209
190
|
|
|
210
191
|
```tsx
|
|
211
|
-
import {
|
|
192
|
+
import { LineChart } from '@eylulg/ui/chart';
|
|
212
193
|
|
|
213
194
|
<LineChart
|
|
214
195
|
title='Requests per day'
|
|
@@ -219,110 +200,78 @@ import { HeatGrid, LineChart } from '@eylulg/ui/chart';
|
|
|
219
200
|
]}
|
|
220
201
|
locale='en-GB'
|
|
221
202
|
/>;
|
|
222
|
-
|
|
223
|
-
<HeatGrid
|
|
224
|
-
title='Checks by case'
|
|
225
|
-
rowLabel='Case'
|
|
226
|
-
rows={[{ id: 'refund', label: 'Refund request' }]}
|
|
227
|
-
columns={[{ id: 'cites', label: 'Cites source' }]}
|
|
228
|
-
states={{
|
|
229
|
-
pass: { label: 'Pass', tone: 'success' },
|
|
230
|
-
fail: { label: 'Fail', tone: 'error' },
|
|
231
|
-
}}
|
|
232
|
-
cells={[{ row: 'refund', column: 'cites', state: 'fail', detail: 'No source cited.' }]}
|
|
233
|
-
/>;
|
|
234
203
|
```
|
|
235
204
|
|
|
236
|
-
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
| `
|
|
256
|
-
| `
|
|
257
|
-
| `
|
|
258
|
-
| `
|
|
259
|
-
| `
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
URLs change when the custom domain arrives.** Pass `projects` to `ProjectSwitcher` or
|
|
270
|
-
`SiteFooter` to override the list.
|
|
271
|
-
|
|
272
|
-
Every chrome part takes a `labels` object for translation, and `useTheme()` lets the app set the
|
|
273
|
-
theme from code. `TopNav` loads its mobile menu on first press, so a page that never opens it pays
|
|
274
|
-
about 1.6 kB gzip for the bar. In Next.js, server components can import the server safe parts directly. Render `TopNav` from a
|
|
275
|
-
small `'use client'` file when you pass `next/link` as `LinkComponent`, because a server component
|
|
276
|
-
cannot pass a function to a client component. See [docs/consuming.md](./docs/consuming.md).
|
|
205
|
+
- Series colours are `--ui-chart-1` to `--ui-chart-6`. They are the same in every variant and
|
|
206
|
+
checked at 3:1 against every surface. Past six series, the rest share a muted colour and differ
|
|
207
|
+
by marker shape and dash.
|
|
208
|
+
- Each chart is a named figure with a generated summary. Tab enters the plot once, arrow keys,
|
|
209
|
+
Home and End move between points, and Escape closes the tooltip. The data is also a table behind
|
|
210
|
+
a "Show table" button.
|
|
211
|
+
- Charts take the width of their container. Numbers and dates go through `Intl` with `locale`.
|
|
212
|
+
|
|
213
|
+
## Page frame
|
|
214
|
+
|
|
215
|
+
The parts every project's pages share are ordinary components on their atomic level, each with its
|
|
216
|
+
own entry point.
|
|
217
|
+
|
|
218
|
+
| Export | Level | What it does | Server safe |
|
|
219
|
+
| ----------------- | -------- | -------------------------------------------------------------------------------------------------- | ----------- |
|
|
220
|
+
| `AppShell` | Template | Skip link, header, optional sidebar, main landmark, footer; `width` and `contentClassName` | yes |
|
|
221
|
+
| `TopNav` | Organism | Logo and product name, `NavItem` links, `center`, `actions`, `mobileActions`, `width`, mobile menu | no |
|
|
222
|
+
| `SidebarNav` | Organism | `NavItem` sections, collapsible groups, an optional action per item, arrow keys | no |
|
|
223
|
+
| `SiteFooter` | Organism | A next project card, a back link and quiet links; `width` and `children` | yes |
|
|
224
|
+
| `ThemeToggle` | Organism | Light, dark and system as a `SegmentedControl`, or `variant="menu"`; controlled or `useTheme` | no |
|
|
225
|
+
| `NavItem` | Atom | One navigation link with `isCurrent`, icon and badge | yes |
|
|
226
|
+
| `TextLink` | Atom | A text link, `inline` or `quiet` | yes |
|
|
227
|
+
| `BrandLogo` | Atom | The EG horse logo, in the brand green in every theme. Default logo of `TopNav` | yes |
|
|
228
|
+
| `BrandLoader` | Atom | The animated logo for page transitions | no |
|
|
229
|
+
| `useTheme` | Hook | `{ theme, resolved, setTheme }` for a command palette or settings page | no |
|
|
230
|
+
| `themeInitScript` | Script | Inline script for the document head that applies the stored theme before first paint | yes |
|
|
231
|
+
|
|
232
|
+
The project list is data, not a component: `@eylulg/ui/projects` exports `projects`,
|
|
233
|
+
`nextProject(currentId)`, `allProjectsLink` and `profileNavLinks`, so a footer is one line:
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
<SiteFooter next={nextProject('workspace')} backLink={allProjectsLink} links={profileNavLinks} />
|
|
237
|
+
```
|
|
277
238
|
|
|
278
239
|
## Development
|
|
279
240
|
|
|
280
241
|
```bash
|
|
281
242
|
npm install
|
|
282
|
-
npm run storybook #
|
|
243
|
+
npm run storybook # http://localhost:6006
|
|
283
244
|
npm test # Vitest, Testing Library, vitest-axe, theme contrast check
|
|
284
|
-
npm run typecheck
|
|
285
|
-
npm run lint # ESLint with jsx-a11y and import order, zero warnings
|
|
286
|
-
npm run format:check
|
|
245
|
+
npm run typecheck && npm run lint && npm run format:check
|
|
287
246
|
npm run knip # unused files, exports and dependencies
|
|
288
|
-
npm run build # dist/ with ESM,
|
|
247
|
+
npm run build # dist/ with ESM, types, styles.css and theme files
|
|
289
248
|
npm run size # bundle size budget
|
|
290
|
-
npm run build-storybook # static Storybook in storybook-static/
|
|
291
|
-
npm run themes # regenerate variant scales and CSS from variants.ts
|
|
292
|
-
npm run contrast # print the contrast report for every variant
|
|
293
249
|
```
|
|
294
250
|
|
|
295
251
|
## Contributing
|
|
296
252
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
`
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
4. **One story per variant**, so the a11y panel and visual review cover each of them.
|
|
314
|
-
5. **Only tokens in components.** Semantic colours (`text-primary`, not `text-gray-900`), radius
|
|
315
|
-
utilities and density utilities, so every theme variant keeps working.
|
|
316
|
-
6. A pre-commit hook runs ESLint and Prettier on staged files. CI runs typecheck, lint, format,
|
|
317
|
-
knip, commitlint, tests, both builds, the size budget and a gitleaks secret scan. Dependabot
|
|
318
|
-
opens grouped updates monthly.
|
|
253
|
+
1. Commits follow Conventional Commits. commitlint checks them in a Husky hook and in CI, and
|
|
254
|
+
semantic-release reads them to pick the version.
|
|
255
|
+
2. A component lives in `src/components/<level>/<Name>/` (atoms, molecules, organisms or
|
|
256
|
+
templates) with `<Name>.tsx`, `<Name>.stories.tsx`, `index.ts` and `__tests__/<Name>.test.tsx`,
|
|
257
|
+
and is built only from the levels below it. Add its name under its level in
|
|
258
|
+
`scripts/components.ts`, export it from `src/index.ts` and add an entry to `exports` in
|
|
259
|
+
`package.json` (a test checks the last two agree).
|
|
260
|
+
3. Nothing is one off. A control is a `Button`, `IconButton`, `NavItem` or `TextLink` shaped by its
|
|
261
|
+
props; fields take their box from `fieldStyles` and every control its height from the control
|
|
262
|
+
scale (`sm` 32px, `md` 40px, `lg` 48px).
|
|
263
|
+
4. Tests cover behaviour this library adds over React Aria: states, rules, focus placement, logic.
|
|
264
|
+
One behaviour per test, queries by role and name, one axe run per component.
|
|
265
|
+
5. Components use semantic tokens only (`text-primary`, not `text-gray-900`), so every variant
|
|
266
|
+
keeps working.
|
|
267
|
+
6. CI runs typecheck, lint, format, knip, commitlint, tests, both builds, the size budget and a
|
|
268
|
+
gitleaks scan. Dependabot opens grouped updates monthly.
|
|
319
269
|
|
|
320
270
|
## Releases
|
|
321
271
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
it is added the job skips the release step with a notice and nothing is published.
|
|
272
|
+
semantic-release runs on pushes to `main`: it tags, publishes to npm with provenance, creates a
|
|
273
|
+
GitHub release and updates `CHANGELOG.md`. The latest version on npm is 1.2.0. Releases are paused
|
|
274
|
+
for now.
|
|
326
275
|
|
|
327
276
|
## License
|
|
328
277
|
|
|
@@ -33,7 +33,9 @@ export interface AvatarGroupProps {
|
|
|
33
33
|
max?: number;
|
|
34
34
|
/** Size of the "+N" counter. Match it to the avatars. */
|
|
35
35
|
size?: AvatarSize;
|
|
36
|
+
/** Accessible name of the "+N" counter. */
|
|
37
|
+
moreLabel?: (count: number) => string;
|
|
36
38
|
className?: string;
|
|
37
39
|
}
|
|
38
40
|
/** Overlapping avatars with a "+N" counter for the rest. */
|
|
39
|
-
export declare function AvatarGroup({ children, 'aria-label': ariaLabel, max, size, className, }: AvatarGroupProps): import("react").JSX.Element;
|
|
41
|
+
export declare function AvatarGroup({ children, 'aria-label': ariaLabel, max, size, moreLabel, className, }: AvatarGroupProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cx } from "
|
|
2
|
+
import { cx } from "../../../utils/cx.js";
|
|
3
3
|
import { Children, useState } from "react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
// src/components/Avatar/Avatar.tsx
|
|
5
|
+
// src/components/atoms/Avatar/Avatar.tsx
|
|
6
6
|
var sizes = {
|
|
7
7
|
xs: {
|
|
8
8
|
avatar: "size-6 text-xs",
|
|
@@ -101,7 +101,7 @@ function Avatar({ name, src, size = "md", status, statusLabel, className }) {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
/** Overlapping avatars with a "+N" counter for the rest. */
|
|
104
|
-
function AvatarGroup({ children, "aria-label": ariaLabel, max = 4, size = "md", className }) {
|
|
104
|
+
function AvatarGroup({ children, "aria-label": ariaLabel, max = 4, size = "md", moreLabel = (count) => `${count} more`, className }) {
|
|
105
105
|
const items = Children.toArray(children);
|
|
106
106
|
const visible = items.slice(0, max);
|
|
107
107
|
const hidden = items.length - visible.length;
|
|
@@ -111,7 +111,7 @@ function AvatarGroup({ children, "aria-label": ariaLabel, max = 4, size = "md",
|
|
|
111
111
|
className: cx("flex -space-x-2", className),
|
|
112
112
|
children: [visible, hidden > 0 && /* @__PURE__ */ jsx("span", {
|
|
113
113
|
role: "img",
|
|
114
|
-
"aria-label":
|
|
114
|
+
"aria-label": moreLabel(hidden),
|
|
115
115
|
"data-initials": `+${hidden}`,
|
|
116
116
|
className: cx(surface, initialsText, "bg-tertiary text-secondary", sizes[size].avatar)
|
|
117
117
|
})]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.js","names":["_Fragment"],"sources":["../../../../src/components/atoms/Avatar/Avatar.tsx"],"sourcesContent":["import { Children, useState, type ReactNode } from 'react';\nimport { cx } from '../../../utils/cx';\n\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\nexport type AvatarStatus = 'online' | 'away' | 'busy' | 'offline';\n\nexport interface AvatarProps {\n /** Full name. Used as the accessible name and for the initials fallback. */\n name: string;\n /** Image URL. Falls back to initials when missing or when it fails to load. */\n src?: string;\n size?: AvatarSize;\n /** Presence dot in the corner, announced as text. */\n status?: AvatarStatus;\n /** Overrides the announced status text, for example \"Online since 9:00\". */\n statusLabel?: string;\n className?: string;\n}\n\nconst sizes: Record<AvatarSize, { avatar: string; dot: string }> = {\n xs: { avatar: 'size-6 text-xs', dot: 'size-1.5' },\n sm: { avatar: 'size-8 text-xs', dot: 'size-2' },\n md: { avatar: 'size-10 text-sm', dot: 'size-2.5' },\n lg: { avatar: 'size-12 text-md', dot: 'size-3' },\n xl: { avatar: 'size-14 text-lg', dot: 'size-3.5' },\n};\n\nconst statuses: Record<AvatarStatus, { dot: string; label: string }> = {\n online: { dot: 'bg-fg-success', label: 'Online' },\n away: { dot: 'bg-fg-warning', label: 'Away' },\n busy: { dot: 'bg-fg-error', label: 'Busy' },\n offline: { dot: 'bg-fg-tertiary', label: 'Offline' },\n};\n\nconst surface =\n 'inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-brand-subtle font-semibold text-brand ring-1 ring-default select-none';\n\n/**\n * Initials are drawn from a data attribute through CSS, not rendered as text.\n * An avatar inside a labelled button would otherwise add visible text the\n * button's accessible name does not contain (axe label-content-name-mismatch).\n */\nconst initialsText = 'after:content-[attr(data-initials)]';\n\nconst dotBase =\n 'absolute right-0 bottom-0 rounded-full outline-2 outline-(--ui-bg-primary) outline-solid';\n\n/**\n * Up to two initials from a name: the first letter of the first and last\n * words, or the first letter of a single name. Extra whitespace is ignored and\n * letters outside the Basic Multilingual Plane stay whole.\n */\nexport function getInitials(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const first = words[0];\n if (!first) return '';\n const last = words.length > 1 ? words[words.length - 1] : undefined;\n const letters = [first, last].map((word) => (word ? (Array.from(word)[0] ?? '') : ''));\n return letters.join('').toLocaleUpperCase();\n}\n\nfunction AvatarImage({ name, src, sizeClass }: { name: string; src?: string; sizeClass: string }) {\n const [failed, setFailed] = useState(false);\n\n function handleError() {\n setFailed(true);\n }\n\n if (!src || failed) {\n return (\n <span\n role='img'\n aria-label={name}\n data-initials={getInitials(name)}\n className={cx(surface, initialsText, sizeClass)}\n />\n );\n }\n return (\n <img\n src={src}\n alt={name}\n onError={handleError}\n className={cx(surface, 'object-cover', sizeClass)}\n />\n );\n}\n\n/**\n * A person's picture, with an initials fallback when there is no image or it\n * fails to load. The name is always the accessible name.\n */\nexport function Avatar({ name, src, size = 'md', status, statusLabel, className }: AvatarProps) {\n return (\n <span className={cx('relative inline-flex shrink-0', className)}>\n <AvatarImage key={src} name={name} src={src} sizeClass={sizes[size].avatar} />\n {status && (\n <>\n <span aria-hidden='true' className={cx(dotBase, statuses[status].dot, sizes[size].dot)} />\n <span className='sr-only'>{statusLabel ?? statuses[status].label}</span>\n </>\n )}\n </span>\n );\n}\n\nexport interface AvatarGroupProps {\n /** Avatar elements. */\n children: ReactNode;\n /** Accessible name of the group, such as \"Reviewers\". */\n 'aria-label': string;\n /** Maximum avatars shown before a \"+N\" counter. */\n max?: number;\n /** Size of the \"+N\" counter. Match it to the avatars. */\n size?: AvatarSize;\n /** Accessible name of the \"+N\" counter. */\n moreLabel?: (count: number) => string;\n className?: string;\n}\n\n/** Overlapping avatars with a \"+N\" counter for the rest. */\nexport function AvatarGroup({\n children,\n 'aria-label': ariaLabel,\n max = 4,\n size = 'md',\n moreLabel = (count) => `${count} more`,\n className,\n}: AvatarGroupProps) {\n const items = Children.toArray(children);\n const visible = items.slice(0, max);\n const hidden = items.length - visible.length;\n return (\n <div role='group' aria-label={ariaLabel} className={cx('flex -space-x-2', className)}>\n {visible}\n {hidden > 0 && (\n <span\n role='img'\n aria-label={moreLabel(hidden)}\n data-initials={`+${hidden}`}\n className={cx(surface, initialsText, 'bg-tertiary text-secondary', sizes[size].avatar)}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAmBA,IAAM,QAA6D;CACjE,IAAI;EAAE,QAAQ;EAAkB,KAAK;CAAW;CAChD,IAAI;EAAE,QAAQ;EAAkB,KAAK;CAAS;CAC9C,IAAI;EAAE,QAAQ;EAAmB,KAAK;CAAW;CACjD,IAAI;EAAE,QAAQ;EAAmB,KAAK;CAAS;CAC/C,IAAI;EAAE,QAAQ;EAAmB,KAAK;CAAW;AACnD;AAEA,IAAM,WAAiE;CACrE,QAAQ;EAAE,KAAK;EAAiB,OAAO;CAAS;CAChD,MAAM;EAAE,KAAK;EAAiB,OAAO;CAAO;CAC5C,MAAM;EAAE,KAAK;EAAe,OAAO;CAAO;CAC1C,SAAS;EAAE,KAAK;EAAkB,OAAO;CAAU;AACrD;AAEA,IAAM,UACJ;;;;;;AAOF,IAAM,eAAe;AAErB,IAAM,UACJ;;;;;;AAOF,SAAgB,YAAY,MAAsB;CAChD,MAAM,QAAQ,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;CACrD,MAAM,QAAQ,MAAM;CACpB,IAAI,CAAC,OAAO,OAAO;CAGnB,OADgB,CAAC,OADJ,MAAM,SAAS,IAAI,MAAM,MAAM,SAAS,KAAK,KAAA,CAC9B,CAAC,CAAC,KAAK,SAAU,OAAQ,MAAM,KAAK,IAAI,CAAC,CAAC,MAAM,KAAM,EAC3E,CAAA,CAAQ,KAAK,EAAE,CAAC,CAAC,kBAAkB;AAC5C;AAEA,SAAS,YAAY,EAAE,MAAM,KAAK,aAAgE;CAChG,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,SAAS,cAAc;EACrB,UAAU,IAAI;CAChB;CAEA,IAAI,CAAC,OAAO,QACV,OACE,oBAAC,QAAD;EACE,MAAK;EACL,cAAY;EACZ,iBAAe,YAAY,IAAI;EAC/B,WAAW,GAAG,SAAS,cAAc,SAAS;CAC/C,CAAA;CAGL,OACE,oBAAC,OAAD;EACO;EACL,KAAK;EACL,SAAS;EACT,WAAW,GAAG,SAAS,gBAAgB,SAAS;CACjD,CAAA;AAEL;;;;;AAMA,SAAgB,OAAO,EAAE,MAAM,KAAK,OAAO,MAAM,QAAQ,aAAa,aAA0B;CAC9F,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,iCAAiC,SAAS;EAA9D,UAAA,CACE,oBAAC,aAAD;GAA6B;GAAW;GAAK,WAAW,MAAM,KAAK,CAAC;EAAS,GAA3D,GAA2D,GAC5E,UACC,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;GAAM,eAAY;GAAO,WAAW,GAAG,SAAS,SAAS,OAAO,CAAC,KAAK,MAAM,KAAK,CAAC,GAAG;EAAI,CAAA,GACzF,oBAAC,QAAD;GAAM,WAAU;GAAW,UAAA,eAAe,SAAS,OAAO,CAAC;EAAY,CAAA,CACvE,EAAA,CAAA,CAEA;;AAEV;;AAiBA,SAAgB,YAAY,EAC1B,UACA,cAAc,WACd,MAAM,GACN,OAAO,MACP,aAAa,UAAU,GAAG,MAAM,QAChC,aACmB;CACnB,MAAM,QAAQ,SAAS,QAAQ,QAAQ;CACvC,MAAM,UAAU,MAAM,MAAM,GAAG,GAAG;CAClC,MAAM,SAAS,MAAM,SAAS,QAAQ;CACtC,OACE,qBAAC,OAAD;EAAK,MAAK;EAAQ,cAAY;EAAW,WAAW,GAAG,mBAAmB,SAAS;EAAnF,UAAA,CACG,SACA,SAAS,KACR,oBAAC,QAAD;GACE,MAAK;GACL,cAAY,UAAU,MAAM;GAC5B,iBAAe,IAAI;GACnB,WAAW,GAAG,SAAS,cAAc,8BAA8B,MAAM,KAAK,CAAC,MAAM;EACtF,CAAA,CAEA;;AAET"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Avatar, AvatarGroup
|
|
1
|
+
export { Avatar, AvatarGroup } from './Avatar';
|
|
2
2
|
export type { AvatarGroupProps, AvatarProps, AvatarSize, AvatarStatus } from './Avatar';
|