@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
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { linkFocus } from "../../../internal/focusRing.js";
|
|
3
|
+
import { cx } from "../../../utils/cx.js";
|
|
4
|
+
import { IconButton } from "../../atoms/IconButton/IconButton.js";
|
|
4
5
|
import { useEffect, useState } from "react";
|
|
5
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { Check, Copy } from "lucide-react";
|
|
7
|
-
// src/components/CodeBlock/CodeBlock.tsx
|
|
8
|
+
// src/components/molecules/CodeBlock/CodeBlock.tsx
|
|
9
|
+
var lineTints = {
|
|
10
|
+
"+": "bg-success-subtle",
|
|
11
|
+
"-": "bg-error-subtle"
|
|
12
|
+
};
|
|
8
13
|
var copiedForMs = 2e3;
|
|
9
14
|
var frame = "relative rounded-lg border border-subtle bg-secondary";
|
|
10
|
-
var pre =
|
|
15
|
+
var pre = `overflow-auto rounded-lg p-4 font-data text-sm text-primary ${linkFocus}`;
|
|
11
16
|
/**
|
|
12
17
|
* Preformatted text in the theme's data font, for generated output, commands
|
|
13
18
|
* and code samples. The block is focusable so a keyboard user can scroll it,
|
|
14
|
-
* and it is a labelled group so a screen reader names it. With `
|
|
15
|
-
* button copies the text and a polite status confirms it.
|
|
19
|
+
* and it is a labelled group so a screen reader names it. With `allowsCopy` a
|
|
20
|
+
* button copies the text and a polite status confirms it. With `isDiff` added and removed lines get a tint.
|
|
16
21
|
*/
|
|
17
|
-
function CodeBlock({ children, label,
|
|
22
|
+
function CodeBlock({ children, "aria-label": ariaLabel, allowsCopy = false, copyLabel = "Copy code", copiedLabel = "Copied", wrap = false, isDiff = false, className }) {
|
|
18
23
|
const [copied, setCopied] = useState(false);
|
|
19
24
|
useEffect(() => {
|
|
20
25
|
if (!copied) return;
|
|
@@ -33,12 +38,15 @@ function CodeBlock({ children, label, copyable = false, copyLabel = "Copy code",
|
|
|
33
38
|
className: cx(frame, className),
|
|
34
39
|
children: [/* @__PURE__ */ jsx("pre", {
|
|
35
40
|
role: "group",
|
|
36
|
-
"aria-label":
|
|
41
|
+
"aria-label": ariaLabel,
|
|
37
42
|
tabIndex: 0,
|
|
38
|
-
className: cx(pre,
|
|
39
|
-
children: /* @__PURE__ */ jsx("code", { children
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
className: cx(pre, allowsCopy && "pr-14", wrap && "break-words whitespace-pre-wrap"),
|
|
44
|
+
children: /* @__PURE__ */ jsx("code", { children: isDiff ? children.split("\n").map((line, index) => /* @__PURE__ */ jsx("span", {
|
|
45
|
+
className: cx("-mx-4 block px-4", lineTints[line.charAt(0)]),
|
|
46
|
+
children: line || " "
|
|
47
|
+
}, index)) : children })
|
|
48
|
+
}), allowsCopy && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
49
|
+
icon: copied ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {}),
|
|
42
50
|
"aria-label": copyLabel,
|
|
43
51
|
variant: "tertiary",
|
|
44
52
|
size: "sm",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","names":["_Fragment"],"sources":["../../../../src/components/molecules/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import { Check, Copy } from 'lucide-react';\nimport { useEffect, useState } from 'react';\nimport { linkFocus } from '../../../internal/focusRing';\nimport { cx } from '../../../utils/cx';\nimport { IconButton } from '../../atoms/IconButton/IconButton';\n\nexport interface CodeBlockProps {\n /** The text to show, exactly as it should be copied. */\n children: string;\n /** Accessible name of the block, such as \"Generated Tailwind theme\". */\n 'aria-label': string;\n /** Adds a button that copies the text. */\n allowsCopy?: boolean;\n /** Accessible name of the copy button. */\n copyLabel?: string;\n /** Announced after copying. */\n copiedLabel?: string;\n /** Wrap long lines instead of scrolling sideways. */\n wrap?: boolean;\n /** Tints lines that start with `+` as added and `-` as removed. The markers stay in the text. */\n isDiff?: boolean;\n className?: string;\n}\n\nconst lineTints: Record<string, string> = {\n '+': 'bg-success-subtle',\n '-': 'bg-error-subtle',\n};\n\nconst copiedForMs = 2000;\n\nconst frame = 'relative rounded-lg border border-subtle bg-secondary';\nconst pre = `overflow-auto rounded-lg p-4 font-data text-sm text-primary ${linkFocus}`;\n\n/**\n * Preformatted text in the theme's data font, for generated output, commands\n * and code samples. The block is focusable so a keyboard user can scroll it,\n * and it is a labelled group so a screen reader names it. With `allowsCopy` a\n * button copies the text and a polite status confirms it. With `isDiff` added and removed lines get a tint.\n */\nexport function CodeBlock({\n children,\n 'aria-label': ariaLabel,\n allowsCopy = false,\n copyLabel = 'Copy code',\n copiedLabel = 'Copied',\n wrap = false,\n isDiff = false,\n className,\n}: CodeBlockProps) {\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!copied) return;\n const timer = window.setTimeout(() => setCopied(false), copiedForMs);\n return () => window.clearTimeout(timer);\n }, [copied]);\n\n async function handleCopy() {\n try {\n await navigator.clipboard.writeText(children);\n setCopied(true);\n } catch {\n setCopied(false);\n }\n }\n\n return (\n <div className={cx(frame, className)}>\n <pre\n role='group'\n aria-label={ariaLabel}\n // A scrollable region must be reachable by keyboard, hence the tab stop on the group.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n className={cx(pre, allowsCopy && 'pr-14', wrap && 'break-words whitespace-pre-wrap')}\n >\n <code>\n {isDiff\n ? children.split('\\n').map((line, index) => (\n <span key={index} className={cx('-mx-4 block px-4', lineTints[line.charAt(0)])}>\n {line || ' '}\n </span>\n ))\n : children}\n </code>\n </pre>\n {allowsCopy && (\n <>\n <IconButton\n icon={copied ? <Check /> : <Copy />}\n aria-label={copyLabel}\n variant='tertiary'\n size='sm'\n className='absolute top-2 right-2'\n onPress={handleCopy}\n />\n <span role='status' className='sr-only'>\n {copied ? copiedLabel : ''}\n </span>\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAwBA,IAAM,YAAoC;CACxC,KAAK;CACL,KAAK;AACP;AAEA,IAAM,cAAc;AAEpB,IAAM,QAAQ;AACd,IAAM,MAAM,+DAA+D;;;;;;;AAQ3E,SAAgB,UAAU,EACxB,UACA,cAAc,WACd,aAAa,OACb,YAAY,aACZ,cAAc,UACd,OAAO,OACP,SAAS,OACT,aACiB;CACjB,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,gBAAgB;EACd,IAAI,CAAC,QAAQ;EACb,MAAM,QAAQ,OAAO,iBAAiB,UAAU,KAAK,GAAG,WAAW;EACnE,aAAa,OAAO,aAAa,KAAK;CACxC,GAAG,CAAC,MAAM,CAAC;CAEX,eAAe,aAAa;EAC1B,IAAI;GACF,MAAM,UAAU,UAAU,UAAU,QAAQ;GAC5C,UAAU,IAAI;EAChB,QAAQ;GACN,UAAU,KAAK;EACjB;CACF;CAEA,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,OAAO,SAAS;EAAnC,UAAA,CACE,oBAAC,OAAD;GACE,MAAK;GACL,cAAY;GAGZ,UAAU;GACV,WAAW,GAAG,KAAK,cAAc,SAAS,QAAQ,iCAAiC;GAEnF,UAAA,oBAAC,QAAD,EAAA,UACG,SACG,SAAS,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,UAC9B,oBAAC,QAAD;IAAkB,WAAW,GAAG,oBAAoB,UAAU,KAAK,OAAO,CAAC,EAAE;IAC1E,UAAA,QAAQ;GACL,GAFK,KAEL,CACP,IACD,SACA,CAAA;EACH,CAAA,GACJ,cACC,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,YAAD;GACE,MAAM,SAAS,oBAAC,OAAD,CAAQ,CAAA,IAAI,oBAAC,MAAD,CAAO,CAAA;GAClC,cAAY;GACZ,SAAQ;GACR,MAAK;GACL,WAAU;GACV,SAAS;EACV,CAAA,GACD,oBAAC,QAAD;GAAM,MAAK;GAAS,WAAU;GAC3B,UAAA,SAAS,cAAc;EACpB,CAAA,CACN,EAAA,CAAA,CAED;;AAET"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { type ComboBoxProps, type ListBoxItemProps, type ListBoxSectionProps } from 'react-aria-components';
|
|
3
|
+
import { type ControlSize } from '../../../internal/control';
|
|
3
4
|
export interface ComboboxProps<T extends object> extends Omit<ComboBoxProps<T>, 'children'> {
|
|
4
5
|
label?: ReactNode;
|
|
5
6
|
hint?: ReactNode;
|
|
6
7
|
errorMessage?: string;
|
|
7
8
|
placeholder?: string;
|
|
9
|
+
/** The same scale as Button and Input. */
|
|
10
|
+
size?: ControlSize;
|
|
8
11
|
/** Shows a spinner in the field while results load, for example from useAsyncList. */
|
|
9
12
|
isLoading?: boolean;
|
|
10
13
|
/** Announced while loading. */
|
|
@@ -19,7 +22,7 @@ export interface ComboboxProps<T extends object> extends Omit<ComboBoxProps<T>,
|
|
|
19
22
|
* `inputValue` and `onInputChange` from useAsyncList and set `isLoading`
|
|
20
23
|
* while a request is in flight.
|
|
21
24
|
*/
|
|
22
|
-
export declare function Combobox<T extends object>({ label, hint, errorMessage, placeholder, isLoading, loadingLabel, emptyState, children, className, isInvalid, ...props }: ComboboxProps<T>): import("react").JSX.Element;
|
|
25
|
+
export declare function Combobox<T extends object>({ label, hint, errorMessage, placeholder, size, isLoading, loadingLabel, emptyState, children, className, isInvalid, ...props }: ComboboxProps<T>): import("react").JSX.Element;
|
|
23
26
|
export interface ComboboxItemProps extends Omit<ListBoxItemProps, 'children'> {
|
|
24
27
|
children: ReactNode;
|
|
25
28
|
/** Secondary line under the label. */
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { fieldInput, fieldStyles, focusInputOnPress } from "../../../internal/control.js";
|
|
3
|
+
import { FieldParts, fieldColumn } from "../../../internal/Field.js";
|
|
4
|
+
import { ListItemText, ListSectionHeader, textValueOf } from "../../../internal/listParts.js";
|
|
5
|
+
import { fieldPopover, listItem } from "../../../internal/surfaces.js";
|
|
6
|
+
import { cx } from "../../../utils/cx.js";
|
|
7
|
+
import { IconButton } from "../../atoms/IconButton/IconButton.js";
|
|
8
|
+
import { Spinner } from "../../atoms/Spinner/Spinner.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { ComboBox, Group, Input, ListBox, ListBoxItem, ListBoxSection, Popover, composeRenderProps } from "react-aria-components";
|
|
11
|
+
import { ChevronDown } from "lucide-react";
|
|
12
|
+
// src/components/molecules/Combobox/Combobox.tsx
|
|
13
|
+
var emptyText = "px-item-x py-item-y text-sm text-tertiary";
|
|
14
|
+
/**
|
|
15
|
+
* A text field with a filtered list of suggestions. Works with static items,
|
|
16
|
+
* with `items` and a render function, and with async data: pass `items`,
|
|
17
|
+
* `inputValue` and `onInputChange` from useAsyncList and set `isLoading`
|
|
18
|
+
* while a request is in flight.
|
|
19
|
+
*/
|
|
20
|
+
function Combobox({ label, hint, errorMessage, placeholder, size = "md", isLoading = false, loadingLabel = "Loading results", emptyState = "No results", children, className, isInvalid, ...props }) {
|
|
21
|
+
function renderEmptyState() {
|
|
22
|
+
if (isLoading) return /* @__PURE__ */ jsx("div", {
|
|
23
|
+
className: emptyText,
|
|
24
|
+
children: loadingLabel
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: emptyText,
|
|
28
|
+
children: emptyState
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsxs(ComboBox, {
|
|
32
|
+
...props,
|
|
33
|
+
allowsEmptyCollection: true,
|
|
34
|
+
isInvalid: isInvalid ?? Boolean(errorMessage),
|
|
35
|
+
className: composeRenderProps(className, (consumer) => cx(fieldColumn, consumer)),
|
|
36
|
+
children: [/* @__PURE__ */ jsx(FieldParts, {
|
|
37
|
+
label,
|
|
38
|
+
hint,
|
|
39
|
+
errorMessage,
|
|
40
|
+
isInvalid,
|
|
41
|
+
children: /* @__PURE__ */ jsxs(Group, {
|
|
42
|
+
onMouseDown: focusInputOnPress,
|
|
43
|
+
className: fieldStyles(size, "pe-1"),
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(Input, {
|
|
46
|
+
placeholder,
|
|
47
|
+
className: fieldInput
|
|
48
|
+
}),
|
|
49
|
+
isLoading && /* @__PURE__ */ jsx(Spinner, {
|
|
50
|
+
size: "sm",
|
|
51
|
+
label: loadingLabel
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
54
|
+
icon: /* @__PURE__ */ jsx(ChevronDown, {}),
|
|
55
|
+
variant: "tertiary",
|
|
56
|
+
size: size === "sm" ? "xs" : "sm"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
}), /* @__PURE__ */ jsx(Popover, {
|
|
61
|
+
offset: 4,
|
|
62
|
+
className: fieldPopover,
|
|
63
|
+
children: /* @__PURE__ */ jsx(ListBox, {
|
|
64
|
+
renderEmptyState,
|
|
65
|
+
className: "max-h-72 outline-none",
|
|
66
|
+
children
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function ComboboxItem({ children, description, className, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx(ListBoxItem, {
|
|
73
|
+
...props,
|
|
74
|
+
textValue: textValueOf(props.textValue, children),
|
|
75
|
+
className: composeRenderProps(className, (consumer) => cx(listItem, "data-selected:font-medium", consumer)),
|
|
76
|
+
children: /* @__PURE__ */ jsx(ListItemText, {
|
|
77
|
+
description,
|
|
78
|
+
children
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function ComboboxSection({ title, children, className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsxs(ListBoxSection, {
|
|
84
|
+
...props,
|
|
85
|
+
className: cx("flex flex-col", className),
|
|
86
|
+
children: [title && /* @__PURE__ */ jsx(ListSectionHeader, { children: title }), children]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export { Combobox, ComboboxItem, ComboboxSection };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=Combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Combobox.js","names":[],"sources":["../../../../src/components/molecules/Combobox/Combobox.tsx"],"sourcesContent":["import { ChevronDown } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport {\n ComboBox,\n Group,\n Input,\n ListBox,\n ListBoxItem,\n ListBoxSection,\n Popover,\n composeRenderProps,\n type ComboBoxProps,\n type ListBoxItemProps,\n type ListBoxSectionProps,\n} from 'react-aria-components';\nimport {\n fieldInput,\n fieldStyles,\n focusInputOnPress,\n type ControlSize,\n} from '../../../internal/control';\nimport { FieldParts, fieldColumn } from '../../../internal/Field';\nimport { ListItemText, ListSectionHeader, textValueOf } from '../../../internal/listParts';\nimport { fieldPopover, listItem } from '../../../internal/surfaces';\nimport { cx } from '../../../utils/cx';\nimport { IconButton } from '../../atoms/IconButton/IconButton';\nimport { Spinner } from '../../atoms/Spinner/Spinner';\n\nexport interface ComboboxProps<T extends object> extends Omit<ComboBoxProps<T>, 'children'> {\n label?: ReactNode;\n hint?: ReactNode;\n errorMessage?: string;\n placeholder?: string;\n /** The same scale as Button and Input. */\n size?: ControlSize;\n /** Shows a spinner in the field while results load, for example from useAsyncList. */\n isLoading?: boolean;\n /** Announced while loading. */\n loadingLabel?: string;\n /** Shown in the popover when nothing matches. Defaults to \"No results\". */\n emptyState?: ReactNode;\n children: ReactNode | ((item: T) => ReactNode);\n}\n\nconst emptyText = 'px-item-x py-item-y text-sm text-tertiary';\n\n/**\n * A text field with a filtered list of suggestions. Works with static items,\n * with `items` and a render function, and with async data: pass `items`,\n * `inputValue` and `onInputChange` from useAsyncList and set `isLoading`\n * while a request is in flight.\n */\nexport function Combobox<T extends object>({\n label,\n hint,\n errorMessage,\n placeholder,\n size = 'md',\n isLoading = false,\n loadingLabel = 'Loading results',\n emptyState = 'No results',\n children,\n className,\n isInvalid,\n ...props\n}: ComboboxProps<T>) {\n function renderEmptyState() {\n if (isLoading) return <div className={emptyText}>{loadingLabel}</div>;\n return <div className={emptyText}>{emptyState}</div>;\n }\n\n return (\n <ComboBox\n {...props}\n allowsEmptyCollection\n isInvalid={isInvalid ?? Boolean(errorMessage)}\n className={composeRenderProps(className, (consumer) => cx(fieldColumn, consumer))}\n >\n <FieldParts label={label} hint={hint} errorMessage={errorMessage} isInvalid={isInvalid}>\n <Group onMouseDown={focusInputOnPress} className={fieldStyles(size, 'pe-1')}>\n <Input placeholder={placeholder} className={fieldInput} />\n {isLoading && <Spinner size='sm' label={loadingLabel} />}\n <IconButton\n icon={<ChevronDown />}\n variant='tertiary'\n size={size === 'sm' ? 'xs' : 'sm'}\n />\n </Group>\n </FieldParts>\n <Popover offset={4} className={fieldPopover}>\n <ListBox renderEmptyState={renderEmptyState} className='max-h-72 outline-none'>\n {children}\n </ListBox>\n </Popover>\n </ComboBox>\n );\n}\n\nexport interface ComboboxItemProps extends Omit<ListBoxItemProps, 'children'> {\n children: ReactNode;\n /** Secondary line under the label. */\n description?: ReactNode;\n}\n\nexport function ComboboxItem({ children, description, className, ...props }: ComboboxItemProps) {\n return (\n <ListBoxItem\n {...props}\n textValue={textValueOf(props.textValue, children)}\n className={composeRenderProps(className, (consumer) =>\n cx(listItem, 'data-selected:font-medium', consumer),\n )}\n >\n <ListItemText description={description}>{children}</ListItemText>\n </ListBoxItem>\n );\n}\n\nexport interface ComboboxSectionProps<T extends object> extends Omit<\n ListBoxSectionProps<T>,\n 'children'\n> {\n /** Visible group heading, also the group's accessible name. */\n title?: ReactNode;\n children: ReactNode;\n}\n\nexport function ComboboxSection<T extends object>({\n title,\n children,\n className,\n ...props\n}: ComboboxSectionProps<T>) {\n return (\n <ListBoxSection {...props} className={cx('flex flex-col', className)}>\n {title && <ListSectionHeader>{title}</ListSectionHeader>}\n {children}\n </ListBoxSection>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA4CA,IAAM,YAAY;;;;;;;AAQlB,SAAgB,SAA2B,EACzC,OACA,MACA,cACA,aACA,OAAO,MACP,YAAY,OACZ,eAAe,mBACf,aAAa,cACb,UACA,WACA,WACA,GAAG,SACgB;CACnB,SAAS,mBAAmB;EAC1B,IAAI,WAAW,OAAO,oBAAC,OAAD;GAAK,WAAW;GAAY,UAAA;EAAkB,CAAA;EACpE,OAAO,oBAAC,OAAD;GAAK,WAAW;GAAY,UAAA;EAAgB,CAAA;CACrD;CAEA,OACE,qBAAC,UAAD;EACE,GAAI;EACJ,uBAAA;EACA,WAAW,aAAa,QAAQ,YAAY;EAC5C,WAAW,mBAAmB,YAAY,aAAa,GAAG,aAAa,QAAQ,CAAC;EAJlF,UAAA,CAME,oBAAC,YAAD;GAAmB;GAAa;GAAoB;GAAyB;GAC3E,UAAA,qBAAC,OAAD;IAAO,aAAa;IAAmB,WAAW,YAAY,MAAM,MAAM;IAA1E,UAAA;KACE,oBAAC,OAAD;MAAoB;MAAa,WAAW;KAAa,CAAA;KACxD,aAAa,oBAAC,SAAD;MAAS,MAAK;MAAK,OAAO;KAAe,CAAA;KACvD,oBAAC,YAAD;MACE,MAAM,oBAAC,aAAD,CAAc,CAAA;MACpB,SAAQ;MACR,MAAM,SAAS,OAAO,OAAO;KAC9B,CAAA;IACI;;EACG,CAAA,GACZ,oBAAC,SAAD;GAAS,QAAQ;GAAG,WAAW;GAC7B,UAAA,oBAAC,SAAD;IAA2B;IAAkB,WAAU;IACpD;GACM,CAAA;EACF,CAAA,CACD;;AAEd;AAQA,SAAgB,aAAa,EAAE,UAAU,aAAa,WAAW,GAAG,SAA4B;CAC9F,OACE,oBAAC,aAAD;EACE,GAAI;EACJ,WAAW,YAAY,MAAM,WAAW,QAAQ;EAChD,WAAW,mBAAmB,YAAY,aACxC,GAAG,UAAU,6BAA6B,QAAQ,CACpD;EAEA,UAAA,oBAAC,cAAD;GAA2B;GAAc;EAAuB,CAAA;CACrD,CAAA;AAEjB;AAWA,SAAgB,gBAAkC,EAChD,OACA,UACA,WACA,GAAG,SACuB;CAC1B,OACE,qBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAW,GAAG,iBAAiB,SAAS;EAAnE,UAAA,CACG,SAAS,oBAAC,mBAAD,EAAA,UAAoB,MAAyB,CAAA,GACtD,QACa;;AAEpB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { type DatePickerProps as AriaDatePickerProps, type DateRangePickerProps as AriaDateRangePickerProps, type DateValue } from 'react-aria-components';
|
|
3
|
+
import { type ControlSize } from '../../../internal/control';
|
|
3
4
|
interface FieldProps {
|
|
4
5
|
/** Visible label. If omitted, pass `aria-label`. */
|
|
5
6
|
label?: ReactNode;
|
|
@@ -7,19 +8,21 @@ interface FieldProps {
|
|
|
7
8
|
hint?: ReactNode;
|
|
8
9
|
/** Error text. Setting it also marks the field invalid. */
|
|
9
10
|
errorMessage?: string;
|
|
10
|
-
/**
|
|
11
|
-
|
|
11
|
+
/** The same scale as Button and Input. */
|
|
12
|
+
size?: ControlSize;
|
|
12
13
|
}
|
|
13
14
|
export interface DatePickerProps<T extends DateValue> extends AriaDatePickerProps<T>, FieldProps {
|
|
14
15
|
}
|
|
15
16
|
export interface DateRangePickerProps<T extends DateValue> extends AriaDateRangePickerProps<T>, FieldProps {
|
|
17
|
+
/** Text between the start and the end date. */
|
|
18
|
+
separatorLabel?: string;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
* A date field with typed segments and a calendar popover. Arrow keys change
|
|
19
22
|
* a segment, typing fills it, and the calendar button opens a month grid where
|
|
20
23
|
* arrow keys move between days and Enter picks one.
|
|
21
24
|
*/
|
|
22
|
-
export declare function DatePicker<T extends DateValue>({ label, hint, errorMessage,
|
|
25
|
+
export declare function DatePicker<T extends DateValue>({ label, hint, errorMessage, size, isInvalid, className, ...props }: DatePickerProps<T>): import("react").JSX.Element;
|
|
23
26
|
/** Like DatePicker, with a start and an end date and a range calendar. */
|
|
24
|
-
export declare function DateRangePicker<T extends DateValue>({ label, hint, errorMessage,
|
|
27
|
+
export declare function DateRangePicker<T extends DateValue>({ label, hint, errorMessage, size, isInvalid, separatorLabel, className, ...props }: DateRangePickerProps<T>): import("react").JSX.Element;
|
|
25
28
|
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { fieldStyles } from "../../../internal/control.js";
|
|
3
|
+
import { FieldParts, fieldColumn } from "../../../internal/Field.js";
|
|
4
|
+
import { focusRing } from "../../../internal/focusRing.js";
|
|
5
|
+
import { popoverSurface } from "../../../internal/surfaces.js";
|
|
6
|
+
import { cx } from "../../../utils/cx.js";
|
|
7
|
+
import { IconButton } from "../../atoms/IconButton/IconButton.js";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Calendar, CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, DateInput, DatePicker, DateRangePicker, DateSegment, Dialog, Group, Heading, Popover, RangeCalendar, composeRenderProps } from "react-aria-components";
|
|
10
|
+
import { CalendarDays, ChevronLeft, ChevronRight } from "lucide-react";
|
|
11
|
+
// src/components/molecules/DatePicker/DatePicker.tsx
|
|
12
|
+
var input = "flex min-w-0 items-center";
|
|
13
|
+
var segment = "rounded-xs px-0.5 tabular-nums caret-transparent outline-none data-placeholder:text-placeholder data-focused:bg-brand-solid data-focused:text-on-solid data-[type=literal]:px-0 data-[type=literal]:text-tertiary";
|
|
14
|
+
var popover = cx(popoverSurface, "overflow-auto p-3");
|
|
15
|
+
var weekday = "pb-1 text-xs font-medium text-tertiary";
|
|
16
|
+
var calendarHeader = "mb-2 flex items-center justify-between gap-2";
|
|
17
|
+
var cell = ["flex size-control-md cursor-pointer items-center justify-center rounded-sm text-sm text-primary data-hovered:bg-field data-outside-month:hidden data-disabled:cursor-not-allowed data-disabled:text-disabled data-unavailable:text-disabled data-unavailable:line-through data-selected:bg-brand-solid data-selected:text-on-solid", focusRing].join(" ");
|
|
18
|
+
var rangeCell = ["flex size-control-md cursor-pointer items-center justify-center text-sm text-primary data-hovered:bg-field data-outside-month:hidden data-disabled:cursor-not-allowed data-disabled:text-disabled data-selected:bg-brand-subtle data-selected:text-brand data-selection-start:rounded-s-sm data-selection-start:bg-brand-solid data-selection-start:text-on-solid data-selection-end:rounded-e-sm data-selection-end:bg-brand-solid data-selection-end:text-on-solid", focusRing].join(" ");
|
|
19
|
+
function Segment(props) {
|
|
20
|
+
return /* @__PURE__ */ jsx(DateSegment, {
|
|
21
|
+
...props,
|
|
22
|
+
className: segment
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function CalendarTrigger({ size }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
27
|
+
icon: /* @__PURE__ */ jsx(CalendarDays, {}),
|
|
28
|
+
variant: "tertiary",
|
|
29
|
+
size: size === "sm" ? "xs" : "sm",
|
|
30
|
+
className: "ms-auto"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function CalendarMonth({ cell }) {
|
|
34
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("header", {
|
|
35
|
+
className: calendarHeader,
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
38
|
+
slot: "previous",
|
|
39
|
+
icon: /* @__PURE__ */ jsx(ChevronLeft, {}),
|
|
40
|
+
variant: "tertiary",
|
|
41
|
+
size: "sm"
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsx(Heading, { className: "text-sm font-semibold text-primary" }),
|
|
44
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
45
|
+
slot: "next",
|
|
46
|
+
icon: /* @__PURE__ */ jsx(ChevronRight, {}),
|
|
47
|
+
variant: "tertiary",
|
|
48
|
+
size: "sm"
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
}), /* @__PURE__ */ jsxs(CalendarGrid, { children: [/* @__PURE__ */ jsx(CalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx(CalendarHeaderCell, {
|
|
52
|
+
className: weekday,
|
|
53
|
+
children: day
|
|
54
|
+
}) }), /* @__PURE__ */ jsx(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx(CalendarCell, {
|
|
55
|
+
date,
|
|
56
|
+
className: cell
|
|
57
|
+
}) })] })] });
|
|
58
|
+
}
|
|
59
|
+
/** The label, the field box with its calendar button, and the calendar popover that DatePicker and DateRangePicker share. */
|
|
60
|
+
function PickerShell({ label, hint, errorMessage, isInvalid, size = "md", inputs, calendar }) {
|
|
61
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FieldParts, {
|
|
62
|
+
label,
|
|
63
|
+
hint,
|
|
64
|
+
errorMessage,
|
|
65
|
+
isInvalid,
|
|
66
|
+
children: /* @__PURE__ */ jsxs(Group, {
|
|
67
|
+
className: fieldStyles(size, "pe-1"),
|
|
68
|
+
children: [inputs, /* @__PURE__ */ jsx(CalendarTrigger, { size })]
|
|
69
|
+
})
|
|
70
|
+
}), /* @__PURE__ */ jsx(Popover, {
|
|
71
|
+
placement: "bottom start",
|
|
72
|
+
className: popover,
|
|
73
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
74
|
+
className: "outline-none",
|
|
75
|
+
children: calendar
|
|
76
|
+
})
|
|
77
|
+
})] });
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A date field with typed segments and a calendar popover. Arrow keys change
|
|
81
|
+
* a segment, typing fills it, and the calendar button opens a month grid where
|
|
82
|
+
* arrow keys move between days and Enter picks one.
|
|
83
|
+
*/
|
|
84
|
+
function DatePicker$1({ label, hint, errorMessage, size, isInvalid, className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsx(DatePicker, {
|
|
86
|
+
...props,
|
|
87
|
+
isInvalid: isInvalid ?? Boolean(errorMessage),
|
|
88
|
+
className: composeRenderProps(className, (consumer) => cx(fieldColumn, consumer)),
|
|
89
|
+
children: /* @__PURE__ */ jsx(PickerShell, {
|
|
90
|
+
label,
|
|
91
|
+
hint,
|
|
92
|
+
errorMessage,
|
|
93
|
+
isInvalid,
|
|
94
|
+
size,
|
|
95
|
+
inputs: /* @__PURE__ */ jsx(DateInput, {
|
|
96
|
+
className: input,
|
|
97
|
+
children: (dateSegment) => /* @__PURE__ */ jsx(Segment, { segment: dateSegment })
|
|
98
|
+
}),
|
|
99
|
+
calendar: /* @__PURE__ */ jsx(Calendar, { children: /* @__PURE__ */ jsx(CalendarMonth, { cell }) })
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** Like DatePicker, with a start and an end date and a range calendar. */
|
|
104
|
+
function DateRangePicker$1({ label, hint, errorMessage, size, isInvalid, separatorLabel = "to", className, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsx(DateRangePicker, {
|
|
106
|
+
...props,
|
|
107
|
+
isInvalid: isInvalid ?? Boolean(errorMessage),
|
|
108
|
+
className: composeRenderProps(className, (consumer) => cx(fieldColumn, consumer)),
|
|
109
|
+
children: /* @__PURE__ */ jsx(PickerShell, {
|
|
110
|
+
label,
|
|
111
|
+
hint,
|
|
112
|
+
errorMessage,
|
|
113
|
+
isInvalid,
|
|
114
|
+
size,
|
|
115
|
+
inputs: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx(DateInput, {
|
|
117
|
+
slot: "start",
|
|
118
|
+
className: input,
|
|
119
|
+
children: (dateSegment) => /* @__PURE__ */ jsx(Segment, { segment: dateSegment })
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ jsx("span", {
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
className: "text-tertiary",
|
|
124
|
+
children: separatorLabel
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ jsx(DateInput, {
|
|
127
|
+
slot: "end",
|
|
128
|
+
className: input,
|
|
129
|
+
children: (dateSegment) => /* @__PURE__ */ jsx(Segment, { segment: dateSegment })
|
|
130
|
+
})
|
|
131
|
+
] }),
|
|
132
|
+
calendar: /* @__PURE__ */ jsx(RangeCalendar, { children: /* @__PURE__ */ jsx(CalendarMonth, { cell: rangeCell }) })
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export { DatePicker$1 as DatePicker, DateRangePicker$1 as DateRangePicker };
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","names":["_Fragment","DatePicker","AriaDatePicker","DateRangePicker","AriaDateRangePicker"],"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"sourcesContent":["import { CalendarDays, ChevronLeft, ChevronRight } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport {\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n DateInput,\n DatePicker as AriaDatePicker,\n DateRangePicker as AriaDateRangePicker,\n DateSegment,\n Dialog,\n Group,\n Heading,\n Popover,\n RangeCalendar,\n composeRenderProps,\n type DatePickerProps as AriaDatePickerProps,\n type DateRangePickerProps as AriaDateRangePickerProps,\n type DateSegmentProps,\n type DateValue,\n} from 'react-aria-components';\nimport { fieldStyles, type ControlSize } from '../../../internal/control';\nimport { FieldParts, fieldColumn } from '../../../internal/Field';\nimport { focusRing } from '../../../internal/focusRing';\nimport { popoverSurface } from '../../../internal/surfaces';\nimport { cx } from '../../../utils/cx';\nimport { IconButton } from '../../atoms/IconButton/IconButton';\n\ninterface FieldProps {\n /** Visible label. If omitted, pass `aria-label`. */\n label?: ReactNode;\n /** Helper text below the field, linked with aria-describedby. */\n hint?: ReactNode;\n /** Error text. Setting it also marks the field invalid. */\n errorMessage?: string;\n /** The same scale as Button and Input. */\n size?: ControlSize;\n}\n\nexport interface DatePickerProps<T extends DateValue> extends AriaDatePickerProps<T>, FieldProps {}\n\nexport interface DateRangePickerProps<T extends DateValue>\n extends AriaDateRangePickerProps<T>, FieldProps {\n /** Text between the start and the end date. */\n separatorLabel?: string;\n}\n\nconst input = 'flex min-w-0 items-center';\nconst segment =\n 'rounded-xs px-0.5 tabular-nums caret-transparent outline-none data-placeholder:text-placeholder data-focused:bg-brand-solid data-focused:text-on-solid data-[type=literal]:px-0 data-[type=literal]:text-tertiary';\nconst popover = cx(popoverSurface, 'overflow-auto p-3');\nconst weekday = 'pb-1 text-xs font-medium text-tertiary';\nconst calendarHeader = 'mb-2 flex items-center justify-between gap-2';\nconst cell = [\n 'flex size-control-md cursor-pointer items-center justify-center rounded-sm text-sm text-primary data-hovered:bg-field data-outside-month:hidden data-disabled:cursor-not-allowed data-disabled:text-disabled data-unavailable:text-disabled data-unavailable:line-through data-selected:bg-brand-solid data-selected:text-on-solid',\n focusRing,\n].join(' ');\nconst rangeCell = [\n 'flex size-control-md cursor-pointer items-center justify-center text-sm text-primary data-hovered:bg-field data-outside-month:hidden data-disabled:cursor-not-allowed data-disabled:text-disabled data-selected:bg-brand-subtle data-selected:text-brand data-selection-start:rounded-s-sm data-selection-start:bg-brand-solid data-selection-start:text-on-solid data-selection-end:rounded-e-sm data-selection-end:bg-brand-solid data-selection-end:text-on-solid',\n focusRing,\n].join(' ');\n\nfunction Segment(props: DateSegmentProps) {\n return <DateSegment {...props} className={segment} />;\n}\n\nfunction CalendarTrigger({ size }: { size: ControlSize }) {\n return (\n <IconButton\n icon={<CalendarDays />}\n variant='tertiary'\n size={size === 'sm' ? 'xs' : 'sm'}\n className='ms-auto'\n />\n );\n}\n\nfunction CalendarMonth({ cell }: { cell: string }) {\n return (\n <>\n <header className={calendarHeader}>\n <IconButton slot='previous' icon={<ChevronLeft />} variant='tertiary' size='sm' />\n <Heading className='text-sm font-semibold text-primary' />\n <IconButton slot='next' icon={<ChevronRight />} variant='tertiary' size='sm' />\n </header>\n <CalendarGrid>\n <CalendarGridHeader>\n {(day) => <CalendarHeaderCell className={weekday}>{day}</CalendarHeaderCell>}\n </CalendarGridHeader>\n <CalendarGridBody>\n {(date) => <CalendarCell date={date} className={cell} />}\n </CalendarGridBody>\n </CalendarGrid>\n </>\n );\n}\n\ninterface PickerShellProps extends FieldProps {\n isInvalid?: boolean;\n /** The date inputs inside the field. */\n inputs: ReactNode;\n /** A Calendar or RangeCalendar. */\n calendar: ReactNode;\n}\n\n/** The label, the field box with its calendar button, and the calendar popover that DatePicker and DateRangePicker share. */\nfunction PickerShell({\n label,\n hint,\n errorMessage,\n isInvalid,\n size = 'md',\n inputs,\n calendar,\n}: PickerShellProps) {\n return (\n <>\n <FieldParts label={label} hint={hint} errorMessage={errorMessage} isInvalid={isInvalid}>\n <Group className={fieldStyles(size, 'pe-1')}>\n {inputs}\n <CalendarTrigger size={size} />\n </Group>\n </FieldParts>\n <Popover placement='bottom start' className={popover}>\n <Dialog className='outline-none'>{calendar}</Dialog>\n </Popover>\n </>\n );\n}\n\n/**\n * A date field with typed segments and a calendar popover. Arrow keys change\n * a segment, typing fills it, and the calendar button opens a month grid where\n * arrow keys move between days and Enter picks one.\n */\nexport function DatePicker<T extends DateValue>({\n label,\n hint,\n errorMessage,\n size,\n isInvalid,\n className,\n ...props\n}: DatePickerProps<T>) {\n return (\n <AriaDatePicker\n {...props}\n isInvalid={isInvalid ?? Boolean(errorMessage)}\n className={composeRenderProps(className, (consumer) => cx(fieldColumn, consumer))}\n >\n <PickerShell\n label={label}\n hint={hint}\n errorMessage={errorMessage}\n isInvalid={isInvalid}\n size={size}\n inputs={\n <DateInput className={input}>\n {(dateSegment) => <Segment segment={dateSegment} />}\n </DateInput>\n }\n calendar={\n <Calendar>\n <CalendarMonth cell={cell} />\n </Calendar>\n }\n />\n </AriaDatePicker>\n );\n}\n\n/** Like DatePicker, with a start and an end date and a range calendar. */\nexport function DateRangePicker<T extends DateValue>({\n label,\n hint,\n errorMessage,\n size,\n isInvalid,\n separatorLabel = 'to',\n className,\n ...props\n}: DateRangePickerProps<T>) {\n return (\n <AriaDateRangePicker\n {...props}\n isInvalid={isInvalid ?? Boolean(errorMessage)}\n className={composeRenderProps(className, (consumer) => cx(fieldColumn, consumer))}\n >\n <PickerShell\n label={label}\n hint={hint}\n errorMessage={errorMessage}\n isInvalid={isInvalid}\n size={size}\n inputs={\n <>\n <DateInput slot='start' className={input}>\n {(dateSegment) => <Segment segment={dateSegment} />}\n </DateInput>\n <span aria-hidden='true' className='text-tertiary'>\n {separatorLabel}\n </span>\n <DateInput slot='end' className={input}>\n {(dateSegment) => <Segment segment={dateSegment} />}\n </DateInput>\n </>\n }\n calendar={\n <RangeCalendar>\n <CalendarMonth cell={rangeCell} />\n </RangeCalendar>\n }\n />\n </AriaDateRangePicker>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkDA,IAAM,QAAQ;AACd,IAAM,UACJ;AACF,IAAM,UAAU,GAAG,gBAAgB,mBAAmB;AACtD,IAAM,UAAU;AAChB,IAAM,iBAAiB;AACvB,IAAM,OAAO,CACX,sUACA,SACF,CAAC,CAAC,KAAK,GAAG;AACV,IAAM,YAAY,CAChB,wcACA,SACF,CAAC,CAAC,KAAK,GAAG;AAEV,SAAS,QAAQ,OAAyB;CACxC,OAAO,oBAAC,aAAD;EAAa,GAAI;EAAO,WAAW;CAAU,CAAA;AACtD;AAEA,SAAS,gBAAgB,EAAE,QAA+B;CACxD,OACE,oBAAC,YAAD;EACE,MAAM,oBAAC,cAAD,CAAe,CAAA;EACrB,SAAQ;EACR,MAAM,SAAS,OAAO,OAAO;EAC7B,WAAU;CACX,CAAA;AAEL;AAEA,SAAS,cAAc,EAAE,QAA0B;CACjD,OACE,qBAAAA,UAAA,EAAA,UAAA,CACE,qBAAC,UAAD;EAAQ,WAAW;EAAnB,UAAA;GACE,oBAAC,YAAD;IAAY,MAAK;IAAW,MAAM,oBAAC,aAAD,CAAc,CAAA;IAAG,SAAQ;IAAW,MAAK;GAAM,CAAA;GACjF,oBAAC,SAAD,EAAS,WAAU,qCAAsC,CAAA;GACzD,oBAAC,YAAD;IAAY,MAAK;IAAO,MAAM,oBAAC,cAAD,CAAe,CAAA;IAAG,SAAQ;IAAW,MAAK;GAAM,CAAA;EACxE;CACR,CAAA,GAAA,qBAAC,cAAD,EAAA,UAAA,CACE,oBAAC,oBAAD,EAAA,WACI,QAAQ,oBAAC,oBAAD;EAAoB,WAAW;EAAU,UAAA;CAAwB,CAAA,EACzD,CAAA,GACpB,oBAAC,kBAAD,EAAA,WACI,SAAS,oBAAC,cAAD;EAAoB;EAAM,WAAW;CAAO,CAAA,EACvC,CAAA,CACN,EAAA,CAAA,CACd,EAAA,CAAA;AAEN;;AAWA,SAAS,YAAY,EACnB,OACA,MACA,cACA,WACA,OAAO,MACP,QACA,YACmB;CACnB,OACE,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,YAAD;EAAmB;EAAa;EAAoB;EAAyB;EAC3E,UAAA,qBAAC,OAAD;GAAO,WAAW,YAAY,MAAM,MAAM;GAA1C,UAAA,CACG,QACD,oBAAC,iBAAD,EAAuB,KAAO,CAAA,CACzB;;CACG,CAAA,GACZ,oBAAC,SAAD;EAAS,WAAU;EAAe,WAAW;EAC3C,UAAA,oBAAC,QAAD;GAAQ,WAAU;GAAgB,UAAA;EAAiB,CAAA;CAC5C,CAAA,CACT,EAAA,CAAA;AAEN;;;;;;AAOA,SAAgBC,aAAgC,EAC9C,OACA,MACA,cACA,MACA,WACA,WACA,GAAG,SACkB;CACrB,OACE,oBAACC,YAAD;EACE,GAAI;EACJ,WAAW,aAAa,QAAQ,YAAY;EAC5C,WAAW,mBAAmB,YAAY,aAAa,GAAG,aAAa,QAAQ,CAAC;EAEhF,UAAA,oBAAC,aAAD;GACS;GACD;GACQ;GACH;GACL;GACN,QACE,oBAAC,WAAD;IAAW,WAAW;IAClB,WAAA,gBAAgB,oBAAC,SAAD,EAAS,SAAS,YAAc,CAAA;GACzC,CAAA;GAEb,UACE,oBAAC,UAAD,EAAA,UACE,oBAAC,eAAD,EAAqB,KAAO,CAAA,EACpB,CAAA;EAEb,CAAA;CACa,CAAA;AAEpB;;AAGA,SAAgBC,kBAAqC,EACnD,OACA,MACA,cACA,MACA,WACA,iBAAiB,MACjB,WACA,GAAG,SACuB;CAC1B,OACE,oBAACC,iBAAD;EACE,GAAI;EACJ,WAAW,aAAa,QAAQ,YAAY;EAC5C,WAAW,mBAAmB,YAAY,aAAa,GAAG,aAAa,QAAQ,CAAC;EAEhF,UAAA,oBAAC,aAAD;GACS;GACD;GACQ;GACH;GACL;GACN,QACE,qBAAAJ,UAAA,EAAA,UAAA;IACE,oBAAC,WAAD;KAAW,MAAK;KAAQ,WAAW;KAC/B,WAAA,gBAAgB,oBAAC,SAAD,EAAS,SAAS,YAAc,CAAA;IACzC,CAAA;IACX,oBAAC,QAAD;KAAM,eAAY;KAAO,WAAU;KAChC,UAAA;IACG,CAAA;IACN,oBAAC,WAAD;KAAW,MAAK;KAAM,WAAW;KAC7B,WAAA,gBAAgB,oBAAC,SAAD,EAAS,SAAS,YAAc,CAAA;IACzC,CAAA;GACX,EAAA,CAAA;GAEJ,UACE,oBAAC,eAAD,EAAA,UACE,oBAAC,eAAD,EAAe,MAAM,UAAY,CAAA,EACpB,CAAA;EAElB,CAAA;CACkB,CAAA;AAEzB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type DialogTriggerProps } from 'react-aria-components';
|
|
2
|
+
import type { OverlayProps } from '../../../internal/OverlayParts';
|
|
3
|
+
export type DialogSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface DialogProps extends OverlayProps {
|
|
5
|
+
size?: DialogSize;
|
|
6
|
+
/** Role "alertdialog" for destructive confirmations that need an explicit choice. */
|
|
7
|
+
role?: 'dialog' | 'alertdialog';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A modal dialog. Focus moves into the dialog when it opens, is trapped while
|
|
11
|
+
* open and returns to the trigger on close. Place it inside a DialogTrigger
|
|
12
|
+
* next to the button that opens it, or control it with isOpen.
|
|
13
|
+
*
|
|
14
|
+
* The modal's code loads the first time it opens, or earlier when the trigger
|
|
15
|
+
* is hovered or focused, so the very first open can take a moment on a slow
|
|
16
|
+
* connection.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Dialog(props: DialogProps): import("react").JSX.Element | null;
|
|
19
|
+
/** Wraps a trigger button and its Dialog, and preloads the dialog on hover or focus of the trigger. */
|
|
20
|
+
export declare function DialogTrigger(props: DialogTriggerProps): import("react").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { createLazyModule } from "../../../internal/lazyModule.js";
|
|
3
|
+
import { PreloadOnIntent } from "../../../internal/PreloadOnIntent.js";
|
|
4
4
|
import { useContext } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { OverlayTriggerStateContext } from "react-aria-components";
|
|
7
|
-
// src/components/Dialog/Dialog.tsx
|
|
6
|
+
import { DialogTrigger, OverlayTriggerStateContext } from "react-aria-components";
|
|
7
|
+
// src/components/molecules/Dialog/Dialog.tsx
|
|
8
8
|
var overlay = /*#__PURE__*/ createLazyModule(() => import("./DialogOverlay.js"));
|
|
9
9
|
/**
|
|
10
10
|
* A modal dialog. Focus moves into the dialog when it opens, is trapped while
|
|
@@ -23,9 +23,9 @@ function Dialog$1(props) {
|
|
|
23
23
|
}
|
|
24
24
|
/** Wraps a trigger button and its Dialog, and preloads the dialog on hover or focus of the trigger. */
|
|
25
25
|
function DialogTrigger$1(props) {
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
|
|
28
|
-
...props
|
|
26
|
+
return /* @__PURE__ */ jsx(PreloadOnIntent, {
|
|
27
|
+
preload: overlay.preload,
|
|
28
|
+
children: /* @__PURE__ */ jsx(DialogTrigger, { ...props })
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
export { Dialog$1 as Dialog, DialogTrigger$1 as DialogTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["Dialog","DialogTrigger","AriaDialogTrigger"],"sources":["../../../../src/components/molecules/Dialog/Dialog.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport {\n DialogTrigger as AriaDialogTrigger,\n OverlayTriggerStateContext,\n type DialogTriggerProps,\n} from 'react-aria-components';\nimport { createLazyModule } from '../../../internal/lazyModule';\nimport type { OverlayProps } from '../../../internal/OverlayParts';\nimport { PreloadOnIntent } from '../../../internal/PreloadOnIntent';\n\nexport type DialogSize = 'sm' | 'md' | 'lg';\n\nexport interface DialogProps extends OverlayProps {\n size?: DialogSize;\n /** Role \"alertdialog\" for destructive confirmations that need an explicit choice. */\n role?: 'dialog' | 'alertdialog';\n}\n\nconst overlay = /*#__PURE__*/ createLazyModule(() => import('./DialogOverlay'));\n\n/**\n * A modal dialog. Focus moves into the dialog when it opens, is trapped while\n * open and returns to the trigger on close. Place it inside a DialogTrigger\n * next to the button that opens it, or control it with isOpen.\n *\n * The modal's code loads the first time it opens, or earlier when the trigger\n * is hovered or focused, so the very first open can take a moment on a slow\n * connection.\n */\nexport function Dialog(props: DialogProps) {\n const triggerState = useContext(OverlayTriggerStateContext);\n const isWanted = props.isOpen ?? props.defaultOpen ?? triggerState?.isOpen ?? false;\n const loaded = overlay.useModule(isWanted);\n return loaded ? <loaded.DialogOverlay {...props} /> : null;\n}\n\n/** Wraps a trigger button and its Dialog, and preloads the dialog on hover or focus of the trigger. */\nexport function DialogTrigger(props: DialogTriggerProps) {\n return (\n <PreloadOnIntent preload={overlay.preload}>\n <AriaDialogTrigger {...props} />\n </PreloadOnIntent>\n );\n}\n"],"mappings":";;;;;;;AAkBA,IAAM,UAAwB,qCAAuB,OAAO,qBAAkB;;;;;;;;;;AAW9E,SAAgBA,SAAO,OAAoB;CACzC,MAAM,eAAe,WAAW,0BAA0B;CAC1D,MAAM,WAAW,MAAM,UAAU,MAAM,eAAe,cAAc,UAAU;CAC9E,MAAM,SAAS,QAAQ,UAAU,QAAQ;CACzC,OAAO,SAAS,oBAAC,OAAO,eAAR,EAAsB,GAAI,MAAQ,CAAA,IAAI;AACxD;;AAGA,SAAgBC,gBAAc,OAA2B;CACvD,OACE,oBAAC,iBAAD;EAAiB,SAAS,QAAQ;EAChC,UAAA,oBAACC,eAAD,EAAmB,GAAI,MAAQ,CAAA;CAChB,CAAA;AAErB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DialogProps } from './Dialog';
|
|
2
|
+
/** The modal behind Dialog. Dialog loads this module the first time it opens. */
|
|
3
|
+
export declare function DialogOverlay({ title, hideTitle, description, children, footer, headerActions, size, role, closeLabel, isDismissable, className, ...overlayProps }: DialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { OverlayFooter, OverlayHeader, resolveContent } from "../../../internal/OverlayParts.js";
|
|
3
|
+
import { modalBackdrop, modalSurface } from "../../../internal/surfaces.js";
|
|
4
|
+
import { cx } from "../../../utils/cx.js";
|
|
5
|
+
import { IconButton } from "../../atoms/IconButton/IconButton.js";
|
|
6
|
+
import { useId } from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Dialog, Modal, ModalOverlay } from "react-aria-components";
|
|
9
|
+
import { X } from "lucide-react";
|
|
10
|
+
// src/components/molecules/Dialog/DialogOverlay.tsx
|
|
11
|
+
var sizes = {
|
|
12
|
+
sm: "max-w-sm",
|
|
13
|
+
md: "max-w-lg",
|
|
14
|
+
lg: "max-w-2xl"
|
|
15
|
+
};
|
|
16
|
+
/** The modal behind Dialog. Dialog loads this module the first time it opens. */
|
|
17
|
+
function DialogOverlay({ title, hideTitle, description, children, footer, headerActions, size = "md", role = "dialog", closeLabel = "Close", isDismissable = true, className, ...overlayProps }) {
|
|
18
|
+
const descriptionId = useId();
|
|
19
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
20
|
+
...overlayProps,
|
|
21
|
+
isDismissable,
|
|
22
|
+
className: cx(modalBackdrop, "flex items-center justify-center p-4"),
|
|
23
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
24
|
+
className: cx("w-full", sizes[size]),
|
|
25
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
26
|
+
role,
|
|
27
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
28
|
+
className: cx(modalSurface, "flex max-h-[85vh] flex-col gap-4 overflow-auto rounded-xl border p-card", className),
|
|
29
|
+
children: ({ close }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(OverlayHeader, {
|
|
31
|
+
title,
|
|
32
|
+
hideTitle,
|
|
33
|
+
description,
|
|
34
|
+
descriptionId,
|
|
35
|
+
headerActions,
|
|
36
|
+
closeButton: /* @__PURE__ */ jsx(IconButton, {
|
|
37
|
+
icon: /* @__PURE__ */ jsx(X, {}),
|
|
38
|
+
"aria-label": closeLabel,
|
|
39
|
+
variant: "tertiary",
|
|
40
|
+
size: "sm",
|
|
41
|
+
onPress: close,
|
|
42
|
+
className: "-mt-1 -mr-1 shrink-0"
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
children && /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: "text-sm text-secondary",
|
|
47
|
+
children: resolveContent(children, close)
|
|
48
|
+
}),
|
|
49
|
+
footer && /* @__PURE__ */ jsx(OverlayFooter, {
|
|
50
|
+
className: "mt-2",
|
|
51
|
+
children: resolveContent(footer, close)
|
|
52
|
+
})
|
|
53
|
+
] })
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export { DialogOverlay };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=DialogOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogOverlay.js","names":["AriaDialog","_Fragment"],"sources":["../../../../src/components/molecules/Dialog/DialogOverlay.tsx"],"sourcesContent":["import { X } from 'lucide-react';\nimport { useId } from 'react';\nimport { Dialog as AriaDialog, Modal, ModalOverlay } from 'react-aria-components';\nimport { OverlayFooter, OverlayHeader, resolveContent } from '../../../internal/OverlayParts';\nimport { modalBackdrop, modalSurface } from '../../../internal/surfaces';\nimport { cx } from '../../../utils/cx';\nimport { IconButton } from '../../atoms/IconButton/IconButton';\nimport type { DialogProps, DialogSize } from './Dialog';\n\nconst sizes: Record<DialogSize, string> = {\n sm: 'max-w-sm',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n};\n\n/** The modal behind Dialog. Dialog loads this module the first time it opens. */\nexport function DialogOverlay({\n title,\n hideTitle,\n description,\n children,\n footer,\n headerActions,\n size = 'md',\n role = 'dialog',\n closeLabel = 'Close',\n isDismissable = true,\n className,\n ...overlayProps\n}: DialogProps) {\n const descriptionId = useId();\n return (\n <ModalOverlay\n {...overlayProps}\n isDismissable={isDismissable}\n className={cx(modalBackdrop, 'flex items-center justify-center p-4')}\n >\n <Modal className={cx('w-full', sizes[size])}>\n <AriaDialog\n role={role}\n aria-describedby={description ? descriptionId : undefined}\n className={cx(\n modalSurface,\n 'flex max-h-[85vh] flex-col gap-4 overflow-auto rounded-xl border p-card',\n className,\n )}\n >\n {({ close }) => (\n <>\n <OverlayHeader\n title={title}\n hideTitle={hideTitle}\n description={description}\n descriptionId={descriptionId}\n headerActions={headerActions}\n closeButton={\n <IconButton\n icon={<X />}\n aria-label={closeLabel}\n variant='tertiary'\n size='sm'\n onPress={close}\n className='-mt-1 -mr-1 shrink-0'\n />\n }\n />\n {children && (\n <div className='text-sm text-secondary'>{resolveContent(children, close)}</div>\n )}\n {footer && (\n <OverlayFooter className='mt-2'>{resolveContent(footer, close)}</OverlayFooter>\n )}\n </>\n )}\n </AriaDialog>\n </Modal>\n </ModalOverlay>\n );\n}\n"],"mappings":";;;;;;;;;;AASA,IAAM,QAAoC;CACxC,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;AAGA,SAAgB,cAAc,EAC5B,OACA,WACA,aACA,UACA,QACA,eACA,OAAO,MACP,OAAO,UACP,aAAa,SACb,gBAAgB,MAChB,WACA,GAAG,gBACW;CACd,MAAM,gBAAgB,MAAM;CAC5B,OACE,oBAAC,cAAD;EACE,GAAI;EACW;EACf,WAAW,GAAG,eAAe,sCAAsC;EAEnE,UAAA,oBAAC,OAAD;GAAO,WAAW,GAAG,UAAU,MAAM,KAAK;GACxC,UAAA,oBAACA,QAAD;IACQ;IACN,oBAAkB,cAAc,gBAAgB,KAAA;IAChD,WAAW,GACT,cACA,2EACA,SACF;IAEE,WAAA,EAAE,YACF,qBAAAC,UAAA,EAAA,UAAA;KACE,oBAAC,eAAD;MACS;MACI;MACE;MACE;MACA;MACf,aACE,oBAAC,YAAD;OACE,MAAM,oBAAC,GAAD,CAAI,CAAA;OACV,cAAY;OACZ,SAAQ;OACR,MAAK;OACL,SAAS;OACT,WAAU;MACX,CAAA;KAEJ,CAAA;KACA,YACC,oBAAC,OAAD;MAAK,WAAU;MAA0B,UAAA,eAAe,UAAU,KAAK;KAAO,CAAA;KAE/E,UACC,oBAAC,eAAD;MAAe,WAAU;MAAQ,UAAA,eAAe,QAAQ,KAAK;KAAiB,CAAA;IAEhF,EAAA,CAAA;GAEM,CAAA;EACP,CAAA;CACK,CAAA;AAElB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DialogTriggerProps } from 'react-aria-components';
|
|
2
|
+
import type { OverlayProps } from '../../../internal/OverlayParts';
|
|
3
|
+
export type DrawerSide = 'left' | 'right' | 'bottom';
|
|
4
|
+
export type DrawerSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface DrawerProps extends OverlayProps {
|
|
6
|
+
/** Edge the panel slides in from. */
|
|
7
|
+
side?: DrawerSide;
|
|
8
|
+
size?: DrawerSize;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A side panel (also called a sheet) on React Aria's Modal. It slides in from
|
|
12
|
+
* an edge, traps focus while open, closes on Escape or a click on the
|
|
13
|
+
* backdrop, and returns focus to the trigger. Use it for navigation on small
|
|
14
|
+
* screens, filters and detail views.
|
|
15
|
+
*
|
|
16
|
+
* The panel's code loads the first time it opens, or earlier when the trigger
|
|
17
|
+
* is hovered or focused.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Drawer(props: DrawerProps): import("react").JSX.Element | null;
|
|
20
|
+
/** Wraps a trigger button and its Drawer, and preloads the drawer on hover or focus of the trigger. */
|
|
21
|
+
export declare function DrawerTrigger(props: DialogTriggerProps): import("react").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { createLazyModule } from "../../../internal/lazyModule.js";
|
|
3
|
+
import { PreloadOnIntent } from "../../../internal/PreloadOnIntent.js";
|
|
4
4
|
import { useContext } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { OverlayTriggerStateContext } from "react-aria-components";
|
|
7
|
-
// src/components/Drawer/Drawer.tsx
|
|
6
|
+
import { DialogTrigger, OverlayTriggerStateContext } from "react-aria-components";
|
|
7
|
+
// src/components/molecules/Drawer/Drawer.tsx
|
|
8
8
|
var overlay = /*#__PURE__*/ createLazyModule(() => import("./DrawerOverlay.js"));
|
|
9
9
|
/**
|
|
10
10
|
* A side panel (also called a sheet) on React Aria's Modal. It slides in from
|
|
@@ -23,9 +23,9 @@ function Drawer(props) {
|
|
|
23
23
|
}
|
|
24
24
|
/** Wraps a trigger button and its Drawer, and preloads the drawer on hover or focus of the trigger. */
|
|
25
25
|
function DrawerTrigger(props) {
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
|
|
28
|
-
...props
|
|
26
|
+
return /* @__PURE__ */ jsx(PreloadOnIntent, {
|
|
27
|
+
preload: overlay.preload,
|
|
28
|
+
children: /* @__PURE__ */ jsx(DialogTrigger, { ...props })
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
export { Drawer, DrawerTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.js","names":["AriaDialogTrigger"],"sources":["../../../../src/components/molecules/Drawer/Drawer.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport {\n DialogTrigger as AriaDialogTrigger,\n OverlayTriggerStateContext,\n type DialogTriggerProps,\n} from 'react-aria-components';\nimport { createLazyModule } from '../../../internal/lazyModule';\nimport type { OverlayProps } from '../../../internal/OverlayParts';\nimport { PreloadOnIntent } from '../../../internal/PreloadOnIntent';\n\nexport type DrawerSide = 'left' | 'right' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg';\n\nexport interface DrawerProps extends OverlayProps {\n /** Edge the panel slides in from. */\n side?: DrawerSide;\n size?: DrawerSize;\n}\n\nconst overlay = /*#__PURE__*/ createLazyModule(() => import('./DrawerOverlay'));\n\n/**\n * A side panel (also called a sheet) on React Aria's Modal. It slides in from\n * an edge, traps focus while open, closes on Escape or a click on the\n * backdrop, and returns focus to the trigger. Use it for navigation on small\n * screens, filters and detail views.\n *\n * The panel's code loads the first time it opens, or earlier when the trigger\n * is hovered or focused.\n */\nexport function Drawer(props: DrawerProps) {\n const triggerState = useContext(OverlayTriggerStateContext);\n const isWanted = props.isOpen ?? props.defaultOpen ?? triggerState?.isOpen ?? false;\n const loaded = overlay.useModule(isWanted);\n return loaded ? <loaded.DrawerOverlay {...props} /> : null;\n}\n\n/** Wraps a trigger button and its Drawer, and preloads the drawer on hover or focus of the trigger. */\nexport function DrawerTrigger(props: DialogTriggerProps) {\n return (\n <PreloadOnIntent preload={overlay.preload}>\n <AriaDialogTrigger {...props} />\n </PreloadOnIntent>\n );\n}\n"],"mappings":";;;;;;;AAmBA,IAAM,UAAwB,qCAAuB,OAAO,qBAAkB;;;;;;;;;;AAW9E,SAAgB,OAAO,OAAoB;CACzC,MAAM,eAAe,WAAW,0BAA0B;CAC1D,MAAM,WAAW,MAAM,UAAU,MAAM,eAAe,cAAc,UAAU;CAC9E,MAAM,SAAS,QAAQ,UAAU,QAAQ;CACzC,OAAO,SAAS,oBAAC,OAAO,eAAR,EAAsB,GAAI,MAAQ,CAAA,IAAI;AACxD;;AAGA,SAAgB,cAAc,OAA2B;CACvD,OACE,oBAAC,iBAAD;EAAiB,SAAS,QAAQ;EAChC,UAAA,oBAACA,eAAD,EAAmB,GAAI,MAAQ,CAAA;CAChB,CAAA;AAErB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DrawerProps } from './Drawer';
|
|
2
2
|
/** The panel behind Drawer. Drawer loads this module the first time it opens. */
|
|
3
|
-
export declare function DrawerOverlay({ title, hideTitle, description, children, footer, side, size, closeLabel, isDismissable, className, ...overlayProps }: DrawerProps): import("react").JSX.Element;
|
|
3
|
+
export declare function DrawerOverlay({ title, hideTitle, description, headerActions, children, footer, side, size, closeLabel, isDismissable, className, ...overlayProps }: DrawerProps): import("react").JSX.Element;
|