@42-central/ui-react 0.20.1 → 0.20.2
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/dist/{chunk-MKKQE3TM.js → chunk-2BNIHOMT.js} +3 -3
- package/dist/{chunk-MKKQE3TM.js.map → chunk-2BNIHOMT.js.map} +1 -1
- package/dist/{chunk-LBAE6FP6.js → chunk-37VQGKD6.js} +4 -4
- package/dist/{chunk-LBAE6FP6.js.map → chunk-37VQGKD6.js.map} +1 -1
- package/dist/{chunk-SXNAUSEB.js → chunk-45TG7H5Q.js} +3 -3
- package/dist/{chunk-SXNAUSEB.js.map → chunk-45TG7H5Q.js.map} +1 -1
- package/dist/{chunk-NJPHZBLI.js → chunk-5CNVVA7I.js} +4 -4
- package/dist/{chunk-NJPHZBLI.js.map → chunk-5CNVVA7I.js.map} +1 -1
- package/dist/{chunk-BNWQ7IAZ.js → chunk-C74TV64U.js} +5 -5
- package/dist/{chunk-BNWQ7IAZ.js.map → chunk-C74TV64U.js.map} +1 -1
- package/dist/{chunk-RCF7HTG5.js → chunk-FDCPMUJK.js} +4 -4
- package/dist/{chunk-RCF7HTG5.js.map → chunk-FDCPMUJK.js.map} +1 -1
- package/dist/{chunk-E63VD25L.js → chunk-HQPU73WV.js} +4 -4
- package/dist/{chunk-E63VD25L.js.map → chunk-HQPU73WV.js.map} +1 -1
- package/dist/{chunk-POKLPMSB.js → chunk-LFQDB5OD.js} +3 -3
- package/dist/{chunk-POKLPMSB.js.map → chunk-LFQDB5OD.js.map} +1 -1
- package/dist/{chunk-5HUEBSIS.js → chunk-N66NC6QK.js} +120 -24
- package/dist/chunk-N66NC6QK.js.map +1 -0
- package/dist/{chunk-IOYZC7SA.js → chunk-UCCJUFOG.js} +3 -3
- package/dist/{chunk-IOYZC7SA.js.map → chunk-UCCJUFOG.js.map} +1 -1
- package/dist/{chunk-KMZENCEP.js → chunk-UVQXRDRO.js} +3 -3
- package/dist/{chunk-KMZENCEP.js.map → chunk-UVQXRDRO.js.map} +1 -1
- package/dist/chunk-V6PY7C6S.js +18 -0
- package/dist/chunk-V6PY7C6S.js.map +1 -0
- package/dist/{chunk-TWLJQE75.js → chunk-WXL5RP6P.js} +3 -3
- package/dist/{chunk-TWLJQE75.js.map → chunk-WXL5RP6P.js.map} +1 -1
- package/dist/{chunk-VTDBWU6H.js → chunk-YZJUPYPO.js} +3 -3
- package/dist/{chunk-VTDBWU6H.js.map → chunk-YZJUPYPO.js.map} +1 -1
- package/dist/{chunk-3BXKTWWD.js → chunk-Z4MBCKG5.js} +4 -4
- package/dist/{chunk-3BXKTWWD.js.map → chunk-Z4MBCKG5.js.map} +1 -1
- package/dist/components/autocomplete/index.js +3 -2
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/camera/index.js +5 -4
- package/dist/components/code-block/chrome.js +4 -4
- package/dist/components/code-block/index.js +5 -5
- package/dist/components/combobox/index.js +3 -2
- package/dist/components/combobox-list/index.js +5 -4
- package/dist/components/data-table/index.js +12 -12
- package/dist/components/date-picker/index.js +6 -5
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts +44 -26
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +35 -53
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/menu/index.js +3 -3
- package/dist/components/multi-combobox-list/index.js +5 -4
- package/dist/components/multi-select/index.js +3 -2
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/number-input/index.js +3 -2
- package/dist/components/photo-capture/index.js +5 -4
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +1 -1
- package/dist/components/popover/index.d.ts.map +1 -1
- package/dist/components/popover/index.js +2 -1
- package/dist/components/popover/popover.d.ts +44 -29
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/schedule/index.js +2 -2
- package/dist/components/select/index.js +4 -3
- package/dist/components/spotlight/index.js +3 -2
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/tags-input/index.js +2 -1
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/time-input/index.js +4 -3
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/tree-multi-select/index.js +3 -2
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-select/index.js +3 -2
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/lib/placement.d.ts +42 -1
- package/dist/lib/placement.d.ts.map +1 -1
- package/dist/lib/slide-on-switch.d.ts +69 -0
- package/dist/lib/slide-on-switch.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/hover-card/hover-card.tsx +89 -167
- package/src/components/popover/index.ts +2 -0
- package/src/components/popover/popover.test.tsx +131 -0
- package/src/components/popover/popover.tsx +191 -53
- package/src/lib/placement.test.ts +37 -0
- package/src/lib/placement.ts +60 -1
- package/src/lib/slide-on-switch.ts +99 -0
- package/dist/chunk-5HUEBSIS.js.map +0 -1
- package/dist/chunk-G52U24GR.js +0 -10
- package/dist/chunk-G52U24GR.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { normalizeSelectData, useLabelSearch, filterSelectData } from '../../chunk-7TDHT3QD.js';
|
|
3
3
|
import { controlOpenProps } from '../../chunk-5FDOOG4J.js';
|
|
4
|
-
import { resolveComboboxTranslations, Combobox } from '../../chunk-
|
|
4
|
+
import { resolveComboboxTranslations, Combobox } from '../../chunk-2BNIHOMT.js';
|
|
5
5
|
import { inputControlClasses, inputSlot } from '../../chunk-45QRQKRC.js';
|
|
6
6
|
import { FieldShell } from '../../chunk-VD6PB3VA.js';
|
|
7
|
-
import { popoverClearTrigger } from '../../chunk-
|
|
7
|
+
import { popoverClearTrigger } from '../../chunk-N66NC6QK.js';
|
|
8
|
+
import '../../chunk-V6PY7C6S.js';
|
|
8
9
|
import '../../chunk-7P32XCEU.js';
|
|
9
10
|
import '../../chunk-H7WOMZXO.js';
|
|
10
11
|
import { useUncontrolled } from '../../chunk-PMUCGFY5.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0GO,IAAM,eAAe,CAA6C;AAAA,EACvE,IAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA,GAAmB,SAAA;AAAA,EACnB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA,GAAQ,eAAA;AAAA,EACR,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,SAAA;AAAA,EACV,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,KAA+B;AAC7B,EAAA,MAAM,oBAAA,GAAuB,4BAA4B,YAAY,CAAA;AAGrE,EAAA,MAAM,SAAA,GAAY,WAAW,KAAA,IAAS,IAAA;AAEtC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,eAAA,CAAgB;AAAA,IACxC,KAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA,EAAY;AAAA,GACb,CAAA;AAGD,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,SAAA,IAAa,KAAK,CAAA;AAG5C,EAAA,MAAM,UAAA,GAAa,QAAQ,MAAM,mBAAA,CAAoB,IAAI,CAAA,EAAG,CAAC,IAAI,CAAC,CAAA;AAClE,EAAA,MAAM,SAAS,cAAA,EAAe;AAC9B,EAAA,MAAM,EAA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OAAA,EAAT,EAAiB,SAAA,EAAW,YAAY,OAAA,EACtC,QAAA,EAAA;AAAA,UAAA,MAAA,GACG,MAAA,CAAO,IAAI,CAAC,KAAA,yBACT,QAAA,CAAS,KAAA,EAAT,EAAiC,KAAA,EAAO,KAAA,CAAM,KAAA,EAC5C,gBAAM,KAAA,CAAM,GAAA,CAAI,YAAY,CAAA,EAAA,EADV,KAAA,CAAM,KAE3B,CACD,CAAA,GACD,KAAA,CAAM,GAAA,CAAI,YAAY,CAAA;AAAA,UACzB,SAAS,IAAA,oBAAQ,GAAA,CAAC,QAAA,CAAS,KAAA,EAAT,EAAgB,QAAA,EAAA,KAAA,EAAM;AAAA,SAAA,EAC3C;AAAA;AAAA;AAAA,GACF;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n filterSelectData,\n type ItemRenderState,\n type NormalizedItem,\n type NormalizedItemOf,\n normalizeSelectData,\n type SelectData,\n type SelectPayload,\n useLabelSearch,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport {\n Combobox,\n type ComboboxTranslations,\n resolveComboboxTranslations,\n} from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { type InputSize, type InputVariant, inputControlClasses, inputSlot } from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * Autocomplete — free-text input with a suggestion popover, on the `Combobox`\n * engine. Unlike `Select`, the **value is the typed string** (`allowCustomValue`):\n * `data` are only suggestions, and the user can type anything or pick one.\n *\n * - `data` accepts the same shapes as `Select` (strings / objects / groups).\n * - Suggestions filter as you type. Once the query exactly\n * matches a suggestion (e.g. right after picking one) the full list shows\n * again rather than collapsing to that single match.\n * - Label / description / error come from the built-in `Field` wrapper.\n */\n\ntype AutocompleteClassNames = {\n field?: string\n control?: string\n input?: string\n option?: string\n popover?: string\n}\n\nexport type AutocompleteProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Suggestions: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled input text (this is the value). */\n value?: string\n /** Uncontrolled initial text. */\n defaultValue?: string\n /** Fires with the input text on every change (typing or picking a suggestion). */\n onChange?: (value: string) => void\n /**\n * Render each suggestion yourself. Receives the item — including its typed\n * `payload` — and its live `{ selected, highlighted }` state; you own the whole\n * row, including any check affordance. Omit it to render the label + selected\n * check.\n */\n renderItem?: (item: NormalizedItem<SelectPayload<Data>>, state: ItemRenderState) => ReactNode\n /** Placeholder shown while the field is empty — this same field also filters the\n * suggestion list, so there's no separate search placeholder. */\n placeholder?: string\n /** Show a clear button once there's text. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the clear button / chevron. */\n endSlot?: ReactNode\n /** Message shown when no suggestion matches. Pass `null` to render nothing. */\n empty?: ReactNode\n size?: InputSize\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for the underlying input (form submission). */\n name?: string\n /** Forwarded to the input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: AutocompleteClassNames\n /** Overrides the clear button's (`clearTriggerLabel`, default `\"Clear value\"`) and the\n * chevron's (`triggerLabel`, default `\"Show options\"`) accessible names. A partial\n * override keeps the other default. */\n translations?: AutocompleteTranslations\n }\n\n/** The combobox family's wording, as `Autocomplete` uses it — see `ComboboxTranslations`. */\nexport type AutocompleteTranslations = ComboboxTranslations\n\nexport const Autocomplete = <const Data extends SelectData = SelectData>({\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder,\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n empty = \"Nothing found\",\n size = \"md\",\n variant = \"default\",\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n translations,\n}: AutocompleteProps<Data>) => {\n const resolvedTranslations = resolveComboboxTranslations(translations)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n const [query, setQuery] = useUncontrolled({\n value,\n defaultValue,\n onChange,\n finalValue: \"\",\n })\n\n // Clear shows once there's text; in \"replace\" mode it hides the chevron.\n const showClear = Boolean(clearable && query)\n\n // Normalize once per `data`; only the filter re-runs as the query changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const search = useLabelSearch()\n const { collection, items, groups } = useMemo(() => {\n // Once the query exactly matches an option (e.g. right after\n // picking one) show the full list again rather than just that match.\n const exact = normalized.items.some((i) => search.equals(i.label, query))\n return filterSelectData(normalized, (item) => exact || search.matches(item.label, query))\n }, [normalized, query, search])\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={classNames?.option}\n >\n {renderItem ? (state) => renderItem(item, state) : item.label}\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root\n collection={collection}\n inputValue={query}\n onInputValueChange={(details) => setQuery(details.inputValue)}\n allowCustomValue\n openOnClick\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n translations={resolvedTranslations}\n >\n <Combobox.Context>\n {(api) => (\n <Combobox.Control\n className={classNames?.control}\n startSlot={startSlot}\n {...props({ \"data-invalid\": isInvalid })}\n // Tablet affordance: a tap on the field's dead zones (start/end slots,\n // padding) opens the suggestions and focuses the input. The input,\n // clear ✕ and chevron keep their own taps. Inert when disabled/readOnly.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n >\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `onBlur` / `aria-invalid` pass straight through. */}\n <ArkCombobox.Input\n placeholder={placeholder}\n name={name}\n onBlur={onBlur}\n ref={ref}\n {...props({ \"aria-invalid\": isInvalid, \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {/* The value here is the typed text, not a machine selection, so Ark's\n `value`-gated ClearTrigger stays hidden — clear the input directly\n instead. A real (tabbable) button; `preventDefault` keeps focus on\n the input through the tap. */}\n {showClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => setQuery(\"\")}\n className={popoverClearTrigger}\n >\n <CloseIcon />\n </button>\n )}\n {(clearSectionMode === \"both\" || !showClear) && <Combobox.Trigger data-chevron />}\n </Combobox.Control>\n )}\n </Combobox.Context>\n\n <Combobox.Content className={classNames?.popover}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Content>\n </Combobox.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0GO,IAAM,eAAe,CAA6C;AAAA,EACvE,IAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA,GAAmB,SAAA;AAAA,EACnB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA,GAAQ,eAAA;AAAA,EACR,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,SAAA;AAAA,EACV,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,KAA+B;AAC7B,EAAA,MAAM,oBAAA,GAAuB,4BAA4B,YAAY,CAAA;AAGrE,EAAA,MAAM,SAAA,GAAY,WAAW,KAAA,IAAS,IAAA;AAEtC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,eAAA,CAAgB;AAAA,IACxC,KAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA,EAAY;AAAA,GACb,CAAA;AAGD,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,SAAA,IAAa,KAAK,CAAA;AAG5C,EAAA,MAAM,UAAA,GAAa,QAAQ,MAAM,mBA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CAAS,OAAA,EAAT,EAAiB,cAAA,EAAY,IAAA,EAAC;AAAA;AAAA;AAAA,SACjF,EAEJ,CAAA;AAAA,6BAEC,QAAA,CAAS,OAAA,EAAT,EAAiB,SAAA,EAAW,YAAY,OAAA,EACtC,QAAA,EAAA;AAAA,UAAA,MAAA,GACG,MAAA,CAAO,IAAI,CAAC,KAAA,yBACT,QAAA,CAAS,KAAA,EAAT,EAAiC,KAAA,EAAO,KAAA,CAAM,KAAA,EAC5C,gBAAM,KAAA,CAAM,GAAA,CAAI,YAAY,CAAA,EAAA,EADV,KAAA,CAAM,KAE3B,CACD,CAAA,GACD,KAAA,CAAM,GAAA,CAAI,YAAY,CAAA;AAAA,UACzB,SAAS,IAAA,oBAAQ,GAAA,CAAC,QAAA,CAAS,KAAA,EAAT,EAAgB,QAAA,EAAA,KAAA,EAAM;AAAA,SAAA,EAC3C;AAAA;AAAA;AAAA,GACF;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n filterSelectData,\n type ItemRenderState,\n type NormalizedItem,\n type NormalizedItemOf,\n normalizeSelectData,\n type SelectData,\n type SelectPayload,\n useLabelSearch,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport {\n Combobox,\n type ComboboxTranslations,\n resolveComboboxTranslations,\n} from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { type InputSize, type InputVariant, inputControlClasses, inputSlot } from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * Autocomplete — free-text input with a suggestion popover, on the `Combobox`\n * engine. Unlike `Select`, the **value is the typed string** (`allowCustomValue`):\n * `data` are only suggestions, and the user can type anything or pick one.\n *\n * - `data` accepts the same shapes as `Select` (strings / objects / groups).\n * - Suggestions filter as you type. Once the query exactly\n * matches a suggestion (e.g. right after picking one) the full list shows\n * again rather than collapsing to that single match.\n * - Label / description / error come from the built-in `Field` wrapper.\n */\n\ntype AutocompleteClassNames = {\n field?: string\n control?: string\n input?: string\n option?: string\n popover?: string\n}\n\nexport type AutocompleteProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Suggestions: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled input text (this is the value). */\n value?: string\n /** Uncontrolled initial text. */\n defaultValue?: string\n /** Fires with the input text on every change (typing or picking a suggestion). */\n onChange?: (value: string) => void\n /**\n * Render each suggestion yourself. Receives the item — including its typed\n * `payload` — and its live `{ selected, highlighted }` state; you own the whole\n * row, including any check affordance. Omit it to render the label + selected\n * check.\n */\n renderItem?: (item: NormalizedItem<SelectPayload<Data>>, state: ItemRenderState) => ReactNode\n /** Placeholder shown while the field is empty — this same field also filters the\n * suggestion list, so there's no separate search placeholder. */\n placeholder?: string\n /** Show a clear button once there's text. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the clear button / chevron. */\n endSlot?: ReactNode\n /** Message shown when no suggestion matches. Pass `null` to render nothing. */\n empty?: ReactNode\n size?: InputSize\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for the underlying input (form submission). */\n name?: string\n /** Forwarded to the input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: AutocompleteClassNames\n /** Overrides the clear button's (`clearTriggerLabel`, default `\"Clear value\"`) and the\n * chevron's (`triggerLabel`, default `\"Show options\"`) accessible names. A partial\n * override keeps the other default. */\n translations?: AutocompleteTranslations\n }\n\n/** The combobox family's wording, as `Autocomplete` uses it — see `ComboboxTranslations`. */\nexport type AutocompleteTranslations = ComboboxTranslations\n\nexport const Autocomplete = <const Data extends SelectData = SelectData>({\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder,\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n empty = \"Nothing found\",\n size = \"md\",\n variant = \"default\",\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n translations,\n}: AutocompleteProps<Data>) => {\n const resolvedTranslations = resolveComboboxTranslations(translations)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n const [query, setQuery] = useUncontrolled({\n value,\n defaultValue,\n onChange,\n finalValue: \"\",\n })\n\n // Clear shows once there's text; in \"replace\" mode it hides the chevron.\n const showClear = Boolean(clearable && query)\n\n // Normalize once per `data`; only the filter re-runs as the query changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const search = useLabelSearch()\n const { collection, items, groups } = useMemo(() => {\n // Once the query exactly matches an option (e.g. right after\n // picking one) show the full list again rather than just that match.\n const exact = normalized.items.some((i) => search.equals(i.label, query))\n return filterSelectData(normalized, (item) => exact || search.matches(item.label, query))\n }, [normalized, query, search])\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={classNames?.option}\n >\n {renderItem ? (state) => renderItem(item, state) : item.label}\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root\n collection={collection}\n inputValue={query}\n onInputValueChange={(details) => setQuery(details.inputValue)}\n allowCustomValue\n openOnClick\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n translations={resolvedTranslations}\n >\n <Combobox.Context>\n {(api) => (\n <Combobox.Control\n className={classNames?.control}\n startSlot={startSlot}\n {...props({ \"data-invalid\": isInvalid })}\n // Tablet affordance: a tap on the field's dead zones (start/end slots,\n // padding) opens the suggestions and focuses the input. The input,\n // clear ✕ and chevron keep their own taps. Inert when disabled/readOnly.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n >\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `onBlur` / `aria-invalid` pass straight through. */}\n <ArkCombobox.Input\n placeholder={placeholder}\n name={name}\n onBlur={onBlur}\n ref={ref}\n {...props({ \"aria-invalid\": isInvalid, \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {/* The value here is the typed text, not a machine selection, so Ark's\n `value`-gated ClearTrigger stays hidden — clear the input directly\n instead. A real (tabbable) button; `preventDefault` keeps focus on\n the input through the tap. */}\n {showClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => setQuery(\"\")}\n className={popoverClearTrigger}\n >\n <CloseIcon />\n </button>\n )}\n {(clearSectionMode === \"both\" || !showClear) && <Combobox.Trigger data-chevron />}\n </Combobox.Control>\n )}\n </Combobox.Context>\n\n <Combobox.Content className={classNames?.popover}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Content>\n </Combobox.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Camera, useCamera, useCameraContext } from '../../chunk-
|
|
2
|
+
export { Camera, useCamera, useCameraContext } from '../../chunk-UCCJUFOG.js';
|
|
3
3
|
import '../../chunk-HX3LNK26.js';
|
|
4
4
|
import '../../chunk-K6YASO4L.js';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-Z4MBCKG5.js';
|
|
6
6
|
import '../../chunk-TWNIAF7K.js';
|
|
7
7
|
import '../../chunk-J43LSYQO.js';
|
|
8
8
|
import '../../chunk-7TDHT3QD.js';
|
|
9
9
|
import '../../chunk-5FDOOG4J.js';
|
|
10
|
-
import '../../chunk-
|
|
10
|
+
import '../../chunk-2BNIHOMT.js';
|
|
11
11
|
import '../../chunk-45QRQKRC.js';
|
|
12
12
|
import '../../chunk-VD6PB3VA.js';
|
|
13
13
|
import '../../chunk-F342ZT7O.js';
|
|
@@ -19,7 +19,8 @@ import '../../chunk-HDYORQZN.js';
|
|
|
19
19
|
import '../../chunk-HBWV5EPU.js';
|
|
20
20
|
import '../../chunk-AHM6SGEU.js';
|
|
21
21
|
import '../../chunk-IPYHTCFL.js';
|
|
22
|
-
import '../../chunk-
|
|
22
|
+
import '../../chunk-N66NC6QK.js';
|
|
23
|
+
import '../../chunk-V6PY7C6S.js';
|
|
23
24
|
import '../../chunk-7P32XCEU.js';
|
|
24
25
|
import '../../chunk-H7WOMZXO.js';
|
|
25
26
|
import '../../chunk-BE2LWUHY.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { CodeBlockButton, CodeBlockChrome, DEFAULT_ICONS } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
2
|
+
export { CodeBlockButton, CodeBlockChrome, DEFAULT_ICONS } from '../../chunk-HQPU73WV.js';
|
|
3
|
+
import '../../chunk-YZJUPYPO.js';
|
|
4
|
+
import '../../chunk-N66NC6QK.js';
|
|
5
|
+
import '../../chunk-V6PY7C6S.js';
|
|
6
6
|
import '../../chunk-7P32XCEU.js';
|
|
7
7
|
import '../../chunk-H7WOMZXO.js';
|
|
8
8
|
import '../../chunk-PMUCGFY5.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CodeBlockButton, CodeBlockChrome } from '../../chunk-
|
|
2
|
-
export { CodeBlockButton } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
1
|
+
import { CodeBlockButton, CodeBlockChrome } from '../../chunk-HQPU73WV.js';
|
|
2
|
+
export { CodeBlockButton } from '../../chunk-HQPU73WV.js';
|
|
3
|
+
import '../../chunk-YZJUPYPO.js';
|
|
4
|
+
import '../../chunk-N66NC6QK.js';
|
|
5
|
+
import '../../chunk-V6PY7C6S.js';
|
|
6
6
|
import '../../chunk-7P32XCEU.js';
|
|
7
7
|
import '../../chunk-H7WOMZXO.js';
|
|
8
8
|
import '../../chunk-PMUCGFY5.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Combobox } from '../../chunk-
|
|
2
|
+
export { Combobox } from '../../chunk-2BNIHOMT.js';
|
|
3
3
|
import '../../chunk-45QRQKRC.js';
|
|
4
4
|
import '../../chunk-VD6PB3VA.js';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-N66NC6QK.js';
|
|
6
|
+
import '../../chunk-V6PY7C6S.js';
|
|
6
7
|
import '../../chunk-7P32XCEU.js';
|
|
7
8
|
import '../../chunk-H7WOMZXO.js';
|
|
8
9
|
import '../../chunk-PMUCGFY5.js';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { ComboboxList } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
2
|
+
export { ComboboxList } from '../../chunk-C74TV64U.js';
|
|
3
|
+
import '../../chunk-45TG7H5Q.js';
|
|
4
4
|
import '../../chunk-7TDHT3QD.js';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-2BNIHOMT.js';
|
|
6
6
|
import '../../chunk-45QRQKRC.js';
|
|
7
7
|
import '../../chunk-VD6PB3VA.js';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-N66NC6QK.js';
|
|
9
|
+
import '../../chunk-V6PY7C6S.js';
|
|
9
10
|
import '../../chunk-7P32XCEU.js';
|
|
10
11
|
import '../../chunk-H7WOMZXO.js';
|
|
11
12
|
import '../../chunk-PMUCGFY5.js';
|
|
@@ -6,30 +6,30 @@ import { Text } from '../../chunk-XKDL4QS6.js';
|
|
|
6
6
|
import '../../chunk-J2WSKRJW.js';
|
|
7
7
|
import '../../chunk-R5GMMWAY.js';
|
|
8
8
|
import '../../chunk-BJZLQTAZ.js';
|
|
9
|
-
import { Root, Trigger, Content, CheckboxItem } from '../../chunk-
|
|
10
|
-
import { MultiComboboxList } from '../../chunk-
|
|
9
|
+
import { Root, Trigger, Content, CheckboxItem } from '../../chunk-FDCPMUJK.js';
|
|
10
|
+
import { MultiComboboxList } from '../../chunk-37VQGKD6.js';
|
|
11
11
|
import { Pill } from '../../chunk-6M6YZ3PQ.js';
|
|
12
12
|
import { Flex } from '../../chunk-UXPINIDN.js';
|
|
13
13
|
import '../../chunk-XFEPUGUZ.js';
|
|
14
|
-
import { ComboboxList } from '../../chunk-
|
|
15
|
-
import '../../chunk-
|
|
16
|
-
import { serializeDateValue, DatePicker } from '../../chunk-
|
|
17
|
-
import { resolveHourCycle } from '../../chunk-
|
|
14
|
+
import { ComboboxList } from '../../chunk-C74TV64U.js';
|
|
15
|
+
import '../../chunk-45TG7H5Q.js';
|
|
16
|
+
import { serializeDateValue, DatePicker } from '../../chunk-5CNVVA7I.js';
|
|
17
|
+
import { resolveHourCycle } from '../../chunk-LFQDB5OD.js';
|
|
18
18
|
import '../../chunk-C4NFRSOR.js';
|
|
19
|
-
import { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput } from '../../chunk-
|
|
19
|
+
import { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput } from '../../chunk-UVQXRDRO.js';
|
|
20
20
|
import '../../chunk-FMMKEYHB.js';
|
|
21
21
|
import { Checkbox } from '../../chunk-6VYGK3Q3.js';
|
|
22
22
|
import '../../chunk-NLOBBJAA.js';
|
|
23
23
|
import { resolveCalendarTranslations } from '../../chunk-MXAACRWE.js';
|
|
24
24
|
import '../../chunk-ZB5VMGKB.js';
|
|
25
|
-
import { Select } from '../../chunk-
|
|
25
|
+
import { Select } from '../../chunk-Z4MBCKG5.js';
|
|
26
26
|
import { Skeleton } from '../../chunk-TWNIAF7K.js';
|
|
27
27
|
import { Card } from '../../chunk-2MXWEIMD.js';
|
|
28
28
|
import { Drawer } from '../../chunk-O7LS6OZR.js';
|
|
29
29
|
import '../../chunk-DA4QII2N.js';
|
|
30
30
|
import '../../chunk-7TDHT3QD.js';
|
|
31
31
|
import '../../chunk-5FDOOG4J.js';
|
|
32
|
-
import { COMBOBOX_DEFAULT_TRANSLATIONS } from '../../chunk-
|
|
32
|
+
import { COMBOBOX_DEFAULT_TRANSLATIONS } from '../../chunk-2BNIHOMT.js';
|
|
33
33
|
import { Input } from '../../chunk-45QRQKRC.js';
|
|
34
34
|
import '../../chunk-VD6PB3VA.js';
|
|
35
35
|
import '../../chunk-DHM4IG2O.js';
|
|
@@ -39,9 +39,9 @@ import { Button } from '../../chunk-SWVUXEBT.js';
|
|
|
39
39
|
import { useDebouncedCallback } from '../../chunk-ZYX564HO.js';
|
|
40
40
|
import '../../chunk-HBWV5EPU.js';
|
|
41
41
|
import { useLocale, useTimeZone } from '../../chunk-IPYHTCFL.js';
|
|
42
|
-
import { Tooltip } from '../../chunk-
|
|
43
|
-
import '../../chunk-
|
|
44
|
-
import
|
|
42
|
+
import { Tooltip } from '../../chunk-YZJUPYPO.js';
|
|
43
|
+
import { Popover } from '../../chunk-N66NC6QK.js';
|
|
44
|
+
import '../../chunk-V6PY7C6S.js';
|
|
45
45
|
import '../../chunk-7P32XCEU.js';
|
|
46
46
|
import '../../chunk-H7WOMZXO.js';
|
|
47
47
|
import { ActionIcon } from '../../chunk-BE2LWUHY.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { DatePicker } from '../../chunk-
|
|
3
|
-
export { DatePicker } from '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
2
|
+
import { DatePicker } from '../../chunk-5CNVVA7I.js';
|
|
3
|
+
export { DatePicker } from '../../chunk-5CNVVA7I.js';
|
|
4
|
+
import '../../chunk-LFQDB5OD.js';
|
|
5
5
|
import '../../chunk-C4NFRSOR.js';
|
|
6
|
-
import '../../chunk-
|
|
6
|
+
import '../../chunk-UVQXRDRO.js';
|
|
7
7
|
import '../../chunk-MXAACRWE.js';
|
|
8
8
|
import { dateToCalendarValue } from '../../chunk-ZB5VMGKB.js';
|
|
9
9
|
import '../../chunk-5FDOOG4J.js';
|
|
@@ -13,7 +13,8 @@ import '../../chunk-DHM4IG2O.js';
|
|
|
13
13
|
import '../../chunk-SWVUXEBT.js';
|
|
14
14
|
import '../../chunk-HBWV5EPU.js';
|
|
15
15
|
import '../../chunk-IPYHTCFL.js';
|
|
16
|
-
import '../../chunk-
|
|
16
|
+
import '../../chunk-N66NC6QK.js';
|
|
17
|
+
import '../../chunk-V6PY7C6S.js';
|
|
17
18
|
import '../../chunk-7P32XCEU.js';
|
|
18
19
|
import '../../chunk-H7WOMZXO.js';
|
|
19
20
|
import '../../chunk-BE2LWUHY.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/date-predicates.ts","../../../src/components/date-picker/aliases.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/date-predicates.ts","../../../src/components/date-picker/aliases.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAM,cAAA,GAAiB,OAAA;AAchB,IAAM,WAAA,GACX,MACA,CAAC,IAAA,EAAM,WAAW,gBAAA,EAAiB,KACjC,mBAAA,CAAoB,IAAA,EAAM,QAAQ,CAAA,CAAE,OAAA,CAAQ,KAAA,CAAM,QAAQ,CAAC,CAAA,GAAI;AAI5D,IAAM,aAAA,GACX,MACA,CAAC,IAAA,EAAM,WAAW,gBAAA,EAAiB,KACjC,mBAAA,CAAoB,IAAA,EAAM,QAAQ,CAAA,CAAE,OAAA,CAAQ,KAAA,CAAM,QAAQ,CAAC,CAAA,GAAI;AAG5D,IAAM,eAAA,GACX,MACA,CAAC,IAAA,EAAM,QAAA,GAAW,gBAAA,EAAiB,KACjC,SAAA,CAAU,mBAAA,CAAoB,IAAA,EAAM,QAAQ,CAAA,EAAG,cAAc;AAG1D,IAAM,aACX,CAAC,QAAA,KACD,CAAC,IAAA,EAAM,WAAW,gBAAA,EAAiB,KACjC,mBAAA,CAAoB,IAAA,EAAM,QAAQ,CAAA,CAAE,OAAA,CAAQ,oBAAoB,QAAA,EAAU,QAAQ,CAAC,CAAA,GAAI;AAGpF,IAAM,YACX,CAAC,QAAA,KACD,CAAC,IAAA,EAAM,WAAW,gBAAA,EAAiB,KACjC,mBAAA,CAAoB,IAAA,EAAM,QAAQ,CAAA,CAAE,OAAA,CAAQ,oBAAoB,QAAA,EAAU,QAAQ,CAAC,CAAA,GAAI;AAGpF,IAAM,eACX,CAAC,KAAA,KACD,CAAC,IAAA,EAAM,QAAA,GAAW,kBAAiB,KAAM;AACvC,EAAA,MAAM,KAAA,GAAQ,mBAAA,CAAoB,IAAA,EAAM,QAAQ,CAAA;AAChD,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,CAAC,QAAA,KAAa,SAAA,CAAU,OAAO,mBAAA,CAAoB,QAAA,EAAU,QAAQ,CAAC,CAAC,CAAA;AAC3F;AAGK,IAAM,KAAA,GACX,CAAA,GAAI,UAAA,KACJ,CAAC,IAAA,EAAM,QAAA,KACL,UAAA,CAAW,IAAA,CAAK,CAAC,SAAA,KAAc,SAAA,CAAU,IAAA,EAAM,QAAQ,CAAC;AAGrD,IAAM,KAAA,GACX,CAAA,GAAI,UAAA,KACJ,CAAC,IAAA,EAAM,QAAA,KACL,UAAA,CAAW,KAAA,CAAM,CAAC,SAAA,KAAc,SAAA,CAAU,IAAA,EAAM,QAAQ,CAAC;ACtEtD,IAAM,eAAA,GAAkB,CAAC,KAAA,qBAAgC,GAAA,CAAC,cAAY,GAAG,KAAA,EAAO,OAAK,IAAA,EAAC;AAItF,IAAM,cAAA,GAAiB,CAAC,KAAA,qBAA+B,GAAA,CAAC,cAAY,GAAG,KAAA,EAAO,UAAQ,IAAA,EAAC;AAIvF,IAAM,mBAAA,GAAsB,CAAC,KAAA,qBAClC,GAAA,CAAC,UAAA,EAAA,EAAY,GAAG,KAAA,EAAO,KAAA,EAAK,IAAA,EAAC,QAAA,EAAQ,IAAA,EAAC","file":"index.js","sourcesContent":["import { getLocalTimeZone, isSameDay, isWeekend, today } from \"@internationalized/date\"\nimport { dateToCalendarValue } from \"./date-value\"\n\n/**\n * RFC §7 (`docs/rfcs/date-picker.md`) restriction-predicate helpers — composable `DatePredicate`\n * callbacks for `Calendar`/`DatePicker`'s `isDateUnavailable`. They present a pure-`Date` surface,\n * converting internally via `lib/date-value.ts`'s boundary.\n *\n * isDateUnavailable={anyOf(disablePast(), disableWeekends())}\n *\n * The factories stay zero-arg (or value-only) so they read naturally at the call site; the zone\n * every conversion is interpreted in arrives as the predicate's *second argument*, which\n * `Calendar`/`DatePicker` fill in with the very `timeZone` they were given. A predicate therefore\n * can't disagree with the component restricting by it — `<Calendar timeZone=\"UTC\"\n * isDateUnavailable={disableWeekends()} />` disables UTC Saturdays whatever the host zone is,\n * instead of whichever days happened to be weekends where the code ran.\n */\n\n/** `isWeekend` needs a locale; these helpers don't take one, so the Gregorian Saturday/Sunday\n * convention is the v1 default. */\nconst WEEKEND_LOCALE = \"en-US\"\n\n/**\n * A day-restriction predicate: the candidate day, plus the `timeZone` to read it in.\n *\n * `Calendar`/`DatePicker` always pass their own resolved `timeZone` — the argument is optional\n * only so a predicate stays callable on its own (filtering a plain `Date[]`, a unit test), where\n * it falls back to the host zone exactly as before.\n */\nexport type DatePredicate = (date: Date, timeZone?: string) => boolean\n\n/** Disable every day before today, today itself included as available. Reads the clock on every\n * call rather than once at factory time, so a long-lived predicate's boundary keeps up as time\n * passes instead of going stale — same rationale as `schedule-predicates.ts`'s own `disablePast`. */\nexport const disablePast =\n (): DatePredicate =>\n (date, timeZone = getLocalTimeZone()) =>\n dateToCalendarValue(date, timeZone).compare(today(timeZone)) < 0\n\n/** Disable every day after today, today itself included as available. Same per-call clock read as\n * `disablePast`. */\nexport const disableFuture =\n (): DatePredicate =>\n (date, timeZone = getLocalTimeZone()) =>\n dateToCalendarValue(date, timeZone).compare(today(timeZone)) > 0\n\n/** Disable Saturdays/Sundays. */\nexport const disableWeekends =\n (): DatePredicate =>\n (date, timeZone = getLocalTimeZone()) =>\n isWeekend(dateToCalendarValue(date, timeZone), WEEKEND_LOCALE)\n\n/** Disable every day strictly before `boundary`. */\nexport const beforeDate =\n (boundary: Date): DatePredicate =>\n (date, timeZone = getLocalTimeZone()) =>\n dateToCalendarValue(date, timeZone).compare(dateToCalendarValue(boundary, timeZone)) < 0\n\n/** Disable every day strictly after `boundary`. */\nexport const afterDate =\n (boundary: Date): DatePredicate =>\n (date, timeZone = getLocalTimeZone()) =>\n dateToCalendarValue(date, timeZone).compare(dateToCalendarValue(boundary, timeZone)) > 0\n\n/** Disable an explicit set of days (matched by calendar day, not exact instant). */\nexport const disableDates =\n (dates: Date[]): DatePredicate =>\n (date, timeZone = getLocalTimeZone()) => {\n const value = dateToCalendarValue(date, timeZone)\n return dates.some((boundary) => isSameDay(value, dateToCalendarValue(boundary, timeZone)))\n }\n\n/** OR-combine predicates — unavailable if ANY predicate disables the day. */\nexport const anyOf =\n (...predicates: DatePredicate[]): DatePredicate =>\n (date, timeZone) =>\n predicates.some((predicate) => predicate(date, timeZone))\n\n/** AND-combine predicates — unavailable only if EVERY predicate disables the day. */\nexport const allOf =\n (...predicates: DatePredicate[]): DatePredicate =>\n (date, timeZone) =>\n predicates.every((predicate) => predicate(date, timeZone))\n","import { DatePicker, type DatePickerProps } from \"./date-picker\"\n\n/**\n * Named presets of `DatePicker`, not separate components. code-style.md's \"generic over\n * bespoke\" rule still holds: each one is a single line that pins `range` / `withTime`, with no\n * markup or behaviour of its own. They exist because these are the names people search for\n * (Mantine and MUI ship them), and because pinning `range` fixes the value type\n * (`DateRangeValue` instead of `Date | null`) without the caller writing the generic.\n */\n\nexport type DateRangePickerProps = Omit<DatePickerProps<true>, \"range\">\n/** `DateRangePicker` === `<DatePicker range />` — same component, narrowed value type. */\nexport const DateRangePicker = (props: DateRangePickerProps) => <DatePicker {...props} range />\n\nexport type DateTimePickerProps = Omit<DatePickerProps<false>, \"withTime\">\n/** `DateTimePicker` === `<DatePicker withTime />`. */\nexport const DateTimePicker = (props: DateTimePickerProps) => <DatePicker {...props} withTime />\n\nexport type DateTimeRangePickerProps = Omit<DatePickerProps<true>, \"range\" | \"withTime\">\n/** `DateTimeRangePicker` === `<DatePicker range withTime />`. */\nexport const DateTimeRangePicker = (props: DateTimeRangePickerProps) => (\n <DatePicker {...props} range withTime />\n)\n"]}
|
|
@@ -1,25 +1,52 @@
|
|
|
1
1
|
import { HoverCard as Ark } from "@ark-ui/react/hover-card";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
import { type LogicalPosition } from "../../lib/placement";
|
|
3
|
+
import { type LogicalPosition, type Placement, type PlacementProps } from "../../lib/placement";
|
|
4
4
|
import type { WithTestId } from "../../lib/test-id";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* HoverCard — a rich preview panel on Ark UI's HoverCard, shown after a short
|
|
7
|
+
* hover/focus delay. It sits between `Popover` (a clickable, focus-trapping
|
|
8
|
+
* panel with no delay) and `Tooltip` (a delayed hint with no rich content):
|
|
9
|
+
* HoverCard is delayed *and* rich — the "hover a username, see a profile
|
|
10
|
+
* card" pattern. Ark owns the open/close state, the open/close delays,
|
|
11
|
+
* positioning, and dismiss-on-outside-interaction; the kit adds the portaled,
|
|
12
|
+
* animated panel chrome (reusing `Popover`'s surface).
|
|
13
|
+
*
|
|
14
|
+
* Unlike `Tooltip`, there's no single-call convenience form — a hover card's
|
|
15
|
+
* content is arbitrary rich markup, so it's compound-only, like `Popover`:
|
|
16
|
+
*
|
|
17
|
+
* <HoverCard.Root>
|
|
18
|
+
* <HoverCard.Trigger asChild>
|
|
19
|
+
* <a href="/norm">@the-norm</a>
|
|
20
|
+
* </HoverCard.Trigger>
|
|
21
|
+
* <HoverCard.Content>
|
|
22
|
+
* Rich <strong>preview</strong> content.
|
|
23
|
+
* </HoverCard.Content>
|
|
24
|
+
* </HoverCard.Root>
|
|
25
|
+
*
|
|
26
|
+
* Ark's machine defaults to a 600ms open delay and a 300ms close delay —
|
|
27
|
+
* long enough that an incidental pass of the cursor doesn't pop a card open.
|
|
28
|
+
* `HoverCard.Group` puts several trigger targets (e.g. a row of avatars) on
|
|
29
|
+
* one *shared* card instead: Ark's own HoverCard machine supports multiple
|
|
30
|
+
* named triggers under a single `Root`/`Content`, so hovering from one
|
|
31
|
+
* target to the next while the card is already open just repositions the
|
|
32
|
+
* same panel — no close/reopen, no delay replay — and it visibly slides
|
|
33
|
+
* between targets.
|
|
34
|
+
*
|
|
35
|
+
* Keep its content a preview. Ark's machine ignores touch, never lets focus
|
|
36
|
+
* into the card, and puts no `aria-expanded`/`aria-controls` on the trigger,
|
|
37
|
+
* because a hover card previews where its trigger *link* goes. For a card
|
|
38
|
+
* people act on (a copy button, a "View profile" link), use
|
|
39
|
+
* `<Popover.Root mode="hover">`. It keeps the delayed hover preview, and a
|
|
40
|
+
* click, tap or Enter pins it as a focusable, dismissable popover.
|
|
41
|
+
*/
|
|
6
42
|
/** `position` accepts Ark's physical placements plus the logical, RTL-aware
|
|
7
43
|
* horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */
|
|
8
|
-
export type HoverCardPosition = LogicalPosition<
|
|
9
|
-
export type HoverCardRootProps = Omit<Ark.RootProps, "positioning" | "onOpenChange"> & {
|
|
44
|
+
export type HoverCardPosition = LogicalPosition<Placement>;
|
|
45
|
+
export type HoverCardRootProps = Omit<Ark.RootProps, "positioning" | "onOpenChange"> & PlacementProps & {
|
|
10
46
|
/** Match the trigger's width (`"target"`), or size to content (`"auto"`,
|
|
11
47
|
* default — a hover card's content is usually much larger than its
|
|
12
48
|
* trigger, unlike a dropdown). */
|
|
13
49
|
width?: "target" | "auto";
|
|
14
|
-
/** Panel placement relative to the trigger. Defaults to Ark's `"bottom"`. */
|
|
15
|
-
position?: HoverCardPosition;
|
|
16
|
-
/** Gap in px between the trigger and the panel. */
|
|
17
|
-
gutter?: number;
|
|
18
|
-
/** Positioner offset. */
|
|
19
|
-
offset?: {
|
|
20
|
-
mainAxis?: number | undefined;
|
|
21
|
-
crossAxis?: number | undefined;
|
|
22
|
-
} | undefined;
|
|
23
50
|
/** Render the panel in a Portal so it escapes clipping ancestors. Default `true`. */
|
|
24
51
|
withinPortal?: boolean;
|
|
25
52
|
/** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is
|
|
@@ -31,7 +58,7 @@ export type HoverCardRootProps = Omit<Ark.RootProps, "positioning" | "onOpenChan
|
|
|
31
58
|
* interaction, or a controlled `onOpenChange`. */
|
|
32
59
|
onClose?: () => void;
|
|
33
60
|
};
|
|
34
|
-
declare const Root: ({ width, position, gutter, offset, withinPortal, container, openDelay, children, onOpenChange, onClose, ...rest }: HoverCardRootProps) => import("react").JSX.Element;
|
|
61
|
+
declare const Root: ({ width, position, gutter, offset, hideWhenDetached, positioning, withinPortal, container, openDelay, children, onOpenChange, onClose, ...rest }: HoverCardRootProps) => import("react").JSX.Element;
|
|
35
62
|
export type HoverCardContentProps = Ark.ContentProps & WithTestId & {
|
|
36
63
|
/** Identifies which `HoverCard.Group` target this content belongs to —
|
|
37
64
|
* only meaningful inside `HoverCard.Group`, where several `Content`s
|
|
@@ -40,19 +67,10 @@ export type HoverCardContentProps = Ark.ContentProps & WithTestId & {
|
|
|
40
67
|
value?: string;
|
|
41
68
|
};
|
|
42
69
|
declare const Content: ({ className, children, testId, value: _value, ...rest }: HoverCardContentProps) => import("react").JSX.Element;
|
|
43
|
-
export type HoverCardGroupProps = Omit<Ark.RootProps, "positioning" | "onOpenChange" | "children"> & {
|
|
70
|
+
export type HoverCardGroupProps = Omit<Ark.RootProps, "positioning" | "onOpenChange" | "children"> & PlacementProps & {
|
|
44
71
|
/** Match every trigger's width (`"target"`), or size to content (`"auto"`,
|
|
45
72
|
* default). */
|
|
46
73
|
width?: "target" | "auto";
|
|
47
|
-
/** Panel placement relative to the active trigger. Defaults to Ark's `"bottom"`. */
|
|
48
|
-
position?: HoverCardPosition;
|
|
49
|
-
/** Gap in px between the active trigger and the panel. */
|
|
50
|
-
gutter?: number;
|
|
51
|
-
/** Positioner offset. */
|
|
52
|
-
offset?: {
|
|
53
|
-
mainAxis?: number | undefined;
|
|
54
|
-
crossAxis?: number | undefined;
|
|
55
|
-
} | undefined;
|
|
56
74
|
/** Render the panel in a Portal so it escapes clipping ancestors. Default `true`. */
|
|
57
75
|
withinPortal?: boolean;
|
|
58
76
|
/** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is
|
|
@@ -99,7 +117,7 @@ export type HoverCardGroupProps = Omit<Ark.RootProps, "positioning" | "onOpenCha
|
|
|
99
117
|
* as a props update on the *same* `Content`/`Positioner`/`Content` element
|
|
100
118
|
* tree, not an unmount-and-remount of a different one, which is what keeps
|
|
101
119
|
* it one real, continuous DOM node to slide. Paired with a CSS transition on
|
|
102
|
-
* the positioner's `transform` (`
|
|
120
|
+
* the positioner's `transform` (`slideStyle`, applied by `Content`
|
|
103
121
|
* whenever `sliding` is set), that reposition visibly slides the panel from
|
|
104
122
|
* one target to the next.
|
|
105
123
|
*
|
|
@@ -111,7 +129,7 @@ export type HoverCardGroupProps = Omit<Ark.RootProps, "positioning" | "onOpenCha
|
|
|
111
129
|
* trigger elements still land exactly there, since `Content` is portaled
|
|
112
130
|
* away separately.
|
|
113
131
|
*/
|
|
114
|
-
declare const Group: ({ width, position, gutter, offset, withinPortal, container, openDelay, children, onOpenChange, onClose, ...rest }: HoverCardGroupProps) => import("react").JSX.Element;
|
|
132
|
+
declare const Group: ({ width, position, gutter, offset, hideWhenDetached, positioning, withinPortal, container, openDelay, children, onOpenChange, onClose, ...rest }: HoverCardGroupProps) => import("react").JSX.Element;
|
|
115
133
|
export declare const HoverCard: {
|
|
116
134
|
Root: typeof Root;
|
|
117
135
|
Trigger: import("react").ForwardRefExoticComponent<Ark.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../../src/components/hover-card/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,IAAI,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAG3D,OAAO,
|
|
1
|
+
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../../src/components/hover-card/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,IAAI,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAG3D,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAGjE,OAA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W,GAAG,IAAI,CAAA;IAC9B,gFAAgF;IAChF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC;uEACmE;IACnE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;+BAG2B;IAC3B,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,QAAA,MAAM,KAAK,qJAcR,mBAAmB,gCAqCrB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;CAKrB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { slideStyle, popoverChrome, splitGroupChildren, useSlideAfterPlaced, activeGroupContent } from '../../chunk-N66NC6QK.js';
|
|
3
|
+
import { toPositioning } from '../../chunk-V6PY7C6S.js';
|
|
4
4
|
import { useOverlayContainer } from '../../chunk-7P32XCEU.js';
|
|
5
5
|
import '../../chunk-H7WOMZXO.js';
|
|
6
6
|
import '../../chunk-PMUCGFY5.js';
|
|
@@ -11,14 +11,9 @@ import { cn } from '../../chunk-4ASNIDV7.js';
|
|
|
11
11
|
import { HoverCard as HoverCard$1 } from '@ark-ui/react/hover-card';
|
|
12
12
|
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
13
13
|
import { Portal } from '@ark-ui/react/portal';
|
|
14
|
-
import { createContext, useContext
|
|
14
|
+
import { createContext, useContext } from 'react';
|
|
15
15
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
16
16
|
|
|
17
|
-
var hoverCardSlideStyle = {
|
|
18
|
-
transitionProperty: "transform",
|
|
19
|
-
transitionDuration: "200ms",
|
|
20
|
-
transitionTimingFunction: "cubic-bezier(0.32, 0.72, 0, 1)"
|
|
21
|
-
};
|
|
22
17
|
var HoverCardContext = createContext({
|
|
23
18
|
width: "auto",
|
|
24
19
|
withinPortal: true,
|
|
@@ -26,9 +21,11 @@ var HoverCardContext = createContext({
|
|
|
26
21
|
});
|
|
27
22
|
var Root = ({
|
|
28
23
|
width = "auto",
|
|
29
|
-
position
|
|
24
|
+
position,
|
|
30
25
|
gutter,
|
|
31
26
|
offset,
|
|
27
|
+
hideWhenDetached,
|
|
28
|
+
positioning,
|
|
32
29
|
withinPortal = true,
|
|
33
30
|
container,
|
|
34
31
|
openDelay,
|
|
@@ -44,12 +41,11 @@ var Root = ({
|
|
|
44
41
|
lazyMount: true,
|
|
45
42
|
unmountOnExit: true,
|
|
46
43
|
openDelay,
|
|
47
|
-
positioning:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
44
|
+
positioning: toPositioning(
|
|
45
|
+
{ position, gutter, offset, hideWhenDetached, positioning },
|
|
46
|
+
dir,
|
|
47
|
+
width
|
|
48
|
+
),
|
|
53
49
|
onOpenChange: ({ open }) => {
|
|
54
50
|
onOpenChange?.(open);
|
|
55
51
|
if (!open) onClose?.();
|
|
@@ -68,7 +64,7 @@ var Content = ({
|
|
|
68
64
|
}) => {
|
|
69
65
|
const { width, withinPortal, container, sliding } = useContext(HoverCardContext);
|
|
70
66
|
const portalContainer = useOverlayContainer(container);
|
|
71
|
-
const panel = /* @__PURE__ */ jsx(HoverCard$1.Positioner, { style: sliding ?
|
|
67
|
+
const panel = /* @__PURE__ */ jsx(HoverCard$1.Positioner, { style: sliding ? slideStyle : void 0, children: /* @__PURE__ */ jsx(
|
|
72
68
|
HoverCard$1.Content,
|
|
73
69
|
{
|
|
74
70
|
tabIndex: -1,
|
|
@@ -81,12 +77,13 @@ var Content = ({
|
|
|
81
77
|
if (!withinPortal) return panel;
|
|
82
78
|
return /* @__PURE__ */ jsx(Portal, { container: portalContainer, children: panel });
|
|
83
79
|
};
|
|
84
|
-
var isGroupContent = (node) => isValidElement(node) && node.type === Content;
|
|
85
80
|
var Group = ({
|
|
86
81
|
width = "auto",
|
|
87
|
-
position
|
|
82
|
+
position,
|
|
88
83
|
gutter,
|
|
89
84
|
offset,
|
|
85
|
+
hideWhenDetached,
|
|
86
|
+
positioning,
|
|
90
87
|
withinPortal = true,
|
|
91
88
|
container,
|
|
92
89
|
openDelay,
|
|
@@ -96,52 +93,37 @@ var Group = ({
|
|
|
96
93
|
...rest
|
|
97
94
|
}) => {
|
|
98
95
|
const { dir } = useLocaleContext();
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
const [sliding, setSliding] = useState(false);
|
|
103
|
-
const slidingRafRef = useRef(null);
|
|
104
|
-
useEffect(
|
|
105
|
-
() => () => {
|
|
106
|
-
if (slidingRafRef.current != null) cancelAnimationFrame(slidingRafRef.current);
|
|
107
|
-
},
|
|
108
|
-
[]
|
|
109
|
-
);
|
|
110
|
-
return /* @__PURE__ */ jsx(HoverCardContext.Provider, { value: { width, withinPortal, container, sliding }, children: /* @__PURE__ */ jsxs(
|
|
96
|
+
const { contents, triggers } = splitGroupChildren(children, Content);
|
|
97
|
+
const slide = useSlideAfterPlaced();
|
|
98
|
+
return /* @__PURE__ */ jsx(HoverCardContext.Provider, { value: { width, withinPortal, container, sliding: slide.sliding }, children: /* @__PURE__ */ jsxs(
|
|
111
99
|
HoverCard$1.Root,
|
|
112
100
|
{
|
|
113
101
|
lazyMount: true,
|
|
114
102
|
unmountOnExit: true,
|
|
115
103
|
openDelay,
|
|
116
|
-
positioning:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
104
|
+
positioning: toPositioning(
|
|
105
|
+
{
|
|
106
|
+
position,
|
|
107
|
+
gutter,
|
|
108
|
+
offset,
|
|
109
|
+
hideWhenDetached,
|
|
110
|
+
positioning: {
|
|
111
|
+
...positioning,
|
|
112
|
+
updatePosition: slide.updatePosition(positioning?.updatePosition)
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
dir,
|
|
116
|
+
width
|
|
117
|
+
),
|
|
122
118
|
onOpenChange: ({ open }) => {
|
|
123
119
|
onOpenChange?.(open);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
slidingRafRef.current = null;
|
|
127
|
-
setSliding(true);
|
|
128
|
-
});
|
|
129
|
-
} else {
|
|
130
|
-
if (slidingRafRef.current != null) {
|
|
131
|
-
cancelAnimationFrame(slidingRafRef.current);
|
|
132
|
-
slidingRafRef.current = null;
|
|
133
|
-
}
|
|
134
|
-
setSliding(false);
|
|
135
|
-
onClose?.();
|
|
136
|
-
}
|
|
120
|
+
slide.onOpenChange(open);
|
|
121
|
+
if (!open) onClose?.();
|
|
137
122
|
},
|
|
138
123
|
...rest,
|
|
139
124
|
children: [
|
|
140
125
|
triggers,
|
|
141
|
-
/* @__PURE__ */ jsx(HoverCard$1.Context, { children: (api) =>
|
|
142
|
-
const active = contents.find((c) => c.props.value === api.triggerValue);
|
|
143
|
-
return active ? cloneElement(active, { key: "hover-card-group-content" }) : null;
|
|
144
|
-
} })
|
|
126
|
+
/* @__PURE__ */ jsx(HoverCard$1.Context, { children: (api) => activeGroupContent(contents, api.triggerValue) })
|
|
145
127
|
]
|
|
146
128
|
}
|
|
147
129
|
) });
|