@economic/taco 2.18.0 → 2.19.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Select2/Select2.d.ts +2 -0
- package/dist/components/Select2/components/Context.d.ts +2 -0
- package/dist/components/Select2/components/Group.d.ts +2 -0
- package/dist/components/Select2/components/Option.d.ts +3 -0
- package/dist/components/Table3/Table3.d.ts +1 -1
- package/dist/components/Table3/components/toolbar/FontSize.d.ts +0 -4
- package/dist/components/Table3/hooks/useCssGrid.d.ts +2 -2
- package/dist/components/Table3/hooks/useCssVars.d.ts +3 -2
- package/dist/components/Table3/types.d.ts +4 -4
- package/dist/esm/index.css +12 -12
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -0
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Group.js +4 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +8 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -5
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js +5 -9
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +10 -10
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js +7 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +4 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/types.js +7 -1
- package/dist/esm/packages/taco/src/types.js.map +1 -1
- package/dist/index.css +12 -12
- package/dist/primitives/Table/types.d.ts +0 -6
- package/dist/primitives/Table/useTable/features/useTableFontSize.d.ts +2 -2
- package/dist/primitives/Table/useTable/util/columns.d.ts +2 -2
- package/dist/taco.cjs.development.js +67 -64
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/package.json +2 -2
- package/types.json +10671 -10529
- package/dist/esm/packages/taco/src/primitives/Table/types.js +0 -10
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +0 -1
@@ -3,6 +3,7 @@ import { Select2Children, Select2CreateHandler, Select2DeleteHandler, Select2Edi
|
|
3
3
|
import { Select2OptionProps } from './components/Option';
|
4
4
|
import { Select2GroupProps } from './components/Group';
|
5
5
|
import { Select2TitleProps } from './components/Title';
|
6
|
+
import { FontSize } from '../../types';
|
6
7
|
declare type Select2Texts = {
|
7
8
|
allSelect: string;
|
8
9
|
allDeselect: string;
|
@@ -32,6 +33,7 @@ declare type Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'child
|
|
32
33
|
required?: boolean;
|
33
34
|
tags?: boolean;
|
34
35
|
value?: Select2Value;
|
36
|
+
fontSize?: FontSize;
|
35
37
|
placeholder?: string;
|
36
38
|
};
|
37
39
|
declare type Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { CollectionRef } from '../../../primitives/Collection/Collection';
|
3
3
|
import { Select2CreateHandler, Select2DeleteHandler, Select2EditHandler, Select2OptionValue, Select2Value } from '../types';
|
4
|
+
import { FontSize } from '../../../types';
|
4
5
|
export declare type Select2ContextProps = {
|
5
6
|
disabled: boolean;
|
6
7
|
highlighted: boolean;
|
@@ -24,6 +25,7 @@ export declare type Select2ContextProps = {
|
|
24
25
|
tags?: boolean;
|
25
26
|
validationError?: Error;
|
26
27
|
value?: Select2Value;
|
28
|
+
fontSize?: FontSize;
|
27
29
|
};
|
28
30
|
export declare const Select2Context: React.Context<Select2ContextProps>;
|
29
31
|
export declare const useSelect2Context: () => Select2ContextProps;
|
@@ -3,9 +3,11 @@ import * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';
|
|
3
3
|
import { Select2OptionProps } from './Option';
|
4
4
|
export declare type Select2GroupProps = Omit<ListboxPrimitive.Listbox2GroupProps, 'children'> & {
|
5
5
|
children: React.ReactElement<Select2OptionProps>[];
|
6
|
+
hasSeparator?: boolean;
|
6
7
|
heading?: string;
|
7
8
|
};
|
8
9
|
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
10
|
children: React.ReactElement<Select2OptionProps>[];
|
11
|
+
hasSeparator?: boolean | undefined;
|
10
12
|
heading?: string | undefined;
|
11
13
|
} & React.RefAttributes<HTMLDivElement>>;
|
@@ -2,10 +2,12 @@ import React from 'react';
|
|
2
2
|
import { IconName } from '../../Icon/Icon';
|
3
3
|
import * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';
|
4
4
|
import { Color } from '../../../types';
|
5
|
+
import { FontSize } from '../../../types';
|
5
6
|
export declare type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children' | 'prefix'> & {
|
6
7
|
children: string;
|
7
8
|
color?: Color;
|
8
9
|
description?: string;
|
10
|
+
fontSize?: FontSize;
|
9
11
|
prefix?: IconName | JSX.Element;
|
10
12
|
postfix?: IconName | JSX.Element;
|
11
13
|
textValue?: string;
|
@@ -14,6 +16,7 @@ export declare const Option: React.ForwardRefExoticComponent<Pick<ListboxPrimiti
|
|
14
16
|
children: string;
|
15
17
|
color?: "green" | "yellow" | "red" | "blue" | "purple" | "brown" | "pink" | "orange" | "grey" | "transparent" | undefined;
|
16
18
|
description?: string | undefined;
|
19
|
+
fontSize?: "small" | "medium" | "large" | undefined;
|
17
20
|
prefix?: "account-preview" | "accounting-year-cancel" | "accounting-year" | "accounting" | "ai-chat-solid" | "ai-stars" | "arrow-bottom" | "arrow-down" | "arrow-end" | "arrow-left" | "arrow-right" | "arrow-start" | "arrow-top" | "arrow-up" | "attach-auto" | "attach-cancel" | "attach-warning" | "attach" | "autotext-insert" | "autotext" | "basic-tabs" | "basic" | "bell-solid" | "book" | "booking" | "budget" | "calendar" | "cash-account" | "cash-reports" | "chart-area" | "chart-bar" | "chart-line" | "chart-pie" | "chart-table" | "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-information" | "circle-minus" | "circle-plus" | "circle-questionmark" | "circle-tick" | "circle-warning" | "clamp-open" | "clamp" | "close" | "column-freeze" | "column-unfreeze" | "columns" | "connection-enable" | "connection-revoke" | "contacts" | "copy" | "courses" | "credit" | "delete-permanently" | "delete" | "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-simple" | "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-solid" | "envelope" | "expand-view" | "expenses" | "export-to-excel" | "export-to-pdf" | "export" | "eye-off" | "eye-on" | "filter-solid" | "filter" | "font-size" | "graph-solid" | "hash" | "height-extra-tall" | "height-medium" | "height-short" | "height-tall" | "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" | "location" | "lock-open" | "lock" | "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" | "payment-paid" | "payment-unpaid" | "period" | "person-change" | "person-minus" | "person-plus" | "person-tick" | "phone-solid" | "play" | "plus-minus" | "print" | "process-payment" | "product-ledger-card" | "profile" | "project-cards" | "projects" | "question-mark-bold" | "question-mark" | "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-template-basic" | "workflow" | "zoom" | JSX.Element | undefined;
|
18
21
|
postfix?: "account-preview" | "accounting-year-cancel" | "accounting-year" | "accounting" | "ai-chat-solid" | "ai-stars" | "arrow-bottom" | "arrow-down" | "arrow-end" | "arrow-left" | "arrow-right" | "arrow-start" | "arrow-top" | "arrow-up" | "attach-auto" | "attach-cancel" | "attach-warning" | "attach" | "autotext-insert" | "autotext" | "basic-tabs" | "basic" | "bell-solid" | "book" | "booking" | "budget" | "calendar" | "cash-account" | "cash-reports" | "chart-area" | "chart-bar" | "chart-line" | "chart-pie" | "chart-table" | "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-information" | "circle-minus" | "circle-plus" | "circle-questionmark" | "circle-tick" | "circle-warning" | "clamp-open" | "clamp" | "close" | "column-freeze" | "column-unfreeze" | "columns" | "connection-enable" | "connection-revoke" | "contacts" | "copy" | "courses" | "credit" | "delete-permanently" | "delete" | "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-simple" | "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-solid" | "envelope" | "expand-view" | "expenses" | "export-to-excel" | "export-to-pdf" | "export" | "eye-off" | "eye-on" | "filter-solid" | "filter" | "font-size" | "graph-solid" | "hash" | "height-extra-tall" | "height-medium" | "height-short" | "height-tall" | "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" | "location" | "lock-open" | "lock" | "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" | "payment-paid" | "payment-unpaid" | "period" | "person-change" | "person-minus" | "person-plus" | "person-tick" | "phone-solid" | "play" | "plus-minus" | "print" | "process-payment" | "product-ledger-card" | "profile" | "project-cards" | "projects" | "question-mark-bold" | "question-mark" | "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-template-basic" | "workflow" | "zoom" | JSX.Element | undefined;
|
19
22
|
textValue?: string | undefined;
|
@@ -16,4 +16,4 @@ declare type Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> &
|
|
16
16
|
export declare const Table3: Table3WithStatics;
|
17
17
|
export { useTable3DataLoader } from './hooks/useTableDataLoader';
|
18
18
|
export type { useTable3DataFetcher, useTable3DataOptions, useTable3DataFetcherValues as useTableDataValues, } from './hooks/useTableDataLoader';
|
19
|
-
export type { Table3Ref, Table3Props, Table3Preset, Table3Settings, Table3SettingsHandler, Table3RowHeight, Table3FilterComparator, Table3FilterHandler, Table3LoadPageHandler, Table3LoadAllHandler, Table3RowGotoHandler, Table3SortHandler, Table3Shortcuts, Table3ShortcutHandlerFn, Table3ShortcutHandlerObject,
|
19
|
+
export type { Table3Ref, Table3Props, Table3Preset, Table3Settings, Table3SettingsHandler, Table3RowHeight, Table3FilterComparator, Table3FilterHandler, Table3LoadPageHandler, Table3LoadAllHandler, Table3RowGotoHandler, Table3SortHandler, Table3Shortcuts, Table3ShortcutHandlerFn, Table3ShortcutHandlerObject, Table3SortDirection, Table3SortFn, Table3RowActionRenderer, Table3RowSelectionHandler, Table3RowExpansionRenderer, Table3RowDropHandler, Table3RowDragHandler, Table3RowClickHandler, Table3ColumnProps, Table3ColumnAlignment, Table3ColumnDataType, Table3ColumnHeaderMenu, Table3ColumnClassNameHandler, Table3ColumnFooterRenderer, Table3ColumnRenderer, Table3ColumnControlRenderer, Table3ColumnControlProps, } from './types';
|
@@ -1,11 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { Table as RTable } from '@tanstack/react-table';
|
3
|
-
import { Table3FontSize } from '../../types';
|
4
3
|
declare type FontSizeButtonProps<TType = unknown> = {
|
5
4
|
table: RTable<TType>;
|
6
5
|
};
|
7
|
-
export declare const FONT_SIZE: {
|
8
|
-
[FontSize in Table3FontSize]: FontSize;
|
9
|
-
};
|
10
6
|
export declare function FontSize<TType = unknown>(props: FontSizeButtonProps<TType>): JSX.Element;
|
11
7
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Table as RTable } from '@tanstack/react-table';
|
3
|
-
import {
|
4
|
-
export declare const useCssGrid: <TType = unknown>(table: RTable<TType>, isPrintTable: boolean | undefined, actionsForRowLength: number | undefined, fontSize:
|
3
|
+
import { FontSize } from '../../../types';
|
4
|
+
export declare const useCssGrid: <TType = unknown>(table: RTable<TType>, isPrintTable: boolean | undefined, actionsForRowLength: number | undefined, fontSize: FontSize) => {
|
5
5
|
style: React.CSSProperties;
|
6
6
|
};
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import { Table3RowHeight } from '../types';
|
2
|
+
import { FontSize } from '../../../types';
|
3
|
+
export declare const useCssVars: (height: Table3RowHeight, fontSize: FontSize) => {
|
3
4
|
style: {
|
4
5
|
'--table3-cell-padding-x': string;
|
5
6
|
'--table3-cell-padding-y': string;
|
@@ -2,8 +2,8 @@
|
|
2
2
|
import { ColumnOrderState, ColumnSizingState, SortingState, VisibilityState, BuiltInSortingFn } from '@tanstack/react-table';
|
3
3
|
import { MenuProps } from '../Menu/Menu';
|
4
4
|
import { MenuItemProps } from '../Menu/components/Item';
|
5
|
-
import { TableColumnFilter, TableColumnSort, TableFilterHandler,
|
6
|
-
import { ValueOf } from '../../types';
|
5
|
+
import { TableColumnFilter, TableColumnSort, TableFilterHandler, TableRef, TableRowClickHandler, TableRowGotoHandler, TableRowHeight, TableRowSelectHandler, TableServerLoadAllHandler, TableServerLoadPageHandler, TableSortHandler } from '../../primitives/Table/types';
|
6
|
+
import { FontSize, ValueOf } from '../../types';
|
7
7
|
export declare type Table3SortDirection = 'asc' | 'desc';
|
8
8
|
export declare type Table3SortFn<TType = unknown> = ((rowA: TType, rowB: TType, columnId: string) => -1 | 0 | 1) | BuiltInSortingFn | 'auto';
|
9
9
|
export declare type Table3ColumnRenderer<TValue = unknown, TType = unknown> = (value: TValue, row: TType) => JSX.Element | string | number | null;
|
@@ -22,6 +22,7 @@ export declare type Table3ColumnControlProps = {
|
|
22
22
|
ref: React.RefObject<HTMLElement> | ((instance: HTMLElement | null | undefined) => void);
|
23
23
|
setValue: (value: any) => void;
|
24
24
|
value: any;
|
25
|
+
fontSize?: FontSize;
|
25
26
|
};
|
26
27
|
export declare type Table3ColumnControlRenderer<TType = unknown> = ((props: Table3ColumnControlProps, row?: TType) => JSX.Element) | 'datepicker' | 'input' | 'switch' | 'textarea';
|
27
28
|
export declare type Table3ColumnProps<TType = unknown> = ValueOf<{
|
@@ -62,7 +63,6 @@ export declare type Table3GroupProps = {
|
|
62
63
|
};
|
63
64
|
export declare type DeprecatedRowDensity = 'compact' | 'normal' | 'comfortable' | 'spacious';
|
64
65
|
export declare type Table3RowHeight = TableRowHeight;
|
65
|
-
export declare type Table3FontSize = TableFontSize;
|
66
66
|
export declare type Table3RowClickHandler<TType = unknown> = TableRowClickHandler<TType>;
|
67
67
|
export declare type Table3RowDragHandler<TType = unknown> = (rows: TType[], showPlaceholder: (string: any) => void, setDataTransfer: (data: string) => void) => void;
|
68
68
|
export declare type Table3RowDropHandler<TType = any> = (event: React.DragEvent, row: TType) => void;
|
@@ -76,7 +76,7 @@ export declare type Table3Settings = {
|
|
76
76
|
columnSizing?: ColumnSizingState;
|
77
77
|
columnVisibility?: VisibilityState;
|
78
78
|
excludeUnmatchedRecordsInSearch?: boolean;
|
79
|
-
fontSize?:
|
79
|
+
fontSize?: FontSize;
|
80
80
|
rowHeight?: Table3RowHeight;
|
81
81
|
showWarningWhenPrintingLargeDataset?: boolean;
|
82
82
|
sorting?: SortingState;
|
package/dist/esm/index.css
CHANGED
@@ -895,17 +895,17 @@
|
|
895
895
|
@apply !my-0;
|
896
896
|
}
|
897
897
|
|
898
|
-
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
898
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself and remove 1px border-width */
|
899
899
|
|
900
900
|
[data-font-size='small'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
901
|
-
@apply px-[calc(var(--table3-cell-padding-x)_-
|
901
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_6px_-_1px)];
|
902
902
|
}
|
903
903
|
|
904
|
-
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
904
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
|
905
905
|
because it should take all the available space in the cell */
|
906
906
|
|
907
907
|
[data-font-size='small'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
908
|
-
@apply px-[calc(var(--table3-cell-padding-x)_-
|
908
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_6px_-_1px)];
|
909
909
|
}
|
910
910
|
|
911
911
|
[data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox'],
|
@@ -934,17 +934,17 @@
|
|
934
934
|
@apply !-my-[5px];
|
935
935
|
}
|
936
936
|
|
937
|
-
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
937
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself and remove 1px border-width */
|
938
938
|
|
939
939
|
[data-font-size='medium'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
940
|
-
@apply px-[calc(var(--table3-cell-padding-x)_-
|
940
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_8px_-_1px)];
|
941
941
|
}
|
942
942
|
|
943
|
-
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
943
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
|
944
944
|
because it should take all the available space in the cell */
|
945
945
|
|
946
946
|
[data-font-size='medium'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
947
|
-
@apply px-[calc(var(--table3-cell-padding-x)_-
|
947
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_8px_-_1px)];
|
948
948
|
}
|
949
949
|
|
950
950
|
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox'],
|
@@ -1003,17 +1003,17 @@
|
|
1003
1003
|
@apply !h-6 !w-6;
|
1004
1004
|
}
|
1005
1005
|
|
1006
|
-
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
1006
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself and remove 1px border-width */
|
1007
1007
|
|
1008
1008
|
[data-font-size='large'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
1009
|
-
@apply px-[calc(var(--table3-cell-padding-x)_-
|
1009
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_10px_-_1px)];
|
1010
1010
|
}
|
1011
1011
|
|
1012
|
-
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
1012
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
|
1013
1013
|
because it should take all the available space in the cell */
|
1014
1014
|
|
1015
1015
|
[data-font-size='large'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
1016
|
-
@apply px-[calc(var(--table3-cell-padding-x)_-
|
1016
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_10px_-_1px)];
|
1017
1017
|
}
|
1018
1018
|
|
1019
1019
|
[data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox'],
|
@@ -44,6 +44,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
44
44
|
readOnly = false,
|
45
45
|
tags = false,
|
46
46
|
value: prop,
|
47
|
+
fontSize,
|
47
48
|
...otherProps
|
48
49
|
} = props;
|
49
50
|
const emptyOption = React__default.useMemo(() => {
|
@@ -121,6 +122,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
121
122
|
shouldPauseHoverState,
|
122
123
|
setShouldPauseHoverState,
|
123
124
|
tags,
|
125
|
+
fontSize,
|
124
126
|
validationError,
|
125
127
|
value
|
126
128
|
};
|
@@ -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 {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} 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';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement } from '../../utils/dom';\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: Select2Children;\n defaultValue?: Select2Value;\n emptyValue?: Select2OptionValue;\n disabled?: boolean;\n highlighted?: boolean;\n invalid?: boolean;\n multiple?: boolean;\n name?: string;\n onChange?: (value: Select2Value) => void;\n onCreate?: Select2CreateHandler;\n onDelete?: Select2DeleteHandler;\n onEdit?: Select2EditHandler;\n readOnly?: boolean;\n required?: boolean;\n tags?: boolean;\n value?: Select2Value;\n placeholder?: string;\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: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n placeholder,\n highlighted = false,\n invalid = false,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n readOnly = false,\n tags = false,\n value: prop,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\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 [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\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 const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\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 shouldPauseHoverState,\n setShouldPauseHoverState,\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.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\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 handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\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 emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n ref={internalRef}\n placeholder={placeholder}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\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 onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\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","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","placeholder","highlighted","invalid","multiple","name","onChange","onCreate","onDelete","onEdit","readOnly","tags","value","prop","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","currentTarget","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","map","child","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","length","Search","select2","searchOrCreate","search","onTabKeyPress","role","customSelector","Collection","Create","Group","Title","isFormControl","useIsFormControl","bubbleValue","Array","isArray","String","BubbleSelect","option","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MAyEMA,OA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AM;MAAK,CACzD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACDrI,OAAO,CAACsI,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 {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} 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';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement } from '../../utils/dom';\nimport { FontSize } from '../../types';\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: Select2Children;\n defaultValue?: Select2Value;\n emptyValue?: Select2OptionValue;\n disabled?: boolean;\n highlighted?: boolean;\n invalid?: boolean;\n multiple?: boolean;\n name?: string;\n onChange?: (value: Select2Value) => void;\n onCreate?: Select2CreateHandler;\n onDelete?: Select2DeleteHandler;\n onEdit?: Select2EditHandler;\n readOnly?: boolean;\n required?: boolean;\n tags?: boolean;\n value?: Select2Value;\n fontSize?: FontSize;\n placeholder?: string;\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: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n placeholder,\n highlighted = false,\n invalid = false,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n readOnly = false,\n tags = false,\n value: prop,\n fontSize,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\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 [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\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 const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\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 shouldPauseHoverState,\n setShouldPauseHoverState,\n tags,\n fontSize,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\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 handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\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 emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n ref={internalRef}\n placeholder={placeholder}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\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 onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\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","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","placeholder","highlighted","invalid","multiple","name","onChange","onCreate","onDelete","onEdit","readOnly","tags","value","prop","fontSize","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","currentTarget","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","map","child","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","length","Search","select2","searchOrCreate","search","onTabKeyPress","role","customSelector","Collection","Create","Group","Title","isFormControl","useIsFormControl","bubbleValue","Array","isArray","String","BubbleSelect","option","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2EMA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAkC,SAASF,OAAOA,CAACG,KAAK,EAAEC,GAAG;EACzF,MAAM;IACFC,QAAQ,EAAEC,YAAY;IACtBC,YAAY,EAAEC,WAAW;IACzBC,QAAQ,GAAG,KAAK;IAChBC,UAAU,GAAGC,SAAS;IACtBC,WAAW;IACXC,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,IAAI,GAAG,KAAK;IACZC,KAAK,EAAEC,IAAI;IACXC,QAAQ;IACR,GAAGC;GACN,GAAGvB,KAAK;EAET,MAAMwB,WAAW,GAAuD1B,cAAK,CAAC2B,OAAO,CAAC;IAClF,IAAIlB,UAAU,KAAKC,SAAS,IAAI,C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AAKZ,SAAS,EAAE;MACrB,IAAII,QAAQ,EAAE;QACVkH,WAAW,GAAGC,KAAK,CAACC,OAAO,CAAC5G,KAAK,CAAC,GAAGA,KAAK,CAAC6E,GAAG,CAACgC,MAAM,CAAC,GAAG,CAAC7G,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG6G,MAAM,CAAC7G,KAAK,CAAC,CAAC;OACjG,MAAM;QACH0G,WAAW,GAAG1G,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG6G,MAAM,CAAC7G,KAAK,CAAC;;;IAIzD,oBACItB,6BAACoI,YAAY;;MAAavG,GAAG,EAAEsG,MAAM,CAACH,WAAW,CAAC;MAAElH,QAAQ,EAAEA,QAAQ;MAAEC,IAAI,EAAEA,IAAI;MAAEO,KAAK,EAAE0G;OACtFvH,UAAU,KAAKC,SAAS,gBAAGV;MAAQsB,KAAK,EAAEb;MAAc,GAAG,IAAI,EAC/DyF,OAAO,CAACC,GAAG,CAACkC,MAAM,mBACfrI;MAAQ6B,GAAG,EAAEsG,MAAM,CAACE,MAAM,CAAC;MAAE/G,KAAK,EAAE6G,MAAM,CAACE,MAAM;MAAK,CACzD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACDtI,OAAO,CAACuI,WAAW,GAAG,SAAS;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../../../../../../src/components/Select2/components/Context.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionRef } from '../../../primitives/Collection/Collection';\nimport { Select2CreateHandler, Select2DeleteHandler, Select2EditHandler, Select2OptionValue, Select2Value } from '../types';\n\nexport type Select2ContextProps = {\n disabled: boolean;\n highlighted: boolean;\n invalid: boolean;\n listboxRef: React.RefObject<CollectionRef>;\n multiple: boolean;\n onCreate?: Select2CreateHandler;\n onDelete?: Select2DeleteHandler;\n onEdit?: Select2EditHandler;\n open: boolean;\n readOnly: boolean;\n ref: React.RefObject<HTMLButtonElement>;\n searchQuery: string;\n searchRef?: React.RefObject<HTMLInputElement>;\n setOpen: (open: boolean) => void;\n setSearchQuery: (value: string) => void;\n setValidationError: (error: Error | undefined) => void;\n setValue: (value: Select2OptionValue) => void;\n shouldPauseHoverState: boolean;\n setShouldPauseHoverState: (pause: boolean) => void;\n tags?: boolean;\n validationError?: Error;\n value?: Select2Value;\n};\n\nexport const Select2Context = React.createContext({} as Select2ContextProps);\nexport const useSelect2Context = () => React.useContext(Select2Context);\n"],"names":["Select2Context","React","createContext","useSelect2Context","useContext"],"mappings":";;
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../../../../../src/components/Select2/components/Context.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionRef } from '../../../primitives/Collection/Collection';\nimport { Select2CreateHandler, Select2DeleteHandler, Select2EditHandler, Select2OptionValue, Select2Value } from '../types';\nimport { FontSize } from '../../../types';\n\nexport type Select2ContextProps = {\n disabled: boolean;\n highlighted: boolean;\n invalid: boolean;\n listboxRef: React.RefObject<CollectionRef>;\n multiple: boolean;\n onCreate?: Select2CreateHandler;\n onDelete?: Select2DeleteHandler;\n onEdit?: Select2EditHandler;\n open: boolean;\n readOnly: boolean;\n ref: React.RefObject<HTMLButtonElement>;\n searchQuery: string;\n searchRef?: React.RefObject<HTMLInputElement>;\n setOpen: (open: boolean) => void;\n setSearchQuery: (value: string) => void;\n setValidationError: (error: Error | undefined) => void;\n setValue: (value: Select2OptionValue) => void;\n shouldPauseHoverState: boolean;\n setShouldPauseHoverState: (pause: boolean) => void;\n tags?: boolean;\n validationError?: Error;\n value?: Select2Value;\n fontSize?: FontSize;\n};\n\nexport const Select2Context = React.createContext({} as Select2ContextProps);\nexport const useSelect2Context = () => React.useContext(Select2Context);\n"],"names":["Select2Context","React","createContext","useSelect2Context","useContext"],"mappings":";;MA+BaA,cAAc,gBAAGC,cAAK,CAACC,aAAa,CAAC,EAAyB;MAC9DC,iBAAiB,GAAGA,MAAMF,cAAK,CAACG,UAAU,CAACJ,cAAc;;;;"}
|
@@ -10,9 +10,12 @@ const Group = /*#__PURE__*/React__default.forwardRef(function Select2Group(props
|
|
10
10
|
const {
|
11
11
|
children,
|
12
12
|
heading,
|
13
|
+
hasSeparator,
|
13
14
|
...attributes
|
14
15
|
} = props;
|
15
|
-
const className = cn(createCollectionClassName(),
|
16
|
+
const className = cn(createCollectionClassName(), {
|
17
|
+
"last:after:content-none after:content-[''] after:bg-grey-300 after:mx-2 after:my-1 after:h-px": hasSeparator && children.length
|
18
|
+
}, props.className);
|
16
19
|
return /*#__PURE__*/React__default.createElement(Group$1, Object.assign({}, attributes, {
|
17
20
|
className: className,
|
18
21
|
ref: ref
|
@@ -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';\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()
|
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 hasSeparator?: boolean;\n heading?: string;\n};\n\nexport const Group = React.forwardRef<HTMLDivElement, Select2GroupProps>(function Select2Group(props, ref) {\n const { children, heading, hasSeparator, ...attributes } = props;\n const className = cn(\n createCollectionClassName(),\n {\n \"last:after:content-none after:content-[''] after:bg-grey-300 after:mx-2 after:my-1 after:h-px\":\n hasSeparator && children.length,\n },\n props.className\n );\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","hasSeparator","attributes","className","cn","createCollectionClassName","length","ListboxPrimitive"],"mappings":";;;;;;;;MAYaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAoC,SAASC,YAAYA,CAACC,KAAK,EAAEC,GAAG;EACrG,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,YAAY;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAChE,MAAMM,SAAS,GAAGC,EAAE,CAChBC,yBAAyB,EAAE,EAC3B;IACI,+FAA+F,EAC3FJ,YAAY,IAAIF,QAAQ,CAACO;GAChC,EACDT,KAAK,CAACM,SAAS,CAClB;EAED,oBACIT,6BAACa,OAAsB,oBAAKL,UAAU;IAAEC,SAAS,EAAEA,SAAS;IAAEL,GAAG,EAAEA;mBAC/DJ,6BAACa,KAAsB;IAACJ,SAAS,EAAC;KAAkDH,OAAO,CAA0B,EACpHD,QAAQ,CACY;AAEjC,CAAC;;;;"}
|
@@ -12,6 +12,7 @@ import { createOptionClassName } from '../utilities.js';
|
|
12
12
|
import { useSelect2Context } from './Context.js';
|
13
13
|
import { EditPopover } from './Edit.js';
|
14
14
|
import { isMobileDevice } from '../../../utils/device.js';
|
15
|
+
import { FontSizes } from '../../../types.js';
|
15
16
|
|
16
17
|
const Option = /*#__PURE__*/React__default.forwardRef(function Select2Option(props, ref) {
|
17
18
|
var _window;
|
@@ -33,9 +34,14 @@ const Option = /*#__PURE__*/React__default.forwardRef(function Select2Option(pro
|
|
33
34
|
setOpen,
|
34
35
|
shouldPauseHoverState,
|
35
36
|
tags,
|
36
|
-
value
|
37
|
+
value,
|
38
|
+
fontSize = FontSizes.medium
|
37
39
|
} = useSelect2Context();
|
38
|
-
const className = cn(createOptionClassName(shouldPauseHoverState),
|
40
|
+
const className = cn(createOptionClassName(shouldPauseHoverState), {
|
41
|
+
'text-xs': fontSize === FontSizes.small,
|
42
|
+
'text-sm': fontSize === FontSizes.medium,
|
43
|
+
'text-base': fontSize === FontSizes.large
|
44
|
+
}, cName);
|
39
45
|
const hasValue = Array.isArray(value) ? !!value.length : value !== undefined;
|
40
46
|
const isTag = tags && !!color;
|
41
47
|
const handleClick = () => {
|
@@ -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 } from '../../Icon/Icon';\nimport { Tag } from '../../Tag/Tag';\nimport { isAriaSelectionKey } from '../../../utils/aria';\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';\nimport { Color } from '../../../types';\n\nexport type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children' | 'prefix'> & {\n children: string;\n color?: Color;\n description?: string;\n prefix?: IconName | JSX.Element;\n postfix?: IconName | JSX.Element;\n textValue?: string;\n};\n\nexport const Option = React.forwardRef<HTMLDivElement, Select2OptionProps>(function Select2Option(props, ref) {\n const { children, color, description, prefix, postfix, className: cName, ...otherProps } = props;\n const {\n onDelete,\n onEdit,\n listboxRef,\n multiple,\n ref: selectRef,\n setOpen,\n shouldPauseHoverState,\n tags,\n value,\n } = useSelect2Context();\n const className = cn(createOptionClassName(shouldPauseHoverState)
|
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 } from '../../Icon/Icon';\nimport { Tag } from '../../Tag/Tag';\nimport { isAriaSelectionKey } from '../../../utils/aria';\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';\nimport { Color } from '../../../types';\nimport { FontSize, FontSizes } from '../../../types';\n\nexport type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children' | 'prefix'> & {\n children: string;\n color?: Color;\n description?: string;\n fontSize?: FontSize;\n prefix?: IconName | JSX.Element;\n postfix?: IconName | JSX.Element;\n textValue?: string;\n};\n\nexport const Option = React.forwardRef<HTMLDivElement, Select2OptionProps>(function Select2Option(props, ref) {\n const { children, color, description, prefix, postfix, className: cName, ...otherProps } = props;\n const {\n onDelete,\n onEdit,\n listboxRef,\n multiple,\n ref: selectRef,\n setOpen,\n shouldPauseHoverState,\n tags,\n value,\n fontSize = FontSizes.medium,\n } = useSelect2Context();\n const className = cn(\n createOptionClassName(shouldPauseHoverState),\n {\n 'text-xs': fontSize === FontSizes.small,\n 'text-sm': fontSize === FontSizes.medium,\n 'text-base': fontSize === FontSizes.large,\n },\n cName\n );\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 isEmptyOption = children !== '';\n\n const popover =\n isEmptyOption && (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 my-1\" color={color} icon={prefix}>\n {children}\n </Tag>\n ) : (\n <>\n {prefix ? typeof prefix === 'string' ? <Icon name={prefix} /> : prefix : null}\n <span className=\"flex w-full justify-between\">\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 <span className=\"flex flex-col self-center\">\n {postfix ? typeof postfix === 'string' ? <Icon name={postfix} /> : postfix : null}\n </span>\n </span>\n </>\n )}\n {popover ? (\n <IconButton\n icon=\"ellipsis-vertical\"\n appearance=\"discrete\"\n className={cn(\n 'group-aria-current:visible invisible -mr-1 ml-auto !h-5 min-h-[theme(spacing.6)] !w-5 min-w-[theme(spacing.6)] hover:!bg-black/[.08] focus:!shadow-none group-hover:visible',\n {\n '!visible': isMobileDevice(window?.navigator),\n }\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","prefix","postfix","className","cName","otherProps","onDelete","onEdit","listboxRef","multiple","selectRef","setOpen","shouldPauseHoverState","tags","value","fontSize","FontSizes","medium","useSelect2Context","cn","createOptionClassName","small","large","hasValue","Array","isArray","length","undefined","isTag","handleClick","_selectRef$current","current","focus","handleKeyDown","event","isAriaSelectionKey","key","isEmptyOption","popover","popoverProps","_props$textValue","_props$textValue2","EditPopover","textValue","String","text","ListboxPrimitive","onClick","onKeyDown","Icon","name","Tag","icon","IconButton","appearance","isMobileDevice","_window","window","navigator","stopP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AS,EAAC;kBACZV;IAAMU,SAAS,EAAC;kBACZV,2CAAOK,QAAQ,CAAQ,EACtBE,WAAW,gBAAGP;IAAMU,SAAS,EAAC;KAAwCH,WAAW,CAAQ,GAAG,IAAI,CAC9F,eACPP;IAAMU,SAAS,EAAC;KACXD,OAAO,GAAG,OAAOA,OAAO,KAAK,QAAQ,gBAAGT,6BAACwD,IAAI;IAACC,IAAI,EAAEhD;IAAW,GAAGA,OAAO,GAAG,IAAI,CAC9E,CACJ,CACR,CACN,EACAoC,OAAO,kBACJ7C,6BAAC4D,UAAU;IACPD,IAAI,EAAC,mBAAmB;IACxBE,UAAU,EAAC,UAAU;IACrBnD,SAAS,EAAEgB,EAAE,CACT,6KAA6K,EAC7K;MACI,UAAU,EAAEoC,cAAc,EAAAC,OAAA,GAACC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS;KAC/C,CACJ;IACDX,OAAO,EAAEb,KAAK;;MACVA,KAAK,CAACyB,eAAe,EAAE;MACvBnD,UAAU,aAAVA,UAAU,wBAAAoD,mBAAA,GAAVpD,UAAU,CAAEuB,OAAO,cAAA6B,mBAAA,uBAAnBA,mBAAA,CAAqBC,cAAc,CAAC3B,KAAK,CAAC4B,aAAa,CAACC,aAA+B,CAAC;KAC3F;IACDzB,OAAO,EAAEA,OAAO;IAChB0B,QAAQ,EAAE,CAAC;IACb,IACF,IAAI,CACc;AAElC,CAAC;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useChildren.js","sources":["../../../../../../../../src/components/Select2/hooks/useChildren.tsx"],"sourcesContent":["import React from 'react';\nimport { Select2OptionProps } from '../components/Option';\nimport { Select2GroupProps } from '../Select2';\nimport { Select2Children, Select2OptionValue, Select2Value } from '../types';\n\nconst isGroup = (child: React.ReactElement) => !!child.props.heading;\n\nexport type useChildrenArgs = {\n children: Select2Children;\n emptyValue?: Select2OptionValue;\n multiple?: boolean;\n open?: boolean;\n setValue: (nextValue: Select2OptionValue) => void;\n value?: Select2Value;\n};\nexport const useChildren = ({ children: initialChildren, emptyValue, multiple, open, setValue, value }: useChildrenArgs) => {\n const [searchQuery, setSearchQuery] = React.useState<string>('');\n\n // flatten children that might be inside groups\n // support empty value - probably a more elegant way to achieve this\n const flattenedChildren: React.ReactElement<Select2OptionProps>[] = React.useMemo(() => {\n const initial: React.ReactElement<Select2OptionProps>[] =\n initialChildren\n ?.map(child => {\n if (isGroup(child)) {\n return (child as React.ReactElement<Select2GroupProps>).props.children;\n }\n // Since we are filtering out groups just above, then casting child to React.ReactElement<Select2OptionProps>, to avoid type inconsistency errors.\n return child as React.ReactElement<Select2OptionProps>;\n })\n .flatMap(c => c) || [];\n\n return initial;\n }, [initialChildren]);\n\n // set an initial value if none is set, we have to trigger state updates for controlled components\n React.useEffect(() => {\n if (!multiple && emptyValue === undefined && value === undefined) {\n setValue(flattenedChildren?.[0]?.props.value);\n }\n }, []);\n\n React.useEffect(() => {\n if (!open) {\n setSearchQuery('');\n }\n }, [open]);\n\n // apply filtering\n const filteredChildren = React.useMemo(() => {\n return initialChildren\n .map(child => {\n if (isGroup(child)) {\n const filteredGroupChildren = (child as React.ReactElement<Select2GroupProps>).props.children.filter(\n groupChild => filterOption(groupChild as React.ReactElement<Select2OptionProps>, searchQuery)\n );\n return filteredGroupChildren.length\n ? React.cloneElement(child as React.ReactElement<Select2OptionProps>, {}, filteredGroupChildren)\n : null;\n }\n\n return filterOption(child as React.ReactElement<Select2OptionProps>, searchQuery) ? child : null;\n })\n .filter(child => !!child) as Select2Children;\n }, [flattenedChildren, searchQuery]);\n\n return {\n flattenedChildren,\n filteredChildren,\n searchQuery,\n setSearchQuery,\n };\n};\n\nconst filterOption = (child: React.ReactElement<Select2OptionProps>, searchQuery: string) => {\n if (child.props.textValue?.toLowerCase().includes(searchQuery.toLowerCase())) {\n return true;\n }\n\n if (child.props.description?.toLowerCase().includes(searchQuery.toLowerCase())) {\n return true;\n }\n\n return String(child.props.children).toLowerCase().includes(searchQuery.toLowerCase());\n};\n"],"names":["isGroup","child","props","heading","useChildren","children","initialChildren","emptyValue","multiple","open","setValue","value","searchQuery","setSearchQuery","React","useState","flattenedChildren","useMemo","initial","map","flatMap","c","useEffect","undefined","_flattenedChildren$","filteredChildren","filteredGroupChildren","filter","groupChild","filterOption","length","cloneElement","_child$props$textValu","textValue","toLowerCase","includes","_child$props$descript","description","String"],"mappings":";;AAKA,MAAMA,OAAO,GAAIC,KAAyB,IAAK,CAAC,CAACA,KAAK,CAACC,KAAK,CAACC,OAAO;
|
1
|
+
{"version":3,"file":"useChildren.js","sources":["../../../../../../../../src/components/Select2/hooks/useChildren.tsx"],"sourcesContent":["import React from 'react';\nimport { Select2OptionProps } from '../components/Option';\nimport { Select2GroupProps } from '../Select2';\nimport { Select2Children, Select2OptionValue, Select2Value } from '../types';\n\nconst isGroup = (child: React.ReactElement) => !!child.props.heading || !!child.props.hasSeparator;\n\nexport type useChildrenArgs = {\n children: Select2Children;\n emptyValue?: Select2OptionValue;\n multiple?: boolean;\n open?: boolean;\n setValue: (nextValue: Select2OptionValue) => void;\n value?: Select2Value;\n};\nexport const useChildren = ({ children: initialChildren, emptyValue, multiple, open, setValue, value }: useChildrenArgs) => {\n const [searchQuery, setSearchQuery] = React.useState<string>('');\n\n // flatten children that might be inside groups\n // support empty value - probably a more elegant way to achieve this\n const flattenedChildren: React.ReactElement<Select2OptionProps>[] = React.useMemo(() => {\n const initial: React.ReactElement<Select2OptionProps>[] =\n initialChildren\n ?.map(child => {\n if (isGroup(child)) {\n return (child as React.ReactElement<Select2GroupProps>).props.children;\n }\n // Since we are filtering out groups just above, then casting child to React.ReactElement<Select2OptionProps>, to avoid type inconsistency errors.\n return child as React.ReactElement<Select2OptionProps>;\n })\n .flatMap(c => c) || [];\n\n return initial;\n }, [initialChildren]);\n\n // set an initial value if none is set, we have to trigger state updates for controlled components\n React.useEffect(() => {\n if (!multiple && emptyValue === undefined && value === undefined) {\n setValue(flattenedChildren?.[0]?.props.value);\n }\n }, []);\n\n React.useEffect(() => {\n if (!open) {\n setSearchQuery('');\n }\n }, [open]);\n\n // apply filtering\n const filteredChildren = React.useMemo(() => {\n return initialChildren\n .map(child => {\n if (isGroup(child)) {\n const filteredGroupChildren = (child as React.ReactElement<Select2GroupProps>).props.children.filter(\n groupChild => filterOption(groupChild as React.ReactElement<Select2OptionProps>, searchQuery)\n );\n return filteredGroupChildren.length\n ? React.cloneElement(child as React.ReactElement<Select2OptionProps>, {}, filteredGroupChildren)\n : null;\n }\n\n return filterOption(child as React.ReactElement<Select2OptionProps>, searchQuery) ? child : null;\n })\n .filter(child => !!child) as Select2Children;\n }, [flattenedChildren, searchQuery]);\n\n return {\n flattenedChildren,\n filteredChildren,\n searchQuery,\n setSearchQuery,\n };\n};\n\nconst filterOption = (child: React.ReactElement<Select2OptionProps>, searchQuery: string) => {\n if (child.props.textValue?.toLowerCase().includes(searchQuery.toLowerCase())) {\n return true;\n }\n\n if (child.props.description?.toLowerCase().includes(searchQuery.toLowerCase())) {\n return true;\n }\n\n return String(child.props.children).toLowerCase().includes(searchQuery.toLowerCase());\n};\n"],"names":["isGroup","child","props","heading","hasSeparator","useChildren","children","initialChildren","emptyValue","multiple","open","setValue","value","searchQuery","setSearchQuery","React","useState","flattenedChildren","useMemo","initial","map","flatMap","c","useEffect","undefined","_flattenedChildren$","filteredChildren","filteredGroupChildren","filter","groupChild","filterOption","length","cloneElement","_child$props$textValu","textValue","toLowerCase","includes","_child$props$descript","description","String"],"mappings":";;AAKA,MAAMA,OAAO,GAAIC,KAAyB,IAAK,CAAC,CAACA,KAAK,CAACC,KAAK,CAACC,OAAO,IAAI,CAAC,CAACF,KAAK,CAACC,KAAK,CAACE,YAAY;MAUrFC,WAAW,GAAGA,CAAC;EAAEC,QAAQ,EAAEC,eAAe;EAAEC,UAAU;EAAEC,QAAQ;EAAEC,IAAI;EAAEC,QAAQ;EAAEC;CAAwB;EACnH,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAK,CA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AC/B,KAA+C,EAAE,EAAE,EAAE0B,qBAAqB,CAAC,GAC9F,IAAI;;MAGd,OAAOG,YAAY,CAAC7B,KAA+C,EAAEY,WAAW,CAAC,GAAGZ,KAAK,GAAG,IAAI;KACnG,CAAC,CACD2B,MAAM,CAAC3B,KAAK,IAAI,CAAC,CAACA,KAAK,CAAoB;GACnD,EAAE,CAACgB,iBAAiB,EAAEJ,WAAW,CAAC,CAAC;EAEpC,OAAO;IACHI,iBAAiB;IACjBS,gBAAgB;IAChBb,WAAW;IACXC;GACH;AACL;AAEA,MAAMgB,YAAY,GAAGA,CAAC7B,KAA6C,EAAEY,WAAmB;;EACpF,KAAAoB,qBAAA,GAAIhC,KAAK,CAACC,KAAK,CAACgC,SAAS,cAAAD,qBAAA,eAArBA,qBAAA,CAAuBE,WAAW,EAAE,CAACC,QAAQ,CAACvB,WAAW,CAACsB,WAAW,EAAE,CAAC,EAAE;IAC1E,OAAO,IAAI;;EAGf,KAAAE,qBAAA,GAAIpC,KAAK,CAACC,KAAK,CAACoC,WAAW,cAAAD,qBAAA,eAAvBA,qBAAA,CAAyBF,WAAW,EAAE,CAACC,QAAQ,CAACvB,WAAW,CAACsB,WAAW,EAAE,CAAC,EAAE;IAC5E,OAAO,IAAI;;EAGf,OAAOI,MAAM,CAACtC,KAAK,CAACC,KAAK,CAACI,QAAQ,CAAC,CAAC6B,WAAW,EAAE,CAACC,QAAQ,CAACvB,WAAW,CAACsB,WAAW,EAAE,CAAC;AACzF,CAAC;;;;"}
|
@@ -2,8 +2,8 @@ import React__default from 'react';
|
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
4
4
|
import { FocusScope } from '@react-aria/focus';
|
5
|
+
import { fixedForwardRef, FontSizes } from '../../types.js';
|
5
6
|
import { flexRender } from '@tanstack/react-table';
|
6
|
-
import { FONT_SIZE } from './components/toolbar/FontSize.js';
|
7
7
|
import { useCssGrid } from './hooks/useCssGrid.js';
|
8
8
|
import { useColumnFreezingStyle } from './hooks/features/useColumnFreezing.js';
|
9
9
|
import { useTable } from './hooks/useTable.js';
|
@@ -14,7 +14,6 @@ import { Summary } from './components/columns/footer/Summary.js';
|
|
14
14
|
import { useCssVars } from './hooks/useCssVars.js';
|
15
15
|
import { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle.js';
|
16
16
|
import { ErrorAlert } from './components/alert/ErrorAlert.js';
|
17
|
-
import { fixedForwardRef } from '../../types.js';
|
18
17
|
export { useTable3DataLoader } from './hooks/useTableDataLoader.js';
|
19
18
|
|
20
19
|
function Column(_) {
|
@@ -114,9 +113,9 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
114
113
|
}
|
115
114
|
};
|
116
115
|
const className = cn('border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none', '[&[data-resizing="true"]]:select-none', {
|
117
|
-
'text-xs': tableMeta.fontSize.size ===
|
118
|
-
'text-sm': tableMeta.fontSize.size ===
|
119
|
-
'text-base': tableMeta.fontSize.size ===
|
116
|
+
'text-xs': tableMeta.fontSize.size === FontSizes.small,
|
117
|
+
'text-sm': tableMeta.fontSize.size === FontSizes.medium,
|
118
|
+
'text-base': tableMeta.fontSize.size === FontSizes.large
|
120
119
|
});
|
121
120
|
// Print tables have "_print" as the postfix for the table id, so we can use the it to determine
|
122
121
|
// if the table is a print table or not.
|