@kumix/ui 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -24
- package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
- package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +12 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +9 -5
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +77 -74
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
- package/dist/components/motion/center-morph-modal.js +82 -88
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/command-palette.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +48 -26
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +30 -30
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/loader.js +20 -22
- package/dist/components/motion/loader.js.map +1 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +83 -83
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.d.ts +28 -0
- package/dist/components/motion/morphing-search.d.ts.map +1 -0
- package/dist/components/motion/morphing-search.js +418 -0
- package/dist/components/motion/morphing-search.js.map +1 -0
- package/dist/components/motion/project-folder.js +20 -20
- package/dist/components/motion/project-folder.js.map +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts +90 -0
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-async.js +549 -0
- package/dist/components/reui/cascader/cascader-async.js.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.js +135 -0
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
- package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-context.js +59 -0
- package/dist/components/reui/cascader/cascader-context.js.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.js +456 -0
- package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.js +68 -0
- package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
- package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
- package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-item.js +530 -0
- package/dist/components/reui/cascader/cascader-item.js.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.js +576 -0
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.js +312 -0
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
- package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
- package/dist/components/reui/cascader/cascader-types.js +2 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-virtual.js +240 -0
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
- package/dist/components/reui/cascader/cascader.d.ts +322 -0
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader.js +1459 -0
- package/dist/components/reui/cascader/cascader.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
- package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1191 -0
- package/dist/components/reui/filters/filters-advanced.js.map +1 -0
- package/dist/components/reui/filters/filters-builder.d.ts +43 -0
- package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-builder.js +152 -0
- package/dist/components/reui/filters/filters-builder.js.map +1 -0
- package/dist/components/reui/filters/filters-chip.d.ts +79 -0
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-chip.js +553 -0
- package/dist/components/reui/filters/filters-chip.js.map +1 -0
- package/dist/components/reui/filters/filters-context.d.ts +290 -0
- package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-context.js +277 -0
- package/dist/components/reui/filters/filters-context.js.map +1 -0
- package/dist/components/reui/filters/filters-date.d.ts +43 -0
- package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-date.js +143 -0
- package/dist/components/reui/filters/filters-date.js.map +1 -0
- package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
- package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-dnd.js +454 -0
- package/dist/components/reui/filters/filters-dnd.js.map +1 -0
- package/dist/components/reui/filters/filters-draft.d.ts +2 -0
- package/dist/components/reui/filters/filters-draft.js +128 -0
- package/dist/components/reui/filters/filters-draft.js.map +1 -0
- package/dist/components/reui/filters/filters-editors.d.ts +91 -0
- package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-editors.js +773 -0
- package/dist/components/reui/filters/filters-editors.js.map +1 -0
- package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
- package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-i18n.js +127 -0
- package/dist/components/reui/filters/filters-i18n.js.map +1 -0
- package/dist/components/reui/filters/filters-lib.d.ts +171 -0
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-lib.js +336 -0
- package/dist/components/reui/filters/filters-lib.js.map +1 -0
- package/dist/components/reui/filters/filters-operators.d.ts +49 -0
- package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-operators.js +300 -0
- package/dist/components/reui/filters/filters-operators.js.map +1 -0
- package/dist/components/reui/filters/filters-query.d.ts +132 -0
- package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-query.js +476 -0
- package/dist/components/reui/filters/filters-query.js.map +1 -0
- package/dist/components/reui/filters/filters-types.d.ts +452 -0
- package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-types.js +2 -0
- package/dist/components/reui/filters/filters.d.ts +114 -0
- package/dist/components/reui/filters/filters.d.ts.map +1 -0
- package/dist/components/reui/filters/filters.js +638 -0
- package/dist/components/reui/filters/filters.js.map +1 -0
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-types.d.ts +25 -71
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +2 -2
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
- package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
- package/dist/lib/text-shimmer.d.ts +2 -2
- package/dist/lib/text-shimmer.d.ts.map +1 -1
- package/dist/lib/text-shimmer.js +2 -2
- package/dist/lib/text-shimmer.js.map +1 -1
- package/dist/presence-gate-BekdC4Bo.js +24 -0
- package/dist/presence-gate-BekdC4Bo.js.map +1 -0
- package/package.json +9 -9
- package/dist/components/reui/filters.d.ts +0 -176
- package/dist/components/reui/filters.d.ts.map +0 -1
- package/dist/components/reui/filters.js +0 -1223
- package/dist/components/reui/filters.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cva } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { FiltersAdvanced } from \"./filters-advanced\";\nimport { FiltersBuilder } from \"./filters-builder\";\nimport { FilterChip } from \"./filters-chip\";\nimport {\n createFilterFocusStore,\n createFilterResolutionStore,\n createFilterRowStateStore,\n FilterActionsContext,\n type FilterActionsContextValue,\n FilterFocusContext,\n FilterRenderContext,\n FilterRowStateProvider,\n FilterStateContext,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterFocusStore,\n useFilterState,\n} from \"./filters-context\";\nimport {\n type FilterDraftAction,\n filterDraftReducer,\n isFilterDraftCommittable,\n} from \"./filters-draft\";\nimport {\n DEFAULT_FILTER_EDITORS,\n type FilterEditorRegistry,\n resolveFilterEditor,\n} from \"./filters-editors\";\nimport { resolveFilterLabels } from \"./filters-i18n\";\nimport {\n buildFilterIndex,\n computeFilterSchemaSignature,\n createFilterIdFactory,\n type FilterPathCollapse,\n findFilterSchemaIssues,\n formatFilterPath,\n getFilterField,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport {\n createFilterOperators,\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n type FilterOperatorLabels,\n getFilterOperator,\n negateFilterOperator,\n operatorTakesValue,\n resolveFilterOperators,\n} from \"./filters-operators\";\nimport {\n clearFilterQuery,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n duplicateFilterNode,\n findFilterNode,\n findFilterRule,\n flattenFilterRules,\n insertFilterNode,\n isFilterRule,\n moveFilterNode,\n moveFilterNodeTo,\n removeFilterNode,\n setFilterCombinator,\n toggleFilterCombinator,\n unwrapFilterGroup,\n updateFilterRule,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nimport type {\n FilterChangeDetails,\n FilterCombinator,\n FilterDraft,\n FilterDraftStep,\n FilterEditor,\n FilterEmptyStateContext,\n FilterField,\n FilterLabels,\n FilterQuery,\n FilterRule,\n FilterValueDisplayContext,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Variants */\n/* -------------------------------------------------------------------------- */\n\nconst filtersBarVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n // The rungs `FILTER_CONTROL_SIZES` holds, fed the RESOLVED rung at both\n // call sites, which is what keeps the two ladders in step: a cva default\n // only applies to a value nobody passed, so a raw `\"lg\"` reaching here\n // would leave the bar with no gap at all.\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2\",\n },\n },\n defaultVariants: { size: \"default\" },\n});\n\n/* -------------------------------------------------------------------------- */\n/* Controllable */\n/* -------------------------------------------------------------------------- */\n\nfunction useControllableQuery<V, O>(\n controlled: FilterQuery<V> | undefined,\n uncontrolledDefault: FilterQuery<V> | undefined,\n onChange: ((query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void) | undefined,\n) {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = React.useState<FilterQuery<V>>(\n () => uncontrolledDefault ?? createFilterQuery<V>(),\n );\n\n const query = isControlled ? controlled : internal;\n const queryRef = React.useRef(query);\n React.useEffect(() => {\n queryRef.current = query;\n });\n\n const setQuery = React.useCallback(\n (next: FilterQuery<V>, details: FilterChangeDetails<V, O>) => {\n if (next === queryRef.current) return;\n queryRef.current = next;\n if (!isControlled) setInternal(next);\n onChange?.(next, details);\n },\n [isControlled, onChange],\n );\n\n return { query, queryRef, setQuery };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersProps<V = unknown, O = unknown> {\n /** The field schema. Nested via each field's own `fields`. */\n fields: FilterField<V, O>[];\n\n query?: FilterQuery<V>;\n defaultQuery?: FilterQuery<V>;\n onQueryChange?: (query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void;\n\n labels?: Partial<FilterLabels>;\n /** Operator wording, overridden independently of the chrome copy. */\n operatorLabels?: FilterOperatorLabels;\n /** Extra or replacement value editors, resolved by a field's `editor` name. */\n editors?: FilterEditorRegistry;\n\n /**\n * Which chrome draws the query. `\"basic\"` is the flat chip row, joined by an\n * implicit AND and drawing no combinator, because a chip row has nowhere to\n * put a parenthesis, and it draws a nested rule at any depth as a flat chip.\n */\n variant?: \"basic\" | \"advanced\";\n /** Where the advanced builder lives. `\"inline\"` renders the panel in place. */\n advancedMode?: \"popover\" | \"inline\";\n /**\n * Where the panel sits against its trigger. Stating it settles a twin split:\n * on overflow Base UI flips edges, Radix only shifts along the axis.\n */\n advancedAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Whether the advanced builder's rows can be REORDERED. Off by default: a\n * move changes nothing about what the query MEANS, and costs a grip on every\n * row plus a gesture a touch screen starts by accident. On, drag and\n * Alt+Arrow move any row but the lone root.\n */\n reorderable?: boolean;\n\n /**\n * The density of the whole bar, chips included. TWO RUNGS and no `lg`,\n * resolved through `filterControlSizes` to whatever the ACTIVE STYLE calls\n * that rung (nova 7/8, sera 9/10, mira 6/7, maia and luma 8/9, lyra and rhea\n * 7/8, vega 8/9). Chips need no `ButtonGroup` variant: `items-stretch` gives\n * the pill the height of its one definite-height child, the kebab.\n */\n size?: \"sm\" | \"default\";\n disabled?: boolean;\n readOnly?: boolean;\n\n /**\n * ONE VETO POINT for every change the BAR makes to the query, and only those.\n * Return `false` to refuse; anything else commits, and `details.reason` names\n * the action. One hook and not fourteen because every write goes through\n * `emit`: the Delete key, Alt+Arrow and a drag alike. It can only refuse, and\n * it sits BEHIND the lock, so a locked bar never asks it. Returning a\n * REPLACEMENT tree was rejected: the announcement is already computed from\n * the proposed tree, so the bar would say one thing and commit another.\n */\n onBeforeQueryChange?: (\n query: FilterQuery<V>,\n details: FilterChangeDetails<V, O>,\n ) => boolean | undefined;\n\n /**\n * Offers \"Convert to advanced filter\" in every chip's kebab; its presence IS\n * the switch, since `variant` belongs to the consumer. Not drawn in advanced.\n */\n onConvertToAdvanced?: () => void;\n\n /**\n * Classes for the dropdown MENUS and the field PICKER panel, one prop each\n * rather than one per mount point. Merged after the default, so `w-*` wins.\n */\n menuClassName?: string;\n fieldPickerClassName?: string;\n\n /**\n * How a NESTED attribute path is shortened when too deep to read. `\"none\"` is\n * the default, so an upgrade changes nothing under a consumer; the collapser\n * is the cascader's, and the full path survives as the accessible NAME.\n */\n pathCollapse?: FilterPathCollapse;\n /**\n * How many names survive the collapse, the elided run not counted. Inert\n * while `pathCollapse` is `\"none\"`. Three is the cascader's own default.\n */\n maxPathSegments?: number;\n\n /** Replaces the default Add filter button. */\n trigger?: React.ReactNode;\n /** Renders a Clear button once the query holds anything. */\n showClear?: boolean;\n\n renderValue?: (context: FilterValueDisplayContext<V, O>) => React.ReactNode;\n renderChip?: (rule: FilterRule<V>) => React.ReactNode;\n /**\n * Replaces the advanced builder's empty state, which exists at all because a\n * builder with no rows is a footer floating in blank space. `null` for none.\n */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function Filters<V = unknown, O = unknown>({\n fields,\n query: controlledQuery,\n defaultQuery,\n onQueryChange,\n labels: labelsProp,\n operatorLabels: operatorLabelsProp,\n editors: editorsProp,\n variant = \"basic\",\n advancedMode = \"popover\",\n advancedAlign = \"start\",\n reorderable = false,\n size = \"default\",\n disabled = false,\n readOnly = false,\n onBeforeQueryChange,\n onConvertToAdvanced,\n menuClassName,\n fieldPickerClassName,\n pathCollapse = \"none\",\n maxPathSegments = 3,\n trigger,\n showClear = false,\n renderValue,\n renderChip,\n renderEmpty,\n className,\n children,\n}: FiltersProps<V, O>) {\n const { query, queryRef, setQuery } = useControllableQuery<V, O>(\n controlledQuery,\n defaultQuery,\n onQueryChange,\n );\n\n const [draft, dispatchDraftRaw] = React.useReducer(\n filterDraftReducer<V>,\n null as FilterDraft<V> | null,\n );\n // Text AND a counter: `aria-live` fires on a DOM mutation and React writes\n // nothing when the string is already there, so a repeat was silent. Measured\n // with a MutationObserver: \"Group added\" three times, one mutation.\n const [announced, setAnnounced] = React.useState({ seq: 0, text: \"\" });\n const announcement = announced.text;\n const setAnnouncement = React.useCallback((text: string) => {\n setAnnounced((prev) => ({ seq: prev.seq + 1, text }));\n }, []);\n\n // Seeded from useId: ids from Date.now() plus Math.random() broke hydration.\n const idSeed = React.useId();\n const nextId = React.useMemo(() => createFilterIdFactory(`${idSeed}f`), [idSeed]);\n\n const focusStore = React.useMemo(() => createFilterFocusStore(), []);\n const rowStateStore = React.useMemo(() => createFilterRowStateStore(), []);\n // One per root: the value-to-label store every `useFilterOptions` shares.\n const resolutionStore = React.useMemo(() => createFilterResolutionStore(), []);\n\n /* -------------------------------- derived ------------------------------- */\n\n // `fields` is an inline literal at every real call site, so the CHEAP walk\n // runs every render and the EXPENSIVE index memoizes on its result. Not a\n // ref caching the previous index: writing a ref during render is the\n // impurity this rewrite removed, and it misbehaves under StrictMode.\n const signature = computeFilterSchemaSignature(fields);\n const index = React.useMemo(\n () => buildFilterIndex<V, O>(fields, null, signature),\n // Not `fields`: its identity changes every render at every real call site.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [signature, fields],\n );\n\n const labels = React.useMemo(() => resolveFilterLabels(labelsProp), [labelsProp]);\n\n const operatorCatalog = React.useMemo(() => {\n if (!operatorLabelsProp) return DEFAULT_FILTER_OPERATORS;\n return createFilterOperators({\n ...DEFAULT_FILTER_OPERATOR_LABELS,\n ...operatorLabelsProp,\n });\n }, [operatorLabelsProp]);\n\n const editors = React.useMemo(\n () => ({ ...DEFAULT_FILTER_EDITORS, ...editorsProp }),\n [editorsProp],\n );\n\n const resolveOperators = React.useCallback(\n (field: FilterField<V, O>) => resolveFilterOperators(field, operatorCatalog),\n [operatorCatalog],\n );\n\n const ruleCount = React.useMemo(() => countFilterRules(query), [query]);\n\n /* --------------------------- latest-props ref --------------------------- */\n\n const latest = React.useRef({\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n });\n React.useEffect(() => {\n latest.current = {\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n };\n });\n\n /* -------------------------------- actions ------------------------------- */\n\n // Every mutator below reads state through `latest`, so no keystroke rebuilds\n // one. The lock flags are the ONE exception, for the reason on `locked`.\n\n /**\n * THE MUTATION BOUNDARY, asked here and not at the nine buttons, because the\n * routes into a query are not only buttons. It needs BOTH the closure and\n * the ref: `latest` is written in a passive effect and effects run\n * child-first, so a consumer effect in the commit that turns `readOnly` on\n * runs BEFORE the ref learns of it, while the ref is what a stale handler\n * reads afterwards.\n */\n const locked = React.useCallback(\n () => disabled || readOnly || isFilterLocked(latest.current),\n [disabled, readOnly],\n );\n\n // Reports whether the write LANDED: `onBeforeQueryChange` is discoverable\n // only here, and a vetoed remove that still announced a count would lie.\n const emit = React.useCallback(\n (\n next: FilterQuery<V>,\n reason: FilterChangeDetails<V, O>[\"reason\"],\n rule: FilterRule<V> | null,\n ): boolean => {\n // The backstop, redundant with each mutator's own early return, and\n // FIRST, so the consumer hook cannot approve what the lock refused.\n if (locked()) return false;\n const field = rule ? (getFilterField(latest.current.index, rule.path) ?? null) : null;\n const details: FilterChangeDetails<V, O> = { reason, rule, field };\n // Strictly `false`, so a handler that forgets to return is not a veto.\n if (latest.current.onBeforeQueryChange?.(next, details) === false) {\n return false;\n }\n latest.current.setQuery(next, details);\n return true;\n },\n [locked],\n );\n\n /**\n * Drops the roving tab stop when the node holding it no longer exists: a cell\n * claims it when the store names it, and the \"row one takes it\" fallback\n * fires only when the store is EMPTY, so a deleted id left twenty cells at\n * `tabindex=\"-1\"` with focus on the BODY. Keyed on the committed `query`, so\n * a consumer's Reset or saved-view load is repaired too: add a condition,\n * press Reset, and 25 cells stayed untabbable in both twins.\n */\n React.useEffect(() => {\n const { id } = focusStore.getSnapshot();\n if (!id || findFilterNode(query, id)) return;\n focusStore.set({ id: null, segment: null, autoOpen: false });\n }, [query, focusStore]);\n\n const addRule = React.useCallback(\n (rule: FilterRule<V>, parentId?: string) => {\n if (locked()) return;\n const next = insertFilterNode(latest.current.queryRef.current, rule, parentId);\n if (!emit(next, \"add\", rule)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const addGroup = React.useCallback(\n (parentId?: string, combinator: FilterCombinator = \"or\") => {\n // Before `nextId`, so a LOCKED bar cannot drift the SSR-seeded sequence.\n if (locked()) return \"\";\n const id = latest.current.nextId();\n // `or` by default: `a AND (b AND c)` is just `a AND b AND c`.\n const next = insertFilterNode(\n latest.current.queryRef.current,\n createFilterGroup<V>({ id, combinator }),\n parentId,\n );\n // `\"\"` on a veto: every caller moves focus onto the id it gets back, and\n // focusing a group that was never created strands the tab stop. The id\n // is already burnt, deliberately: a veto is a client-time decision the\n // server never took part in.\n if (!emit(next, \"add\", null)) return \"\";\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n return id;\n },\n [emit, locked, setAnnouncement],\n );\n\n const updateRule = React.useCallback(\n (id: string, updates: Partial<Omit<FilterRule<V>, \"id\" | \"type\">>) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = updateFilterRule(current, id, updates);\n if (next === current) return;\n // THE VALUE, not the field or the operator: picking an attribute leaves\n // the value empty, so arming there reddens the flow the primitive itself\n // walks a user through. A field re-pick sends `value: undefined` in the\n // SAME patch, so `path` and not the presence of `value` tells the two\n // apart. Clearing a typed value still arms it: no `path` in that patch.\n if (\"path\" in updates) rowStateStore.unmark(id);\n else if (\"value\" in updates) rowStateStore.mark(id);\n emit(next, \"update\", findFilterRule(next, id));\n },\n [emit, locked, rowStateStore],\n );\n\n const removeNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const removed = findFilterRule(current, id);\n const next = removeFilterNode(current, id);\n if (next === current) return;\n if (!emit(next, \"remove\", removed)) return;\n // A rule removal reports the COUNT; a group has no rule to report and\n // takes an unknown number of conditions with it, so it says so instead.\n setAnnouncement(\n removed\n ? latest.current.labels.countAnnouncement(countFilterRules(next))\n : latest.current.labels.groupAnnouncement(false),\n );\n },\n [emit, locked, setAnnouncement],\n );\n\n const duplicateNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = duplicateFilterNode(current, id, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count, not \"duplicated\": a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const negateRule = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const rule = findFilterRule(current, id);\n if (!rule) return;\n const field = getFilterField(latest.current.index, rule.path);\n if (!field) return;\n const operators = latest.current.resolveOperators(field);\n const flipped = negateFilterOperator(\n getFilterOperator(operators, rule.operator),\n operators,\n rule.negated,\n );\n const next = updateFilterRule(current, id, {\n operator: flipped.operator ?? rule.operator,\n negated: flipped.negated || undefined,\n });\n emit(next, \"negate\", findFilterRule(next, id));\n },\n [emit, locked],\n );\n\n // Says where a node LANDED, the one mutator a screen reader hears nothing\n // else about: focus stays on the handle and the name does not change. Reads\n // the tree AFTER the move: the position and sibling count announced are the\n // ones the user has just arrived at.\n const announceReorder = React.useCallback(\n (next: FilterQuery<V>, id: string, fromParentId: string | null) => {\n const found = findFilterNode(next, id);\n if (!found?.parent) return;\n const label = isFilterRule(found.node)\n ? formatFilterPath(\n latest.current.index,\n found.node.path,\n latest.current.labels.pathSeparator,\n )\n : found.node.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n const position = found.index + 1;\n const total = found.parent.rules.length;\n\n // A move that changed the node's CONTAINER is a different event, named by\n // the group's own headline, or the bar's label at the top level.\n if (fromParentId && fromParentId !== found.parent.id) {\n const destination =\n found.parent.id === next.id\n ? latest.current.labels.filtersLabel\n : found.parent.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n setAnnouncement(\n latest.current.labels.moveAnnouncement(label, destination, position, total),\n );\n return;\n }\n\n setAnnouncement(latest.current.labels.reorderAnnouncement(label, position, total));\n },\n [setAnnouncement],\n );\n\n const moveNode = React.useCallback(\n (id: string, delta: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = moveFilterNode(current, id, delta);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n // Within the owning group by construction, so there is no destination.\n announceReorder(next, id, null);\n },\n [emit, announceReorder, locked],\n );\n\n // Also the drag layer's drop commit, so a drag and Alt+Arrow say the same.\n const moveNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n // BEFORE the move: the only place the old parent still exists.\n const fromParentId = findFilterNode(current, id)?.parent?.id ?? null;\n const next = moveFilterNodeTo(current, id, parentId, index);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n announceReorder(next, id, fromParentId);\n },\n [emit, announceReorder, locked],\n );\n\n const copyNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = copyFilterNodeTo(current, id, parentId, index, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count again: an Alt-drag of a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const wrapNodeInGroup = React.useCallback(\n (id: string, combinator: FilterCombinator = \"or\") => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = wrapFilterNodeInGroup(current, id, latest.current.nextId(), combinator);\n if (next === current) return;\n if (!emit(next, \"add\", findFilterRule(next, id))) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n },\n [emit, locked, setAnnouncement],\n );\n\n const unwrapGroup = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = unwrapFilterGroup(current, groupId);\n if (next === current) return;\n // The conditions survive in place, so the count has not changed.\n if (!emit(next, \"remove\", null)) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(false));\n },\n [emit, locked, setAnnouncement],\n );\n\n // What a combinator change SOUNDS like: the pill's name changes with it, but\n // a name change on the FOCUSED element is not re-announced by NVDA or JAWS.\n // The group's own headline, not the bare word: it says what the query MEANS\n // now, which is the thing that changed.\n const announceCombinator = React.useCallback(\n (combinator: FilterCombinator) => {\n setAnnouncement(\n combinator === \"and\" ? latest.current.labels.groupAll : latest.current.labels.groupAny,\n );\n },\n [setAnnouncement],\n );\n\n const setCombinatorAction = React.useCallback(\n (groupId: string, combinator: FilterCombinator) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = setFilterCombinator(current, groupId, combinator);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n announceCombinator(combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const toggleCombinatorAction = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = toggleFilterCombinator(current, groupId);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n // Read off the COMMITTED tree, so the sentence cannot disagree with it.\n const group = findFilterNode(next, groupId)?.node;\n if (group && !isFilterRule(group)) announceCombinator(group.combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const clearQueryAction = React.useCallback(() => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = clearFilterQuery(current);\n if (next === current) return;\n if (!emit(next, \"clear\", null)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(0));\n }, [emit, locked, setAnnouncement]);\n\n // The live region, opened to the chrome inside the bar. The setter itself is\n // not published: it is a channel anything could write anything to.\n const announce = React.useCallback(\n (message: string) => {\n if (!message) return;\n setAnnouncement(message);\n },\n [setAnnouncement],\n );\n\n // A draft is a MUTATION in progress, so it locks with the rest, except\n // `close`: a panel open when the bar turned read only must still dismiss.\n const dispatchDraft = React.useCallback(\n (action: FilterDraftAction<V>) => {\n if (action.type !== \"close\" && locked()) return;\n dispatchDraftRaw(action);\n },\n [locked],\n );\n\n const openCreate = React.useCallback(() => {\n if (locked()) return;\n dispatchDraftRaw({ type: \"openCreate\" });\n }, [locked]);\n\n const openAmend = React.useCallback(\n (id: string, step: FilterDraftStep) => {\n if (locked()) return;\n const rule = findFilterRule(latest.current.queryRef.current, id);\n if (!rule) return;\n dispatchDraftRaw({\n type: \"openAmend\",\n ruleId: id,\n step,\n path: rule.path,\n operator: rule.operator,\n value: rule.value,\n });\n },\n [locked],\n );\n\n const closeDraft = React.useCallback(() => dispatchDraftRaw({ type: \"close\" }), []);\n\n const getQuery = React.useCallback(() => latest.current.queryRef.current, []);\n const getDraft = React.useCallback(() => latest.current.draft, []);\n\n /* ------------------------- draft -> query commit ------------------------ */\n\n // The draft becomes a rule exactly once, when the reducer says it is ready.\n // Here rather than in each click handler, which is what lets the \"arity none\n // skips the value step\" branch live in the pure reducer.\n React.useEffect(() => {\n if (draft?.status !== \"ready\") return;\n if (!isFilterDraftCommittable(draft)) return;\n\n if (draft.ruleId) {\n updateRule(draft.ruleId, {\n path: draft.path,\n operator: draft.operator ?? \"\",\n value: draft.value,\n });\n } else if (!locked()) {\n // Asked here too: this branch burns an id and points the focus store at\n // it, and a store naming a chip that never existed eats the tab stop.\n const id = nextId();\n addRule(\n createFilterRule<V>({\n id,\n path: draft.path,\n // Empty on purpose: the chip renders \"Select condition\" and opens.\n operator: \"\",\n value: undefined,\n }),\n );\n focusStore.set({ id, segment: \"operator\", autoOpen: true });\n }\n dispatchDraftRaw({ type: \"close\" });\n }, [draft, addRule, updateRule, nextId, focusStore, locked]);\n\n /* ---------------------------- dev diagnostics --------------------------- */\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const issues = findFilterSchemaIssues(fields, (field) =>\n resolveFilterOperators(field, operatorCatalog),\n );\n if (issues.duplicatePaths.length) {\n warnFilterOnce(\n `dup:${issues.duplicatePaths.join(\",\")}`,\n `duplicate sibling field ids are ignored after the first: ${issues.duplicatePaths.join(\", \")}`,\n );\n }\n if (issues.emptyIds.length) {\n warnFilterOnce(\"empty-id\", \"every field needs a non-empty id\");\n }\n if (issues.unknownDefaultOperators.length) {\n warnFilterOnce(\n `op:${issues.unknownDefaultOperators.join(\",\")}`,\n `defaultOperator names an operator the field does not offer: ${issues.unknownDefaultOperators.join(\", \")}`,\n );\n }\n }, [fields, operatorCatalog]);\n\n /* ------------------------------- contexts ------------------------------- */\n\n const actions = React.useMemo<FilterActionsContextValue<V, O>>(\n () => ({\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n convertToAdvanced: onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n // The same lookup the chrome uses, so a headless consumer can ask it too.\n resolveEditor: (field, operator) =>\n resolveFilterEditor(field, operator, editors) as FilterEditor<V, O> | undefined,\n resolution: resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinator: setCombinatorAction,\n toggleCombinator: toggleCombinatorAction,\n clearQuery: clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n }),\n // Every input is memoized and every action `[]`-stable, so this\n // republishes on a real schema or config change, never on a keystroke.\n [\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinatorAction,\n toggleCombinatorAction,\n clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n ],\n );\n\n const state = React.useMemo(\n () => ({\n query,\n draft,\n ruleCount,\n announcement,\n announcementSeq: announced.seq,\n }),\n [query, draft, ruleCount, announcement, announced.seq],\n );\n\n const renderContext = React.useMemo(\n () => ({ renderValue, renderChip, renderEmpty }),\n [renderValue, renderChip, renderEmpty],\n );\n\n return (\n <FilterActionsContext.Provider value={actions as unknown as FilterActionsContextValue}>\n <FilterStateContext.Provider value={state as never}>\n <FilterRenderContext.Provider value={renderContext as never}>\n <FilterRowStateProvider value={rowStateStore}>\n <FilterFocusContext.Provider value={focusStore}>\n {children ??\n (variant === \"advanced\" ? (\n <FiltersAdvanced<V, O>\n mode={advancedMode}\n align={advancedAlign}\n trigger={trigger}\n reorderable={reorderable}\n className={className}\n />\n ) : (\n <FiltersRow trigger={trigger} showClear={showClear} className={className} />\n ))}\n </FilterFocusContext.Provider>\n </FilterRowStateProvider>\n </FilterRenderContext.Provider>\n </FilterStateContext.Provider>\n </FilterActionsContext.Provider>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersRowProps {\n trigger?: React.ReactNode;\n showClear?: boolean;\n className?: string;\n}\n\n/**\n * The chip row: a toolbar with a roving tabindex, where the predecessor made\n * every segment of every chip its own tab stop. There is NO combinator here,\n * because a chip row can draw a word between two pills but not a parenthesis.\n */\nexport function FiltersRow({ trigger, showClear, className }: FiltersRowProps) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState();\n const focusStore = useFilterFocusStore();\n const rootRef = React.useRef<HTMLDivElement>(null);\n // The keys consult this even though the actions already refuse: an ungated\n // Enter would ARM `autoOpen` for a popover that then refuses to open. Gated\n // per branch, never at the top of `onKeyDown`: the arrows, Home and End are\n // how a read-only bar is read.\n const locked = isFilterLocked(actions);\n\n // Flattened, not `query.rules.filter(isFilterRule)`: a query built in the\n // advanced builder would otherwise hide nested conditions that still filter.\n const rules = React.useMemo(() => flattenFilterRules(query), [query]);\n\n const chips = () =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"filter-chip\"]') ?? []);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = (event.target as HTMLElement).closest<HTMLElement>('[data-slot=\"filter-chip\"]');\n if (!target) return;\n // A key pressed inside an open popover belongs to that popover.\n if (event.target !== target) return;\n\n const all = chips();\n const current = all.indexOf(target);\n if (current === -1) return;\n\n const rtl = getComputedStyle(target).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focusAt = (index: number) => {\n const next = all[Math.max(0, Math.min(index, all.length - 1))];\n if (!next) return;\n event.preventDefault();\n next.focus();\n };\n\n const ruleId = target.dataset.ruleId;\n if (!ruleId) return;\n\n if (event.altKey && (event.key === forward || event.key === backward)) {\n if (locked) return;\n event.preventDefault();\n actions.moveNode(ruleId, event.key === forward ? 1 : -1);\n return;\n }\n if (event.key === forward) return focusAt(current + 1);\n if (event.key === backward) return focusAt(current - 1);\n if (event.key === \"Home\") return focusAt(0);\n if (event.key === \"End\") return focusAt(all.length - 1);\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(ruleId);\n // The neighbour taking this chip's place, so a run of deletes keeps focus.\n requestAnimationFrame(() => {\n const remaining = chips();\n remaining[Math.min(current, remaining.length - 1)]?.focus();\n });\n return;\n }\n\n if (event.key === \"Enter\" || event.key === \" \") {\n if (locked) return;\n event.preventDefault();\n // Enter RESUMES the chip: the attribute segment is display only, so the\n // target is whichever step the flow has not reached, never nothing.\n const rule = findFilterRule(actions.getQuery(), ruleId);\n if (!rule) return;\n const field = getFilterField(actions.index, rule.path);\n // No popover to open, so autoOpen would sit armed until another chip\n // spent it. The chip stays reachable and Delete still removes it.\n if (!field) return;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n const segment = rule.operator && operatorTakesValue(operator) ? \"value\" : \"operator\";\n focusStore.set({ id: ruleId, segment, autoOpen: true });\n }\n };\n\n return (\n <div\n ref={rootRef}\n data-slot=\"filters\"\n data-empty={rules.length === 0 || undefined}\n /* A presence hook, so a consumer can tint the whole read-only bar. */\n data-readonly={actions.readOnly || undefined}\n className={cn(\n /* `sizes.button` and not `actions.size`: the gap ladder and the control\n ladder must answer for the same rung, normalized in one place. */\n filtersBarVariants({ size: sizes.button }),\n /* An empty toolbar is still a flex child, so it took a gap with no\n width. The gap goes, not the toolbar, which owns the row's name. */\n rules.length === 0 && \"gap-0\",\n className,\n )}\n >\n <div\n role=\"toolbar\"\n aria-label={actions.labels.filtersLabel}\n aria-orientation=\"horizontal\"\n /* `role=toolbar` disallows `aria-readonly`, and `aria-disabled` would\n deny arrowing; a description is legal here and spoken on entry. */\n {...(actions.readOnly ? { \"aria-description\": actions.labels.readOnly } : null)}\n className={cn(filtersBarVariants({ size: sizes.button }))}\n onKeyDown={onKeyDown}\n >\n {rules.map((rule, index) => (\n <FilterChip key={rule.id} rule={rule} index={index} />\n ))}\n </div>\n\n <FiltersBuilder trigger={trigger} />\n\n {showClear && ruleCount > 0 ? (\n // `ms-auto` and not `ml-auto`, so Clear stays on the trailing edge\n // under RTL, where the whole bar mirrors.\n <Button\n variant=\"outline\"\n /* The same rung as the Add filter trigger beside it. */\n size={sizes.button}\n className=\"ms-auto\"\n /* `disabled` for the hard flag, `aria-disabled` for the soft one, so\n a read-only Clear keeps its tab stop and can still be found. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clear}\n </Button>\n ) : null}\n\n {/* Keyed on the sequence, so the same sentence twice is two\n announcements (see `announced` for the measurement). A replaced live\n element stops being watched. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Exports */\n/* -------------------------------------------------------------------------- */\n\nexport {\n FilterAdvancedRow,\n FiltersAdvanced,\n FiltersAdvancedPanel,\n} from \"./filters-advanced\";\nexport {\n FilterFieldPicker,\n FiltersBuilder,\n} from \"./filters-builder\";\nexport {\n FilterChip,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nexport {\n // The read-only contract: the gate, and the props a mutating control wears.\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n // What a custom chip needs to rebuild the roving scheme `renderChip` drops.\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocus,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nexport {\n DEFAULT_FILTER_EDITORS,\n useFilterOptions,\n useFilterValueResolution,\n} from \"./filters-editors\";\nexport { DEFAULT_FILTER_LABELS } from \"./filters-i18n\";\nexport {\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n} from \"./filters-operators\";\n// The two resolver signatures `collectFilterIssues` takes.\nexport type {\n FilterArityResolver,\n FilterValidateResolver,\n} from \"./filters-query\";\n// The full pure READ surface, so one import reaches everything a predicate, a\n// saved view or a backend query needs. It stops at the query TREE and compiles\n// nothing: `flattenFilterConditions` is the hand-off a server compiles from.\n// No SQL emitter, because a server has to re-validate anything a browser sends\n// and should compile from the tree rather than parse a client's string. SQL is\n// one target of that hand-off beside Prisma, Drizzle, a REST query string and\n// Elasticsearch.\nexport {\n // The panel does not DRAW the built-in reasons, so this is the only way to\n // surface \"missing value\", \"empty group\" and the rest.\n collectFilterIssues,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n flattenFilterConditions,\n flattenFilterRules,\n isFilterQueryEmpty,\n isFilterRuleComplete,\n moveFilterNodeTo,\n pruneFilterQuery,\n unwrapFilterGroup,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nexport type * from \"./filters-types\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,MAAM,qBAAqB,IAAI,+BAA+B;CAC5D,UAAU,EAKR,MAAM;EACJ,IAAI;EACJ,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAMD,SAAS,qBACP,YACA,qBACA,UACA;CACA,MAAM,eAAe,eAAe,KAAA;CACpC,MAAM,CAAC,UAAU,eAAeA,QAAM,eAC9B,uBAAuB,kBAAqB,CACpD;CAEA,MAAM,QAAQ,eAAe,aAAa;CAC1C,MAAM,WAAWA,QAAM,OAAO,KAAK;CACnC,QAAM,gBAAgB;EACpB,SAAS,UAAU;CACrB,CAAC;CAYD,OAAO;EAAE;EAAO;EAAU,UAVTA,QAAM,aACpB,MAAsB,YAAuC;GAC5D,IAAI,SAAS,SAAS,SAAS;GAC/B,SAAS,UAAU;GACnB,IAAI,CAAC,cAAc,YAAY,IAAI;GACnC,WAAW,MAAM,OAAO;EAC1B,GACA,CAAC,cAAc,QAAQ,CAGQ;CAAE;AACrC;AA4GA,SAAgB,QAAkC,EAChD,QACA,OAAO,iBACP,cACA,eACA,QAAQ,YACR,gBAAgB,oBAChB,SAAS,aACT,UAAU,SACV,eAAe,WACf,gBAAgB,SAChB,cAAc,OACd,OAAO,WACP,WAAW,OACX,WAAW,OACX,qBACA,qBACA,eACA,sBACA,eAAe,QACf,kBAAkB,GAClB,SACA,YAAY,OACZ,aACA,YACA,aACA,WACA,YACqB;CACrB,MAAM,EAAE,OAAO,UAAU,aAAa,qBACpC,iBACA,cACA,aACF;CAEA,MAAM,CAAC,OAAO,oBAAoBA,QAAM,WACtC,oBACA,IACF;CAIA,MA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B,oBAAC,QAAD;IACE,SAAQ;IAER,MAAM,MAAM;IACZ,WAAU;IAGV,UAAU,QAAQ;IAClB,GAAI,oBAAoB,OAAO;IAC/B,eAAe,QAAQ,WAAW;IAEjC,UAAA,QAAQ,OAAO;GACV,CAAA,IACN;GAKJ,oBAAC,OAAD;IAAK,aAAU;IAAS,MAAK;IAAS,WAAU;IAC9C,UAAA,oBAAC,QAAD,EAAA,UAA6B,aAAmB,GAArC,eAAqC;GAC7C,CAAA;EACF;;AAET"}
|
|
@@ -13,7 +13,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
13
13
|
* :not() or !important needed
|
|
14
14
|
*/
|
|
15
15
|
declare const frameVariants: (props?: ({
|
|
16
|
-
variant?: "
|
|
16
|
+
variant?: "default" | "ghost" | "inverse" | null | undefined;
|
|
17
17
|
spacing?: "default" | "sm" | "lg" | "xs" | null | undefined;
|
|
18
18
|
stacked?: boolean | null | undefined;
|
|
19
19
|
dense?: boolean | null | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
3
2
|
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
4
4
|
import { flattenResources, toZoned } from "./gantt-lib.js";
|
|
5
5
|
import { useGantt, useGanttSelector, useGanttViewConfig } from "./gantt.js";
|
|
6
6
|
import { useGanttGestures, wasRecentDrag } from "./gantt-dnd.js";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Button } from "../../ui/button.js";
|
|
3
3
|
import { Calendar } from "../../ui/calendar.js";
|
|
4
4
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../../ui/dropdown-menu.js";
|
|
5
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
6
5
|
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
7
7
|
import { toZoned } from "./gantt-lib.js";
|
|
8
8
|
import { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from "./gantt.js";
|
|
9
9
|
import { useState } from "react";
|
|
@@ -1,56 +1,41 @@
|
|
|
1
1
|
//#region src/components/reui/gantt/gantt-types.d.ts
|
|
2
2
|
type GanttBarId = string;
|
|
3
|
-
/** Horizontal time scale of the gantt axis. */
|
|
4
3
|
type GanttScale = "day" | "week" | "month" | "quarter" | "year";
|
|
5
|
-
/**
|
|
4
|
+
/** Row drag-reorder proposal: `parentId` null is root, `resources` is the tree with the move applied. */
|
|
6
5
|
interface GanttResourceReorder {
|
|
7
|
-
/** The dragged resource id. */
|
|
8
6
|
resourceId: string;
|
|
9
|
-
/** New parent id, or null for the root level. */
|
|
10
7
|
parentId: string | null;
|
|
11
|
-
/**
|
|
8
|
+
/** Position among the new parent's children, the moved row excluded. */
|
|
12
9
|
index: number;
|
|
13
|
-
/** The full resource tree with the move applied (convenience). */
|
|
14
10
|
resources: GanttResource[];
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* would create a concurrent schedule is refused.
|
|
20
|
-
* - "multiple": concurrent schedules stack into stable lanes and the row grows.
|
|
13
|
+
* "single" keeps the node on one track and refuses any gesture that would
|
|
14
|
+
* create a concurrent schedule; "multiple" stacks them into stable lanes.
|
|
21
15
|
*/
|
|
22
16
|
type GanttScheduleMode = "single" | "multiple";
|
|
23
17
|
/**
|
|
24
|
-
* Drop policy for a gesture
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* - "clamp": the gesture stops at the neighbour's edge.
|
|
28
|
-
* - "reject": the gesture is marked invalid and never commits.
|
|
18
|
+
* Drop policy for a gesture overlapping another schedule in the SAME node.
|
|
19
|
+
* Policy only - overlapping data always renders. "allow" (default) commits as
|
|
20
|
+
* proposed, "clamp" stops at the neighbour's edge, "reject" never commits.
|
|
29
21
|
*/
|
|
30
22
|
type GanttOverlapPolicy = "allow" | "reject" | "clamp";
|
|
31
|
-
/** Vertical placement of
|
|
23
|
+
/** Vertical placement of row content when the node holds several lanes; "start" pins it to the first lane. */
|
|
32
24
|
type GanttRowAlign = "start" | "center";
|
|
33
|
-
/**
|
|
34
|
-
* One node of the gantt tree: a generic item that carries a title, consumer
|
|
35
|
-
* columns, and zero or more schedules. It is not domain-bound - the same node
|
|
36
|
-
* expresses a task (one schedule) or a resource lane (many). Nesting via
|
|
37
|
-
* children renders as collapsible groups.
|
|
38
|
-
*/
|
|
25
|
+
/** One tree node, not domain-bound: a task (one schedule) or a resource lane (many). Children nest as collapsible groups. */
|
|
39
26
|
interface GanttResource {
|
|
40
27
|
id: string;
|
|
41
28
|
title: string;
|
|
42
|
-
/** Token or css color used for subtle row/column accents. */
|
|
43
29
|
color?: string;
|
|
44
|
-
/** Per-node cardinality
|
|
30
|
+
/** Per-node cardinality; falls back to the view-level default. */
|
|
45
31
|
scheduleMode?: GanttScheduleMode;
|
|
46
32
|
children?: GanttResource[];
|
|
47
33
|
}
|
|
48
34
|
/** Preferred name for a tree node; `GanttResource` is the legacy alias. */
|
|
49
35
|
type GanttNode = GanttResource;
|
|
36
|
+
/** Half-open: `start` inclusive, `end` exclusive. */
|
|
50
37
|
interface GanttDateRange {
|
|
51
|
-
/** Inclusive instant. */
|
|
52
38
|
start: Date;
|
|
53
|
-
/** Exclusive instant. */
|
|
54
39
|
end: Date;
|
|
55
40
|
}
|
|
56
41
|
type GanttWeekday = "MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU";
|
|
@@ -58,7 +43,7 @@ interface GanttRecurrenceRule {
|
|
|
58
43
|
freq: "daily" | "weekly" | "monthly" | "yearly";
|
|
59
44
|
interval?: number;
|
|
60
45
|
count?: number;
|
|
61
|
-
/** Inclusive
|
|
46
|
+
/** Inclusive, unlike the exclusive `end` of a range. */
|
|
62
47
|
until?: Date;
|
|
63
48
|
byWeekday?: Array<GanttWeekday | {
|
|
64
49
|
day: GanttWeekday;
|
|
@@ -73,34 +58,28 @@ interface GanttRecurrenceRule {
|
|
|
73
58
|
interface GanttEvent<TData = unknown> {
|
|
74
59
|
id: GanttBarId;
|
|
75
60
|
title: string;
|
|
76
|
-
/** Plain
|
|
61
|
+
/** Plain instants, not ISO strings. `end` is exclusive and must be >= start. */
|
|
77
62
|
start: Date;
|
|
78
|
-
/** Exclusive; must be >= start. */
|
|
79
63
|
end: Date;
|
|
80
64
|
allDay?: boolean;
|
|
81
65
|
/** Structured rule or a raw "RRULE:..." line. */
|
|
82
66
|
recurrence?: GanttRecurrenceRule | string;
|
|
83
|
-
/**
|
|
67
|
+
/** An edited single occurrence of that series; `originalStart` is the RECURRENCE-ID it replaces. */
|
|
84
68
|
recurringEventId?: GanttBarId;
|
|
85
|
-
/** Which occurrence it replaces (RECURRENCE-ID semantics). */
|
|
86
69
|
originalStart?: Date;
|
|
87
70
|
/** Token or css color; flows to the --gantt-event-color css var. */
|
|
88
71
|
color?: string;
|
|
89
|
-
/**
|
|
72
|
+
/** Vetoes only, ANDed with interactions.drag / .resize: readOnly blocks both, draggable/resizable one each. */
|
|
90
73
|
readOnly?: boolean;
|
|
91
|
-
/** Per-event override; default comes from interactions.drag. */
|
|
92
74
|
draggable?: boolean;
|
|
93
|
-
/** Per-event override; default comes from interactions.resize. */
|
|
94
75
|
resizable?: boolean;
|
|
95
|
-
/**
|
|
76
|
+
/** Feeds the default getEventPriority; higher orders and packs first. */
|
|
96
77
|
priority?: number;
|
|
97
|
-
/** Completion 0-100
|
|
78
|
+
/** Completion 0-100, not 0-1. */
|
|
98
79
|
progress?: number;
|
|
99
80
|
/** Explicit stacking override; wins over the computed z. */
|
|
100
81
|
zIndex?: number;
|
|
101
|
-
/** Resource row this bar belongs to. */
|
|
102
82
|
resourceId?: string;
|
|
103
|
-
/** Consumer payload, fully generic. */
|
|
104
83
|
data?: TData;
|
|
105
84
|
}
|
|
106
85
|
interface GanttOccurrence<TData = unknown> {
|
|
@@ -125,15 +104,13 @@ interface GanttSegment<TData = unknown> {
|
|
|
125
104
|
/** Minutes from the visible range start, clamped to the range. */
|
|
126
105
|
startMin?: number;
|
|
127
106
|
endMin?: number;
|
|
128
|
-
/**
|
|
107
|
+
/** Lane packing: 0-based lane index, then the lanes the node's row resolved to. */
|
|
129
108
|
column?: number;
|
|
130
|
-
/** Lanes the node's row resolved to. */
|
|
131
109
|
columnCount?: number;
|
|
132
110
|
columnSpan?: number;
|
|
133
111
|
}
|
|
134
112
|
interface GanttSelection {
|
|
135
113
|
eventKeys: string[];
|
|
136
|
-
/** Committed slot selection; see GanttSlotDraft for the in-gesture value. */
|
|
137
114
|
slot: {
|
|
138
115
|
start: Date;
|
|
139
116
|
end: Date;
|
|
@@ -152,30 +129,22 @@ interface GanttDragState<TData = unknown> {
|
|
|
152
129
|
proposedStart: Date;
|
|
153
130
|
proposedEnd: Date;
|
|
154
131
|
proposedAllDay: boolean;
|
|
155
|
-
/** The bar's own resource; moves are x-axis only and never cross rows. */
|
|
156
132
|
proposedResourceId?: string;
|
|
157
133
|
/** Last canDropEvent verdict; drives data-drop-invalid styling. */
|
|
158
134
|
valid: boolean;
|
|
159
135
|
}
|
|
160
|
-
/**
|
|
161
|
-
* The in-progress drag-create rectangle ONLY, cleared on commit or cancel.
|
|
162
|
-
* The committed slot selection lives in GanttSelection.slot.
|
|
163
|
-
*/
|
|
136
|
+
/** The in-gesture drag-create rectangle only; the committed slot is GanttSelection.slot. */
|
|
164
137
|
interface GanttSlotDraft {
|
|
165
138
|
start: Date;
|
|
166
139
|
end: Date;
|
|
167
140
|
allDay: boolean;
|
|
168
|
-
/** Present when the slot was selected inside a resource row. */
|
|
169
141
|
resourceId?: string;
|
|
170
142
|
}
|
|
171
143
|
interface GanttState<TData = unknown> {
|
|
172
|
-
/** Horizontal axis scale. */
|
|
173
144
|
scale: GanttScale;
|
|
174
|
-
/** Anchor date. */
|
|
175
145
|
date: Date;
|
|
176
|
-
/** Full rendered axis range - fetch remote data for THIS. */
|
|
146
|
+
/** Full rendered axis range - fetch remote data for THIS, not for activeRange (the logical month/week). */
|
|
177
147
|
visibleRange: GanttDateRange;
|
|
178
|
-
/** The logical period (the month/week itself). */
|
|
179
148
|
activeRange: GanttDateRange;
|
|
180
149
|
events: GanttEvent<TData>[];
|
|
181
150
|
selection: GanttSelection;
|
|
@@ -183,11 +152,7 @@ interface GanttState<TData = unknown> {
|
|
|
183
152
|
loading: boolean;
|
|
184
153
|
drag: GanttDragState<TData> | null;
|
|
185
154
|
slotDraft: GanttSlotDraft | null;
|
|
186
|
-
/**
|
|
187
|
-
* Instant at the center of the scrolled viewport; the nav title follows it
|
|
188
|
-
* so the header always names what you are looking at. null before the view
|
|
189
|
-
* reports a position (falls back to the anchor date).
|
|
190
|
-
*/
|
|
155
|
+
/** Center of the scrolled viewport; the nav title follows it. null falls back to the anchor date. */
|
|
191
156
|
viewportCenter: Date | null;
|
|
192
157
|
}
|
|
193
158
|
interface GanttRangeInfo {
|
|
@@ -204,7 +169,6 @@ interface GanttProposedUpdate<TData = unknown> {
|
|
|
204
169
|
start: Date;
|
|
205
170
|
end: Date;
|
|
206
171
|
allDay: boolean;
|
|
207
|
-
/** The bar's own resource (moves stay in-row); set on create/api. */
|
|
208
172
|
resourceId?: string;
|
|
209
173
|
source: "drag" | "resize-start" | "resize-end" | "keyboard" | "api";
|
|
210
174
|
}
|
|
@@ -219,30 +183,20 @@ interface GanttSlotInfo {
|
|
|
219
183
|
date: Date;
|
|
220
184
|
end?: Date;
|
|
221
185
|
allDay: boolean;
|
|
222
|
-
/** Present when the click happened inside a resource row. */
|
|
223
186
|
resourceId?: string;
|
|
224
187
|
}
|
|
225
|
-
/**
|
|
226
|
-
* Off-day marking (non-working days). `true` uses the defaults: weekends
|
|
227
|
-
* with a muted background. Custom weekday sets, explicit dates, a predicate,
|
|
228
|
-
* and a custom class are all supported; marked cells carry `data-off` for
|
|
229
|
-
* CSS-selector customization.
|
|
230
|
-
*/
|
|
188
|
+
/** Off-day marking; `true` takes the defaults. Marked cells carry `data-off` for CSS customization. */
|
|
231
189
|
interface GanttOffDaysConfig {
|
|
232
190
|
/** Weekday numbers treated as off (0 = Sunday). Default [0, 6]. */
|
|
233
191
|
weekendDays?: number[];
|
|
234
|
-
/**
|
|
192
|
+
/** Extra off dates compared by day in the display zone. */
|
|
235
193
|
dates?: Date[];
|
|
236
|
-
/**
|
|
194
|
+
/** Runs in addition to weekendDays and dates, not instead; any match marks the day off. */
|
|
237
195
|
isOffDay?: (day: Date) => boolean;
|
|
238
196
|
/** Marker classes; default "bg-muted/40". */
|
|
239
197
|
className?: string;
|
|
240
198
|
}
|
|
241
|
-
/**
|
|
242
|
-
* External-data contract. v1 ships the type plus docs recipes (Google
|
|
243
|
-
* events.list / MS Graph calendarView map to GanttEvent in ~15 lines);
|
|
244
|
-
* OAuth, tokens, and sync loops are application backend territory.
|
|
245
|
-
*/
|
|
199
|
+
/** External-data contract; OAuth, tokens, and sync loops are application backend territory. */
|
|
246
200
|
interface GanttDataAdapter<TData = unknown> {
|
|
247
201
|
getEvents(range: GanttDateRange, signal?: AbortSignal): Promise<GanttEvent<TData>[]>;
|
|
248
202
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-types.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-types.tsx"],"mappings":";KAEK;;
|
|
1
|
+
{"version":3,"file":"gantt-types.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-types.tsx"],"mappings":";KAEK;KAEA;;UAGK;EACR;EACA;;EAEA;EACA,WAAW;;;;;;KAOR;;;;;;KAOA;;KAGA;;UAGK;EACR;EACA;EACA;;EAEA,eAAe;EACf,WAAW;;;KAIR,YAA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1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button } from "../../ui/button.js";
|
|
3
3
|
import { ScrollArea as ScrollArea$1, ScrollBar } from "../../ui/scroll-area.js";
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
5
4
|
import { Checkbox } from "../../ui/checkbox.js";
|
|
6
5
|
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
7
7
|
import { getDayKey, getLaneKey, getRangeKey, packTimedSegments, reorderResources, resolveOffDay, toZoned, zonedStartOfDay } from "./gantt-lib.js";
|
|
8
8
|
import { resolveScheduleMode, resolveTimelineLines, useGantt, useGanttSelector, useGanttSettings, useGanttViewConfig } from "./gantt.js";
|
|
9
9
|
import { cancelActiveGanttGestures, markGestureEnd, useGanttGestureTeardown, useGanttGestures, wasRecentDrag } from "./gantt-dnd.js";
|
|
@@ -5,7 +5,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
5
5
|
//#region src/components/ui/attachment.d.ts
|
|
6
6
|
declare const attachmentVariants: (props?: ({
|
|
7
7
|
size?: "default" | "sm" | "xs" | null | undefined;
|
|
8
|
-
orientation?: "
|
|
8
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
declare function Attachment({ className, state, size, orientation, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
|
|
11
11
|
state?: "idle" | "uploading" | "processing" | "error" | "done";
|
|
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
//#region src/components/ui/badge.d.ts
|
|
4
4
|
declare const badgeVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
//#endregion
|
|
@@ -4,7 +4,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
4
4
|
//#region src/components/ui/bubble.d.ts
|
|
5
5
|
declare function BubbleGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
6
6
|
declare const bubbleVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "muted" | "tinted" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
declare function Bubble({ variant, align, className, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
|
|
10
10
|
align?: "start" | "end";
|
|
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/ui/button-group.d.ts
|
|
5
5
|
declare const buttonGroupVariants: (props?: ({
|
|
6
|
-
orientation?: "
|
|
6
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
|
|
9
9
|
declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -2,8 +2,8 @@ import { Button as Button$1 } from "@base-ui/react/button";
|
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
//#region src/components/ui/button.d.ts
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
6
|
-
size?: "default" | "sm" | "
|
|
5
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | "xs" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|
|
9
9
|
//#endregion
|
|
@@ -7,7 +7,7 @@ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
|
7
7
|
function Checkbox({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
9
9
|
"data-slot": "checkbox",
|
|
10
|
-
className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 group-has-disabled/field:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
10
|
+
className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 group-has-focus-visible/field-label:not-data-checked:border-input group-has-disabled/field:opacity-50 group-has-focus-visible/field-label:ring-0 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-focus-visible/field-label:data-checked:border-primary dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
11
11
|
...props,
|
|
12
12
|
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
13
13
|
"data-slot": "checkbox-indicator",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":["CheckboxPrimitive"],"sources":["../../../src/components/ui/checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport { CheckIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\n\nfunction Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 group-has-disabled/field:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none [&>svg]:size-3.5\"\n >\n <CheckIcon />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { Checkbox };\n"],"mappings":";;;;;;AAOA,SAAS,SAAS,EAAE,WAAW,GAAG,SAAuC;CACvE,OACE,oBAACA,WAAkB,MAAnB;EACE,aAAU;EACV,WAAW,GACT,
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":["CheckboxPrimitive"],"sources":["../../../src/components/ui/checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport { CheckIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\n\nfunction Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 group-has-focus-visible/field-label:not-data-checked:border-input group-has-disabled/field:opacity-50 group-has-focus-visible/field-label:ring-0 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-focus-visible/field-label:data-checked:border-primary dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none [&>svg]:size-3.5\"\n >\n <CheckIcon />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { Checkbox };\n"],"mappings":";;;;;;AAOA,SAAS,SAAS,EAAE,WAAW,GAAG,SAAuC;CACvE,OACE,oBAACA,WAAkB,MAAnB;EACE,aAAU;EACV,WAAW,GACT,k1BACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAACA,WAAkB,WAAnB;GACE,aAAU;GACV,WAAU;GAEV,UAAA,oBAAC,WAAD,CAAY,CAAA;EACe,CAAA;CACP,CAAA;AAE5B"}
|
|
@@ -7,7 +7,7 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
|
|
|
7
7
|
}): import("react").JSX.Element;
|
|
8
8
|
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
9
9
|
declare const fieldVariants: (props?: ({
|
|
10
|
-
orientation?: "
|
|
10
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): import("react").JSX.Element;
|
|
13
13
|
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Separator } from "./separator.js";
|
|
3
2
|
import { Label } from "./label.js";
|
|
3
|
+
import { Separator } from "./separator.js";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -55,7 +55,7 @@ function FieldContent({ className, ...props }) {
|
|
|
55
55
|
function FieldLabel({ className, ...props }) {
|
|
56
56
|
return /* @__PURE__ */ jsx(Label, {
|
|
57
57
|
"data-slot": "field-label",
|
|
58
|
-
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-data-checked:border-primary/30 has-data-checked:bg-primary/5 *:data-[slot=field]:p-2.5 group-data-[disabled=true]/field:opacity-50 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
|
|
58
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug has-[>[data-slot=field]]:has-focus-visible:border-ring has-[>[data-slot=field]]:has-focus-visible:ring-3 has-[>[data-slot=field]]:has-focus-visible:ring-ring/50 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 *:data-[slot=field]:p-2.5 group-data-[disabled=true]/field:opacity-50 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
|
|
59
59
|
...props
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":[],"sources":["../../../src/components/ui/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Label } from \"./label\";\nimport { Separator } from \"./separator\";\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nconst fieldVariants = cva(\"group/field flex w-full gap-2 data-[invalid=true]:text-destructive\", {\n variants: {\n orientation: {\n vertical: \"flex-col *:w-full [&>.sr-only]:w-auto\",\n horizontal:\n \"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n responsive:\n \"@md/field-group:flex-row flex-col @md/field-group:items-center *:w-full @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nfunction Field({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\", className)}\n {...props}\n />\n );\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-data-checked:border-primary/30 has-data-checked:bg-primary/5 *:data-[slot=field]:p-2.5 group-data-[disabled=true]/field:opacity-50 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"flex w-fit items-center gap-2 font-medium text-sm group-data-[disabled=true]/field:opacity-50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-left font-normal text-muted-foreground text-sm leading-normal group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5\",\n \"nth-last-2:-mt-1 last:mt-0\",\n \"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\",\n className,\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n );\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors?.length) {\n return null;\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message;\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"font-normal text-destructive text-sm\", className)}\n {...props}\n >\n {content}\n </div>\n );\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n};\n"],"mappings":";;;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,GAAG,SAA2C;CAC3E,OACE,oBAAC,YAAD;EACE,aAAU;EACV,WAAW,GACT,oGACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,UAAU,UACV,GAAG,SACiE;CACpE,OACE,oBAAC,UAAD;EACE,aAAU;EACV,gBAAc;EACd,WAAW,GACT,mFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,wIACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,gBAAgB,IAAI,sEAAsE;CAC9F,UAAU,EACR,aAAa;EACX,UAAU;EACV,YACE;EACF,YACE;CACJ,EACF;CACA,iBAAiB,EACf,aAAa,WACf;AACF,CAAC;AAED,SAAS,MAAM,EACb,WACA,cAAc,YACd,GAAG,SACgE;CACnE,OACE,oBAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,oBAAkB;EAClB,WAAW,GAAG,cAAc,EAAE,YAAY,CAAC,GAAG,SAAS;EACvD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,iEAAiE,SAAS;EACxF,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAA6C;CAC/E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,
|
|
1
|
+
{"version":3,"file":"field.js","names":[],"sources":["../../../src/components/ui/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Label } from \"./label\";\nimport { Separator } from \"./separator\";\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nconst fieldVariants = cva(\"group/field flex w-full gap-2 data-[invalid=true]:text-destructive\", {\n variants: {\n orientation: {\n vertical: \"flex-col *:w-full [&>.sr-only]:w-auto\",\n horizontal:\n \"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n responsive:\n \"@md/field-group:flex-row flex-col @md/field-group:items-center *:w-full @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nfunction Field({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\", className)}\n {...props}\n />\n );\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug has-[>[data-slot=field]]:has-focus-visible:border-ring has-[>[data-slot=field]]:has-focus-visible:ring-3 has-[>[data-slot=field]]:has-focus-visible:ring-ring/50 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 *:data-[slot=field]:p-2.5 group-data-[disabled=true]/field:opacity-50 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"flex w-fit items-center gap-2 font-medium text-sm group-data-[disabled=true]/field:opacity-50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-left font-normal text-muted-foreground text-sm leading-normal group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5\",\n \"nth-last-2:-mt-1 last:mt-0\",\n \"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\",\n className,\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n );\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors?.length) {\n return null;\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message;\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"font-normal text-destructive text-sm\", className)}\n {...props}\n >\n {content}\n </div>\n );\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n};\n"],"mappings":";;;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,GAAG,SAA2C;CAC3E,OACE,oBAAC,YAAD;EACE,aAAU;EACV,WAAW,GACT,oGACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,UAAU,UACV,GAAG,SACiE;CACpE,OACE,oBAAC,UAAD;EACE,aAAU;EACV,gBAAc;EACd,WAAW,GACT,mFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,wIACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,gBAAgB,IAAI,sEAAsE;CAC9F,UAAU,EACR,aAAa;EACX,UAAU;EACV,YACE;EAC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,CAAC,GAAG,IAAI,IAAI,OAAO,KAAK,UAAU,CAAC,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;EAEzF,IAAI,cAAc,WAAW,GAC3B,OAAO,aAAa,EAAE,EAAE;EAG1B,OACE,oBAAC,MAAD;GAAI,WAAU;GACX,UAAA,aAAa,KAAK,OAAO,UAAU,OAAO,WAAW,oBAAC,MAAD,EAAA,UAAiB,MAAM,QAAY,GAA1B,KAA0B,CAAC;EACxF,CAAA;CAER,GAAG,CAAC,UAAU,MAAM,CAAC;CAErB,IAAI,CAAC,SACH,OAAO;CAGT,OACE,oBAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,WAAW,GAAG,wCAAwC,SAAS;EAC/D,GAAI;EAEH,UAAA;CACE,CAAA;AAET"}
|
|
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
declare function ItemGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
7
7
|
declare function ItemSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): React$1.JSX.Element;
|
|
8
8
|
declare const itemVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "outline" | "muted" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "xs" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
@@ -14,7 +14,7 @@ function RadioGroup({ className, ...props }) {
|
|
|
14
14
|
function RadioGroupItem({ className, ...props }) {
|
|
15
15
|
return /* @__PURE__ */ jsx(Radio.Root, {
|
|
16
16
|
"data-slot": "radio-group-item",
|
|
17
|
-
className: cn("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
17
|
+
className: cn("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 group-has-focus-visible/field-label:not-data-checked:border-input group-has-focus-visible/field-label:ring-0 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-focus-visible/field-label:data-checked:border-primary dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
18
18
|
...props,
|
|
19
19
|
children: /* @__PURE__ */ jsx(Radio.Indicator, {
|
|
20
20
|
"data-slot": "radio-group-indicator",
|