@dmsi/wedgekit-react 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/chunk-27KIIUAR.js +59 -0
- package/dist/chunk-2G2E2JMA.js +123 -0
- package/dist/chunk-4C66DLIJ.js +51 -0
- package/dist/chunk-4RD5ZF2V.js +55 -0
- package/dist/chunk-4RJKB7LC.js +14 -0
- package/dist/chunk-4T7F5BZZ.js +26 -0
- package/dist/chunk-5GOBP2JS.js +53 -0
- package/dist/chunk-6ZY524ID.js +42 -0
- package/dist/chunk-AWQSSKCK.js +32 -0
- package/dist/chunk-BNHSAFMP.js +93 -0
- package/dist/chunk-BWRHL2AG.js +439 -0
- package/dist/chunk-DKKYR6DS.js +132 -0
- package/dist/chunk-E5ALT5W7.js +182 -0
- package/dist/chunk-FY7PTP6E.js +322 -0
- package/dist/chunk-GTCSRHPF.js +119 -0
- package/dist/chunk-I2UVVKQI.js +12 -0
- package/dist/chunk-IGQVA7SC.js +41 -0
- package/dist/chunk-K3IKUSZW.js +59 -0
- package/dist/chunk-KENSVWOY.js +151 -0
- package/dist/chunk-KX3O6GJ6.js +138 -0
- package/dist/chunk-L4UM372R.js +253 -0
- package/dist/chunk-ORMEWXMH.js +37 -0
- package/dist/chunk-Q3FKEKIN.js +23 -0
- package/dist/chunk-SEKKGFM6.js +28 -0
- package/dist/chunk-SY3HT54E.js +91 -0
- package/dist/chunk-TAW5ZZ4Z.js +346 -0
- package/dist/chunk-TRUPPHBQ.js +109 -0
- package/dist/chunk-TU55CHXU.js +30 -0
- package/dist/chunk-TWZZB4WO.js +114 -0
- package/dist/chunk-TYI74BSP.js +62 -0
- package/dist/chunk-U42SKNR6.js +104 -0
- package/dist/chunk-UU3FA6LV.js +72 -0
- package/dist/chunk-WVUIIBRR.js +51 -0
- package/dist/chunk-XUIPGYP5.js +39 -0
- package/dist/chunk-Z4UCFUF7.js +299 -0
- package/dist/components/Breadcrumbs.cjs +376 -0
- package/dist/components/Breadcrumbs.js +90 -0
- package/dist/components/Button.cjs +319 -0
- package/dist/components/Button.js +8 -0
- package/dist/components/CalendarRange.cjs +520 -0
- package/dist/components/CalendarRange.js +13 -0
- package/dist/components/Caption.cjs +283 -0
- package/dist/components/Caption.js +80 -0
- package/dist/components/Checkbox.cjs +378 -0
- package/dist/components/Checkbox.js +11 -0
- package/dist/components/ContentTab.cjs +382 -0
- package/dist/components/ContentTab.js +10 -0
- package/dist/components/ContentTabs.cjs +472 -0
- package/dist/components/ContentTabs.js +98 -0
- package/dist/components/DMSiLogo.cjs +79 -0
- package/dist/components/DMSiLogo.js +56 -0
- package/dist/components/DataGrid.cjs +3113 -0
- package/dist/components/DataGrid.js +758 -0
- package/dist/components/DataGridCell.cjs +1907 -0
- package/dist/components/DataGridCell.js +24 -0
- package/dist/components/DataTable.cjs +791 -0
- package/dist/components/DataTable.js +720 -0
- package/dist/components/DateInput.cjs +1130 -0
- package/dist/components/DateInput.js +170 -0
- package/dist/components/DateRangeInput.cjs +1131 -0
- package/dist/components/DateRangeInput.js +171 -0
- package/dist/components/DebugJson.cjs +50 -0
- package/dist/components/DebugJson.js +27 -0
- package/dist/components/Display.cjs +234 -0
- package/dist/components/Display.js +12 -0
- package/dist/components/EditingContext.cjs +73 -0
- package/dist/components/EditingContext.js +35 -0
- package/dist/components/FilterGroup.cjs +1431 -0
- package/dist/components/FilterGroup.js +231 -0
- package/dist/components/FullViewportBox.cjs +35 -0
- package/dist/components/FullViewportBox.js +12 -0
- package/dist/components/Grid.cjs +69 -0
- package/dist/components/Grid.js +36 -0
- package/dist/components/GridContainer.cjs +125 -0
- package/dist/components/GridContainer.js +92 -0
- package/dist/components/Heading.cjs +238 -0
- package/dist/components/Heading.js +14 -0
- package/dist/components/HorizontalDivider.cjs +33 -0
- package/dist/components/HorizontalDivider.js +10 -0
- package/dist/components/Icon.cjs +98 -0
- package/dist/components/Icon.js +7 -0
- package/dist/components/Input.cjs +672 -0
- package/dist/components/Input.js +21 -0
- package/dist/components/InputGroup.cjs +270 -0
- package/dist/components/InputGroup.js +60 -0
- package/dist/components/Label.cjs +223 -0
- package/dist/components/Label.js +8 -0
- package/dist/components/Link.cjs +262 -0
- package/dist/components/Link.js +8 -0
- package/dist/components/List.cjs +37 -0
- package/dist/components/List.js +14 -0
- package/dist/components/LiveChatComponent.cjs +63 -0
- package/dist/components/LiveChatComponent.js +40 -0
- package/dist/components/LogoAgilityTopBar.cjs +115 -0
- package/dist/components/LogoAgilityTopBar.js +92 -0
- package/dist/components/LogoDMSiTopBar.cjs +79 -0
- package/dist/components/LogoDMSiTopBar.js +7 -0
- package/dist/components/LogoMillworkTopBar.cjs +221 -0
- package/dist/components/LogoMillworkTopBar.js +198 -0
- package/dist/components/MainBar.cjs +211 -0
- package/dist/components/MainBar.js +65 -0
- package/dist/components/Menu.cjs +437 -0
- package/dist/components/Menu.js +11 -0
- package/dist/components/MenuOption.cjs +483 -0
- package/dist/components/MenuOption.js +13 -0
- package/dist/components/MobileDataGrid.cjs +658 -0
- package/dist/components/MobileDataGrid.js +125 -0
- package/dist/components/Modal.cjs +783 -0
- package/dist/components/Modal.js +245 -0
- package/dist/components/ModalButtons.cjs +385 -0
- package/dist/components/ModalButtons.js +10 -0
- package/dist/components/ModalContent.cjs +57 -0
- package/dist/components/ModalContent.js +7 -0
- package/dist/components/ModalHeader.cjs +426 -0
- package/dist/components/ModalHeader.js +11 -0
- package/dist/components/ModalScrim.cjs +64 -0
- package/dist/components/ModalScrim.js +7 -0
- package/dist/components/NavigationTab.cjs +431 -0
- package/dist/components/NavigationTab.js +10 -0
- package/dist/components/NavigationTabs.cjs +477 -0
- package/dist/components/NavigationTabs.js +56 -0
- package/dist/components/Notification.cjs +640 -0
- package/dist/components/Notification.js +117 -0
- package/dist/components/OptionPill.cjs +478 -0
- package/dist/components/OptionPill.js +11 -0
- package/dist/components/Paragraph.cjs +231 -0
- package/dist/components/Paragraph.js +8 -0
- package/dist/components/Password.cjs +700 -0
- package/dist/components/Password.js +53 -0
- package/dist/components/ProjectBar.cjs +242 -0
- package/dist/components/ProjectBar.js +63 -0
- package/dist/components/Radio.cjs +349 -0
- package/dist/components/Radio.js +131 -0
- package/dist/components/Search.cjs +767 -0
- package/dist/components/Search.js +12 -0
- package/dist/components/Select.cjs +758 -0
- package/dist/components/Select.js +12 -0
- package/dist/components/SideMenu.cjs +54 -0
- package/dist/components/SideMenu.js +21 -0
- package/dist/components/SideMenuGroup.cjs +422 -0
- package/dist/components/SideMenuGroup.js +83 -0
- package/dist/components/SideMenuItem.cjs +388 -0
- package/dist/components/SideMenuItem.js +70 -0
- package/dist/components/Stack.cjs +138 -0
- package/dist/components/Stack.js +7 -0
- package/dist/components/StatusPill.cjs +265 -0
- package/dist/components/StatusPill.js +52 -0
- package/dist/components/Stepper.cjs +885 -0
- package/dist/components/Stepper.js +105 -0
- package/dist/components/Subheader.cjs +226 -0
- package/dist/components/Subheader.js +8 -0
- package/dist/components/Surface.cjs +98 -0
- package/dist/components/Surface.js +40 -0
- package/dist/components/Swatch.cjs +1728 -0
- package/dist/components/Swatch.js +1319 -0
- package/dist/components/Textarea.cjs +269 -0
- package/dist/components/Textarea.js +96 -0
- package/dist/components/Theme.cjs +36 -0
- package/dist/components/Theme.js +7 -0
- package/dist/components/Time.cjs +1118 -0
- package/dist/components/Time.js +353 -0
- package/dist/components/Toast.cjs +644 -0
- package/dist/components/Toast.js +218 -0
- package/dist/components/Tooltip.cjs +273 -0
- package/dist/components/Tooltip.js +9 -0
- package/dist/components/TopBar.cjs +352 -0
- package/dist/components/TopBar.js +132 -0
- package/dist/components/useInfiniteScroll.cjs +57 -0
- package/dist/components/useInfiniteScroll.js +8 -0
- package/dist/components/useMatchesMedia.cjs +53 -0
- package/dist/components/useMatchesMedia.js +9 -0
- package/dist/components/useMenuSystem.cjs +358 -0
- package/dist/components/useMenuSystem.js +11 -0
- package/dist/components/useMounted.cjs +39 -0
- package/dist/components/useMounted.js +8 -0
- package/dist/fonts.css +21 -0
- package/dist/icons-light[FILL]-PPZXOLWS.woff2 +0 -0
- package/dist/icons-normal[FILL]-PPZXOLWS.woff2 +0 -0
- package/dist/index.css +4401 -0
- package/dist/open-sans-55T6A4JE.woff2 +0 -0
- package/dist/types.cjs +18 -0
- package/dist/types.js +0 -0
- package/package.json +66 -0
- package/src/brand.css +125 -0
- package/src/classNames.ts +144 -0
- package/src/components/Breadcrumbs.tsx +116 -0
- package/src/components/Button.tsx +210 -0
- package/src/components/CalendarRange.tsx +429 -0
- package/src/components/Caption.tsx +101 -0
- package/src/components/Checkbox.tsx +196 -0
- package/src/components/ContentTab.tsx +66 -0
- package/src/components/ContentTabs.tsx +103 -0
- package/src/components/DMSiLogo.tsx +32 -0
- package/src/components/DataGrid.tsx +948 -0
- package/src/components/DataGridCell.tsx +384 -0
- package/src/components/DataTable.tsx +835 -0
- package/src/components/DateInput.tsx +188 -0
- package/src/components/DateRangeInput.tsx +179 -0
- package/src/components/DebugJson.tsx +24 -0
- package/src/components/Display.tsx +60 -0
- package/src/components/EditingContext.tsx +40 -0
- package/src/components/FilterGroup.tsx +234 -0
- package/src/components/FullViewportBox.tsx +11 -0
- package/src/components/Grid.tsx +75 -0
- package/src/components/GridContainer.tsx +124 -0
- package/src/components/Heading.tsx +66 -0
- package/src/components/HorizontalDivider.tsx +3 -0
- package/src/components/Icon.tsx +36 -0
- package/src/components/Input.tsx +511 -0
- package/src/components/InputGroup.tsx +51 -0
- package/src/components/Label.tsx +40 -0
- package/src/components/Link.tsx +106 -0
- package/src/components/List.tsx +10 -0
- package/src/components/LiveChatComponent.tsx +56 -0
- package/src/components/LogoAgilityTopBar.tsx +53 -0
- package/src/components/LogoDMSiTopBar.tsx +32 -0
- package/src/components/LogoMillworkTopBar.tsx +118 -0
- package/src/components/MainBar.tsx +83 -0
- package/src/components/Menu.tsx +286 -0
- package/src/components/MenuOption.tsx +275 -0
- package/src/components/MobileDataGrid.tsx +135 -0
- package/src/components/Modal.tsx +271 -0
- package/src/components/ModalButtons.tsx +44 -0
- package/src/components/ModalContent.tsx +23 -0
- package/src/components/ModalHeader.tsx +41 -0
- package/src/components/ModalScrim.tsx +35 -0
- package/src/components/NavigationTab.tsx +89 -0
- package/src/components/NavigationTabs.tsx +63 -0
- package/src/components/Notification.tsx +120 -0
- package/src/components/OptionPill.tsx +114 -0
- package/src/components/Paragraph.tsx +49 -0
- package/src/components/Password.tsx +46 -0
- package/src/components/ProjectBar.tsx +76 -0
- package/src/components/Radio.tsx +140 -0
- package/src/components/Search.tsx +129 -0
- package/src/components/Select.tsx +104 -0
- package/src/components/SideMenu.tsx +21 -0
- package/src/components/SideMenuGroup.tsx +81 -0
- package/src/components/SideMenuItem.tsx +90 -0
- package/src/components/Stack.tsx +179 -0
- package/src/components/StatusPill.tsx +51 -0
- package/src/components/Stepper.tsx +91 -0
- package/src/components/Subheader.tsx +44 -0
- package/src/components/Surface.tsx +34 -0
- package/src/components/Swatch.tsx +1066 -0
- package/src/components/Textarea.tsx +101 -0
- package/src/components/Theme.tsx +13 -0
- package/src/components/Time.tsx +438 -0
- package/src/components/Toast.tsx +244 -0
- package/src/components/Tooltip.tsx +137 -0
- package/src/components/TopBar.tsx +124 -0
- package/src/components/useInfiniteScroll.tsx +40 -0
- package/src/components/useMatchesMedia.tsx +28 -0
- package/src/components/useMenuSystem.tsx +367 -0
- package/src/components/useMounted.tsx +14 -0
- package/src/darkmode.css +140 -0
- package/src/fonts.css +23 -0
- package/src/index.css +509 -0
- package/src/index.tsx +2 -0
- package/src/types.ts +149 -0
- package/src/utils/formatting.tsx +81 -0
- package/src/utils.ts +23 -0
|
@@ -0,0 +1,1907 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
var __objRest = (source, exclude) => {
|
|
27
|
+
var target = {};
|
|
28
|
+
for (var prop in source)
|
|
29
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
if (source != null && __getOwnPropSymbols)
|
|
32
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
+
target[prop] = source[prop];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
var __export = (target, all) => {
|
|
39
|
+
for (var name in all)
|
|
40
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
41
|
+
};
|
|
42
|
+
var __copyProps = (to, from, except, desc) => {
|
|
43
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
44
|
+
for (let key of __getOwnPropNames(from))
|
|
45
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
46
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
47
|
+
}
|
|
48
|
+
return to;
|
|
49
|
+
};
|
|
50
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
51
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
52
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
53
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
54
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
55
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
56
|
+
mod
|
|
57
|
+
));
|
|
58
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
59
|
+
|
|
60
|
+
// src/components/DataGridCell.tsx
|
|
61
|
+
var DataGridCell_exports = {};
|
|
62
|
+
__export(DataGridCell_exports, {
|
|
63
|
+
DataGridCell: () => DataGridCell,
|
|
64
|
+
DragAlongCell: () => DragAlongCell,
|
|
65
|
+
DraggableCellHeader: () => DraggableCellHeader
|
|
66
|
+
});
|
|
67
|
+
module.exports = __toCommonJS(DataGridCell_exports);
|
|
68
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
69
|
+
|
|
70
|
+
// ../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js
|
|
71
|
+
var import_react = require("react");
|
|
72
|
+
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
73
|
+
var CSS = /* @__PURE__ */ Object.freeze({
|
|
74
|
+
Translate: {
|
|
75
|
+
toString(transform) {
|
|
76
|
+
if (!transform) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const {
|
|
80
|
+
x,
|
|
81
|
+
y
|
|
82
|
+
} = transform;
|
|
83
|
+
return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)";
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
Scale: {
|
|
87
|
+
toString(transform) {
|
|
88
|
+
if (!transform) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const {
|
|
92
|
+
scaleX,
|
|
93
|
+
scaleY
|
|
94
|
+
} = transform;
|
|
95
|
+
return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
Transform: {
|
|
99
|
+
toString(transform) {
|
|
100
|
+
if (!transform) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
Transition: {
|
|
107
|
+
toString(_ref) {
|
|
108
|
+
let {
|
|
109
|
+
property,
|
|
110
|
+
duration,
|
|
111
|
+
easing
|
|
112
|
+
} = _ref;
|
|
113
|
+
return property + " " + duration + "ms " + easing;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// src/components/DataGridCell.tsx
|
|
119
|
+
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
120
|
+
var import_react8 = require("react");
|
|
121
|
+
|
|
122
|
+
// src/classNames.ts
|
|
123
|
+
var import_clsx = __toESM(require("clsx"), 1);
|
|
124
|
+
var typography = {
|
|
125
|
+
display1: (0, import_clsx.default)(
|
|
126
|
+
"font-sans font-semibold",
|
|
127
|
+
"text-display-1-mobile desktop:text-display-1-desktop compact:text-display-1-desktop-compact",
|
|
128
|
+
"leading-display-1-mobile desktop:leading-display-1-desktop"
|
|
129
|
+
),
|
|
130
|
+
display2: (0, import_clsx.default)(
|
|
131
|
+
"font-sans font-bold",
|
|
132
|
+
"text-display-2-mobile desktop:text-display-2-desktop compact:text-display-2-desktop-compact",
|
|
133
|
+
"leading-display-2-mobile desktop:leading-display-2-desktop"
|
|
134
|
+
),
|
|
135
|
+
heading1: (0, import_clsx.default)(
|
|
136
|
+
"font-sans font-semibold",
|
|
137
|
+
"text-heading-1-mobile desktop:text-heading-1-desktop compact:text-heading-1-desktop-compact",
|
|
138
|
+
"leading-heading-1-mobile desktop:leading-heading-1-desktop"
|
|
139
|
+
),
|
|
140
|
+
heading2: (0, import_clsx.default)(
|
|
141
|
+
"font-sans font-normal",
|
|
142
|
+
"text-heading-2-mobile desktop:text-heading-2-desktop compact:text-heading-2-desktop-compact",
|
|
143
|
+
"leading-heading-2-mobile desktop:leading-heading-2-desktop"
|
|
144
|
+
),
|
|
145
|
+
heading3: (0, import_clsx.default)(
|
|
146
|
+
"font-sans font-semibold",
|
|
147
|
+
"text-heading-3-mobile desktop:text-heading-3-desktop compact:text-heading-3-desktop-compact",
|
|
148
|
+
"leading-heading-3-mobile desktop:leading-heading-3-desktop"
|
|
149
|
+
),
|
|
150
|
+
subheader: (0, import_clsx.default)(
|
|
151
|
+
"font-sans font-semibold",
|
|
152
|
+
"text-subheader-mobile desktop:text-subheader-desktop compact:text-subheader-desktop-compact",
|
|
153
|
+
"leading-subheader-mobile desktop:leading-subheader-desktop"
|
|
154
|
+
),
|
|
155
|
+
link: (0, import_clsx.default)(
|
|
156
|
+
"font-sans font-normal",
|
|
157
|
+
"text-link-mobile desktop:text-link-desktop compact:text-link-desktop-compact",
|
|
158
|
+
"leading-link-mobile desktop:leading-link-desktop"
|
|
159
|
+
),
|
|
160
|
+
buttonLabel: (0, import_clsx.default)(
|
|
161
|
+
"font-sans font-semibold",
|
|
162
|
+
"text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
|
|
163
|
+
"leading-label-mobile desktop:leading-label-desktop"
|
|
164
|
+
),
|
|
165
|
+
label: (0, import_clsx.default)(
|
|
166
|
+
"font-sans font-semibold",
|
|
167
|
+
"text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
|
|
168
|
+
"leading-label-mobile desktop:leading-label-desktop"
|
|
169
|
+
),
|
|
170
|
+
paragraph: (0, import_clsx.default)(
|
|
171
|
+
"font-sans font-normal",
|
|
172
|
+
"text-paragraph-mobile desktop:text-paragraph-desktop compact:text-paragraph-desktop-compact",
|
|
173
|
+
"leading-paragraph-mobile desktop:leading-paragraph-desktop"
|
|
174
|
+
),
|
|
175
|
+
caption: (0, import_clsx.default)(
|
|
176
|
+
"font-sans font-normal",
|
|
177
|
+
"text-caption-mobile desktop:text-caption-desktop compact:text-caption-desktop-compact",
|
|
178
|
+
"leading-caption-mobile desktop:leading-caption-desktop"
|
|
179
|
+
)
|
|
180
|
+
};
|
|
181
|
+
var baseTransition = (0, import_clsx.default)(
|
|
182
|
+
"transition-colors duration-100 ease-in-out"
|
|
183
|
+
);
|
|
184
|
+
var componentGap = (0, import_clsx.default)(
|
|
185
|
+
"gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-desktop-compact-component-gap"
|
|
186
|
+
);
|
|
187
|
+
var paddingUsingComponentGap = (0, import_clsx.default)(
|
|
188
|
+
"p-mobile-component-gap desktop:p-desktop-component-gap compact:p-desktop-compact-component-gap"
|
|
189
|
+
);
|
|
190
|
+
var paddingYUsingLayoutGroupGap = (0, import_clsx.default)(
|
|
191
|
+
"py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
|
|
192
|
+
);
|
|
193
|
+
var componentPadding = (0, import_clsx.default)(
|
|
194
|
+
"p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding"
|
|
195
|
+
);
|
|
196
|
+
var componentPaddingBottom = (0, import_clsx.default)(
|
|
197
|
+
"pb-mobile-component-padding desktop:pb-desktop-component-padding compact:pb-desktop-compact-component-padding"
|
|
198
|
+
);
|
|
199
|
+
var componentPaddingY = (0, import_clsx.default)(
|
|
200
|
+
"py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding"
|
|
201
|
+
);
|
|
202
|
+
var componentPaddingXUsingComponentGap = (0, import_clsx.default)(
|
|
203
|
+
"px-mobile-component-gap desktop:px-desktop-component-gap compact:px-desktop-compact-component-gap"
|
|
204
|
+
);
|
|
205
|
+
var componentPaddingYUsingComponentGap = (0, import_clsx.default)(
|
|
206
|
+
"py-mobile-component-gap desktop:py-desktop-component-gap compact:py-desktop-compact-component-gap"
|
|
207
|
+
);
|
|
208
|
+
var componentPaddingMinusBorder = (0, import_clsx.default)(
|
|
209
|
+
"p-[calc(var(--spacing-mobile-component-padding)_-_1px)] desktop:p-[calc(var(--spacing-desktop-component-padding)_-_1px)] compact:p-[calc(var(--spacing-desktop-compact-component-padding)_-_1px)]"
|
|
210
|
+
);
|
|
211
|
+
var componentPaddingMinus2pxBorder = (0, import_clsx.default)(
|
|
212
|
+
"p-[calc(var(--spacing-mobile-component-padding)_-_2px)] desktop:p-[calc(var(--spacing-desktop-component-padding)_-_2px)] compact:p-[calc(var(--spacing-desktop-compact-component-padding)_-_2px)]"
|
|
213
|
+
);
|
|
214
|
+
var layoutPaddingBottom = (0, import_clsx.default)(
|
|
215
|
+
"pb-mobile-layout-padding desktop:pb-desktop-layout-padding compact:pb-desktop-compact-layout-padding"
|
|
216
|
+
);
|
|
217
|
+
var layoutPaddingY = (0, import_clsx.default)(
|
|
218
|
+
"py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding"
|
|
219
|
+
);
|
|
220
|
+
var containerPaddingX = (0, import_clsx.default)(
|
|
221
|
+
"px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding"
|
|
222
|
+
);
|
|
223
|
+
var containerPaddingY = (0, import_clsx.default)(
|
|
224
|
+
"py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding"
|
|
225
|
+
);
|
|
226
|
+
var layoutGroupGapPaddingY = (0, import_clsx.default)(
|
|
227
|
+
"py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
|
|
228
|
+
);
|
|
229
|
+
var layoutGroupGap = (0, import_clsx.default)(
|
|
230
|
+
"gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-desktop-compact-layout-group-gap"
|
|
231
|
+
);
|
|
232
|
+
var layoutGap = (0, import_clsx.default)(
|
|
233
|
+
"gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-desktop-compact-layout-gap"
|
|
234
|
+
);
|
|
235
|
+
var gapUsingContainerPadding = (0, import_clsx.default)(
|
|
236
|
+
"gap-mobile-container-padding desktop:gap-desktop-container-padding compact:gap-desktop-compact-container-padding"
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
// src/components/Icon.tsx
|
|
240
|
+
var import_clsx2 = __toESM(require("clsx"), 1);
|
|
241
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
242
|
+
function Icon(_a) {
|
|
243
|
+
var _b = _a, {
|
|
244
|
+
name,
|
|
245
|
+
size = 24,
|
|
246
|
+
variant = "outline"
|
|
247
|
+
} = _b, props = __objRest(_b, [
|
|
248
|
+
"name",
|
|
249
|
+
"size",
|
|
250
|
+
"variant"
|
|
251
|
+
]);
|
|
252
|
+
const variantStyle = variant === "filled" ? '"FILL" 1' : '"FILL" 0';
|
|
253
|
+
const weightStyle = size === 16 ? '"wght" 400' : '"wght" 300';
|
|
254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
255
|
+
"span",
|
|
256
|
+
__spreadProps(__spreadValues({}, props), {
|
|
257
|
+
className: (0, import_clsx2.default)(
|
|
258
|
+
"icon",
|
|
259
|
+
`icon-${size}`,
|
|
260
|
+
// size === 16 ? "font-normal" : "font-light", // size 16 font weight is not working as normal from before
|
|
261
|
+
props.className
|
|
262
|
+
),
|
|
263
|
+
style: __spreadValues({
|
|
264
|
+
fontVariationSettings: variantStyle + `, ${weightStyle}`
|
|
265
|
+
}, props.style),
|
|
266
|
+
children: name
|
|
267
|
+
})
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// src/components/Search.tsx
|
|
272
|
+
var import_react3 = require("react");
|
|
273
|
+
|
|
274
|
+
// src/components/Input.tsx
|
|
275
|
+
var import_react2 = require("react");
|
|
276
|
+
var import_clsx4 = __toESM(require("clsx"), 1);
|
|
277
|
+
|
|
278
|
+
// src/components/Label.tsx
|
|
279
|
+
var import_clsx3 = __toESM(require("clsx"), 1);
|
|
280
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
281
|
+
var Label = (_a) => {
|
|
282
|
+
var _b = _a, {
|
|
283
|
+
as = "span",
|
|
284
|
+
padded,
|
|
285
|
+
className,
|
|
286
|
+
color,
|
|
287
|
+
align
|
|
288
|
+
} = _b, props = __objRest(_b, [
|
|
289
|
+
"as",
|
|
290
|
+
"padded",
|
|
291
|
+
"className",
|
|
292
|
+
"color",
|
|
293
|
+
"align"
|
|
294
|
+
]);
|
|
295
|
+
const Element = as;
|
|
296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
297
|
+
Element,
|
|
298
|
+
__spreadProps(__spreadValues({
|
|
299
|
+
className: (0, import_clsx3.default)(
|
|
300
|
+
typography.label,
|
|
301
|
+
align === "left" && "text-left",
|
|
302
|
+
align === "center" && "text-center",
|
|
303
|
+
align === "right" && "text-right",
|
|
304
|
+
className,
|
|
305
|
+
padded && componentPaddingXUsingComponentGap
|
|
306
|
+
)
|
|
307
|
+
}, props), {
|
|
308
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
309
|
+
color: color ? `var(--color-${color})` : void 0
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
);
|
|
313
|
+
};
|
|
314
|
+
Label.displayName = "Label";
|
|
315
|
+
|
|
316
|
+
// src/utils/formatting.tsx
|
|
317
|
+
function getDecimalPlaceholder(decimals) {
|
|
318
|
+
if (!decimals || decimals <= 0) {
|
|
319
|
+
return {};
|
|
320
|
+
}
|
|
321
|
+
return {
|
|
322
|
+
placeholder: `0.${"0".repeat(decimals)}`
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function formatDecimalValue(value, decimals) {
|
|
326
|
+
if (!value || value === "") {
|
|
327
|
+
return "";
|
|
328
|
+
}
|
|
329
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
330
|
+
if (isNaN(numValue)) {
|
|
331
|
+
return "";
|
|
332
|
+
}
|
|
333
|
+
if (!decimals || decimals <= 0) {
|
|
334
|
+
return String(Math.round(numValue));
|
|
335
|
+
}
|
|
336
|
+
return numValue.toFixed(decimals);
|
|
337
|
+
}
|
|
338
|
+
function formatCurrencyDisplay(value) {
|
|
339
|
+
if (!value || value === "") {
|
|
340
|
+
return "";
|
|
341
|
+
}
|
|
342
|
+
const parts = value.split(".");
|
|
343
|
+
const integerPart = parts[0];
|
|
344
|
+
const decimalPart = parts[1];
|
|
345
|
+
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
346
|
+
return decimalPart !== void 0 ? `${formattedInteger}.${decimalPart}` : formattedInteger;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// src/components/Input.tsx
|
|
350
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
351
|
+
var InputBase = (_a) => {
|
|
352
|
+
var _b = _a, {
|
|
353
|
+
before,
|
|
354
|
+
after,
|
|
355
|
+
type,
|
|
356
|
+
label,
|
|
357
|
+
error,
|
|
358
|
+
className,
|
|
359
|
+
align = "left",
|
|
360
|
+
caption,
|
|
361
|
+
required,
|
|
362
|
+
selectOnFocus,
|
|
363
|
+
removeRoundness,
|
|
364
|
+
inputContainerRef,
|
|
365
|
+
removeBorder,
|
|
366
|
+
wrapperClassName,
|
|
367
|
+
focus
|
|
368
|
+
} = _b, props = __objRest(_b, [
|
|
369
|
+
"before",
|
|
370
|
+
"after",
|
|
371
|
+
"type",
|
|
372
|
+
"label",
|
|
373
|
+
"error",
|
|
374
|
+
"className",
|
|
375
|
+
"align",
|
|
376
|
+
"caption",
|
|
377
|
+
"required",
|
|
378
|
+
"selectOnFocus",
|
|
379
|
+
"removeRoundness",
|
|
380
|
+
"inputContainerRef",
|
|
381
|
+
"removeBorder",
|
|
382
|
+
"wrapperClassName",
|
|
383
|
+
"focus"
|
|
384
|
+
]);
|
|
385
|
+
const attributes = {
|
|
386
|
+
"data-error": error && !focus || null,
|
|
387
|
+
"data-focus": focus || null
|
|
388
|
+
};
|
|
389
|
+
const inputRef = (0, import_react2.useRef)(null);
|
|
390
|
+
(0, import_react2.useEffect)(() => {
|
|
391
|
+
var _a2;
|
|
392
|
+
const input = inputRef.current;
|
|
393
|
+
const focusHandler = () => {
|
|
394
|
+
input == null ? void 0 : input.select();
|
|
395
|
+
};
|
|
396
|
+
if (selectOnFocus) {
|
|
397
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.addEventListener("focus", focusHandler);
|
|
398
|
+
return () => {
|
|
399
|
+
input == null ? void 0 : input.removeEventListener("focus", focusHandler);
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
}, [selectOnFocus]);
|
|
403
|
+
const inputBaseClass = (0, import_clsx4.default)(
|
|
404
|
+
"w-full",
|
|
405
|
+
"flex flex-row items-center",
|
|
406
|
+
"bg-background-action-secondary-normal caret-icon-on-action-secondary-normal",
|
|
407
|
+
componentGap,
|
|
408
|
+
baseTransition,
|
|
409
|
+
"outline-transparent outline-2 -outline-offset-2",
|
|
410
|
+
componentPaddingMinusBorder,
|
|
411
|
+
!removeRoundness && "rounded-base",
|
|
412
|
+
!removeBorder && "border border-border-primary-normal",
|
|
413
|
+
"relative"
|
|
414
|
+
);
|
|
415
|
+
const inputFocusClass = (0, import_clsx4.default)(
|
|
416
|
+
"has-[[data-focus]]:border-transparent has-[[data-focus]]:outline-border-primary-focus focus-within:border-transparent focus-within:outline-border-primary-focus"
|
|
417
|
+
);
|
|
418
|
+
const inputDisabledClass = (0, import_clsx4.default)(
|
|
419
|
+
"has-disabled:bg-background-action-secondary-disabled"
|
|
420
|
+
);
|
|
421
|
+
const inputReadOnlyClass = (0, import_clsx4.default)(
|
|
422
|
+
"has-[input:not(:disabled):read-only]:outline-none has-[input:not(:disabled):read-only]:bg-transparent has-[input:not(:disabled):read-only]:border-transparent has-[input:not(:disabled):read-only]:pl-0"
|
|
423
|
+
);
|
|
424
|
+
const inputInvalidClass = (0, import_clsx4.default)(
|
|
425
|
+
"has-[[data-error]]:border-transparent has-[[data-error]]:not-focus-within:outline-border-primary-error has-[[data-error]]:not-focus-within:outline-1"
|
|
426
|
+
);
|
|
427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
428
|
+
"label",
|
|
429
|
+
{
|
|
430
|
+
ref: inputContainerRef,
|
|
431
|
+
className: (0, import_clsx4.default)(
|
|
432
|
+
"w-full flex flex-col",
|
|
433
|
+
"block",
|
|
434
|
+
"text-text-primary-normal has-disabled:text-text-primary-disabled",
|
|
435
|
+
componentGap
|
|
436
|
+
),
|
|
437
|
+
style: __spreadValues({}, props.style),
|
|
438
|
+
children: [
|
|
439
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx4.default)("flex items-center", componentGap), children: [
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
441
|
+
Label,
|
|
442
|
+
{
|
|
443
|
+
className: (0, import_clsx4.default)(
|
|
444
|
+
props.disabled || props.readOnly ? "cursor-default" : "cursor-pointer"
|
|
445
|
+
),
|
|
446
|
+
children: label
|
|
447
|
+
}
|
|
448
|
+
),
|
|
449
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
450
|
+
"span",
|
|
451
|
+
{
|
|
452
|
+
className: (0, import_clsx4.default)(typography.label, "text-text-critical-normal"),
|
|
453
|
+
children: "*"
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
] }),
|
|
457
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
className: (0, import_clsx4.default)(
|
|
461
|
+
inputBaseClass,
|
|
462
|
+
!props.disabled && inputInvalidClass,
|
|
463
|
+
inputFocusClass,
|
|
464
|
+
inputDisabledClass,
|
|
465
|
+
inputReadOnlyClass,
|
|
466
|
+
wrapperClassName
|
|
467
|
+
),
|
|
468
|
+
children: [
|
|
469
|
+
before,
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
471
|
+
"input",
|
|
472
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
473
|
+
ref: (el) => {
|
|
474
|
+
inputRef.current = el;
|
|
475
|
+
},
|
|
476
|
+
type,
|
|
477
|
+
required
|
|
478
|
+
}, props), attributes), {
|
|
479
|
+
id: props.id,
|
|
480
|
+
className: (0, import_clsx4.default)(
|
|
481
|
+
"flex-1 outline-none w-full max-w-full min-h-6 min-w-0",
|
|
482
|
+
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
483
|
+
"placeholder:text-text-secondary-normal disabled:text-text-secondary-disabled",
|
|
484
|
+
align === "right" && "text-right",
|
|
485
|
+
align === "center" && "text-center",
|
|
486
|
+
componentPaddingXUsingComponentGap,
|
|
487
|
+
typography.paragraph,
|
|
488
|
+
className,
|
|
489
|
+
props.readOnly && !props.disabled && "!px-0"
|
|
490
|
+
)
|
|
491
|
+
})
|
|
492
|
+
),
|
|
493
|
+
after
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
caption
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
);
|
|
501
|
+
};
|
|
502
|
+
var Input = (_a) => {
|
|
503
|
+
var _b = _a, {
|
|
504
|
+
variant = "default",
|
|
505
|
+
decimals,
|
|
506
|
+
uom,
|
|
507
|
+
removeSearchIcon,
|
|
508
|
+
value: propValue,
|
|
509
|
+
onChange,
|
|
510
|
+
onBlur,
|
|
511
|
+
onClear
|
|
512
|
+
} = _b, props = __objRest(_b, [
|
|
513
|
+
"variant",
|
|
514
|
+
"decimals",
|
|
515
|
+
"uom",
|
|
516
|
+
"removeSearchIcon",
|
|
517
|
+
"value",
|
|
518
|
+
"onChange",
|
|
519
|
+
"onBlur",
|
|
520
|
+
"onClear"
|
|
521
|
+
]);
|
|
522
|
+
const [internalValue, setInternalValue] = (0, import_react2.useState)("");
|
|
523
|
+
const [displayValue, setDisplayValue] = (0, import_react2.useState)("");
|
|
524
|
+
(0, import_react2.useEffect)(() => {
|
|
525
|
+
var _a2;
|
|
526
|
+
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
527
|
+
if (variant === "currency") {
|
|
528
|
+
if (propValue === void 0 || propValue === "" || typeof propValue === "number" && isNaN(propValue)) {
|
|
529
|
+
setInternalValue("");
|
|
530
|
+
setDisplayValue("");
|
|
531
|
+
} else {
|
|
532
|
+
const numValue = typeof propValue === "string" ? parseFloat(propValue) : propValue;
|
|
533
|
+
if (!isNaN(numValue)) {
|
|
534
|
+
const formatted = numValue.toFixed(decimals != null ? decimals : 2);
|
|
535
|
+
setInternalValue(formatted);
|
|
536
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
} else {
|
|
540
|
+
setInternalValue(stringValue);
|
|
541
|
+
setDisplayValue(stringValue);
|
|
542
|
+
}
|
|
543
|
+
}, [propValue, decimals, variant]);
|
|
544
|
+
const getInputProps = () => {
|
|
545
|
+
var _a2;
|
|
546
|
+
const baseProps = __spreadProps(__spreadValues(__spreadValues({}, props), getDecimalPlaceholder(decimals)), {
|
|
547
|
+
value: propValue
|
|
548
|
+
});
|
|
549
|
+
switch (variant) {
|
|
550
|
+
case "search":
|
|
551
|
+
return __spreadProps(__spreadValues({}, baseProps), {
|
|
552
|
+
placeholder: (_a2 = props.placeholder) != null ? _a2 : "Search",
|
|
553
|
+
className: "!mr-6",
|
|
554
|
+
value: displayValue
|
|
555
|
+
});
|
|
556
|
+
case "finder":
|
|
557
|
+
return baseProps;
|
|
558
|
+
case "currency":
|
|
559
|
+
return __spreadProps(__spreadValues({}, baseProps), {
|
|
560
|
+
align: "right",
|
|
561
|
+
type: "text",
|
|
562
|
+
value: displayValue
|
|
563
|
+
});
|
|
564
|
+
case "percentage":
|
|
565
|
+
case "uom":
|
|
566
|
+
return __spreadProps(__spreadValues({}, baseProps), {
|
|
567
|
+
type: "number",
|
|
568
|
+
align: "right"
|
|
569
|
+
});
|
|
570
|
+
default:
|
|
571
|
+
return baseProps;
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
const getBeforeElement = () => {
|
|
575
|
+
if (props.before) return props.before;
|
|
576
|
+
switch (variant) {
|
|
577
|
+
case "search":
|
|
578
|
+
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "search" }) }) : null;
|
|
579
|
+
case "currency":
|
|
580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "attach_money" }) });
|
|
581
|
+
default:
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
const getAfterElement = () => {
|
|
586
|
+
if (props.after) return props.after;
|
|
587
|
+
switch (variant) {
|
|
588
|
+
case "search": {
|
|
589
|
+
const hasValue = displayValue.length > 0;
|
|
590
|
+
return hasValue && !props.readOnly ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
591
|
+
Icon,
|
|
592
|
+
{
|
|
593
|
+
name: "close",
|
|
594
|
+
onClick: handleSearchReset,
|
|
595
|
+
className: "cursor-pointer absolute right-2 bottom-2/4 translate-y-2/4"
|
|
596
|
+
}
|
|
597
|
+
) : null;
|
|
598
|
+
}
|
|
599
|
+
case "finder":
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "search" });
|
|
601
|
+
case "uom":
|
|
602
|
+
return uom ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-text-secondary-normal uppercase", children: uom.slice(0, 4) }) : null;
|
|
603
|
+
case "percentage":
|
|
604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "percent" }) });
|
|
605
|
+
default:
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
const handleSearchReset = () => {
|
|
610
|
+
setInternalValue("");
|
|
611
|
+
setDisplayValue("");
|
|
612
|
+
if (onChange) {
|
|
613
|
+
const syntheticEvent = {
|
|
614
|
+
target: { value: "" }
|
|
615
|
+
};
|
|
616
|
+
if (typeof onChange === "function") {
|
|
617
|
+
onChange(syntheticEvent);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
onClear == null ? void 0 : onClear();
|
|
621
|
+
};
|
|
622
|
+
const handleChange = (e) => {
|
|
623
|
+
const rawValue = e.target.value;
|
|
624
|
+
if (variant === "search") {
|
|
625
|
+
setInternalValue(rawValue);
|
|
626
|
+
setDisplayValue(rawValue);
|
|
627
|
+
if (typeof onChange === "function") {
|
|
628
|
+
onChange(e);
|
|
629
|
+
}
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if (variant === "currency") {
|
|
633
|
+
const raw = rawValue.replace(/,/g, "");
|
|
634
|
+
if (raw === "") {
|
|
635
|
+
setInternalValue("");
|
|
636
|
+
setDisplayValue("");
|
|
637
|
+
if (onChange) {
|
|
638
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
639
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: "" })
|
|
640
|
+
});
|
|
641
|
+
onChange(syntheticEvent);
|
|
642
|
+
}
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
const regex = /^\d*\.?\d*$/;
|
|
646
|
+
if (!regex.test(raw)) return;
|
|
647
|
+
const parts = raw.split(".");
|
|
648
|
+
const currentDecimals = decimals != null ? decimals : 2;
|
|
649
|
+
if (parts.length === 2 && parts[1].length > currentDecimals) return;
|
|
650
|
+
setInternalValue(raw);
|
|
651
|
+
setDisplayValue(formatCurrencyDisplay(raw));
|
|
652
|
+
const asNumber = Number(raw);
|
|
653
|
+
if (!isNaN(asNumber) && onChange) {
|
|
654
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
655
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
656
|
+
});
|
|
657
|
+
onChange(syntheticEvent);
|
|
658
|
+
}
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
setInternalValue(rawValue);
|
|
662
|
+
setDisplayValue(rawValue);
|
|
663
|
+
if (typeof onChange === "function") {
|
|
664
|
+
onChange(e);
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
const handleBlur = (e) => {
|
|
668
|
+
if (variant === "currency") {
|
|
669
|
+
const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
|
|
670
|
+
setInternalValue(formatted);
|
|
671
|
+
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
672
|
+
const asNumber = Number(formatted);
|
|
673
|
+
if (!isNaN(asNumber) && onChange) {
|
|
674
|
+
const syntheticEvent = __spreadProps(__spreadValues({}, e), {
|
|
675
|
+
target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
|
|
676
|
+
});
|
|
677
|
+
onChange(syntheticEvent);
|
|
678
|
+
}
|
|
679
|
+
} else if (variant === "uom" || variant === "percentage") {
|
|
680
|
+
const formattedValue = formatDecimalValue(e.target.value, decimals);
|
|
681
|
+
e.target.value = formattedValue;
|
|
682
|
+
}
|
|
683
|
+
onBlur == null ? void 0 : onBlur(e);
|
|
684
|
+
};
|
|
685
|
+
const inputProps = getInputProps();
|
|
686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
687
|
+
InputBase,
|
|
688
|
+
__spreadProps(__spreadValues({}, inputProps), {
|
|
689
|
+
before: getBeforeElement(),
|
|
690
|
+
after: getAfterElement(),
|
|
691
|
+
onChange: handleChange,
|
|
692
|
+
onBlur: handleBlur
|
|
693
|
+
})
|
|
694
|
+
);
|
|
695
|
+
};
|
|
696
|
+
Input.displayName = "Input";
|
|
697
|
+
var Finder = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "finder" }));
|
|
698
|
+
var UOM = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "uom" }));
|
|
699
|
+
var Currency = (props) => {
|
|
700
|
+
var _a;
|
|
701
|
+
const handleCurrencyChange = (e) => {
|
|
702
|
+
var _a2;
|
|
703
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, e);
|
|
704
|
+
};
|
|
705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
706
|
+
Input,
|
|
707
|
+
__spreadProps(__spreadValues({}, props), {
|
|
708
|
+
variant: "currency",
|
|
709
|
+
decimals: (_a = props.decimals) != null ? _a : 2,
|
|
710
|
+
onChange: handleCurrencyChange
|
|
711
|
+
})
|
|
712
|
+
);
|
|
713
|
+
};
|
|
714
|
+
var Percentage = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "percentage" }));
|
|
715
|
+
Finder.displayName = "Finder";
|
|
716
|
+
UOM.displayName = "UOM";
|
|
717
|
+
Currency.displayName = "Currency";
|
|
718
|
+
Percentage.displayName = "Percentage";
|
|
719
|
+
|
|
720
|
+
// src/components/Search.tsx
|
|
721
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
722
|
+
var Search = (_a) => {
|
|
723
|
+
var _b = _a, {
|
|
724
|
+
label,
|
|
725
|
+
error,
|
|
726
|
+
children,
|
|
727
|
+
readOnly,
|
|
728
|
+
renderMenu,
|
|
729
|
+
onClick,
|
|
730
|
+
className,
|
|
731
|
+
wrapperClassName,
|
|
732
|
+
removeRoundness
|
|
733
|
+
} = _b, props = __objRest(_b, [
|
|
734
|
+
"label",
|
|
735
|
+
"error",
|
|
736
|
+
"children",
|
|
737
|
+
"readOnly",
|
|
738
|
+
"renderMenu",
|
|
739
|
+
"onClick",
|
|
740
|
+
"className",
|
|
741
|
+
"wrapperClassName",
|
|
742
|
+
"removeRoundness"
|
|
743
|
+
]);
|
|
744
|
+
const inputRef = (0, import_react3.useRef)(null);
|
|
745
|
+
const inputContainerRef = (0, import_react3.useRef)(null);
|
|
746
|
+
const preventFocusOnInitialRender = (0, import_react3.useRef)(true);
|
|
747
|
+
const [show, setShow] = (0, import_react3.useState)(false);
|
|
748
|
+
const [clearing, setClearing] = (0, import_react3.useState)(false);
|
|
749
|
+
const uniqueId = (0, import_react3.useId)();
|
|
750
|
+
const searchMenuName = `search-menu-${uniqueId}`;
|
|
751
|
+
(0, import_react3.useEffect)(() => {
|
|
752
|
+
var _a2;
|
|
753
|
+
if (preventFocusOnInitialRender.current) {
|
|
754
|
+
preventFocusOnInitialRender.current = false;
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
758
|
+
}, [props.value]);
|
|
759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
761
|
+
Input,
|
|
762
|
+
__spreadValues({
|
|
763
|
+
variant: "search",
|
|
764
|
+
inputContainerRef,
|
|
765
|
+
ref: inputRef,
|
|
766
|
+
label,
|
|
767
|
+
wrapperClassName,
|
|
768
|
+
onClick: (e) => {
|
|
769
|
+
if (props.disabled || readOnly) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
if (clearing) {
|
|
773
|
+
setClearing(false);
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
onClick == null ? void 0 : onClick(e);
|
|
777
|
+
setShow(!show);
|
|
778
|
+
},
|
|
779
|
+
onClear: () => {
|
|
780
|
+
setClearing(true);
|
|
781
|
+
},
|
|
782
|
+
onKeyDown: (e) => {
|
|
783
|
+
setShow(true);
|
|
784
|
+
if (["ArrowUp", "ArrowDown"].includes(e.key)) {
|
|
785
|
+
e.preventDefault();
|
|
786
|
+
const menu = document.querySelector(`[data-menu="${searchMenuName}"]`);
|
|
787
|
+
const selectedMenuOption = menu == null ? void 0 : menu.querySelector("[data-selected]");
|
|
788
|
+
if (selectedMenuOption) {
|
|
789
|
+
const allMenuOptions = Array.from((menu == null ? void 0 : menu.querySelectorAll('[role="menuitem"]')) || []);
|
|
790
|
+
const currentIndex = allMenuOptions.indexOf(selectedMenuOption);
|
|
791
|
+
let targetOption;
|
|
792
|
+
if (e.key === "ArrowDown") {
|
|
793
|
+
targetOption = allMenuOptions[currentIndex + 1] || allMenuOptions[0];
|
|
794
|
+
} else {
|
|
795
|
+
targetOption = allMenuOptions[currentIndex - 1] || allMenuOptions[allMenuOptions.length - 1];
|
|
796
|
+
}
|
|
797
|
+
targetOption == null ? void 0 : targetOption.focus();
|
|
798
|
+
} else {
|
|
799
|
+
const toFocusMenuOption = e.key === "ArrowDown" ? menu == null ? void 0 : menu.querySelector('[role="menuitem"]') : menu == null ? void 0 : menu.querySelector('[role="menuitem"]:last-child');
|
|
800
|
+
toFocusMenuOption == null ? void 0 : toFocusMenuOption.focus();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
error,
|
|
805
|
+
readOnly,
|
|
806
|
+
removeRoundness,
|
|
807
|
+
focus: show
|
|
808
|
+
}, props)
|
|
809
|
+
),
|
|
810
|
+
renderMenu ? renderMenu({
|
|
811
|
+
positionTo: inputContainerRef,
|
|
812
|
+
show,
|
|
813
|
+
setShow,
|
|
814
|
+
topOffset: props.caption ? -16 : null,
|
|
815
|
+
autoFocusOff: true,
|
|
816
|
+
menuName: searchMenuName
|
|
817
|
+
}) : children
|
|
818
|
+
] });
|
|
819
|
+
};
|
|
820
|
+
Search.displayName = "Search";
|
|
821
|
+
|
|
822
|
+
// src/components/Menu.tsx
|
|
823
|
+
var import_clsx5 = __toESM(require("clsx"), 1);
|
|
824
|
+
var import_react6 = require("react");
|
|
825
|
+
var import_react_dom = require("react-dom");
|
|
826
|
+
|
|
827
|
+
// src/components/useMenuSystem.tsx
|
|
828
|
+
var import_react5 = require("react");
|
|
829
|
+
|
|
830
|
+
// src/components/useMatchesMedia.tsx
|
|
831
|
+
var import_react4 = require("react");
|
|
832
|
+
var useMatchesMedia = (query) => {
|
|
833
|
+
const [matches, setMatches] = (0, import_react4.useState)(
|
|
834
|
+
() => typeof window !== "undefined" ? window.matchMedia(query).matches : false
|
|
835
|
+
);
|
|
836
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
837
|
+
const mediaQueryList = window.matchMedia(query);
|
|
838
|
+
const listener = (event) => {
|
|
839
|
+
setMatches(event.matches);
|
|
840
|
+
};
|
|
841
|
+
mediaQueryList.addEventListener("change", listener);
|
|
842
|
+
setMatches(mediaQueryList.matches);
|
|
843
|
+
return () => {
|
|
844
|
+
mediaQueryList.removeEventListener("change", listener);
|
|
845
|
+
};
|
|
846
|
+
}, [query]);
|
|
847
|
+
return matches;
|
|
848
|
+
};
|
|
849
|
+
var useMatchesMobile = () => {
|
|
850
|
+
const isMobile = useMatchesMedia("(width < 48rem)");
|
|
851
|
+
return isMobile;
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
// src/components/useMenuSystem.tsx
|
|
855
|
+
function useSubMenuSystem(mobilePositionTo) {
|
|
856
|
+
const [activeMenus, setActiveMenus] = (0, import_react5.useState)(
|
|
857
|
+
{}
|
|
858
|
+
);
|
|
859
|
+
const [activeMenu, setActiveMenu] = (0, import_react5.useState)("");
|
|
860
|
+
const [currentSubMenuLevel, setCurrentSubMenuLevel] = (0, import_react5.useState)(null);
|
|
861
|
+
const menuRootRef = (0, import_react5.useRef)(null);
|
|
862
|
+
const subMenuRefs = (0, import_react5.useRef)({});
|
|
863
|
+
const hoverTimeoutRef = (0, import_react5.useRef)(null);
|
|
864
|
+
const closeTimeoutRef = (0, import_react5.useRef)(null);
|
|
865
|
+
const isMobile = useMatchesMobile();
|
|
866
|
+
const toggleMenu = (menuId, level) => {
|
|
867
|
+
if (closeTimeoutRef.current) {
|
|
868
|
+
clearTimeout(closeTimeoutRef.current);
|
|
869
|
+
closeTimeoutRef.current = null;
|
|
870
|
+
}
|
|
871
|
+
setActiveMenu(menuId);
|
|
872
|
+
setCurrentSubMenuLevel(level);
|
|
873
|
+
setActiveMenus((prev) => {
|
|
874
|
+
const newActiveMenus = __spreadValues({}, prev);
|
|
875
|
+
if (newActiveMenus[level] === menuId) {
|
|
876
|
+
delete newActiveMenus[level];
|
|
877
|
+
} else {
|
|
878
|
+
newActiveMenus[level] = menuId;
|
|
879
|
+
}
|
|
880
|
+
Object.keys(newActiveMenus).forEach((key) => {
|
|
881
|
+
if (Number(key) > level) {
|
|
882
|
+
delete newActiveMenus[Number(key)];
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
return newActiveMenus;
|
|
886
|
+
});
|
|
887
|
+
};
|
|
888
|
+
const openMenu = (menuId, level) => {
|
|
889
|
+
if (closeTimeoutRef.current) {
|
|
890
|
+
clearTimeout(closeTimeoutRef.current);
|
|
891
|
+
closeTimeoutRef.current = null;
|
|
892
|
+
}
|
|
893
|
+
setActiveMenus((prev) => {
|
|
894
|
+
const newActiveMenus = __spreadValues({}, prev);
|
|
895
|
+
newActiveMenus[level] = menuId;
|
|
896
|
+
Object.keys(newActiveMenus).forEach((key) => {
|
|
897
|
+
if (Number(key) > level) {
|
|
898
|
+
delete newActiveMenus[Number(key)];
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
return newActiveMenus;
|
|
902
|
+
});
|
|
903
|
+
};
|
|
904
|
+
const openMenuWithDelay = (menuId, level, delay = 150) => {
|
|
905
|
+
if (isMobile) {
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
if (hoverTimeoutRef.current) {
|
|
909
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
910
|
+
}
|
|
911
|
+
hoverTimeoutRef.current = setTimeout(() => {
|
|
912
|
+
openMenu(menuId, level);
|
|
913
|
+
}, delay);
|
|
914
|
+
};
|
|
915
|
+
const closeMenuWithDelay = (level, delay = 500) => {
|
|
916
|
+
if (isMobile) {
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
if (hoverTimeoutRef.current) {
|
|
920
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
921
|
+
hoverTimeoutRef.current = null;
|
|
922
|
+
}
|
|
923
|
+
closeTimeoutRef.current = setTimeout(() => {
|
|
924
|
+
closeSubMenuLevel(level);
|
|
925
|
+
}, delay);
|
|
926
|
+
};
|
|
927
|
+
const cancelCloseTimeout = () => {
|
|
928
|
+
if (isMobile) {
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
if (closeTimeoutRef.current) {
|
|
932
|
+
clearTimeout(closeTimeoutRef.current);
|
|
933
|
+
closeTimeoutRef.current = null;
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
const closeSubMenuLevel = (level) => {
|
|
937
|
+
setActiveMenus((prev) => {
|
|
938
|
+
const newActiveMenus = __spreadValues({}, prev);
|
|
939
|
+
delete newActiveMenus[level];
|
|
940
|
+
Object.keys(newActiveMenus).forEach((key) => {
|
|
941
|
+
if (Number(key) >= level) {
|
|
942
|
+
delete newActiveMenus[Number(key)];
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
if (isMobile) {
|
|
946
|
+
const newSubMenuLevel = level - 1;
|
|
947
|
+
setCurrentSubMenuLevel(newSubMenuLevel);
|
|
948
|
+
const newActiveMenu = newActiveMenus[newSubMenuLevel];
|
|
949
|
+
if (Object.keys(newActiveMenus).length > 0 && newActiveMenu) {
|
|
950
|
+
setActiveMenu(newActiveMenu);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
return newActiveMenus;
|
|
954
|
+
});
|
|
955
|
+
};
|
|
956
|
+
const registerSubMenu = (id, element) => {
|
|
957
|
+
subMenuRefs.current[id] = element;
|
|
958
|
+
};
|
|
959
|
+
const isMenuActive = (menuId, level) => {
|
|
960
|
+
return activeMenus[level] === menuId;
|
|
961
|
+
};
|
|
962
|
+
(0, import_react5.useEffect)(() => {
|
|
963
|
+
const handleClickOutside = (event) => {
|
|
964
|
+
var _a;
|
|
965
|
+
if (Object.keys(activeMenus).length === 0) return;
|
|
966
|
+
const target = event.target;
|
|
967
|
+
if ((_a = menuRootRef.current) == null ? void 0 : _a.contains(target)) return;
|
|
968
|
+
const isInsideActiveSubmenu = Object.values(activeMenus).some((id) => {
|
|
969
|
+
const submenuEl = subMenuRefs.current[id];
|
|
970
|
+
return submenuEl == null ? void 0 : submenuEl.contains(target);
|
|
971
|
+
});
|
|
972
|
+
if (!isInsideActiveSubmenu) {
|
|
973
|
+
setActiveMenus({});
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
977
|
+
return () => {
|
|
978
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
979
|
+
};
|
|
980
|
+
}, [activeMenus]);
|
|
981
|
+
(0, import_react5.useEffect)(() => {
|
|
982
|
+
return () => {
|
|
983
|
+
if (hoverTimeoutRef.current) {
|
|
984
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
985
|
+
}
|
|
986
|
+
if (closeTimeoutRef.current) {
|
|
987
|
+
clearTimeout(closeTimeoutRef.current);
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
}, []);
|
|
991
|
+
const getAllFocusableMenuElements = () => {
|
|
992
|
+
const elements = [];
|
|
993
|
+
if (menuRootRef.current) {
|
|
994
|
+
elements.push(...Array.from(menuRootRef.current.children));
|
|
995
|
+
}
|
|
996
|
+
Object.values(activeMenus).forEach((menuId) => {
|
|
997
|
+
const submenuEl = subMenuRefs.current[menuId];
|
|
998
|
+
if (submenuEl) {
|
|
999
|
+
elements.push(...Array.from(submenuEl.children));
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
return elements;
|
|
1003
|
+
};
|
|
1004
|
+
const findCurrentMenuLevel = (element) => {
|
|
1005
|
+
let current = element.parentElement;
|
|
1006
|
+
while (current) {
|
|
1007
|
+
const level = current.getAttribute("data-menu-level");
|
|
1008
|
+
if (level !== null) {
|
|
1009
|
+
return parseInt(level, 10);
|
|
1010
|
+
}
|
|
1011
|
+
current = current.parentElement;
|
|
1012
|
+
}
|
|
1013
|
+
return 0;
|
|
1014
|
+
};
|
|
1015
|
+
const getMenuElementsAtLevel = (level) => {
|
|
1016
|
+
var _a;
|
|
1017
|
+
if (level === 0 && menuRootRef.current) {
|
|
1018
|
+
return Array.from(menuRootRef.current.children);
|
|
1019
|
+
}
|
|
1020
|
+
const menuId = (_a = Object.entries(activeMenus).find(([, id]) => {
|
|
1021
|
+
const submenuEl = subMenuRefs.current[id];
|
|
1022
|
+
return submenuEl && submenuEl.getAttribute("data-menu-level") === level.toString();
|
|
1023
|
+
})) == null ? void 0 : _a[1];
|
|
1024
|
+
if (menuId) {
|
|
1025
|
+
const submenuEl = subMenuRefs.current[menuId];
|
|
1026
|
+
if (submenuEl) {
|
|
1027
|
+
return Array.from(submenuEl.children);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
return [];
|
|
1031
|
+
};
|
|
1032
|
+
return {
|
|
1033
|
+
menuRootRef,
|
|
1034
|
+
activeMenus,
|
|
1035
|
+
openMenu,
|
|
1036
|
+
isMenuActive,
|
|
1037
|
+
registerSubMenu,
|
|
1038
|
+
closeSubMenuLevel,
|
|
1039
|
+
getAllFocusableMenuElements,
|
|
1040
|
+
findCurrentMenuLevel,
|
|
1041
|
+
getMenuElementsAtLevel,
|
|
1042
|
+
mobileHide: isMobile && Object.keys(activeMenus).length > 0,
|
|
1043
|
+
listeners: {
|
|
1044
|
+
onSubMenuHover: openMenuWithDelay,
|
|
1045
|
+
onSubMenuLeave: closeMenuWithDelay,
|
|
1046
|
+
onSubMenuEnter: cancelCloseTimeout,
|
|
1047
|
+
toggleMenu,
|
|
1048
|
+
mobilePositionTo,
|
|
1049
|
+
activeMenu,
|
|
1050
|
+
currentSubMenuLevel,
|
|
1051
|
+
closeSubMenuLevel
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function useMenuPosition(elementRef, position = "bottom", options) {
|
|
1056
|
+
const [menuPosition, setMenuPosition] = (0, import_react5.useState)({
|
|
1057
|
+
top: 0,
|
|
1058
|
+
left: 0,
|
|
1059
|
+
minWidth: 0
|
|
1060
|
+
});
|
|
1061
|
+
const isMobile = useMatchesMobile();
|
|
1062
|
+
const updatePosition = (0, import_react5.useCallback)(() => {
|
|
1063
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1064
|
+
if (!(elementRef == null ? void 0 : elementRef.current)) return;
|
|
1065
|
+
const triggerRect = elementRef.current.getBoundingClientRect();
|
|
1066
|
+
const menuRect = (_b = (_a = options == null ? void 0 : options.menuRef) == null ? void 0 : _a.current) == null ? void 0 : _b.getBoundingClientRect();
|
|
1067
|
+
const viewportWidth = window.innerWidth;
|
|
1068
|
+
const menuWidth = (menuRect == null ? void 0 : menuRect.width) || triggerRect.width;
|
|
1069
|
+
const topOffset = (_c = options == null ? void 0 : options.topOffset) != null ? _c : 4;
|
|
1070
|
+
let top = 0;
|
|
1071
|
+
let left = 0;
|
|
1072
|
+
if (position === "bottom" || position === "bottom-right") {
|
|
1073
|
+
top = triggerRect.top + triggerRect.height + topOffset;
|
|
1074
|
+
} else {
|
|
1075
|
+
top = triggerRect.top;
|
|
1076
|
+
}
|
|
1077
|
+
if (position === "bottom") {
|
|
1078
|
+
left = triggerRect.left + window.scrollX;
|
|
1079
|
+
} else if (position === "bottom-right") {
|
|
1080
|
+
left = triggerRect.right + window.scrollX - menuWidth;
|
|
1081
|
+
} else if (position === "right") {
|
|
1082
|
+
left = triggerRect.right + window.scrollX;
|
|
1083
|
+
}
|
|
1084
|
+
const overflowsLeftViewport = left + menuWidth > viewportWidth;
|
|
1085
|
+
if (overflowsLeftViewport) {
|
|
1086
|
+
left = triggerRect.left - menuWidth;
|
|
1087
|
+
}
|
|
1088
|
+
if (isMobile) {
|
|
1089
|
+
left = triggerRect.left + menuWidth > viewportWidth ? Math.max(viewportWidth - menuWidth, 0) - 8 : triggerRect.left;
|
|
1090
|
+
top = ((_f = (_e = (_d = elementRef.current.parentElement) == null ? void 0 : _d.getBoundingClientRect()) == null ? void 0 : _e.top) != null ? _f : 0) + ((_i = (_h = (_g = elementRef.current.parentElement) == null ? void 0 : _g.getBoundingClientRect()) == null ? void 0 : _h.height) != null ? _i : 0) + topOffset;
|
|
1091
|
+
}
|
|
1092
|
+
setMenuPosition({
|
|
1093
|
+
top,
|
|
1094
|
+
left,
|
|
1095
|
+
minWidth: triggerRect.width
|
|
1096
|
+
});
|
|
1097
|
+
}, [elementRef, position, options == null ? void 0 : options.menuRef, options == null ? void 0 : options.topOffset, isMobile]);
|
|
1098
|
+
(0, import_react5.useEffect)(() => {
|
|
1099
|
+
if (!(options == null ? void 0 : options.isOpen) || !(options == null ? void 0 : options.setIsOpen)) return;
|
|
1100
|
+
const handleClickOutside = (event) => {
|
|
1101
|
+
var _a, _b, _c, _d, _e;
|
|
1102
|
+
const target = event.target;
|
|
1103
|
+
if ((_a = elementRef.current) == null ? void 0 : _a.contains(target)) return;
|
|
1104
|
+
if ((_c = (_b = options.menuRef) == null ? void 0 : _b.current) == null ? void 0 : _c.contains(target)) return;
|
|
1105
|
+
if ((_d = options.additionalRefs) == null ? void 0 : _d.some((ref) => {
|
|
1106
|
+
var _a2;
|
|
1107
|
+
return (_a2 = ref.current) == null ? void 0 : _a2.contains(target);
|
|
1108
|
+
}))
|
|
1109
|
+
return;
|
|
1110
|
+
(_e = options.setIsOpen) == null ? void 0 : _e.call(options, false);
|
|
1111
|
+
};
|
|
1112
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1113
|
+
return () => {
|
|
1114
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1115
|
+
};
|
|
1116
|
+
}, [
|
|
1117
|
+
options,
|
|
1118
|
+
elementRef,
|
|
1119
|
+
options == null ? void 0 : options.isOpen,
|
|
1120
|
+
options == null ? void 0 : options.setIsOpen,
|
|
1121
|
+
options == null ? void 0 : options.menuRef,
|
|
1122
|
+
options == null ? void 0 : options.additionalRefs
|
|
1123
|
+
]);
|
|
1124
|
+
(0, import_react5.useEffect)(() => {
|
|
1125
|
+
updatePosition();
|
|
1126
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
1127
|
+
if (elementRef == null ? void 0 : elementRef.current) {
|
|
1128
|
+
resizeObserver.observe(elementRef.current);
|
|
1129
|
+
}
|
|
1130
|
+
window.addEventListener("scroll", updatePosition);
|
|
1131
|
+
window.addEventListener("resize", updatePosition);
|
|
1132
|
+
return () => {
|
|
1133
|
+
resizeObserver.disconnect();
|
|
1134
|
+
window.removeEventListener("scroll", updatePosition);
|
|
1135
|
+
window.removeEventListener("resize", updatePosition);
|
|
1136
|
+
};
|
|
1137
|
+
}, [elementRef, updatePosition]);
|
|
1138
|
+
return { menuPosition, updatePosition };
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// src/utils.ts
|
|
1142
|
+
function findDocumentRoot(element) {
|
|
1143
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1144
|
+
throw new Error(
|
|
1145
|
+
"findDocumentRoot can only be used in a browser environment."
|
|
1146
|
+
);
|
|
1147
|
+
}
|
|
1148
|
+
if (!element || !(element instanceof Node)) {
|
|
1149
|
+
return window.document.body;
|
|
1150
|
+
}
|
|
1151
|
+
var currentElement = element;
|
|
1152
|
+
while (currentElement && currentElement.parentNode) {
|
|
1153
|
+
if (currentElement.parentNode === document) {
|
|
1154
|
+
return document.body;
|
|
1155
|
+
} else if (currentElement.parentNode instanceof DocumentFragment) {
|
|
1156
|
+
return currentElement.parentNode;
|
|
1157
|
+
} else {
|
|
1158
|
+
currentElement = currentElement.parentNode;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
return window.document.body;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
// src/components/Menu.tsx
|
|
1165
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1166
|
+
var Menu = (_a) => {
|
|
1167
|
+
var _b = _a, {
|
|
1168
|
+
children,
|
|
1169
|
+
className,
|
|
1170
|
+
ref,
|
|
1171
|
+
positionTo,
|
|
1172
|
+
mobilePositionTo,
|
|
1173
|
+
show,
|
|
1174
|
+
setShow,
|
|
1175
|
+
position = "bottom",
|
|
1176
|
+
maxHeight: customMaxHeight,
|
|
1177
|
+
topOffset,
|
|
1178
|
+
mobileBackMenuOption,
|
|
1179
|
+
mobileHide,
|
|
1180
|
+
useDefaultMinWidth,
|
|
1181
|
+
autoFocusOff,
|
|
1182
|
+
menuName
|
|
1183
|
+
} = _b, props = __objRest(_b, [
|
|
1184
|
+
"children",
|
|
1185
|
+
"className",
|
|
1186
|
+
"ref",
|
|
1187
|
+
"positionTo",
|
|
1188
|
+
"mobilePositionTo",
|
|
1189
|
+
"show",
|
|
1190
|
+
"setShow",
|
|
1191
|
+
"position",
|
|
1192
|
+
"maxHeight",
|
|
1193
|
+
"topOffset",
|
|
1194
|
+
"mobileBackMenuOption",
|
|
1195
|
+
"mobileHide",
|
|
1196
|
+
"useDefaultMinWidth",
|
|
1197
|
+
"autoFocusOff",
|
|
1198
|
+
"menuName"
|
|
1199
|
+
]);
|
|
1200
|
+
const internalRef = (0, import_react6.useRef)(null);
|
|
1201
|
+
const actualRef = ref || internalRef;
|
|
1202
|
+
const [maxHeight, setMaxHeight] = (0, import_react6.useState)("180px");
|
|
1203
|
+
const isMobile = useMatchesMobile();
|
|
1204
|
+
const { menuPosition, updatePosition } = useMenuPosition(
|
|
1205
|
+
isMobile && mobilePositionTo ? mobilePositionTo : positionTo,
|
|
1206
|
+
position,
|
|
1207
|
+
{
|
|
1208
|
+
isOpen: show,
|
|
1209
|
+
setIsOpen: setShow,
|
|
1210
|
+
menuRef: internalRef,
|
|
1211
|
+
topOffset
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
(0, import_react6.useEffect)(() => {
|
|
1215
|
+
const raf = requestAnimationFrame(() => {
|
|
1216
|
+
if (!actualRef || !actualRef.current || customMaxHeight) {
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
if (actualRef.current.childElementCount > 4) {
|
|
1220
|
+
let accumulatedHeight = 0;
|
|
1221
|
+
Array.from(actualRef.current.children).forEach((child, index) => {
|
|
1222
|
+
if (index >= 5) {
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
accumulatedHeight += child.clientHeight;
|
|
1226
|
+
});
|
|
1227
|
+
accumulatedHeight = accumulatedHeight / 5 * 4.5;
|
|
1228
|
+
setMaxHeight(`${accumulatedHeight}px`);
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
return () => {
|
|
1232
|
+
cancelAnimationFrame(raf);
|
|
1233
|
+
};
|
|
1234
|
+
}, [actualRef, customMaxHeight]);
|
|
1235
|
+
(0, import_react6.useEffect)(() => {
|
|
1236
|
+
if (!show) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
initializeMenuFocus();
|
|
1240
|
+
updatePosition();
|
|
1241
|
+
}, [show, updatePosition]);
|
|
1242
|
+
(0, import_react6.useEffect)(() => {
|
|
1243
|
+
if (!show || !setShow) {
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
const handleEscapeKey = (event) => {
|
|
1247
|
+
var _a2;
|
|
1248
|
+
if (event.key !== "Escape") {
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
setShow(false);
|
|
1252
|
+
(_a2 = positionTo == null ? void 0 : positionTo.current) == null ? void 0 : _a2.focus();
|
|
1253
|
+
};
|
|
1254
|
+
document.addEventListener("keydown", handleEscapeKey);
|
|
1255
|
+
return () => {
|
|
1256
|
+
document.removeEventListener("keydown", handleEscapeKey);
|
|
1257
|
+
};
|
|
1258
|
+
}, [show, setShow, positionTo]);
|
|
1259
|
+
return show && (0, import_react_dom.createPortal)(
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1261
|
+
"div",
|
|
1262
|
+
__spreadProps(__spreadValues({
|
|
1263
|
+
ref: setRefs,
|
|
1264
|
+
className: (0, import_clsx5.default)(
|
|
1265
|
+
"shadow-4 rounded-base bg-background-grouped-primary-normal overflow-x-hidden overflow-y-auto flex flex-col outline-0",
|
|
1266
|
+
"fixed",
|
|
1267
|
+
"z-50",
|
|
1268
|
+
mobileHide && "opacity-0 pointer-events-none",
|
|
1269
|
+
className
|
|
1270
|
+
)
|
|
1271
|
+
}, props), {
|
|
1272
|
+
style: __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props.style), {
|
|
1273
|
+
maxHeight: customMaxHeight || maxHeight
|
|
1274
|
+
}), menuPosition), {
|
|
1275
|
+
minWidth: useDefaultMinWidth ? "212px" : menuPosition.minWidth
|
|
1276
|
+
}),
|
|
1277
|
+
onKeyDown: handleKeydown,
|
|
1278
|
+
onMouseDown: stopPropagation,
|
|
1279
|
+
onMouseUp: stopPropagation,
|
|
1280
|
+
onTouchStart: stopPropagation,
|
|
1281
|
+
onTouchEnd: stopPropagation,
|
|
1282
|
+
tabIndex: -1,
|
|
1283
|
+
"data-menu": menuName != null ? menuName : "",
|
|
1284
|
+
children: [
|
|
1285
|
+
mobileBackMenuOption == null ? void 0 : mobileBackMenuOption(),
|
|
1286
|
+
children
|
|
1287
|
+
]
|
|
1288
|
+
})
|
|
1289
|
+
),
|
|
1290
|
+
findDocumentRoot(internalRef.current)
|
|
1291
|
+
);
|
|
1292
|
+
function handleKeydown(e) {
|
|
1293
|
+
var _a2, _b2;
|
|
1294
|
+
if (!internalRef.current) {
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
if (e.key !== "Escape") {
|
|
1298
|
+
e.stopPropagation();
|
|
1299
|
+
}
|
|
1300
|
+
const menuOptions = Array.from(
|
|
1301
|
+
internalRef.current.querySelectorAll('[role="menuitem"]')
|
|
1302
|
+
);
|
|
1303
|
+
if (menuOptions.length === 0) {
|
|
1304
|
+
return;
|
|
1305
|
+
}
|
|
1306
|
+
let currentIndex = -1;
|
|
1307
|
+
const focusedElement = document.activeElement;
|
|
1308
|
+
for (let i = 0; i < menuOptions.length; i++) {
|
|
1309
|
+
if (menuOptions[i] === focusedElement) {
|
|
1310
|
+
currentIndex = i;
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
switch (e.key) {
|
|
1315
|
+
case "ArrowDown": {
|
|
1316
|
+
e.preventDefault();
|
|
1317
|
+
const nextIndex = currentIndex < menuOptions.length - 1 ? currentIndex + 1 : 0;
|
|
1318
|
+
menuOptions[nextIndex].focus();
|
|
1319
|
+
break;
|
|
1320
|
+
}
|
|
1321
|
+
case "ArrowUp": {
|
|
1322
|
+
e.preventDefault();
|
|
1323
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : menuOptions.length - 1;
|
|
1324
|
+
menuOptions[prevIndex].focus();
|
|
1325
|
+
break;
|
|
1326
|
+
}
|
|
1327
|
+
case "Home":
|
|
1328
|
+
e.preventDefault();
|
|
1329
|
+
menuOptions[0].focus();
|
|
1330
|
+
break;
|
|
1331
|
+
case "End":
|
|
1332
|
+
e.preventDefault();
|
|
1333
|
+
menuOptions[menuOptions.length - 1].focus();
|
|
1334
|
+
break;
|
|
1335
|
+
case "Enter":
|
|
1336
|
+
case " ":
|
|
1337
|
+
case "ArrowRight":
|
|
1338
|
+
e.preventDefault();
|
|
1339
|
+
if (currentIndex >= 0) {
|
|
1340
|
+
menuOptions[currentIndex].click();
|
|
1341
|
+
}
|
|
1342
|
+
break;
|
|
1343
|
+
case "ArrowLeft":
|
|
1344
|
+
e.preventDefault();
|
|
1345
|
+
(_a2 = positionTo == null ? void 0 : positionTo.current) == null ? void 0 : _a2.click();
|
|
1346
|
+
(_b2 = positionTo == null ? void 0 : positionTo.current) == null ? void 0 : _b2.focus();
|
|
1347
|
+
break;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
function initializeMenuFocus() {
|
|
1351
|
+
var _a2, _b2, _c;
|
|
1352
|
+
if (!autoFocusOff) {
|
|
1353
|
+
(_a2 = internalRef.current) == null ? void 0 : _a2.focus();
|
|
1354
|
+
}
|
|
1355
|
+
const selectedOption = (_b2 = internalRef.current) == null ? void 0 : _b2.querySelector(
|
|
1356
|
+
"[data-selected]"
|
|
1357
|
+
);
|
|
1358
|
+
const firstMenuItem = (_c = internalRef.current) == null ? void 0 : _c.querySelector(
|
|
1359
|
+
'[role="menuitem"]'
|
|
1360
|
+
);
|
|
1361
|
+
const targetElement = selectedOption || firstMenuItem;
|
|
1362
|
+
if (!targetElement) {
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
targetElement.scrollIntoView({
|
|
1366
|
+
block: "nearest",
|
|
1367
|
+
behavior: "instant"
|
|
1368
|
+
});
|
|
1369
|
+
if (autoFocusOff) {
|
|
1370
|
+
return;
|
|
1371
|
+
}
|
|
1372
|
+
requestAnimationFrame(() => {
|
|
1373
|
+
targetElement.focus();
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
function setRefs(node) {
|
|
1377
|
+
internalRef.current = node;
|
|
1378
|
+
if (ref) {
|
|
1379
|
+
if (typeof ref === "function") {
|
|
1380
|
+
ref(node);
|
|
1381
|
+
} else {
|
|
1382
|
+
ref.current = node;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
function stopPropagation(e) {
|
|
1387
|
+
e.stopPropagation();
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
Menu.displayName = "Menu";
|
|
1391
|
+
|
|
1392
|
+
// src/components/MenuOption.tsx
|
|
1393
|
+
var import_clsx7 = __toESM(require("clsx"), 1);
|
|
1394
|
+
var import_react7 = require("react");
|
|
1395
|
+
|
|
1396
|
+
// src/components/Paragraph.tsx
|
|
1397
|
+
var import_clsx6 = __toESM(require("clsx"), 1);
|
|
1398
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1399
|
+
var Paragraph = (_a) => {
|
|
1400
|
+
var _b = _a, {
|
|
1401
|
+
className,
|
|
1402
|
+
color,
|
|
1403
|
+
padded,
|
|
1404
|
+
align = "left",
|
|
1405
|
+
tall,
|
|
1406
|
+
addOverflow,
|
|
1407
|
+
children,
|
|
1408
|
+
as = "p"
|
|
1409
|
+
} = _b, props = __objRest(_b, [
|
|
1410
|
+
"className",
|
|
1411
|
+
"color",
|
|
1412
|
+
"padded",
|
|
1413
|
+
"align",
|
|
1414
|
+
"tall",
|
|
1415
|
+
"addOverflow",
|
|
1416
|
+
"children",
|
|
1417
|
+
"as"
|
|
1418
|
+
]);
|
|
1419
|
+
const Element = as;
|
|
1420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1421
|
+
Element,
|
|
1422
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1423
|
+
className: (0, import_clsx6.default)(
|
|
1424
|
+
typography.paragraph,
|
|
1425
|
+
className,
|
|
1426
|
+
padded && componentPaddingXUsingComponentGap,
|
|
1427
|
+
align === "left" && "text-left",
|
|
1428
|
+
align === "center" && "text-center",
|
|
1429
|
+
align === "right" && "text-right",
|
|
1430
|
+
tall && "!leading-6",
|
|
1431
|
+
addOverflow && "whitespace-nowrap text-ellipsis overflow-hidden"
|
|
1432
|
+
),
|
|
1433
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
1434
|
+
color: color ? `var(--color-${color})` : void 0
|
|
1435
|
+
}),
|
|
1436
|
+
children
|
|
1437
|
+
})
|
|
1438
|
+
);
|
|
1439
|
+
};
|
|
1440
|
+
Paragraph.displayName = "Paragraph";
|
|
1441
|
+
|
|
1442
|
+
// src/components/MenuOption.tsx
|
|
1443
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1444
|
+
var MenuOption = ({
|
|
1445
|
+
children,
|
|
1446
|
+
disabled = false,
|
|
1447
|
+
variant = "normal",
|
|
1448
|
+
value,
|
|
1449
|
+
before,
|
|
1450
|
+
after,
|
|
1451
|
+
subMenu,
|
|
1452
|
+
onClick,
|
|
1453
|
+
selected,
|
|
1454
|
+
ref,
|
|
1455
|
+
onSubMenuHover,
|
|
1456
|
+
onSubMenuLeave,
|
|
1457
|
+
onSubMenuEnter,
|
|
1458
|
+
toggleMenu,
|
|
1459
|
+
subMenuLevel = 1,
|
|
1460
|
+
currentSubMenuLevel,
|
|
1461
|
+
closeSubMenuLevel,
|
|
1462
|
+
activeMenu,
|
|
1463
|
+
mobilePositionTo,
|
|
1464
|
+
highlightMatchingText = false,
|
|
1465
|
+
menuValue
|
|
1466
|
+
}) => {
|
|
1467
|
+
const uniqueId = (0, import_react7.useId)();
|
|
1468
|
+
const internalRef = (0, import_react7.useRef)(null);
|
|
1469
|
+
const actualRef = ref || internalRef;
|
|
1470
|
+
const menuId = (0, import_react7.useRef)(`menu-${uniqueId}`);
|
|
1471
|
+
const isMobile = useMatchesMobile();
|
|
1472
|
+
const handleMouseEnter = () => {
|
|
1473
|
+
if (subMenu && onSubMenuHover && !disabled) {
|
|
1474
|
+
onSubMenuHover(menuId.current, subMenuLevel);
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
const handleMouseLeave = () => {
|
|
1478
|
+
if (subMenu && onSubMenuLeave && !disabled) {
|
|
1479
|
+
onSubMenuLeave(subMenuLevel);
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
const handleSubMenuEnter = () => {
|
|
1483
|
+
if (onSubMenuEnter) {
|
|
1484
|
+
onSubMenuEnter();
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
const additionalAttributes = {
|
|
1488
|
+
"data-selected": selected || null
|
|
1489
|
+
};
|
|
1490
|
+
const svgStyles = (0, import_clsx7.default)(
|
|
1491
|
+
"[&>svg]:shrink-0 [&>svg]:fill-icon-action-primary-normal"
|
|
1492
|
+
);
|
|
1493
|
+
const textLabelStyles = (0, import_clsx7.default)("w-full whitespace-nowrap !leading-6");
|
|
1494
|
+
const normalStyles = variant === "normal" && !disabled && (0, import_clsx7.default)(
|
|
1495
|
+
"bg-transparent text-text-primary-normal",
|
|
1496
|
+
"hover:bg-background-action-secondary-hover",
|
|
1497
|
+
"focus:bg-background-action-secondary-hover",
|
|
1498
|
+
"data-selected:bg-background-action-secondary-hover",
|
|
1499
|
+
"active:bg-background-action-secondary-active"
|
|
1500
|
+
);
|
|
1501
|
+
const normalDisabledStyles = variant === "normal" && disabled && (0, import_clsx7.default)("text-text-primary-disabled");
|
|
1502
|
+
const actionStyles = variant === "action" && !disabled && (0, import_clsx7.default)(
|
|
1503
|
+
"text-action-400 bg-transparent",
|
|
1504
|
+
"hover:bg-background-action-secondary-hover hover:text-text-action-hover",
|
|
1505
|
+
"focus:bg-background-action-secondary-hover focus:text-text-action-hover",
|
|
1506
|
+
"data-selected:bg-background-action-secondary-active data-selected:text-text-action-active",
|
|
1507
|
+
"active:bg-background-action-secondary-active active:text-text-action-active"
|
|
1508
|
+
);
|
|
1509
|
+
const actionDisabledStyles = variant === "action" && disabled && (0, import_clsx7.default)("text-text-action-disabled");
|
|
1510
|
+
const disabledStyles = disabled && (0, import_clsx7.default)("bg-transparent cursor-default pointer-events-none");
|
|
1511
|
+
const renderChildren = typeof children === "string" && highlightMatchingText ? highlightMatch(children, menuValue) : children;
|
|
1512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1514
|
+
"div",
|
|
1515
|
+
__spreadProps(__spreadValues({
|
|
1516
|
+
ref: actualRef,
|
|
1517
|
+
className: (0, import_clsx7.default)(
|
|
1518
|
+
"flex items-center cursor-pointer w-full text-left relative outline-none",
|
|
1519
|
+
svgStyles,
|
|
1520
|
+
componentGap,
|
|
1521
|
+
componentPadding,
|
|
1522
|
+
baseTransition,
|
|
1523
|
+
normalStyles,
|
|
1524
|
+
normalDisabledStyles,
|
|
1525
|
+
actionStyles,
|
|
1526
|
+
actionDisabledStyles,
|
|
1527
|
+
disabledStyles
|
|
1528
|
+
),
|
|
1529
|
+
"data-value": value || children,
|
|
1530
|
+
onClick: () => {
|
|
1531
|
+
onClick == null ? void 0 : onClick(menuId.current, value || children);
|
|
1532
|
+
if (subMenu) {
|
|
1533
|
+
toggleMenu(menuId.current, subMenuLevel);
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
onMouseEnter: handleMouseEnter,
|
|
1537
|
+
onMouseLeave: handleMouseLeave
|
|
1538
|
+
}, additionalAttributes), {
|
|
1539
|
+
tabIndex: -1,
|
|
1540
|
+
role: "menuitem",
|
|
1541
|
+
"aria-haspopup": subMenu ? "menu" : void 0,
|
|
1542
|
+
children: [
|
|
1543
|
+
before && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "shrink-0 flex items-center", children: before }),
|
|
1544
|
+
variant === "action" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { padded: true, className: textLabelStyles, children: renderChildren }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Paragraph, { padded: true, className: textLabelStyles, children: renderChildren }),
|
|
1545
|
+
renderAfterProp()
|
|
1546
|
+
]
|
|
1547
|
+
})
|
|
1548
|
+
),
|
|
1549
|
+
subMenu && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1550
|
+
"div",
|
|
1551
|
+
{
|
|
1552
|
+
onMouseEnter: handleSubMenuEnter,
|
|
1553
|
+
onMouseLeave: handleMouseLeave,
|
|
1554
|
+
"data-submenu-parent": menuId.current,
|
|
1555
|
+
"data-menu-level": subMenuLevel + 1,
|
|
1556
|
+
children: subMenu({ menuId: menuId.current, positionTo: actualRef, mobilePositionTo, position: "right", subMenuLevel, mobileBackMenuOption, mobileHide: isMobile && activeMenu !== menuId.current })
|
|
1557
|
+
}
|
|
1558
|
+
)
|
|
1559
|
+
] });
|
|
1560
|
+
function renderAfterProp() {
|
|
1561
|
+
if (after) {
|
|
1562
|
+
return after;
|
|
1563
|
+
}
|
|
1564
|
+
if (subMenu && after !== null) {
|
|
1565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron_right" });
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
function mobileBackMenuOption() {
|
|
1569
|
+
if (!isMobile) {
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1573
|
+
MenuOption,
|
|
1574
|
+
{
|
|
1575
|
+
onClick: () => {
|
|
1576
|
+
closeSubMenuLevel == null ? void 0 : closeSubMenuLevel(currentSubMenuLevel != null ? currentSubMenuLevel : 0);
|
|
1577
|
+
},
|
|
1578
|
+
variant: "action",
|
|
1579
|
+
before: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron_left" }),
|
|
1580
|
+
children: "Back"
|
|
1581
|
+
}
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
MenuOption.displayName = "MenuOption";
|
|
1586
|
+
function highlightMatch(text, searchValue) {
|
|
1587
|
+
if (!searchValue || !searchValue.trim()) {
|
|
1588
|
+
return text;
|
|
1589
|
+
}
|
|
1590
|
+
const regex = new RegExp(`(${searchValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi");
|
|
1591
|
+
const parts = text.split(regex);
|
|
1592
|
+
return parts.map(
|
|
1593
|
+
(part, index) => regex.test(part) ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-bold", children: part }, index) : part
|
|
1594
|
+
);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
// src/components/DataGridCell.tsx
|
|
1598
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1599
|
+
var DataGridCell = (0, import_react8.memo)(
|
|
1600
|
+
(_a) => {
|
|
1601
|
+
var _b = _a, {
|
|
1602
|
+
type = "default",
|
|
1603
|
+
component = "static",
|
|
1604
|
+
children,
|
|
1605
|
+
className,
|
|
1606
|
+
locked = false,
|
|
1607
|
+
noPadding = false,
|
|
1608
|
+
paddedLeft = false,
|
|
1609
|
+
style,
|
|
1610
|
+
onClick,
|
|
1611
|
+
onRightClick,
|
|
1612
|
+
error,
|
|
1613
|
+
warning,
|
|
1614
|
+
center,
|
|
1615
|
+
width
|
|
1616
|
+
} = _b, props = __objRest(_b, [
|
|
1617
|
+
"type",
|
|
1618
|
+
"component",
|
|
1619
|
+
"children",
|
|
1620
|
+
"className",
|
|
1621
|
+
"locked",
|
|
1622
|
+
"noPadding",
|
|
1623
|
+
"paddedLeft",
|
|
1624
|
+
"style",
|
|
1625
|
+
"onClick",
|
|
1626
|
+
"onRightClick",
|
|
1627
|
+
"error",
|
|
1628
|
+
"warning",
|
|
1629
|
+
"center",
|
|
1630
|
+
"width"
|
|
1631
|
+
]);
|
|
1632
|
+
const Element = type === "header" ? "th" : "td";
|
|
1633
|
+
const timerRef = (0, import_react8.useRef)(null);
|
|
1634
|
+
const [isGrabbing, setIsGrabbing] = (0, import_react8.useState)(false);
|
|
1635
|
+
const [isPointerPressed, setIsPointerPressed] = (0, import_react8.useState)(false);
|
|
1636
|
+
(0, import_react8.useEffect)(() => {
|
|
1637
|
+
return () => {
|
|
1638
|
+
if (timerRef.current) {
|
|
1639
|
+
clearTimeout(timerRef.current);
|
|
1640
|
+
timerRef.current = null;
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
}, []);
|
|
1644
|
+
const handlePointerDown = (_event) => {
|
|
1645
|
+
setIsPointerPressed(true);
|
|
1646
|
+
timerRef.current = window.setTimeout(() => {
|
|
1647
|
+
setIsGrabbing(true);
|
|
1648
|
+
}, 500);
|
|
1649
|
+
};
|
|
1650
|
+
const handlePointerUp = (event) => {
|
|
1651
|
+
if (timerRef.current) {
|
|
1652
|
+
clearTimeout(timerRef.current);
|
|
1653
|
+
timerRef.current = null;
|
|
1654
|
+
}
|
|
1655
|
+
const rightClick = event.nativeEvent instanceof MouseEvent && event.nativeEvent.button === 2;
|
|
1656
|
+
if (!isGrabbing && onClick && !rightClick && isPointerPressed) {
|
|
1657
|
+
onClick(event);
|
|
1658
|
+
}
|
|
1659
|
+
if (rightClick && onRightClick) {
|
|
1660
|
+
onRightClick();
|
|
1661
|
+
}
|
|
1662
|
+
setIsGrabbing(false);
|
|
1663
|
+
setIsPointerPressed(false);
|
|
1664
|
+
};
|
|
1665
|
+
const handlePointerLeave = () => {
|
|
1666
|
+
if (timerRef.current) {
|
|
1667
|
+
clearTimeout(timerRef.current);
|
|
1668
|
+
timerRef.current = null;
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1671
|
+
const headerBgStyles = type === "header" && !locked && !["button"].includes(component) && "bg-brand-400 border-brand-200";
|
|
1672
|
+
const lockedHeaderBgStyles = locked && !["button"].includes(component) && "bg-neutral-400 border-neutral-300";
|
|
1673
|
+
const headerTypeStyles = type === "header" && component !== "button" && component !== "icon" && (0, import_clsx8.default)("border-r");
|
|
1674
|
+
const buttonComponentStyles = component === "button" && (0, import_clsx8.default)("border-r border-b border-border-primary-normal");
|
|
1675
|
+
const iconComponentStyles = component === "icon" && (0, import_clsx8.default)("border-l");
|
|
1676
|
+
const cellClasses = (0, import_clsx8.default)(
|
|
1677
|
+
headerTypeStyles,
|
|
1678
|
+
buttonComponentStyles,
|
|
1679
|
+
headerBgStyles,
|
|
1680
|
+
lockedHeaderBgStyles,
|
|
1681
|
+
iconComponentStyles,
|
|
1682
|
+
className,
|
|
1683
|
+
"flex flex-1 items-center gap-1 whitespace-nowrap min-w-full max-h-10 relative text-text-primary-normal",
|
|
1684
|
+
"focus-within:!z-10",
|
|
1685
|
+
component === "input" && "border",
|
|
1686
|
+
component === "input" && !error && !warning && "border-border-primary-normal",
|
|
1687
|
+
component === "input" && error && "border-border-primary-error",
|
|
1688
|
+
component === "input" && warning && "border-background-warning-normal",
|
|
1689
|
+
!["button", "icon"].includes(component) && !noPadding && "p-2",
|
|
1690
|
+
paddedLeft && "pl-2",
|
|
1691
|
+
component === "icon" && "border-l",
|
|
1692
|
+
isGrabbing && "!cursor-grabbing",
|
|
1693
|
+
component === "checkbox" || center && "justify-center"
|
|
1694
|
+
);
|
|
1695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1696
|
+
Element,
|
|
1697
|
+
__spreadProps(__spreadValues({
|
|
1698
|
+
className: (0, import_clsx8.default)("flex", !width && "flex-1"),
|
|
1699
|
+
style: { width }
|
|
1700
|
+
}, props), {
|
|
1701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1702
|
+
"div",
|
|
1703
|
+
{
|
|
1704
|
+
className: cellClasses,
|
|
1705
|
+
style: __spreadValues({}, style),
|
|
1706
|
+
onMouseDown: handlePointerDown,
|
|
1707
|
+
onMouseUp: handlePointerUp,
|
|
1708
|
+
onMouseLeave: handlePointerLeave,
|
|
1709
|
+
onTouchStart: handlePointerDown,
|
|
1710
|
+
onTouchEnd: handlePointerUp,
|
|
1711
|
+
onTouchCancel: handlePointerLeave,
|
|
1712
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
1713
|
+
children
|
|
1714
|
+
}
|
|
1715
|
+
)
|
|
1716
|
+
})
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
);
|
|
1720
|
+
DataGridCell.displayName = "DataGridCell";
|
|
1721
|
+
function DraggableCellHeader(_a) {
|
|
1722
|
+
var _b = _a, {
|
|
1723
|
+
header,
|
|
1724
|
+
children,
|
|
1725
|
+
locked = false
|
|
1726
|
+
} = _b, props = __objRest(_b, [
|
|
1727
|
+
"header",
|
|
1728
|
+
"children",
|
|
1729
|
+
"locked"
|
|
1730
|
+
]);
|
|
1731
|
+
var _a2;
|
|
1732
|
+
const { attributes, isDragging, listeners, setNodeRef, transform, node } = (0, import_sortable.useSortable)({
|
|
1733
|
+
id: header.column.id
|
|
1734
|
+
});
|
|
1735
|
+
const [showMenu, setShowMenu] = (0, import_react8.useState)(false);
|
|
1736
|
+
const [filter, setFilter] = (0, import_react8.useState)(
|
|
1737
|
+
(_a2 = header.column.getFilterValue()) != null ? _a2 : ""
|
|
1738
|
+
);
|
|
1739
|
+
const {
|
|
1740
|
+
menuRootRef,
|
|
1741
|
+
isMenuActive,
|
|
1742
|
+
registerSubMenu,
|
|
1743
|
+
listeners: subMenuListeners,
|
|
1744
|
+
mobileHide
|
|
1745
|
+
} = useSubMenuSystem(node);
|
|
1746
|
+
(0, import_react8.useEffect)(() => {
|
|
1747
|
+
const handler = setTimeout(() => {
|
|
1748
|
+
header.column.setFilterValue(filter);
|
|
1749
|
+
}, 500);
|
|
1750
|
+
return () => {
|
|
1751
|
+
clearTimeout(handler);
|
|
1752
|
+
};
|
|
1753
|
+
}, [filter]);
|
|
1754
|
+
const style = {
|
|
1755
|
+
opacity: isDragging ? 0.8 : 1,
|
|
1756
|
+
position: "relative",
|
|
1757
|
+
transform: CSS.Translate.toString(transform),
|
|
1758
|
+
transition: "width transform 0.2s ease-in-out",
|
|
1759
|
+
whiteSpace: "nowrap",
|
|
1760
|
+
width: header.column.getSize(),
|
|
1761
|
+
zIndex: isDragging ? 1 : 0,
|
|
1762
|
+
"--color-text-primary-normal": "var(--color-neutral-000)"
|
|
1763
|
+
};
|
|
1764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1765
|
+
DataGridCell,
|
|
1766
|
+
__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
|
|
1767
|
+
locked,
|
|
1768
|
+
type: "header",
|
|
1769
|
+
component: "header",
|
|
1770
|
+
ref: setNodeRef,
|
|
1771
|
+
colSpan: header.colSpan,
|
|
1772
|
+
style
|
|
1773
|
+
}, props), {
|
|
1774
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
1775
|
+
onRightClick: () => setShowMenu(!showMenu)
|
|
1776
|
+
}), locked ? {} : attributes), locked ? {} : listeners), {
|
|
1777
|
+
children: [
|
|
1778
|
+
children,
|
|
1779
|
+
header.column.getCanFilter() && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1780
|
+
Menu,
|
|
1781
|
+
{
|
|
1782
|
+
ref: menuRootRef,
|
|
1783
|
+
positionTo: node,
|
|
1784
|
+
show: showMenu,
|
|
1785
|
+
setShow: setShowMenu,
|
|
1786
|
+
mobileHide,
|
|
1787
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1788
|
+
MenuOption,
|
|
1789
|
+
__spreadProps(__spreadValues({}, subMenuListeners), {
|
|
1790
|
+
subMenu: (_b2) => {
|
|
1791
|
+
var _c = _b2, { menuId, subMenuLevel } = _c, props2 = __objRest(_c, ["menuId", "subMenuLevel"]);
|
|
1792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1793
|
+
Menu,
|
|
1794
|
+
__spreadProps(__spreadValues({}, props2), {
|
|
1795
|
+
show: isMenuActive(menuId, subMenuLevel),
|
|
1796
|
+
ref: (el) => {
|
|
1797
|
+
registerSubMenu(menuId, el);
|
|
1798
|
+
},
|
|
1799
|
+
children: [
|
|
1800
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_clsx8.default)(paddingUsingComponentGap), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1801
|
+
Search,
|
|
1802
|
+
{
|
|
1803
|
+
onChange: (event) => {
|
|
1804
|
+
setFilter(event.target.value);
|
|
1805
|
+
},
|
|
1806
|
+
onKeyDown: (event) => {
|
|
1807
|
+
if ([" ", "Space"].includes(event.key)) {
|
|
1808
|
+
event.stopPropagation();
|
|
1809
|
+
}
|
|
1810
|
+
},
|
|
1811
|
+
value: filter != null ? filter : ""
|
|
1812
|
+
}
|
|
1813
|
+
) }),
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1815
|
+
MenuOption,
|
|
1816
|
+
{
|
|
1817
|
+
onClick: handleFilterFnChange,
|
|
1818
|
+
before: menuOptionIcon("includesString"),
|
|
1819
|
+
children: "Contains"
|
|
1820
|
+
}
|
|
1821
|
+
),
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1823
|
+
MenuOption,
|
|
1824
|
+
{
|
|
1825
|
+
onClick: handleFilterFnChange,
|
|
1826
|
+
before: menuOptionIcon("startsWith"),
|
|
1827
|
+
children: "Starts with"
|
|
1828
|
+
}
|
|
1829
|
+
),
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1831
|
+
MenuOption,
|
|
1832
|
+
{
|
|
1833
|
+
onClick: handleFilterFnChange,
|
|
1834
|
+
before: menuOptionIcon("endsWith"),
|
|
1835
|
+
children: "Ends with"
|
|
1836
|
+
}
|
|
1837
|
+
)
|
|
1838
|
+
]
|
|
1839
|
+
})
|
|
1840
|
+
);
|
|
1841
|
+
},
|
|
1842
|
+
children: "Filter"
|
|
1843
|
+
})
|
|
1844
|
+
)
|
|
1845
|
+
}
|
|
1846
|
+
)
|
|
1847
|
+
]
|
|
1848
|
+
})
|
|
1849
|
+
);
|
|
1850
|
+
function menuOptionIcon(value) {
|
|
1851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1852
|
+
Icon,
|
|
1853
|
+
{
|
|
1854
|
+
name: "check",
|
|
1855
|
+
className: (0, import_clsx8.default)(
|
|
1856
|
+
header.column.columnDef.filterFn !== value && "text-transparent"
|
|
1857
|
+
)
|
|
1858
|
+
}
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
function handleFilterFnChange(_id, value) {
|
|
1862
|
+
var _a3;
|
|
1863
|
+
let filterFn = "includesString";
|
|
1864
|
+
const currentFilterFn = header.column.columnDef.filterFn;
|
|
1865
|
+
if ((value == null ? void 0 : value.toLowerCase()) === "starts with") {
|
|
1866
|
+
filterFn = currentFilterFn === "startsWith" ? "auto" : "startsWith";
|
|
1867
|
+
}
|
|
1868
|
+
if ((value == null ? void 0 : value.toLowerCase()) === "ends with") {
|
|
1869
|
+
filterFn = currentFilterFn === "endsWith" ? "auto" : "endsWith";
|
|
1870
|
+
}
|
|
1871
|
+
if ((value == null ? void 0 : value.toLowerCase()) === "contains") {
|
|
1872
|
+
filterFn = currentFilterFn === "includesString" ? "auto" : "includesString";
|
|
1873
|
+
}
|
|
1874
|
+
header.column.columnDef.filterFn = filterFn;
|
|
1875
|
+
header.column.setFilterValue((_a3 = header.column.getFilterValue()) != null ? _a3 : "");
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
DraggableCellHeader.displayName = "DraggableCellHeader";
|
|
1879
|
+
function DragAlongCell(_a) {
|
|
1880
|
+
var _b = _a, {
|
|
1881
|
+
cell,
|
|
1882
|
+
children
|
|
1883
|
+
} = _b, props = __objRest(_b, [
|
|
1884
|
+
"cell",
|
|
1885
|
+
"children"
|
|
1886
|
+
]);
|
|
1887
|
+
const { isDragging, setNodeRef, transform } = (0, import_sortable.useSortable)({
|
|
1888
|
+
id: cell.column.id
|
|
1889
|
+
});
|
|
1890
|
+
const style = {
|
|
1891
|
+
opacity: isDragging ? 0.8 : 1,
|
|
1892
|
+
position: "relative",
|
|
1893
|
+
transform: CSS.Translate.toString(transform),
|
|
1894
|
+
transition: "width transform 0.2s ease-in-out",
|
|
1895
|
+
zIndex: isDragging ? 1 : 0,
|
|
1896
|
+
width: cell.column.getSize(),
|
|
1897
|
+
minWidth: "min-content"
|
|
1898
|
+
};
|
|
1899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DataGridCell, __spreadProps(__spreadValues({ style, ref: setNodeRef }, props), { children }));
|
|
1900
|
+
}
|
|
1901
|
+
DragAlongCell.displayName = "DragAlongCell";
|
|
1902
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1903
|
+
0 && (module.exports = {
|
|
1904
|
+
DataGridCell,
|
|
1905
|
+
DragAlongCell,
|
|
1906
|
+
DraggableCellHeader
|
|
1907
|
+
});
|