jaci-ui 0.6.3 → 0.8.0
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/CHANGELOG.md +12 -0
- package/README.md +48 -0
- package/dist/components/alert/alert.cjs +11 -1
- package/dist/components/alert/alert.cjs.map +1 -1
- package/dist/components/alert/alert.d.cts +4 -1
- package/dist/components/alert/alert.d.ts +4 -1
- package/dist/components/alert/alert.js +11 -2
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/index.d.cts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert-dialog/alert-dialog.cjs +4 -1
- package/dist/components/alert-dialog/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.d.cts +2 -2
- package/dist/components/alert-dialog/alert-dialog.d.ts +2 -2
- package/dist/components/alert-dialog/alert-dialog.js +4 -1
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.cjs +23 -0
- package/dist/components/aspect-ratio/aspect-ratio.cjs.map +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.cts +9 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +23 -0
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -0
- package/dist/components/aspect-ratio/index.d.cts +2 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/card/card.cjs +10 -1
- package/dist/components/card/card.cjs.map +1 -1
- package/dist/components/card/card.d.cts +15 -2
- package/dist/components/card/card.d.ts +15 -2
- package/dist/components/card/card.js +10 -2
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/index.d.cts +2 -2
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/code/code.cjs +39 -0
- package/dist/components/code/code.cjs.map +1 -0
- package/dist/components/code/code.d.cts +14 -0
- package/dist/components/code/code.d.ts +14 -0
- package/dist/components/code/code.js +39 -0
- package/dist/components/code/code.js.map +1 -0
- package/dist/components/code/index.d.cts +2 -0
- package/dist/components/code/index.d.ts +2 -0
- package/dist/components/color-picker/color-picker.cjs +4 -1
- package/dist/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/components/color-picker/color-picker.d.cts +2 -2
- package/dist/components/color-picker/color-picker.d.ts +2 -2
- package/dist/components/color-picker/color-picker.js +4 -1
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/combobox/combobox.cjs +4 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.d.cts +2 -2
- package/dist/components/combobox/combobox.d.ts +2 -2
- package/dist/components/combobox/combobox.js +4 -1
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/command/command.cjs +73 -12
- package/dist/components/command/command.cjs.map +1 -1
- package/dist/components/command/command.d.cts +7 -1
- package/dist/components/command/command.d.ts +7 -1
- package/dist/components/command/command.js +73 -12
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/command/index.d.cts +2 -2
- package/dist/components/command/index.d.ts +2 -2
- package/dist/components/context-menu/context-menu.cjs +4 -1
- package/dist/components/context-menu/context-menu.cjs.map +1 -1
- package/dist/components/context-menu/context-menu.d.cts +2 -2
- package/dist/components/context-menu/context-menu.d.ts +2 -2
- package/dist/components/context-menu/context-menu.js +4 -1
- package/dist/components/context-menu/context-menu.js.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +4 -1
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.d.cts +2 -2
- package/dist/components/date-picker/date-picker.d.ts +2 -2
- package/dist/components/date-picker/date-picker.js +4 -1
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +4 -1
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.d.cts +2 -2
- package/dist/components/date-range-picker/date-range-picker.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.js +4 -1
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/dialog/dialog.cjs +4 -1
- package/dist/components/dialog/dialog.cjs.map +1 -1
- package/dist/components/dialog/dialog.d.cts +2 -2
- package/dist/components/dialog/dialog.d.ts +2 -2
- package/dist/components/dialog/dialog.js +4 -1
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.cjs +4 -1
- package/dist/components/drawer/drawer.cjs.map +1 -1
- package/dist/components/drawer/drawer.d.cts +2 -2
- package/dist/components/drawer/drawer.d.ts +2 -2
- package/dist/components/drawer/drawer.js +4 -1
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/feedback/badge.cjs +6 -3
- package/dist/components/feedback/badge.cjs.map +1 -1
- package/dist/components/feedback/badge.d.cts +1 -0
- package/dist/components/feedback/badge.d.ts +1 -0
- package/dist/components/feedback/badge.js +6 -3
- package/dist/components/feedback/badge.js.map +1 -1
- package/dist/components/figure/figure.cjs +134 -0
- package/dist/components/figure/figure.cjs.map +1 -0
- package/dist/components/figure/figure.d.cts +24 -0
- package/dist/components/figure/figure.d.ts +24 -0
- package/dist/components/figure/figure.js +131 -0
- package/dist/components/figure/figure.js.map +1 -0
- package/dist/components/figure/index.d.cts +2 -0
- package/dist/components/figure/index.d.ts +2 -0
- package/dist/components/image/image.cjs +112 -0
- package/dist/components/image/image.cjs.map +1 -0
- package/dist/components/image/image.d.cts +21 -0
- package/dist/components/image/image.d.ts +21 -0
- package/dist/components/image/image.js +112 -0
- package/dist/components/image/image.js.map +1 -0
- package/dist/components/image/index.d.cts +2 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/kbd/index.d.cts +2 -0
- package/dist/components/kbd/index.d.ts +2 -0
- package/dist/components/kbd/kbd.cjs +23 -0
- package/dist/components/kbd/kbd.cjs.map +1 -0
- package/dist/components/kbd/kbd.d.cts +12 -0
- package/dist/components/kbd/kbd.d.ts +12 -0
- package/dist/components/kbd/kbd.js +23 -0
- package/dist/components/kbd/kbd.js.map +1 -0
- package/dist/components/menu/menu.cjs +4 -1
- package/dist/components/menu/menu.cjs.map +1 -1
- package/dist/components/menu/menu.d.cts +2 -2
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/menu/menu.js +4 -1
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/menubar/menubar.cjs +4 -1
- package/dist/components/menubar/menubar.cjs.map +1 -1
- package/dist/components/menubar/menubar.d.cts +2 -2
- package/dist/components/menubar/menubar.d.ts +2 -2
- package/dist/components/menubar/menubar.js +4 -1
- package/dist/components/menubar/menubar.js.map +1 -1
- package/dist/components/navigation/navigation.cjs +3 -1
- package/dist/components/navigation/navigation.cjs.map +1 -1
- package/dist/components/navigation/navigation.js +3 -1
- package/dist/components/navigation/navigation.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.cjs +4 -1
- package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.d.cts +2 -2
- package/dist/components/navigation-menu/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu/navigation-menu.js +4 -1
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/popover/popover.cjs +4 -1
- package/dist/components/popover/popover.cjs.map +1 -1
- package/dist/components/popover/popover.d.cts +2 -2
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/popover.js +4 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.cjs +19 -7
- package/dist/components/progress/progress.cjs.map +1 -1
- package/dist/components/progress/progress.d.cts +4 -0
- package/dist/components/progress/progress.d.ts +4 -0
- package/dist/components/progress/progress.js +19 -7
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/quote/index.d.cts +2 -0
- package/dist/components/quote/index.d.ts +2 -0
- package/dist/components/quote/quote.cjs +38 -0
- package/dist/components/quote/quote.cjs.map +1 -0
- package/dist/components/quote/quote.d.cts +19 -0
- package/dist/components/quote/quote.d.ts +19 -0
- package/dist/components/quote/quote.js +38 -0
- package/dist/components/quote/quote.js.map +1 -0
- package/dist/components/select/select.cjs +4 -1
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.d.cts +2 -2
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +4 -1
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/sidebar/sidebar.cjs +24 -17
- package/dist/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/sidebar/sidebar.d.cts +4 -2
- package/dist/components/sidebar/sidebar.d.ts +4 -2
- package/dist/components/sidebar/sidebar.js +24 -17
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/stat/index.d.cts +2 -0
- package/dist/components/stat/index.d.ts +2 -0
- package/dist/components/stat/stat.cjs +122 -0
- package/dist/components/stat/stat.cjs.map +1 -0
- package/dist/components/stat/stat.d.cts +51 -0
- package/dist/components/stat/stat.d.ts +51 -0
- package/dist/components/stat/stat.js +114 -0
- package/dist/components/stat/stat.js.map +1 -0
- package/dist/components/stat-group/index.d.cts +2 -0
- package/dist/components/stat-group/index.d.ts +2 -0
- package/dist/components/toast/toast.cjs +4 -1
- package/dist/components/toast/toast.cjs.map +1 -1
- package/dist/components/toast/toast.d.cts +1 -1
- package/dist/components/toast/toast.d.ts +1 -1
- package/dist/components/toast/toast.js +4 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tooltip/tooltip.cjs +4 -1
- package/dist/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/components/tooltip/tooltip.d.cts +2 -2
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/tooltip.js +4 -1
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/components/typography/heading.cjs +8 -2
- package/dist/components/typography/heading.cjs.map +1 -1
- package/dist/components/typography/heading.d.cts +8 -1
- package/dist/components/typography/heading.d.ts +8 -1
- package/dist/components/typography/heading.js +8 -2
- package/dist/components/typography/heading.js.map +1 -1
- package/dist/components/typography/index.d.cts +2 -2
- package/dist/components/typography/index.d.ts +2 -2
- package/dist/components/typography/paragraph.cjs +7 -2
- package/dist/components/typography/paragraph.cjs.map +1 -1
- package/dist/components/typography/paragraph.d.cts +8 -2
- package/dist/components/typography/paragraph.d.ts +8 -2
- package/dist/components/typography/paragraph.js +7 -2
- package/dist/components/typography/paragraph.js.map +1 -1
- package/dist/components/typography/text.cjs +6 -2
- package/dist/components/typography/text.cjs.map +1 -1
- package/dist/components/typography/text.d.cts +5 -0
- package/dist/components/typography/text.d.ts +5 -0
- package/dist/components/typography/text.js +6 -2
- package/dist/components/typography/text.js.map +1 -1
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -0
- package/dist/styled-system/recipes/alert.cjs +2 -1
- package/dist/styled-system/recipes/alert.cjs.map +1 -1
- package/dist/styled-system/recipes/alert.js +2 -1
- package/dist/styled-system/recipes/alert.js.map +1 -1
- package/dist/styled-system/recipes/aspect-ratio-box.cjs +25 -0
- package/dist/styled-system/recipes/aspect-ratio-box.cjs.map +1 -0
- package/dist/styled-system/recipes/aspect-ratio-box.js +25 -0
- package/dist/styled-system/recipes/aspect-ratio-box.js.map +1 -0
- package/dist/styled-system/recipes/badge.cjs +16 -6
- package/dist/styled-system/recipes/badge.cjs.map +1 -1
- package/dist/styled-system/recipes/badge.js +16 -6
- package/dist/styled-system/recipes/badge.js.map +1 -1
- package/dist/styled-system/recipes/code.cjs +33 -0
- package/dist/styled-system/recipes/code.cjs.map +1 -0
- package/dist/styled-system/recipes/code.js +33 -0
- package/dist/styled-system/recipes/code.js.map +1 -0
- package/dist/styled-system/recipes/command.cjs +3 -3
- package/dist/styled-system/recipes/command.cjs.map +1 -1
- package/dist/styled-system/recipes/command.js +3 -3
- package/dist/styled-system/recipes/command.js.map +1 -1
- package/dist/styled-system/recipes/figure.cjs +43 -0
- package/dist/styled-system/recipes/figure.cjs.map +1 -0
- package/dist/styled-system/recipes/figure.js +43 -0
- package/dist/styled-system/recipes/figure.js.map +1 -0
- package/dist/styled-system/recipes/heading.cjs +34 -9
- package/dist/styled-system/recipes/heading.cjs.map +1 -1
- package/dist/styled-system/recipes/heading.js +34 -9
- package/dist/styled-system/recipes/heading.js.map +1 -1
- package/dist/styled-system/recipes/image.cjs +57 -0
- package/dist/styled-system/recipes/image.cjs.map +1 -0
- package/dist/styled-system/recipes/image.js +57 -0
- package/dist/styled-system/recipes/image.js.map +1 -0
- package/dist/styled-system/recipes/kbd.cjs +39 -0
- package/dist/styled-system/recipes/kbd.cjs.map +1 -0
- package/dist/styled-system/recipes/kbd.js +39 -0
- package/dist/styled-system/recipes/kbd.js.map +1 -0
- package/dist/styled-system/recipes/paragraph.cjs +25 -2
- package/dist/styled-system/recipes/paragraph.cjs.map +1 -1
- package/dist/styled-system/recipes/paragraph.js +25 -2
- package/dist/styled-system/recipes/paragraph.js.map +1 -1
- package/dist/styled-system/recipes/progress.cjs +1 -0
- package/dist/styled-system/recipes/progress.cjs.map +1 -1
- package/dist/styled-system/recipes/progress.js +1 -0
- package/dist/styled-system/recipes/progress.js.map +1 -1
- package/dist/styled-system/recipes/quote.cjs +39 -0
- package/dist/styled-system/recipes/quote.cjs.map +1 -0
- package/dist/styled-system/recipes/quote.js +39 -0
- package/dist/styled-system/recipes/quote.js.map +1 -0
- package/dist/styled-system/recipes/stat-group.cjs +40 -0
- package/dist/styled-system/recipes/stat-group.cjs.map +1 -0
- package/dist/styled-system/recipes/stat-group.js +40 -0
- package/dist/styled-system/recipes/stat-group.js.map +1 -0
- package/dist/styled-system/recipes/stat.cjs +63 -0
- package/dist/styled-system/recipes/stat.cjs.map +1 -0
- package/dist/styled-system/recipes/stat.js +63 -0
- package/dist/styled-system/recipes/stat.js.map +1 -0
- package/dist/styled-system/recipes/text.cjs +23 -2
- package/dist/styled-system/recipes/text.cjs.map +1 -1
- package/dist/styled-system/recipes/text.js +23 -2
- package/dist/styled-system/recipes/text.js.map +1 -1
- package/dist/styles.css +1064 -117
- package/dist/theme/theme-provider.cjs +18 -8
- package/dist/theme/theme-provider.cjs.map +1 -1
- package/dist/theme/theme-provider.js +18 -8
- package/dist/theme/theme-provider.js.map +1 -1
- package/dist/theme/theme-scope.cjs +21 -0
- package/dist/theme/theme-scope.cjs.map +1 -0
- package/dist/theme/theme-scope.js +19 -0
- package/dist/theme/theme-scope.js.map +1 -0
- package/package.json +7 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { withRecipeClassName } from "../base-ui.js";
|
|
3
3
|
import { popover } from "../../styled-system/recipes/popover.js";
|
|
4
|
+
import { useThemePortalProps } from "../../theme/theme-scope.js";
|
|
4
5
|
import { forwardRef } from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -18,7 +19,9 @@ const PopoverTrigger = forwardRef(function PopoverTrigger({ className, ...props
|
|
|
18
19
|
});
|
|
19
20
|
});
|
|
20
21
|
/** Preserves Base UI's optional portal container and mount controls. */
|
|
21
|
-
|
|
22
|
+
function PopoverPortal(props) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Popover.Portal, { ...useThemePortalProps(props) });
|
|
24
|
+
}
|
|
22
25
|
const PopoverPositioner = forwardRef(function PopoverPositioner({ className, ...props }, ref) {
|
|
23
26
|
return /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
24
27
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["PopoverRoot","BasePopover","Popover"],"sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { popover } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\n/** Preserves Base UI's controlled `open` API and uncontrolled `defaultOpen` API. */\nexport type PopoverRootProps<Payload = unknown> = BasePopoverRoot.Props<Payload>;\n\nexport function PopoverRoot<Payload = unknown>(props: PopoverRootProps<Payload>) {\n return <BasePopover.Root {...props} />;\n}\n\nexport type PopoverTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\n\nexport const PopoverTrigger = forwardRef<HTMLButtonElement, PopoverTriggerProps>(\n function PopoverTrigger({ className, ...props }, ref) {\n return (\n <BasePopover.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(popover().trigger, className)}\n data-jaci-component=\"popover\"\n data-slot=\"popover-trigger\"\n />\n );\n },\n);\n\n/** Preserves Base UI's optional portal container and mount controls. */\nexport
|
|
1
|
+
{"version":3,"file":"popover.js","names":["PopoverRoot","BasePopover","Popover"],"sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { popover } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\n/** Preserves Base UI's controlled `open` API and uncontrolled `defaultOpen` API. */\nexport type PopoverRootProps<Payload = unknown> = BasePopoverRoot.Props<Payload>;\n\nexport function PopoverRoot<Payload = unknown>(props: PopoverRootProps<Payload>) {\n return <BasePopover.Root {...props} />;\n}\n\nexport type PopoverTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\n\nexport const PopoverTrigger = forwardRef<HTMLButtonElement, PopoverTriggerProps>(\n function PopoverTrigger({ className, ...props }, ref) {\n return (\n <BasePopover.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(popover().trigger, className)}\n data-jaci-component=\"popover\"\n data-slot=\"popover-trigger\"\n />\n );\n },\n);\n\n/** Preserves Base UI's optional portal container and mount controls. */\nexport function PopoverPortal(props: ComponentPropsWithoutRef<typeof BasePopover.Portal>) {\n return <BasePopover.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type PopoverPositionerProps = ComponentPropsWithoutRef<typeof BasePopover.Positioner>;\n\nexport const PopoverPositioner = forwardRef<HTMLDivElement, PopoverPositionerProps>(\n function PopoverPositioner({ className, ...props }, ref) {\n return (\n <BasePopover.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(popover().positioner, className)}\n data-slot=\"popover-positioner\"\n />\n );\n },\n);\n\nexport type PopoverPopupProps = ComponentPropsWithoutRef<typeof BasePopover.Popup>;\n\nexport const PopoverPopup = forwardRef<HTMLDivElement, PopoverPopupProps>(function PopoverPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BasePopover.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(popover().popup, className)}\n data-jaci-component=\"popover\"\n data-slot=\"popover-popup\"\n />\n );\n});\n\nexport type PopoverTitleProps = ComponentPropsWithoutRef<typeof BasePopover.Title>;\n\nexport const PopoverTitle = forwardRef<HTMLHeadingElement, PopoverTitleProps>(function PopoverTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BasePopover.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(popover().title, className)}\n data-slot=\"popover-title\"\n />\n );\n});\n\nexport type PopoverDescriptionProps = ComponentPropsWithoutRef<typeof BasePopover.Description>;\n\nexport const PopoverDescription = forwardRef<HTMLParagraphElement, PopoverDescriptionProps>(\n function PopoverDescription({ className, ...props }, ref) {\n return (\n <BasePopover.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(popover().description, className)}\n data-slot=\"popover-description\"\n />\n );\n },\n);\n\nexport type PopoverCloseProps = ComponentPropsWithoutRef<typeof BasePopover.Close>;\n\nexport const PopoverClose = forwardRef<HTMLButtonElement, PopoverCloseProps>(function PopoverClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BasePopover.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close popover\")}\n ref={ref}\n className={withRecipeClassName(popover().close, className)}\n data-slot=\"popover-close\"\n >\n {children ?? \"×\"}\n </BasePopover.Close>\n );\n});\n\nexport type PopoverArrowProps = ComponentPropsWithoutRef<typeof BasePopover.Arrow>;\n\nexport const PopoverArrow = forwardRef<HTMLDivElement, PopoverArrowProps>(function PopoverArrow(\n { className, ...props },\n ref,\n) {\n return (\n <BasePopover.Arrow\n {...props}\n ref={ref}\n className={withRecipeClassName(popover().arrow, className)}\n data-slot=\"popover-arrow\"\n />\n );\n});\n\nexport const Popover = {\n Root: PopoverRoot,\n Trigger: PopoverTrigger,\n Portal: PopoverPortal,\n Positioner: PopoverPositioner,\n Popup: PopoverPopup,\n Title: PopoverTitle,\n Description: PopoverDescription,\n Close: PopoverClose,\n Arrow: PopoverArrow,\n createHandle: BasePopover.createHandle,\n};\n"],"mappings":";;;;;;;;AAcA,SAAgBA,cAA+B,OAAkC;CAC/E,OAAO,oBAACC,QAAY,MAAb,EAAkB,GAAI,MAAQ,CAAA;AACvC;AAIA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAACA,QAAY,SAAb;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,QAAQ,CAAC,CAAC,SAAS,SAAS;EAC3D,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CACF;;AAGA,SAAgB,cAAc,OAA4D;CACxF,OAAO,oBAACA,QAAY,QAAb,EAAoB,GAAI,oBAAoB,KAAK,EAAI,CAAA;AAC9D;AAIA,MAAa,oBAAoB,WAC/B,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAS,KAAK;CACvD,OACE,oBAACA,QAAY,YAAb;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,QAAQ,CAAC,CA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;CACP,aAAa;CACb,OAAO;CACP,OAAO;CACP,cAAcC,QAAY;AAC5B"}
|
|
@@ -11,11 +11,13 @@ function clamp(value, maximum) {
|
|
|
11
11
|
* A semantic progress bar. Provide `label` or `aria-label` so its purpose is
|
|
12
12
|
* announced to assistive technology.
|
|
13
13
|
*/
|
|
14
|
-
const Progress = (0, react.forwardRef)(function Progress({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-valuetext": ariaValueText, className, indeterminate = false, label, max = 100, value = 0, ...props }, ref) {
|
|
14
|
+
const Progress = (0, react.forwardRef)(function Progress({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-valuetext": ariaValueText, className, format, getAriaValueText, indeterminate = false, label, locale, max = 100, value = 0, valueLabel, ...props }, ref) {
|
|
15
15
|
const labelId = (0, react.useId)();
|
|
16
16
|
const maximum = Number.isFinite(max) && max > 0 ? max : 100;
|
|
17
17
|
const currentValue = clamp(value ?? 0, maximum);
|
|
18
18
|
const percentage = currentValue / maximum * 100;
|
|
19
|
+
const formattedValue = new Intl.NumberFormat(locale, format).format(currentValue);
|
|
20
|
+
const computedValueText = getAriaValueText?.(formattedValue, currentValue);
|
|
19
21
|
const hasVisibleLabel = label !== null && label !== void 0;
|
|
20
22
|
const labelledBy = ariaLabelledBy ?? (ariaLabel || !hasVisibleLabel ? void 0 : labelId);
|
|
21
23
|
const accessibleLabel = ariaLabel ?? (labelledBy ? void 0 : "Progress");
|
|
@@ -29,17 +31,27 @@ const Progress = (0, react.forwardRef)(function Progress({ "aria-label": ariaLab
|
|
|
29
31
|
"aria-valuemax": maximum,
|
|
30
32
|
"aria-valuemin": 0,
|
|
31
33
|
"aria-valuenow": indeterminate ? void 0 : currentValue,
|
|
32
|
-
"aria-valuetext": ariaValueText,
|
|
34
|
+
"aria-valuetext": ariaValueText ?? computedValueText,
|
|
33
35
|
className: require_cx.cx(styles.root, className),
|
|
34
36
|
"data-indeterminate": indeterminate || void 0,
|
|
35
37
|
"data-jaci-component": "progress",
|
|
36
38
|
"data-slot": "progress",
|
|
37
39
|
role: "progressbar",
|
|
38
|
-
children: [hasVisibleLabel ? /* @__PURE__ */ (0, react_jsx_runtime.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
children: [hasVisibleLabel || valueLabel !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
41
|
+
style: {
|
|
42
|
+
display: "flex",
|
|
43
|
+
minWidth: 0
|
|
44
|
+
},
|
|
45
|
+
children: [hasVisibleLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
46
|
+
className: styles.label,
|
|
47
|
+
"data-slot": "progress-label",
|
|
48
|
+
id: labelId,
|
|
49
|
+
children: label
|
|
50
|
+
}) : null, valueLabel !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
51
|
+
className: styles.value,
|
|
52
|
+
"data-slot": "progress-value",
|
|
53
|
+
children: valueLabel
|
|
54
|
+
}) : null]
|
|
43
55
|
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
44
56
|
"aria-hidden": "true",
|
|
45
57
|
className: styles.track,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.cjs","names":["progress","cx"],"sources":["../../../src/components/progress/progress.tsx"],"sourcesContent":["import { forwardRef, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { progress } from \"../../styled-system/recipes\";\n\nfunction clamp(value: number, maximum: number) {\n if (!Number.isFinite(value)) {\n return 0;\n }\n\n return Math.min(Math.max(value, 0), maximum);\n}\n\nexport interface ProgressProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The current amount. Omit it, or set `indeterminate`, when it is unknown. */\n value?: number | null;\n /** The value that represents completion. Defaults to 100. */\n max?: number;\n /** Omits `aria-valuenow` and renders an in-progress visual state. */\n indeterminate?: boolean;\n /** A visible, automatically associated accessible label. */\n label?: ReactNode;\n}\n\n/**\n * A semantic progress bar. Provide `label` or `aria-label` so its purpose is\n * announced to assistive technology.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-valuetext\": ariaValueText,\n className,\n indeterminate = false,\n label,\n max = 100,\n value = 0,\n ...props\n },\n ref,\n) {\n const labelId = useId();\n const maximum = Number.isFinite(max) && max > 0 ? max : 100;\n const currentValue = clamp(value ?? 0, maximum);\n const percentage = (currentValue / maximum) * 100;\n const hasVisibleLabel = label !== null && label !== undefined;\n const labelledBy = ariaLabelledBy ?? (ariaLabel || !hasVisibleLabel ? undefined : labelId);\n const accessibleLabel = ariaLabel ?? (labelledBy ? undefined : \"Progress\");\n const styles = progress({ indeterminate });\n\n return (\n <div\n {...props}\n ref={ref}\n aria-busy={indeterminate || undefined}\n aria-label={accessibleLabel}\n aria-labelledby={labelledBy}\n aria-valuemax={maximum}\n aria-valuemin={0}\n aria-valuenow={indeterminate ? undefined : currentValue}\n aria-valuetext={ariaValueText}\n className={cx(styles.root, className)}\n data-indeterminate={indeterminate || undefined}\n data-jaci-component=\"progress\"\n data-slot=\"progress\"\n role=\"progressbar\"\n >\n {hasVisibleLabel ? (\n <span className={styles.label} data-slot=\"progress-label\" id={labelId}>\n
|
|
1
|
+
{"version":3,"file":"progress.cjs","names":["progress","cx"],"sources":["../../../src/components/progress/progress.tsx"],"sourcesContent":["import { forwardRef, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { progress } from \"../../styled-system/recipes\";\n\nfunction clamp(value: number, maximum: number) {\n if (!Number.isFinite(value)) {\n return 0;\n }\n\n return Math.min(Math.max(value, 0), maximum);\n}\n\nexport interface ProgressProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The current amount. Omit it, or set `indeterminate`, when it is unknown. */\n value?: number | null;\n /** The value that represents completion. Defaults to 100. */\n max?: number;\n /** Omits `aria-valuenow` and renders an in-progress visual state. */\n indeterminate?: boolean;\n /** A visible, automatically associated accessible label. */\n label?: ReactNode;\n valueLabel?: ReactNode;\n locale?: Intl.LocalesArgument;\n format?: Intl.NumberFormatOptions;\n getAriaValueText?: (formattedValue: string, value: number) => string;\n}\n\n/**\n * A semantic progress bar. Provide `label` or `aria-label` so its purpose is\n * announced to assistive technology.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-valuetext\": ariaValueText,\n className,\n format,\n getAriaValueText,\n indeterminate = false,\n label,\n locale,\n max = 100,\n value = 0,\n valueLabel,\n ...props\n },\n ref,\n) {\n const labelId = useId();\n const maximum = Number.isFinite(max) && max > 0 ? max : 100;\n const currentValue = clamp(value ?? 0, maximum);\n const percentage = (currentValue / maximum) * 100;\n const formattedValue = new Intl.NumberFormat(locale, format).format(currentValue);\n const computedValueText = getAriaValueText?.(formattedValue, currentValue);\n const hasVisibleLabel = label !== null && label !== undefined;\n const labelledBy = ariaLabelledBy ?? (ariaLabel || !hasVisibleLabel ? undefined : labelId);\n const accessibleLabel = ariaLabel ?? (labelledBy ? undefined : \"Progress\");\n const styles = progress({ indeterminate });\n\n return (\n <div\n {...props}\n ref={ref}\n aria-busy={indeterminate || undefined}\n aria-label={accessibleLabel}\n aria-labelledby={labelledBy}\n aria-valuemax={maximum}\n aria-valuemin={0}\n aria-valuenow={indeterminate ? undefined : currentValue}\n aria-valuetext={ariaValueText ?? computedValueText}\n className={cx(styles.root, className)}\n data-indeterminate={indeterminate || undefined}\n data-jaci-component=\"progress\"\n data-slot=\"progress\"\n role=\"progressbar\"\n >\n {hasVisibleLabel || valueLabel !== undefined ? (\n <div style={{ display: \"flex\", minWidth: 0 }}>\n {hasVisibleLabel ? (\n <span className={styles.label} data-slot=\"progress-label\" id={labelId}>\n {label}\n </span>\n ) : null}\n {valueLabel !== undefined ? (\n <span className={styles.value} data-slot=\"progress-value\">\n {valueLabel}\n </span>\n ) : null}\n </div>\n ) : null}\n <div aria-hidden=\"true\" className={styles.track} data-slot=\"progress-track\">\n <div\n className={styles.indicator}\n data-indeterminate={indeterminate || undefined}\n data-slot=\"progress-indicator\"\n style={indeterminate ? undefined : { width: `${percentage}%` }}\n />\n </div>\n </div>\n );\n});\n"],"mappings":";;;;;AAMA,SAAS,MAAM,OAAe,SAAiB;CAC7C,IAAI,CAAC,OAAO,SAAS,KAAK,GACxB,OAAO;CAGT,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,OAAO;AAC7C;;;;;AAqBA,MAAa,YAAA,GAAA,MAAA,WAAA,CAAqD,SAAS,SACzE,EACE,cAAc,WACd,mBAAmB,gBACnB,kBAAkB,eAClB,WACA,QACA,kBACA,gBAAgB,OAChB,OACA,QACA,MAAM,KACN,QAAQ,GACR,YACA,GAAG,SAEL,KACA;CACA,MAAM,WAAA,GAAA,MAAA,MAAA,CAAgB;CACtB,MAAM,UAAU,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;CACxD,MAAM,eAAe,MAAM,SAAS,GAAG,OAAO;CAC9C,MAAM,aAAc,eAAe,UAAW;CAC9C,MAAM,iBAAiB,IAAI,KAAK,aAAa,QAAQ,MAAM,CAAC,CAAC,OAAO,YAAY;CAChF,MAAM,oBAAoB,mBAAmB,gBAAgB,YAAY;CACzE,MAAM,kBAAkB,UAAU,QAAQ,UAAU,KAAA;CACpD,MAAM,aAAa,mBAAmB,aAAa,CAAC,kBAAkB,KAAA,IAAY;CAClF,MAAM,kBAAkB,cAAc,aAAa,KAAA,IAAY;CAC/D,MAAM,SAASA,iBAAAA,SAAS,EAAE,cAAc,CAAC;CAEzC,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,aAAW,iBAAiB,KAAA;EAC5B,cAAY;EACZ,mBAAiB;EACjB,iBAAe;EACf,iBAAe;EACf,iBAAe,gBAAgB,KAAA,IAAY;EAC3C,kBAAgB,iBAAiB;EACjC,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,sBAAoB,iBAAiB,KAAA;EACrC,uBAAoB;EACpB,aAAU;EACV,MAAK;YAdP,CAgBG,mBAAmB,eAAe,KAAA,IACjC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,OAAO;IAAE,SAAS;IAAQ,UAAU;GAAE;aAA3C,CACG,kBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAW,OAAO;IAAO,aAAU;IAAiB,IAAI;cAC3D;GACG,CAAA,IACJ,MACH,eAAe,KAAA,IACd,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAW,OAAO;IAAO,aAAU;cACtC;GACG,CAAA,IACJ,IACD;OACH,MACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,eAAY;GAAO,WAAW,OAAO;GAAO,aAAU;aACzD,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACE,WAAW,OAAO;IAClB,sBAAoB,iBAAiB,KAAA;IACrC,aAAU;IACV,OAAO,gBAAgB,KAAA,IAAY,EAAE,OAAO,GAAG,WAAW,GAAG;GAC9D,CAAA;EACE,CAAA,CACF;;AAET,CAAC"}
|
|
@@ -9,6 +9,10 @@ interface ProgressProps extends Omit<ComponentPropsWithoutRef<"div">, "children"
|
|
|
9
9
|
indeterminate?: boolean;
|
|
10
10
|
/** A visible, automatically associated accessible label. */
|
|
11
11
|
label?: ReactNode;
|
|
12
|
+
valueLabel?: ReactNode;
|
|
13
|
+
locale?: Intl.LocalesArgument;
|
|
14
|
+
format?: Intl.NumberFormatOptions;
|
|
15
|
+
getAriaValueText?: (formattedValue: string, value: number) => string;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* A semantic progress bar. Provide `label` or `aria-label` so its purpose is
|
|
@@ -9,6 +9,10 @@ interface ProgressProps extends Omit<ComponentPropsWithoutRef<"div">, "children"
|
|
|
9
9
|
indeterminate?: boolean;
|
|
10
10
|
/** A visible, automatically associated accessible label. */
|
|
11
11
|
label?: ReactNode;
|
|
12
|
+
valueLabel?: ReactNode;
|
|
13
|
+
locale?: Intl.LocalesArgument;
|
|
14
|
+
format?: Intl.NumberFormatOptions;
|
|
15
|
+
getAriaValueText?: (formattedValue: string, value: number) => string;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* A semantic progress bar. Provide `label` or `aria-label` so its purpose is
|
|
@@ -11,11 +11,13 @@ function clamp(value, maximum) {
|
|
|
11
11
|
* A semantic progress bar. Provide `label` or `aria-label` so its purpose is
|
|
12
12
|
* announced to assistive technology.
|
|
13
13
|
*/
|
|
14
|
-
const Progress = forwardRef(function Progress({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-valuetext": ariaValueText, className, indeterminate = false, label, max = 100, value = 0, ...props }, ref) {
|
|
14
|
+
const Progress = forwardRef(function Progress({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-valuetext": ariaValueText, className, format, getAriaValueText, indeterminate = false, label, locale, max = 100, value = 0, valueLabel, ...props }, ref) {
|
|
15
15
|
const labelId = useId();
|
|
16
16
|
const maximum = Number.isFinite(max) && max > 0 ? max : 100;
|
|
17
17
|
const currentValue = clamp(value ?? 0, maximum);
|
|
18
18
|
const percentage = currentValue / maximum * 100;
|
|
19
|
+
const formattedValue = new Intl.NumberFormat(locale, format).format(currentValue);
|
|
20
|
+
const computedValueText = getAriaValueText?.(formattedValue, currentValue);
|
|
19
21
|
const hasVisibleLabel = label !== null && label !== void 0;
|
|
20
22
|
const labelledBy = ariaLabelledBy ?? (ariaLabel || !hasVisibleLabel ? void 0 : labelId);
|
|
21
23
|
const accessibleLabel = ariaLabel ?? (labelledBy ? void 0 : "Progress");
|
|
@@ -29,17 +31,27 @@ const Progress = forwardRef(function Progress({ "aria-label": ariaLabel, "aria-l
|
|
|
29
31
|
"aria-valuemax": maximum,
|
|
30
32
|
"aria-valuemin": 0,
|
|
31
33
|
"aria-valuenow": indeterminate ? void 0 : currentValue,
|
|
32
|
-
"aria-valuetext": ariaValueText,
|
|
34
|
+
"aria-valuetext": ariaValueText ?? computedValueText,
|
|
33
35
|
className: cx(styles.root, className),
|
|
34
36
|
"data-indeterminate": indeterminate || void 0,
|
|
35
37
|
"data-jaci-component": "progress",
|
|
36
38
|
"data-slot": "progress",
|
|
37
39
|
role: "progressbar",
|
|
38
|
-
children: [hasVisibleLabel ? /* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
children: [hasVisibleLabel || valueLabel !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
style: {
|
|
42
|
+
display: "flex",
|
|
43
|
+
minWidth: 0
|
|
44
|
+
},
|
|
45
|
+
children: [hasVisibleLabel ? /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: styles.label,
|
|
47
|
+
"data-slot": "progress-label",
|
|
48
|
+
id: labelId,
|
|
49
|
+
children: label
|
|
50
|
+
}) : null, valueLabel !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: styles.value,
|
|
52
|
+
"data-slot": "progress-value",
|
|
53
|
+
children: valueLabel
|
|
54
|
+
}) : null]
|
|
43
55
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
44
56
|
"aria-hidden": "true",
|
|
45
57
|
className: styles.track,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","names":[],"sources":["../../../src/components/progress/progress.tsx"],"sourcesContent":["import { forwardRef, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { progress } from \"../../styled-system/recipes\";\n\nfunction clamp(value: number, maximum: number) {\n if (!Number.isFinite(value)) {\n return 0;\n }\n\n return Math.min(Math.max(value, 0), maximum);\n}\n\nexport interface ProgressProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The current amount. Omit it, or set `indeterminate`, when it is unknown. */\n value?: number | null;\n /** The value that represents completion. Defaults to 100. */\n max?: number;\n /** Omits `aria-valuenow` and renders an in-progress visual state. */\n indeterminate?: boolean;\n /** A visible, automatically associated accessible label. */\n label?: ReactNode;\n}\n\n/**\n * A semantic progress bar. Provide `label` or `aria-label` so its purpose is\n * announced to assistive technology.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-valuetext\": ariaValueText,\n className,\n indeterminate = false,\n label,\n max = 100,\n value = 0,\n ...props\n },\n ref,\n) {\n const labelId = useId();\n const maximum = Number.isFinite(max) && max > 0 ? max : 100;\n const currentValue = clamp(value ?? 0, maximum);\n const percentage = (currentValue / maximum) * 100;\n const hasVisibleLabel = label !== null && label !== undefined;\n const labelledBy = ariaLabelledBy ?? (ariaLabel || !hasVisibleLabel ? undefined : labelId);\n const accessibleLabel = ariaLabel ?? (labelledBy ? undefined : \"Progress\");\n const styles = progress({ indeterminate });\n\n return (\n <div\n {...props}\n ref={ref}\n aria-busy={indeterminate || undefined}\n aria-label={accessibleLabel}\n aria-labelledby={labelledBy}\n aria-valuemax={maximum}\n aria-valuemin={0}\n aria-valuenow={indeterminate ? undefined : currentValue}\n aria-valuetext={ariaValueText}\n className={cx(styles.root, className)}\n data-indeterminate={indeterminate || undefined}\n data-jaci-component=\"progress\"\n data-slot=\"progress\"\n role=\"progressbar\"\n >\n {hasVisibleLabel ? (\n <span className={styles.label} data-slot=\"progress-label\" id={labelId}>\n
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../../../src/components/progress/progress.tsx"],"sourcesContent":["import { forwardRef, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { progress } from \"../../styled-system/recipes\";\n\nfunction clamp(value: number, maximum: number) {\n if (!Number.isFinite(value)) {\n return 0;\n }\n\n return Math.min(Math.max(value, 0), maximum);\n}\n\nexport interface ProgressProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The current amount. Omit it, or set `indeterminate`, when it is unknown. */\n value?: number | null;\n /** The value that represents completion. Defaults to 100. */\n max?: number;\n /** Omits `aria-valuenow` and renders an in-progress visual state. */\n indeterminate?: boolean;\n /** A visible, automatically associated accessible label. */\n label?: ReactNode;\n valueLabel?: ReactNode;\n locale?: Intl.LocalesArgument;\n format?: Intl.NumberFormatOptions;\n getAriaValueText?: (formattedValue: string, value: number) => string;\n}\n\n/**\n * A semantic progress bar. Provide `label` or `aria-label` so its purpose is\n * announced to assistive technology.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-valuetext\": ariaValueText,\n className,\n format,\n getAriaValueText,\n indeterminate = false,\n label,\n locale,\n max = 100,\n value = 0,\n valueLabel,\n ...props\n },\n ref,\n) {\n const labelId = useId();\n const maximum = Number.isFinite(max) && max > 0 ? max : 100;\n const currentValue = clamp(value ?? 0, maximum);\n const percentage = (currentValue / maximum) * 100;\n const formattedValue = new Intl.NumberFormat(locale, format).format(currentValue);\n const computedValueText = getAriaValueText?.(formattedValue, currentValue);\n const hasVisibleLabel = label !== null && label !== undefined;\n const labelledBy = ariaLabelledBy ?? (ariaLabel || !hasVisibleLabel ? undefined : labelId);\n const accessibleLabel = ariaLabel ?? (labelledBy ? undefined : \"Progress\");\n const styles = progress({ indeterminate });\n\n return (\n <div\n {...props}\n ref={ref}\n aria-busy={indeterminate || undefined}\n aria-label={accessibleLabel}\n aria-labelledby={labelledBy}\n aria-valuemax={maximum}\n aria-valuemin={0}\n aria-valuenow={indeterminate ? undefined : currentValue}\n aria-valuetext={ariaValueText ?? computedValueText}\n className={cx(styles.root, className)}\n data-indeterminate={indeterminate || undefined}\n data-jaci-component=\"progress\"\n data-slot=\"progress\"\n role=\"progressbar\"\n >\n {hasVisibleLabel || valueLabel !== undefined ? (\n <div style={{ display: \"flex\", minWidth: 0 }}>\n {hasVisibleLabel ? (\n <span className={styles.label} data-slot=\"progress-label\" id={labelId}>\n {label}\n </span>\n ) : null}\n {valueLabel !== undefined ? (\n <span className={styles.value} data-slot=\"progress-value\">\n {valueLabel}\n </span>\n ) : null}\n </div>\n ) : null}\n <div aria-hidden=\"true\" className={styles.track} data-slot=\"progress-track\">\n <div\n className={styles.indicator}\n data-indeterminate={indeterminate || undefined}\n data-slot=\"progress-indicator\"\n style={indeterminate ? undefined : { width: `${percentage}%` }}\n />\n </div>\n </div>\n );\n});\n"],"mappings":";;;;;AAMA,SAAS,MAAM,OAAe,SAAiB;CAC7C,IAAI,CAAC,OAAO,SAAS,KAAK,GACxB,OAAO;CAGT,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,OAAO;AAC7C;;;;;AAqBA,MAAa,WAAW,WAA0C,SAAS,SACzE,EACE,cAAc,WACd,mBAAmB,gBACnB,kBAAkB,eAClB,WACA,QACA,kBACA,gBAAgB,OAChB,OACA,QACA,MAAM,KACN,QAAQ,GACR,YACA,GAAG,SAEL,KACA;CACA,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;CACxD,MAAM,eAAe,MAAM,SAAS,GAAG,OAAO;CAC9C,MAAM,aAAc,eAAe,UAAW;CAC9C,MAAM,iBAAiB,IAAI,KAAK,aAAa,QAAQ,MAAM,CAAC,CAAC,OAAO,YAAY;CAChF,MAAM,oBAAoB,mBAAmB,gBAAgB,YAAY;CACzE,MAAM,kBAAkB,UAAU,QAAQ,UAAU,KAAA;CACpD,MAAM,aAAa,mBAAmB,aAAa,CAAC,kBAAkB,KAAA,IAAY;CAClF,MAAM,kBAAkB,cAAc,aAAa,KAAA,IAAY;CAC/D,MAAM,SAAS,SAAS,EAAE,cAAc,CAAC;CAEzC,OACE,qBAAC,OAAD;EACE,GAAI;EACC;EACL,aAAW,iBAAiB,KAAA;EAC5B,cAAY;EACZ,mBAAiB;EACjB,iBAAe;EACf,iBAAe;EACf,iBAAe,gBAAgB,KAAA,IAAY;EAC3C,kBAAgB,iBAAiB;EACjC,WAAW,GAAG,OAAO,MAAM,SAAS;EACpC,sBAAoB,iBAAiB,KAAA;EACrC,uBAAoB;EACpB,aAAU;EACV,MAAK;YAdP,CAgBG,mBAAmB,eAAe,KAAA,IACjC,qBAAC,OAAD;GAAK,OAAO;IAAE,SAAS;IAAQ,UAAU;GAAE;aAA3C,CACG,kBACC,oBAAC,QAAD;IAAM,WAAW,OAAO;IAAO,aAAU;IAAiB,IAAI;cAC3D;GACG,CAAA,IACJ,MACH,eAAe,KAAA,IACd,oBAAC,QAAD;IAAM,WAAW,OAAO;IAAO,aAAU;cACtC;GACG,CAAA,IACJ,IACD;OACH,MACJ,oBAAC,OAAD;GAAK,eAAY;GAAO,WAAW,OAAO;GAAO,aAAU;aACzD,oBAAC,OAAD;IACE,WAAW,OAAO;IAClB,sBAAoB,iBAAiB,KAAA;IACrC,aAAU;IACV,OAAO,gBAAgB,KAAA,IAAY,EAAE,OAAO,GAAG,WAAW,GAAG;GAC9D,CAAA;EACE,CAAA,CACF;;AAET,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
2
|
+
const require_quote = require("../../styled-system/recipes/quote.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
//#region src/components/quote/quote.tsx
|
|
6
|
+
/** A semantic blockquote with optional author and source attribution. */
|
|
7
|
+
const Quote = (0, react.forwardRef)(function Quote({ author, children, className, size = "md", source, variant = "default", ...props }, ref) {
|
|
8
|
+
const hasAttribution = author !== void 0 || source !== void 0;
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("blockquote", {
|
|
10
|
+
...props,
|
|
11
|
+
ref,
|
|
12
|
+
className: require_cx.cx(require_quote.quote({
|
|
13
|
+
size,
|
|
14
|
+
variant
|
|
15
|
+
}), className),
|
|
16
|
+
"data-jaci-component": "quote",
|
|
17
|
+
"data-size": size,
|
|
18
|
+
"data-slot": "quote",
|
|
19
|
+
"data-variant": variant,
|
|
20
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21
|
+
"data-slot": "quote-content",
|
|
22
|
+
children
|
|
23
|
+
}), hasAttribution ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
24
|
+
"data-slot": "quote-footer",
|
|
25
|
+
children: [author !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
26
|
+
"data-slot": "quote-author",
|
|
27
|
+
children: author
|
|
28
|
+
}) : null, source !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("cite", {
|
|
29
|
+
"data-slot": "quote-source",
|
|
30
|
+
children: source
|
|
31
|
+
}) : null]
|
|
32
|
+
}) : null]
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.Quote = Quote;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=quote.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.cjs","names":["cx","quote"],"sources":["../../../src/components/quote/quote.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { quote } from \"../../styled-system/recipes\";\n\nexport type QuoteVariant = \"default\" | \"accent\" | \"subtle\";\nexport type QuoteSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface QuoteProps extends ComponentPropsWithoutRef<\"blockquote\"> {\n /** Visual treatment for the quote surface and leading border. */\n variant?: QuoteVariant;\n /** Typography scale for the quoted content. */\n size?: QuoteSize;\n /** Optional author rendered in a semantic footer. */\n author?: ReactNode;\n /** Optional source rendered as a semantic `<cite>`. */\n source?: ReactNode;\n}\n\n/** A semantic blockquote with optional author and source attribution. */\nexport const Quote = forwardRef<HTMLQuoteElement, QuoteProps>(function Quote(\n { author, children, className, size = \"md\", source, variant = \"default\", ...props },\n ref,\n) {\n const hasAttribution = author !== undefined || source !== undefined;\n\n return (\n <blockquote\n {...props}\n ref={ref}\n className={cx(quote({ size, variant }), className)}\n data-jaci-component=\"quote\"\n data-size={size}\n data-slot=\"quote\"\n data-variant={variant}\n >\n <div data-slot=\"quote-content\">{children}</div>\n {hasAttribution ? (\n <footer data-slot=\"quote-footer\">\n {author !== undefined ? <span data-slot=\"quote-author\">{author}</span> : null}\n {source !== undefined ? <cite data-slot=\"quote-source\">{source}</cite> : null}\n </footer>\n ) : null}\n </blockquote>\n );\n});\n"],"mappings":";;;;;;AAqBA,MAAa,SAAA,GAAA,MAAA,WAAA,CAAiD,SAAS,MACrE,EAAE,QAAQ,UAAU,WAAW,OAAO,MAAM,QAAQ,UAAU,WAAW,GAAG,SAC5E,KACA;CACA,MAAM,iBAAiB,WAAW,KAAA,KAAa,WAAW,KAAA;CAE1D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,cAAD;EACE,GAAI;EACC;EACL,WAAWA,WAAAA,GAAGC,cAAAA,MAAM;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACjD,uBAAoB;EACpB,aAAW;EACX,aAAU;EACV,gBAAc;YAPhB,CASE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,aAAU;GAAiB;EAAc,CAAA,GAC7C,iBACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;GAAQ,aAAU;aAAlB,CACG,WAAW,KAAA,IAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,aAAU;cAAgB;GAAa,CAAA,IAAI,MACxE,WAAW,KAAA,IAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,aAAU;cAAgB;GAAa,CAAA,IAAI,IACnE;OACN,IACM;;AAEhB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
//#region src/components/quote/quote.d.ts
|
|
3
|
+
type QuoteVariant = "default" | "accent" | "subtle";
|
|
4
|
+
type QuoteSize = "sm" | "md" | "lg";
|
|
5
|
+
interface QuoteProps extends ComponentPropsWithoutRef<"blockquote"> {
|
|
6
|
+
/** Visual treatment for the quote surface and leading border. */
|
|
7
|
+
variant?: QuoteVariant;
|
|
8
|
+
/** Typography scale for the quoted content. */
|
|
9
|
+
size?: QuoteSize;
|
|
10
|
+
/** Optional author rendered in a semantic footer. */
|
|
11
|
+
author?: ReactNode;
|
|
12
|
+
/** Optional source rendered as a semantic `<cite>`. */
|
|
13
|
+
source?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/** A semantic blockquote with optional author and source attribution. */
|
|
16
|
+
declare const Quote: import("react").ForwardRefExoticComponent<QuoteProps & import("react").RefAttributes<HTMLQuoteElement>>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Quote, QuoteProps, QuoteSize, QuoteVariant };
|
|
19
|
+
//# sourceMappingURL=quote.d.cts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
//#region src/components/quote/quote.d.ts
|
|
3
|
+
type QuoteVariant = "default" | "accent" | "subtle";
|
|
4
|
+
type QuoteSize = "sm" | "md" | "lg";
|
|
5
|
+
interface QuoteProps extends ComponentPropsWithoutRef<"blockquote"> {
|
|
6
|
+
/** Visual treatment for the quote surface and leading border. */
|
|
7
|
+
variant?: QuoteVariant;
|
|
8
|
+
/** Typography scale for the quoted content. */
|
|
9
|
+
size?: QuoteSize;
|
|
10
|
+
/** Optional author rendered in a semantic footer. */
|
|
11
|
+
author?: ReactNode;
|
|
12
|
+
/** Optional source rendered as a semantic `<cite>`. */
|
|
13
|
+
source?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/** A semantic blockquote with optional author and source attribution. */
|
|
16
|
+
declare const Quote: import("react").ForwardRefExoticComponent<QuoteProps & import("react").RefAttributes<HTMLQuoteElement>>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Quote, QuoteProps, QuoteSize, QuoteVariant };
|
|
19
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cx } from "../../styled-system/css/cx.js";
|
|
2
|
+
import { quote } from "../../styled-system/recipes/quote.js";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/quote/quote.tsx
|
|
6
|
+
/** A semantic blockquote with optional author and source attribution. */
|
|
7
|
+
const Quote = forwardRef(function Quote({ author, children, className, size = "md", source, variant = "default", ...props }, ref) {
|
|
8
|
+
const hasAttribution = author !== void 0 || source !== void 0;
|
|
9
|
+
return /* @__PURE__ */ jsxs("blockquote", {
|
|
10
|
+
...props,
|
|
11
|
+
ref,
|
|
12
|
+
className: cx(quote({
|
|
13
|
+
size,
|
|
14
|
+
variant
|
|
15
|
+
}), className),
|
|
16
|
+
"data-jaci-component": "quote",
|
|
17
|
+
"data-size": size,
|
|
18
|
+
"data-slot": "quote",
|
|
19
|
+
"data-variant": variant,
|
|
20
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
21
|
+
"data-slot": "quote-content",
|
|
22
|
+
children
|
|
23
|
+
}), hasAttribution ? /* @__PURE__ */ jsxs("footer", {
|
|
24
|
+
"data-slot": "quote-footer",
|
|
25
|
+
children: [author !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
26
|
+
"data-slot": "quote-author",
|
|
27
|
+
children: author
|
|
28
|
+
}) : null, source !== void 0 ? /* @__PURE__ */ jsx("cite", {
|
|
29
|
+
"data-slot": "quote-source",
|
|
30
|
+
children: source
|
|
31
|
+
}) : null]
|
|
32
|
+
}) : null]
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Quote };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=quote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.js","names":[],"sources":["../../../src/components/quote/quote.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { quote } from \"../../styled-system/recipes\";\n\nexport type QuoteVariant = \"default\" | \"accent\" | \"subtle\";\nexport type QuoteSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface QuoteProps extends ComponentPropsWithoutRef<\"blockquote\"> {\n /** Visual treatment for the quote surface and leading border. */\n variant?: QuoteVariant;\n /** Typography scale for the quoted content. */\n size?: QuoteSize;\n /** Optional author rendered in a semantic footer. */\n author?: ReactNode;\n /** Optional source rendered as a semantic `<cite>`. */\n source?: ReactNode;\n}\n\n/** A semantic blockquote with optional author and source attribution. */\nexport const Quote = forwardRef<HTMLQuoteElement, QuoteProps>(function Quote(\n { author, children, className, size = \"md\", source, variant = \"default\", ...props },\n ref,\n) {\n const hasAttribution = author !== undefined || source !== undefined;\n\n return (\n <blockquote\n {...props}\n ref={ref}\n className={cx(quote({ size, variant }), className)}\n data-jaci-component=\"quote\"\n data-size={size}\n data-slot=\"quote\"\n data-variant={variant}\n >\n <div data-slot=\"quote-content\">{children}</div>\n {hasAttribution ? (\n <footer data-slot=\"quote-footer\">\n {author !== undefined ? <span data-slot=\"quote-author\">{author}</span> : null}\n {source !== undefined ? <cite data-slot=\"quote-source\">{source}</cite> : null}\n </footer>\n ) : null}\n </blockquote>\n );\n});\n"],"mappings":";;;;;;AAqBA,MAAa,QAAQ,WAAyC,SAAS,MACrE,EAAE,QAAQ,UAAU,WAAW,OAAO,MAAM,QAAQ,UAAU,WAAW,GAAG,SAC5E,KACA;CACA,MAAM,iBAAiB,WAAW,KAAA,KAAa,WAAW,KAAA;CAE1D,OACE,qBAAC,cAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,MAAM;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACjD,uBAAoB;EACpB,aAAW;EACX,aAAU;EACV,gBAAc;YAPhB,CASE,oBAAC,OAAD;GAAK,aAAU;GAAiB;EAAc,CAAA,GAC7C,iBACC,qBAAC,UAAD;GAAQ,aAAU;aAAlB,CACG,WAAW,KAAA,IAAY,oBAAC,QAAD;IAAM,aAAU;cAAgB;GAAa,CAAA,IAAI,MACxE,WAAW,KAAA,IAAY,oBAAC,QAAD;IAAM,aAAU;cAAgB;GAAa,CAAA,IAAI,IACnE;OACN,IACM;;AAEhB,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
3
3
|
const require_base_ui = require("../base-ui.cjs");
|
|
4
4
|
const require_select = require("../../styled-system/recipes/select.cjs");
|
|
5
|
+
const require_theme_scope = require("../../theme/theme-scope.cjs");
|
|
5
6
|
let react = require("react");
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
let _base_ui_react_select = require("@base-ui/react/select");
|
|
@@ -80,7 +81,9 @@ const SelectIcon = (0, react.forwardRef)(function SelectIcon({ children = "⌄",
|
|
|
80
81
|
});
|
|
81
82
|
});
|
|
82
83
|
/** Preserves Base UI's optional portal container and mount controls. */
|
|
83
|
-
|
|
84
|
+
function SelectPortal(props) {
|
|
85
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Portal, { ...require_theme_scope.useThemePortalProps(props) });
|
|
86
|
+
}
|
|
84
87
|
const SelectPositioner = (0, react.forwardRef)(function SelectPositioner({ className, ...props }, ref) {
|
|
85
88
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Positioner, {
|
|
86
89
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.cjs","names":["select","BaseSelect","withRecipeClassName","cx"],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["\"use client\";\n\nimport { Select as BaseSelect } from \"@base-ui/react/select\";\nimport { createContext, forwardRef, useContext, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport type { SelectRoot as BaseSelectRoot } from \"@base-ui/react/select\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { select } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type SelectSize = \"sm\" | \"md\" | \"lg\";\n\nconst SelectSizeContext = createContext<SelectSize>(\"md\");\nconst SelectAuxContext = createContext<{ clear: () => void; disabled: boolean } | null>(null);\n\nfunction useSelectStyles() {\n return select({ size: useContext(SelectSizeContext) });\n}\n\n/**\n * Groups an accessible listbox select. Use `value`/`onValueChange` for a\n * controlled selection, or `defaultValue` for an uncontrolled selection.\n *\n * `size` is shared by all visual parts so the trigger stays aligned with the\n * library's `Input` component.\n */\nexport interface SelectRootProps<Value, Multiple extends boolean | undefined = false>\n extends BaseSelectRoot.Props<Value, Multiple> {\n size?: SelectSize;\n loading?: boolean;\n}\n\nexport function SelectRoot<Value = unknown, Multiple extends boolean | undefined = false>({\n defaultValue,\n disabled = false,\n loading: _loading,\n multiple,\n onValueChange,\n size = \"md\",\n value: controlledValue,\n ...props\n}: SelectRootProps<Value, Multiple>) {\n const [uncontrolledValue, setUncontrolledValue] = useState<unknown>(\n defaultValue ?? (multiple ? [] : null),\n );\n const value = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const clear = () => {\n const nextValue = multiple ? [] : null;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue as never, undefined as never);\n };\n return (\n <SelectSizeContext.Provider value={size}>\n <SelectAuxContext.Provider value={{ clear, disabled }}>\n <BaseSelect.Root\n {...props}\n disabled={disabled}\n defaultValue={undefined}\n multiple={multiple}\n onValueChange={(nextValue, details) => {\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue, details);\n }}\n value={value as SelectRootProps<Value, Multiple>[\"value\"]}\n />\n </SelectAuxContext.Provider>\n </SelectSizeContext.Provider>\n );\n}\n\nexport type SelectLabelProps = ComponentPropsWithoutRef<typeof BaseSelect.Label>;\n\n/** An accessible label that Base UI associates with the trigger automatically. */\nexport const SelectLabel = forwardRef<HTMLDivElement, SelectLabelProps>(function SelectLabel(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Label\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().label, className)}\n data-slot=\"select-label\"\n />\n );\n});\n\nexport type SelectTriggerProps = ComponentPropsWithoutRef<typeof BaseSelect.Trigger>;\n\n/** The button-shaped control that opens the select popup. */\nexport const SelectTrigger = forwardRef<HTMLButtonElement, SelectTriggerProps>(\n function SelectTrigger({ className, ...props }, ref) {\n return (\n <BaseSelect.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().trigger, className)}\n data-jaci-component=\"select\"\n data-slot=\"select-trigger\"\n />\n );\n },\n);\n\nexport type SelectValueProps = ComponentPropsWithoutRef<typeof BaseSelect.Value>;\n\n/** Renders the selected item's label, or its placeholder when empty. */\nexport const SelectValue = forwardRef<HTMLSpanElement, SelectValueProps>(function SelectValue(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Value\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().value, className)}\n data-slot=\"select-value\"\n />\n );\n});\n\nexport type SelectIconProps = ComponentPropsWithoutRef<typeof BaseSelect.Icon>;\n\n/** A small chevron that rotates while the popup is open. */\nexport const SelectIcon = forwardRef<HTMLSpanElement, SelectIconProps>(function SelectIcon(\n { children = \"⌄\", className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Icon\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={withRecipeClassName(useSelectStyles().icon, className)}\n data-slot=\"select-icon\"\n >\n {children}\n </BaseSelect.Icon>\n );\n});\n\n/** Preserves Base UI's optional portal container and mount controls. */\nexport const SelectPortal = BaseSelect.Portal;\n\nexport type SelectPositionerProps = ComponentPropsWithoutRef<typeof BaseSelect.Positioner>;\n\nexport const SelectPositioner = forwardRef<HTMLDivElement, SelectPositionerProps>(\n function SelectPositioner({ className, ...props }, ref) {\n return (\n <BaseSelect.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().positioner, className)}\n data-slot=\"select-positioner\"\n />\n );\n },\n);\n\nexport type SelectPopupProps = ComponentPropsWithoutRef<typeof BaseSelect.Popup>;\n\nexport const SelectPopup = forwardRef<HTMLDivElement, SelectPopupProps>(function SelectPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().popup, className)}\n data-slot=\"select-popup\"\n />\n );\n});\n\nexport type SelectListProps = ComponentPropsWithoutRef<typeof BaseSelect.List>;\n\nexport const SelectList = forwardRef<HTMLDivElement, SelectListProps>(function SelectList(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.List\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().list, className)}\n data-slot=\"select-list\"\n />\n );\n});\n\nexport type SelectItemProps = ComponentPropsWithoutRef<typeof BaseSelect.Item>;\n\nexport const SelectItem = forwardRef<HTMLElement, SelectItemProps>(function SelectItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().item, className)}\n data-slot=\"select-item\"\n />\n );\n});\n\nexport type SelectItemTextProps = ComponentPropsWithoutRef<typeof BaseSelect.ItemText>;\n\nexport const SelectItemText = forwardRef<HTMLDivElement, SelectItemTextProps>(\n function SelectItemText({ className, ...props }, ref) {\n return (\n <BaseSelect.ItemText\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().itemText, className)}\n data-slot=\"select-item-text\"\n />\n );\n },\n);\n\nexport type SelectItemIndicatorProps = ComponentPropsWithoutRef<typeof BaseSelect.ItemIndicator>;\n\nexport const SelectItemIndicator = forwardRef<HTMLSpanElement, SelectItemIndicatorProps>(\n function SelectItemIndicator({ children = \"✓\", className, ...props }, ref) {\n return (\n <BaseSelect.ItemIndicator\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={withRecipeClassName(useSelectStyles().itemIndicator, className)}\n data-slot=\"select-item-indicator\"\n >\n {children}\n </BaseSelect.ItemIndicator>\n );\n },\n);\n\nexport type SelectGroupProps = ComponentPropsWithoutRef<typeof BaseSelect.Group>;\n\nexport const SelectGroup = forwardRef<HTMLDivElement, SelectGroupProps>(function SelectGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().group, className)}\n data-slot=\"select-group\"\n />\n );\n});\n\nexport type SelectGroupLabelProps = ComponentPropsWithoutRef<typeof BaseSelect.GroupLabel>;\n\nexport const SelectGroupLabel = forwardRef<HTMLDivElement, SelectGroupLabelProps>(\n function SelectGroupLabel({ className, ...props }, ref) {\n return (\n <BaseSelect.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().groupLabel, className)}\n data-slot=\"select-group-label\"\n />\n );\n },\n);\n\n/**\n * A visual separator for groups in a listbox. It is intentionally hidden from\n * assistive technology because ARIA listboxes may only contain options or\n * option groups, not semantic separators.\n */\nexport interface SelectSeparatorProps extends ComponentPropsWithoutRef<\"div\"> {\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nexport const SelectSeparator = forwardRef<HTMLDivElement, SelectSeparatorProps>(\n function SelectSeparator({ className, orientation = \"horizontal\", ...props }, ref) {\n return (\n <div\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={cx(useSelectStyles().separator, className)}\n data-orientation={orientation}\n data-slot=\"select-separator\"\n />\n );\n },\n);\n\nexport interface SelectClearProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\nexport const SelectClear = forwardRef<HTMLButtonElement, SelectClearProps>(function SelectClear(\n { children = \"×\", className, ...props },\n ref,\n) {\n const context = useContext(SelectAuxContext);\n const styles = useSelectStyles();\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Clear selection\"}\n className={cx(styles.clear, className)}\n data-slot=\"select-clear\"\n disabled={props.disabled || context?.disabled}\n onClick={(event) => {\n context?.clear();\n props.onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n});\n\nexport type SelectEmptyProps = ComponentPropsWithoutRef<\"div\">;\nexport const SelectEmpty = forwardRef<HTMLDivElement, SelectEmptyProps>(function SelectEmpty(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n className={cx(useSelectStyles().empty, className)}\n data-slot=\"select-empty\"\n ref={ref}\n />\n );\n});\nexport type SelectLoadingProps = ComponentPropsWithoutRef<\"div\">;\nexport const SelectLoading = forwardRef<HTMLDivElement, SelectLoadingProps>(function SelectLoading(\n { children = \"Loading…\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n aria-live=\"polite\"\n className={cx(useSelectStyles().loading, className)}\n data-slot=\"select-loading\"\n ref={ref}\n >\n {children}\n </div>\n );\n});\nexport type SelectStatusProps = ComponentPropsWithoutRef<\"div\">;\nexport const SelectStatus = forwardRef<HTMLDivElement, SelectStatusProps>(function SelectStatus(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n aria-live=\"polite\"\n className={cx(useSelectStyles().status, className)}\n data-slot=\"select-status\"\n ref={ref}\n />\n );\n});\n\nexport const Select = {\n Root: SelectRoot,\n Label: SelectLabel,\n Trigger: SelectTrigger,\n Value: SelectValue,\n Icon: SelectIcon,\n Portal: SelectPortal,\n Positioner: SelectPositioner,\n Popup: SelectPopup,\n List: SelectList,\n Item: SelectItem,\n ItemText: SelectItemText,\n ItemIndicator: SelectItemIndicator,\n Group: SelectGroup,\n GroupLabel: SelectGroupLabel,\n Separator: SelectSeparator,\n Clear: SelectClear,\n Empty: SelectEmpty,\n Loading: SelectLoading,\n Status: SelectStatus,\n};\n"],"mappings":";;;;;;;;AAaA,MAAM,qBAAA,GAAA,MAAA,cAAA,CAA8C,IAAI;AACxD,MAAM,oBAAA,GAAA,MAAA,cAAA,CAAkF,IAAI;AAE5F,SAAS,kBAAkB;CACzB,OAAOA,eAAAA,OAAO,EAAE,OAAA,GAAA,MAAA,WAAA,CAAiB,iBAAiB,EAAE,CAAC;AACvD;AAeA,SAAgB,WAA0E,EACxF,cACA,WAAW,OACX,SAAS,UACT,UACA,eACA,OAAO,MACP,OAAO,iBACP,GAAG,SACgC;CACnC,MAAM,CAAC,mBAAmB,yBAAA,GAAA,MAAA,SAAA,CACxB,iBAAiB,WAAW,CAAC,IAAI,KACnC;CACA,MAAM,QAAQ,oBAAoB,KAAA,IAAY,oBAAoB;CAClE,MAAM,cAAc;EAClB,MAAM,YAAY,WAAW,CAAC,IAAI;EAClC,IAAI,oBAAoB,KAAA,GAAW,qBAAqB,SAAS;EACjE,gBAAgB,WAAoB,KAAA,CAAkB;CACxD;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAkB,UAAnB;EAA4B,OAAO;YACjC,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAiB,UAAlB;GAA2B,OAAO;IAAE;IAAO;GAAS;aAClD,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,OAAW,MAAZ;IACE,GAAI;IACM;IACV,cAAc,KAAA;IACJ;IACV,gBAAgB,WAAW,YAAY;KACrC,IAAI,oBAAoB,KAAA,GAAW,qBAAqB,SAAS;KACjE,gBAAgB,WAAW,OAAO;IACpC;IACO;GACR,CAAA;EACwB,CAAA;CACD,CAAA;AAEhC;;AAKA,MAAa,eAAA,GAAA,MAAA,WAAA,CAA2D,SAAS,YAC/E,EAA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
|
1
|
+
{"version":3,"file":"select.cjs","names":["select","BaseSelect","withRecipeClassName","useThemePortalProps","cx"],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["\"use client\";\n\nimport { Select as BaseSelect } from \"@base-ui/react/select\";\nimport { createContext, forwardRef, useContext, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport type { SelectRoot as BaseSelectRoot } from \"@base-ui/react/select\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { select } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type SelectSize = \"sm\" | \"md\" | \"lg\";\n\nconst SelectSizeContext = createContext<SelectSize>(\"md\");\nconst SelectAuxContext = createContext<{ clear: () => void; disabled: boolean } | null>(null);\n\nfunction useSelectStyles() {\n return select({ size: useContext(SelectSizeContext) });\n}\n\n/**\n * Groups an accessible listbox select. Use `value`/`onValueChange` for a\n * controlled selection, or `defaultValue` for an uncontrolled selection.\n *\n * `size` is shared by all visual parts so the trigger stays aligned with the\n * library's `Input` component.\n */\nexport interface SelectRootProps<Value, Multiple extends boolean | undefined = false>\n extends BaseSelectRoot.Props<Value, Multiple> {\n size?: SelectSize;\n loading?: boolean;\n}\n\nexport function SelectRoot<Value = unknown, Multiple extends boolean | undefined = false>({\n defaultValue,\n disabled = false,\n loading: _loading,\n multiple,\n onValueChange,\n size = \"md\",\n value: controlledValue,\n ...props\n}: SelectRootProps<Value, Multiple>) {\n const [uncontrolledValue, setUncontrolledValue] = useState<unknown>(\n defaultValue ?? (multiple ? [] : null),\n );\n const value = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const clear = () => {\n const nextValue = multiple ? [] : null;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue as never, undefined as never);\n };\n return (\n <SelectSizeContext.Provider value={size}>\n <SelectAuxContext.Provider value={{ clear, disabled }}>\n <BaseSelect.Root\n {...props}\n disabled={disabled}\n defaultValue={undefined}\n multiple={multiple}\n onValueChange={(nextValue, details) => {\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue, details);\n }}\n value={value as SelectRootProps<Value, Multiple>[\"value\"]}\n />\n </SelectAuxContext.Provider>\n </SelectSizeContext.Provider>\n );\n}\n\nexport type SelectLabelProps = ComponentPropsWithoutRef<typeof BaseSelect.Label>;\n\n/** An accessible label that Base UI associates with the trigger automatically. */\nexport const SelectLabel = forwardRef<HTMLDivElement, SelectLabelProps>(function SelectLabel(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Label\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().label, className)}\n data-slot=\"select-label\"\n />\n );\n});\n\nexport type SelectTriggerProps = ComponentPropsWithoutRef<typeof BaseSelect.Trigger>;\n\n/** The button-shaped control that opens the select popup. */\nexport const SelectTrigger = forwardRef<HTMLButtonElement, SelectTriggerProps>(\n function SelectTrigger({ className, ...props }, ref) {\n return (\n <BaseSelect.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().trigger, className)}\n data-jaci-component=\"select\"\n data-slot=\"select-trigger\"\n />\n );\n },\n);\n\nexport type SelectValueProps = ComponentPropsWithoutRef<typeof BaseSelect.Value>;\n\n/** Renders the selected item's label, or its placeholder when empty. */\nexport const SelectValue = forwardRef<HTMLSpanElement, SelectValueProps>(function SelectValue(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Value\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().value, className)}\n data-slot=\"select-value\"\n />\n );\n});\n\nexport type SelectIconProps = ComponentPropsWithoutRef<typeof BaseSelect.Icon>;\n\n/** A small chevron that rotates while the popup is open. */\nexport const SelectIcon = forwardRef<HTMLSpanElement, SelectIconProps>(function SelectIcon(\n { children = \"⌄\", className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Icon\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={withRecipeClassName(useSelectStyles().icon, className)}\n data-slot=\"select-icon\"\n >\n {children}\n </BaseSelect.Icon>\n );\n});\n\n/** Preserves Base UI's optional portal container and mount controls. */\nexport function SelectPortal(props: ComponentPropsWithoutRef<typeof BaseSelect.Portal>) {\n return <BaseSelect.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type SelectPositionerProps = ComponentPropsWithoutRef<typeof BaseSelect.Positioner>;\n\nexport const SelectPositioner = forwardRef<HTMLDivElement, SelectPositionerProps>(\n function SelectPositioner({ className, ...props }, ref) {\n return (\n <BaseSelect.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().positioner, className)}\n data-slot=\"select-positioner\"\n />\n );\n },\n);\n\nexport type SelectPopupProps = ComponentPropsWithoutRef<typeof BaseSelect.Popup>;\n\nexport const SelectPopup = forwardRef<HTMLDivElement, SelectPopupProps>(function SelectPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().popup, className)}\n data-slot=\"select-popup\"\n />\n );\n});\n\nexport type SelectListProps = ComponentPropsWithoutRef<typeof BaseSelect.List>;\n\nexport const SelectList = forwardRef<HTMLDivElement, SelectListProps>(function SelectList(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.List\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().list, className)}\n data-slot=\"select-list\"\n />\n );\n});\n\nexport type SelectItemProps = ComponentPropsWithoutRef<typeof BaseSelect.Item>;\n\nexport const SelectItem = forwardRef<HTMLElement, SelectItemProps>(function SelectItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().item, className)}\n data-slot=\"select-item\"\n />\n );\n});\n\nexport type SelectItemTextProps = ComponentPropsWithoutRef<typeof BaseSelect.ItemText>;\n\nexport const SelectItemText = forwardRef<HTMLDivElement, SelectItemTextProps>(\n function SelectItemText({ className, ...props }, ref) {\n return (\n <BaseSelect.ItemText\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().itemText, className)}\n data-slot=\"select-item-text\"\n />\n );\n },\n);\n\nexport type SelectItemIndicatorProps = ComponentPropsWithoutRef<typeof BaseSelect.ItemIndicator>;\n\nexport const SelectItemIndicator = forwardRef<HTMLSpanElement, SelectItemIndicatorProps>(\n function SelectItemIndicator({ children = \"✓\", className, ...props }, ref) {\n return (\n <BaseSelect.ItemIndicator\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={withRecipeClassName(useSelectStyles().itemIndicator, className)}\n data-slot=\"select-item-indicator\"\n >\n {children}\n </BaseSelect.ItemIndicator>\n );\n },\n);\n\nexport type SelectGroupProps = ComponentPropsWithoutRef<typeof BaseSelect.Group>;\n\nexport const SelectGroup = forwardRef<HTMLDivElement, SelectGroupProps>(function SelectGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseSelect.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().group, className)}\n data-slot=\"select-group\"\n />\n );\n});\n\nexport type SelectGroupLabelProps = ComponentPropsWithoutRef<typeof BaseSelect.GroupLabel>;\n\nexport const SelectGroupLabel = forwardRef<HTMLDivElement, SelectGroupLabelProps>(\n function SelectGroupLabel({ className, ...props }, ref) {\n return (\n <BaseSelect.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(useSelectStyles().groupLabel, className)}\n data-slot=\"select-group-label\"\n />\n );\n },\n);\n\n/**\n * A visual separator for groups in a listbox. It is intentionally hidden from\n * assistive technology because ARIA listboxes may only contain options or\n * option groups, not semantic separators.\n */\nexport interface SelectSeparatorProps extends ComponentPropsWithoutRef<\"div\"> {\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nexport const SelectSeparator = forwardRef<HTMLDivElement, SelectSeparatorProps>(\n function SelectSeparator({ className, orientation = \"horizontal\", ...props }, ref) {\n return (\n <div\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={cx(useSelectStyles().separator, className)}\n data-orientation={orientation}\n data-slot=\"select-separator\"\n />\n );\n },\n);\n\nexport interface SelectClearProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\nexport const SelectClear = forwardRef<HTMLButtonElement, SelectClearProps>(function SelectClear(\n { children = \"×\", className, ...props },\n ref,\n) {\n const context = useContext(SelectAuxContext);\n const styles = useSelectStyles();\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Clear selection\"}\n className={cx(styles.clear, className)}\n data-slot=\"select-clear\"\n disabled={props.disabled || context?.disabled}\n onClick={(event) => {\n context?.clear();\n props.onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n});\n\nexport type SelectEmptyProps = ComponentPropsWithoutRef<\"div\">;\nexport const SelectEmpty = forwardRef<HTMLDivElement, SelectEmptyProps>(function SelectEmpty(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n className={cx(useSelectStyles().empty, className)}\n data-slot=\"select-empty\"\n ref={ref}\n />\n );\n});\nexport type SelectLoadingProps = ComponentPropsWithoutRef<\"div\">;\nexport const SelectLoading = forwardRef<HTMLDivElement, SelectLoadingProps>(function SelectLoading(\n { children = \"Loading…\", className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n aria-live=\"polite\"\n className={cx(useSelectStyles().loading, className)}\n data-slot=\"select-loading\"\n ref={ref}\n >\n {children}\n </div>\n );\n});\nexport type SelectStatusProps = ComponentPropsWithoutRef<\"div\">;\nexport const SelectStatus = forwardRef<HTMLDivElement, SelectStatusProps>(function SelectStatus(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n aria-live=\"polite\"\n className={cx(useSelectStyles().status, className)}\n data-slot=\"select-status\"\n ref={ref}\n />\n );\n});\n\nexport const Select = {\n Root: SelectRoot,\n Label: SelectLabel,\n Trigger: SelectTrigger,\n Value: SelectValue,\n Icon: SelectIcon,\n Portal: SelectPortal,\n Positioner: SelectPositioner,\n Popup: SelectPopup,\n List: SelectList,\n Item: SelectItem,\n ItemText: SelectItemText,\n ItemIndicator: SelectItemIndicator,\n Group: SelectGroup,\n GroupLabel: SelectGroupLabel,\n Separator: SelectSeparator,\n Clear: SelectClear,\n Empty: SelectEmpty,\n Loading: SelectLoading,\n Status: SelectStatus,\n};\n"],"mappings":";;;;;;;;;AAcA,MAAM,qBAAA,GAAA,MAAA,cAAA,CAA8C,IAAI;AACxD,MAAM,oBAAA,GAAA,MAAA,cAAA,CAAkF,IAAI;AAE5F,SAAS,kBAAkB;CACzB,OAAOA,eAAAA,OAAO,EAAE,OAAA,GAAA,MAAA,WAAA,CAAiB,iBAAiB,EAAE,CAAC;AACvD;AAeA,SAAgB,WAA0E,EACxF,cACA,WAAW,OACX,SAAS,UACT,UACA,eACA,OAAO,MACP,OAAO,iBACP,GAAG,SACgC;CACnC,MAAM,CAAC,mBAAmB,yBAAA,GAAA,MAAA,SAAA,CACxB,iBAAiB,WAAW,CAAC,IAAI,KACnC;CACA,MAAM,QAAQ,oBAAoB,KAAA,IAAY,oBAAoB;CAClE,MAAM,cAAc;EAClB,MAAM,YAAY,WAAW,CAAC,IAAI;EAClC,IAAI,oBAAoB,KAAA,GAAW,qBAAqB,SAAS;EACjE,gBAAgB,WAAoB,KAAA,CAAkB;CACxD;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAkB,UAAnB;EAA4B,OAAO;YACjC,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAiB,UAAlB;GAA2B,OAAO;IAAE;IAAO;GAAS;aAClD,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,OAAW,MAAZ;IACE,GAAI;IACM;IACV,cAAc,KAAA;IACJ;IACV,gBAAgB,WAAW,YAAY;KACrC,IAAI,oBAAoB,KAAA,GAAW,qBAAqB,SAAS;KACjE,gBAAgB,WAAW,OAAO;IACpC;IACO;GACR,CAAA;EACwB,CAAA;CACD,CAAA;AAEhC;;AAKA,MAAa,eAAA,GAAA,MAAA,WAAA,CAA2D,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;CACP,MAAM;CACN,MAAM;CACN,UAAU;CACV,eAAe;CACf,OAAO;CACP,YAAY;CACZ,WAAW;CACX,OAAO;CACP,OAAO;CACP,SAAS;CACT,QAAQ;AACV"}
|
|
@@ -27,7 +27,7 @@ type SelectIconProps = ComponentPropsWithoutRef<typeof Select.Icon>;
|
|
|
27
27
|
/** A small chevron that rotates while the popup is open. */
|
|
28
28
|
declare const SelectIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectIconProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
29
29
|
/** Preserves Base UI's optional portal container and mount controls. */
|
|
30
|
-
declare
|
|
30
|
+
declare function SelectPortal(props: ComponentPropsWithoutRef<typeof Select.Portal>): import("react").JSX.Element;
|
|
31
31
|
type SelectPositionerProps = ComponentPropsWithoutRef<typeof Select.Positioner>;
|
|
32
32
|
declare const SelectPositioner: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectPositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
33
|
type SelectPopupProps = ComponentPropsWithoutRef<typeof Select.Popup>;
|
|
@@ -69,7 +69,7 @@ declare const Select$1: {
|
|
|
69
69
|
Trigger: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
70
70
|
Value: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectValueProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
71
71
|
Icon: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectIconProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
72
|
-
Portal:
|
|
72
|
+
Portal: typeof SelectPortal;
|
|
73
73
|
Positioner: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectPositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
74
74
|
Popup: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectPopupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
75
75
|
List: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -27,7 +27,7 @@ type SelectIconProps = ComponentPropsWithoutRef<typeof Select.Icon>;
|
|
|
27
27
|
/** A small chevron that rotates while the popup is open. */
|
|
28
28
|
declare const SelectIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectIconProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
29
29
|
/** Preserves Base UI's optional portal container and mount controls. */
|
|
30
|
-
declare
|
|
30
|
+
declare function SelectPortal(props: ComponentPropsWithoutRef<typeof Select.Portal>): import("react").JSX.Element;
|
|
31
31
|
type SelectPositionerProps = ComponentPropsWithoutRef<typeof Select.Positioner>;
|
|
32
32
|
declare const SelectPositioner: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectPositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
33
|
type SelectPopupProps = ComponentPropsWithoutRef<typeof Select.Popup>;
|
|
@@ -69,7 +69,7 @@ declare const Select$1: {
|
|
|
69
69
|
Trigger: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
70
70
|
Value: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectValueProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
71
71
|
Icon: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectIconProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
72
|
-
Portal:
|
|
72
|
+
Portal: typeof SelectPortal;
|
|
73
73
|
Positioner: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectPositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
74
74
|
Popup: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectPopupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
75
75
|
List: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { cx } from "../../styled-system/css/cx.js";
|
|
3
3
|
import { withRecipeClassName } from "../base-ui.js";
|
|
4
4
|
import { select } from "../../styled-system/recipes/select.js";
|
|
5
|
+
import { useThemePortalProps } from "../../theme/theme-scope.js";
|
|
5
6
|
import { createContext, forwardRef, useContext, useState } from "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import { Select } from "@base-ui/react/select";
|
|
@@ -80,7 +81,9 @@ const SelectIcon = forwardRef(function SelectIcon({ children = "⌄", className,
|
|
|
80
81
|
});
|
|
81
82
|
});
|
|
82
83
|
/** Preserves Base UI's optional portal container and mount controls. */
|
|
83
|
-
|
|
84
|
+
function SelectPortal(props) {
|
|
85
|
+
return /* @__PURE__ */ jsx(Select.Portal, { ...useThemePortalProps(props) });
|
|
86
|
+
}
|
|
84
87
|
const SelectPositioner = forwardRef(function SelectPositioner({ className, ...props }, ref) {
|
|
85
88
|
return /* @__PURE__ */ jsx(Select.Positioner, {
|
|
86
89
|
...props,
|