@easyvision/easyvision-ui 1.7.5 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -239,6 +239,64 @@ declare const EasyVisionCardDescription: React.ForwardRefExoticComponent<React.H
239
239
  declare const EasyVisionCardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
240
240
  declare const EasyVisionCardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
241
241
 
242
+ /** A single unfoldable question/answer entry for the data-driven API. */
243
+ interface AccordionItem {
244
+ /** Stable key, also used to track open state. */
245
+ id: string;
246
+ /** Header content — a string or any node (e.g. icon + label). */
247
+ question: ReactNode;
248
+ /** Free-format body revealed when the item is expanded. */
249
+ content: ReactNode;
250
+ /** Start expanded (uncontrolled mode only). */
251
+ defaultOpen?: boolean;
252
+ /** Render the trigger as non-interactive. */
253
+ disabled?: boolean;
254
+ }
255
+ /** 'single' = one item open at a time; 'multiple' = items open independently. */
256
+ type AccordionMode = 'single' | 'multiple';
257
+ interface EasyVisionAccordionProps {
258
+ /** Data-driven items. Omit when composing <EasyVisionAccordionItem> children instead. */
259
+ items?: AccordionItem[];
260
+ /** Compound children (alternative to `items`). */
261
+ children?: ReactNode;
262
+ /** Open behaviour. Default: 'single'. */
263
+ mode?: AccordionMode;
264
+ /** Controlled set of open ids. When provided the component is fully controlled. */
265
+ openIds?: string[];
266
+ /** Uncontrolled initial open ids (ignored when `openIds` is set). */
267
+ defaultOpenIds?: string[];
268
+ /** Fired whenever the open set changes, with the next list of open ids. */
269
+ onOpenChange?: (openIds: string[]) => void;
270
+ className?: string;
271
+ }
272
+ interface EasyVisionAccordionItemProps {
273
+ /** Stable key, also used to track open state. */
274
+ id: string;
275
+ /** Header content — a string or any node. */
276
+ question: ReactNode;
277
+ /** Free-format body revealed when expanded. */
278
+ children: ReactNode;
279
+ /** Start expanded (uncontrolled mode only). */
280
+ defaultOpen?: boolean;
281
+ /** Render the trigger as non-interactive. */
282
+ disabled?: boolean;
283
+ className?: string;
284
+ }
285
+
286
+ /**
287
+ * Marker component for the compound API. It renders nothing on its own — the
288
+ * parent <EasyVisionAccordion> reads its props and draws the row. Rendering it
289
+ * outside an accordion is a no-op.
290
+ */
291
+ declare function EasyVisionAccordionItem(_props: EasyVisionAccordionItemProps): React.ReactElement | null;
292
+ declare namespace EasyVisionAccordionItem {
293
+ var displayName: string;
294
+ }
295
+ declare function EasyVisionAccordion({ items, children, mode, openIds, defaultOpenIds, onOpenChange, className, }: EasyVisionAccordionProps): React.ReactElement;
296
+ declare namespace EasyVisionAccordion {
297
+ var displayName: string;
298
+ }
299
+
242
300
  /**
243
301
  * LoopBack adapter for `EasyVisionTable`.
244
302
  *
@@ -690,4 +748,4 @@ declare const getSlice: <K extends SliceKind>(fullId: string) => SliceFor<K> | u
690
748
  */
691
749
  declare const defaultCell: (content: ReactNode, title?: string) => ReactNode;
692
750
 
693
- export { type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type TableLabels, type TableMode, type TextFieldDef, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
751
+ export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type TableLabels, type TableMode, type TextFieldDef, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
package/dist/index.d.ts CHANGED
@@ -239,6 +239,64 @@ declare const EasyVisionCardDescription: React.ForwardRefExoticComponent<React.H
239
239
  declare const EasyVisionCardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
240
240
  declare const EasyVisionCardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
241
241
 
242
+ /** A single unfoldable question/answer entry for the data-driven API. */
243
+ interface AccordionItem {
244
+ /** Stable key, also used to track open state. */
245
+ id: string;
246
+ /** Header content — a string or any node (e.g. icon + label). */
247
+ question: ReactNode;
248
+ /** Free-format body revealed when the item is expanded. */
249
+ content: ReactNode;
250
+ /** Start expanded (uncontrolled mode only). */
251
+ defaultOpen?: boolean;
252
+ /** Render the trigger as non-interactive. */
253
+ disabled?: boolean;
254
+ }
255
+ /** 'single' = one item open at a time; 'multiple' = items open independently. */
256
+ type AccordionMode = 'single' | 'multiple';
257
+ interface EasyVisionAccordionProps {
258
+ /** Data-driven items. Omit when composing <EasyVisionAccordionItem> children instead. */
259
+ items?: AccordionItem[];
260
+ /** Compound children (alternative to `items`). */
261
+ children?: ReactNode;
262
+ /** Open behaviour. Default: 'single'. */
263
+ mode?: AccordionMode;
264
+ /** Controlled set of open ids. When provided the component is fully controlled. */
265
+ openIds?: string[];
266
+ /** Uncontrolled initial open ids (ignored when `openIds` is set). */
267
+ defaultOpenIds?: string[];
268
+ /** Fired whenever the open set changes, with the next list of open ids. */
269
+ onOpenChange?: (openIds: string[]) => void;
270
+ className?: string;
271
+ }
272
+ interface EasyVisionAccordionItemProps {
273
+ /** Stable key, also used to track open state. */
274
+ id: string;
275
+ /** Header content — a string or any node. */
276
+ question: ReactNode;
277
+ /** Free-format body revealed when expanded. */
278
+ children: ReactNode;
279
+ /** Start expanded (uncontrolled mode only). */
280
+ defaultOpen?: boolean;
281
+ /** Render the trigger as non-interactive. */
282
+ disabled?: boolean;
283
+ className?: string;
284
+ }
285
+
286
+ /**
287
+ * Marker component for the compound API. It renders nothing on its own — the
288
+ * parent <EasyVisionAccordion> reads its props and draws the row. Rendering it
289
+ * outside an accordion is a no-op.
290
+ */
291
+ declare function EasyVisionAccordionItem(_props: EasyVisionAccordionItemProps): React.ReactElement | null;
292
+ declare namespace EasyVisionAccordionItem {
293
+ var displayName: string;
294
+ }
295
+ declare function EasyVisionAccordion({ items, children, mode, openIds, defaultOpenIds, onOpenChange, className, }: EasyVisionAccordionProps): React.ReactElement;
296
+ declare namespace EasyVisionAccordion {
297
+ var displayName: string;
298
+ }
299
+
242
300
  /**
243
301
  * LoopBack adapter for `EasyVisionTable`.
244
302
  *
@@ -690,4 +748,4 @@ declare const getSlice: <K extends SliceKind>(fullId: string) => SliceFor<K> | u
690
748
  */
691
749
  declare const defaultCell: (content: ReactNode, title?: string) => ReactNode;
692
750
 
693
- export { type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type TableLabels, type TableMode, type TextFieldDef, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
751
+ export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type TableLabels, type TableMode, type TextFieldDef, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import './easyvision.css';
2
2
  import './EasyVisionTable.css';
3
- import * as React8 from 'react';
3
+ import * as React9 from 'react';
4
4
  import { createContext, forwardRef, useMemo, useSyncExternalStore, useRef, useEffect, useCallback, useImperativeHandle, useContext, useState, createElement } from 'react';
5
5
  import { ChevronDown, ChevronUp, Check, Search, X, Plus, ChevronRight, Circle, Calendar as Calendar$1, ChevronLeft, ChevronsUpDown, Loader2, ArrowUp, ArrowDown, ArrowUpDown, Settings2 } from 'lucide-react';
6
6
  import { clsx } from 'clsx';
@@ -24,7 +24,7 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
24
24
  function cn(...inputs) {
25
25
  return twMerge(clsx(inputs));
26
26
  }
27
- var Input = React8.forwardRef(
27
+ var Input = React9.forwardRef(
28
28
  ({ className, type, ...props }, ref) => {
29
29
  return /* @__PURE__ */ jsx(
30
30
  "input",
@@ -232,7 +232,7 @@ function EasyVisionInput({
232
232
  }
233
233
  var Select = SelectPrimitive.Root;
234
234
  var SelectValue = SelectPrimitive.Value;
235
- var SelectTrigger = React8.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
235
+ var SelectTrigger = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
236
236
  SelectPrimitive.Trigger,
237
237
  {
238
238
  ref,
@@ -245,7 +245,7 @@ var SelectTrigger = React8.forwardRef(({ className, children, ...props }, ref) =
245
245
  }
246
246
  ));
247
247
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
248
- var SelectScrollUpButton = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
248
+ var SelectScrollUpButton = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
249
249
  SelectPrimitive.ScrollUpButton,
250
250
  {
251
251
  ref,
@@ -255,7 +255,7 @@ var SelectScrollUpButton = React8.forwardRef(({ className, ...props }, ref) => /
255
255
  }
256
256
  ));
257
257
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
258
- var SelectScrollDownButton = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
258
+ var SelectScrollDownButton = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
259
259
  SelectPrimitive.ScrollDownButton,
260
260
  {
261
261
  ref,
@@ -265,7 +265,7 @@ var SelectScrollDownButton = React8.forwardRef(({ className, ...props }, ref) =>
265
265
  }
266
266
  ));
267
267
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
268
- var SelectContent = React8.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
268
+ var SelectContent = React9.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
269
269
  SelectPrimitive.Content,
270
270
  {
271
271
  ref,
@@ -289,7 +289,7 @@ var SelectContent = React8.forwardRef(({ className, children, position = "popper
289
289
  }
290
290
  ) }));
291
291
  SelectContent.displayName = SelectPrimitive.Content.displayName;
292
- var SelectLabel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
292
+ var SelectLabel = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
293
293
  SelectPrimitive.Label,
294
294
  {
295
295
  ref,
@@ -298,7 +298,7 @@ var SelectLabel = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
298
298
  }
299
299
  ));
300
300
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
301
- var SelectItem = React8.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
301
+ var SelectItem = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
302
302
  SelectPrimitive.Item,
303
303
  {
304
304
  ref,
@@ -311,7 +311,7 @@ var SelectItem = React8.forwardRef(({ className, children, ...props }, ref) => /
311
311
  }
312
312
  ));
313
313
  SelectItem.displayName = SelectPrimitive.Item.displayName;
314
- var SelectSeparator = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
314
+ var SelectSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
315
315
  SelectPrimitive.Separator,
316
316
  {
317
317
  ref,
@@ -342,7 +342,7 @@ var buttonVariants = cva("ev-btn", {
342
342
  size: "default"
343
343
  }
344
344
  });
345
- var Button = React8.forwardRef(
345
+ var Button = React9.forwardRef(
346
346
  ({ className, variant, size, asChild = false, ...props }, ref) => {
347
347
  const Comp = asChild ? Slot : "button";
348
348
  return /* @__PURE__ */ jsx(
@@ -358,7 +358,7 @@ var Button = React8.forwardRef(
358
358
  Button.displayName = "Button";
359
359
  var Popover = PopoverPrimitive.Root;
360
360
  var PopoverTrigger = PopoverPrimitive.Trigger;
361
- var PopoverContent = React8.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
361
+ var PopoverContent = React9.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
362
362
  PopoverPrimitive.Content,
363
363
  {
364
364
  ref,
@@ -369,7 +369,7 @@ var PopoverContent = React8.forwardRef(({ className, align = "center", sideOffse
369
369
  }
370
370
  ) }));
371
371
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
372
- var Command = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
372
+ var Command = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
373
373
  Command$1,
374
374
  {
375
375
  ref,
@@ -378,7 +378,7 @@ var Command = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
378
378
  }
379
379
  ));
380
380
  Command.displayName = Command$1.displayName;
381
- var CommandInput = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "ev-cmd-input-wrapper", "cmdk-input-wrapper": "", children: [
381
+ var CommandInput = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "ev-cmd-input-wrapper", "cmdk-input-wrapper": "", children: [
382
382
  /* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "ev-cmd-input-icon" }),
383
383
  /* @__PURE__ */ jsx(
384
384
  Command$1.Input,
@@ -390,7 +390,7 @@ var CommandInput = React8.forwardRef(({ className, ...props }, ref) => /* @__PUR
390
390
  )
391
391
  ] }));
392
392
  CommandInput.displayName = Command$1.Input.displayName;
393
- var CommandList = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
393
+ var CommandList = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
394
394
  Command$1.List,
395
395
  {
396
396
  ref,
@@ -399,7 +399,7 @@ var CommandList = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
399
399
  }
400
400
  ));
401
401
  CommandList.displayName = Command$1.List.displayName;
402
- var CommandEmpty = React8.forwardRef((props, ref) => /* @__PURE__ */ jsx(
402
+ var CommandEmpty = React9.forwardRef((props, ref) => /* @__PURE__ */ jsx(
403
403
  Command$1.Empty,
404
404
  {
405
405
  ref,
@@ -408,7 +408,7 @@ var CommandEmpty = React8.forwardRef((props, ref) => /* @__PURE__ */ jsx(
408
408
  }
409
409
  ));
410
410
  CommandEmpty.displayName = Command$1.Empty.displayName;
411
- var CommandGroup = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
411
+ var CommandGroup = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
412
412
  Command$1.Group,
413
413
  {
414
414
  ref,
@@ -417,7 +417,7 @@ var CommandGroup = React8.forwardRef(({ className, ...props }, ref) => /* @__PUR
417
417
  }
418
418
  ));
419
419
  CommandGroup.displayName = Command$1.Group.displayName;
420
- var CommandSeparator = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
420
+ var CommandSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
421
421
  Command$1.Separator,
422
422
  {
423
423
  ref,
@@ -426,7 +426,7 @@ var CommandSeparator = React8.forwardRef(({ className, ...props }, ref) => /* @_
426
426
  }
427
427
  ));
428
428
  CommandSeparator.displayName = Command$1.Separator.displayName;
429
- var CommandItem = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
429
+ var CommandItem = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
430
430
  Command$1.Item,
431
431
  {
432
432
  ref,
@@ -593,6 +593,7 @@ function TextWidget({ definition, value, onChange, onRemove }) {
593
593
  }
594
594
  var SENTINEL = "__easyvision_undef__";
595
595
  function SelectorWidget({ definition, value, onChange, onRemove }) {
596
+ const [open, setOpen] = useState(false);
596
597
  const [resolved, setResolved] = useState(
597
598
  Array.isArray(definition.options) ? definition.options : null
598
599
  );
@@ -606,14 +607,23 @@ function SelectorWidget({ definition, value, onChange, onRemove }) {
606
607
  const opts = resolved ?? [];
607
608
  const selectValue = value === void 0 || value === "" ? SENTINEL : String(value);
608
609
  return /* @__PURE__ */ jsxs("div", { className: "ev-mf-chip is-wrap", children: [
609
- /* @__PURE__ */ jsxs("span", { className: "ev-mf-chip-label", children: [
610
- definition.label,
611
- definition.mandatory && /* @__PURE__ */ jsx("span", { className: "ev-mf-chip-required", children: "*" }),
612
- ":"
613
- ] }),
610
+ /* @__PURE__ */ jsxs(
611
+ "span",
612
+ {
613
+ className: "ev-mf-chip-label is-clickable",
614
+ onClick: () => setOpen(true),
615
+ children: [
616
+ definition.label,
617
+ definition.mandatory && /* @__PURE__ */ jsx("span", { className: "ev-mf-chip-required", children: "*" }),
618
+ ":"
619
+ ]
620
+ }
621
+ ),
614
622
  /* @__PURE__ */ jsxs(
615
623
  Select,
616
624
  {
625
+ open,
626
+ onOpenChange: setOpen,
617
627
  value: selectValue,
618
628
  onValueChange: (raw) => {
619
629
  if (raw === SENTINEL) onChange(void 0);
@@ -639,7 +649,7 @@ function SelectorWidget({ definition, value, onChange, onRemove }) {
639
649
  )
640
650
  ] });
641
651
  }
642
- var Checkbox = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
652
+ var Checkbox = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
643
653
  CheckboxPrimitive.Root,
644
654
  {
645
655
  ref,
@@ -656,6 +666,7 @@ function MultiSelectWidget({
656
666
  onRemove
657
667
  }) {
658
668
  const [search, setSearch] = useState("");
669
+ const [open, setOpen] = useState(false);
659
670
  const searchFn = definition.searchOptions;
660
671
  const hasSearchOptions = typeof searchFn === "function";
661
672
  const [resolved, setResolved] = useState(
@@ -709,11 +720,18 @@ function MultiSelectWidget({
709
720
  const removeOne = (v) => onChange(selected.filter((x) => x !== v));
710
721
  const labelOf = (v) => labelCache.current.get(v) ?? baseOpts.find((o) => o.value === v)?.label ?? String(v);
711
722
  return /* @__PURE__ */ jsxs("div", { className: "ev-mf-chip is-wrap", children: [
712
- /* @__PURE__ */ jsxs("span", { className: "ev-mf-chip-label", children: [
713
- definition.label,
714
- definition.mandatory && /* @__PURE__ */ jsx("span", { className: "ev-mf-chip-required", children: "*" }),
715
- ":"
716
- ] }),
723
+ /* @__PURE__ */ jsxs(
724
+ "span",
725
+ {
726
+ className: "ev-mf-chip-label is-clickable",
727
+ onClick: () => setOpen(true),
728
+ children: [
729
+ definition.label,
730
+ definition.mandatory && /* @__PURE__ */ jsx("span", { className: "ev-mf-chip-required", children: "*" }),
731
+ ":"
732
+ ]
733
+ }
734
+ ),
717
735
  selected.map((v) => /* @__PURE__ */ jsxs("span", { className: "ev-mf-chip-badge", children: [
718
736
  labelOf(v),
719
737
  /* @__PURE__ */ jsx(
@@ -726,7 +744,7 @@ function MultiSelectWidget({
726
744
  }
727
745
  )
728
746
  ] }, String(v))),
729
- /* @__PURE__ */ jsxs(Popover, { children: [
747
+ /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
730
748
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", className: "ev-mf-chip-caret", children: /* @__PURE__ */ jsx(ChevronDown, {}) }) }),
731
749
  /* @__PURE__ */ jsxs(PopoverContent, { className: "ev-mf-ms-popover", align: "start", children: [
732
750
  /* @__PURE__ */ jsx(
@@ -1585,33 +1603,143 @@ function buildChildQueryDirect(field, values) {
1585
1603
  return Object.keys(where).length > 0 ? { where } : {};
1586
1604
  }
1587
1605
  var join = (...parts) => parts.filter(Boolean).join(" ");
1588
- var EasyVisionCard = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card", className), ...props }));
1606
+ var EasyVisionCard = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card", className), ...props }));
1589
1607
  EasyVisionCard.displayName = "EasyVisionCard";
1590
- var EasyVisionCardHeader = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card-header", className), ...props }));
1608
+ var EasyVisionCardHeader = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card-header", className), ...props }));
1591
1609
  EasyVisionCardHeader.displayName = "EasyVisionCardHeader";
1592
- var EasyVisionCardTitle = React8.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h3", { ref, className: join("ev-card-title", className), ...props, children }));
1610
+ var EasyVisionCardTitle = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h3", { ref, className: join("ev-card-title", className), ...props, children }));
1593
1611
  EasyVisionCardTitle.displayName = "EasyVisionCardTitle";
1594
- var EasyVisionCardDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: join("ev-card-description", className), ...props }));
1612
+ var EasyVisionCardDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: join("ev-card-description", className), ...props }));
1595
1613
  EasyVisionCardDescription.displayName = "EasyVisionCardDescription";
1596
- var EasyVisionCardContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card-content", className), ...props }));
1614
+ var EasyVisionCardContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card-content", className), ...props }));
1597
1615
  EasyVisionCardContent.displayName = "EasyVisionCardContent";
1598
- var EasyVisionCardFooter = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card-footer", className), ...props }));
1616
+ var EasyVisionCardFooter = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: join("ev-card-footer", className), ...props }));
1599
1617
  EasyVisionCardFooter.displayName = "EasyVisionCardFooter";
1600
- var Table = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("table", { ref, className: cn("ev-table", className), ...props }));
1618
+ var join2 = (...parts) => parts.filter(Boolean).join(" ");
1619
+ function EasyVisionAccordionItem(_props) {
1620
+ return null;
1621
+ }
1622
+ EasyVisionAccordionItem.displayName = "EasyVisionAccordionItem";
1623
+ function normalizeFromChildren(children) {
1624
+ const out = [];
1625
+ React9.Children.forEach(children, (child) => {
1626
+ if (!React9.isValidElement(child)) return;
1627
+ if (child.type !== EasyVisionAccordionItem) return;
1628
+ const p = child.props;
1629
+ out.push({
1630
+ id: p.id,
1631
+ question: p.question,
1632
+ content: p.children,
1633
+ defaultOpen: p.defaultOpen,
1634
+ disabled: p.disabled,
1635
+ className: p.className
1636
+ });
1637
+ });
1638
+ return out;
1639
+ }
1640
+ function normalizeFromItems(items) {
1641
+ return items.map((it) => ({
1642
+ id: it.id,
1643
+ question: it.question,
1644
+ content: it.content,
1645
+ defaultOpen: it.defaultOpen,
1646
+ disabled: it.disabled
1647
+ }));
1648
+ }
1649
+ function AccordionRow({ item, open, onToggle }) {
1650
+ const panelId = `ev-accordion-panel-${item.id}`;
1651
+ const triggerId = `ev-accordion-trigger-${item.id}`;
1652
+ return /* @__PURE__ */ jsxs("div", { className: join2("ev-accordion-item", item.className), children: [
1653
+ /* @__PURE__ */ jsxs(
1654
+ "button",
1655
+ {
1656
+ type: "button",
1657
+ id: triggerId,
1658
+ className: join2("ev-accordion-trigger", open && "ev-accordion-trigger-open"),
1659
+ "aria-expanded": open,
1660
+ "aria-controls": panelId,
1661
+ disabled: item.disabled,
1662
+ onClick: () => onToggle(item.id),
1663
+ children: [
1664
+ /* @__PURE__ */ jsx("span", { className: "ev-accordion-question", children: item.question }),
1665
+ /* @__PURE__ */ jsx(ChevronDown, { className: "ev-accordion-icon", "aria-hidden": "true" })
1666
+ ]
1667
+ }
1668
+ ),
1669
+ open && /* @__PURE__ */ jsx(
1670
+ "div",
1671
+ {
1672
+ id: panelId,
1673
+ role: "region",
1674
+ "aria-labelledby": triggerId,
1675
+ className: "ev-accordion-panel",
1676
+ children: item.content
1677
+ }
1678
+ )
1679
+ ] });
1680
+ }
1681
+ function EasyVisionAccordion({
1682
+ items,
1683
+ children,
1684
+ mode = "single",
1685
+ openIds,
1686
+ defaultOpenIds,
1687
+ onOpenChange,
1688
+ className
1689
+ }) {
1690
+ const normalized = React9.useMemo(
1691
+ () => items ? normalizeFromItems(items) : normalizeFromChildren(children),
1692
+ [items, children]
1693
+ );
1694
+ const isControlled = openIds !== void 0;
1695
+ const [internalOpen, setInternalOpen] = React9.useState(() => {
1696
+ if (defaultOpenIds) return new Set(defaultOpenIds);
1697
+ return new Set(normalized.filter((it) => it.defaultOpen).map((it) => it.id));
1698
+ });
1699
+ const openSet = React9.useMemo(
1700
+ () => isControlled ? new Set(openIds) : internalOpen,
1701
+ [isControlled, openIds, internalOpen]
1702
+ );
1703
+ const handleToggle = React9.useCallback(
1704
+ (id) => {
1705
+ const next = new Set(openSet);
1706
+ if (next.has(id)) {
1707
+ next.delete(id);
1708
+ } else {
1709
+ if (mode === "single") next.clear();
1710
+ next.add(id);
1711
+ }
1712
+ if (!isControlled) setInternalOpen(next);
1713
+ onOpenChange?.(Array.from(next));
1714
+ },
1715
+ [openSet, mode, isControlled, onOpenChange]
1716
+ );
1717
+ return /* @__PURE__ */ jsx("div", { className: join2("ev-accordion", className), children: normalized.map((item) => /* @__PURE__ */ jsx(
1718
+ AccordionRow,
1719
+ {
1720
+ item,
1721
+ open: openSet.has(item.id),
1722
+ onToggle: handleToggle
1723
+ },
1724
+ item.id
1725
+ )) });
1726
+ }
1727
+ EasyVisionAccordion.displayName = "EasyVisionAccordion";
1728
+ var Table = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("table", { ref, className: cn("ev-table", className), ...props }));
1601
1729
  Table.displayName = "Table";
1602
- var TableHeader = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className, ...props }));
1730
+ var TableHeader = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className, ...props }));
1603
1731
  TableHeader.displayName = "TableHeader";
1604
- var TableBody = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className, ...props }));
1732
+ var TableBody = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className, ...props }));
1605
1733
  TableBody.displayName = "TableBody";
1606
- var TableFooter = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tfoot", { ref, className, ...props }));
1734
+ var TableFooter = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tfoot", { ref, className, ...props }));
1607
1735
  TableFooter.displayName = "TableFooter";
1608
- var TableRow = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", { ref, className, ...props }));
1736
+ var TableRow = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", { ref, className, ...props }));
1609
1737
  TableRow.displayName = "TableRow";
1610
- var TableHead = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("th", { ref, className, ...props }));
1738
+ var TableHead = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("th", { ref, className, ...props }));
1611
1739
  TableHead.displayName = "TableHead";
1612
- var TableCell = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("td", { ref, className, ...props }));
1740
+ var TableCell = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("td", { ref, className, ...props }));
1613
1741
  TableCell.displayName = "TableCell";
1614
- var TableCaption = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className, ...props }));
1742
+ var TableCaption = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className, ...props }));
1615
1743
  TableCaption.displayName = "TableCaption";
1616
1744
  var isNestedField = (field) => field.includes(".");
1617
1745
  var resolvePath = (obj, path) => path.split(".").reduce(
@@ -1741,7 +1869,7 @@ function useTableData({
1741
1869
  var DropdownMenu = DropdownMenuPrimitive.Root;
1742
1870
  var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
1743
1871
  var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
1744
- var DropdownMenuSubTrigger = React8.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1872
+ var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1745
1873
  DropdownMenuPrimitive.SubTrigger,
1746
1874
  {
1747
1875
  ref,
@@ -1758,7 +1886,7 @@ var DropdownMenuSubTrigger = React8.forwardRef(({ className, inset, children, ..
1758
1886
  }
1759
1887
  ));
1760
1888
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
1761
- var DropdownMenuSubContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1889
+ var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1762
1890
  DropdownMenuPrimitive.SubContent,
1763
1891
  {
1764
1892
  ref,
@@ -1767,7 +1895,7 @@ var DropdownMenuSubContent = React8.forwardRef(({ className, ...props }, ref) =>
1767
1895
  }
1768
1896
  ));
1769
1897
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
1770
- var DropdownMenuContent = React8.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1898
+ var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1771
1899
  DropdownMenuPrimitive.Content,
1772
1900
  {
1773
1901
  ref,
@@ -1777,7 +1905,7 @@ var DropdownMenuContent = React8.forwardRef(({ className, sideOffset = 4, ...pro
1777
1905
  }
1778
1906
  ) }));
1779
1907
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
1780
- var DropdownMenuItem = React8.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
1908
+ var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
1781
1909
  DropdownMenuPrimitive.Item,
1782
1910
  {
1783
1911
  ref,
@@ -1790,7 +1918,7 @@ var DropdownMenuItem = React8.forwardRef(({ className, inset, ...props }, ref) =
1790
1918
  }
1791
1919
  ));
1792
1920
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
1793
- var DropdownMenuCheckboxItem = React8.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
1921
+ var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
1794
1922
  DropdownMenuPrimitive.CheckboxItem,
1795
1923
  {
1796
1924
  ref,
@@ -1804,7 +1932,7 @@ var DropdownMenuCheckboxItem = React8.forwardRef(({ className, children, checked
1804
1932
  }
1805
1933
  ));
1806
1934
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
1807
- var DropdownMenuRadioItem = React8.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1935
+ var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1808
1936
  DropdownMenuPrimitive.RadioItem,
1809
1937
  {
1810
1938
  ref,
@@ -1817,7 +1945,7 @@ var DropdownMenuRadioItem = React8.forwardRef(({ className, children, ...props }
1817
1945
  }
1818
1946
  ));
1819
1947
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
1820
- var DropdownMenuLabel = React8.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
1948
+ var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
1821
1949
  DropdownMenuPrimitive.Label,
1822
1950
  {
1823
1951
  ref,
@@ -1830,7 +1958,7 @@ var DropdownMenuLabel = React8.forwardRef(({ className, inset, ...props }, ref)
1830
1958
  }
1831
1959
  ));
1832
1960
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
1833
- var DropdownMenuSeparator = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1961
+ var DropdownMenuSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1834
1962
  DropdownMenuPrimitive.Separator,
1835
1963
  {
1836
1964
  ref,
@@ -2844,6 +2972,6 @@ function EasyVisionTable(props) {
2844
2972
  }
2845
2973
  var defaultCell = (content, title) => /* @__PURE__ */ jsx("span", { className: "text-sm text-foreground", title, children: content });
2846
2974
 
2847
- export { EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, EasyVisionInput, EasyVisionMultifilter, EasyVisionSelector, EasyVisionTable, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
2975
+ export { EasyVisionAccordion, EasyVisionAccordionItem, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, EasyVisionInput, EasyVisionMultifilter, EasyVisionSelector, EasyVisionTable, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
2848
2976
  //# sourceMappingURL=index.js.map
2849
2977
  //# sourceMappingURL=index.js.map