impact-nova 2.1.0-alpha.4 → 2.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/ag-grid-react/ag-grid-tooltip-overflow.d.ts +3 -0
- package/dist/components/data/ag-grid-react/ag-grid-tooltip-overflow.js +6 -0
- package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +15 -21
- package/dist/components/data/ag-grid-react/cell-renderers/date-display-renderer.js +1 -1
- package/dist/components/data/ag-grid-react/cell-renderers/default-text-cell-renderer.d.ts +1 -2
- package/dist/components/data/ag-grid-react/cell-renderers/default-text-cell-renderer.js +12 -6
- package/dist/components/data/ag-grid-react/cell-renderers/editors/textarea-cell-editor.js +19 -19
- package/dist/components/data/ag-grid-react/cell-renderers/select-display-renderer.js +1 -1
- package/dist/components/data/ag-grid-react/cell-renderers/switch-display-renderer.js +15 -15
- package/dist/components/data/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +1 -1
- package/dist/components/data/ag-grid-react/headers/advanced-filter/column-filter-section.js +33 -33
- package/dist/components/data/ag-grid-react/headers/components/header-info.js +66 -62
- package/dist/components/data/ag-grid-react/headers/components/info-modal.js +6 -6
- package/dist/components/data/ag-grid-react/headers/components/section-renderers.js +18 -18
- package/dist/components/data/ag-grid-react/headers/custom-header-group.js +40 -29
- package/dist/components/data/ag-grid-react/headers/custom-header.js +102 -98
- package/dist/components/data/ag-grid-react/index.d.ts +1 -1
- package/dist/components/data/ag-grid-react/index.js +136 -127
- package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +7 -0
- package/dist/components/data/ag-grid-react/notify-column-indicator-sync.js +6 -0
- package/dist/components/data/ag-grid-react/theme.js +8 -4
- package/dist/components/data/ag-grid-react/use-ag-grid-truncation-tooltip.d.ts +5 -0
- package/dist/components/data/ag-grid-react/use-ag-grid-truncation-tooltip.js +13 -0
- package/dist/components/data/ag-grid-react/useGridAutoSizeStrategyOnResize.js +8 -5
- package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +14 -0
- package/dist/components/data/data-table/build-column-tree-from-grid.js +95 -0
- package/dist/components/data/data-table/data-table-column-apply.d.ts +29 -0
- package/dist/components/data/data-table/data-table-column-apply.js +102 -0
- package/dist/components/data/data-table/data-table-column-def-pin.d.ts +25 -0
- package/dist/components/data/data-table/data-table-column-def-pin.js +66 -0
- package/dist/components/data/data-table/data-table-column-list-sync.d.ts +8 -0
- package/dist/components/data/data-table/data-table-column-list-sync.js +15 -0
- package/dist/components/data/data-table/data-table-column-list.d.ts +14 -4
- package/dist/components/data/data-table/data-table-column-list.js +74 -277
- package/dist/components/data/data-table/data-table-constants.d.ts +3 -4
- package/dist/components/data/data-table/data-table-context.d.ts +3 -6
- package/dist/components/data/data-table/data-table-context.js +21 -10
- package/dist/components/data/data-table/data-table-saved-views.js +26 -26
- package/dist/components/data/data-table/data-table-sheet-portal-store.d.ts +13 -0
- package/dist/components/data/data-table/data-table-sheet-portal-store.js +36 -0
- package/dist/components/data/data-table/data-table-sheet.d.ts +3 -6
- package/dist/components/data/data-table/data-table-sheet.js +4 -2
- package/dist/components/data/data-table/data-table-view-menu.js +40 -40
- package/dist/components/data/data-table/data-table.d.ts +8 -10
- package/dist/components/data/data-table/data-table.js +138 -111
- package/dist/components/data/data-table/data-table.types.d.ts +35 -0
- package/dist/components/data/data-table/index.js +28 -27
- package/dist/components/data/data-table/indicator-legend.js +6 -6
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +16 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +222 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-attributes.d.ts +8 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +72 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-context.d.ts +13 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-context.js +25 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-metrics.d.ts +6 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +41 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-parts.d.ts +31 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-parts.js +233 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-preset.d.ts +18 -0
- package/dist/components/data/expandable-list-item/expandable-list-item-preset.js +133 -0
- package/dist/components/data/expandable-list-item/expandable-list-item.d.ts +5 -0
- package/dist/components/data/{expandable-sku/expandable-sku.types.d.ts → expandable-list-item/expandable-list-item.types.d.ts} +7 -7
- package/dist/components/data/expandable-list-item/index.d.ts +5 -0
- package/dist/components/data/expandable-list-item/index.js +19 -0
- package/dist/components/data/nested-list/components/NestedListHeader.js +11 -11
- package/dist/components/data/nested-list/components/SortableItem.js +2 -2
- package/dist/components/data-display/avatar/avatar.types.d.ts +2 -0
- package/dist/components/data-display/badge/badge.types.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +11 -11
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +7 -7
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +31 -31
- package/dist/components/data-display/card/card.js +8 -8
- package/dist/components/data-display/chart/chart.types.d.ts +9 -0
- package/dist/components/data-display/skeleton/skeleton.js +6 -6
- package/dist/components/data-display/statistics-card/statistics-card.js +14 -14
- package/dist/components/feedback/alert-dialog/alert-dialog.js +19 -19
- package/dist/components/feedback/dialog/dialog.js +1 -1
- package/dist/components/feedback/drawer/drawer.js +18 -18
- package/dist/components/feedback/dropdown-menu/dropdown-menu.js +70 -57
- package/dist/components/feedback/popover/popover.js +1 -1
- package/dist/components/feedback/sheet/sheet.js +1 -1
- package/dist/components/feedback/tooltip/tooltip.js +22 -22
- package/dist/components/feedback/tooltip/tooltip.variants.js +1 -1
- package/dist/components/flows/command-palette/command-palette.js +104 -104
- package/dist/components/flows/command-palette/shortcut-settings.js +34 -34
- package/dist/components/flows/filter-strip/filter-tag-list.js +4 -4
- package/dist/components/flows/notification-panel/notification-list.js +17 -17
- package/dist/components/flows/notification-panel/notification-panel.js +4 -4
- package/dist/components/flows/notification-panel/notification-panel.types.d.ts +3 -0
- package/dist/components/flows/wizard/wizard.js +8 -8
- package/dist/components/forms/combobox/combobox.js +20 -20
- package/dist/components/forms/date-picker/date-picker.js +17 -17
- package/dist/components/forms/date-picker/date-range-picker.js +3 -3
- package/dist/components/forms/date-picker/month-picker.js +1 -1
- package/dist/components/forms/date-picker/month-range-picker.js +42 -42
- package/dist/components/forms/date-picker/week-picker.js +15 -15
- package/dist/components/forms/date-picker/week-range-picker.js +3 -3
- package/dist/components/forms/file-upload/file-upload.js +33 -33
- package/dist/components/forms/input/input.js +8 -8
- package/dist/components/forms/input/input.variants.js +3 -3
- package/dist/components/forms/select/components/SelectMenuPanel.d.ts +1 -2
- package/dist/components/forms/select/components/SelectMenuPanel.js +18 -20
- package/dist/components/forms/select/components/SelectTrigger.d.ts +9 -6
- package/dist/components/forms/select/components/SelectTrigger.js +120 -122
- package/dist/components/forms/select/components/Submenu.js +8 -8
- package/dist/components/forms/select/hooks/useSelectKeyboardHandlers.d.ts +1 -1
- package/dist/components/forms/select/hooks/useSelectValueState.d.ts +19 -0
- package/dist/components/forms/select/hooks/useSelectValueState.js +41 -0
- package/dist/components/forms/select/index.js +4 -3
- package/dist/components/forms/select/select.js +180 -175
- package/dist/components/forms/select/select.types.d.ts +3 -2
- package/dist/components/forms/select/select.variants.js +4 -4
- package/dist/components/forms/select/utils/select.d.ts +2 -1
- package/dist/components/forms/select/utils/select.js +47 -37
- package/dist/components/layout/sidebar/sidebar.d.ts +7 -50
- package/dist/components/layout/sidebar/sidebar.js +12 -11
- package/dist/components/layout/sidebar/sidebar.types.d.ts +35 -1
- package/dist/components/primitives/button-group/button-group.js +32 -32
- package/dist/components/primitives/chips/chips.variants.js +5 -5
- package/dist/components/primitives/empty-container/empty-container.types.d.ts +3 -0
- package/dist/components/primitives/kbd/kbd.variants.js +3 -3
- package/dist/components/primitives/stepper/stepper.js +6 -6
- package/dist/impact-nova-components.css +113 -7
- package/dist/impact-nova-tokens.scss +2 -4
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +467 -433
- package/dist/lib/compose-refs.d.ts +8 -0
- package/dist/lib/compose-refs.js +14 -0
- package/dist/lib/primitives/field.types.d.ts +8 -2
- package/dist/lib/virtualized/index.d.ts +3 -0
- package/dist/lib/virtualized/index.js +33 -16
- package/dist/lib/virtualized/useVirtualizedList.d.ts +2 -0
- package/dist/lib/virtualized/useVirtualizedList.js +115 -109
- package/dist/lib/virtualized/virtualized-list-context.d.ts +12 -0
- package/dist/lib/virtualized/virtualized-list-context.js +21 -0
- package/dist/lib/virtualized/virtualized-list-parts.d.ts +51 -0
- package/dist/lib/virtualized/virtualized-list-parts.js +175 -0
- package/dist/lib/virtualized/virtualized-list-utils.d.ts +5 -0
- package/dist/lib/virtualized/virtualized-list-utils.js +6 -0
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/migration.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +24 -15
- package/tailwind.config.js +1 -0
- package/dist/components/data/ag-grid-react/headers/components/truncated-text.d.ts +0 -15
- package/dist/components/data/ag-grid-react/headers/components/truncated-text.js +0 -27
- package/dist/components/data/expandable-sku/expandable-sku.d.ts +0 -38
- package/dist/components/data/expandable-sku/expandable-sku.js +0 -245
- package/dist/components/data/expandable-sku/index.d.ts +0 -2
- package/dist/components/data/expandable-sku/index.js +0 -4
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as i from "@radix-ui/react-popover";
|
|
3
3
|
import { cn as r } from "../../../../lib/utils.js";
|
|
4
|
-
function
|
|
5
|
-
menuRef:
|
|
4
|
+
function v({
|
|
5
|
+
menuRef: n,
|
|
6
6
|
menuMinHeight: t,
|
|
7
|
-
menuWidth:
|
|
7
|
+
menuWidth: l,
|
|
8
8
|
isReadOnly: a,
|
|
9
9
|
id: d,
|
|
10
|
-
menuLabel:
|
|
11
|
-
|
|
12
|
-
children: c
|
|
10
|
+
menuLabel: s,
|
|
11
|
+
children: p
|
|
13
12
|
}) {
|
|
14
|
-
return /* @__PURE__ */ o(
|
|
15
|
-
|
|
13
|
+
return /* @__PURE__ */ o(i.Portal, { children: /* @__PURE__ */ o(
|
|
14
|
+
i.Content,
|
|
16
15
|
{
|
|
17
|
-
ref:
|
|
16
|
+
ref: n,
|
|
18
17
|
side: "bottom",
|
|
19
18
|
sideOffset: 4,
|
|
20
19
|
align: "start",
|
|
21
20
|
avoidCollisions: !0,
|
|
22
21
|
collisionPadding: 8,
|
|
23
|
-
"aria-label":
|
|
22
|
+
"aria-label": s,
|
|
24
23
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
25
|
-
onInteractOutside: i,
|
|
26
|
-
onFocusOutside: i,
|
|
27
24
|
onWheel: (e) => e.stopPropagation(),
|
|
28
25
|
style: {
|
|
29
|
-
width:
|
|
30
|
-
|
|
26
|
+
width: l ?? "var(--radix-popover-trigger-width)",
|
|
27
|
+
minWidth: "var(--radix-popover-trigger-width)",
|
|
28
|
+
maxHeight: "min(320px, var(--radix-popover-content-available-height, 320px))"
|
|
31
29
|
},
|
|
32
30
|
className: r(
|
|
33
|
-
"z-
|
|
34
|
-
a ? "bg-disabled-surface" : "bg-canvas"
|
|
31
|
+
"z-50 flex flex-col overflow-hidden rounded-[12px] p-0 text-base shadow-[0px_1px_6px_0px_rgba(26,39,124,0.14)] focus:outline-none sm:text-sm border-none pointer-events-auto",
|
|
32
|
+
a ? "bg-disabled-surface" : "bg-canvas-elevated"
|
|
35
33
|
),
|
|
36
34
|
"data-testid": `select-menu-${d || "default"}`,
|
|
37
35
|
"data-component": "select-menu",
|
|
@@ -40,17 +38,17 @@ function x({
|
|
|
40
38
|
{
|
|
41
39
|
className: r(
|
|
42
40
|
"flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px]",
|
|
43
|
-
a ? "bg-disabled-surface" : "bg-canvas"
|
|
41
|
+
a ? "bg-disabled-surface" : "bg-canvas-elevated"
|
|
44
42
|
),
|
|
45
43
|
style: {
|
|
46
44
|
minHeight: t ? `${t}px` : void 0
|
|
47
45
|
},
|
|
48
|
-
children:
|
|
46
|
+
children: p
|
|
49
47
|
}
|
|
50
48
|
)
|
|
51
49
|
}
|
|
52
50
|
) });
|
|
53
51
|
}
|
|
54
52
|
export {
|
|
55
|
-
|
|
53
|
+
v as SelectMenuPanel
|
|
56
54
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FocusEvent, KeyboardEvent, MouseEvent, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { MultiValue, Option, SingleValue } from '../select.types';
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
export interface SelectTriggerProps<OptionType extends Option = Option> {
|
|
4
|
-
triggerRef: RefObject<
|
|
5
|
+
triggerRef: RefObject<HTMLButtonElement | null>;
|
|
5
6
|
inputRef: RefObject<HTMLInputElement | null>;
|
|
6
7
|
selectFieldId: string;
|
|
7
8
|
listboxId: string;
|
|
@@ -31,10 +32,12 @@ export interface SelectTriggerProps<OptionType extends Option = Option> {
|
|
|
31
32
|
formatSelectedCount: (count: number) => string;
|
|
32
33
|
resolveOptionLabel: (option: OptionType | Option) => ReactNode;
|
|
33
34
|
isMulti?: boolean;
|
|
34
|
-
onFocus?: (event: FocusEvent<
|
|
35
|
-
onBlur?: (event: FocusEvent<
|
|
36
|
-
onKeyDown: (event: KeyboardEvent<
|
|
37
|
-
|
|
35
|
+
onFocus?: (event: FocusEvent<HTMLButtonElement>) => void;
|
|
36
|
+
onBlur?: (event: FocusEvent<HTMLButtonElement>) => void;
|
|
37
|
+
onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
|
|
38
|
+
onToggle: () => void;
|
|
38
39
|
onClear: (event: MouseEvent) => void;
|
|
39
40
|
}
|
|
40
|
-
export declare
|
|
41
|
+
export declare const SelectTrigger: <OptionType extends Option = Option>(props: SelectTriggerProps<OptionType> & {
|
|
42
|
+
ref?: React.ForwardedRef<HTMLButtonElement>;
|
|
43
|
+
}) => React.ReactElement | null;
|
|
@@ -1,166 +1,162 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as t, jsxs as c, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import * as J from "react";
|
|
3
|
+
import { LoadingSpinner as K, Cross as Q, ChevronRight as U } from "impact-nova-icons";
|
|
4
|
+
import { cn as g } from "../../../../lib/utils.js";
|
|
5
|
+
import { selectTriggerVariants as W } from "../select.variants.js";
|
|
6
|
+
import { hasClearableSelectValue as X } from "../utils/hasClearableSelectValue.js";
|
|
7
|
+
import { SelectTriggerValue as Y } from "./SelectTriggerValue.js";
|
|
8
|
+
function Z(...i) {
|
|
9
|
+
return (n) => {
|
|
10
|
+
for (const r of i)
|
|
11
|
+
r && (typeof r == "function" ? r(n) : r.current = n);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function _({
|
|
15
|
+
triggerRef: i,
|
|
16
|
+
inputRef: n,
|
|
17
|
+
selectFieldId: r,
|
|
18
|
+
listboxId: x,
|
|
19
|
+
id: s,
|
|
20
|
+
className: h,
|
|
14
21
|
size: w = "default",
|
|
15
|
-
error:
|
|
22
|
+
error: b,
|
|
16
23
|
isDisabled: a,
|
|
17
|
-
isReadOnly:
|
|
18
|
-
isOpen:
|
|
19
|
-
isLoading:
|
|
20
|
-
isProcessing:
|
|
21
|
-
isClearable:
|
|
22
|
-
isSearchable:
|
|
23
|
-
searchPosition:
|
|
24
|
-
searchValue:
|
|
25
|
-
setSearchValue:
|
|
26
|
-
autoFocus:
|
|
27
|
-
name:
|
|
28
|
-
label:
|
|
29
|
-
placeholder:
|
|
30
|
-
leftContent:
|
|
31
|
-
activeDescendantId:
|
|
32
|
-
internalValue:
|
|
33
|
-
totalCount:
|
|
34
|
-
totalOptionsCount:
|
|
35
|
-
formatSelectedCount:
|
|
36
|
-
resolveOptionLabel:
|
|
37
|
-
isMulti:
|
|
38
|
-
onFocus:
|
|
39
|
-
onBlur:
|
|
40
|
-
onKeyDown:
|
|
41
|
-
|
|
42
|
-
onClear:
|
|
43
|
-
}) {
|
|
44
|
-
const
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
"
|
|
24
|
+
isReadOnly: l,
|
|
25
|
+
isOpen: o,
|
|
26
|
+
isLoading: v,
|
|
27
|
+
isProcessing: N,
|
|
28
|
+
isClearable: C,
|
|
29
|
+
isSearchable: S,
|
|
30
|
+
searchPosition: k,
|
|
31
|
+
searchValue: P,
|
|
32
|
+
setSearchValue: T,
|
|
33
|
+
autoFocus: y,
|
|
34
|
+
name: z,
|
|
35
|
+
label: f,
|
|
36
|
+
placeholder: d,
|
|
37
|
+
leftContent: m,
|
|
38
|
+
activeDescendantId: j,
|
|
39
|
+
internalValue: p,
|
|
40
|
+
totalCount: V,
|
|
41
|
+
totalOptionsCount: $,
|
|
42
|
+
formatSelectedCount: F,
|
|
43
|
+
resolveOptionLabel: I,
|
|
44
|
+
isMulti: u,
|
|
45
|
+
onFocus: L,
|
|
46
|
+
onBlur: R,
|
|
47
|
+
onKeyDown: q,
|
|
48
|
+
onToggle: A,
|
|
49
|
+
onClear: B
|
|
50
|
+
}, D) {
|
|
51
|
+
const E = C && !l && !a && X(u, p);
|
|
52
|
+
return /* @__PURE__ */ t(
|
|
53
|
+
"button",
|
|
47
54
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
type: "button",
|
|
56
|
+
ref: Z(D, i),
|
|
57
|
+
disabled: a,
|
|
58
|
+
className: g(
|
|
59
|
+
W({
|
|
51
60
|
size: w,
|
|
52
|
-
error: !!
|
|
61
|
+
error: !!b,
|
|
53
62
|
disabled: !!a,
|
|
54
|
-
readOnly:
|
|
55
|
-
open:
|
|
63
|
+
readOnly: l,
|
|
64
|
+
open: o
|
|
56
65
|
}),
|
|
57
|
-
|
|
66
|
+
h
|
|
58
67
|
),
|
|
59
|
-
id:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
onBlur: A,
|
|
68
|
+
id: r,
|
|
69
|
+
onFocus: L,
|
|
70
|
+
onBlur: R,
|
|
63
71
|
role: "combobox",
|
|
64
|
-
"aria-expanded":
|
|
72
|
+
"aria-expanded": o,
|
|
65
73
|
"aria-haspopup": "listbox",
|
|
66
|
-
"aria-controls":
|
|
67
|
-
"aria-activedescendant":
|
|
68
|
-
"aria-label":
|
|
69
|
-
"aria-disabled": a || void 0,
|
|
74
|
+
"aria-controls": x,
|
|
75
|
+
"aria-activedescendant": j,
|
|
76
|
+
"aria-label": f ? String(f) : d,
|
|
70
77
|
"data-component": "select-trigger",
|
|
71
78
|
"data-disabled": a || void 0,
|
|
72
|
-
"data-state":
|
|
73
|
-
onKeyDown:
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
"data-state": o ? "open" : "closed",
|
|
80
|
+
onKeyDown: q,
|
|
81
|
+
onClick: (e) => {
|
|
82
|
+
if (e.target.closest("[data-clear-button]")) {
|
|
83
|
+
e.preventDefault(), e.stopPropagation();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
a || l || A();
|
|
78
87
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
(o.closest("[data-chevron-button]") || o.closest("[data-clear-button]")) && (t.preventDefault(), t.stopPropagation());
|
|
88
|
+
onPointerDown: (e) => {
|
|
89
|
+
e.target.closest("[data-clear-button]") && (e.preventDefault(), e.stopPropagation());
|
|
82
90
|
},
|
|
83
|
-
children: /* @__PURE__ */
|
|
84
|
-
|
|
85
|
-
/* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between w-full min-w-0 max-w-full", children: [
|
|
92
|
+
m ? /* @__PURE__ */ t("div", { className: "flex items-center text-content-icon shrink-0", children: m }) : null,
|
|
93
|
+
/* @__PURE__ */ c(
|
|
86
94
|
"div",
|
|
87
95
|
{
|
|
88
|
-
className: "flex-1 flex items-center overflow-hidden min-w-0 max-w-full",
|
|
89
|
-
"data-testid": `select-value-${
|
|
96
|
+
className: "flex-1 flex items-center overflow-hidden min-w-0 max-w-full text-left",
|
|
97
|
+
"data-testid": `select-value-${s || "default"}`,
|
|
90
98
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
99
|
+
/* @__PURE__ */ t(
|
|
100
|
+
Y,
|
|
93
101
|
{
|
|
94
|
-
isMulti:
|
|
102
|
+
isMulti: u,
|
|
95
103
|
isDisabled: a,
|
|
96
|
-
internalValue:
|
|
97
|
-
totalCount:
|
|
98
|
-
totalOptionsCount:
|
|
99
|
-
formatSelectedCount:
|
|
100
|
-
resolveOptionLabel:
|
|
101
|
-
placeholder: /* @__PURE__ */
|
|
104
|
+
internalValue: p,
|
|
105
|
+
totalCount: V,
|
|
106
|
+
totalOptionsCount: $,
|
|
107
|
+
formatSelectedCount: F,
|
|
108
|
+
resolveOptionLabel: I,
|
|
109
|
+
placeholder: /* @__PURE__ */ t(
|
|
102
110
|
"span",
|
|
103
111
|
{
|
|
104
112
|
className: "text-content-placeholder font-normal text-[14px] truncate min-w-0 block",
|
|
105
|
-
"data-testid": `select-placeholder-${
|
|
113
|
+
"data-testid": `select-placeholder-${s || "default"}`,
|
|
106
114
|
"data-has-value": !1,
|
|
107
|
-
children:
|
|
115
|
+
children: d
|
|
108
116
|
}
|
|
109
117
|
)
|
|
110
118
|
}
|
|
111
119
|
),
|
|
112
|
-
|
|
120
|
+
S && o && k === "trigger" && !l ? /* @__PURE__ */ t(
|
|
113
121
|
"input",
|
|
114
122
|
{
|
|
115
|
-
ref:
|
|
123
|
+
ref: n,
|
|
116
124
|
type: "text",
|
|
117
|
-
className: "flex-1 min-w-[50px] border-none p-0 focus:ring-0 text-sm outline-none h-full",
|
|
118
|
-
value:
|
|
119
|
-
onChange: (
|
|
120
|
-
|
|
125
|
+
className: "flex-1 min-w-[50px] border-none p-0 focus:ring-0 text-sm outline-none h-full bg-transparent",
|
|
126
|
+
value: P,
|
|
127
|
+
onChange: (e) => {
|
|
128
|
+
T(e.target.value);
|
|
121
129
|
},
|
|
122
|
-
onClick: (
|
|
123
|
-
autoFocus:
|
|
124
|
-
name:
|
|
130
|
+
onClick: (e) => e.stopPropagation(),
|
|
131
|
+
autoFocus: y,
|
|
132
|
+
name: z || void 0
|
|
125
133
|
}
|
|
126
134
|
) : null
|
|
127
135
|
]
|
|
128
136
|
}
|
|
129
137
|
),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
|
|
132
|
-
"
|
|
138
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1 text-content-icon shrink-0", children: !o && (v || N) ? /* @__PURE__ */ t(K, { size: "14px" }) : /* @__PURE__ */ c(H, { children: [
|
|
139
|
+
E ? /* @__PURE__ */ t(
|
|
140
|
+
"span",
|
|
133
141
|
{
|
|
134
|
-
|
|
142
|
+
role: "presentation",
|
|
135
143
|
"data-clear-button": !0,
|
|
136
144
|
"aria-label": "Clear selection",
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
className: "hover:text-content-secondary p-0.5 cursor-pointer z-10 relative inline-flex",
|
|
146
|
+
onPointerDown: (e) => {
|
|
147
|
+
e.preventDefault(), e.stopPropagation(), B(e);
|
|
139
148
|
},
|
|
140
|
-
|
|
141
|
-
children: /* @__PURE__ */ e(K, { size: "11px", className: "text-content-muted" })
|
|
149
|
+
children: /* @__PURE__ */ t(Q, { size: "11px", className: "text-content-icon" })
|
|
142
150
|
}
|
|
143
151
|
) : null,
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
152
|
+
/* @__PURE__ */ t(
|
|
153
|
+
U,
|
|
146
154
|
{
|
|
147
|
-
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
t.preventDefault(), t.stopPropagation(), p(!r);
|
|
153
|
-
},
|
|
154
|
-
className: "hover:text-content-secondary p-0.5 cursor-pointer z-10 relative border-0 bg-transparent",
|
|
155
|
-
children: /* @__PURE__ */ e(
|
|
156
|
-
Q,
|
|
157
|
-
{
|
|
158
|
-
size: "16px",
|
|
159
|
-
className: f(
|
|
160
|
-
"transition-transform duration-200",
|
|
161
|
-
r ? "-rotate-90" : "rotate-90"
|
|
162
|
-
)
|
|
163
|
-
}
|
|
155
|
+
size: "16px",
|
|
156
|
+
"aria-hidden": !0,
|
|
157
|
+
className: g(
|
|
158
|
+
"transition-transform duration-200 shrink-0",
|
|
159
|
+
o ? "-rotate-90" : "rotate-90"
|
|
164
160
|
)
|
|
165
161
|
}
|
|
166
162
|
)
|
|
@@ -169,6 +165,8 @@ function tt({
|
|
|
169
165
|
}
|
|
170
166
|
);
|
|
171
167
|
}
|
|
168
|
+
const M = J.forwardRef(_);
|
|
169
|
+
M.displayName = "SelectTrigger";
|
|
172
170
|
export {
|
|
173
|
-
|
|
171
|
+
M as SelectTrigger
|
|
174
172
|
};
|
|
@@ -5,15 +5,15 @@ import { ChevronRight as N, Checkmark as S } from "impact-nova-icons";
|
|
|
5
5
|
import { cn as w } from "../../../../lib/utils.js";
|
|
6
6
|
const $ = ({
|
|
7
7
|
parentOption: n,
|
|
8
|
-
isMulti:
|
|
8
|
+
isMulti: d,
|
|
9
9
|
isReadOnly: c,
|
|
10
10
|
isSelected: f,
|
|
11
11
|
getIndeterminateState: x,
|
|
12
12
|
getSelectedCount: v,
|
|
13
13
|
handleSelect: h
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
15
|
+
const u = "children" in n && Array.isArray(n.children) ? n.children : null;
|
|
16
|
+
if (!u) return null;
|
|
17
17
|
const i = String(n.value || "");
|
|
18
18
|
return /* @__PURE__ */ r(l.Root, { open: !0, children: [
|
|
19
19
|
/* @__PURE__ */ t(l.Anchor, { className: "absolute inset-0 pointer-events-none" }),
|
|
@@ -29,9 +29,9 @@ const $ = ({
|
|
|
29
29
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
30
30
|
onInteractOutside: (e) => e.preventDefault(),
|
|
31
31
|
onFocusOutside: (e) => e.preventDefault(),
|
|
32
|
-
className: "select-submenu-container z-
|
|
32
|
+
className: "select-submenu-container z-50 min-w-[180px] max-h-[300px] overflow-auto rounded-xl bg-canvas-elevated py-1 shadow-elevation-floating",
|
|
33
33
|
"data-component": "select-menu",
|
|
34
|
-
children:
|
|
34
|
+
children: u.map((e) => {
|
|
35
35
|
const a = f(e), g = x(e), o = e.isDisabled, m = v(e), s = "children" in e && Array.isArray(e.children) && e.children.length > 0, p = e.isParentSelectable !== !1, b = String(e.value || "");
|
|
36
36
|
return /* @__PURE__ */ r(
|
|
37
37
|
"div",
|
|
@@ -50,7 +50,7 @@ const $ = ({
|
|
|
50
50
|
"data-component": "select-option",
|
|
51
51
|
children: [
|
|
52
52
|
/* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
53
|
-
|
|
53
|
+
d && p && /* @__PURE__ */ t(
|
|
54
54
|
C,
|
|
55
55
|
{
|
|
56
56
|
checked: g ? "indeterminate" : a,
|
|
@@ -69,14 +69,14 @@ const $ = ({
|
|
|
69
69
|
children: e.label
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
s && m > 0 && /* @__PURE__ */ r("span", { className: "text-xs text-
|
|
72
|
+
s && m > 0 && /* @__PURE__ */ r("span", { className: "text-xs text-secondary-foreground font-medium", children: [
|
|
73
73
|
"(",
|
|
74
74
|
m,
|
|
75
75
|
")"
|
|
76
76
|
] })
|
|
77
77
|
] }),
|
|
78
78
|
s && /* @__PURE__ */ t(N, { size: "sm", className: "text-content-icon" }),
|
|
79
|
-
!
|
|
79
|
+
!d && a && !s && /* @__PURE__ */ t(S, { className: "h-4 w-4 text-brand" })
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
82
|
e.value
|
|
@@ -18,7 +18,7 @@ export interface UseSelectKeyboardHandlersParams {
|
|
|
18
18
|
handleSelectAll: () => void | Promise<void>;
|
|
19
19
|
openedViaKeyboardRef: MutableRefObject<boolean>;
|
|
20
20
|
searchInputRef: RefObject<HTMLInputElement | null>;
|
|
21
|
-
triggerRef: RefObject<
|
|
21
|
+
triggerRef: RefObject<HTMLButtonElement | null>;
|
|
22
22
|
}
|
|
23
23
|
export declare function useSelectKeyboardHandlers(params: UseSelectKeyboardHandlersParams): {
|
|
24
24
|
handleTriggerKeyDown: (e: ReactKeyboardEvent) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Option, PropsValue } from '../select.types';
|
|
2
|
+
export interface UseSelectValueStateParams<OptionType> {
|
|
3
|
+
value: PropsValue<OptionType> | undefined;
|
|
4
|
+
defaultValue: PropsValue<OptionType> | undefined;
|
|
5
|
+
isMulti: boolean;
|
|
6
|
+
onChange?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface UseSelectValueStateResult<OptionType> {
|
|
9
|
+
usesMenuSession: boolean;
|
|
10
|
+
currentValue: PropsValue<OptionType>;
|
|
11
|
+
setCurrentValue: (next: PropsValue<OptionType>) => void;
|
|
12
|
+
beginMenuSession: () => void;
|
|
13
|
+
endMenuSession: () => PropsValue<OptionType> | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Controlled selects without `onChange` keep edits in a menu session so
|
|
17
|
+
* `onMenuClose` can batch-commit without stale `value` props.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useSelectValueState<OptionType extends Option = Option>({ value, defaultValue, isMulti, onChange, }: UseSelectValueStateParams<OptionType>): UseSelectValueStateResult<OptionType>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState as i, useRef as v, useCallback as r } from "react";
|
|
2
|
+
import { cloneSelectValue as M } from "../utils/select.js";
|
|
3
|
+
function h({
|
|
4
|
+
value: c,
|
|
5
|
+
defaultValue: V,
|
|
6
|
+
isMulti: s,
|
|
7
|
+
onChange: f
|
|
8
|
+
}) {
|
|
9
|
+
const u = c !== void 0, e = u && f === void 0, [S, d] = i(
|
|
10
|
+
V ?? (s ? [] : null)
|
|
11
|
+
), [a, l] = i(null), o = v(null), t = u ? c : S, m = e && a !== null ? a : t, p = r(
|
|
12
|
+
(n) => {
|
|
13
|
+
if (!u) {
|
|
14
|
+
d(n);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
e && (o.current = n, l(n));
|
|
18
|
+
},
|
|
19
|
+
[u, e]
|
|
20
|
+
), C = r(() => {
|
|
21
|
+
if (!e)
|
|
22
|
+
return;
|
|
23
|
+
const n = M(t, s);
|
|
24
|
+
o.current = n, l(n);
|
|
25
|
+
}, [e, t, s]), b = r(() => {
|
|
26
|
+
if (!e)
|
|
27
|
+
return;
|
|
28
|
+
const n = o.current ?? t;
|
|
29
|
+
return o.current = null, l(null), n;
|
|
30
|
+
}, [e, t]);
|
|
31
|
+
return {
|
|
32
|
+
usesMenuSession: e,
|
|
33
|
+
currentValue: m,
|
|
34
|
+
setCurrentValue: p,
|
|
35
|
+
beginMenuSession: C,
|
|
36
|
+
endMenuSession: b
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
h as useSelectValueState
|
|
41
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Select as n } from "./select.js";
|
|
2
|
-
import { cx as r, getIndeterminateState as i, getLeafOptions as
|
|
2
|
+
import { cloneSelectValue as c, cx as r, getIndeterminateState as i, getLeafOptions as l, getSelectedCount as S, getSequence as a, isInvertedSelection as d, isOptionArray as g, isSelected as p } from "./utils/select.js";
|
|
3
3
|
export {
|
|
4
4
|
n as Select,
|
|
5
|
+
c as cloneSelectValue,
|
|
5
6
|
r as cx,
|
|
6
7
|
i as getIndeterminateState,
|
|
7
|
-
|
|
8
|
+
l as getLeafOptions,
|
|
8
9
|
S as getSelectedCount,
|
|
9
10
|
a as getSequence,
|
|
10
11
|
d as isInvertedSelection,
|
|
11
12
|
g as isOptionArray,
|
|
12
|
-
|
|
13
|
+
p as isSelected
|
|
13
14
|
};
|