@economic/taco 1.21.9 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/components/Select2/Select2.d.ts +1 -1
  2. package/dist/components/Select2/Select2.stories.d.ts +7 -1
  3. package/dist/components/Select2/components/Collection.d.ts +2 -1
  4. package/dist/components/Select2/components/Group.d.ts +9 -2
  5. package/dist/components/Select2/components/Option.d.ts +2 -0
  6. package/dist/components/Select2/hooks/useChildren.d.ts +4 -3
  7. package/dist/components/Table2/hooks/useColumnDefinitions.d.ts +2 -1
  8. package/dist/components/Table2/types.d.ts +2 -1
  9. package/dist/components/Table2/utilities/columns.d.ts +2 -2
  10. package/dist/esm/packages/taco/src/components/Select2/Select2.js +6 -6
  11. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Select2/components/Collection.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Select2/components/Group.js +10 -3
  14. package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +7 -2
  16. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
  18. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +29 -11
  20. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
  22. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Table2/Table2.js +2 -1
  24. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js +3 -3
  26. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +2 -2
  28. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +1 -0
  30. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Table2/types.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +11 -6
  33. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +1 -1
  34. package/dist/taco.cjs.development.js +72 -35
  35. package/dist/taco.cjs.development.js.map +1 -1
  36. package/dist/taco.cjs.production.min.js +1 -1
  37. package/dist/taco.cjs.production.min.js.map +1 -1
  38. package/package.json +2 -2
  39. package/types.json +42 -15
@@ -17,7 +17,7 @@ declare type Select2Texts = {
17
17
  };
18
18
  declare type Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {
19
19
  autoFocus?: boolean;
20
- children: React.ReactElement<Select2OptionProps>[];
20
+ children: Array<React.ReactElement<Select2OptionProps> | React.ReactElement<Select2GroupProps>>;
21
21
  defaultValue?: Select2Value;
22
22
  emptyValue?: Select2OptionValue;
23
23
  disabled?: boolean;
@@ -9,6 +9,7 @@ export declare const DefaultValue: () => JSX.Element;
9
9
  export declare const EmptyValue: () => JSX.Element;
10
10
  export declare const Multiple: () => JSX.Element;
11
11
  export declare const Icons: () => JSX.Element;
12
+ export declare const Descriptions: () => JSX.Element;
12
13
  export declare const IconsMultiple: {
13
14
  (): JSX.Element;
14
15
  storyName: string;
@@ -18,7 +19,12 @@ export declare const TagsMultiple: {
18
19
  (): JSX.Element;
19
20
  storyName: string;
20
21
  };
21
- export declare const NoSearch: () => JSX.Element;
22
+ export declare const Groups: () => JSX.Element;
23
+ export declare const GroupsMultiple: {
24
+ (): JSX.Element;
25
+ storyName: string;
26
+ };
27
+ export declare const WithoutSearch: () => JSX.Element;
22
28
  export declare const Create: () => JSX.Element;
23
29
  export declare const CreateTags: {
24
30
  (): JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
+ import { Select2GroupProps } from './Group';
2
3
  import { Select2OptionProps } from './Option';
3
4
  export declare type Select2CollectionProps = {
4
- children: React.ReactElement<Select2OptionProps>[];
5
+ children: Array<React.ReactElement<Select2OptionProps> | React.ReactElement<Select2GroupProps>>;
5
6
  };
6
7
  export declare const Collection: (props: Select2CollectionProps) => JSX.Element;
@@ -1,4 +1,11 @@
1
1
  import React from 'react';
2
2
  import * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';
3
- export declare type Select2GroupProps = ListboxPrimitive.Listbox2GroupProps;
4
- export declare const Group: React.ForwardRefExoticComponent<ListboxPrimitive.Listbox2GroupProps & React.RefAttributes<HTMLDivElement>>;
3
+ import { Select2OptionProps } from './Option';
4
+ export declare type Select2GroupProps = Omit<ListboxPrimitive.Listbox2GroupProps, 'children'> & {
5
+ children: React.ReactElement<Select2OptionProps>[];
6
+ heading?: string;
7
+ };
8
+ export declare const Group: React.ForwardRefExoticComponent<Pick<ListboxPrimitive.Listbox2GroupProps, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
9
+ children: React.ReactElement<Select2OptionProps>[];
10
+ heading?: string | undefined;
11
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -5,12 +5,14 @@ import * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';
5
5
  export declare type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children'> & {
6
6
  children: string;
7
7
  color?: Color;
8
+ description?: string;
8
9
  icon?: React.ReactElement<IconProps> | IconName;
9
10
  textValue?: string;
10
11
  };
11
12
  export declare const Option: React.ForwardRefExoticComponent<Pick<ListboxPrimitive.Listbox2OptionProps, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "value"> & {
12
13
  children: string;
13
14
  color?: "green" | "yellow" | "red" | "blue" | "purple" | "orange" | "brown" | "pink" | "grey" | undefined;
15
+ description?: string | undefined;
14
16
  icon?: React.ReactElement<IconProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | "account-preview" | "accounting-year-cancel" | "accounting-year" | "accounting" | "arrow-bottom" | "arrow-down" | "arrow-end" | "arrow-left" | "arrow-right" | "arrow-start" | "arrow-top" | "arrow-up" | "attach-auto" | "attach-cancel" | "attach" | "autotext-insert" | "autotext" | "basic-tabs" | "basic" | "bell-solid" | "book" | "booking" | "budget" | "calendar" | "cash-account" | "cash-reports" | "chat-solid" | "chat" | "chevron-down-double" | "chevron-down-solid" | "chevron-down" | "chevron-left-double" | "chevron-left-solid" | "chevron-left" | "chevron-right-double" | "chevron-right-solid" | "chevron-right" | "chevron-up-double" | "chevron-up-solid" | "chevron-up" | "circle-close" | "circle-minus" | "circle-plus" | "circle-tick" | "clamp-open" | "clamp" | "close" | "columns" | "connection-enable" | "connection-revoke" | "contacts" | "copy" | "courses" | "credit" | "delete-permanently" | "delete" | "density-comfortable" | "density-compact" | "density-normal" | "density-spacious" | "depecriate" | "developer" | "distribution-template" | "document-approve" | "document-create-entry" | "document-cut" | "document-error" | "document-isolate-page" | "document-merge" | "document-move" | "document-preview" | "document-received" | "document-rejected-request" | "document-split" | "document-time" | "document" | "download" | "drag" | "e-copedia" | "e-signature" | "edit" | "ellipsis-horizontal" | "ellipsis-vertical" | "entries-on-account" | "entries-open" | "entries-warning" | "entry-type-customer-invoice" | "entry-type-customer-payment" | "entry-type-journal-entry" | "entry-type-manual-customer-invoice" | "entry-type-supplier-invoice" | "entry-type-supplier-payment" | "envelope-approved" | "envelope" | "expand-view" | "expenses" | "export-to-excel" | "export-to-pdf" | "export" | "filter-solid" | "filter" | "graph-solid" | "hash" | "home" | "images" | "import" | "inbox-einvoicing" | "inbox-scanning" | "inbox-smart" | "inbox" | "info" | "inventory-matrix" | "inventory" | "journal-pro" | "layout-both" | "layout-first" | "layout-last" | "layout-none" | "layout" | "ledger-card-customer-reminder" | "ledger-card-manual-customer-invoice" | "ledger-card-obsolete-stock" | "ledger-card-opening-entry" | "ledger-card-reserved-entry" | "ledger-card-shrinkage-pilferage" | "ledger-card-stock-adjustment" | "ledger-card-transferred-opening-entry" | "ledger-card" | "lightbulb" | "line" | "list-bulleted" | "list-search" | "list" | "lock-open" | "log-out" | "log" | "market" | "match-amount" | "match-entries" | "menu" | "mileage" | "modal-resize" | "modal-shrink" | "more-solid" | "more" | "move" | "navigation-list" | "note-follow-up" | "note-read" | "note" | "numbers" | "partner-api" | "period" | "person-change" | "person-minus" | "person-plus" | "person-tick" | "play" | "plus-minus" | "print" | "process-payment" | "product-ledger-card" | "profile" | "project-cards" | "projects" | "quicklinks" | "rating-bankruptcy" | "rating-payment-problems" | "reconciled" | "refresh" | "report-solid" | "report" | "restore" | "rotate-left" | "rotate-right" | "sales" | "search-bold" | "search" | "secure-tick" | "secure" | "settings-solid" | "settings" | "shortcuts" | "show-all" | "show-less" | "show-more" | "show-template" | "sliders" | "smartpay" | "sort-by" | "star-solid" | "star" | "subscriptions" | "system-entries" | "tag" | "template-override" | "templates" | "thumb-both" | "thumb-down-solid" | "thumb-down" | "thumb-up-solid" | "thumb-up" | "tick-bold" | "tick" | "time" | "transfer-cancel" | "transfer-locked" | "transfer" | "undo" | "undock" | "unreconciled" | "warning" | "webshop" | "website" | "workflow" | "zoom" | undefined;
15
17
  textValue?: string | undefined;
16
18
  } & React.RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Select2OptionProps } from '../components/Option';
3
+ import { Select2GroupProps } from '../Select2';
3
4
  import { Select2OptionValue, Select2Value } from '../types';
4
5
  export declare type useChildrenArgs = {
5
- children: React.ReactElement<Select2OptionProps>[];
6
+ children: Array<React.ReactElement<Select2OptionProps> | React.ReactElement<Select2GroupProps>>;
6
7
  emptyValue?: Select2OptionValue;
7
8
  multiple?: boolean;
8
9
  open?: boolean;
@@ -10,8 +11,8 @@ export declare type useChildrenArgs = {
10
11
  value?: Select2Value;
11
12
  };
12
13
  export declare const useChildren: ({ children: initialChildren, emptyValue, multiple, open, setValue, value }: useChildrenArgs) => {
13
- allChildren: React.ReactElement<Select2OptionProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>[];
14
- filteredChildren: React.ReactElement<Select2OptionProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>[];
14
+ flattenedChildren: React.ReactElement<Select2OptionProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>[];
15
+ filteredChildren: (React.ReactElement<Select2OptionProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactElement<Select2GroupProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>)[];
15
16
  searchQuery: string;
16
17
  setSearchQuery: React.Dispatch<React.SetStateAction<string>>;
17
18
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ColumnSort, Row, RowData } from '@tanstack/react-table';
3
- import { CellAlignment, ColumnDataType, RowDragHandler, Table2ColumnControlRenderer, Table2ColumnFooterRenderer, Table2ColumnHeaderMenu, Table2ColumnProps, Table2RowActionProps } from '../types';
3
+ import { CellAlignment, ColumnDataType, RowDragHandler, RowExpansionRenderer, Table2ColumnControlRenderer, Table2ColumnFooterRenderer, Table2ColumnHeaderMenu, Table2ColumnProps, Table2RowActionProps } from '../types';
4
4
  declare module '@tanstack/table-core' {
5
5
  interface ColumnMeta<TData extends RowData, TValue> {
6
6
  align?: CellAlignment;
@@ -23,6 +23,7 @@ declare type useColumnDefinitionsOptions<TType> = {
23
23
  enableRowExpansion: boolean;
24
24
  enableRowSelection: boolean;
25
25
  enableMultipleRowSelection: boolean;
26
+ expandedRowRenderer?: RowExpansionRenderer<TType>;
26
27
  onRowDrag?: RowDragHandler<TType>;
27
28
  };
28
29
  export declare function useColumnDefinitions<TType = any>(children: React.ReactElement<Table2ColumnProps<TType>>[], options: useColumnDefinitionsOptions<TType>, tableRef: React.RefObject<HTMLDivElement>): {
@@ -99,6 +99,7 @@ export declare type Table2Settings = {
99
99
  export declare type RowClickHandler<TType = any> = (row: TType) => void;
100
100
  export declare type RowDragHandler<TType = any> = (rows: TType[], showPlaceholder: (string: any) => void, setDataTransfer: (data: string) => void) => void;
101
101
  export declare type RowSelectionHandler<TType = any> = (rows: TType[]) => void;
102
+ export declare type RowExpansionRenderer<TType = any> = (row: TType) => (() => JSX.Element) | null;
102
103
  export declare type SortHandler = OnChangeFn<SortingState>;
103
104
  export declare type SettingsHandler = OnChangeFn<Table2Settings>;
104
105
  export declare type SaveHandlerErrorResponse = Record<string, string | undefined | null> | null;
@@ -125,7 +126,7 @@ export declare type Table2Props<TType = any> = Omit<React.HTMLAttributes<HTMLDiv
125
126
  disableSearch?: boolean;
126
127
  disableSorting?: boolean;
127
128
  emptyState?: () => JSX.Element;
128
- expandedRowRenderer?: (row: TType) => JSX.Element;
129
+ expandedRowRenderer?: RowExpansionRenderer<TType>;
129
130
  length?: number;
130
131
  loadMore?: () => Promise<void>;
131
132
  manualColumnFiltering?: boolean;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DisplayColumnDef } from '@tanstack/react-table';
3
- import { RowDragHandler } from '../types';
3
+ import { RowDragHandler, RowExpansionRenderer } from '../types';
4
4
  import { LocalizationTexts } from '../../Provider/Localization';
5
5
  export declare const COLUMN_ID_FOR_DRAGGABLE = "__draggable";
6
6
  export declare const COLUMN_ID_FOR_SELECTION = "__select";
@@ -10,5 +10,5 @@ export declare const isInternalColumn: (id: string) => boolean;
10
10
  export declare const MIN_COLUMN_SIZE = 80;
11
11
  export declare function createRowDraggableColumn<TType = any>(onRowDrag: RowDragHandler<TType>, texts: LocalizationTexts): DisplayColumnDef<TType, any>;
12
12
  export declare function createRowSelectionColumn<TType = any>(enableMultipleRowSelection: boolean, lastSelectedRowIndex: React.MutableRefObject<number | undefined>, onRowDrag: RowDragHandler<TType> | undefined, tableRef: React.RefObject<HTMLDivElement>, texts: LocalizationTexts): DisplayColumnDef<TType, any>;
13
- export declare function createRowExpansionColumn<TType = any>(texts: LocalizationTexts): DisplayColumnDef<TType, any>;
13
+ export declare function createRowExpansionColumn<TType = any>(expandedRowRenderer: RowExpansionRenderer<TType>, texts: LocalizationTexts): DisplayColumnDef<TType, any>;
14
14
  export declare function createRowActionsColumn<TType = any>(rowActions: any, texts: LocalizationTexts): DisplayColumnDef<TType, any>;
@@ -65,7 +65,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
65
65
  const setValue = createListboxValueSetter(multiple, _setValue);
66
66
  const [validationError, setValidationError] = React__default.useState();
67
67
  const {
68
- allChildren,
68
+ flattenedChildren,
69
69
  filteredChildren,
70
70
  searchQuery,
71
71
  setSearchQuery
@@ -138,7 +138,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
138
138
  emptyValue: emptyValue,
139
139
  multiple: multiple || tags,
140
140
  name: name,
141
- options: allChildren.map(child => child.props.value),
141
+ options: flattenedChildren.map(child => child.props.value),
142
142
  parentRef: internalRef,
143
143
  setValue: setValue,
144
144
  value: value
@@ -150,7 +150,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
150
150
  onBlur: handleBlur,
151
151
  onKeyDown: handleKeyDown,
152
152
  ref: internalRef
153
- }), allChildren)), /*#__PURE__*/React__default.createElement(Portal, null, /*#__PURE__*/React__default.createElement(Content, {
153
+ }), flattenedChildren)), /*#__PURE__*/React__default.createElement(Portal, null, /*#__PURE__*/React__default.createElement(Content, {
154
154
  asChild: true,
155
155
  align: "start",
156
156
  onOpenAutoFocus: event => {
@@ -172,10 +172,10 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
172
172
  style: {
173
173
  minWidth: dimensions !== null && dimensions !== void 0 && dimensions.width ? `${dimensions.width}px` : undefined
174
174
  }
175
- }, !disableSearch && (allChildren.length > 0 || onCreate) ? /*#__PURE__*/React__default.createElement(Search, {
175
+ }, !disableSearch && (flattenedChildren.length > 0 || onCreate) ? /*#__PURE__*/React__default.createElement(Search, {
176
176
  placeholder: onCreate ? texts.select2.searchOrCreate : texts.select2.search,
177
177
  ref: searchRef
178
- }) : null, allChildren.length <= 0 ? /*#__PURE__*/React__default.createElement("div", {
178
+ }) : null, flattenedChildren.length <= 0 ? /*#__PURE__*/React__default.createElement("div", {
179
179
  className: "text-grey-700 -mt-0.5 flex h-8 items-center px-2",
180
180
  role: "presentation"
181
181
  }, "No results found...") : /*#__PURE__*/React__default.createElement(Root$1, {
@@ -190,7 +190,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
190
190
  value: value
191
191
  }, /*#__PURE__*/React__default.createElement(Collection, null, filteredChildren), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
192
192
  onCreate: onCreate,
193
- options: allChildren
193
+ options: flattenedChildren
194
194
  }) : null))))));
195
195
  });
196
196
  Select2.Option = Option;
@@ -1 +1 @@
1
- {"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport { Select2OptionValue, Select2Value } from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { useChildren } from './hooks/useChildren';\nimport { Color } from '../../utils/colors';\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\n//import { All } from './components/All';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n};\n\ntype Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n autoFocus?: boolean;\n children: React.ReactElement<Select2OptionProps>[];\n defaultValue?: Select2Value;\n emptyValue?: Select2OptionValue;\n disabled?: boolean;\n disableSearch?: boolean;\n highlighted?: boolean;\n invalid?: boolean;\n multiple?: boolean;\n name?: string;\n onChange?: (value: Select2Value) => void;\n onCreate?: (name: string, color: Color | undefined) => Promise<Select2OptionProps>;\n onDelete?: (value: Select2OptionValue) => Promise<void>;\n onEdit?: (value: Select2OptionValue, text: string, color: Color | undefined) => Promise<void>;\n readOnly?: boolean;\n required?: boolean;\n tags?: boolean;\n value?: Select2Value;\n};\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initialChildren,\n defaultValue: defaultProp,\n disabled = false,\n disableSearch = false,\n emptyValue = undefined,\n highlighted = false,\n invalid = false,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n readOnly = false,\n tabIndex = 0,\n tags = false,\n value: prop,\n ...otherProps\n } = props;\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n\n const { allChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n tags,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (event.key === 'ArrowDown') {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={allChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n ref={internalRef}>\n {allChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={event => {\n event.preventDefault();\n event.stopPropagation();\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={event => {\n event.preventDefault();\n event.stopPropagation();\n internalRef.current?.focus();\n }}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {!disableSearch && (allChildren.length > 0 || onCreate) ? (\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n />\n ) : null}\n {allChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {/*multiple && !searchQuery && Array.isArray(value) ? (\n <All\n children={allChildren}\n onToggle={_setValue}\n selected={value.length === allChildren.length}\n />\n ) : null*/}\n <Collection>{filteredChildren}</Collection>\n {onCreate ? <Create onCreate={onCreate} options={allChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initialChildren","defaultValue","defaultProp","disabled","disableSearch","emptyValue","undefined","highlighted","invalid","multiple","name","onChange","onCreate","onDelete","onEdit","readOnly","tabIndex","tags","value","prop","otherProps","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","open","setOpen","useState","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","allChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","key","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","closest","id","currentTarget","getAttribute","className","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","map","child","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","stopPropagation","focus","onCloseAutoFocus","sideOffset","style","minWidth","width","length","Search","placeholder","select2","searchOrCreate","search","role","customSelector","Collection","Create","Option","Group","Title","isFormControl","useIsFormControl","bubbleValue","Array","isArray","String","BubbleSelect","option","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MAgEMA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAkC,SAASF,OAAO,CAACG,KAAK,EAAEC,GAAG;EACzF,MAAM;IACFC,QAAQ,EAAEC,eAAe;IACzBC,YAAY,EAAEC,WAAW;IACzBC,QAAQ,GAAG,KAAK;IAChBC,aAAa,GAAG,KAAK;IACrBC,UAAU,GAAGC,SAAS;IACtBC,WAAW,GAAG,KAAK;IACnBC,OAAO,GAAG,KAAK;IACfC,QAAQ,GAAG,KAAK;IAChBC,IAAI;IACJC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,MAAM;IACNC,QAAQ,GAAG,KAAK;IAChBC,QAAQ,GAAG,CAAC;IACZC,IAAI,GAAG,KAAK;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M;QACHkF,WAAW,GAAGlF,KAAK,KAAK,IAAI,GAAG,EAAE,GAAGqF,MAAM,CAACrF,KAAK,CAAC;;;IAIzD,oBACIvB,6BAAC6G,YAAY;;MAAaxD,GAAG,EAAEuD,MAAM,CAACH,WAAW,CAAC;MAAE3F,QAAQ,EAAEA,QAAQ;MAAEC,IAAI,EAAEA,IAAI;MAAEQ,KAAK,EAAEkF;OACtF/F,UAAU,KAAKC,SAAS,gBAAGX;MAAQuB,KAAK,EAAEb;MAAc,GAAG,IAAI,EAC/DgE,OAAO,CAACC,GAAG,CAACmC,MAAM,iBACf9G;MAAQqD,GAAG,EAAEuD,MAAM,CAACE,MAAM,CAAC;MAAEvF,KAAK,EAAEqF,MAAM,CAACE,MAAM;MACpD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACD/G,OAAO,CAACgH,WAAW,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport { Select2OptionValue, Select2Value } from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { useChildren } from './hooks/useChildren';\nimport { Color } from '../../utils/colors';\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\n//import { All } from './components/All';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n};\n\ntype Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n autoFocus?: boolean;\n children: Array<React.ReactElement<Select2OptionProps> | React.ReactElement<Select2GroupProps>>;\n defaultValue?: Select2Value;\n emptyValue?: Select2OptionValue;\n disabled?: boolean;\n disableSearch?: boolean;\n highlighted?: boolean;\n invalid?: boolean;\n multiple?: boolean;\n name?: string;\n onChange?: (value: Select2Value) => void;\n onCreate?: (name: string, color: Color | undefined) => Promise<Select2OptionProps>;\n onDelete?: (value: Select2OptionValue) => Promise<void>;\n onEdit?: (value: Select2OptionValue, text: string, color: Color | undefined) => Promise<void>;\n readOnly?: boolean;\n required?: boolean;\n tags?: boolean;\n value?: Select2Value;\n};\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initialChildren,\n defaultValue: defaultProp,\n disabled = false,\n disableSearch = false,\n emptyValue = undefined,\n highlighted = false,\n invalid = false,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n readOnly = false,\n tabIndex = 0,\n tags = false,\n value: prop,\n ...otherProps\n } = props;\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n\n const { flattenedChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n tags,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (event.key === 'ArrowDown') {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={flattenedChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n ref={internalRef}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={event => {\n event.preventDefault();\n event.stopPropagation();\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={event => {\n event.preventDefault();\n event.stopPropagation();\n internalRef.current?.focus();\n }}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {!disableSearch && (flattenedChildren.length > 0 || onCreate) ? (\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n />\n ) : null}\n {flattenedChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {/*multiple && !searchQuery && Array.isArray(value) ? (\n <All\n children={flattenedChildren}\n onToggle={_setValue}\n selected={value.length === flattenedChildren.length}\n />\n ) : null*/}\n <Collection>{filteredChildren}</Collection>\n {onCreate ? <Create onCreate={onCreate} options={flattenedChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initialChildren","defaultValue","defaultProp","disabled","disableSearch","emptyValue","undefined","highlighted","invalid","multiple","name","onChange","onCreate","onDelete","onEdit","readOnly","tabIndex","tags","value","prop","otherProps","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","open","setOpen","useState","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","key","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","closest","id","currentTarget","getAttribute","className","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","map","child","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","stopPropagation","focus","onCloseAutoFocus","sideOffset","style","minWidth","width","length","Search","placeholder","select2","searchOrCreate","search","role","customSelector","Collection","Create","Option","Group","Title","isFormControl","useIsFormControl","bubbleValue","Array","isArray","String","BubbleSelect","option","displayName"],"m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AO;IAAEG,SAAS;IAAEtD,KAAK;IAAEiB;GAAU,GAAGtC,KAAK;EACjF,MAAMqG,aAAa,GAAGC,gBAAgB,CAAC3B,SAAS,EAAE,MAAMrC,QAAQ,CAAC1B,QAAQ,GAAG,EAAE,GAAGH,SAAS,CAAC,CAAC;EAE5F,IAAI8F,WAAW;EAEf,IAAIF,aAAa,EAAE;IACf,IAAIhF,KAAK,KAAKZ,SAAS,EAAE;MACrB,IAAIG,QAAQ,EAAE;QACV2F,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACpF,KAAK,CAAC,GAAGA,KAAK,CAACoD,GAAG,CAACiC,MAAM,CAAC,GAAG,CAACrF,KAAK,KAAK,IAAI,GAAG,EAAE,GAAGqF,MAAM,CAACrF,KAAK,CAAC,CAAC;OACjG,MAAM;QACHkF,WAAW,GAAGlF,KAAK,KAAK,IAAI,GAAG,EAAE,GAAGqF,MAAM,CAACrF,KAAK,CAAC;;;IAIzD,oBACIvB,6BAAC6G,YAAY;;MAAaxD,GAAG,EAAEuD,MAAM,CAACH,WAAW,CAAC;MAAE3F,QAAQ,EAAEA,QAAQ;MAAEC,IAAI,EAAEA,IAAI;MAAEQ,KAAK,EAAEkF;OACtF/F,UAAU,KAAKC,SAAS,gBAAGX;MAAQuB,KAAK,EAAEb;MAAc,GAAG,IAAI,EAC/DgE,OAAO,CAACC,GAAG,CAACmC,MAAM,iBACf9G;MAAQqD,GAAG,EAAEuD,MAAM,CAACE,MAAM,CAAC;MAAEvF,KAAK,EAAEqF,MAAM,CAACE,MAAM;MACpD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACD/G,OAAO,CAACgH,WAAW,GAAG,SAAS;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Collection.js","sources":["../../../../../../../../src/components/Select2/components/Collection.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { Select2OptionProps } from './Option';\n\nexport type Select2CollectionProps = {\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const Collection = (props: Select2CollectionProps) => {\n const { children } = props;\n\n return <ScrollArea className=\"flex max-h-[10.3rem] w-full flex-col gap-y-0.5 px-1.5\">{children}</ScrollArea>;\n};\n"],"names":["Collection","props","children","React","ScrollArea","className"],"mappings":";;;MAQaA,UAAU,GAAIC,KAA6B;EACpD,MAAM;IAAEC;GAAU,GAAGD,KAAK;EAE1B,oBAAOE,6BAACC,UAAU;IAACC,SAAS,EAAC;KAAyDH,QAAQ,CAAc;AAChH;;;;"}
1
+ {"version":3,"file":"Collection.js","sources":["../../../../../../../../src/components/Select2/components/Collection.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { Select2GroupProps } from './Group';\nimport { Select2OptionProps } from './Option';\n\nexport type Select2CollectionProps = {\n children: Array<React.ReactElement<Select2OptionProps> | React.ReactElement<Select2GroupProps>>;\n};\n\nexport const Collection = (props: Select2CollectionProps) => {\n const { children } = props;\n\n return <ScrollArea className=\"flex max-h-[10.3rem] w-full flex-col gap-y-0.5 px-1.5\">{children}</ScrollArea>;\n};\n"],"names":["Collection","props","children","React","ScrollArea","className"],"mappings":";;;MASaA,UAAU,GAAIC,KAA6B;EACpD,MAAM;IAAEC;GAAU,GAAGD,KAAK;EAE1B,oBAAOE,6BAACC,UAAU;IAACC,SAAS,EAAC;KAAyDH,QAAQ,CAAc;AAChH;;;;"}
@@ -3,15 +3,22 @@ import cn from 'classnames';
3
3
  import '../../../primitives/Listbox2/components/Root.js';
4
4
  import '../../../primitives/Listbox2/components/Option.js';
5
5
  import { Group as Group$1 } from '../../../primitives/Listbox2/components/Group.js';
6
- import '../../../primitives/Listbox2/components/Title.js';
6
+ import { Title } from '../../../primitives/Listbox2/components/Title.js';
7
7
  import { createCollectionClassName } from '../utilities.js';
8
8
 
9
9
  const Group = /*#__PURE__*/React__default.forwardRef(function Select2Group(props, ref) {
10
+ const {
11
+ children,
12
+ heading,
13
+ ...attributes
14
+ } = props;
10
15
  const className = cn(createCollectionClassName(), props.className);
11
- return /*#__PURE__*/React__default.createElement(Group$1, Object.assign({}, props, {
16
+ return /*#__PURE__*/React__default.createElement(Group$1, Object.assign({}, attributes, {
12
17
  className: className,
13
18
  ref: ref
14
- }));
19
+ }), /*#__PURE__*/React__default.createElement(Title, {
20
+ className: "sticky top-0 bg-white px-2 font-bold leading-8"
21
+ }, heading), children);
15
22
  });
16
23
 
17
24
  export { Group };
@@ -1 +1 @@
1
- {"version":3,"file":"Group.js","sources":["../../../../../../../../src/components/Select2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createCollectionClassName } from '../utilities';\n\nexport type Select2GroupProps = ListboxPrimitive.Listbox2GroupProps;\n\nexport const Group = React.forwardRef<HTMLDivElement, Select2GroupProps>(function Select2Group(props, ref) {\n const className = cn(createCollectionClassName(), props.className);\n return <ListboxPrimitive.Group {...props} className={className} ref={ref} />;\n});\n"],"names":["Group","React","forwardRef","Select2Group","props","ref","className","cn","createCollectionClassName","ListboxPrimitive"],"mappings":";;;;;;;;MAOaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAoC,SAASC,YAAY,CAACC,KAAK,EAAEC,GAAG;EACrG,MAAMC,SAAS,GAAGC,EAAE,CAACC,yBAAyB,EAAE,EAAEJ,KAAK,CAACE,SAAS,CAAC;EAClE,oBAAOL,6BAACQ,OAAsB,oBAAKL,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAChF,CAAC;;;;"}
1
+ {"version":3,"file":"Group.js","sources":["../../../../../../../../src/components/Select2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createCollectionClassName } from '../utilities';\nimport { Select2OptionProps } from './Option';\n\nexport type Select2GroupProps = Omit<ListboxPrimitive.Listbox2GroupProps, 'children'> & {\n children: React.ReactElement<Select2OptionProps>[];\n heading?: string;\n};\n\nexport const Group = React.forwardRef<HTMLDivElement, Select2GroupProps>(function Select2Group(props, ref) {\n const { children, heading, ...attributes } = props;\n const className = cn(createCollectionClassName(), props.className);\n\n return (\n <ListboxPrimitive.Group {...attributes} className={className} ref={ref}>\n <ListboxPrimitive.Title className=\"sticky top-0 bg-white px-2 font-bold leading-8\">{heading}</ListboxPrimitive.Title>\n {children}\n </ListboxPrimitive.Group>\n );\n});\n"],"names":["Group","React","forwardRef","Select2Group","props","ref","children","heading","attributes","className","cn","createCollectionClassName","ListboxPrimitive"],"mappings":";;;;;;;;MAWaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAoC,SAASC,YAAY,CAACC,KAAK,EAAEC,GAAG;EACrG,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAClD,MAAMK,SAAS,GAAGC,EAAE,CAACC,yBAAyB,EAAE,EAAEP,KAAK,CAACK,SAAS,CAAC;EAElE,oBACIR,6BAACW,OAAsB,oBAAKJ,UAAU;IAAEC,SAAS,EAAEA,SAAS;IAAEJ,GAAG,EAAEA;mBAC/DJ,6BAACW,KAAsB;IAACH,SAAS,EAAC;KAAkDF,OAAO,CAA0B,EACpHD,QAAQ,CACY;AAEjC,CAAC;;;;"}
@@ -18,6 +18,7 @@ const Option = /*#__PURE__*/React__default.forwardRef(function Select2Option(pro
18
18
  const {
19
19
  children,
20
20
  color,
21
+ description,
21
22
  icon,
22
23
  ...otherProps
23
24
  } = props;
@@ -65,14 +66,18 @@ const Option = /*#__PURE__*/React__default.forwardRef(function Select2Option(pro
65
66
  ref: ref
66
67
  }), hasValue ? /*#__PURE__*/React__default.createElement(Icon, {
67
68
  name: "tick",
68
- className: "group-aria-selected:visible pointer-events-none invisible -mx-1 !h-4 !w-4"
69
+ className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible"
69
70
  }) : null, isTag ? /*#__PURE__*/React__default.createElement(Tag, {
70
71
  className: "pointer-events-none",
71
72
  color: color,
72
73
  icon: icon
73
74
  }, children) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, icon ? typeof icon === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
74
75
  name: icon
75
- }) : icon : null, children), popover ? /*#__PURE__*/React__default.createElement(IconButton, {
76
+ }) : icon : null, /*#__PURE__*/React__default.createElement("span", {
77
+ className: "flex flex-col"
78
+ }, /*#__PURE__*/React__default.createElement("span", null, children), description ? /*#__PURE__*/React__default.createElement("span", {
79
+ className: "text-grey-700 -mt-1.5 mb-1.5 text-xs"
80
+ }, description) : null)), popover ? /*#__PURE__*/React__default.createElement(IconButton, {
76
81
  rounded: true,
77
82
  icon: "ellipsis-vertical",
78
83
  appearance: "discrete",
@@ -1 +1 @@
1
- {"version":3,"file":"Option.js","sources":["../../../../../../../../src/components/Select2/components/Option.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName, IconProps } from '../../Icon/Icon';\nimport { Tag } from '../../Tag/Tag';\nimport { isAriaSelectionKey } from '../../../utils/aria';\nimport { Color } from '../../../utils/colors';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createOptionClassName } from '../utilities';\nimport { useSelect2Context } from './Context';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { EditPopover } from './Edit';\nimport { isMobileDevice } from '../../../utils/device';\n\nexport type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children'> & {\n children: string;\n color?: Color;\n icon?: React.ReactElement<IconProps> | IconName;\n textValue?: string;\n};\n\nexport const Option = React.forwardRef<HTMLDivElement, Select2OptionProps>(function Select2Option(props, ref) {\n const { children, color, icon, ...otherProps } = props;\n const className = createOptionClassName();\n const { onDelete, onEdit, listboxRef, multiple, ref: selectRef, setOpen, tags, value } = useSelect2Context();\n\n const hasValue = Array.isArray(value) ? !!value.length : value !== undefined;\n const isTag = tags && !!color;\n\n const handleClick = () => {\n if (!multiple) {\n setOpen(false);\n } else {\n selectRef.current?.focus();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (isAriaSelectionKey(event)) {\n if (!multiple || event.key === 'Tab') {\n setOpen(false);\n }\n }\n };\n\n const popover =\n onEdit || onDelete\n ? popoverProps => (\n <EditPopover\n {...popoverProps}\n color={props.color}\n key={props.textValue ?? String(props.children)}\n text={props.textValue ?? String(props.children)}\n value={props.value}\n />\n )\n : undefined;\n\n return (\n <ListboxPrimitive.Option {...otherProps} className={className} onClick={handleClick} onKeyDown={handleKeyDown} ref={ref}>\n {hasValue ? (\n <Icon name=\"tick\" className=\"group-aria-selected:visible pointer-events-none invisible -mx-1 !h-4 !w-4\" />\n ) : null}\n {isTag ? (\n <Tag className=\"pointer-events-none\" color={color} icon={icon}>\n {children}\n </Tag>\n ) : (\n <>\n {icon ? typeof icon === 'string' ? <Icon name={icon} /> : icon : null}\n {children}\n </>\n )}\n {popover ? (\n <IconButton\n rounded\n icon=\"ellipsis-vertical\"\n appearance=\"discrete\"\n className={cn('group-aria-current:visible invisible ml-auto -mr-2 focus:!shadow-none group-hover:visible', {\n '!visible': isMobileDevice(window?.navigator),\n })}\n onClick={event => {\n event.stopPropagation();\n listboxRef?.current?.setActiveIndex(event.currentTarget.parentElement as HTMLDivElement);\n }}\n popover={popover}\n tabIndex={-1}\n />\n ) : null}\n </ListboxPrimitive.Option>\n );\n});\n"],"names":["Option","React","forwardRef","Select2Option","props","ref","children","color","icon","otherProps","className","createOptionClassName","onDelete","onEdit","listboxRef","multiple","selectRef","setOpen","tags","value","useSelect2Context","hasValue","Array","isArray","length","undefined","isTag","handleClick","current","focus","handleKeyDown","event","isAriaSelectionKey","key","popover","popoverProps","EditPopover","textValue","String","text","ListboxPrimitive","onClick","onKeyDown","Icon","name","Tag","IconButton","rounded","appearance","cn","isMobileDevice","window","navigator","stopPropagation","setActiveIndex","currentTarget","parentElement","tabIndex"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iEAAIC,MAAM,CAAClC,KAAK,CAACE,QAAQ,CAAC;MAC/Ca,KAAK,EAAEf,KAAK,CAACe;OACf;GACL,GACDM,SAAS;EAEnB,oBACIxB,6BAACuC,QAAuB,oBAAK/B,UAAU;IAAEC,SAAS,EAAEA,SAAS;IAAE+B,OAAO,EAAEd,WAAW;IAAEe,SAAS,EAAEZ,aAAa;IAAEzB,GAAG,EAAEA;MAC/GgB,QAAQ,gBACLpB,6BAAC0C,IAAI;IAACC,IAAI,EAAC,MAAM;IAAClC,SAAS,EAAC;IAA8E,GAC1G,IAAI,EACPgB,KAAK,gBACFzB,6BAAC4C,GAAG;IAACnC,SAAS,EAAC,qBAAqB;IAACH,KAAK,EAAEA,KAAK;IAAEC,IAAI,EAAEA;KACpDF,QAAQ,CACP,gBAENL,4DACKO,IAAI,GAAG,OAAOA,IAAI,KAAK,QAAQ,gBAAGP,6BAAC0C,IAAI;IAACC,IAAI,EAAEpC;IAAQ,GAAGA,IAAI,GAAG,IAAI,EACpEF,QAAQ,CAEhB,EACA4B,OAAO,gBACJjC,6BAAC6C,UAAU;IACPC,OAAO;IACPvC,IAAI,EAAC,mBAAmB;IACxBwC,UAAU,EAAC,UAAU;IACrBtC,SAAS,EAAEuC,EAAE,CAAC,2FAA2F,EAAE;MACvG,UAAU,EAAEC,cAAc,YAACC,MAAM,4CAAN,QAAQC,SAAS;KAC/C,CAAC;IACFX,OAAO,EAAEV,KAAK;;MACVA,KAAK,CAACsB,eAAe,EAAE;MACvBvC,UAAU,aAAVA,UAAU,8CAAVA,UAAU,CAAEc,OAAO,wDAAnB,oBAAqB0B,cAAc,CAACvB,KAAK,CAACwB,aAAa,CAACC,aAA+B,CAAC;KAC3F;IACDtB,OAAO,EAAEA,OAAO;IAChBuB,QAAQ,EAAE,CAAC;IACb,GACF,IAAI,CACc;AAElC,CAAC;;;;"}
1
+ {"version":3,"file":"Option.js","sources":["../../../../../../../../src/components/Select2/components/Option.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName, IconProps } from '../../Icon/Icon';\nimport { Tag } from '../../Tag/Tag';\nimport { isAriaSelectionKey } from '../../../utils/aria';\nimport { Color } from '../../../utils/colors';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createOptionClassName } from '../utilities';\nimport { useSelect2Context } from './Context';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { EditPopover } from './Edit';\nimport { isMobileDevice } from '../../../utils/device';\n\nexport type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children'> & {\n children: string;\n color?: Color;\n description?: string;\n icon?: React.ReactElement<IconProps> | IconName;\n textValue?: string;\n};\n\nexport const Option = React.forwardRef<HTMLDivElement, Select2OptionProps>(function Select2Option(props, ref) {\n const { children, color, description, icon, ...otherProps } = props;\n const className = createOptionClassName();\n const { onDelete, onEdit, listboxRef, multiple, ref: selectRef, setOpen, tags, value } = useSelect2Context();\n\n const hasValue = Array.isArray(value) ? !!value.length : value !== undefined;\n const isTag = tags && !!color;\n\n const handleClick = () => {\n if (!multiple) {\n setOpen(false);\n } else {\n selectRef.current?.focus();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (isAriaSelectionKey(event)) {\n if (!multiple || event.key === 'Tab') {\n setOpen(false);\n }\n }\n };\n\n const popover =\n onEdit || onDelete\n ? popoverProps => (\n <EditPopover\n {...popoverProps}\n color={props.color}\n key={props.textValue ?? String(props.children)}\n text={props.textValue ?? String(props.children)}\n value={props.value}\n />\n )\n : undefined;\n\n return (\n <ListboxPrimitive.Option {...otherProps} className={className} onClick={handleClick} onKeyDown={handleKeyDown} ref={ref}>\n {hasValue ? (\n <Icon name=\"tick\" className=\"pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible\" />\n ) : null}\n\n {isTag ? (\n <Tag className=\"pointer-events-none\" color={color} icon={icon}>\n {children}\n </Tag>\n ) : (\n <>\n {icon ? typeof icon === 'string' ? <Icon name={icon} /> : icon : null}\n <span className=\"flex flex-col\">\n <span>{children}</span>\n {description ? <span className=\"text-grey-700 -mt-1.5 mb-1.5 text-xs\">{description}</span> : null}\n </span>\n </>\n )}\n {popover ? (\n <IconButton\n rounded\n icon=\"ellipsis-vertical\"\n appearance=\"discrete\"\n className={cn('group-aria-current:visible invisible ml-auto -mr-2 focus:!shadow-none group-hover:visible', {\n '!visible': isMobileDevice(window?.navigator),\n })}\n onClick={event => {\n event.stopPropagation();\n listboxRef?.current?.setActiveIndex(event.currentTarget.parentElement as HTMLDivElement);\n }}\n popover={popover}\n tabIndex={-1}\n />\n ) : null}\n </ListboxPrimitive.Option>\n );\n});\n"],"names":["Option","React","forwardRef","Select2Option","props","ref","children","color","description","icon","otherProps","className","createOptionClassName","onDelete","onEdit","listboxRef","multiple","selectRef","setOpen","tags","value","useSelect2Context","hasValue","Array","isArray","length","undefined","isTag","handleClick","current","focus","handleKeyDown","event","isAriaSelectionKey","key","popover","popoverProps","EditPopover","textValue","String","text","ListboxPrimitive","onClick","onKeyDown","Icon","name","Tag","IconButton","rounded","appearance","cn","isMobileDevice","window","navigator","stopPropagation","setActiveIndex","currentTarget","parentElement","tabIndex"],"mappings":";;;;;;;;;;;;;;;MAqBaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAqC,SAASC,aAAa,CAACC,KAAK,EAAEC,GAAG;;EACxG,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,WAAW;IAAEC,IAAI;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACnE,MAAMO,SAAS,GAAGC,qBAAqB,EAAE;EACzC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,UAAU;IAAEC,QAAQ;IAAEX,GAAG,EAAEY,SAAS;IAAEC,OAAO;IAAEC,IAAI;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE5G,MAAMC,QAAQ,GAAGC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,GAAG,CAAC,CAACA,KAAK,CAACK,MA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P,gBAENL,4DACKQ,IAAI,GAAG,OAAOA,IAAI,KAAK,QAAQ,gBAAGR,6BAAC2C,IAAI;IAACC,IAAI,EAAEpC;IAAQ,GAAGA,IAAI,GAAG,IAAI,eACrER;IAAMU,SAAS,EAAC;kBACZV,2CAAOK,QAAQ,CAAQ,EACtBE,WAAW,gBAAGP;IAAMU,SAAS,EAAC;KAAwCH,WAAW,CAAQ,GAAG,IAAI,CAC9F,CAEd,EACA2B,OAAO,gBACJlC,6BAAC8C,UAAU;IACPC,OAAO;IACPvC,IAAI,EAAC,mBAAmB;IACxBwC,UAAU,EAAC,UAAU;IACrBtC,SAAS,EAAEuC,EAAE,CAAC,2FAA2F,EAAE;MACvG,UAAU,EAAEC,cAAc,YAACC,MAAM,4CAAN,QAAQC,SAAS;KAC/C,CAAC;IACFX,OAAO,EAAEV,KAAK;;MACVA,KAAK,CAACsB,eAAe,EAAE;MACvBvC,UAAU,aAAVA,UAAU,8CAAVA,UAAU,CAAEc,OAAO,wDAAnB,oBAAqB0B,cAAc,CAACvB,KAAK,CAACwB,aAAa,CAACC,aAA+B,CAAC;KAC3F;IACDtB,OAAO,EAAEA,OAAO;IAChBuB,QAAQ,EAAE,CAAC;IACb,GACF,IAAI,CACc;AAElC,CAAC;;;;"}
@@ -125,7 +125,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
125
125
  tags
126
126
  } = useSelect2Context();
127
127
  const buttonRef = useMergedRef(ref);
128
- const valuesAsChildren = values.map(value => children.find(c => c.props.value === value));
128
+ const valuesAsChildren = values.map(value => children.find(c => c.props.value === value)).filter(c => !!c);
129
129
  let content;
130
130
  let {
131
131
  className
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onClick, tabIndex = 0, ...otherProps } = props;\n const { disabled, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'cursor-pointer !px-1.5',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly }).replace('w-full', ''),\n { 'w-full': !props.className?.includes('w-') },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled || readOnly ? -1 : tabIndex}\n type=\"button\">\n {children}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, value, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (currentValue) {\n if (tags) {\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.icon}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n } else {\n output = (\n <>\n {currentValue.props.icon ? (\n typeof currentValue.props.icon === 'string' ? (\n <Icon name={currentValue.props.icon} />\n ) : (\n currentValue.props.icon\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <div className={contentClassName}>{output}</div>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, values = [], ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values.map(value =>\n children.find(c => c.props.value === value)\n ) as React.ReactElement<Select2OptionProps>[];\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('!absolute z-20', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\">\n <div className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.map(child => (\n <Tag\n key={child.props.value}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ))}\n </div>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue key={String(open)} valuesAsChildren={valuesAsChildren} />;\n }\n\n return (\n <div\n className={cn('relative inline-flex flex-grow', { 'h-8': open })}\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </div>\n );\n});\n\nconst MultipleValue = ({ valuesAsChildren }) => {\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n const createClickHandler = tagValue => event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(tagValue);\n }\n };\n\n return (\n <div className=\"relative flex items-center gap-1 overflow-hidden\">\n <div className=\"flex gap-1 truncate\" ref={el => setContentRef(el)}>\n {valuesAsChildren.map((child, index) => {\n const tag = (\n <Tag\n key={child.props.value}\n className={cn('cursor-pointer', {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n })}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={open ? createClickHandler(child.props.value) : undefined}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={child.props.value} title={String(child.props.children)}>\n {tag}\n </Tooltip>\n );\n }\n\n return tag;\n })}\n </div>\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(child.props.children) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </div>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Trigger","React","forwardRef","Select2Trigger","props","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onClick","tabIndex","otherProps","disabled","highlighted","invalid","open","readOnly","className","cn","getInputClasses","replace","includes","handleClick","event","preventDefault","role","type","Icon","name","Select2TriggerSingle","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","Select2TriggerMultiple","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","content","ScrollArea","child","key","onDelete","stopPropagation","MultipleValue","String","style","width","current","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","createClickHandler","tagValue","el","index","tag","truncate","hidden","Tooltip","title","length","slice","join","Badge"],"mappings":";;;;;;;;;;;;MAkBaA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAyC,SAASC,cAAc,CAACC,KAAK,EAAEC,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,KAAKK,SAAS,GAAG,CAACL,KAAK,CAAC,GAAGK,SAAS;IACvF,oBAAOX,6BAACY,QAAQ,oBAAKT,KAAK;MAAEC,GAAG,EAAEA,GAAG;MAAEM,MAAM,EAAEA;OAAU;;EAG5D,oBAAOV,6BAACa,MAAM,oBAAKV,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,KAAK,EAAEA;KAAS;AACxD,CAAC;AAKD,MAAMQ,MAAM,gBAAGd,cAAK,CAACC,UAAU,CAAi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,gBAAgB,CAClB8B,KAAK,CAACZ,aAAa,GAAG,CAAC,CAAC,CACxBjB,GAAG,CAACI,KAAK,IAAKA,KAAK,GAAGK,MAAM,CAACL,KAAK,CAACtD,KAAK,CAACa,QAAQ,CAAC,GAAG,EAAG,CAAC,CACzDmE,IAAI,CAAC,IAAI;kBACdnF,6BAACoF,KAAK;IAAC3D,SAAS,EAAC;UAAkB2B,gBAAgB,CAAC6B,MAAM,IAAIX,aAAa,GAAG,CAAC,CAAC,CAAS,CACnF,GACV,IAAI,CACN;AAEd,CAAC;AAED,MAAM3B,YAAY,GAAIrC,KAA8B,IAAMmD,KAA8B;EACpF,IAAIjD,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACuB,QAAQ,CAAC4B,KAAK,CAACtD,KAAK,CAACG,KAAK,CAAC;;EAG5C,OAAOmD,KAAK,CAACtD,KAAK,CAACG,KAAK,KAAKA,KAAK;AACtC,CAAC;;;;"}
1
+ {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onClick, tabIndex = 0, ...otherProps } = props;\n const { disabled, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'cursor-pointer !px-1.5',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly }).replace('w-full', ''),\n { 'w-full': !props.className?.includes('w-') },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled || readOnly ? -1 : tabIndex}\n type=\"button\">\n {children}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, value, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (currentValue) {\n if (tags) {\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.icon}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n } else {\n output = (\n <>\n {currentValue.props.icon ? (\n typeof currentValue.props.icon === 'string' ? (\n <Icon name={currentValue.props.icon} />\n ) : (\n currentValue.props.icon\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <div className={contentClassName}>{output}</div>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, values = [], ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values\n .map(value => children.find(c => c.props.value === value))\n .filter(c => !!c) as React.ReactElement<Select2OptionProps>[];\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('!absolute z-20', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\">\n <div className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.map(child => (\n <Tag\n key={child.props.value}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ))}\n </div>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue key={String(open)} valuesAsChildren={valuesAsChildren} />;\n }\n\n return (\n <div\n className={cn('relative inline-flex flex-grow', { 'h-8': open })}\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </div>\n );\n});\n\nconst MultipleValue = ({ valuesAsChildren }) => {\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n const createClickHandler = tagValue => event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(tagValue);\n }\n };\n\n return (\n <div className=\"relative flex items-center gap-1 overflow-hidden\">\n <div className=\"flex gap-1 truncate\" ref={el => setContentRef(el)}>\n {valuesAsChildren.map((child, index) => {\n const tag = (\n <Tag\n key={child.props.value}\n className={cn('cursor-pointer', {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n })}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={open ? createClickHandler(child.props.value) : undefined}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={child.props.value} title={String(child.props.children)}>\n {tag}\n </Tooltip>\n );\n }\n\n return tag;\n })}\n </div>\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(child.props.children) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </div>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Trigger","React","forwardRef","Select2Trigger","props","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onClick","tabIndex","otherProps","disabled","highlighted","invalid","open","readOnly","className","cn","getInputClasses","replace","includes","handleClick","event","preventDefault","role","type","Icon","name","Select2TriggerSingle","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","Select2TriggerMultiple","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","filter","content","ScrollArea","child","key","onDelete","stopPropagation","MultipleValue","String","style","width","current","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","createClickHandler","tagValue","el","index","tag","truncate","hidden","Tooltip","title","length","slice","join","Badge"],"mappings":";;;;;;;;;;;;MAkBaA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAyC,SAASC,cAAc,CAACC,KAAK,EAAEC,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,KAAKK,SAAS,GAAG,CAACL,KAAK,CAAC,GAAGK,SAAS;IACvF,oBAAOX,6BAACY,QAAQ,oBAAKT,KAAK;MAAEC,GAAG,EAAEA,GAAG;MAAEM,MAAM,EAAEA;OAAU;;EAG5D,oBAAOV,6BAACa,MAAM,oBAAKV,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,KAAK,EAAEA;KAAS;AACxD,CAAC;AAKD,MAAMQ,MAAM,gBAAGd,cAAK,CAACC,UAAU,CAAiC,SAASc,oBAAoB,CAACZ,KAAK,EAAEC,GAAG;;EACpG,MAAM;IAAEY,QAAQ;IAAEC,OAAO;IAAEC,QAAQ,GAAG,CAAC;IAAE,GAAGC;GAAY,GAAGhB,KAAK;EAChE,MAAM;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEC,IAAI;IAAEC;GAAU,GAAGjB,iBAAiB,EAAE;EAE9E,MAAMkB,SAAS,GAAGC,EAAE,CAChB,wBAAwB,EACxBC,eAAe,CAAC;IAAE,GAAGxB,KAAK;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEE;GAAU,CAAC,CAACI,OAAO,CAAC,QA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