jaci-ui 0.1.0 → 0.2.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 +23 -0
- package/README.md +168 -0
- package/dist/components/color-picker/color-picker.cjs +77 -22
- package/dist/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/components/color-picker/color-picker.d.cts +3 -3
- package/dist/components/color-picker/color-picker.d.ts +3 -3
- package/dist/components/color-picker/color-picker.js +77 -22
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +227 -30
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.d.cts +23 -5
- package/dist/components/date-picker/date-picker.d.ts +23 -5
- package/dist/components/date-picker/date-picker.js +226 -32
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-picker/date-utils.cjs +32 -2
- package/dist/components/date-picker/date-utils.cjs.map +1 -1
- package/dist/components/date-picker/date-utils.d.cts +5 -0
- package/dist/components/date-picker/date-utils.d.ts +5 -0
- package/dist/components/date-picker/date-utils.js +29 -3
- package/dist/components/date-picker/date-utils.js.map +1 -1
- package/dist/components/date-picker/index.d.cts +3 -2
- package/dist/components/date-picker/index.d.ts +3 -2
- package/dist/components/menu/menu.cjs +1 -2
- package/dist/components/menu/menu.cjs.map +1 -1
- package/dist/components/menu/menu.d.cts +1 -2
- package/dist/components/menu/menu.d.ts +1 -2
- package/dist/components/menu/menu.js +1 -2
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/option-selector/option-selector.cjs.map +1 -1
- package/dist/components/option-selector/option-selector.d.cts +2 -2
- package/dist/components/option-selector/option-selector.d.ts +2 -2
- package/dist/components/option-selector/option-selector.js.map +1 -1
- package/dist/components/toast/toast.cjs +1 -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 +1 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -2
- package/dist/styled-system/recipes/color-picker.cjs +1 -0
- package/dist/styled-system/recipes/color-picker.cjs.map +1 -1
- package/dist/styled-system/recipes/color-picker.js +1 -0
- package/dist/styled-system/recipes/color-picker.js.map +1 -1
- package/dist/styled-system/recipes/date-picker.cjs +6 -0
- package/dist/styled-system/recipes/date-picker.cjs.map +1 -1
- package/dist/styled-system/recipes/date-picker.js +6 -0
- package/dist/styled-system/recipes/date-picker.js.map +1 -1
- package/dist/styles.css +190 -4
- package/package.json +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.js","names":["BasePopover"],"sources":["../../../src/components/color-picker/color-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport { createContext, forwardRef, useContext, useEffect, useId, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, PointerEvent, ReactNode } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { colorPicker } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { defaultColor, formatColor, parseColor } from \"./color-utils\";\nimport type { ColorFormat, ColorModel } from \"./color-utils\";\n\nexport type { ColorFormat, ColorModel } from \"./color-utils\";\nexport { defaultColor, formatColor, parseColor } from \"./color-utils\";\n\ninterface ColorPickerContextValue {\n color: ColorModel;\n disabled: boolean;\n format: ColorFormat;\n inputId: string;\n setColor: (color: ColorModel) => void;\n showAlpha: boolean;\n swatches: string[];\n value: string;\n}\n\nconst ColorPickerContext = createContext<ColorPickerContextValue | null>(null);\n\nfunction useColorPicker() {\n const context = useContext(ColorPickerContext);\n if (!context) throw new Error(\"ColorPicker parts must be rendered inside ColorPicker.Root.\");\n return context;\n}\n\nexport interface ColorPickerRootProps extends Omit<BasePopoverRoot.Props, \"children\"> {\n children?: ReactNode;\n defaultValue?: string;\n disabled?: boolean;\n format?: ColorFormat;\n id?: string;\n name?: string;\n onValueChange?: (value: string) => void;\n showAlpha?: boolean;\n swatches?: string[];\n value?: string;\n}\n\nexport function ColorPickerRoot({\n children,\n defaultValue = \"#000000\",\n disabled = false,\n format = \"hex\",\n id,\n name,\n onValueChange,\n showAlpha = false,\n swatches = [],\n value: controlledValue,\n ...popoverProps\n}: ColorPickerRootProps) {\n const generatedId = useId();\n const inputId = id ?? generatedId;\n const [uncontrolledColor, setUncontrolledColor] = useState<ColorModel>(() =>\n defaultColor(defaultValue),\n );\n const parsedControlled = parseColor(controlledValue);\n const color = parsedControlled ?? uncontrolledColor;\n const formattedValue = formatColor(color, format, showAlpha);\n const setColor = (nextColor: ColorModel) => {\n setUncontrolledColor(nextColor);\n onValueChange?.(formatColor(nextColor, format, showAlpha));\n };\n\n return (\n <ColorPickerContext.Provider\n value={{\n color,\n disabled,\n format,\n inputId,\n setColor,\n showAlpha,\n swatches,\n value: formattedValue,\n }}\n >\n <BasePopover.Root {...popoverProps}>\n {children}\n {name ? (\n <input\n aria-hidden=\"true\"\n id={`${inputId}-value`}\n name={name}\n type=\"hidden\"\n value={formattedValue}\n />\n ) : null}\n </BasePopover.Root>\n </ColorPickerContext.Provider>\n );\n}\n\nexport interface ColorPickerLabelProps extends ComponentPropsWithoutRef<\"label\"> {}\nexport const ColorPickerLabel = forwardRef<HTMLLabelElement, ColorPickerLabelProps>(\n function ColorPickerLabel({ children, className, htmlFor, ...props }, ref) {\n const { inputId } = useColorPicker();\n return (\n <label\n {...props}\n ref={ref}\n className={cx(colorPicker().label, className)}\n data-slot=\"color-picker-label\"\n htmlFor={htmlFor ?? inputId}\n >\n {children}\n </label>\n );\n },\n);\n\nexport type ColorPickerControlProps = ComponentPropsWithoutRef<\"div\">;\nexport const ColorPickerControl = forwardRef<HTMLDivElement, ColorPickerControlProps>(\n function ColorPickerControl({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(colorPicker().control, className)}\n data-slot=\"color-picker-control\"\n />\n );\n },\n);\n\nexport type ColorPickerTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\nexport const ColorPickerTrigger = forwardRef<HTMLButtonElement, ColorPickerTriggerProps>(\n function ColorPickerTrigger({ className, disabled, ...props }, ref) {\n const context = useColorPicker();\n return (\n <BasePopover.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(colorPicker().trigger, className)}\n data-jaci-component=\"color-picker\"\n data-slot=\"color-picker-trigger\"\n disabled={disabled ?? context.disabled}\n id={props.id ?? context.inputId}\n />\n );\n },\n);\n\nexport type ColorPickerPreviewProps = ComponentPropsWithoutRef<\"span\">;\nexport const ColorPickerPreview = forwardRef<HTMLSpanElement, ColorPickerPreviewProps>(\n function ColorPickerPreview({ className, style, ...props }, ref) {\n const { value } = useColorPicker();\n return (\n <span\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? value}\n className={cx(colorPicker().preview, className)}\n data-slot=\"color-picker-preview\"\n role=\"img\"\n style={{ backgroundColor: value, ...style }}\n />\n );\n },\n);\n\nexport type ColorPickerValueProps = ComponentPropsWithoutRef<\"span\">;\nexport const ColorPickerValue = forwardRef<HTMLSpanElement, ColorPickerValueProps>(\n function ColorPickerValue({ className, ...props }, ref) {\n const { value } = useColorPicker();\n return (\n <span\n {...props}\n ref={ref}\n className={cx(colorPicker().value, className)}\n data-slot=\"color-picker-value\"\n >\n {props.children ?? value}\n </span>\n );\n },\n);\n\nexport const ColorPickerPortal: typeof BasePopover.Portal = BasePopover.Portal;\nexport type ColorPickerPositionerProps = ComponentPropsWithoutRef<typeof BasePopover.Positioner>;\nexport const ColorPickerPositioner = forwardRef<HTMLDivElement, ColorPickerPositionerProps>(\n function ColorPickerPositioner({ className, ...props }, ref) {\n return (\n <BasePopover.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(colorPicker().positioner, className)}\n data-slot=\"color-picker-positioner\"\n />\n );\n },\n);\n\nexport type ColorPickerPopupProps = ComponentPropsWithoutRef<typeof BasePopover.Popup>;\nexport const ColorPickerPopup = forwardRef<HTMLDivElement, ColorPickerPopupProps>(\n function ColorPickerPopup({ className, ...props }, ref) {\n return (\n <BasePopover.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(colorPicker().popup, className)}\n data-jaci-component=\"color-picker\"\n data-slot=\"color-picker-popup\"\n />\n );\n },\n);\n\nfunction updateFromPoint(\n event: PointerEvent<HTMLDivElement>,\n setColor: (color: ColorModel) => void,\n color: ColorModel,\n) {\n const rect = event.currentTarget.getBoundingClientRect();\n const saturation = Math.round(\n Math.min(1, Math.max(0, (event.clientX - rect.left) / rect.width)) * 100,\n );\n const lightness = Math.round(\n (1 - Math.min(1, Math.max(0, (event.clientY - rect.top) / rect.height))) * 100,\n );\n setColor({ ...color, lightness, saturation });\n}\n\nexport type ColorPickerPaletteProps = Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\">;\nexport const ColorPickerPalette = forwardRef<HTMLDivElement, ColorPickerPaletteProps>(\n function ColorPickerPalette({ className, onKeyDown, onPointerDown, style, ...props }, ref) {\n const { color, setColor, value } = useColorPicker();\n const background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${color.hue} 100% 50%))`;\n return (\n <div\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Color saturation and lightness\"}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={Math.round(color.saturation)}\n aria-valuetext={value}\n className={cx(colorPicker().palette, className)}\n data-slot=\"color-picker-palette\"\n onKeyDown={(event) => {\n const step = event.shiftKey ? 10 : 1;\n if (\n event.key === \"ArrowLeft\" ||\n event.key === \"ArrowRight\" ||\n event.key === \"ArrowUp\" ||\n event.key === \"ArrowDown\"\n ) {\n event.preventDefault();\n setColor({\n ...color,\n saturation:\n event.key === \"ArrowLeft\"\n ? Math.max(0, color.saturation - step)\n : event.key === \"ArrowRight\"\n ? Math.min(100, color.saturation + step)\n : color.saturation,\n lightness:\n event.key === \"ArrowDown\"\n ? Math.max(0, color.lightness - step)\n : event.key === \"ArrowUp\"\n ? Math.min(100, color.lightness + step)\n : color.lightness,\n });\n }\n onKeyDown?.(event);\n }}\n onPointerDown={(event) => {\n updateFromPoint(event, setColor, color);\n onPointerDown?.(event);\n }}\n role=\"slider\"\n style={{ background, ...style }}\n tabIndex={props.tabIndex ?? 0}\n />\n );\n },\n);\n\nexport type ColorPickerHueProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"max\" | \"min\" | \"onChange\" | \"step\" | \"type\" | \"value\"\n>;\nexport const ColorPickerHue = forwardRef<HTMLInputElement, ColorPickerHueProps>(\n function ColorPickerHue({ className, onInput, ...props }, ref) {\n const { color, setColor } = useColorPicker();\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Hue\"}\n className={cx(colorPicker().hue, className)}\n data-slot=\"color-picker-hue\"\n max={360}\n min={0}\n onInput={(event) => {\n setColor({ ...color, hue: Number(event.currentTarget.value) });\n onInput?.(event);\n }}\n step={1}\n type=\"range\"\n value={color.hue}\n />\n );\n },\n);\n\nexport type ColorPickerAlphaProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"max\" | \"min\" | \"onChange\" | \"step\" | \"type\" | \"value\"\n>;\nexport const ColorPickerAlpha = forwardRef<HTMLInputElement, ColorPickerAlphaProps>(\n function ColorPickerAlpha({ className, onInput, style, ...props }, ref) {\n const { color, setColor, showAlpha } = useColorPicker();\n if (!showAlpha) return null;\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Opacity\"}\n className={cx(colorPicker().alpha, className)}\n data-slot=\"color-picker-alpha\"\n max={1}\n min={0}\n onInput={(event) => {\n setColor({ ...color, alpha: Number(event.currentTarget.value) });\n onInput?.(event);\n }}\n step={0.01}\n style={{\n ...style,\n background: `linear-gradient(to right, transparent, ${formatColor({ ...color, alpha: 1 }, \"rgb\")})`,\n }}\n type=\"range\"\n value={color.alpha}\n />\n );\n },\n);\n\nexport type ColorPickerSwatchesProps = ComponentPropsWithoutRef<\"fieldset\">;\nexport const ColorPickerSwatches = forwardRef<HTMLFieldSetElement, ColorPickerSwatchesProps>(\n function ColorPickerSwatches({ children, className, ...props }, ref) {\n const { swatches } = useColorPicker();\n return (\n <fieldset\n {...props}\n ref={ref}\n className={cx(colorPicker().swatches, className)}\n data-slot=\"color-picker-swatches\"\n >\n {children ?? swatches.map((color) => <ColorPickerSwatch color={color} key={color} />)}\n </fieldset>\n );\n },\n);\n\nexport interface ColorPickerSwatchProps extends ComponentPropsWithoutRef<\"button\"> {\n color: string;\n}\nexport const ColorPickerSwatch = forwardRef<HTMLButtonElement, ColorPickerSwatchProps>(\n function ColorPickerSwatch({ children, className, color, style, ...props }, ref) {\n const context = useColorPicker();\n const parsed = parseColor(color);\n const selected =\n parsed && formatColor(parsed, context.format, context.showAlpha) === context.value;\n return (\n <button\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? color}\n aria-pressed={selected || undefined}\n className={cx(colorPicker().swatch, className)}\n data-selected={selected || undefined}\n data-slot=\"color-picker-swatch\"\n onClick={(event) => {\n if (parsed) context.setColor(parsed);\n props.onClick?.(event);\n }}\n style={{ backgroundColor: color, ...style }}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type ColorPickerInputProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"onChange\" | \"type\" | \"value\"\n>;\nexport const ColorPickerInput = forwardRef<HTMLInputElement, ColorPickerInputProps>(\n function ColorPickerInput({ className, onBlur, onKeyDown, ...props }, ref) {\n const { format, setColor, showAlpha, value } = useColorPicker();\n const [draft, setDraft] = useState(value);\n const [invalid, setInvalid] = useState(false);\n useEffect(() => setDraft(value), [value]);\n const commit = () => {\n const parsed = parseColor(draft);\n if (!parsed) {\n setInvalid(true);\n setDraft(value);\n return;\n }\n setInvalid(false);\n setColor(parsed);\n setDraft(formatColor(parsed, format, showAlpha));\n };\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Color value\"}\n aria-invalid={invalid || undefined}\n className={cx(colorPicker().input, className)}\n data-slot=\"color-picker-input\"\n onBlur={(event) => {\n commit();\n onBlur?.(event);\n }}\n onChange={(event) => {\n setDraft(event.currentTarget.value);\n setInvalid(false);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n event.preventDefault();\n commit();\n }\n onKeyDown?.(event);\n }}\n type=\"text\"\n value={draft}\n />\n );\n },\n);\n\nexport type ColorPickerNativeInputProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"onChange\" | \"type\" | \"value\"\n>;\nexport const ColorPickerNativeInput = forwardRef<HTMLInputElement, ColorPickerNativeInputProps>(\n function ColorPickerNativeInput({ className, onInput, ...props }, ref) {\n const { color, setColor, showAlpha } = useColorPicker();\n const value = formatColor({ ...color, alpha: 1 }, \"hex\");\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Choose a color\"}\n className={cx(colorPicker().nativeInput, className)}\n data-slot=\"color-picker-native-input\"\n onInput={(event) => {\n const parsed = parseColor(event.currentTarget.value);\n if (parsed) setColor({ ...parsed, alpha: showAlpha ? color.alpha : 1 });\n onInput?.(event);\n }}\n type=\"color\"\n value={value.slice(0, 7)}\n />\n );\n },\n);\n\nexport const ColorPicker = {\n Root: ColorPickerRoot,\n Label: ColorPickerLabel,\n Control: ColorPickerControl,\n Trigger: ColorPickerTrigger,\n Preview: ColorPickerPreview,\n Value: ColorPickerValue,\n Portal: ColorPickerPortal,\n Positioner: ColorPickerPositioner,\n Popup: ColorPickerPopup,\n Palette: ColorPickerPalette,\n Hue: ColorPickerHue,\n Alpha: ColorPickerAlpha,\n Swatches: ColorPickerSwatches,\n Swatch: ColorPickerSwatch,\n Input: ColorPickerInput,\n NativeInput: ColorPickerNativeInput,\n createHandle: BasePopover.createH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F;AAEA,MAAa,cAAc;CACzB,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,SAAS;CACT,KAAK;CACL,OAAO;CACP,UAAU;CACV,QAAQ;CACR,OAAO;CACP,aAAa;CACb,cAAcA,QAAY;AAC5B"}
|
|
1
|
+
{"version":3,"file":"color-picker.js","names":["BasePopover"],"sources":["../../../src/components/color-picker/color-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport { createContext, forwardRef, useContext, useEffect, useId, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, CSSProperties, PointerEvent, ReactNode } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { colorPicker } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { defaultColor, formatColor, parseColor } from \"./color-utils\";\nimport type { ColorFormat, ColorModel } from \"./color-utils\";\n\nexport type { ColorFormat, ColorModel } from \"./color-utils\";\nexport { defaultColor, formatColor, parseColor } from \"./color-utils\";\n\ninterface ColorPickerContextValue {\n color: ColorModel;\n disabled: boolean;\n format: ColorFormat;\n inputId: string;\n setColor: (color: ColorModel) => void;\n showAlpha: boolean;\n swatches: string[];\n value: string;\n}\n\nconst ColorPickerContext = createContext<ColorPickerContextValue | null>(null);\n\nfunction useColorPicker() {\n const context = useContext(ColorPickerContext);\n if (!context) throw new Error(\"ColorPicker parts must be rendered inside ColorPicker.Root.\");\n return context;\n}\n\nexport interface ColorPickerRootProps extends Omit<BasePopoverRoot.Props, \"children\"> {\n children?: ReactNode;\n defaultValue?: string;\n disabled?: boolean;\n format?: ColorFormat;\n id?: string;\n name?: string;\n onValueChange?: (value: string) => void;\n showAlpha?: boolean;\n swatches?: string[];\n value?: string;\n}\n\nexport function ColorPickerRoot({\n children,\n defaultValue = \"#000000\",\n disabled = false,\n format = \"hex\",\n id,\n name,\n onValueChange,\n showAlpha = false,\n swatches = [],\n value: controlledValue,\n ...popoverProps\n}: ColorPickerRootProps) {\n const generatedId = useId();\n const inputId = id ?? generatedId;\n const [uncontrolledColor, setUncontrolledColor] = useState<ColorModel>(() =>\n defaultColor(defaultValue),\n );\n const parsedControlled = parseColor(controlledValue);\n const color = parsedControlled ?? uncontrolledColor;\n const formattedValue = formatColor(color, format, showAlpha);\n const setColor = (nextColor: ColorModel) => {\n setUncontrolledColor(nextColor);\n onValueChange?.(formatColor(nextColor, format, showAlpha));\n };\n\n return (\n <ColorPickerContext.Provider\n value={{\n color,\n disabled,\n format,\n inputId,\n setColor,\n showAlpha,\n swatches,\n value: formattedValue,\n }}\n >\n <BasePopover.Root {...popoverProps}>\n {children}\n {name ? (\n <input\n aria-hidden=\"true\"\n id={`${inputId}-value`}\n name={name}\n type=\"hidden\"\n value={formattedValue}\n />\n ) : null}\n </BasePopover.Root>\n </ColorPickerContext.Provider>\n );\n}\n\nexport interface ColorPickerLabelProps extends ComponentPropsWithoutRef<\"label\"> {}\nexport const ColorPickerLabel = forwardRef<HTMLLabelElement, ColorPickerLabelProps>(\n function ColorPickerLabel({ children, className, htmlFor, ...props }, ref) {\n const { inputId } = useColorPicker();\n return (\n <label\n {...props}\n ref={ref}\n className={cx(colorPicker().label, className)}\n data-slot=\"color-picker-label\"\n htmlFor={htmlFor ?? inputId}\n >\n {children}\n </label>\n );\n },\n);\n\nexport type ColorPickerControlProps = ComponentPropsWithoutRef<\"div\">;\nexport const ColorPickerControl = forwardRef<HTMLDivElement, ColorPickerControlProps>(\n function ColorPickerControl({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(colorPicker().control, className)}\n data-slot=\"color-picker-control\"\n />\n );\n },\n);\n\nexport type ColorPickerTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\nexport const ColorPickerTrigger = forwardRef<HTMLButtonElement, ColorPickerTriggerProps>(\n function ColorPickerTrigger({ className, disabled, ...props }, ref) {\n const context = useColorPicker();\n return (\n <BasePopover.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(colorPicker().trigger, className)}\n data-jaci-component=\"color-picker\"\n data-slot=\"color-picker-trigger\"\n disabled={disabled ?? context.disabled}\n id={props.id ?? context.inputId}\n />\n );\n },\n);\n\nexport type ColorPickerPreviewProps = ComponentPropsWithoutRef<\"span\">;\nexport const ColorPickerPreview = forwardRef<HTMLSpanElement, ColorPickerPreviewProps>(\n function ColorPickerPreview({ className, style, ...props }, ref) {\n const { value } = useColorPicker();\n return (\n <span\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? value}\n className={cx(colorPicker().preview, className)}\n data-slot=\"color-picker-preview\"\n role=\"img\"\n style={{ backgroundColor: value, ...style }}\n />\n );\n },\n);\n\nexport type ColorPickerValueProps = ComponentPropsWithoutRef<\"span\">;\nexport const ColorPickerValue = forwardRef<HTMLSpanElement, ColorPickerValueProps>(\n function ColorPickerValue({ className, ...props }, ref) {\n const { value } = useColorPicker();\n return (\n <span\n {...props}\n ref={ref}\n className={cx(colorPicker().value, className)}\n data-slot=\"color-picker-value\"\n >\n {props.children ?? value}\n </span>\n );\n },\n);\n\nexport const ColorPickerPortal: typeof BasePopover.Portal = BasePopover.Portal;\nexport type ColorPickerPositionerProps = ComponentPropsWithoutRef<typeof BasePopover.Positioner>;\nexport const ColorPickerPositioner = forwardRef<HTMLDivElement, ColorPickerPositionerProps>(\n function ColorPickerPositioner({ className, ...props }, ref) {\n return (\n <BasePopover.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(colorPicker().positioner, className)}\n data-slot=\"color-picker-positioner\"\n />\n );\n },\n);\n\nexport type ColorPickerPopupProps = ComponentPropsWithoutRef<typeof BasePopover.Popup>;\nexport const ColorPickerPopup = forwardRef<HTMLDivElement, ColorPickerPopupProps>(\n function ColorPickerPopup({ className, ...props }, ref) {\n return (\n <BasePopover.Popup\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Color picker\"}\n ref={ref}\n className={withRecipeClassName(colorPicker().popup, className)}\n data-jaci-component=\"color-picker\"\n data-slot=\"color-picker-popup\"\n />\n );\n },\n);\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction formatPalettePercentage(value: number) {\n return `${Number(value.toFixed(2))}%`;\n}\n\nfunction hslToPalettePosition(color: ColorModel) {\n const lightness = clamp(color.lightness / 100, 0, 1);\n const saturation = clamp(color.saturation / 100, 0, 1);\n const chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;\n const value = lightness + chroma / 2;\n\n return {\n lightness: (1 - value) * 100,\n saturation: value === 0 ? 0 : (chroma / value) * 100,\n };\n}\n\nfunction palettePositionToHsl(\n saturation: number,\n lightness: number,\n color: ColorModel,\n): ColorModel {\n const hsvSaturation = clamp(saturation / 100, 0, 1);\n const value = 1 - clamp(lightness / 100, 0, 1);\n const hslLightness = value * (1 - hsvSaturation / 2);\n const hslSaturation =\n hslLightness === 0 || hslLightness === 1\n ? 0\n : ((value - hslLightness) / Math.min(hslLightness, 1 - hslLightness)) * 100;\n\n return {\n ...color,\n lightness: hslLightness * 100,\n saturation: clamp(hslSaturation, 0, 100),\n };\n}\n\nfunction updateFromPoint(\n event: PointerEvent<HTMLDivElement>,\n setColor: (color: ColorModel) => void,\n color: ColorModel,\n) {\n const rect = event.currentTarget.getBoundingClientRect();\n const saturation = Math.round(clamp((event.clientX - rect.left) / rect.width, 0, 1) * 100);\n const lightness = Math.round(clamp((event.clientY - rect.top) / rect.height, 0, 1) * 100);\n setColor(palettePositionToHsl(saturation, lightness, color));\n}\n\nexport type ColorPickerPaletteProps = Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\">;\nexport const ColorPickerPalette = forwardRef<HTMLDivElement, ColorPickerPaletteProps>(\n function ColorPickerPalette(\n {\n children,\n className,\n onKeyDown,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n style,\n ...props\n },\n ref,\n ) {\n const { color, disabled, setColor, value } = useColorPicker();\n const [isDragging, setIsDragging] = useState(false);\n const background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${color.hue} 100% 50%))`;\n const palettePosition = hslToPalettePosition(color);\n const paletteStyle = {\n \"--jaci-color-palette-lightness\": formatPalettePercentage(palettePosition.lightness),\n \"--jaci-color-palette-saturation\": formatPalettePercentage(palettePosition.saturation),\n background,\n ...style,\n } as CSSProperties;\n\n const releasePointer = (event: PointerEvent<HTMLDivElement>) => {\n if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {\n event.currentTarget.releasePointerCapture(event.pointerId);\n }\n setIsDragging(false);\n };\n\n return (\n <div\n {...props}\n ref={ref}\n aria-disabled={disabled || undefined}\n aria-label={props[\"aria-label\"] ?? \"Color saturation and lightness\"}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={Math.round(palettePosition.saturation)}\n aria-valuetext={value}\n className={cx(colorPicker().palette, className)}\n data-disabled={disabled || undefined}\n data-dragging={isDragging || undefined}\n data-slot=\"color-picker-palette\"\n onKeyDown={(event) => {\n const step = event.shiftKey ? 10 : 1;\n if (\n event.key === \"ArrowLeft\" ||\n event.key === \"ArrowRight\" ||\n event.key === \"ArrowUp\" ||\n event.key === \"ArrowDown\"\n ) {\n event.preventDefault();\n const saturation =\n event.key === \"ArrowLeft\"\n ? Math.max(0, palettePosition.saturation - step)\n : event.key === \"ArrowRight\"\n ? Math.min(100, palettePosition.saturation + step)\n : palettePosition.saturation;\n const lightness =\n event.key === \"ArrowDown\"\n ? Math.min(100, palettePosition.lightness + step)\n : event.key === \"ArrowUp\"\n ? Math.max(0, palettePosition.lightness - step)\n : palettePosition.lightness;\n setColor(palettePositionToHsl(saturation, lightness, color));\n }\n onKeyDown?.(event);\n }}\n onPointerDown={(event) => {\n if (!disabled) {\n updateFromPoint(event, setColor, color);\n setIsDragging(true);\n try {\n event.currentTarget.setPointerCapture(event.pointerId);\n } catch {\n // Pointer capture is not available in every test environment.\n }\n }\n onPointerDown?.(event);\n }}\n onPointerMove={(event) => {\n if (!disabled && isDragging) updateFromPoint(event, setColor, color);\n onPointerMove?.(event);\n }}\n onPointerUp={(event) => {\n releasePointer(event);\n onPointerUp?.(event);\n }}\n onPointerCancel={(event) => {\n releasePointer(event);\n onPointerCancel?.(event);\n }}\n role=\"slider\"\n style={paletteStyle}\n tabIndex={props.tabIndex ?? (disabled ? -1 : 0)}\n >\n <span\n aria-hidden=\"true\"\n className={colorPicker().paletteIndicator}\n data-slot=\"color-picker-palette-indicator\"\n />\n {children}\n </div>\n );\n },\n);\n\nexport type ColorPickerHueProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"max\" | \"min\" | \"onChange\" | \"step\" | \"type\" | \"value\"\n>;\nexport const ColorPickerHue = forwardRef<HTMLInputElement, ColorPickerHueProps>(\n function ColorPickerHue({ className, onInput, ...props }, ref) {\n const { color, setColor } = useColorPicker();\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Hue\"}\n className={cx(colorPicker().hue, className)}\n data-slot=\"color-picker-hue\"\n max={360}\n min={0}\n onInput={(event) => {\n setColor({ ...color, hue: Number(event.currentTarget.value) });\n onInput?.(event);\n }}\n step={1}\n type=\"range\"\n value={color.hue}\n />\n );\n },\n);\n\nexport type ColorPickerAlphaProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"max\" | \"min\" | \"onChange\" | \"step\" | \"type\" | \"value\"\n>;\nexport const ColorPickerAlpha = forwardRef<HTMLInputElement, ColorPickerAlphaProps>(\n function ColorPickerAlpha({ className, onInput, style, ...props }, ref) {\n const { color, setColor, showAlpha } = useColorPicker();\n if (!showAlpha) return null;\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Opacity\"}\n className={cx(colorPicker().alpha, className)}\n data-slot=\"color-picker-alpha\"\n max={1}\n min={0}\n onInput={(event) => {\n setColor({ ...color, alpha: Number(event.currentTarget.value) });\n onInput?.(event);\n }}\n step={0.01}\n style={{\n ...style,\n background: `linear-gradient(to right, transparent, ${formatColor({ ...color, alpha: 1 }, \"rgb\")})`,\n }}\n type=\"range\"\n value={color.alpha}\n />\n );\n },\n);\n\nexport type ColorPickerSwatchesProps = ComponentPropsWithoutRef<\"fieldset\">;\nexport const ColorPickerSwatches = forwardRef<HTMLFieldSetElement, ColorPickerSwatchesProps>(\n function ColorPickerSwatches({ children, className, ...props }, ref) {\n const { swatches } = useColorPicker();\n return (\n <fieldset\n {...props}\n ref={ref}\n className={cx(colorPicker().swatches, className)}\n data-slot=\"color-picker-swatches\"\n >\n {children ?? swatches.map((color) => <ColorPickerSwatch color={color} key={color} />)}\n </fieldset>\n );\n },\n);\n\nexport interface ColorPickerSwatchProps extends ComponentPropsWithoutRef<\"button\"> {\n color: string;\n}\nexport const ColorPickerSwatch = forwardRef<HTMLButtonElement, ColorPickerSwatchProps>(\n function ColorPickerSwatch({ children, className, color, style, ...props }, ref) {\n const context = useColorPicker();\n const parsed = parseColor(color);\n const selected =\n parsed && formatColor(parsed, context.format, context.showAlpha) === context.value;\n return (\n <button\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? color}\n aria-pressed={selected || undefined}\n className={cx(colorPicker().swatch, className)}\n data-selected={selected || undefined}\n data-slot=\"color-picker-swatch\"\n onClick={(event) => {\n if (parsed) context.setColor(parsed);\n props.onClick?.(event);\n }}\n style={{ backgroundColor: color, ...style }}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type ColorPickerInputProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"onChange\" | \"type\" | \"value\"\n>;\nexport const ColorPickerInput = forwardRef<HTMLInputElement, ColorPickerInputProps>(\n function ColorPickerInput({ className, onBlur, onKeyDown, ...props }, ref) {\n const { format, setColor, showAlpha, value } = useColorPicker();\n const [draft, setDraft] = useState(value);\n const [invalid, setInvalid] = useState(false);\n useEffect(() => setDraft(value), [value]);\n const commit = () => {\n const parsed = parseColor(draft);\n if (!parsed) {\n setInvalid(true);\n setDraft(value);\n return;\n }\n setInvalid(false);\n setColor(parsed);\n setDraft(formatColor(parsed, format, showAlpha));\n };\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Color value\"}\n aria-invalid={invalid || undefined}\n className={cx(colorPicker().input, className)}\n data-slot=\"color-picker-input\"\n onBlur={(event) => {\n commit();\n onBlur?.(event);\n }}\n onChange={(event) => {\n setDraft(event.currentTarget.value);\n setInvalid(false);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n event.preventDefault();\n commit();\n }\n onKeyDown?.(event);\n }}\n type=\"text\"\n value={draft}\n />\n );\n },\n);\n\nexport type ColorPickerNativeInputProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"onChange\" | \"type\" | \"value\"\n>;\nexport const ColorPickerNativeInput = forwardRef<HTMLInputElement, ColorPickerNativeInputProps>(\n function ColorPickerNativeInput({ className, onInput, ...props }, ref) {\n const { color, setColor, showAlpha } = useColorPicker();\n const value = formatColor({ ...color, alpha: 1 }, \"hex\");\n return (\n <input\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Choose a color\"}\n className={cx(colorPicker().nativeInput, className)}\n data-slot=\"color-picker-native-input\"\n onInput={(event) => {\n const parsed = parseColor(event.currentTarget.value);\n if (parsed) setColor({ ...parsed, alpha: showAlpha ? color.alpha : 1 });\n onInput?.(event);\n }}\n type=\"color\"\n value={value.slice(0, 7)}\n />\n );\n },\n);\n\nexport const ColorPicker = {\n Root: ColorPickerRoot,\n Label: ColorPickerLabel,\n Control: ColorPickerControl,\n Trigger: ColorPickerTrigger,\n Preview: ColorPickerPreview,\n Value: ColorPickerValue,\n Portal: ColorPickerPortal,\n Positioner: ColorPickerPositioner,\n Popup: ColorPickerPopup,\n Palette: ColorPickerPalette,\n Hue: ColorPickerHue,\n Alpha: ColorPickerAlpha,\n Swatches: ColorPickerSwatches,\n Swatch: ColorPickerSwatch,\n Input: ColorPickerInput,\n NativeInput: ColorPickerNativeInput,\n createHandle: BasePopover.createHandle,\n};\n"],"mappings":";;;;;;;;;AA2BA,MAAM,qBAAqB,cAA8C,IAAI;AAE7E,SAAS,iBAAiB;CACxB,MAAM,UAAU,WAAW,kBAAkB;CAC7C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,6DAA6D;CAC3F,OAAO;AACT;AAeA,SAAgB,gBAAgB,EAC9B,UACA,eAAe,WACf,WAAW,OACX,SAAS,OACT,IACA,MACA,eACA,YAAY,OACZ,WAAW,CAAC,GACZ,OAAO,iBACP,GAAG,gBACoB;CACvB,MAAM,cAAc,MAAM;CAC1B,MAAM,UAAU,MAAM;CACtB,MAAM,CAAC,mBAAmB,wBAAwB,eAChD,aAAa,YAAY,CAC3B;CAEA,MAAM,QADmB,WAAW,eACP,KAAK;CAClC,MAAM,iBAAiB,YAAY,OAAO,QAAQ,SAAS;CAC3D,MAAM,YAAY,cAA0B;EAC1C,qBAAqB,SAAS;EAC9B,gBAAgB,YAAY,WAAW,QAAQ,SAAS,CAAC;CAC3D;CAEA,OACE,oBAAC,mBAAmB,UAApB;EACE,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA,OAAO;EACT;YAEA,qBAACA,QAAY,MAAb;GAAkB,GAAI;aAAtB,CACG,UACA,OACC,oBAAC,SAAD;IACE,eAAY;IACZ,IAAI,GAAG,QAAQ;IACT;IACN,MAAK;IACL,OAAO;GACR,CAAA,IACC,IACY;;CACS,CAAA;AAEjC;AAGA,MAAa,mBAAmB,WAC9B,SAAS,iBAAiB,EAAE,UAAU,WAAW,SAAS,GAAG,SAAS,KAAK;CACzE,MAAM,EAAE,YAAY,eAAe;CACnC,OACE,oBAAC,SAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,YAAY,CAAC,CAAC,OAAO,SAAS;EAC5C,aAAU;EACV,SAAS,WAAW;EAEnB;CACI,CAAA;AAEX,CACF;AAGA,MAAa,qB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EL,CACF;AAMA,MAAa,yBAAyB,WACpC,SAAS,uBAAuB,EAAE,WAAW,SAAS,GAAG,SAAS,KAAK;CACrE,MAAM,EAAE,OAAO,UAAU,cAAc,eAAe;CACtD,MAAM,QAAQ,YAAY;EAAE,GAAG;EAAO,OAAO;CAAE,GAAG,KAAK;CACvD,OACE,oBAAC,SAAD;EACE,GAAI;EACC;EACL,cAAY,MAAM,iBAAiB;EACnC,WAAW,GAAG,YAAY,CAAC,CAAC,aAAa,SAAS;EAClD,aAAU;EACV,UAAU,UAAU;GAClB,MAAM,SAAS,WAAW,MAAM,cAAc,KAAK;GACnD,IAAI,QAAQ,SAAS;IAAE,GAAG;IAAQ,OAAO,YAAY,MAAM,QAAQ;GAAE,CAAC;GACtE,UAAU,KAAK;EACjB;EACA,MAAK;EACL,OAAO,MAAM,MAAM,GAAG,CAAC;CACxB,CAAA;AAEL,CACF;AAEA,MAAa,cAAc;CACzB,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,SAAS;CACT,KAAK;CACL,OAAO;CACP,UAAU;CACV,QAAQ;CACR,OAAO;CACP,aAAa;CACb,cAAcA,QAAY;AAC5B"}
|
|
@@ -23,7 +23,7 @@ function composeRefs(first, second) {
|
|
|
23
23
|
else if (first) first.current = value;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function DatePickerRoot({ children, closeOnSelect
|
|
26
|
+
function DatePickerRoot({ children, closeOnSelect: closeOnSelectProp, defaultValue = null, disabled = false, granularity = "day", isDateDisabled, locale = "pt-BR", maxDate, minDate, name, onValueChange, onMonthChange, placeholder = "Select a date", size = "md", value: controlledValue, weekStartsOn = 0, yearRange: configuredYearRange, actionsRef: externalActionsRef, ...popoverProps }) {
|
|
27
27
|
const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
|
|
28
28
|
const selected = controlledValue === void 0 ? uncontrolledValue : controlledValue;
|
|
29
29
|
const [month, setMonthState] = (0, react.useState)(() => require_date_utils.startOfMonth(selected ?? /* @__PURE__ */ new Date()));
|
|
@@ -37,6 +37,29 @@ function DatePickerRoot({ children, closeOnSelect = true, defaultValue = null, d
|
|
|
37
37
|
const styles = require_date_picker.datePicker({ size });
|
|
38
38
|
const minMonth = minDate ? require_date_utils.startOfMonth(minDate) : void 0;
|
|
39
39
|
const maxMonth = maxDate ? require_date_utils.startOfMonth(maxDate) : void 0;
|
|
40
|
+
const closeOnSelect = closeOnSelectProp ?? granularity !== "date-time";
|
|
41
|
+
const yearRange = (0, react.useMemo)(() => {
|
|
42
|
+
const defaultStart = today.getFullYear() - 100;
|
|
43
|
+
const defaultEnd = today.getFullYear() + 20;
|
|
44
|
+
const start = configuredYearRange?.start ?? defaultStart;
|
|
45
|
+
const end = configuredYearRange?.end ?? defaultEnd;
|
|
46
|
+
const years = [
|
|
47
|
+
selected?.getFullYear(),
|
|
48
|
+
minDate?.getFullYear(),
|
|
49
|
+
maxDate?.getFullYear()
|
|
50
|
+
].filter((year) => year !== void 0);
|
|
51
|
+
return {
|
|
52
|
+
end: Math.max(start, end, ...years),
|
|
53
|
+
start: Math.min(start, end, ...years)
|
|
54
|
+
};
|
|
55
|
+
}, [
|
|
56
|
+
configuredYearRange?.end,
|
|
57
|
+
configuredYearRange?.start,
|
|
58
|
+
maxDate,
|
|
59
|
+
minDate,
|
|
60
|
+
selected,
|
|
61
|
+
today
|
|
62
|
+
]);
|
|
40
63
|
const clampMonth = (0, react.useCallback)((nextMonth) => {
|
|
41
64
|
const normalized = require_date_utils.startOfMonth(nextMonth);
|
|
42
65
|
if (minMonth && require_date_utils.isBeforeDay(normalized, minMonth)) return minMonth;
|
|
@@ -68,26 +91,102 @@ function DatePickerRoot({ children, closeOnSelect = true, defaultValue = null, d
|
|
|
68
91
|
const close = (0, react.useCallback)(() => {
|
|
69
92
|
(externalActionsRef ?? internalActionsRef).current?.close();
|
|
70
93
|
}, [externalActionsRef]);
|
|
71
|
-
const
|
|
72
|
-
if (disabled || dateDisabled(date)) return;
|
|
73
|
-
const nextValue = require_date_utils.createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());
|
|
94
|
+
const setValue = (0, react.useCallback)((nextValue) => {
|
|
74
95
|
setUncontrolledValue(nextValue);
|
|
96
|
+
onValueChange?.(nextValue);
|
|
97
|
+
}, [onValueChange]);
|
|
98
|
+
const monthDisabled = (0, react.useCallback)((candidate) => {
|
|
99
|
+
const firstDay = require_date_utils.startOfMonth(candidate);
|
|
100
|
+
const lastDay = require_date_utils.createCalendarDate(candidate.getFullYear(), candidate.getMonth() + 1, 0);
|
|
101
|
+
return Boolean(minDate && require_date_utils.isBeforeDay(lastDay, minDate) || maxDate && require_date_utils.isAfterDay(firstDay, maxDate));
|
|
102
|
+
}, [maxDate, minDate]);
|
|
103
|
+
const onSelect = (0, react.useCallback)((date) => {
|
|
104
|
+
if (disabled || (granularity === "month" ? monthDisabled(date) : dateDisabled(date))) return;
|
|
105
|
+
const nextValue = require_date_utils.createCalendarDate(date.getFullYear(), date.getMonth(), granularity === "month" ? 1 : date.getDate());
|
|
106
|
+
if (granularity === "date-time") {
|
|
107
|
+
nextValue.setHours(selected?.getHours() ?? 12, selected?.getMinutes() ?? 0, 0, 0);
|
|
108
|
+
if (minDate && require_date_utils.isSameDay(nextValue, minDate) && nextValue < minDate) nextValue.setHours(minDate.getHours(), minDate.getMinutes(), 0, 0);
|
|
109
|
+
if (maxDate && require_date_utils.isSameDay(nextValue, maxDate) && nextValue > maxDate) nextValue.setHours(maxDate.getHours(), maxDate.getMinutes(), 0, 0);
|
|
110
|
+
}
|
|
111
|
+
setValue(nextValue);
|
|
75
112
|
setFocusedDate(nextValue);
|
|
76
113
|
setMonth(require_date_utils.startOfMonth(nextValue));
|
|
77
|
-
onValueChange?.(nextValue);
|
|
78
114
|
if (closeOnSelect) close();
|
|
79
115
|
}, [
|
|
80
116
|
close,
|
|
81
117
|
closeOnSelect,
|
|
82
118
|
dateDisabled,
|
|
83
119
|
disabled,
|
|
84
|
-
|
|
85
|
-
|
|
120
|
+
granularity,
|
|
121
|
+
maxDate,
|
|
122
|
+
monthDisabled,
|
|
123
|
+
minDate,
|
|
124
|
+
selected,
|
|
125
|
+
setMonth,
|
|
126
|
+
setValue
|
|
86
127
|
]);
|
|
87
128
|
const onClear = (0, react.useCallback)(() => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
129
|
+
setValue(null);
|
|
130
|
+
}, [setValue]);
|
|
131
|
+
const selectMonth = (0, react.useCallback)((monthIndex) => {
|
|
132
|
+
const nextMonth = clampMonth(require_date_utils.createCalendarDate(month.getFullYear(), monthIndex, 1));
|
|
133
|
+
if (monthDisabled(nextMonth)) return;
|
|
134
|
+
setMonth(nextMonth);
|
|
135
|
+
if (granularity === "month") {
|
|
136
|
+
const nextValue = require_date_utils.createCalendarDate(nextMonth.getFullYear(), nextMonth.getMonth(), 1);
|
|
137
|
+
setFocusedDate(nextValue);
|
|
138
|
+
setValue(nextValue);
|
|
139
|
+
if (closeOnSelect) close();
|
|
140
|
+
}
|
|
141
|
+
}, [
|
|
142
|
+
clampMonth,
|
|
143
|
+
close,
|
|
144
|
+
closeOnSelect,
|
|
145
|
+
granularity,
|
|
146
|
+
month,
|
|
147
|
+
monthDisabled,
|
|
148
|
+
setMonth,
|
|
149
|
+
setValue
|
|
150
|
+
]);
|
|
151
|
+
const selectYear = (0, react.useCallback)((year) => {
|
|
152
|
+
const nextMonth = clampMonth(require_date_utils.createCalendarDate(year, month.getMonth(), 1));
|
|
153
|
+
if (monthDisabled(nextMonth)) return;
|
|
154
|
+
setMonth(nextMonth);
|
|
155
|
+
if (granularity === "month") {
|
|
156
|
+
const nextValue = require_date_utils.createCalendarDate(nextMonth.getFullYear(), nextMonth.getMonth(), 1);
|
|
157
|
+
setFocusedDate(nextValue);
|
|
158
|
+
setValue(nextValue);
|
|
159
|
+
if (closeOnSelect) close();
|
|
160
|
+
}
|
|
161
|
+
}, [
|
|
162
|
+
clampMonth,
|
|
163
|
+
close,
|
|
164
|
+
closeOnSelect,
|
|
165
|
+
granularity,
|
|
166
|
+
month,
|
|
167
|
+
monthDisabled,
|
|
168
|
+
setMonth,
|
|
169
|
+
setValue
|
|
170
|
+
]);
|
|
171
|
+
const onTimeChange = (0, react.useCallback)((value) => {
|
|
172
|
+
const match = value.match(/^(\d{2}):(\d{2})$/);
|
|
173
|
+
if (!match) return;
|
|
174
|
+
const hours = Number(match[1]);
|
|
175
|
+
const minutes = Number(match[2]);
|
|
176
|
+
if (hours > 23 || minutes > 59) return;
|
|
177
|
+
const baseDate = selected ?? focusedDate;
|
|
178
|
+
const nextValue = require_date_utils.createCalendarDate(baseDate.getFullYear(), baseDate.getMonth(), baseDate.getDate());
|
|
179
|
+
nextValue.setHours(hours, minutes, 0, 0);
|
|
180
|
+
if (minDate && require_date_utils.isSameDay(nextValue, minDate) && nextValue < minDate) return;
|
|
181
|
+
if (maxDate && require_date_utils.isSameDay(nextValue, maxDate) && nextValue > maxDate) return;
|
|
182
|
+
setValue(nextValue);
|
|
183
|
+
}, [
|
|
184
|
+
focusedDate,
|
|
185
|
+
maxDate,
|
|
186
|
+
minDate,
|
|
187
|
+
selected,
|
|
188
|
+
setValue
|
|
189
|
+
]);
|
|
91
190
|
const focusDate = (0, react.useCallback)((date, direction = 1) => {
|
|
92
191
|
let nextDate = require_date_utils.createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());
|
|
93
192
|
const step = direction < 0 ? -1 : 1;
|
|
@@ -102,39 +201,51 @@ function DatePickerRoot({ children, closeOnSelect = true, defaultValue = null, d
|
|
|
102
201
|
focusTarget();
|
|
103
202
|
queueMicrotask(focusTarget);
|
|
104
203
|
}, [dateDisabled, setMonth]);
|
|
204
|
+
const canNavigate = (0, react.useCallback)((amount) => {
|
|
205
|
+
const nextMonth = require_date_utils.addMonths(month, amount);
|
|
206
|
+
return !(minMonth && require_date_utils.isBeforeDay(nextMonth, minMonth) || maxMonth && require_date_utils.isAfterDay(nextMonth, maxMonth));
|
|
207
|
+
}, [
|
|
208
|
+
maxMonth,
|
|
209
|
+
minMonth,
|
|
210
|
+
month
|
|
211
|
+
]);
|
|
212
|
+
const registerDay = (0, react.useCallback)((key, node) => {
|
|
213
|
+
if (node) dayRefs.current.set(key, node);
|
|
214
|
+
else dayRefs.current.delete(key);
|
|
215
|
+
}, []);
|
|
216
|
+
const timeMin = selected && minDate && require_date_utils.isSameDay(selected, minDate) ? require_date_utils.toTimeInput(minDate) : void 0;
|
|
217
|
+
const timeMax = selected && maxDate && require_date_utils.isSameDay(selected, maxDate) ? require_date_utils.toTimeInput(maxDate) : void 0;
|
|
105
218
|
const context = {
|
|
106
|
-
canNavigate
|
|
107
|
-
const nextMonth = require_date_utils.addMonths(month, amount);
|
|
108
|
-
return !(minMonth && require_date_utils.isBeforeDay(nextMonth, minMonth) || maxMonth && require_date_utils.isAfterDay(nextMonth, maxMonth));
|
|
109
|
-
}, [
|
|
110
|
-
maxMonth,
|
|
111
|
-
minMonth,
|
|
112
|
-
month
|
|
113
|
-
]),
|
|
219
|
+
canNavigate,
|
|
114
220
|
close,
|
|
115
221
|
dateDisabled,
|
|
222
|
+
granularity,
|
|
116
223
|
disabled,
|
|
117
224
|
focusDate,
|
|
118
225
|
focusedDate,
|
|
119
|
-
formatDate: (date) => require_date_utils.formatDateLabel(date, locale, String(placeholder)),
|
|
226
|
+
formatDate: (date) => require_date_utils.formatDateLabel(date, locale, String(placeholder), granularity),
|
|
120
227
|
labelId,
|
|
121
228
|
locale,
|
|
122
229
|
month,
|
|
230
|
+
monthDisabled,
|
|
123
231
|
onClear,
|
|
232
|
+
onTimeChange,
|
|
124
233
|
onSelect,
|
|
234
|
+
selectMonth,
|
|
235
|
+
selectYear,
|
|
125
236
|
placeholder,
|
|
126
|
-
registerDay
|
|
127
|
-
if (node) dayRefs.current.set(key, node);
|
|
128
|
-
else dayRefs.current.delete(key);
|
|
129
|
-
}, []),
|
|
237
|
+
registerDay,
|
|
130
238
|
selected,
|
|
131
239
|
setFocusedDate,
|
|
132
240
|
setMonth,
|
|
133
241
|
size,
|
|
134
242
|
styles,
|
|
135
243
|
today: require_date_utils.createCalendarDate(today.getFullYear(), today.getMonth(), today.getDate()),
|
|
244
|
+
timeMax,
|
|
245
|
+
timeMin,
|
|
136
246
|
triggerId,
|
|
137
|
-
weekStartsOn
|
|
247
|
+
weekStartsOn,
|
|
248
|
+
yearRange
|
|
138
249
|
};
|
|
139
250
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DatePickerContext.Provider, {
|
|
140
251
|
value: context,
|
|
@@ -146,7 +257,7 @@ function DatePickerRoot({ children, closeOnSelect = true, defaultValue = null, d
|
|
|
146
257
|
disabled,
|
|
147
258
|
name,
|
|
148
259
|
type: "hidden",
|
|
149
|
-
value: require_date_utils.toInputDate(selected)
|
|
260
|
+
value: granularity === "month" ? require_date_utils.toInputMonth(selected) : granularity === "date-time" ? require_date_utils.toInputDateTime(selected) : require_date_utils.toInputDate(selected)
|
|
150
261
|
}) : null]
|
|
151
262
|
});
|
|
152
263
|
}
|
|
@@ -245,7 +356,7 @@ const DatePickerClose = (0, react.forwardRef)(function DatePickerClose({ classNa
|
|
|
245
356
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_popover.Popover.Close, {
|
|
246
357
|
...props,
|
|
247
358
|
ref,
|
|
248
|
-
className: require_base_ui.withRecipeClassName(styles.
|
|
359
|
+
className: require_base_ui.withRecipeClassName(styles.close, className),
|
|
249
360
|
"data-slot": "date-picker-close"
|
|
250
361
|
});
|
|
251
362
|
});
|
|
@@ -268,6 +379,59 @@ const DatePickerCaption = (0, react.forwardRef)(function DatePickerCaption({ chi
|
|
|
268
379
|
children: children ?? require_date_utils.formatMonthLabel(month, locale)
|
|
269
380
|
});
|
|
270
381
|
});
|
|
382
|
+
const DatePickerMonthSelect = (0, react.forwardRef)(function DatePickerMonthSelect({ className, ...props }, ref) {
|
|
383
|
+
const { locale, month, monthDisabled, selectMonth, styles } = useDatePickerContext();
|
|
384
|
+
const labels = require_date_utils.getMonthLabels(locale);
|
|
385
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
386
|
+
...props,
|
|
387
|
+
"aria-label": props["aria-label"] ?? "Select month",
|
|
388
|
+
className: require_cx.cx(styles.monthSelect, className),
|
|
389
|
+
"data-slot": "date-picker-month-select",
|
|
390
|
+
onChange: (event) => selectMonth(Number(event.currentTarget.value)),
|
|
391
|
+
ref,
|
|
392
|
+
value: month.getMonth(),
|
|
393
|
+
children: labels.map((label, monthIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
394
|
+
disabled: monthDisabled(require_date_utils.createCalendarDate(month.getFullYear(), monthIndex, 1)),
|
|
395
|
+
value: monthIndex,
|
|
396
|
+
children: label
|
|
397
|
+
}, label))
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
const DatePickerYearSelect = (0, react.forwardRef)(function DatePickerYearSelect({ className, ...props }, ref) {
|
|
401
|
+
const { month, monthDisabled, selectYear, styles, yearRange } = useDatePickerContext();
|
|
402
|
+
const years = Array.from({ length: yearRange.end - yearRange.start + 1 }, (_, index) => yearRange.start + index);
|
|
403
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
404
|
+
...props,
|
|
405
|
+
"aria-label": props["aria-label"] ?? "Select year",
|
|
406
|
+
className: require_cx.cx(styles.yearSelect, className),
|
|
407
|
+
"data-slot": "date-picker-year-select",
|
|
408
|
+
onChange: (event) => selectYear(Number(event.currentTarget.value)),
|
|
409
|
+
ref,
|
|
410
|
+
value: month.getFullYear(),
|
|
411
|
+
children: years.map((year) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
412
|
+
disabled: monthDisabled(require_date_utils.createCalendarDate(year, month.getMonth(), 1)),
|
|
413
|
+
value: year,
|
|
414
|
+
children: year
|
|
415
|
+
}, year))
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
const DatePickerTimeField = (0, react.forwardRef)(function DatePickerTimeField({ className, ...props }, ref) {
|
|
419
|
+
const { disabled, granularity, onTimeChange, selected, styles, timeMax, timeMin } = useDatePickerContext();
|
|
420
|
+
if (granularity !== "date-time") return null;
|
|
421
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
422
|
+
...props,
|
|
423
|
+
"aria-label": props["aria-label"] ?? "Select time",
|
|
424
|
+
className: require_cx.cx(styles.timeField, className),
|
|
425
|
+
"data-slot": "date-picker-time-field",
|
|
426
|
+
disabled: disabled || !selected,
|
|
427
|
+
max: timeMax,
|
|
428
|
+
min: timeMin,
|
|
429
|
+
onChange: (event) => onTimeChange(event.currentTarget.value),
|
|
430
|
+
ref,
|
|
431
|
+
type: "time",
|
|
432
|
+
value: require_date_utils.toTimeInput(selected)
|
|
433
|
+
});
|
|
434
|
+
});
|
|
271
435
|
const DatePickerNavigationButton = (0, react.forwardRef)(function DatePickerNavigationButton({ amount, children, className, onClick, ...props }, ref) {
|
|
272
436
|
const { canNavigate, month, setMonth, styles } = useDatePickerContext();
|
|
273
437
|
const direction = amount ?? 1;
|
|
@@ -380,17 +544,44 @@ const DatePickerDay = (0, react.forwardRef)(function DatePickerDay({ children, c
|
|
|
380
544
|
children: children ?? date.getDate()
|
|
381
545
|
});
|
|
382
546
|
});
|
|
547
|
+
const DatePickerMonthButton = (0, react.forwardRef)(function DatePickerMonthButton({ date }, ref) {
|
|
548
|
+
const { disabled, granularity, locale, monthDisabled, onSelect, selected, styles } = useDatePickerContext();
|
|
549
|
+
const isDisabled = disabled || monthDisabled(date);
|
|
550
|
+
const isSelected = granularity === "month" && Boolean(selected && isSameMonth(selected, date));
|
|
551
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
552
|
+
"aria-label": new Intl.DateTimeFormat(locale, { month: "long" }).format(date),
|
|
553
|
+
"aria-selected": isSelected,
|
|
554
|
+
className: styles.month,
|
|
555
|
+
"data-disabled": isDisabled || void 0,
|
|
556
|
+
"data-selected": isSelected || void 0,
|
|
557
|
+
"data-slot": "date-picker-month",
|
|
558
|
+
disabled: isDisabled,
|
|
559
|
+
onClick: () => onSelect(date),
|
|
560
|
+
ref,
|
|
561
|
+
role: "gridcell",
|
|
562
|
+
type: "button",
|
|
563
|
+
children: new Intl.DateTimeFormat(locale, { month: "short" }).format(date)
|
|
564
|
+
});
|
|
565
|
+
});
|
|
383
566
|
const DatePickerCalendar = (0, react.forwardRef)(function DatePickerCalendar({ "aria-label": ariaLabel, className, ...props }, ref) {
|
|
384
|
-
const { locale, month, styles, weekStartsOn } = useDatePickerContext();
|
|
567
|
+
const { granularity, locale, month, styles, weekStartsOn } = useDatePickerContext();
|
|
385
568
|
const days = (0, react.useMemo)(() => require_date_utils.getCalendarDays(month, weekStartsOn), [month, weekStartsOn]);
|
|
386
569
|
const weekdays = (0, react.useMemo)(() => require_date_utils.getWeekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
387
|
-
|
|
570
|
+
const monthDates = (0, react.useMemo)(() => Array.from({ length: 12 }, (_, index) => require_date_utils.createCalendarDate(month.getFullYear(), index, 1)), [month]);
|
|
571
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
388
572
|
...props,
|
|
389
573
|
ref,
|
|
390
574
|
"aria-label": ariaLabel ?? require_date_utils.formatMonthLabel(month, locale),
|
|
391
575
|
className: require_cx.cx(styles.calendar, className),
|
|
576
|
+
"data-granularity": granularity,
|
|
392
577
|
"data-slot": "date-picker-calendar",
|
|
393
|
-
children:
|
|
578
|
+
children: granularity === "month" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
579
|
+
"aria-label": String(month.getFullYear()),
|
|
580
|
+
className: styles.monthGrid,
|
|
581
|
+
"data-slot": "date-picker-month-grid",
|
|
582
|
+
role: "grid",
|
|
583
|
+
children: monthDates.map((date) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerMonthButton, { date }, require_date_utils.dateKey(date)))
|
|
584
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
394
585
|
"aria-hidden": "true",
|
|
395
586
|
className: styles.weekdays,
|
|
396
587
|
"data-slot": "date-picker-weekdays",
|
|
@@ -405,7 +596,7 @@ const DatePickerCalendar = (0, react.forwardRef)(function DatePickerCalendar({ "
|
|
|
405
596
|
"data-slot": "date-picker-grid",
|
|
406
597
|
role: "grid",
|
|
407
598
|
children: days.map((date) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerDay, { date }, require_date_utils.dateKey(date)))
|
|
408
|
-
})]
|
|
599
|
+
})] })
|
|
409
600
|
});
|
|
410
601
|
});
|
|
411
602
|
const DatePicker = {
|
|
@@ -421,6 +612,9 @@ const DatePicker = {
|
|
|
421
612
|
Close: DatePickerClose,
|
|
422
613
|
Header: DatePickerHeader,
|
|
423
614
|
Caption: DatePickerCaption,
|
|
615
|
+
MonthSelect: DatePickerMonthSelect,
|
|
616
|
+
YearSelect: DatePickerYearSelect,
|
|
617
|
+
TimeField: DatePickerTimeField,
|
|
424
618
|
Previous: DatePickerPrevious,
|
|
425
619
|
Next: DatePickerNext,
|
|
426
620
|
Day: DatePickerDay,
|
|
@@ -436,13 +630,16 @@ exports.DatePickerControl = DatePickerControl;
|
|
|
436
630
|
exports.DatePickerDay = DatePickerDay;
|
|
437
631
|
exports.DatePickerHeader = DatePickerHeader;
|
|
438
632
|
exports.DatePickerLabel = DatePickerLabel;
|
|
633
|
+
exports.DatePickerMonthSelect = DatePickerMonthSelect;
|
|
439
634
|
exports.DatePickerNext = DatePickerNext;
|
|
440
635
|
exports.DatePickerPopup = DatePickerPopup;
|
|
441
636
|
exports.DatePickerPortal = DatePickerPortal;
|
|
442
637
|
exports.DatePickerPositioner = DatePickerPositioner;
|
|
443
638
|
exports.DatePickerPrevious = DatePickerPrevious;
|
|
444
639
|
exports.DatePickerRoot = DatePickerRoot;
|
|
640
|
+
exports.DatePickerTimeField = DatePickerTimeField;
|
|
445
641
|
exports.DatePickerTrigger = DatePickerTrigger;
|
|
446
642
|
exports.DatePickerValue = DatePickerValue;
|
|
643
|
+
exports.DatePickerYearSelect = DatePickerYearSelect;
|
|
447
644
|
|
|
448
645
|
//# sourceMappingURL=date-picker.cjs.map
|