@marigold/components 16.1.0 → 17.0.1
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/Checkbox-D6DudF_g.mjs +431 -0
- package/dist/Checkbox-DIbAWlSt.cjs +503 -0
- package/dist/index.cjs +1595 -1066
- package/dist/index.d.cts +842 -264
- package/dist/index.d.mts +730 -152
- package/dist/index.mjs +1529 -1014
- package/dist/legacy.cjs +334 -0
- package/dist/legacy.d.cts +60 -0
- package/dist/legacy.d.mts +60 -0
- package/dist/legacy.mjs +333 -0
- package/package.json +50 -36
package/dist/index.cjs
CHANGED
|
@@ -26,12 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
}) : target, mod));
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
|
|
29
|
+
const require_Checkbox = require('./Checkbox-DIbAWlSt.cjs');
|
|
30
30
|
let react_aria_components = require("react-aria-components");
|
|
31
|
+
let __marigold_system = require("@marigold/system");
|
|
31
32
|
let react = require("react");
|
|
32
33
|
react = __toESM(react);
|
|
33
34
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
34
35
|
let __react_aria_i18n = require("@react-aria/i18n");
|
|
36
|
+
let __react_aria_collections = require("@react-aria/collections");
|
|
37
|
+
let motion_react = require("motion/react");
|
|
35
38
|
let __internationalized_date = require("@internationalized/date");
|
|
36
39
|
let __react_aria_calendar = require("@react-aria/calendar");
|
|
37
40
|
let __react_aria_utils = require("@react-aria/utils");
|
|
@@ -44,9 +47,6 @@ let __react_aria_ssr = require("@react-aria/ssr");
|
|
|
44
47
|
let react_dom = require("react-dom");
|
|
45
48
|
let __react_aria_label = require("@react-aria/label");
|
|
46
49
|
let __react_aria_button = require("@react-aria/button");
|
|
47
|
-
let __react_aria_table = require("@react-aria/table");
|
|
48
|
-
let __react_stately_table = require("@react-stately/table");
|
|
49
|
-
let __react_stately_data = require("@react-stately/data");
|
|
50
50
|
let __react_aria_visually_hidden = require("@react-aria/visually-hidden");
|
|
51
51
|
|
|
52
52
|
//#region src/Accordion/AccordionContext.tsx
|
|
@@ -160,6 +160,112 @@ Accordion.Header = AccordionHeader;
|
|
|
160
160
|
Accordion.Content = AccordionPanel;
|
|
161
161
|
Accordion.Item = AccordionItem;
|
|
162
162
|
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/icons/X.tsx
|
|
165
|
+
const X = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
166
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
167
|
+
width: size$1,
|
|
168
|
+
height: size$1,
|
|
169
|
+
viewBox: "0 0 24 24",
|
|
170
|
+
fill: "none",
|
|
171
|
+
stroke: "currentColor",
|
|
172
|
+
strokeWidth: "2",
|
|
173
|
+
strokeLinecap: "round",
|
|
174
|
+
strokeLinejoin: "round",
|
|
175
|
+
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
176
|
+
...props,
|
|
177
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/CloseButton/CloseButton.tsx
|
|
182
|
+
const CloseButton = (0, react.forwardRef)(({ className, size: size$1, variant, ...props }, ref) => {
|
|
183
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
184
|
+
ref,
|
|
185
|
+
className: (0, __marigold_system.useClassNames)({
|
|
186
|
+
component: "CloseButton",
|
|
187
|
+
className,
|
|
188
|
+
size: size$1,
|
|
189
|
+
variant
|
|
190
|
+
}),
|
|
191
|
+
...props,
|
|
192
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(X, {})
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/Text/Text.tsx
|
|
198
|
+
const _Text = ({ variant, size: size$1, color, align, cursor: cursor$1, weight, fontSize, fontStyle, lineHeight, wrap, whiteSpace, children, as = "div", ...props }) => {
|
|
199
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
200
|
+
component: "Text",
|
|
201
|
+
variant,
|
|
202
|
+
size: size$1
|
|
203
|
+
});
|
|
204
|
+
/**
|
|
205
|
+
* Use `<Text>` when a `slot` is used. Make sure `elementType`
|
|
206
|
+
* prop is only used in combination the `<Text>`.
|
|
207
|
+
*/
|
|
208
|
+
const Component$1 = props.slot ? react_aria_components.Text : as;
|
|
209
|
+
const elementType = props.slot ? { elementType: as } : {};
|
|
210
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component$1, {
|
|
211
|
+
...props,
|
|
212
|
+
...elementType,
|
|
213
|
+
className: (0, __marigold_system.cn)("max-w-(--maxTextWidth)", classNames$2, fontStyle && __marigold_system.textStyle[fontStyle], align && __marigold_system.textAlign[align], cursor$1 && __marigold_system.cursorStyle[cursor$1], weight && __marigold_system.fontWeight[weight], fontSize && __marigold_system.textSize[fontSize], lineHeight && __marigold_system.lineHeight[lineHeight], wrap && __marigold_system.textWrap[wrap], whiteSpace && __marigold_system.whiteSpace[whiteSpace]),
|
|
214
|
+
style: { color: color && (0, __marigold_system.ensureCssVar)(color, "color") },
|
|
215
|
+
children
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/ActionBar/ActionButton.tsx
|
|
221
|
+
const ActionButton = ({ onPress, children }) => {
|
|
222
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
223
|
+
onPress,
|
|
224
|
+
className: (0, __marigold_system.useClassNames)({
|
|
225
|
+
component: "Button",
|
|
226
|
+
variant: "ghost",
|
|
227
|
+
size: "default"
|
|
228
|
+
}),
|
|
229
|
+
children
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/ActionBar/ActionBar.tsx
|
|
235
|
+
const ActionBar = ({ children, id, onClearSelection, selectedItemCount = 0, variant, size: size$1 }) => {
|
|
236
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
237
|
+
component: "ActionBar",
|
|
238
|
+
variant,
|
|
239
|
+
size: size$1
|
|
240
|
+
});
|
|
241
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
242
|
+
const isHidden = selectedItemCount === 0;
|
|
243
|
+
const countText = selectedItemCount === "all" ? "All items selected" : `${selectedItemCount} selected`;
|
|
244
|
+
if (isHidden) return null;
|
|
245
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
246
|
+
id,
|
|
247
|
+
className: (0, __marigold_system.cn)("z-30", classNames$2.container),
|
|
248
|
+
role: "toolbar",
|
|
249
|
+
"aria-label": stringFormatter.format("bulkActionsAriaLabel"),
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
252
|
+
className: classNames$2.count,
|
|
253
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Text, { children: countText })
|
|
254
|
+
}),
|
|
255
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
256
|
+
className: classNames$2.actions,
|
|
257
|
+
children
|
|
258
|
+
}),
|
|
259
|
+
onClearSelection && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseButton, {
|
|
260
|
+
"aria-label": stringFormatter.format("clearSelectionAriaLabel"),
|
|
261
|
+
onPress: onClearSelection,
|
|
262
|
+
className: classNames$2.clearButton
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
ActionBar.Button = ActionButton;
|
|
268
|
+
|
|
163
269
|
//#endregion
|
|
164
270
|
//#region src/Aside/Aside.tsx
|
|
165
271
|
/**
|
|
@@ -205,121 +311,15 @@ const Aspect = ({ ratio = "square", maxWidth, children }) => {
|
|
|
205
311
|
const Center = ({ maxWidth = "100%", space = 0, children, ...props }) => {
|
|
206
312
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
207
313
|
...props,
|
|
208
|
-
className: (0, __marigold_system.cn)("
|
|
209
|
-
style:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
//#endregion
|
|
215
|
-
//#region src/icons/TriangleAlert.tsx
|
|
216
|
-
const TriangleAlert = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
217
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
218
|
-
width: size$1,
|
|
219
|
-
height: size$1,
|
|
220
|
-
viewBox: "0 0 24 24",
|
|
221
|
-
fill: "none",
|
|
222
|
-
stroke: "currentColor",
|
|
223
|
-
strokeWidth: "2",
|
|
224
|
-
strokeLinecap: "round",
|
|
225
|
-
strokeLinejoin: "round",
|
|
226
|
-
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
227
|
-
...props,
|
|
228
|
-
children: [
|
|
229
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
230
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 9v4" }),
|
|
231
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 17h.01" })
|
|
232
|
-
]
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
//#endregion
|
|
236
|
-
//#region src/HelpText/HelpText.tsx
|
|
237
|
-
const HelpText = ({ variant, size: size$1, description, errorMessage, ...props }) => {
|
|
238
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
239
|
-
component: "HelpText",
|
|
240
|
-
variant,
|
|
241
|
-
size: size$1
|
|
242
|
-
});
|
|
243
|
-
const ctx = (0, react.useContext)(react_aria_components.FieldErrorContext);
|
|
244
|
-
if (!description && !ctx?.isInvalid) return null;
|
|
245
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
246
|
-
className: (0, __marigold_system.cn)(classNames$2.container),
|
|
247
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.FieldError, {
|
|
248
|
-
...props,
|
|
249
|
-
className: "flex flex-col",
|
|
250
|
-
children: (validation) => {
|
|
251
|
-
/**
|
|
252
|
-
* Prefer custom error messages, fallback to native errors ones.
|
|
253
|
-
*
|
|
254
|
-
* Note that we can not merge custom and native error messages,
|
|
255
|
-
* because we can not distinguish the type of error messages
|
|
256
|
-
* in the native ones since it is just an array of strings.
|
|
257
|
-
*/
|
|
258
|
-
const messages = (typeof errorMessage === "function" ? errorMessage(validation) : errorMessage) || validation.validationErrors;
|
|
259
|
-
return Array.isArray(messages) ? messages.map((msg, idx) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
260
|
-
className: "flex items-center justify-start gap-1",
|
|
261
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TriangleAlert, { className: (0, __marigold_system.cn)("h-4 w-4 shrink-0", classNames$2.icon) }), msg]
|
|
262
|
-
}, idx)) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
263
|
-
className: "flex items-start justify-start gap-1",
|
|
264
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TriangleAlert, { className: (0, __marigold_system.cn)("h-4 w-4 shrink-0", classNames$2.icon) }), messages]
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}), ctx && ctx.isInvalid ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Text, {
|
|
268
|
-
slot: "description",
|
|
269
|
-
children: description
|
|
270
|
-
})]
|
|
271
|
-
});
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
//#endregion
|
|
275
|
-
//#region src/Label/Label.tsx
|
|
276
|
-
const _Label = ({ size: size$1, variant, children, ...props }) => {
|
|
277
|
-
const className = (0, __marigold_system.useClassNames)({
|
|
278
|
-
component: "Label",
|
|
279
|
-
size: size$1,
|
|
280
|
-
variant
|
|
281
|
-
});
|
|
282
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Label, {
|
|
283
|
-
...props,
|
|
284
|
-
className: (0, __marigold_system.cn)(className, "inline-flex"),
|
|
314
|
+
className: (0, __marigold_system.cn)("mx-auto box-content flex flex-col items-center justify-center gap-y-(--space)", "max-w-(--maxWidth)"),
|
|
315
|
+
style: {
|
|
316
|
+
...(0, __marigold_system.createVar)({ maxWidth }),
|
|
317
|
+
...(0, __marigold_system.createSpacingVar)("space", `${space}`)
|
|
318
|
+
},
|
|
285
319
|
children
|
|
286
320
|
});
|
|
287
321
|
};
|
|
288
322
|
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region src/FieldBase/FieldBase.tsx
|
|
291
|
-
const fixedForwardRef = react.forwardRef;
|
|
292
|
-
const _FieldBase = (props, ref) => {
|
|
293
|
-
const { as: Component$1 = "div", children, label, size: size$1, variant, width = "full", description, errorMessage, className, ...rest } = props;
|
|
294
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
295
|
-
component: "Field",
|
|
296
|
-
variant,
|
|
297
|
-
size: size$1
|
|
298
|
-
});
|
|
299
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Component$1, {
|
|
300
|
-
ref,
|
|
301
|
-
className: (0, __marigold_system.cn)("group/field", "flex flex-col", __marigold_system.width[width], classNames$2, className),
|
|
302
|
-
"data-required": props.isRequired ? true : void 0,
|
|
303
|
-
"data-error": props.isInvalid ? true : void 0,
|
|
304
|
-
...rest,
|
|
305
|
-
children: [
|
|
306
|
-
label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Label, {
|
|
307
|
-
variant,
|
|
308
|
-
size: size$1,
|
|
309
|
-
children: label
|
|
310
|
-
}) : null,
|
|
311
|
-
children,
|
|
312
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HelpText, {
|
|
313
|
-
variant,
|
|
314
|
-
size: size$1,
|
|
315
|
-
description,
|
|
316
|
-
errorMessage
|
|
317
|
-
})
|
|
318
|
-
]
|
|
319
|
-
});
|
|
320
|
-
};
|
|
321
|
-
const FieldBase = fixedForwardRef(_FieldBase);
|
|
322
|
-
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/ProgressCircle/ProgressCircle.tsx
|
|
325
325
|
const ProgressCircleSvg = ({ size: size$1 = "16", variant }) => {
|
|
@@ -386,23 +386,6 @@ const Search = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (
|
|
|
386
386
|
})]
|
|
387
387
|
});
|
|
388
388
|
|
|
389
|
-
//#endregion
|
|
390
|
-
//#region src/icons/X.tsx
|
|
391
|
-
const X = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
392
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
393
|
-
width: size$1,
|
|
394
|
-
height: size$1,
|
|
395
|
-
viewBox: "0 0 24 24",
|
|
396
|
-
fill: "none",
|
|
397
|
-
stroke: "currentColor",
|
|
398
|
-
strokeWidth: "2",
|
|
399
|
-
strokeLinecap: "round",
|
|
400
|
-
strokeLinejoin: "round",
|
|
401
|
-
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
402
|
-
...props,
|
|
403
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
404
|
-
});
|
|
405
|
-
|
|
406
389
|
//#endregion
|
|
407
390
|
//#region src/Input/Input.tsx
|
|
408
391
|
const _Input = (0, react.forwardRef)(({ type, icon, action, variant, size: size$1, className, ...props }, ref) => {
|
|
@@ -420,17 +403,17 @@ const _Input = (0, react.forwardRef)(({ type, icon, action, variant, size: size$
|
|
|
420
403
|
className: (0, __marigold_system.cn)("absolute right-0 cursor-pointer", classNames$2.action, action.props.className)
|
|
421
404
|
}) : null;
|
|
422
405
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
423
|
-
className: "group/input relative flex items-center",
|
|
406
|
+
className: (0, __marigold_system.cn)("group/input relative flex w-(--field-width) max-w-full min-w-0 items-center"),
|
|
424
407
|
"data-icon": icon && "",
|
|
425
408
|
"data-action": action && "",
|
|
426
409
|
children: [
|
|
427
|
-
inputIcon,
|
|
428
410
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Input, {
|
|
429
411
|
...props,
|
|
430
|
-
className: (0, __marigold_system.cn)("
|
|
412
|
+
className: (0, __marigold_system.cn)("flex-1", "disabled:cursor-not-allowed", "[&[type=file]]:border-none [&[type=file]]:p-0", "[&[type=color]]:ml-0 [&[type=color]]:border-none [&[type=color]]:bg-transparent [&[type=color]]:p-0", classNames$2.input, className),
|
|
431
413
|
ref,
|
|
432
414
|
type
|
|
433
415
|
}),
|
|
416
|
+
inputIcon,
|
|
434
417
|
inputAction
|
|
435
418
|
]
|
|
436
419
|
});
|
|
@@ -449,7 +432,10 @@ const SearchInput = (0, react.forwardRef)(({ className, loading, onClear, ...pro
|
|
|
449
432
|
type: "search",
|
|
450
433
|
className: (0, __marigold_system.cn)("[&::-webkit-search-cancel-button]:hidden", className?.input),
|
|
451
434
|
ref,
|
|
452
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
435
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
436
|
+
"aria-hidden": "true",
|
|
437
|
+
size: "16"
|
|
438
|
+
}),
|
|
453
439
|
action: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressCircle, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
454
440
|
className: className?.action,
|
|
455
441
|
onPress: () => onClear?.(),
|
|
@@ -467,23 +453,6 @@ const SearchInput = (0, react.forwardRef)(({ className, loading, onClear, ...pro
|
|
|
467
453
|
const ListBoxContext = (0, react.createContext)({});
|
|
468
454
|
const useListBoxContext = () => (0, react.useContext)(ListBoxContext);
|
|
469
455
|
|
|
470
|
-
//#endregion
|
|
471
|
-
//#region src/icons/Check.tsx
|
|
472
|
-
const Check = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
473
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
474
|
-
width: size$1,
|
|
475
|
-
height: size$1,
|
|
476
|
-
viewBox: "0 0 24 24",
|
|
477
|
-
fill: "none",
|
|
478
|
-
stroke: "currentColor",
|
|
479
|
-
strokeWidth: "2",
|
|
480
|
-
strokeLinecap: "round",
|
|
481
|
-
strokeLinejoin: "round",
|
|
482
|
-
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
483
|
-
...props,
|
|
484
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M20 6 9 17l-5-5" })
|
|
485
|
-
});
|
|
486
|
-
|
|
487
456
|
//#endregion
|
|
488
457
|
//#region src/ListBox/ListBoxItem.tsx
|
|
489
458
|
const _ListBoxItem = ({ ...props }) => {
|
|
@@ -494,7 +463,7 @@ const _ListBoxItem = ({ ...props }) => {
|
|
|
494
463
|
textValue: props.textValue ?? String(props.children),
|
|
495
464
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
496
465
|
className: "selection-indicator contents",
|
|
497
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Check, {
|
|
466
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Check, {
|
|
498
467
|
size: 16,
|
|
499
468
|
strokeWidth: "3",
|
|
500
469
|
className: "hidden"
|
|
@@ -529,7 +498,7 @@ const _ListBox = (0, react.forwardRef)(({ variant, size: size$1, ...props }, ref
|
|
|
529
498
|
className: classNames$2.container,
|
|
530
499
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.ListBox, {
|
|
531
500
|
...props,
|
|
532
|
-
className: (0, __marigold_system.cn)("overflow-y-auto
|
|
501
|
+
className: (0, __marigold_system.cn)("overflow-y-auto", classNames$2.list),
|
|
533
502
|
ref,
|
|
534
503
|
...listBoxProps,
|
|
535
504
|
children: props.children
|
|
@@ -540,31 +509,9 @@ const _ListBox = (0, react.forwardRef)(({ variant, size: size$1, ...props }, ref
|
|
|
540
509
|
_ListBox.Item = _ListBoxItem;
|
|
541
510
|
_ListBox.Section = _Section;
|
|
542
511
|
|
|
543
|
-
//#endregion
|
|
544
|
-
//#region src/Overlay/Underlay.tsx
|
|
545
|
-
const Underlay = ({ size: size$1, variant, open, dismissable, keyboardDismissable, ...rest }) => {
|
|
546
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
547
|
-
component: "Underlay",
|
|
548
|
-
size: size$1,
|
|
549
|
-
variant
|
|
550
|
-
});
|
|
551
|
-
const props = {
|
|
552
|
-
isOpen: open,
|
|
553
|
-
isDismissable: dismissable,
|
|
554
|
-
isKeyboardDismissDisabled: keyboardDismissable,
|
|
555
|
-
...rest
|
|
556
|
-
};
|
|
557
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.ModalOverlay, {
|
|
558
|
-
className: ({ isEntering, isExiting }) => (0, __marigold_system.cn)("fixed inset-0 z-40 grid place-items-center overflow-y-auto", isEntering ? "animate-in fade-in duration-300 ease-out" : "", isExiting ? "animate-out fade-out duration-200 ease-in" : "", classNames$2),
|
|
559
|
-
...props,
|
|
560
|
-
"data-testid": "underlay-id",
|
|
561
|
-
children: props.children
|
|
562
|
-
});
|
|
563
|
-
};
|
|
564
|
-
|
|
565
512
|
//#endregion
|
|
566
513
|
//#region src/Overlay/Popover.tsx
|
|
567
|
-
const _Popover = (0, react.forwardRef)(({ keyboardDismissDisabled, placement, open, children, ...rest }, ref) => {
|
|
514
|
+
const _Popover = (0, react.forwardRef)(({ keyboardDismissDisabled, placement, offset: offset$1 = 0, open, children, ...rest }, ref) => {
|
|
568
515
|
const props = {
|
|
569
516
|
isKeyboardDismissDisabled: keyboardDismissDisabled,
|
|
570
517
|
isOpen: open,
|
|
@@ -576,97 +523,272 @@ const _Popover = (0, react.forwardRef)(({ keyboardDismissDisabled, placement, op
|
|
|
576
523
|
variant: placement,
|
|
577
524
|
className: "min-w-(--trigger-width)"
|
|
578
525
|
});
|
|
579
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
580
|
-
ref,
|
|
581
|
-
...props,
|
|
582
|
-
className: (0, __marigold_system.cn)("fixed! top-auto! bottom-0! left-0! max-h-fit! w-full", classNames$2),
|
|
583
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Underlay, { open })]
|
|
584
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Popover, {
|
|
526
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Popover, {
|
|
585
527
|
ref,
|
|
586
528
|
...props,
|
|
587
|
-
className: classNames$2,
|
|
529
|
+
className: (0, __marigold_system.cn)("z-30 flex", classNames$2),
|
|
588
530
|
placement,
|
|
589
|
-
offset:
|
|
531
|
+
offset: offset$1,
|
|
590
532
|
children
|
|
591
|
-
})
|
|
533
|
+
});
|
|
592
534
|
});
|
|
593
535
|
|
|
594
536
|
//#endregion
|
|
595
|
-
//#region src/
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
537
|
+
//#region src/Button/Button.tsx
|
|
538
|
+
const _Button = (0, react.forwardRef)(({ children, variant, size: size$1, disabled, loading, fullWidth, ...props }, ref) => {
|
|
539
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
540
|
+
component: "Button",
|
|
541
|
+
variant,
|
|
542
|
+
size: size$1
|
|
543
|
+
});
|
|
544
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
545
|
+
...props,
|
|
546
|
+
ref,
|
|
547
|
+
className: (0, __marigold_system.cn)(classNames$2, fullWidth ? "w-full" : void 0, loading && "cursor-progress!"),
|
|
548
|
+
isPending: loading,
|
|
549
|
+
isDisabled: disabled,
|
|
550
|
+
children: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
551
|
+
className: "absolute",
|
|
552
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressCircle, {})
|
|
553
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
554
|
+
className: "invisible flex gap-[inherit]",
|
|
555
|
+
children
|
|
556
|
+
})] }) : children
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region src/Tray/Context.tsx
|
|
562
|
+
const TrayContext = (0, react.createContext)(null);
|
|
563
|
+
const useTrayContext = () => (0, react.useContext)(TrayContext);
|
|
564
|
+
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region src/Tray/TrayActions.tsx
|
|
567
|
+
const TrayActions = ({ children }) => {
|
|
568
|
+
const { classNames: classNames$2 } = useTrayContext();
|
|
569
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
570
|
+
className: (0, __marigold_system.cn)("[grid-area:actions]", classNames$2.actions),
|
|
571
|
+
children
|
|
572
|
+
});
|
|
627
573
|
};
|
|
628
574
|
|
|
629
575
|
//#endregion
|
|
630
|
-
//#region src/
|
|
631
|
-
const
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
loading,
|
|
637
|
-
className: { action: (0, __marigold_system.cn)(state?.inputValue === "" ? "invisible" : "visible", classNames$2) },
|
|
638
|
-
onKeyDown: (e$1) => {
|
|
639
|
-
if (e$1.key === "Enter" || e$1.key === "Escape") e$1.preventDefault();
|
|
640
|
-
if (e$1.key === "Enter") {
|
|
641
|
-
if (state?.selectionManager.focusedKey === null) onSubmit?.(null, state?.inputValue);
|
|
642
|
-
}
|
|
576
|
+
//#region src/Tray/TrayContent.tsx
|
|
577
|
+
const TrayContent = ({ children, className }) => {
|
|
578
|
+
const { classNames: classNames$2 } = useTrayContext();
|
|
579
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
580
|
+
ref: (node$1) => {
|
|
581
|
+
if (node$1 && !node$1.style.minHeight) node$1.style.minHeight = `${node$1.offsetHeight}px`;
|
|
643
582
|
},
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
state?.setSelectedKey(null);
|
|
647
|
-
onClear?.();
|
|
648
|
-
}
|
|
583
|
+
className: (0, __marigold_system.cn)("[grid-area:content]", classNames$2.content, className),
|
|
584
|
+
children
|
|
649
585
|
});
|
|
650
586
|
};
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
587
|
+
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/Tray/TrayModal.tsx
|
|
590
|
+
const MotionModal = motion_react.motion.create(react_aria_components.Modal);
|
|
591
|
+
const MotionModalOverlay = motion_react.motion.create(react_aria_components.ModalOverlay);
|
|
592
|
+
const inertiaTransition = {
|
|
593
|
+
type: "inertia",
|
|
594
|
+
bounceStiffness: 300,
|
|
595
|
+
bounceDamping: 40,
|
|
596
|
+
timeConstant: 300
|
|
597
|
+
};
|
|
598
|
+
const staticTransition = {
|
|
599
|
+
duration: .5,
|
|
600
|
+
ease: (0, motion_react.cubicBezier)(.32, .72, 0, 1)
|
|
601
|
+
};
|
|
602
|
+
const TrayModal = ({ open, onOpenChange, dismissable = true, keyboardDismissable = true, children }) => {
|
|
603
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({ component: "Tray" });
|
|
604
|
+
const state = (0, react.useContext)(react_aria_components.OverlayTriggerStateContext);
|
|
605
|
+
const h$1 = typeof window !== "undefined" ? window.innerHeight : 0;
|
|
606
|
+
const y$1 = (0, motion_react.useMotionValue)(h$1);
|
|
607
|
+
const handleOpenChange = (isOpen) => {
|
|
608
|
+
onOpenChange?.(isOpen);
|
|
609
|
+
if (!isOpen) state?.close();
|
|
610
|
+
};
|
|
611
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, { children: open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MotionModalOverlay, {
|
|
612
|
+
isOpen: true,
|
|
613
|
+
onOpenChange: handleOpenChange,
|
|
614
|
+
isDismissable: dismissable,
|
|
615
|
+
isKeyboardDismissDisabled: !keyboardDismissable,
|
|
616
|
+
className: (0, __marigold_system.cn)(classNames$2.overlay),
|
|
617
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MotionModal, {
|
|
618
|
+
className: classNames$2.container,
|
|
619
|
+
initial: { y: h$1 },
|
|
620
|
+
animate: { y: 0 },
|
|
621
|
+
exit: { y: h$1 },
|
|
622
|
+
transition: staticTransition,
|
|
623
|
+
style: { y: y$1 },
|
|
624
|
+
drag: "y",
|
|
625
|
+
dragConstraints: { top: 0 },
|
|
626
|
+
onDragEnd: (_e, { offset: offset$1, velocity }) => {
|
|
627
|
+
if (offset$1.y > window.innerHeight * .75 || velocity.y > 10) handleOpenChange(false);
|
|
628
|
+
else (0, motion_react.animate)(y$1, 0, {
|
|
629
|
+
...inertiaTransition,
|
|
630
|
+
min: 0,
|
|
631
|
+
max: 0
|
|
632
|
+
});
|
|
633
|
+
},
|
|
634
|
+
children
|
|
635
|
+
})
|
|
636
|
+
}) });
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
//#endregion
|
|
640
|
+
//#region src/Tray/TrayTitle.tsx
|
|
641
|
+
const TrayTitle = ({ children }) => {
|
|
642
|
+
const { classNames: classNames$2 } = useTrayContext();
|
|
643
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Header, {
|
|
644
|
+
className: (0, __marigold_system.cn)("[grid-area:title]", classNames$2.header),
|
|
645
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Heading, {
|
|
646
|
+
slot: "title",
|
|
647
|
+
level: 2,
|
|
648
|
+
className: classNames$2.title,
|
|
649
|
+
children
|
|
650
|
+
})
|
|
651
|
+
});
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region src/Tray/TrayTrigger.tsx
|
|
656
|
+
const TrayTrigger = ({ open, children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.DialogTrigger, {
|
|
657
|
+
isOpen: open,
|
|
658
|
+
...props,
|
|
659
|
+
children
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region src/Tray/Tray.tsx
|
|
664
|
+
const Tray = ({ open, onOpenChange, dismissable = true, keyboardDismissable = true, children, ...props }) => {
|
|
665
|
+
const state = (0, react.useContext)(react_aria_components.OverlayTriggerStateContext);
|
|
666
|
+
const isHidden = (0, __react_aria_collections.useIsHidden)();
|
|
667
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({ component: "Tray" });
|
|
668
|
+
const openState = open ?? state?.isOpen;
|
|
669
|
+
if (isHidden) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TrayContext.Provider, {
|
|
670
|
+
value: { classNames: classNames$2 },
|
|
671
|
+
children
|
|
672
|
+
});
|
|
673
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TrayContext.Provider, {
|
|
674
|
+
value: { classNames: classNames$2 },
|
|
675
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TrayModal, {
|
|
676
|
+
open: openState,
|
|
677
|
+
dismissable,
|
|
678
|
+
onOpenChange,
|
|
679
|
+
keyboardDismissable,
|
|
680
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Dialog, {
|
|
681
|
+
...props,
|
|
682
|
+
className: (0, __marigold_system.cn)("group/tray [grid-template-areas:'drag'_'title'_'content'_'actions']", classNames$2.container),
|
|
683
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, __marigold_system.cn)("[grid-area:drag]", classNames$2.dragHandle) }), children]
|
|
684
|
+
})
|
|
685
|
+
})
|
|
686
|
+
});
|
|
687
|
+
};
|
|
688
|
+
Tray.Trigger = TrayTrigger;
|
|
689
|
+
Tray.Title = TrayTitle;
|
|
690
|
+
Tray.Content = TrayContent;
|
|
691
|
+
Tray.Actions = TrayActions;
|
|
692
|
+
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/Autocomplete/MobileAutocomplete.tsx
|
|
695
|
+
const MobileAutocompleteTrigger = ({ placeholder }) => {
|
|
696
|
+
const state = (0, react.useContext)(react_aria_components.ComboBoxStateContext);
|
|
697
|
+
const inputClassNames = (0, __marigold_system.useClassNames)({ component: "Input" });
|
|
698
|
+
const autocompleteClassNames = (0, __marigold_system.useClassNames)({ component: "Autocomplete" });
|
|
699
|
+
const displayText = state?.selectedItem?.textValue || "";
|
|
700
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
701
|
+
className: autocompleteClassNames.mobileTrigger,
|
|
702
|
+
"data-icon": "",
|
|
703
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
704
|
+
"aria-hidden": "true",
|
|
705
|
+
size: "16",
|
|
706
|
+
className: (0, __marigold_system.cn)("pointer-events-none absolute z-10", inputClassNames.icon)
|
|
707
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
708
|
+
className: (0, __marigold_system.cn)("w-full flex-1 text-left", "group-data-error/field:ui-state-error", "group-data-focus-visible/trigger:ui-state-focus", inputClassNames.input),
|
|
709
|
+
children: displayText || /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
710
|
+
className: "text-muted-foreground",
|
|
711
|
+
children: placeholder
|
|
712
|
+
})
|
|
713
|
+
})]
|
|
714
|
+
});
|
|
715
|
+
};
|
|
716
|
+
const MobileAutocomplete = ({ placeholder, label, emptyState, children, input }) => {
|
|
717
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
718
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray.Trigger, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
719
|
+
className: "group/trigger outline-none",
|
|
720
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileAutocompleteTrigger, { placeholder })
|
|
721
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray, { children: [
|
|
722
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Title, { children: label }),
|
|
723
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray.Content, {
|
|
724
|
+
className: "flex flex-col gap-2",
|
|
725
|
+
children: [input, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ListBox, {
|
|
726
|
+
renderEmptyState: () => emptyState ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Center, { children: stringFormatter.format("noResultsFound") }),
|
|
727
|
+
children
|
|
728
|
+
})]
|
|
729
|
+
}),
|
|
730
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Actions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Button, {
|
|
731
|
+
slot: "close",
|
|
732
|
+
children: stringFormatter.format("close")
|
|
733
|
+
}) })
|
|
734
|
+
] })] });
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/Autocomplete/Autocomplete.tsx
|
|
739
|
+
const AutocompleteInput = ({ loading, onSubmit, onClear, ref, autoFocus }) => {
|
|
740
|
+
const state = (0, react.useContext)(react_aria_components.ComboBoxStateContext);
|
|
741
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({ component: "ComboBox" });
|
|
742
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
743
|
+
ref,
|
|
744
|
+
loading,
|
|
745
|
+
autoFocus,
|
|
746
|
+
className: { action: (0, __marigold_system.cn)(state?.inputValue === "" ? "invisible" : "visible", classNames$2) },
|
|
747
|
+
onKeyDown: (e$1) => {
|
|
748
|
+
if (e$1.key === "Enter" || e$1.key === "Escape") e$1.preventDefault();
|
|
749
|
+
if (e$1.key === "Enter") {
|
|
750
|
+
if (state?.selectionManager.focusedKey === null) onSubmit?.(null, state?.inputValue);
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
onClear: () => {
|
|
754
|
+
state?.setInputValue("");
|
|
755
|
+
state?.setSelectedKey(null);
|
|
756
|
+
onClear?.();
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
const _Autocomplete = (0, react.forwardRef)(({ children, defaultValue, value, disabled, error, readOnly, required, emptyState, loading, onChange, onClear, onSubmit, ...rest }, ref) => {
|
|
761
|
+
const props = {
|
|
762
|
+
onSelectionChange: (key) => key !== null && onSubmit?.(key, null),
|
|
763
|
+
defaultInputValue: defaultValue,
|
|
764
|
+
inputValue: value,
|
|
765
|
+
onInputChange: onChange,
|
|
766
|
+
allowsCustomValue: true,
|
|
767
|
+
isDisabled: disabled,
|
|
659
768
|
isInvalid: error,
|
|
660
769
|
isReadOnly: readOnly,
|
|
661
770
|
isRequired: required,
|
|
662
771
|
...rest
|
|
663
772
|
};
|
|
664
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages);
|
|
665
|
-
|
|
773
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
774
|
+
const isSmallScreen = (0, __marigold_system.useSmallScreen)();
|
|
775
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
666
776
|
as: react_aria_components.ComboBox,
|
|
667
777
|
ref,
|
|
668
778
|
...props,
|
|
669
|
-
children:
|
|
779
|
+
children: isSmallScreen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileAutocomplete, {
|
|
780
|
+
placeholder: rest.placeholder,
|
|
781
|
+
label: rest.label,
|
|
782
|
+
emptyState,
|
|
783
|
+
input: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutocompleteInput, {
|
|
784
|
+
loading,
|
|
785
|
+
onSubmit,
|
|
786
|
+
onClear,
|
|
787
|
+
ref,
|
|
788
|
+
autoFocus: true
|
|
789
|
+
}),
|
|
790
|
+
children
|
|
791
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutocompleteInput, {
|
|
670
792
|
loading,
|
|
671
793
|
onSubmit,
|
|
672
794
|
onClear,
|
|
@@ -674,23 +796,55 @@ const _Autocomplete = (0, react.forwardRef)(({ children, defaultValue, value, di
|
|
|
674
796
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Popover, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ListBox, {
|
|
675
797
|
renderEmptyState: () => emptyState ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Center, { children: stringFormatter.format("noResultsFound") }),
|
|
676
798
|
children
|
|
677
|
-
}) })]
|
|
799
|
+
}) })] })
|
|
678
800
|
});
|
|
679
801
|
});
|
|
680
802
|
_Autocomplete.Option = _ListBox.Item;
|
|
681
803
|
_Autocomplete.Section = _ListBox.Section;
|
|
682
804
|
|
|
805
|
+
//#endregion
|
|
806
|
+
//#region src/icons/Lock.tsx
|
|
807
|
+
const Lock = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
808
|
+
"data-testid": "lock-icon",
|
|
809
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
810
|
+
width: size$1,
|
|
811
|
+
height: size$1,
|
|
812
|
+
viewBox: "0 0 24 24",
|
|
813
|
+
fill: "none",
|
|
814
|
+
stroke: "currentColor",
|
|
815
|
+
strokeWidth: "2",
|
|
816
|
+
strokeLinecap: "round",
|
|
817
|
+
strokeLinejoin: "round",
|
|
818
|
+
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
819
|
+
...props,
|
|
820
|
+
children: [
|
|
821
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
822
|
+
cx: "12",
|
|
823
|
+
cy: "16",
|
|
824
|
+
r: "1"
|
|
825
|
+
}),
|
|
826
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
827
|
+
x: "3",
|
|
828
|
+
y: "10",
|
|
829
|
+
width: "18",
|
|
830
|
+
height: "12",
|
|
831
|
+
rx: "2"
|
|
832
|
+
}),
|
|
833
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7 10V7a5 5 0 0 1 10 0v3" })
|
|
834
|
+
]
|
|
835
|
+
});
|
|
836
|
+
|
|
683
837
|
//#endregion
|
|
684
838
|
//#region src/Badge/Badge.tsx
|
|
685
839
|
const Badge = ({ variant, size: size$1, children, ...props }) => {
|
|
686
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
840
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
687
841
|
className: (0, __marigold_system.useClassNames)({
|
|
688
842
|
component: "Badge",
|
|
689
843
|
variant,
|
|
690
844
|
size: size$1
|
|
691
845
|
}),
|
|
692
846
|
...props,
|
|
693
|
-
children
|
|
847
|
+
children: [["master", "admin"].includes(variant ?? "") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Lock, { size: 16 }), children]
|
|
694
848
|
});
|
|
695
849
|
};
|
|
696
850
|
|
|
@@ -728,7 +882,7 @@ const IconButton = ({ className, children, variant, size: size$1, ...props }) =>
|
|
|
728
882
|
//#endregion
|
|
729
883
|
//#region src/Breadcrumbs/BreadcrumbEllipsis.tsx
|
|
730
884
|
const BreadcrumbEllipsis = ({ hiddenItems = [], disabled = false }) => {
|
|
731
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages, "marigold");
|
|
885
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages, "marigold");
|
|
732
886
|
const { container, item: menuItem } = (0, __marigold_system.useClassNames)({ component: "Menu" });
|
|
733
887
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.MenuTrigger, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
|
|
734
888
|
"aria-label": stringFormatter.format("hiddenBreadcrumbs"),
|
|
@@ -808,30 +962,6 @@ const Breakout = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("d
|
|
|
808
962
|
children
|
|
809
963
|
});
|
|
810
964
|
|
|
811
|
-
//#endregion
|
|
812
|
-
//#region src/Button/Button.tsx
|
|
813
|
-
const _Button = (0, react.forwardRef)(({ children, variant, size: size$1, disabled, loading, fullWidth, ...props }, ref) => {
|
|
814
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
815
|
-
component: "Button",
|
|
816
|
-
variant,
|
|
817
|
-
size: size$1
|
|
818
|
-
});
|
|
819
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
820
|
-
...props,
|
|
821
|
-
ref,
|
|
822
|
-
className: (0, __marigold_system.cn)(classNames$2, fullWidth ? "w-full" : void 0, loading && "cursor-progress!"),
|
|
823
|
-
isPending: loading,
|
|
824
|
-
isDisabled: disabled,
|
|
825
|
-
children: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
826
|
-
className: "absolute",
|
|
827
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressCircle, {})
|
|
828
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
829
|
-
className: "invisible flex gap-[inherit]",
|
|
830
|
-
children
|
|
831
|
-
})] }) : children
|
|
832
|
-
});
|
|
833
|
-
});
|
|
834
|
-
|
|
835
965
|
//#endregion
|
|
836
966
|
//#region src/Calendar/CalendarGridHeader.tsx
|
|
837
967
|
function CalendarGridHeader(props) {
|
|
@@ -865,9 +995,10 @@ function CalendarGridHeader(props) {
|
|
|
865
995
|
|
|
866
996
|
//#endregion
|
|
867
997
|
//#region src/Calendar/CalendarGrid.tsx
|
|
868
|
-
const _CalendarGrid = () => {
|
|
998
|
+
const _CalendarGrid = ({ offset: offset$1 }) => {
|
|
869
999
|
const classNames$2 = (0, __marigold_system.useClassNames)({ component: "Calendar" });
|
|
870
1000
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.CalendarGrid, {
|
|
1001
|
+
offset: offset$1,
|
|
871
1002
|
className: classNames$2.calendarGrid,
|
|
872
1003
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarGridHeader, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.CalendarCell, {
|
|
873
1004
|
date,
|
|
@@ -877,8 +1008,8 @@ const _CalendarGrid = () => {
|
|
|
877
1008
|
};
|
|
878
1009
|
|
|
879
1010
|
//#endregion
|
|
880
|
-
//#region src/icons/
|
|
881
|
-
const
|
|
1011
|
+
//#region src/icons/ChevronLeft.tsx
|
|
1012
|
+
const ChevronLeft = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
882
1013
|
xmlns: "http://www.w3.org/2000/svg",
|
|
883
1014
|
width: size$1,
|
|
884
1015
|
height: size$1,
|
|
@@ -890,13 +1021,75 @@ const ChevronsVertical = ({ size: size$1 = 24, className, ...props }) => /* @__P
|
|
|
890
1021
|
strokeLinejoin: "round",
|
|
891
1022
|
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
892
1023
|
...props,
|
|
893
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "
|
|
1024
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m15 18-6-6 6-6" })
|
|
894
1025
|
});
|
|
895
1026
|
|
|
896
1027
|
//#endregion
|
|
897
1028
|
//#region src/Calendar/Context.tsx
|
|
898
|
-
const CalendarContext = (0, react.createContext)(
|
|
899
|
-
const useCalendarContext = () =>
|
|
1029
|
+
const CalendarContext = (0, react.createContext)(null);
|
|
1030
|
+
const useCalendarContext = () => {
|
|
1031
|
+
const ctx = (0, react.useContext)(CalendarContext);
|
|
1032
|
+
if (!ctx) throw new Error("Calendar components must be used within <Calendar>");
|
|
1033
|
+
return ctx;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
//#endregion
|
|
1037
|
+
//#region src/Calendar/CalendarHeader.tsx
|
|
1038
|
+
const CalendarHeader = ({ monthOffset = 0, showPrevious = true, showNext = true }) => {
|
|
1039
|
+
const state = (0, react.useContext)(react_aria_components.CalendarStateContext);
|
|
1040
|
+
const { classNames: classNames$2 } = useCalendarContext();
|
|
1041
|
+
const monthFormatter = (0, __react_aria_i18n.useDateFormatter)({
|
|
1042
|
+
month: "long",
|
|
1043
|
+
year: "numeric",
|
|
1044
|
+
timeZone: state.timeZone
|
|
1045
|
+
});
|
|
1046
|
+
const monthDate = state.visibleRange.start.add({ months: monthOffset });
|
|
1047
|
+
const formattedMonth = monthFormatter.format(monthDate.toDate(state.timeZone));
|
|
1048
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1049
|
+
className: "mb-4 flex min-h-[36px] items-center justify-between",
|
|
1050
|
+
children: [
|
|
1051
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1052
|
+
className: "flex-1",
|
|
1053
|
+
children: showPrevious && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
|
|
1054
|
+
className: (0, __marigold_system.cn)("inline-flex items-center justify-center gap-[0.5ch]", classNames$2.calendarControllers),
|
|
1055
|
+
variant: "navigation",
|
|
1056
|
+
slot: "previous",
|
|
1057
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronLeft, { size: "20" })
|
|
1058
|
+
})
|
|
1059
|
+
}),
|
|
1060
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Heading, {
|
|
1061
|
+
className: "text-sm font-medium",
|
|
1062
|
+
children: formattedMonth
|
|
1063
|
+
}),
|
|
1064
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1065
|
+
className: "flex flex-1 justify-end",
|
|
1066
|
+
children: showNext && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
|
|
1067
|
+
className: (0, __marigold_system.cn)("inline-flex items-center justify-center gap-[0.5ch]", classNames$2.calendarControllers),
|
|
1068
|
+
variant: "navigation",
|
|
1069
|
+
slot: "next",
|
|
1070
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronRight, { size: "20" })
|
|
1071
|
+
})
|
|
1072
|
+
})
|
|
1073
|
+
]
|
|
1074
|
+
});
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region src/icons/ChevronsVertical.tsx
|
|
1079
|
+
const ChevronsVertical = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1080
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1081
|
+
width: size$1,
|
|
1082
|
+
height: size$1,
|
|
1083
|
+
viewBox: "0 0 24 24",
|
|
1084
|
+
fill: "none",
|
|
1085
|
+
stroke: "currentColor",
|
|
1086
|
+
strokeWidth: "2",
|
|
1087
|
+
strokeLinecap: "round",
|
|
1088
|
+
strokeLinejoin: "round",
|
|
1089
|
+
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
1090
|
+
...props,
|
|
1091
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7 15l5 5 5-5M7 9l5-5 5 5" })
|
|
1092
|
+
});
|
|
900
1093
|
|
|
901
1094
|
//#endregion
|
|
902
1095
|
//#region src/Calendar/useFormattedMonths.tsx
|
|
@@ -934,23 +1127,6 @@ const CalendarListBox = ({ type, isDisabled, setSelectedDropdown }) => {
|
|
|
934
1127
|
});
|
|
935
1128
|
};
|
|
936
1129
|
|
|
937
|
-
//#endregion
|
|
938
|
-
//#region src/icons/ChevronLeft.tsx
|
|
939
|
-
const ChevronLeft = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
940
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
941
|
-
width: size$1,
|
|
942
|
-
height: size$1,
|
|
943
|
-
viewBox: "0 0 24 24",
|
|
944
|
-
fill: "none",
|
|
945
|
-
stroke: "currentColor",
|
|
946
|
-
strokeWidth: "2",
|
|
947
|
-
strokeLinecap: "round",
|
|
948
|
-
strokeLinejoin: "round",
|
|
949
|
-
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
950
|
-
...props,
|
|
951
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m15 18-6-6 6-6" })
|
|
952
|
-
});
|
|
953
|
-
|
|
954
1130
|
//#endregion
|
|
955
1131
|
//#region src/Calendar/MonthControls.tsx
|
|
956
1132
|
function MonthControls() {
|
|
@@ -1046,350 +1222,138 @@ const YearListBox = ({ setSelectedDropdown, minValue, maxValue }) => {
|
|
|
1046
1222
|
format: (year) => formatter.format(year.toDate(state.timeZone))
|
|
1047
1223
|
});
|
|
1048
1224
|
};
|
|
1049
|
-
var YearListBox_default = YearListBox;
|
|
1050
|
-
|
|
1051
|
-
//#endregion
|
|
1052
|
-
//#region src/Calendar/calendarListBoxSelectableCheck.ts
|
|
1053
|
-
function hasOnlyOneSelectableMonth(minValue, maxValue) {
|
|
1054
|
-
if (!minValue || !maxValue || minValue.year !== maxValue.year) return false;
|
|
1055
|
-
return maxValue.month - minValue.month === 0;
|
|
1056
|
-
}
|
|
1057
|
-
function hasOnlyOneSelectableYear(minValue, maxValue) {
|
|
1058
|
-
if (!minValue || !maxValue || minValue.year !== maxValue.year) return false;
|
|
1059
|
-
return true;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
//#endregion
|
|
1063
|
-
//#region src/Calendar/Calendar.tsx
|
|
1064
|
-
const _Calendar = ({ disabled, readOnly, size: size$1, variant, width = "fit", dateUnavailable, minValue
|
|
1065
|
-
const
|
|
1066
|
-
const
|
|
1067
|
-
const props = {
|
|
1068
|
-
isDisabled: disabled,
|
|
1069
|
-
isReadOnly: readOnly,
|
|
1070
|
-
isDateUnavailable: dateUnavailable,
|
|
1071
|
-
minValue,
|
|
1072
|
-
maxValue,
|
|
1073
|
-
...rest
|
|
1074
|
-
};
|
|
1075
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1076
|
-
component: "Calendar",
|
|
1077
|
-
size: size$1,
|
|
1078
|
-
variant
|
|
1079
|
-
});
|
|
1080
|
-
const [selectedDropdown, setSelectedDropdown] = (0, react.useState)();
|
|
1081
|
-
const ViewMap = {
|
|
1082
|
-
month: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthListBox_default, {
|
|
1083
|
-
setSelectedDropdown,
|
|
1084
|
-
minValue,
|
|
1085
|
-
maxValue
|
|
1086
|
-
}),
|
|
1087
|
-
year: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(YearListBox_default, {
|
|
1088
|
-
setSelectedDropdown,
|
|
1089
|
-
minValue,
|
|
1090
|
-
maxValue
|
|
1091
|
-
})
|
|
1092
|
-
};
|
|
1093
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarContext.Provider, {
|
|
1094
|
-
value: { classNames: classNames$2 },
|
|
1095
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Calendar, {
|
|
1096
|
-
className: (0, __marigold_system.cn)("relative flex min-h-[350px] flex-col rounded-xs p-4", __marigold_system.width[width], classNames$2.calendar),
|
|
1097
|
-
...props,
|
|
1098
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1099
|
-
className: (0, __marigold_system.cn)("pointer-events-none absolute top-1/2 left-0 w-full -translate-y-1/2 opacity-0", selectedDropdown && "pointer-events-auto opacity-100"),
|
|
1100
|
-
children: ViewMap[selectedDropdown]
|
|
1101
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1102
|
-
className: (0, __marigold_system.cn)("flex flex-col", selectedDropdown && "pointer-events-none opacity-0"),
|
|
1103
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1104
|
-
className: "mb-4 flex items-center justify-between",
|
|
1105
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1106
|
-
className: "flex w-fit gap-4",
|
|
1107
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarListBox, {
|
|
1108
|
-
type: "month",
|
|
1109
|
-
isDisabled: hasOnlyOneSelectableMonth(minValue, maxValue) || props.isDisabled,
|
|
1110
|
-
setSelectedDropdown
|
|
1111
|
-
}, "month"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarListBox, {
|
|
1112
|
-
type: "year",
|
|
1113
|
-
isDisabled: hasOnlyOneSelectableYear(minValue, maxValue) || props.isDisabled,
|
|
1114
|
-
setSelectedDropdown
|
|
1115
|
-
}, "year")]
|
|
1116
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthControls_default, {})]
|
|
1117
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_CalendarGrid, {})]
|
|
1118
|
-
})]
|
|
1119
|
-
})
|
|
1120
|
-
});
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
|
-
//#endregion
|
|
1124
|
-
//#region src/Card/Card.tsx
|
|
1125
|
-
const Card = ({ children, variant, size: size$1, space = 0, p: p$1, px, py, pt, pb, pl, pr, ...props }) => {
|
|
1126
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1127
|
-
component: "Card",
|
|
1128
|
-
variant,
|
|
1129
|
-
size: size$1
|
|
1130
|
-
});
|
|
1131
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1132
|
-
...props,
|
|
1133
|
-
className: (0, __marigold_system.cn)("flex flex-col", classNames$2, __marigold_system.gapSpace[space], __marigold_system.paddingSpace !== void 0 && __marigold_system.paddingSpace[p$1], __marigold_system.paddingSpaceX !== void 0 && __marigold_system.paddingSpaceX[px], __marigold_system.paddingSpaceY !== void 0 && __marigold_system.paddingSpaceY[py], __marigold_system.paddingRight !== void 0 && __marigold_system.paddingRight[pr], __marigold_system.paddingLeft !== void 0 && __marigold_system.paddingLeft[pl], __marigold_system.paddingBottom !== void 0 && __marigold_system.paddingBottom[pb], __marigold_system.paddingTop !== void 0 && __marigold_system.paddingTop[pt]),
|
|
1134
|
-
children
|
|
1135
|
-
});
|
|
1136
|
-
};
|
|
1137
|
-
|
|
1138
|
-
//#endregion
|
|
1139
|
-
//#region src/Collapsible/Context.tsx
|
|
1140
|
-
const CollapsibleContext = (0, react.createContext)(void 0);
|
|
1141
|
-
const CollapsibleProvider = ({ value, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapsibleContext.Provider, {
|
|
1142
|
-
value,
|
|
1143
|
-
children
|
|
1144
|
-
});
|
|
1145
|
-
|
|
1146
|
-
//#endregion
|
|
1147
|
-
//#region src/Collapsible/CollapsibleContent.tsx
|
|
1148
|
-
const CollapsibleContent = ({ variant, size: size$1, children, ...props }) => {
|
|
1149
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1150
|
-
component: "Collapsible",
|
|
1151
|
-
variant,
|
|
1152
|
-
size: size$1,
|
|
1153
|
-
context: CollapsibleContext
|
|
1154
|
-
});
|
|
1155
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.DisclosurePanel, {
|
|
1156
|
-
...props,
|
|
1157
|
-
className: classNames$2.content,
|
|
1158
|
-
children
|
|
1159
|
-
});
|
|
1160
|
-
};
|
|
1161
|
-
|
|
1162
|
-
//#endregion
|
|
1163
|
-
//#region src/Collapsible/CollapsibleTrigger.tsx
|
|
1164
|
-
const CollapsibleTrigger = ({ variant, size: size$1, children, level, ...props }) => {
|
|
1165
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1166
|
-
component: "Collapsible",
|
|
1167
|
-
variant,
|
|
1168
|
-
size: size$1,
|
|
1169
|
-
context: CollapsibleContext
|
|
1170
|
-
});
|
|
1171
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Heading, {
|
|
1172
|
-
level,
|
|
1173
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
1174
|
-
...props,
|
|
1175
|
-
slot: "trigger",
|
|
1176
|
-
className: classNames$2.trigger,
|
|
1177
|
-
children
|
|
1178
|
-
})
|
|
1179
|
-
});
|
|
1180
|
-
};
|
|
1181
|
-
|
|
1182
|
-
//#endregion
|
|
1183
|
-
//#region src/Collapsible/Collapsible.tsx
|
|
1184
|
-
const Collapsible = ({ variant, size: size$1, children, unstyled, ...props }) => {
|
|
1185
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1186
|
-
component: "Collapsible",
|
|
1187
|
-
variant,
|
|
1188
|
-
size: size$1
|
|
1189
|
-
});
|
|
1190
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapsibleProvider, {
|
|
1191
|
-
value: {
|
|
1192
|
-
variant,
|
|
1193
|
-
size: size$1
|
|
1194
|
-
},
|
|
1195
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Disclosure, {
|
|
1196
|
-
...props,
|
|
1197
|
-
className: (0, __marigold_system.cn)(classNames$2.container, unstyled && "expanded:contents expanded:[&_[role=group]]:contents"),
|
|
1198
|
-
children
|
|
1199
|
-
})
|
|
1200
|
-
});
|
|
1201
|
-
};
|
|
1202
|
-
Collapsible.Trigger = CollapsibleTrigger;
|
|
1203
|
-
Collapsible.Content = CollapsibleContent;
|
|
1204
|
-
|
|
1205
|
-
//#endregion
|
|
1206
|
-
//#region src/Collapsible/More.tsx
|
|
1207
|
-
const More = ({ children, defaultExpanded = false, unstyled = true, showCount = false, ...props }) => {
|
|
1208
|
-
/**
|
|
1209
|
-
* We need to add state here, because toggling on a checkbox will
|
|
1210
|
-
* force a rerender and without the state the <Collapsible> will be collapsed.
|
|
1211
|
-
*/
|
|
1212
|
-
const [isExpanded, setIsExpanded] = (0, react.useState)(defaultExpanded);
|
|
1213
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages, "marigold");
|
|
1214
|
-
const count = `${react.Children.count(children)}`;
|
|
1215
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Collapsible, {
|
|
1216
|
-
variant: "link",
|
|
1217
|
-
unstyled,
|
|
1218
|
-
isExpanded,
|
|
1219
|
-
...props,
|
|
1220
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collapsible.Content, { children }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collapsible.Trigger, {
|
|
1221
|
-
onPress: () => setIsExpanded(!isExpanded),
|
|
1222
|
-
children: isExpanded ? stringFormatter.format(showCount ? "showLessCount" : "showLess").replace("{count}", count) : stringFormatter.format(showCount ? "showMoreCount" : "showMore").replace("{count}", count)
|
|
1223
|
-
})]
|
|
1224
|
-
});
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
//#endregion
|
|
1228
|
-
//#region src/utils/children.utils.ts
|
|
1229
|
-
const splitChildren = (children, at) => {
|
|
1230
|
-
const childArray = react.Children.toArray(children);
|
|
1231
|
-
if (at === void 0) return [childArray, []];
|
|
1232
|
-
return [childArray.slice(0, at), childArray.slice(at)];
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
|
-
//#endregion
|
|
1236
|
-
//#region src/Checkbox/Context.tsx
|
|
1237
|
-
const CheckboxGroupContext = (0, react.createContext)(null);
|
|
1238
|
-
const useCheckboxGroupContext = () => (0, react.useContext)(CheckboxGroupContext);
|
|
1239
|
-
|
|
1240
|
-
//#endregion
|
|
1241
|
-
//#region src/Checkbox/CheckboxGroup.tsx
|
|
1242
|
-
const CollapsibleGroup$1 = ({ children }) => {
|
|
1243
|
-
const state = (0, react.useContext)(react_aria_components.CheckboxGroupStateContext);
|
|
1244
|
-
if (!children || children.length === 0) return null;
|
|
1245
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(More, {
|
|
1246
|
-
defaultExpanded: children.some((child) => (0, react.isValidElement)(child) && state.value.includes(child.props.value)),
|
|
1247
|
-
showCount: true,
|
|
1248
|
-
children
|
|
1249
|
-
});
|
|
1250
|
-
};
|
|
1251
|
-
const _CheckboxGroup = ({ children, variant, size: size$1, required, disabled, readOnly, error, width, orientation = "vertical", collapseAt, ...rest }) => {
|
|
1252
|
-
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1253
|
-
component: "Checkbox",
|
|
1254
|
-
variant,
|
|
1255
|
-
size: size$1,
|
|
1256
|
-
className: { group: "gap-x-2" }
|
|
1257
|
-
});
|
|
1258
|
-
const props = {
|
|
1259
|
-
className: classNames$2.group,
|
|
1260
|
-
isRequired: required,
|
|
1261
|
-
isDisabled: disabled,
|
|
1262
|
-
isReadOnly: readOnly,
|
|
1263
|
-
isInvalid: error,
|
|
1264
|
-
...rest
|
|
1265
|
-
};
|
|
1266
|
-
const [visibleChildren, collapsedChildren] = splitChildren(children, collapseAt);
|
|
1267
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
1268
|
-
as: react_aria_components.CheckboxGroup,
|
|
1269
|
-
width,
|
|
1270
|
-
...props,
|
|
1271
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1272
|
-
role: "presentation",
|
|
1273
|
-
"data-orientation": orientation,
|
|
1274
|
-
className: (0, __marigold_system.cn)(classNames$2.group, "group/checkboxgroup flex items-start", orientation === "vertical" ? "flex-col gap-[0.5ch]" : "flex-row gap-[1.5ch]"),
|
|
1275
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CheckboxGroupContext.Provider, {
|
|
1276
|
-
value: {
|
|
1277
|
-
width,
|
|
1278
|
-
variant,
|
|
1279
|
-
size: size$1
|
|
1280
|
-
},
|
|
1281
|
-
children: [visibleChildren, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapsibleGroup$1, { children: collapsedChildren })]
|
|
1282
|
-
})
|
|
1283
|
-
})
|
|
1284
|
-
});
|
|
1285
|
-
};
|
|
1286
|
-
|
|
1287
|
-
//#endregion
|
|
1288
|
-
//#region src/icons/Minus.tsx
|
|
1289
|
-
const Minus = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1290
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1291
|
-
width: size$1,
|
|
1292
|
-
height: size$1,
|
|
1293
|
-
viewBox: "0 0 24 24",
|
|
1294
|
-
fill: "none",
|
|
1295
|
-
stroke: "currentColor",
|
|
1296
|
-
strokeWidth: "2",
|
|
1297
|
-
strokeLinecap: "round",
|
|
1298
|
-
strokeLinejoin: "round",
|
|
1299
|
-
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
1300
|
-
...props,
|
|
1301
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12h14" })
|
|
1302
|
-
});
|
|
1303
|
-
|
|
1304
|
-
//#endregion
|
|
1305
|
-
//#region src/Checkbox/Checkbox.tsx
|
|
1306
|
-
const Field = ({ description, children }) => {
|
|
1307
|
-
const className = (0, __marigold_system.useClassNames)({ component: "Field" });
|
|
1308
|
-
const descriptionId = (0, __react_aria_utils.useId)();
|
|
1309
|
-
if (!description) return children;
|
|
1310
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1311
|
-
className,
|
|
1312
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Provider, {
|
|
1313
|
-
values: [[react_aria_components.CheckboxContext, { "aria-describedby": descriptionId }], [react_aria_components.TextContext, { id: descriptionId }]],
|
|
1314
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HelpText, { description })]
|
|
1315
|
-
})
|
|
1316
|
-
});
|
|
1317
|
-
};
|
|
1318
|
-
const Icon$1 = ({ className, checked, indeterminate, ...props }) => {
|
|
1319
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1320
|
-
"aria-hidden": "true",
|
|
1321
|
-
className: (0, __marigold_system.cn)("flex shrink-0 grow-0 basis-4 items-center justify-center", "h-4 w-4 p-px", "bg-white", "rounded-[3px] border border-solid border-black", className),
|
|
1322
|
-
...props,
|
|
1323
|
-
children: indeterminate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minus, {
|
|
1324
|
-
size: "12",
|
|
1325
|
-
strokeWidth: "4"
|
|
1326
|
-
}) : checked ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Check, {
|
|
1327
|
-
size: "12",
|
|
1328
|
-
strokeWidth: "4"
|
|
1329
|
-
}) : null
|
|
1330
|
-
});
|
|
1331
|
-
};
|
|
1332
|
-
const _Checkbox = (0, react.forwardRef)(({ error, disabled, readOnly, required, checked, defaultChecked, indeterminate, variant, size: size$1, label, description, ...rest }, ref) => {
|
|
1225
|
+
var YearListBox_default = YearListBox;
|
|
1226
|
+
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region src/Calendar/calendarListBoxSelectableCheck.ts
|
|
1229
|
+
function hasOnlyOneSelectableMonth(minValue, maxValue) {
|
|
1230
|
+
if (!minValue || !maxValue || minValue.year !== maxValue.year) return false;
|
|
1231
|
+
return maxValue.month - minValue.month === 0;
|
|
1232
|
+
}
|
|
1233
|
+
function hasOnlyOneSelectableYear(minValue, maxValue) {
|
|
1234
|
+
if (!minValue || !maxValue || minValue.year !== maxValue.year) return false;
|
|
1235
|
+
return true;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
//#endregion
|
|
1239
|
+
//#region src/Calendar/Calendar.tsx
|
|
1240
|
+
const _Calendar = ({ disabled, readOnly, size: size$1, variant, width = "fit", dateUnavailable, minValue, maxValue, visibleDuration = { months: 1 }, pageBehavior = "visible", ...rest }) => {
|
|
1241
|
+
const visibleMonths = visibleDuration?.months ?? 1;
|
|
1242
|
+
const isMultiMonth = visibleMonths > 1;
|
|
1333
1243
|
const props = {
|
|
1334
|
-
isIndeterminate: indeterminate,
|
|
1335
1244
|
isDisabled: disabled,
|
|
1336
1245
|
isReadOnly: readOnly,
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1246
|
+
isDateUnavailable: dateUnavailable,
|
|
1247
|
+
minValue,
|
|
1248
|
+
maxValue,
|
|
1249
|
+
visibleDuration,
|
|
1250
|
+
pageBehavior,
|
|
1341
1251
|
...rest
|
|
1342
1252
|
};
|
|
1343
|
-
const group = useCheckboxGroupContext();
|
|
1344
1253
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1345
|
-
component: "
|
|
1346
|
-
|
|
1347
|
-
|
|
1254
|
+
component: "Calendar",
|
|
1255
|
+
size: size$1,
|
|
1256
|
+
variant
|
|
1348
1257
|
});
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1258
|
+
const [selectedDropdown, setSelectedDropdown] = (0, react.useState)();
|
|
1259
|
+
const ViewMap = {
|
|
1260
|
+
month: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthListBox_default, {
|
|
1261
|
+
setSelectedDropdown,
|
|
1262
|
+
minValue,
|
|
1263
|
+
maxValue
|
|
1264
|
+
}),
|
|
1265
|
+
year: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(YearListBox_default, {
|
|
1266
|
+
setSelectedDropdown,
|
|
1267
|
+
minValue,
|
|
1268
|
+
maxValue
|
|
1269
|
+
})
|
|
1270
|
+
};
|
|
1271
|
+
if (isMultiMonth) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarContext.Provider, {
|
|
1272
|
+
value: {
|
|
1273
|
+
classNames: classNames$2,
|
|
1274
|
+
visibleMonths,
|
|
1275
|
+
minValue,
|
|
1276
|
+
maxValue,
|
|
1277
|
+
disabled
|
|
1278
|
+
},
|
|
1279
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Calendar, {
|
|
1280
|
+
className: (0, __marigold_system.cn)("relative flex min-h-[350px] flex-col", __marigold_system.width[width], classNames$2.calendar),
|
|
1354
1281
|
...props,
|
|
1355
|
-
children:
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1282
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1283
|
+
className: (0, __marigold_system.cn)("flex gap-4", classNames$2.calendarContainer),
|
|
1284
|
+
children: [...Array(visibleMonths).keys()].map((i$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1285
|
+
className: (0, __marigold_system.cn)("flex-1", classNames$2.calendarMonth),
|
|
1286
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarHeader, {
|
|
1287
|
+
monthOffset: i$1,
|
|
1288
|
+
showPrevious: i$1 === 0,
|
|
1289
|
+
showNext: i$1 === visibleMonths - 1
|
|
1290
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_CalendarGrid, { offset: { months: i$1 } })]
|
|
1291
|
+
}, i$1))
|
|
1292
|
+
})
|
|
1363
1293
|
})
|
|
1364
1294
|
});
|
|
1365
|
-
|
|
1366
|
-
|
|
1295
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarContext.Provider, {
|
|
1296
|
+
value: {
|
|
1297
|
+
classNames: classNames$2,
|
|
1298
|
+
visibleMonths,
|
|
1299
|
+
minValue,
|
|
1300
|
+
maxValue,
|
|
1301
|
+
disabled
|
|
1302
|
+
},
|
|
1303
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Calendar, {
|
|
1304
|
+
className: (0, __marigold_system.cn)("relative flex min-h-[350px] flex-col", __marigold_system.width[width], classNames$2.calendar),
|
|
1305
|
+
...props,
|
|
1306
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1307
|
+
className: (0, __marigold_system.cn)("pointer-events-none absolute top-1/2 left-0 w-full -translate-y-1/2 opacity-0", selectedDropdown && "pointer-events-auto opacity-100"),
|
|
1308
|
+
children: ViewMap[selectedDropdown]
|
|
1309
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1310
|
+
className: (0, __marigold_system.cn)("flex flex-col", selectedDropdown && "pointer-events-none opacity-0"),
|
|
1311
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1312
|
+
className: "mb-4 flex items-center justify-between",
|
|
1313
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1314
|
+
className: "flex w-fit gap-4",
|
|
1315
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarListBox, {
|
|
1316
|
+
type: "month",
|
|
1317
|
+
isDisabled: hasOnlyOneSelectableMonth(minValue, maxValue) || props.isDisabled,
|
|
1318
|
+
setSelectedDropdown
|
|
1319
|
+
}, "month"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarListBox, {
|
|
1320
|
+
type: "year",
|
|
1321
|
+
isDisabled: hasOnlyOneSelectableYear(minValue, maxValue) || props.isDisabled,
|
|
1322
|
+
setSelectedDropdown
|
|
1323
|
+
}, "year")]
|
|
1324
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthControls_default, {})]
|
|
1325
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_CalendarGrid, {})]
|
|
1326
|
+
})]
|
|
1327
|
+
})
|
|
1328
|
+
});
|
|
1329
|
+
};
|
|
1367
1330
|
|
|
1368
1331
|
//#endregion
|
|
1369
|
-
//#region src/
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
variant
|
|
1378
|
-
}),
|
|
1332
|
+
//#region src/Card/Card.tsx
|
|
1333
|
+
const Card = ({ children, variant, size: size$1, space = "0", stretch, p: p$1, px, py, pt, pb, pl, pr, ...props }) => {
|
|
1334
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1335
|
+
component: "Card",
|
|
1336
|
+
variant,
|
|
1337
|
+
size: size$1
|
|
1338
|
+
});
|
|
1339
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1379
1340
|
...props,
|
|
1380
|
-
|
|
1341
|
+
className: (0, __marigold_system.cn)("flex flex-col gap-y-(--space)", stretch ? "" : "w-fit", classNames$2, __marigold_system.paddingSpace !== void 0 && __marigold_system.paddingSpace[p$1], __marigold_system.paddingSpaceX !== void 0 && __marigold_system.paddingSpaceX[px], __marigold_system.paddingSpaceY !== void 0 && __marigold_system.paddingSpaceY[py], __marigold_system.paddingRight !== void 0 && __marigold_system.paddingRight[pr], __marigold_system.paddingLeft !== void 0 && __marigold_system.paddingLeft[pl], __marigold_system.paddingBottom !== void 0 && __marigold_system.paddingBottom[pb], __marigold_system.paddingTop !== void 0 && __marigold_system.paddingTop[pt]),
|
|
1342
|
+
style: (0, __marigold_system.createSpacingVar)("space", `${space}`),
|
|
1343
|
+
children
|
|
1381
1344
|
});
|
|
1382
|
-
}
|
|
1345
|
+
};
|
|
1383
1346
|
|
|
1384
1347
|
//#endregion
|
|
1385
1348
|
//#region src/Columns/Columns.tsx
|
|
1386
1349
|
const Columns = ({ space = 0, columns, collapseAt = "0em", stretch, children, ...props }) => {
|
|
1387
1350
|
if (react.Children.count(children) !== columns.length) throw new Error(`Columns: expected ${columns.length} children, got ${react.Children.count(children)}`);
|
|
1388
1351
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1389
|
-
className: (0, __marigold_system.cn)("flex flex-wrap items-stretch", stretch && "h-full"
|
|
1352
|
+
className: (0, __marigold_system.cn)("flex flex-wrap items-stretch gap-(--space)", stretch && "h-full"),
|
|
1353
|
+
style: (0, __marigold_system.createSpacingVar)("space", `${space}`),
|
|
1390
1354
|
...props,
|
|
1391
1355
|
children: react.Children.map(children, (child, idx) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1392
|
-
className: (0, __marigold_system.cn)(columns[idx] === "fit" ? "flex h-fit w-fit" : "flex-(--columnSize)", "basis-[calc((var(--collapseAt)
|
|
1356
|
+
className: (0, __marigold_system.cn)(columns[idx] === "fit" ? "flex h-fit w-fit" : "flex-(--columnSize)", "basis-[calc((var(--collapseAt)-100%)*999)]"),
|
|
1393
1357
|
style: (0, __marigold_system.createVar)({
|
|
1394
1358
|
collapseAt,
|
|
1395
1359
|
columnSize: columns[idx]
|
|
@@ -1399,6 +1363,48 @@ const Columns = ({ space = 0, columns, collapseAt = "0em", stretch, children, ..
|
|
|
1399
1363
|
});
|
|
1400
1364
|
};
|
|
1401
1365
|
|
|
1366
|
+
//#endregion
|
|
1367
|
+
//#region src/ComboBox/MobileCombobox.tsx
|
|
1368
|
+
const MobileComboBoxTrigger = ({ placeholder }) => {
|
|
1369
|
+
const state = (0, react.useContext)(react_aria_components.ComboBoxStateContext);
|
|
1370
|
+
const inputClassNames = (0, __marigold_system.useClassNames)({ component: "Input" });
|
|
1371
|
+
const comboBoxClassNames = (0, __marigold_system.useClassNames)({ component: "ComboBox" });
|
|
1372
|
+
const displayText = state?.selectedItem?.textValue || "";
|
|
1373
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1374
|
+
className: comboBoxClassNames.mobileTrigger,
|
|
1375
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1376
|
+
className: (0, __marigold_system.cn)("w-full flex-1 text-left", "group-data-error/field:ui-state-error", "group-data-focus-visible/trigger:ui-state-focus", inputClassNames.input),
|
|
1377
|
+
children: displayText || /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1378
|
+
className: "text-muted-foreground",
|
|
1379
|
+
children: placeholder
|
|
1380
|
+
})
|
|
1381
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1382
|
+
className: (0, __marigold_system.cn)("absolute right-2 cursor-pointer", inputClassNames.action, comboBoxClassNames),
|
|
1383
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronsVertical, { size: "16" })
|
|
1384
|
+
})]
|
|
1385
|
+
});
|
|
1386
|
+
};
|
|
1387
|
+
const MobileComboBox = ({ placeholder, label, emptyState, children }) => {
|
|
1388
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
1389
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray.Trigger, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
1390
|
+
className: "group/trigger outline-none",
|
|
1391
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileComboBoxTrigger, { placeholder })
|
|
1392
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray, { children: [
|
|
1393
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Title, { children: label }),
|
|
1394
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray.Content, {
|
|
1395
|
+
className: "flex flex-col gap-2",
|
|
1396
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Input, { autoFocus: true }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ListBox, {
|
|
1397
|
+
renderEmptyState: () => emptyState ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Center, { children: stringFormatter.format("noResultsFound") }),
|
|
1398
|
+
children
|
|
1399
|
+
})]
|
|
1400
|
+
}),
|
|
1401
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Actions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Button, {
|
|
1402
|
+
slot: "close",
|
|
1403
|
+
children: stringFormatter.format("close")
|
|
1404
|
+
}) })
|
|
1405
|
+
] })] });
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1402
1408
|
//#endregion
|
|
1403
1409
|
//#region src/ComboBox/ComboBox.tsx
|
|
1404
1410
|
const _ComboBox = (0, react.forwardRef)(({ variant, size: size$1, required, disabled, readOnly, error, defaultValue, value, emptyState, onChange, children, loading, ...rest }, ref) => {
|
|
@@ -1417,18 +1423,24 @@ const _ComboBox = (0, react.forwardRef)(({ variant, size: size$1, required, disa
|
|
|
1417
1423
|
variant,
|
|
1418
1424
|
size: size$1
|
|
1419
1425
|
});
|
|
1420
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages);
|
|
1421
|
-
|
|
1426
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
1427
|
+
const isSmallScreen = (0, __marigold_system.useSmallScreen)();
|
|
1428
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
1422
1429
|
as: react_aria_components.ComboBox,
|
|
1423
1430
|
ref,
|
|
1424
1431
|
...props,
|
|
1425
|
-
children:
|
|
1426
|
-
|
|
1432
|
+
children: isSmallScreen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileComboBox, {
|
|
1433
|
+
placeholder: rest.placeholder,
|
|
1434
|
+
label: rest.label,
|
|
1435
|
+
emptyState,
|
|
1436
|
+
children
|
|
1437
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Input, { action: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
|
|
1438
|
+
className: classNames$2.icon,
|
|
1427
1439
|
children: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressCircle, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronsVertical, { size: "16" })
|
|
1428
1440
|
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Popover, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ListBox, {
|
|
1429
1441
|
renderEmptyState: () => emptyState ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Center, { children: stringFormatter.format("noResultsFound") }),
|
|
1430
1442
|
children
|
|
1431
|
-
}) })]
|
|
1443
|
+
}) })] })
|
|
1432
1444
|
});
|
|
1433
1445
|
});
|
|
1434
1446
|
_ComboBox.Option = _ListBox.Item;
|
|
@@ -1458,11 +1470,14 @@ const gridColumn = {
|
|
|
1458
1470
|
};
|
|
1459
1471
|
const Container = ({ contentLength = "default", align = "left", alignItems = "none", space = 0, children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1460
1472
|
...props,
|
|
1461
|
-
className: (0, __marigold_system.cn)("grid", __marigold_system.placeItems[alignItems], gridColsAlign[align], gridColumn[align]
|
|
1462
|
-
style:
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1473
|
+
className: (0, __marigold_system.cn)("grid gap-(--space)", __marigold_system.placeItems[alignItems], gridColsAlign[align], gridColumn[align]),
|
|
1474
|
+
style: {
|
|
1475
|
+
...(0, __marigold_system.createVar)({
|
|
1476
|
+
maxTextWidth: containerTextLength[contentLength],
|
|
1477
|
+
maxHeadlineWidth: containerHeadlineLength[contentLength]
|
|
1478
|
+
}),
|
|
1479
|
+
...(0, __marigold_system.createSpacingVar)("space", `${space}`)
|
|
1480
|
+
},
|
|
1466
1481
|
children
|
|
1467
1482
|
});
|
|
1468
1483
|
|
|
@@ -1520,11 +1535,11 @@ const Info = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0,
|
|
|
1520
1535
|
//#region src/ContextualHelp/ContextualHelpContent.tsx
|
|
1521
1536
|
const ContextualHelpContent = ({ children, variant, size: size$1 }) => {
|
|
1522
1537
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1523
|
-
className: (0, __marigold_system.useClassNames)({
|
|
1538
|
+
className: (0, __marigold_system.cn)("min-h-0 overflow-y-auto [grid-area:content]", (0, __marigold_system.useClassNames)({
|
|
1524
1539
|
component: "ContextualHelp",
|
|
1525
1540
|
variant,
|
|
1526
1541
|
size: size$1
|
|
1527
|
-
}).content,
|
|
1542
|
+
}).content),
|
|
1528
1543
|
children
|
|
1529
1544
|
});
|
|
1530
1545
|
};
|
|
@@ -1533,11 +1548,11 @@ const ContextualHelpContent = ({ children, variant, size: size$1 }) => {
|
|
|
1533
1548
|
//#region src/ContextualHelp/ContextualHelpTitle.tsx
|
|
1534
1549
|
const ContextualHelpTitle = ({ children, variant, size: size$1 }) => {
|
|
1535
1550
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Heading, {
|
|
1536
|
-
className: (0, __marigold_system.useClassNames)({
|
|
1551
|
+
className: (0, __marigold_system.cn)("[grid-area:title]", (0, __marigold_system.useClassNames)({
|
|
1537
1552
|
component: "ContextualHelp",
|
|
1538
1553
|
variant,
|
|
1539
1554
|
size: size$1
|
|
1540
|
-
}).title,
|
|
1555
|
+
}).title),
|
|
1541
1556
|
children
|
|
1542
1557
|
});
|
|
1543
1558
|
};
|
|
@@ -1553,13 +1568,13 @@ const DialogTrigger$2 = ({ open, ...rest }) => /* @__PURE__ */ (0, react_jsx_run
|
|
|
1553
1568
|
...rest
|
|
1554
1569
|
});
|
|
1555
1570
|
const _ContextualHelp = (0, react.forwardRef)(({ children, variant = "help", size: size$1, width, placement = "bottom start", offset: offset$1 = 0, defaultOpen, open, onOpenChange, ariaLabel }, ref) => {
|
|
1556
|
-
const Icon$
|
|
1571
|
+
const Icon$1 = icons$2[variant];
|
|
1557
1572
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1558
1573
|
component: "ContextualHelp",
|
|
1559
1574
|
variant,
|
|
1560
1575
|
size: size$1
|
|
1561
1576
|
});
|
|
1562
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages);
|
|
1577
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
1563
1578
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogTrigger$2, {
|
|
1564
1579
|
defaultOpen,
|
|
1565
1580
|
open,
|
|
@@ -1568,14 +1583,13 @@ const _ContextualHelp = (0, react.forwardRef)(({ children, variant = "help", siz
|
|
|
1568
1583
|
ref,
|
|
1569
1584
|
className: classNames$2.trigger,
|
|
1570
1585
|
"aria-label": ariaLabel ?? (variant === "info" ? stringFormatter.format("moreInfo") : stringFormatter.format("help")),
|
|
1571
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$
|
|
1572
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1586
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$1, { size: 20 })
|
|
1587
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Popover, {
|
|
1573
1588
|
placement,
|
|
1574
1589
|
offset: offset$1,
|
|
1575
|
-
className: classNames$2.popover,
|
|
1576
|
-
[`data-${width ?? "medium"}`]: true,
|
|
1577
1590
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Dialog, {
|
|
1578
|
-
className: classNames$2.container,
|
|
1591
|
+
className: (0, __marigold_system.cn)("grid [grid-template-areas:'title'_'content']", classNames$2.container),
|
|
1592
|
+
[`data-${width ?? "medium"}`]: true,
|
|
1579
1593
|
children
|
|
1580
1594
|
})
|
|
1581
1595
|
})]
|
|
@@ -1683,10 +1697,10 @@ const _DateInput = ({ variant, size: size$1, action, onPaste, ...props }) => {
|
|
|
1683
1697
|
}
|
|
1684
1698
|
};
|
|
1685
1699
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Group, {
|
|
1686
|
-
className: classNames$2.field,
|
|
1700
|
+
className: (0, __marigold_system.cn)(classNames$2.field, "w-(--field-width) max-w-full min-w-0 overflow-hidden"),
|
|
1687
1701
|
onPaste: handlePaste,
|
|
1688
1702
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.DateInput, {
|
|
1689
|
-
className: "flex flex-1 items-center",
|
|
1703
|
+
className: (0, __marigold_system.cn)("flex flex-1 items-center", classNames$2.input),
|
|
1690
1704
|
...props,
|
|
1691
1705
|
children: (segment) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_DateSegment, {
|
|
1692
1706
|
className: classNames$2.segment,
|
|
@@ -1699,7 +1713,7 @@ const _DateInput = ({ variant, size: size$1, action, onPaste, ...props }) => {
|
|
|
1699
1713
|
//#endregion
|
|
1700
1714
|
//#region src/DateField/DateField.tsx
|
|
1701
1715
|
const _DateField = (0, react.forwardRef)(({ variant, size: size$1, action, disabled, required, error, readOnly, onChange, ...rest }, ref) => {
|
|
1702
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
1716
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
1703
1717
|
as: react_aria_components.DateField,
|
|
1704
1718
|
variant,
|
|
1705
1719
|
size: size$1,
|
|
@@ -1708,17 +1722,14 @@ const _DateField = (0, react.forwardRef)(({ variant, size: size$1, action, disab
|
|
|
1708
1722
|
isReadOnly: readOnly,
|
|
1709
1723
|
isInvalid: error,
|
|
1710
1724
|
isRequired: required,
|
|
1725
|
+
onChange,
|
|
1711
1726
|
...rest,
|
|
1712
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DateInputWithPasteWrapper, {
|
|
1713
|
-
onChange,
|
|
1714
|
-
action
|
|
1715
|
-
})
|
|
1727
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DateInputWithPasteWrapper, { action })
|
|
1716
1728
|
});
|
|
1717
1729
|
});
|
|
1718
|
-
const DateInputWithPasteWrapper = ({
|
|
1730
|
+
const DateInputWithPasteWrapper = ({ ...props }) => {
|
|
1719
1731
|
const ctx = (0, react.useContext)(react_aria_components.DateFieldStateContext);
|
|
1720
1732
|
const onPaste = (date) => {
|
|
1721
|
-
if (onChange) onChange(date);
|
|
1722
1733
|
ctx?.setValue(date);
|
|
1723
1734
|
};
|
|
1724
1735
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_DateInput, {
|
|
@@ -1774,7 +1785,9 @@ const _DatePicker = (0, react.forwardRef)(({ dateUnavailable, disabled, required
|
|
|
1774
1785
|
size: size$1,
|
|
1775
1786
|
variant
|
|
1776
1787
|
});
|
|
1777
|
-
|
|
1788
|
+
const isSmallScreen = (0, __marigold_system.useSmallScreen)();
|
|
1789
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
1790
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Checkbox.FieldBase, {
|
|
1778
1791
|
as: react_aria_components.DatePicker,
|
|
1779
1792
|
variant,
|
|
1780
1793
|
size: size$1,
|
|
@@ -1789,7 +1802,14 @@ const _DatePicker = (0, react.forwardRef)(({ dateUnavailable, disabled, required
|
|
|
1789
1802
|
"data-testid": "action"
|
|
1790
1803
|
})
|
|
1791
1804
|
})
|
|
1792
|
-
}),
|
|
1805
|
+
}), isSmallScreen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray, { children: [
|
|
1806
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Title, { children: rest.label }),
|
|
1807
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Content, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Calendar, { disabled }) }),
|
|
1808
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Actions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Button, {
|
|
1809
|
+
slot: "close",
|
|
1810
|
+
children: stringFormatter.format("close")
|
|
1811
|
+
}) })
|
|
1812
|
+
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Popover, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Dialog, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Calendar, { disabled }) }) })]
|
|
1793
1813
|
});
|
|
1794
1814
|
});
|
|
1795
1815
|
const DatePickerWithPasteWrapper = ({ onChange, ...props }) => {
|
|
@@ -1804,6 +1824,28 @@ const DatePickerWithPasteWrapper = ({ onChange, ...props }) => {
|
|
|
1804
1824
|
});
|
|
1805
1825
|
};
|
|
1806
1826
|
|
|
1827
|
+
//#endregion
|
|
1828
|
+
//#region src/Overlay/Underlay.tsx
|
|
1829
|
+
const Underlay = ({ size: size$1, variant, open, dismissable, keyboardDismissable, ...rest }) => {
|
|
1830
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
1831
|
+
component: "Underlay",
|
|
1832
|
+
size: size$1,
|
|
1833
|
+
variant
|
|
1834
|
+
});
|
|
1835
|
+
const props = {
|
|
1836
|
+
isOpen: open,
|
|
1837
|
+
isDismissable: dismissable,
|
|
1838
|
+
isKeyboardDismissDisabled: keyboardDismissable,
|
|
1839
|
+
...rest
|
|
1840
|
+
};
|
|
1841
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.ModalOverlay, {
|
|
1842
|
+
className: ({ isEntering, isExiting }) => (0, __marigold_system.cn)("fixed inset-0 z-50 grid place-items-center overflow-y-auto", isEntering ? "animate-in fade-in duration-300 ease-out" : "", isExiting ? "animate-out fade-out duration-200 ease-in" : "", classNames$2),
|
|
1843
|
+
...props,
|
|
1844
|
+
"data-testid": "underlay-id",
|
|
1845
|
+
children: props.children
|
|
1846
|
+
});
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1807
1849
|
//#endregion
|
|
1808
1850
|
//#region src/Overlay/Modal.tsx
|
|
1809
1851
|
const _Modal = (0, react.forwardRef)(({ size: size$1, open, dismissable, keyboardDismissable, onOpenChange, children, ...props }, ref) => {
|
|
@@ -1846,7 +1888,7 @@ const DialogActions = ({ variant, size: size$1, children }) => {
|
|
|
1846
1888
|
//#region src/Dialog/DialogContent.tsx
|
|
1847
1889
|
const DialogContent = ({ variant, size: size$1, children }) => {
|
|
1848
1890
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1849
|
-
className: (0, __marigold_system.cn)("min-h-0 overflow-auto [grid-area:content]", (0, __marigold_system.useClassNames)({
|
|
1891
|
+
className: (0, __marigold_system.cn)("min-h-0 overflow-y-auto [grid-area:content]", (0, __marigold_system.useClassNames)({
|
|
1850
1892
|
component: "Dialog",
|
|
1851
1893
|
variant,
|
|
1852
1894
|
size: size$1
|
|
@@ -1944,7 +1986,7 @@ _Dialog.Actions = DialogActions;
|
|
|
1944
1986
|
//#endregion
|
|
1945
1987
|
//#region src/Dialog/ConfirmationDialog.tsx
|
|
1946
1988
|
const ConfirmationDialog = ({ title, confirmationLabel, cancelLabel, onCancel, onConfirm, autoFocusButton, children, variant, size: size$1 = "xsmall", ...props }) => {
|
|
1947
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages, "marigold");
|
|
1989
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages, "marigold");
|
|
1948
1990
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Dialog, {
|
|
1949
1991
|
role: "alertdialog",
|
|
1950
1992
|
variant,
|
|
@@ -2189,7 +2231,7 @@ const NonModal = (0, react.forwardRef)(({ open, ...rest }, ref) => {
|
|
|
2189
2231
|
//#region src/Drawer/DrawerModal.tsx
|
|
2190
2232
|
const MobileModal = ({ children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.ModalOverlay, {
|
|
2191
2233
|
...props,
|
|
2192
|
-
className: "fixed inset-0 z-
|
|
2234
|
+
className: "fixed inset-0 z-50 h-(--visual-viewport-height)",
|
|
2193
2235
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Modal, {
|
|
2194
2236
|
className: "flex *:flex-1",
|
|
2195
2237
|
children
|
|
@@ -2271,7 +2313,7 @@ const Drawer = ({ children, size: size$1 = "medium", variant, open, keyboardDism
|
|
|
2271
2313
|
children: [closeButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseButton, {
|
|
2272
2314
|
"aria-label": "dismiss drawer",
|
|
2273
2315
|
style: { "--i": 0 },
|
|
2274
|
-
className: classNames$2.closeButton,
|
|
2316
|
+
className: (0, __marigold_system.cn)("z-80", classNames$2.closeButton),
|
|
2275
2317
|
onPress: ctx?.close
|
|
2276
2318
|
}), children]
|
|
2277
2319
|
})
|
|
@@ -2283,14 +2325,106 @@ Drawer.Title = DrawerTitle;
|
|
|
2283
2325
|
Drawer.Content = DrawerContent;
|
|
2284
2326
|
Drawer.Actions = DrawerActions;
|
|
2285
2327
|
|
|
2328
|
+
//#endregion
|
|
2329
|
+
//#region src/EmptyState/EmptyState.tsx
|
|
2330
|
+
const EmptyState = ({ title, description, action, variant, size: size$1, ...props }) => {
|
|
2331
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
2332
|
+
component: "EmptyState",
|
|
2333
|
+
variant,
|
|
2334
|
+
size: size$1
|
|
2335
|
+
});
|
|
2336
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2337
|
+
className: classNames$2.container,
|
|
2338
|
+
...props,
|
|
2339
|
+
children: [
|
|
2340
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
2341
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2342
|
+
width: "151",
|
|
2343
|
+
height: "84",
|
|
2344
|
+
viewBox: "0 0 151 84",
|
|
2345
|
+
fill: "none",
|
|
2346
|
+
className: "mb-6",
|
|
2347
|
+
"data-testid": "empty-state-illustration",
|
|
2348
|
+
"aria-hidden": "true",
|
|
2349
|
+
children: [
|
|
2350
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ellipse", {
|
|
2351
|
+
cx: "75.5",
|
|
2352
|
+
cy: "70.8003",
|
|
2353
|
+
rx: "75.5",
|
|
2354
|
+
ry: "13.1577",
|
|
2355
|
+
fill: "#EDECEC"
|
|
2356
|
+
}),
|
|
2357
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2358
|
+
d: "M42.6059 8.14447C44.1096 9.39758 47.6183 9.91971 49.1847 10.0241V71.1133H30.0747C24.561 69.636 23.1826 65.4853 23.1826 63.5947V44.4847C25.6888 44.6936 30.7013 43.4822 30.7013 36.966C30.7013 30.4499 25.6888 27.9854 23.1826 27.5677V10.0241C23.1826 9.0843 23.8092 5.95152 25.3756 4.38513C26.6287 3.13202 29.4482 2.19218 30.7013 1.87891H39.4731C39.8908 3.4453 41.1021 6.89135 42.6059 8.14447Z",
|
|
2359
|
+
fill: "white"
|
|
2360
|
+
}),
|
|
2361
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2362
|
+
d: "M49.8666 10.2474C53.7335 9.54586 56.338 4.88273 57.4051 1.95542C57.5564 1.54028 57.9458 1.25503 58.3876 1.25951L119.214 1.87704C119.31 1.87801 119.405 1.89262 119.497 1.92186C120.92 2.37547 123.927 3.55656 125.624 5.01129C127.379 6.51502 127.817 9.18833 127.817 10.337V62.3412C127.817 62.8503 127.379 64.6283 125.624 67.6669C123.87 70.7055 121.134 71.2304 119.985 71.113H49.8713C49.3191 71.113 48.8713 70.6652 48.8713 70.1129V11.337C48.8713 10.7847 49.3232 10.346 49.8666 10.2474Z",
|
|
2363
|
+
fill: "#F7F7F7"
|
|
2364
|
+
}),
|
|
2365
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2366
|
+
d: "M118.808 0.00662447C119.277 0.0239338 119.926 0.0808981 120.675 0.239747C122.169 0.556561 124.122 1.29138 125.805 2.97481C127.438 4.60764 128.326 6.49112 128.807 7.93403C129.049 8.66006 129.193 9.28997 129.277 9.74517C129.32 9.97315 129.347 10.1589 129.364 10.2928C129.373 10.3598 129.379 10.4142 129.383 10.4543C129.385 10.4744 129.388 10.491 129.389 10.5039C129.389 10.5103 129.39 10.5158 129.39 10.5204C129.39 10.5226 129.39 10.5247 129.391 10.5265C129.391 10.5275 129.39 10.5288 129.391 10.5296L129.391 10.5308C129.391 10.5314 129.363 10.534 127.83 10.6617L129.391 10.5314L129.397 10.5963V62.0393H127.83L129.397 62.0406V62.0424C129.397 62.0433 129.396 62.0445 129.396 62.0455V62.0693C129.396 62.0822 129.395 62.0981 129.395 62.1164C129.394 62.1531 129.392 62.2007 129.389 62.2584C129.382 62.3739 129.369 62.5305 129.345 62.7228C129.297 63.1075 129.204 63.6376 129.023 64.2708C128.66 65.5397 127.947 67.2208 126.547 68.97C125.047 70.845 123.178 71.7713 121.718 72.2276C120.987 72.4561 120.345 72.5713 119.879 72.6296C119.645 72.6588 119.453 72.6743 119.314 72.6822C119.244 72.6862 119.186 72.6884 119.144 72.6896C119.122 72.6902 119.104 72.6906 119.09 72.6908H119.06C119.059 72.6908 119.059 72.6907 119.059 71.1244V72.6908H30.7135V71.1244C30.7135 72.6907 30.713 72.6908 30.7123 72.6908H30.6835C30.6706 72.6906 30.6548 72.6901 30.6364 72.6896C30.5996 72.6885 30.552 72.6863 30.4944 72.6828C30.3793 72.676 30.2235 72.6633 30.0337 72.6388C29.6548 72.5899 29.1357 72.4946 28.5303 72.3084C27.317 71.9351 25.7472 71.1925 24.2803 69.7257C22.7636 68.2089 22.1015 66.5005 21.82 65.1868C21.6793 64.5305 21.6319 63.9643 21.6199 63.5537C21.6138 63.3478 21.6167 63.1789 21.6217 63.0551C21.6237 63.0048 21.6261 62.9618 21.6284 62.9266V45.1486C21.6286 43.8942 22.6347 43.0011 23.7161 42.9116L24.0331 42.878C24.8301 42.7745 26.0052 42.4838 27.0092 41.7111C28.075 40.8909 29.1471 39.3773 29.1471 36.3505C29.1471 33.3076 28.0617 31.7216 26.9591 30.8351C25.7833 29.8899 24.3901 29.5858 23.6286 29.4939C22.5764 29.3669 21.6285 28.4802 21.6284 27.2655V9.95932L21.6358 9.88345L23.1948 10.0352C21.7189 9.8917 21.6405 9.88363 21.6364 9.88284V9.87978C21.6365 9.87838 21.6368 9.87666 21.637 9.87488C21.6374 9.87126 21.6377 9.86657 21.6382 9.86142C21.6393 9.85103 21.6406 9.83741 21.6425 9.82104C21.6463 9.78802 21.6517 9.7429 21.659 9.68704C21.6738 9.57522 21.6968 9.41902 21.73 9.22691C21.7963 8.84347 21.9054 8.31069 22.0794 7.6954C22.4226 6.48194 23.042 4.86123 24.1518 3.43433C25.3427 1.90326 26.9783 1.06453 28.2158 0.609929C28.8469 0.378108 29.4093 0.233047 29.8177 0.145519C30.0228 0.101583 30.1914 0.0715045 30.3133 0.0519029C30.3744 0.0420967 30.424 0.034942 30.4608 0.0298756C30.4792 0.0273413 30.4948 0.0252681 30.5067 0.0237569C30.5125 0.0230192 30.5178 0.0224319 30.522 0.0219212C30.524 0.0216751 30.5259 0.021504 30.5275 0.0213094C30.5283 0.0212086 30.5292 0.0213966 30.5299 0.0213094L30.5312 0.0206975C30.5317 0.0210523 30.5345 0.0436789 30.678 1.27136L30.5318 0.0206975L30.6223 0.0102957H39.172C40.3083 0.0102957 41.1716 0.844137 41.3668 1.83673L41.3968 2.03742L41.4414 2.39353C41.5737 3.30078 41.9215 4.71028 42.8053 5.92954C43.7515 7.23492 45.4105 8.46873 48.5703 8.4688C51.4189 8.4688 52.9238 7.27959 53.8025 5.9742C54.7445 4.57463 55.0359 2.91873 55.1192 2.04905L55.1314 1.94748C55.2805 0.902099 56.1685 0.0104433 57.3421 0.0102957H118.063C118.066 0.0101221 118.069 0.00986006 118.072 0.00968382C118.115 0.00726142 118.171 0.00493038 118.241 0.00295324C118.38 -0.000999543 118.572 -0.00205497 118.808 0.00662447ZM118.245 3.13818C118.244 3.13828 118.242 3.13812 118.241 3.13818L118.245 3.13757H118.245L118.245 3.13818ZM32.2799 36.3505C32.2799 40.2506 30.8314 42.7228 28.9195 44.1941C27.4746 45.306 25.8841 45.7531 24.7612 45.9355V63.0575L24.7539 63.1352C24.7532 63.1453 24.7523 63.1613 24.7514 63.1823C24.7491 63.2396 24.7471 63.3352 24.7508 63.4619C24.7583 63.717 24.7893 64.0909 24.8836 64.5309C25.072 65.41 25.5065 66.5214 26.4959 67.5107C27.5351 68.5498 28.6283 69.0606 29.4512 69.3139C29.8638 69.4408 30.2065 69.5023 30.4345 69.5317C30.5481 69.5464 30.6323 69.5527 30.6811 69.5556C30.7051 69.557 30.7204 69.5578 30.7263 69.558H119.059C119.072 69.5577 119.098 69.5565 119.136 69.5543C119.211 69.55 119.333 69.541 119.49 69.5213C119.807 69.4817 120.262 69.4005 120.784 69.2374C121.83 68.9105 123.094 68.2708 124.1 67.0132C125.207 65.6299 125.747 64.3345 126.011 63.4105C126.143 62.9474 126.206 62.5761 126.236 62.3343C126.251 62.2138 126.258 62.1258 126.261 62.0748C126.263 62.0495 126.264 62.0333 126.264 62.0271V10.7474C126.262 10.7333 126.26 10.7163 126.258 10.6966C126.247 10.6139 126.228 10.4838 126.197 10.3154C126.134 9.97754 126.024 9.49099 125.835 8.92465C125.454 7.78278 124.776 6.37641 123.589 5.18978C122.453 4.05392 121.116 3.53577 120.026 3.30461C119.483 3.18954 119.016 3.14891 118.692 3.13696C118.531 3.13101 118.407 3.13232 118.33 3.13451C118.291 3.1356 118.264 3.13677 118.25 3.13757C118.243 3.13796 118.24 3.13816 118.239 3.13818C118.239 3.13818 118.24 3.13826 118.241 3.13818L118.184 3.14308H58.1351C57.9431 4.34163 57.4898 6.10606 56.4011 7.72354C54.9709 9.84828 52.5151 11.6016 48.5703 11.6016C44.4144 11.6015 41.8086 9.89301 40.2685 7.76821C39.0862 6.13709 38.5955 4.35234 38.3888 3.14308H30.823C30.8191 3.1437 30.815 3.14423 30.8108 3.14491C30.737 3.15678 30.6216 3.17759 30.4743 3.20916C30.1779 3.27267 29.7611 3.37964 29.2958 3.55058C28.3405 3.90154 27.3131 4.47255 26.6244 5.35805C25.8547 6.34775 25.3774 7.54657 25.0941 8.54835C24.9549 9.04044 24.8681 9.46424 24.8169 9.76046C24.7914 9.9081 24.7752 10.0232 24.7655 10.097C24.7638 10.1096 24.7625 10.1211 24.7612 10.1313V26.5049C25.8771 26.7257 27.4732 27.2291 28.9219 28.3938C30.8178 29.9179 32.2799 32.4295 32.2799 36.3505Z",
|
|
2367
|
+
fill: "#C8C8C8"
|
|
2368
|
+
}),
|
|
2369
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2370
|
+
d: "M47.3049 66.4135V64.2848C47.3051 63.4198 48.0063 62.7184 48.8713 62.7184C49.7363 62.7184 50.4376 63.4198 50.4377 64.2848V66.4135C50.4377 67.2786 49.7364 67.9799 48.8713 67.9799C48.0062 67.9799 47.3049 67.2786 47.3049 66.4135ZM47.3049 58.204V53.9466C47.3051 53.0817 48.0063 52.3802 48.8713 52.3802C49.7363 52.3802 50.4376 53.0817 50.4377 53.9466V58.204C50.4376 59.069 49.7363 59.7704 48.8713 59.7704C48.0063 59.7704 47.3051 59.069 47.3049 58.204ZM47.3049 47.8659V43.6085C47.3051 42.7435 48.0063 42.0421 48.8713 42.0421C49.7363 42.0421 50.4376 42.7435 50.4377 43.6085V47.8659C50.4376 48.7308 49.7363 49.4323 48.8713 49.4323C48.0063 49.4323 47.3051 48.7308 47.3049 47.8659ZM47.3049 37.5277V33.2703C47.3051 32.4053 48.0063 31.7039 48.8713 31.7039C49.7363 31.7039 50.4376 32.4053 50.4377 33.2703V37.5277C50.4376 38.3927 49.7363 39.0941 48.8713 39.0941C48.0063 39.0941 47.3051 38.3927 47.3049 37.5277ZM47.3049 27.1895V22.9321C47.3051 22.0671 48.0063 21.3657 48.8713 21.3657C49.7363 21.3657 50.4376 22.0671 50.4377 22.9321V27.1895C50.4376 28.0545 49.7363 28.7559 48.8713 28.7559C48.0063 28.7559 47.3051 28.0545 47.3049 27.1895ZM47.3049 16.8513V14.7226C47.3049 13.8575 48.0062 13.1562 48.8713 13.1562C49.7364 13.1562 50.4377 13.8575 50.4377 14.7226V16.8513C50.4376 17.7163 49.7363 18.4177 48.8713 18.4177C48.0063 18.4177 47.3051 17.7163 47.3049 16.8513Z",
|
|
2371
|
+
fill: "#C8C8C8"
|
|
2372
|
+
}),
|
|
2373
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2374
|
+
d: "M63.6644 30.1688C63.9188 29.3419 64.7956 28.8778 65.6224 29.1322C68.1752 29.9177 75.1526 31.0546 81.9128 29.1231C82.7446 28.8856 83.6118 29.3676 83.8494 30.1994C84.0869 31.0311 83.6049 31.8983 82.7731 32.1359C75.2793 34.2769 67.6632 33.0382 64.7009 32.1267C63.8741 31.8723 63.41 30.9956 63.6644 30.1688Z",
|
|
2375
|
+
fill: "#C8C8C8"
|
|
2376
|
+
}),
|
|
2377
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2378
|
+
d: "M94.2091 30.1688C94.4635 29.3419 95.3402 28.8778 96.1671 29.1322C98.7198 29.9177 105.697 31.0546 112.458 29.1231C113.289 28.8856 114.156 29.3676 114.394 30.1994C114.632 31.0311 114.15 31.8983 113.318 32.1359C105.824 34.2769 98.2078 33.0382 95.2456 32.1267C94.4188 31.8723 93.9547 30.9956 94.2091 30.1688Z",
|
|
2379
|
+
fill: "#C8C8C8"
|
|
2380
|
+
}),
|
|
2381
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2382
|
+
d: "M98.9176 52.8999C98.9176 52.0483 98.7013 51.3673 98.4508 50.9603C98.37 50.8291 98.3018 50.7487 98.2519 50.6996C98.2021 50.7487 98.1338 50.8291 98.0531 50.9603C97.8026 51.3673 97.5862 52.0483 97.5862 52.8999C97.5862 53.7515 97.8026 54.4325 98.0531 54.8396C98.1337 54.9705 98.2021 55.0505 98.2519 55.0996C98.3018 55.0505 98.3702 54.9705 98.4508 54.8396C98.7013 54.4325 98.9176 53.7515 98.9176 52.8999ZM100.797 52.8999C100.797 55.1843 99.6577 57.0362 98.2519 57.0362C96.8462 57.0362 95.7065 55.1843 95.7065 52.8999C95.7065 50.6155 96.8462 48.7637 98.2519 48.7637C99.6577 48.7637 100.797 50.6155 100.797 52.8999Z",
|
|
2383
|
+
fill: "#C8C8C8"
|
|
2384
|
+
}),
|
|
2385
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2386
|
+
d: "M118.636 50.2557L118.807 49.3678L122.064 46.6211L122.072 46.5827L119.534 46.0927L119.763 44.9043L124.094 45.7405L123.907 46.7087L120.827 49.4061L120.819 49.4445L123.378 49.9385L123.149 51.127L118.636 50.2557Z",
|
|
2387
|
+
fill: "#C8C8C8"
|
|
2388
|
+
}),
|
|
2389
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2390
|
+
d: "M131.588 40.8727L131.845 39.772L136.046 36.4992L136.057 36.4515L132.911 35.7164L133.256 34.2431L138.625 35.4977L138.344 36.698L134.365 39.9177L134.354 39.9654L137.526 40.7066L137.182 42.1799L131.588 40.8727Z",
|
|
2391
|
+
fill: "#C8C8C8"
|
|
2392
|
+
}),
|
|
2393
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2394
|
+
d: "M136.063 29.0709L135.74 27.4065L139.484 20.3498L139.47 20.2777L134.713 21.2007L134.28 18.9728L142.399 17.3976L142.752 19.2127L139.28 26.0602L139.294 26.1323L144.09 25.2016L144.523 27.4295L136.063 29.0709Z",
|
|
2395
|
+
fill: "#C8C8C8"
|
|
2396
|
+
})
|
|
2397
|
+
]
|
|
2398
|
+
}),
|
|
2399
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2400
|
+
className: classNames$2.title,
|
|
2401
|
+
children: title
|
|
2402
|
+
}),
|
|
2403
|
+
description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2404
|
+
className: classNames$2.description,
|
|
2405
|
+
children: description
|
|
2406
|
+
}),
|
|
2407
|
+
action && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2408
|
+
className: classNames$2.action,
|
|
2409
|
+
children: action
|
|
2410
|
+
})
|
|
2411
|
+
]
|
|
2412
|
+
});
|
|
2413
|
+
};
|
|
2414
|
+
|
|
2286
2415
|
//#endregion
|
|
2287
2416
|
//#region src/FileField/FileFieldItem.tsx
|
|
2288
2417
|
const FileFieldItem = ({ children, onRemove }) => {
|
|
2418
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({ component: "FileField" });
|
|
2419
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages, "marigold");
|
|
2289
2420
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2290
|
-
className: "
|
|
2291
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2292
|
-
"
|
|
2293
|
-
|
|
2421
|
+
className: (0, __marigold_system.cn)("grid", classNames$2.item),
|
|
2422
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2423
|
+
className: (0, __marigold_system.cn)("[grid-area:remove]", classNames$2.itemRemove),
|
|
2424
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseButton, {
|
|
2425
|
+
"aria-label": stringFormatter.format("removeFile"),
|
|
2426
|
+
onPress: onRemove
|
|
2427
|
+
})
|
|
2294
2428
|
})]
|
|
2295
2429
|
});
|
|
2296
2430
|
};
|
|
@@ -2358,24 +2492,35 @@ const normalizeAndLimitFiles = (files, { accept, multiple }) => {
|
|
|
2358
2492
|
|
|
2359
2493
|
//#endregion
|
|
2360
2494
|
//#region src/FileField/FileField.tsx
|
|
2361
|
-
const FileField = ({ disabled = false, accept = ["*"], multiple = false, width, label, ...props }) => {
|
|
2495
|
+
const FileField = ({ disabled = false, accept = ["*"], multiple = false, width, label, name, ...props }) => {
|
|
2362
2496
|
const [files, setFiles] = (0, react.useState)(null);
|
|
2363
|
-
const
|
|
2497
|
+
const hiddenInputRef = (0, react.useRef)(null);
|
|
2498
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
2364
2499
|
const dropZoneLabel = stringFormatter.format("dropZoneLabel");
|
|
2365
2500
|
const buttonLabel = stringFormatter.format("uploadLabel");
|
|
2501
|
+
const syncHiddenInput = (newFiles) => {
|
|
2502
|
+
if (!hiddenInputRef.current || !name || typeof DataTransfer === "undefined") return;
|
|
2503
|
+
const dt = new DataTransfer();
|
|
2504
|
+
newFiles?.forEach((f$1) => dt.items.add(f$1));
|
|
2505
|
+
hiddenInputRef.current.files = dt.files;
|
|
2506
|
+
};
|
|
2366
2507
|
const handleSelect = (files$1) => {
|
|
2367
|
-
|
|
2508
|
+
const normalized = normalizeAndLimitFiles(files$1 ? Array.from(files$1) : [], {
|
|
2368
2509
|
accept,
|
|
2369
2510
|
multiple
|
|
2370
|
-
})
|
|
2511
|
+
});
|
|
2512
|
+
setFiles(normalized);
|
|
2513
|
+
syncHiddenInput(normalized);
|
|
2371
2514
|
};
|
|
2372
2515
|
const handleDrop = async (e$1) => {
|
|
2373
2516
|
try {
|
|
2374
2517
|
const filePromises = e$1.items.filter(isFileDropItem).map((item) => item.getFile());
|
|
2375
|
-
|
|
2518
|
+
const normalized = normalizeAndLimitFiles((await Promise.all(filePromises)).filter(Boolean), {
|
|
2376
2519
|
accept,
|
|
2377
2520
|
multiple
|
|
2378
|
-
})
|
|
2521
|
+
});
|
|
2522
|
+
setFiles(normalized);
|
|
2523
|
+
syncHiddenInput(normalized);
|
|
2379
2524
|
} catch {}
|
|
2380
2525
|
};
|
|
2381
2526
|
const fileTriggerProps = {
|
|
@@ -2384,52 +2529,64 @@ const FileField = ({ disabled = false, accept = ["*"], multiple = false, width,
|
|
|
2384
2529
|
onSelect: handleSelect
|
|
2385
2530
|
};
|
|
2386
2531
|
const classNames$2 = (0, __marigold_system.useClassNames)({ component: "FileField" });
|
|
2387
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FieldBase, {
|
|
2532
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Checkbox.FieldBase, {
|
|
2388
2533
|
as: "div",
|
|
2389
2534
|
width,
|
|
2390
2535
|
label,
|
|
2391
2536
|
className: classNames$2.container,
|
|
2392
2537
|
...props,
|
|
2393
|
-
children: [
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2538
|
+
children: [
|
|
2539
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.DropZone, {
|
|
2540
|
+
onDrop: handleDrop,
|
|
2541
|
+
isDisabled: disabled,
|
|
2542
|
+
className: classNames$2.dropZone,
|
|
2543
|
+
"data-testid": "dropzone",
|
|
2544
|
+
...props,
|
|
2545
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2546
|
+
className: classNames$2.dropZoneContent,
|
|
2547
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2548
|
+
className: classNames$2.dropZoneLabel,
|
|
2549
|
+
children: dropZoneLabel
|
|
2550
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_FileTrigger, {
|
|
2551
|
+
...fileTriggerProps,
|
|
2552
|
+
label: buttonLabel,
|
|
2553
|
+
disabled
|
|
2554
|
+
})]
|
|
2555
|
+
})
|
|
2556
|
+
}),
|
|
2557
|
+
files?.map((file, index$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FileField.Item, {
|
|
2558
|
+
onRemove: () => {
|
|
2559
|
+
const updated = (files ?? []).filter((_, i$1) => i$1 !== index$1);
|
|
2560
|
+
setFiles(updated);
|
|
2561
|
+
syncHiddenInput(updated);
|
|
2562
|
+
},
|
|
2563
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2564
|
+
className: (0, __marigold_system.cn)("[grid-area:label]", classNames$2.itemLabel),
|
|
2416
2565
|
children: file.name
|
|
2417
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
2418
|
-
className: classNames$2.itemDescription,
|
|
2566
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2567
|
+
className: (0, __marigold_system.cn)("[grid-area:description]", classNames$2.itemDescription),
|
|
2419
2568
|
children: [(file.size / 1024 / 1024).toFixed(2), " MB"]
|
|
2420
2569
|
})]
|
|
2570
|
+
}, index$1)),
|
|
2571
|
+
name && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2572
|
+
type: "file",
|
|
2573
|
+
ref: hiddenInputRef,
|
|
2574
|
+
name,
|
|
2575
|
+
hidden: true,
|
|
2576
|
+
multiple
|
|
2421
2577
|
})
|
|
2422
|
-
|
|
2578
|
+
]
|
|
2423
2579
|
});
|
|
2424
2580
|
};
|
|
2425
2581
|
FileField.Item = FileFieldItem;
|
|
2426
2582
|
|
|
2427
2583
|
//#endregion
|
|
2428
2584
|
//#region src/Form/Form.tsx
|
|
2429
|
-
const _Form = ({ unstyled, maxWidth = "full", ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Form, {
|
|
2585
|
+
const _Form = (0, react.forwardRef)(({ unstyled, maxWidth = "full", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Form, {
|
|
2430
2586
|
...props,
|
|
2587
|
+
ref,
|
|
2431
2588
|
className: (0, __marigold_system.cn)(__marigold_system.maxWidth[maxWidth], unstyled && "contents")
|
|
2432
|
-
});
|
|
2589
|
+
}));
|
|
2433
2590
|
|
|
2434
2591
|
//#endregion
|
|
2435
2592
|
//#region src/Grid/GridArea.tsx
|
|
@@ -2444,11 +2601,12 @@ const parseGridAreas = (areas) => areas.map((area) => `"${area}"`).join("\n");
|
|
|
2444
2601
|
const parseTemplateValue = (values) => values.map((val) => typeof val === "number" ? `${val}fr` : val).join(" ");
|
|
2445
2602
|
const Grid = ({ children, areas, columns, rows, alignX, alignY, height = "auto", space = 0, ...props }) => {
|
|
2446
2603
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2447
|
-
className: (0, __marigold_system.cn)("grid", alignX && __marigold_system.alignment?.horizontal?.alignmentX[alignX], alignY && __marigold_system.alignment?.horizontal?.alignmentY[alignY], __marigold_system.
|
|
2604
|
+
className: (0, __marigold_system.cn)("grid gap-(--space)", alignX && __marigold_system.alignment?.horizontal?.alignmentX[alignX], alignY && __marigold_system.alignment?.horizontal?.alignmentY[alignY], __marigold_system.height[height]),
|
|
2448
2605
|
style: {
|
|
2449
2606
|
gridTemplateAreas: parseGridAreas(areas),
|
|
2450
2607
|
gridTemplateColumns: parseTemplateValue(columns),
|
|
2451
|
-
gridTemplateRows: parseTemplateValue(rows)
|
|
2608
|
+
gridTemplateRows: parseTemplateValue(rows),
|
|
2609
|
+
...(0, __marigold_system.createSpacingVar)("space", `${space}`)
|
|
2452
2610
|
},
|
|
2453
2611
|
...props,
|
|
2454
2612
|
children
|
|
@@ -2458,7 +2616,7 @@ Grid.Area = GridArea;
|
|
|
2458
2616
|
|
|
2459
2617
|
//#endregion
|
|
2460
2618
|
//#region src/Headline/Headline.tsx
|
|
2461
|
-
const _Headline = ({ variant, size: size$1, children, align = "left", color, level = "1", ...props }) => {
|
|
2619
|
+
const _Headline = ({ variant, size: size$1, children, align = "left", color, level = "1", lineHeight, ...props }) => {
|
|
2462
2620
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
2463
2621
|
component: "Headline",
|
|
2464
2622
|
variant,
|
|
@@ -2467,7 +2625,7 @@ const _Headline = ({ variant, size: size$1, children, align = "left", color, lev
|
|
|
2467
2625
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Heading, {
|
|
2468
2626
|
level: Number(level),
|
|
2469
2627
|
...props,
|
|
2470
|
-
className: (0, __marigold_system.cn)(classNames$2, "max-w-(--maxHeadlineWidth)", __marigold_system.textAlign[align]),
|
|
2628
|
+
className: (0, __marigold_system.cn)(classNames$2, "max-w-(--maxHeadlineWidth)", __marigold_system.textAlign[align], lineHeight && __marigold_system.lineHeight[lineHeight]),
|
|
2471
2629
|
style: { color: color && (0, __marigold_system.ensureCssVar)(color, "color") },
|
|
2472
2630
|
children
|
|
2473
2631
|
});
|
|
@@ -2632,6 +2790,8 @@ const _Menu = ({ children, label, variant, size: size$1, disabled, open, placeme
|
|
|
2632
2790
|
variant,
|
|
2633
2791
|
size: size$1
|
|
2634
2792
|
});
|
|
2793
|
+
const isSmallScreen = (0, __marigold_system.useSmallScreen)();
|
|
2794
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
2635
2795
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.MenuTrigger, {
|
|
2636
2796
|
...props,
|
|
2637
2797
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
@@ -2639,7 +2799,18 @@ const _Menu = ({ children, label, variant, size: size$1, disabled, open, placeme
|
|
|
2639
2799
|
"aria-label": ariaLabel,
|
|
2640
2800
|
isDisabled: disabled,
|
|
2641
2801
|
children: label
|
|
2642
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.
|
|
2802
|
+
}), isSmallScreen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray, { children: [
|
|
2803
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Title, { children: label }),
|
|
2804
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Content, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Menu, {
|
|
2805
|
+
...props,
|
|
2806
|
+
className: classNames$2.container,
|
|
2807
|
+
children
|
|
2808
|
+
}) }),
|
|
2809
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Actions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Button, {
|
|
2810
|
+
slot: "close",
|
|
2811
|
+
children: stringFormatter.format("close")
|
|
2812
|
+
}) })
|
|
2813
|
+
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Popover, {
|
|
2643
2814
|
open,
|
|
2644
2815
|
placement,
|
|
2645
2816
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Menu, {
|
|
@@ -2814,7 +2985,7 @@ function _objectWithoutProperties$1(e$1, t$1) {
|
|
|
2814
2985
|
}
|
|
2815
2986
|
|
|
2816
2987
|
//#endregion
|
|
2817
|
-
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.
|
|
2988
|
+
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.9_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-select/dist/useStateManager-7e1e8489.esm.js
|
|
2818
2989
|
var _excluded$6 = [
|
|
2819
2990
|
"defaultInputValue",
|
|
2820
2991
|
"defaultMenuIsOpen",
|
|
@@ -4420,7 +4591,7 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
4420
4591
|
}
|
|
4421
4592
|
|
|
4422
4593
|
//#endregion
|
|
4423
|
-
//#region ../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.2.0_react@19.2.
|
|
4594
|
+
//#region ../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.2.0_react@19.2.3/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.esm.js
|
|
4424
4595
|
var isBrowser$1 = typeof document !== "undefined";
|
|
4425
4596
|
var syncFallback = function syncFallback$1(create) {
|
|
4426
4597
|
return create();
|
|
@@ -4430,7 +4601,7 @@ var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$1 ? syncFallback : use
|
|
|
4430
4601
|
var useInsertionEffectWithLayoutFallback = useInsertionEffect || react.useLayoutEffect;
|
|
4431
4602
|
|
|
4432
4603
|
//#endregion
|
|
4433
|
-
//#region ../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@19.2.
|
|
4604
|
+
//#region ../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@19.2.9_react@19.2.3/node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
4434
4605
|
var isDevelopment = false;
|
|
4435
4606
|
var isBrowser = typeof document !== "undefined";
|
|
4436
4607
|
var EmotionCacheContext = /* @__PURE__ */ react.createContext(typeof HTMLElement !== "undefined" ? /* @__PURE__ */ createCache({ key: "css" }) : null);
|
|
@@ -4513,7 +4684,7 @@ var require_extends = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4513
4684
|
}));
|
|
4514
4685
|
|
|
4515
4686
|
//#endregion
|
|
4516
|
-
//#region ../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@19.2.
|
|
4687
|
+
//#region ../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@19.2.9_react@19.2.3/node_modules/@emotion/react/dist/emotion-react.esm.js
|
|
4517
4688
|
var import_extends = require_extends();
|
|
4518
4689
|
var import_hoist_non_react_statics_cjs = require_hoist_non_react_statics_cjs();
|
|
4519
4690
|
var jsx = function jsx$1(type, props) {
|
|
@@ -4526,9 +4697,9 @@ var jsx = function jsx$1(type, props) {
|
|
|
4526
4697
|
for (var i$1 = 2; i$1 < argsLength; i$1++) createElementArgArray[i$1] = args[i$1];
|
|
4527
4698
|
return react.createElement.apply(null, createElementArgArray);
|
|
4528
4699
|
};
|
|
4529
|
-
(function(_jsx$
|
|
4700
|
+
(function(_jsx$162) {
|
|
4530
4701
|
var JSX;
|
|
4531
|
-
(function(_JSX) {})(JSX || (JSX = _jsx$
|
|
4702
|
+
(function(_JSX) {})(JSX || (JSX = _jsx$162.JSX || (_jsx$162.JSX = {})));
|
|
4532
4703
|
})(jsx || (jsx = {}));
|
|
4533
4704
|
function css$2() {
|
|
4534
4705
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
@@ -4866,11 +5037,11 @@ function autoUpdate(reference, floating, update, options$1) {
|
|
|
4866
5037
|
}
|
|
4867
5038
|
|
|
4868
5039
|
//#endregion
|
|
4869
|
-
//#region ../../node_modules/.pnpm/use-isomorphic-layout-effect@1.2.1_@types+react@19.2.
|
|
5040
|
+
//#region ../../node_modules/.pnpm/use-isomorphic-layout-effect@1.2.1_@types+react@19.2.9_react@19.2.3/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
4870
5041
|
var index = typeof document !== "undefined" ? react.useLayoutEffect : function noop$1() {};
|
|
4871
5042
|
|
|
4872
5043
|
//#endregion
|
|
4873
|
-
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.
|
|
5044
|
+
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.9_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
4874
5045
|
var _excluded$4 = [
|
|
4875
5046
|
"className",
|
|
4876
5047
|
"clearValue",
|
|
@@ -5552,9 +5723,9 @@ var groupCSS = function groupCSS$1(_ref$1, unstyled) {
|
|
|
5552
5723
|
paddingTop: spacing.baseUnit * 2
|
|
5553
5724
|
};
|
|
5554
5725
|
};
|
|
5555
|
-
var Group$
|
|
5556
|
-
var children = props.children, cx = props.cx, getStyles = props.getStyles, getClassNames$1 = props.getClassNames, Heading$
|
|
5557
|
-
return jsx("div", _extends({}, getStyleProps(props, "group", { group: true }), innerProps), jsx(Heading$
|
|
5726
|
+
var Group$4 = function Group$6(props) {
|
|
5727
|
+
var children = props.children, cx = props.cx, getStyles = props.getStyles, getClassNames$1 = props.getClassNames, Heading$7 = props.Heading, headingProps = props.headingProps, innerProps = props.innerProps, label = props.label, theme = props.theme, selectProps = props.selectProps;
|
|
5728
|
+
return jsx("div", _extends({}, getStyleProps(props, "group", { group: true }), innerProps), jsx(Heading$7, _extends({}, headingProps, {
|
|
5558
5729
|
selectProps,
|
|
5559
5730
|
theme,
|
|
5560
5731
|
getStyles,
|
|
@@ -5584,7 +5755,7 @@ var GroupHeading = function GroupHeading$1(props) {
|
|
|
5584
5755
|
var innerProps = _objectWithoutProperties$1(_cleanCommonProps, _excluded$1);
|
|
5585
5756
|
return jsx("div", _extends({}, getStyleProps(props, "groupHeading", { "group-heading": true }), innerProps));
|
|
5586
5757
|
};
|
|
5587
|
-
var Group$1$1 = Group$
|
|
5758
|
+
var Group$1$1 = Group$4;
|
|
5588
5759
|
var _excluded$5 = [
|
|
5589
5760
|
"innerRef",
|
|
5590
5761
|
"isDisabled",
|
|
@@ -5696,7 +5867,7 @@ function MultiValueRemove$1(_ref5) {
|
|
|
5696
5867
|
}
|
|
5697
5868
|
var MultiValue$1 = function MultiValue(props) {
|
|
5698
5869
|
var children = props.children, components$1 = props.components, data = props.data, innerProps = props.innerProps, isDisabled = props.isDisabled, removeProps$1 = props.removeProps, selectProps = props.selectProps;
|
|
5699
|
-
var Container$1 = components$1.Container, Label$
|
|
5870
|
+
var Container$1 = components$1.Container, Label$1 = components$1.Label, Remove = components$1.Remove;
|
|
5700
5871
|
return jsx(Container$1, {
|
|
5701
5872
|
data,
|
|
5702
5873
|
innerProps: _objectSpread2$1(_objectSpread2$1({}, getStyleProps(props, "multiValue", {
|
|
@@ -5704,7 +5875,7 @@ var MultiValue$1 = function MultiValue(props) {
|
|
|
5704
5875
|
"multi-value--is-disabled": isDisabled
|
|
5705
5876
|
})), innerProps),
|
|
5706
5877
|
selectProps
|
|
5707
|
-
}, jsx(Label$
|
|
5878
|
+
}, jsx(Label$1, {
|
|
5708
5879
|
data,
|
|
5709
5880
|
innerProps: _objectSpread2$1({}, getStyleProps(props, "multiValueLabel", { "multi-value__label": true })),
|
|
5710
5881
|
selectProps
|
|
@@ -5850,7 +6021,7 @@ var require_memoize_one_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
5850
6021
|
}));
|
|
5851
6022
|
|
|
5852
6023
|
//#endregion
|
|
5853
|
-
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.
|
|
6024
|
+
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.9_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-select/dist/Select-ef7c0426.esm.js
|
|
5854
6025
|
var import_memoize_one_cjs = /* @__PURE__ */ __toESM(require_memoize_one_cjs());
|
|
5855
6026
|
function _EMOTION_STRINGIFIED_CSS_ERROR__$2() {
|
|
5856
6027
|
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
|
|
@@ -7780,7 +7951,7 @@ var Select$1 = /* @__PURE__ */ function(_Component) {
|
|
|
7780
7951
|
key: "renderMenu",
|
|
7781
7952
|
value: function renderMenu() {
|
|
7782
7953
|
var _this4 = this;
|
|
7783
|
-
var _this$getComponents7 = this.getComponents(), Group$
|
|
7954
|
+
var _this$getComponents7 = this.getComponents(), Group$6 = _this$getComponents7.Group, GroupHeading$1 = _this$getComponents7.GroupHeading, Menu$3 = _this$getComponents7.Menu, MenuList$1 = _this$getComponents7.MenuList, MenuPortal$1 = _this$getComponents7.MenuPortal, LoadingMessage$1 = _this$getComponents7.LoadingMessage, NoOptionsMessage$1 = _this$getComponents7.NoOptionsMessage, Option = _this$getComponents7.Option;
|
|
7784
7955
|
var commonProps = this.commonProps;
|
|
7785
7956
|
var focusedOption = this.state.focusedOption;
|
|
7786
7957
|
var _this$props12 = this.props, captureMenuScroll = _this$props12.captureMenuScroll, inputValue = _this$props12.inputValue, isLoading = _this$props12.isLoading, loadingMessage = _this$props12.loadingMessage, minMenuHeight = _this$props12.minMenuHeight, maxMenuHeight = _this$props12.maxMenuHeight, menuIsOpen = _this$props12.menuIsOpen, menuPlacement = _this$props12.menuPlacement, menuPosition = _this$props12.menuPosition, menuPortalTarget = _this$props12.menuPortalTarget, menuShouldBlockScroll = _this$props12.menuShouldBlockScroll, menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView, noOptionsMessage = _this$props12.noOptionsMessage, onMenuScrollToTop = _this$props12.onMenuScrollToTop, onMenuScrollToBottom = _this$props12.onMenuScrollToBottom;
|
|
@@ -7823,7 +7994,7 @@ var Select$1 = /* @__PURE__ */ function(_Component) {
|
|
|
7823
7994
|
var _data = item.data, options$1 = item.options, groupIndex = item.index;
|
|
7824
7995
|
var groupId = "".concat(_this4.getElementId("group"), "-").concat(groupIndex);
|
|
7825
7996
|
var headingId = "".concat(groupId, "-heading");
|
|
7826
|
-
return /* @__PURE__ */ react.createElement(Group$
|
|
7997
|
+
return /* @__PURE__ */ react.createElement(Group$6, _extends({}, commonProps, {
|
|
7827
7998
|
key: groupId,
|
|
7828
7999
|
data: _data,
|
|
7829
8000
|
options: options$1,
|
|
@@ -8401,7 +8572,7 @@ var require_taggedTemplateLiteral = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
8401
8572
|
}));
|
|
8402
8573
|
|
|
8403
8574
|
//#endregion
|
|
8404
|
-
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.
|
|
8575
|
+
//#region ../../node_modules/.pnpm/react-select@5.10.2_@types+react@19.2.9_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-select/dist/react-select.esm.js
|
|
8405
8576
|
var import_objectSpread2 = require_objectSpread2();
|
|
8406
8577
|
var import_slicedToArray = require_slicedToArray();
|
|
8407
8578
|
var import_objectWithoutProperties = require_objectWithoutProperties();
|
|
@@ -8466,6 +8637,9 @@ const getClassNames = (classNames$2) => ({
|
|
|
8466
8637
|
placeholder: () => "hidden",
|
|
8467
8638
|
valueContainer: () => classNames$2.valueContainer
|
|
8468
8639
|
});
|
|
8640
|
+
/**
|
|
8641
|
+
* @deprecated Use `TagField` instead. Will be removed in a future major version.
|
|
8642
|
+
*/
|
|
8469
8643
|
const Multiselect = ({ disabled, readOnly = false, items, selectedItems, defaultSelectedItems, defaultValue, error, errorMessage, size: size$1, variant, placeholder, description, emptyState, onChange, onSelectionChange, width, ...rest }) => {
|
|
8470
8644
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
8471
8645
|
component: "MultiSelect",
|
|
@@ -8509,7 +8683,7 @@ const Multiselect = ({ disabled, readOnly = false, items, selectedItems, default
|
|
|
8509
8683
|
"data-invalid": error,
|
|
8510
8684
|
"data-readonly": readOnly,
|
|
8511
8685
|
children: [
|
|
8512
|
-
props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Label, {
|
|
8686
|
+
props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox._Label, {
|
|
8513
8687
|
...labelProps,
|
|
8514
8688
|
children: props.label
|
|
8515
8689
|
}),
|
|
@@ -8522,7 +8696,7 @@ const Multiselect = ({ disabled, readOnly = false, items, selectedItems, default
|
|
|
8522
8696
|
position: "absolute",
|
|
8523
8697
|
top: "100%",
|
|
8524
8698
|
width: "100%",
|
|
8525
|
-
zIndex:
|
|
8699
|
+
zIndex: 20
|
|
8526
8700
|
}),
|
|
8527
8701
|
valueContainer: (base) => ({ ...base }),
|
|
8528
8702
|
container: (base) => ({
|
|
@@ -8555,7 +8729,7 @@ const Multiselect = ({ disabled, readOnly = false, items, selectedItems, default
|
|
|
8555
8729
|
})
|
|
8556
8730
|
}
|
|
8557
8731
|
}),
|
|
8558
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HelpText, {
|
|
8732
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.HelpText, {
|
|
8559
8733
|
description,
|
|
8560
8734
|
errorMessage
|
|
8561
8735
|
})
|
|
@@ -8584,11 +8758,11 @@ const Plus = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0,
|
|
|
8584
8758
|
//#endregion
|
|
8585
8759
|
//#region src/NumberField/StepButton.tsx
|
|
8586
8760
|
const _StepButton = ({ direction, className, ...props }) => {
|
|
8587
|
-
const Icon$
|
|
8761
|
+
const Icon$1 = direction === "up" ? Plus : require_Checkbox.Minus;
|
|
8588
8762
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
8589
8763
|
className: (0, __marigold_system.cn)(["flex items-center justify-center", "cursor-pointer data-disabled:cursor-not-allowed"], className),
|
|
8590
8764
|
...props,
|
|
8591
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$
|
|
8765
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$1, { size: 16 })
|
|
8592
8766
|
});
|
|
8593
8767
|
};
|
|
8594
8768
|
|
|
@@ -8608,13 +8782,13 @@ const _NumberField = (0, react.forwardRef)(({ variant, size: size$1, disabled, r
|
|
|
8608
8782
|
...rest
|
|
8609
8783
|
};
|
|
8610
8784
|
const showStepper = !hideStepper && !readOnly;
|
|
8611
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
8785
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
8612
8786
|
as: react_aria_components.NumberField,
|
|
8613
8787
|
...props,
|
|
8614
8788
|
"data-readonly": readOnly ? "true" : void 0,
|
|
8615
8789
|
"data-stepper": showStepper ? "true" : void 0,
|
|
8616
8790
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Group, {
|
|
8617
|
-
className: (0, __marigold_system.cn)("flex items-stretch", classNames$2.group),
|
|
8791
|
+
className: (0, __marigold_system.cn)("flex w-(--field-width) max-w-full min-w-0 items-stretch", classNames$2.group),
|
|
8618
8792
|
children: [
|
|
8619
8793
|
showStepper && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_StepButton, {
|
|
8620
8794
|
className: classNames$2.stepper,
|
|
@@ -8836,7 +9010,7 @@ const useRadioGroupContext = () => (0, react.useContext)(RadioGroupContext);
|
|
|
8836
9010
|
const CollapsibleGroup = ({ children }) => {
|
|
8837
9011
|
const state = (0, react.useContext)(react_aria_components.RadioGroupStateContext);
|
|
8838
9012
|
if (!children || children.length === 0) return null;
|
|
8839
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(More, {
|
|
9013
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.More, {
|
|
8840
9014
|
defaultExpanded: children.some((child) => (0, react.isValidElement)(child) && state.selectedValue === child.props.value),
|
|
8841
9015
|
showCount: true,
|
|
8842
9016
|
children
|
|
@@ -8855,8 +9029,8 @@ const _RadioGroup = ({ variant, size: size$1, label, error, disabled, required,
|
|
|
8855
9029
|
isInvalid: error,
|
|
8856
9030
|
...rest
|
|
8857
9031
|
};
|
|
8858
|
-
const [visibleChildren, collapsedChildren] = splitChildren(children, collapseAt);
|
|
8859
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
9032
|
+
const [visibleChildren, collapsedChildren] = require_Checkbox.splitChildren(children, collapseAt);
|
|
9033
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
8860
9034
|
as: react_aria_components.RadioGroup,
|
|
8861
9035
|
width,
|
|
8862
9036
|
label,
|
|
@@ -8918,7 +9092,7 @@ _Radio.Group = _RadioGroup;
|
|
|
8918
9092
|
//#region src/Scrollable/Scrollable.tsx
|
|
8919
9093
|
const Scrollable = ({ children, width = "full", height, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
8920
9094
|
...props,
|
|
8921
|
-
className: (0, __marigold_system.cn)(["sticky h-(--height) overflow-auto overscroll-
|
|
9095
|
+
className: (0, __marigold_system.cn)(["sticky h-(--height) overflow-auto overscroll-auto", __marigold_system.width[width]]),
|
|
8922
9096
|
style: (0, __marigold_system.createVar)({ height }),
|
|
8923
9097
|
children
|
|
8924
9098
|
});
|
|
@@ -8926,7 +9100,7 @@ const Scrollable = ({ children, width = "full", height, ...props }) => /* @__PUR
|
|
|
8926
9100
|
//#endregion
|
|
8927
9101
|
//#region src/SearchField/SearchField.tsx
|
|
8928
9102
|
const _SearchField = (0, react.forwardRef)(({ disabled, required, readOnly, error, ...rest }, ref) => {
|
|
8929
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
9103
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
8930
9104
|
as: react_aria_components.SearchField,
|
|
8931
9105
|
...rest,
|
|
8932
9106
|
isDisabled: disabled,
|
|
@@ -9027,7 +9201,7 @@ const icons$1 = {
|
|
|
9027
9201
|
success: CircleCheck,
|
|
9028
9202
|
info: Info,
|
|
9029
9203
|
warning: CircleAlert,
|
|
9030
|
-
error: TriangleAlert
|
|
9204
|
+
error: require_Checkbox.TriangleAlert
|
|
9031
9205
|
};
|
|
9032
9206
|
const SectionMessage = ({ variant = "info", size: size$1, children, closeButton, close, onCloseChange, ...props }) => {
|
|
9033
9207
|
const buttonRef = (0, react.useRef)(null);
|
|
@@ -9036,7 +9210,7 @@ const SectionMessage = ({ variant = "info", size: size$1, children, closeButton,
|
|
|
9036
9210
|
variant,
|
|
9037
9211
|
size: size$1
|
|
9038
9212
|
});
|
|
9039
|
-
const Icon$
|
|
9213
|
+
const Icon$1 = icons$1[variant];
|
|
9040
9214
|
const [internalVisible, setInternalVisible] = (0, react.useState)(true);
|
|
9041
9215
|
const isCurrentlyVisible = close ?? internalVisible;
|
|
9042
9216
|
const { buttonProps } = (0, __react_aria_button.useButton)(props, buttonRef);
|
|
@@ -9054,7 +9228,7 @@ const SectionMessage = ({ variant = "info", size: size$1, children, closeButton,
|
|
|
9054
9228
|
children: [
|
|
9055
9229
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9056
9230
|
className: (0, __marigold_system.cn)("[grid-area:icon]", classNames$2.icon),
|
|
9057
|
-
children: Icon$
|
|
9231
|
+
children: Icon$1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$1, { size: "20" })
|
|
9058
9232
|
}),
|
|
9059
9233
|
closeButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseButton, {
|
|
9060
9234
|
...buttonProps,
|
|
@@ -9073,12 +9247,19 @@ SectionMessage.Content = SectionMessageContent;
|
|
|
9073
9247
|
|
|
9074
9248
|
//#endregion
|
|
9075
9249
|
//#region src/Select/Select.tsx
|
|
9076
|
-
const SelectBase = (0, react.forwardRef)(function Select$2({ disabled, required, items, variant, size: size$1, error, open, children, ...rest }, ref) {
|
|
9250
|
+
const SelectBase = (0, react.forwardRef)(function Select$2({ disabled, required, items, variant, size: size$1, error, open, label, children, selectionMode, onChange, ...rest }, ref) {
|
|
9251
|
+
const isSingleSelect = !selectionMode || selectionMode === "single";
|
|
9252
|
+
const [trayOpen, setTrayOpen] = (0, react.useState)(false);
|
|
9077
9253
|
const props = {
|
|
9078
9254
|
isDisabled: disabled,
|
|
9079
9255
|
isInvalid: error,
|
|
9080
9256
|
isOpen: open,
|
|
9081
9257
|
isRequired: required,
|
|
9258
|
+
selectionMode,
|
|
9259
|
+
onChange: (...args) => {
|
|
9260
|
+
onChange?.(...args);
|
|
9261
|
+
if (isSingleSelect) setTrayOpen(false);
|
|
9262
|
+
},
|
|
9082
9263
|
...rest
|
|
9083
9264
|
};
|
|
9084
9265
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
@@ -9086,22 +9267,45 @@ const SelectBase = (0, react.forwardRef)(function Select$2({ disabled, required,
|
|
|
9086
9267
|
variant,
|
|
9087
9268
|
size: size$1
|
|
9088
9269
|
});
|
|
9089
|
-
|
|
9270
|
+
const isSmallScreen = (0, __marigold_system.useSmallScreen)();
|
|
9271
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
9272
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
9090
9273
|
as: react_aria_components.Select,
|
|
9091
9274
|
ref,
|
|
9092
9275
|
variant,
|
|
9093
9276
|
size: size$1,
|
|
9277
|
+
label,
|
|
9094
9278
|
...props,
|
|
9095
|
-
children:
|
|
9096
|
-
|
|
9097
|
-
|
|
9279
|
+
children: isSmallScreen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray.Trigger, {
|
|
9280
|
+
open: trayOpen,
|
|
9281
|
+
onOpenChange: setTrayOpen,
|
|
9282
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(IconButton, {
|
|
9283
|
+
className: (0, __marigold_system.cn)("flex w-(--field-width) max-w-full min-w-0 items-center justify-between gap-1 overflow-hidden", classNames$2.select),
|
|
9284
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.SelectValue, { className: "truncate text-nowrap **:[[slot=description]]:hidden" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronsVertical, {
|
|
9285
|
+
size: "16",
|
|
9286
|
+
className: classNames$2.icon
|
|
9287
|
+
})]
|
|
9288
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray, { children: [
|
|
9289
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Title, { children: label }),
|
|
9290
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Content, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ListBox, {
|
|
9291
|
+
items,
|
|
9292
|
+
children
|
|
9293
|
+
}) }),
|
|
9294
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Actions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Button, {
|
|
9295
|
+
slot: "close",
|
|
9296
|
+
children: stringFormatter.format("close")
|
|
9297
|
+
}) })
|
|
9298
|
+
] })]
|
|
9299
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Button, {
|
|
9300
|
+
className: (0, __marigold_system.cn)("flex w-(--field-width) max-w-full min-w-0 items-center justify-between gap-1", classNames$2.select),
|
|
9301
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.SelectValue, { className: "truncate text-nowrap **:[[slot=description]]:hidden" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronsVertical, {
|
|
9098
9302
|
size: "16",
|
|
9099
9303
|
className: classNames$2.icon
|
|
9100
9304
|
})]
|
|
9101
9305
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Popover, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ListBox, {
|
|
9102
9306
|
items,
|
|
9103
9307
|
children
|
|
9104
|
-
}) })]
|
|
9308
|
+
}) })] })
|
|
9105
9309
|
});
|
|
9106
9310
|
});
|
|
9107
9311
|
const Select = Object.assign(SelectBase, {
|
|
@@ -9125,8 +9329,8 @@ const SelectListAction = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime
|
|
|
9125
9329
|
//#region src/SelectList/SelectListItem.tsx
|
|
9126
9330
|
const SelectionIndicator = ({ selectionMode }) => {
|
|
9127
9331
|
switch (selectionMode) {
|
|
9128
|
-
case "multiple": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Checkbox, { slot: "selection" });
|
|
9129
|
-
case "single": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Check, {
|
|
9332
|
+
case "multiple": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox._Checkbox, { slot: "selection" });
|
|
9333
|
+
case "single": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Check, {
|
|
9130
9334
|
size: 12,
|
|
9131
9335
|
className: "invisible hidden"
|
|
9132
9336
|
});
|
|
@@ -9186,13 +9390,13 @@ const _Slider = (0, react.forwardRef)(({ variant, size: size$1, width = "full",
|
|
|
9186
9390
|
isDisabled: disabled,
|
|
9187
9391
|
...rest
|
|
9188
9392
|
};
|
|
9189
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FieldBase, {
|
|
9393
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Checkbox.FieldBase, {
|
|
9190
9394
|
as: react_aria_components.Slider,
|
|
9191
9395
|
className: (0, __marigold_system.cn)("grid grid-cols-[auto_1fr] gap-y-1", classNames$2.container, __marigold_system.width[width]),
|
|
9192
9396
|
ref,
|
|
9193
9397
|
...props,
|
|
9194
9398
|
children: [
|
|
9195
|
-
label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Label, { children: label }),
|
|
9399
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox._Label, { children: label }),
|
|
9196
9400
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.SliderOutput, {
|
|
9197
9401
|
className: (0, __marigold_system.cn)("flex justify-end", classNames$2.output),
|
|
9198
9402
|
children: ({ state }) => state.values.map((_, i$1) => state.getThumbValueLabel(i$1)).join(" - ")
|
|
@@ -9229,7 +9433,7 @@ const Split = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
|
9229
9433
|
|
|
9230
9434
|
//#endregion
|
|
9231
9435
|
//#region src/Stack/Stack.tsx
|
|
9232
|
-
const Stack = ({ children, space = 0, stretch = false, alignX = "stretch", alignY, asList = false, ...props }) => {
|
|
9436
|
+
const Stack = ({ children, space = "0", stretch = false, alignX = "stretch", alignY, asList = false, ...props }) => {
|
|
9233
9437
|
const Component$1 = asList ? "ul" : "div";
|
|
9234
9438
|
const stackChildren = asList ? react.Children.map(children, (child) => child != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: child }) : null) : children;
|
|
9235
9439
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component$1, {
|
|
@@ -9255,7 +9459,7 @@ const _Switch = (0, react.forwardRef)(({ variant, size: size$1, width = "full",
|
|
|
9255
9459
|
...rest,
|
|
9256
9460
|
ref,
|
|
9257
9461
|
className: (0, __marigold_system.cn)(__marigold_system.width[width], "group/switch", "flex items-center gap-[1ch]", classNames$2.container),
|
|
9258
|
-
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Label, {
|
|
9462
|
+
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox._Label, {
|
|
9259
9463
|
elementType: "span",
|
|
9260
9464
|
children: label
|
|
9261
9465
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -9269,326 +9473,475 @@ const _Switch = (0, react.forwardRef)(({ variant, size: size$1, width = "full",
|
|
|
9269
9473
|
});
|
|
9270
9474
|
|
|
9271
9475
|
//#endregion
|
|
9272
|
-
//#region src/Table/Context.tsx
|
|
9273
|
-
const TableContext = (0, react.createContext)(
|
|
9274
|
-
const useTableContext = () =>
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9476
|
+
//#region src/Table/Context.tsx
|
|
9477
|
+
const TableContext = (0, react.createContext)(null);
|
|
9478
|
+
const useTableContext = () => {
|
|
9479
|
+
const context = (0, react.useContext)(TableContext);
|
|
9480
|
+
if (context === null) throw new Error("useTableContext must be used within a <Table> component");
|
|
9481
|
+
return context;
|
|
9482
|
+
};
|
|
9483
|
+
|
|
9484
|
+
//#endregion
|
|
9485
|
+
//#region src/Table/TableBody.tsx
|
|
9486
|
+
const TableBody = ({ emptyState, ...props }) => {
|
|
9487
|
+
const { classNames: classNames$2 } = useTableContext();
|
|
9488
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.TableBody, {
|
|
9489
|
+
...props,
|
|
9490
|
+
className: (0, __marigold_system.cn)(classNames$2.body),
|
|
9491
|
+
renderEmptyState: emptyState
|
|
9492
|
+
});
|
|
9493
|
+
};
|
|
9494
|
+
|
|
9495
|
+
//#endregion
|
|
9496
|
+
//#region src/Table/TableCellContent.tsx
|
|
9497
|
+
/**
|
|
9498
|
+
* Prevents event propagation for table cells, to make their content
|
|
9499
|
+
* selectable without interfering with row selection.
|
|
9500
|
+
*/
|
|
9501
|
+
const stopPropagationProps = {
|
|
9502
|
+
onMouseDown: (e$1) => e$1.stopPropagation(),
|
|
9503
|
+
onPointerDown: (e$1) => e$1.stopPropagation(),
|
|
9504
|
+
onTouchStart: (e$1) => e$1.stopPropagation()
|
|
9505
|
+
};
|
|
9506
|
+
const TableCellContent = ({ columnIndex, alignX, cellOverflow, children, className, allowTextSelection }) => {
|
|
9507
|
+
const { overflow: tableOverflow, allowTextSelection: tableAllowTextSelection } = useTableContext();
|
|
9508
|
+
const state = (0, react.useContext)(react_aria_components.TableStateContext);
|
|
9509
|
+
const overflow = cellOverflow ?? tableOverflow;
|
|
9510
|
+
const selectable = allowTextSelection ?? tableAllowTextSelection;
|
|
9511
|
+
const columnAlign = columnIndex ? state?.collection.columns[columnIndex].props.alignX : void 0;
|
|
9512
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9513
|
+
"data-cell-content": "",
|
|
9514
|
+
className: (0, __marigold_system.cn)(__marigold_system.textAlign[alignX || columnAlign || "left"], overflow === "truncate" ? "truncate" : "wrap-break-word", selectable && "cursor-text select-text", className),
|
|
9515
|
+
tabIndex: selectable ? -1 : void 0,
|
|
9516
|
+
...selectable ? stopPropagationProps : {},
|
|
9517
|
+
children
|
|
9518
|
+
});
|
|
9519
|
+
};
|
|
9520
|
+
|
|
9521
|
+
//#endregion
|
|
9522
|
+
//#region src/Table/TableCell.tsx
|
|
9523
|
+
const TableCell = ({ children, alignX, overflow: cellOverflow, ...props }) => {
|
|
9524
|
+
const { classNames: classNames$2, alignY = "middle" } = useTableContext();
|
|
9525
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Cell, {
|
|
9526
|
+
className: (0, __marigold_system.cn)(classNames$2.cell, __marigold_system.verticalAlign[alignY]),
|
|
9527
|
+
...props,
|
|
9528
|
+
children: ({ columnIndex }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCellContent, {
|
|
9529
|
+
columnIndex,
|
|
9530
|
+
alignX,
|
|
9531
|
+
cellOverflow,
|
|
9532
|
+
children
|
|
9533
|
+
})
|
|
9534
|
+
});
|
|
9535
|
+
};
|
|
9536
|
+
|
|
9537
|
+
//#endregion
|
|
9538
|
+
//#region src/icons/SortAscending.tsx
|
|
9539
|
+
const SortAscending = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__marigold_system.SVG, {
|
|
9540
|
+
width: size$1,
|
|
9541
|
+
height: size$1,
|
|
9542
|
+
viewBox: "0 0 24 24",
|
|
9543
|
+
fill: "none",
|
|
9544
|
+
strokeLinecap: "round",
|
|
9545
|
+
strokeLinejoin: "round",
|
|
9546
|
+
strokeWidth: 2,
|
|
9547
|
+
className: (0, __marigold_system.cn)("flex-none shrink-0 stroke-current", className),
|
|
9548
|
+
...props,
|
|
9549
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 8l4-4 4 4M7 4v16m4-8h4m-4 4h7m-7 4h10" })
|
|
9550
|
+
});
|
|
9551
|
+
|
|
9552
|
+
//#endregion
|
|
9553
|
+
//#region src/icons/SortDescending.tsx
|
|
9554
|
+
const SortDescending = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__marigold_system.SVG, {
|
|
9555
|
+
width: size$1,
|
|
9556
|
+
height: size$1,
|
|
9557
|
+
viewBox: "0 0 24 24",
|
|
9558
|
+
fill: "none",
|
|
9559
|
+
strokeLinecap: "round",
|
|
9560
|
+
strokeLinejoin: "round",
|
|
9561
|
+
strokeWidth: 2,
|
|
9562
|
+
className: (0, __marigold_system.cn)("flex-none shrink-0 stroke-current", className),
|
|
9563
|
+
...props,
|
|
9564
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 16l4 4 4-4m-4 4V4m4 0h10M11 8h7m-7 4h4" })
|
|
9565
|
+
});
|
|
9566
|
+
|
|
9567
|
+
//#endregion
|
|
9568
|
+
//#region src/Table/TableColumn.tsx
|
|
9569
|
+
const isStaticWidth = (width) => !`${width}`.endsWith("fr");
|
|
9570
|
+
const ensureWidth = (width, minWdith) => {
|
|
9571
|
+
if (minWdith) return minWdith;
|
|
9572
|
+
return isStaticWidth(width) ? width : minWdith;
|
|
9573
|
+
};
|
|
9574
|
+
const TableColumn = ({ alignX = "left", width, minWidth, rowHeader, ...props }) => {
|
|
9575
|
+
const { classNames: classNames$2 } = useTableContext();
|
|
9576
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Column, {
|
|
9577
|
+
className: classNames$2.column,
|
|
9578
|
+
width,
|
|
9579
|
+
minWidth: ensureWidth(width, minWidth),
|
|
9580
|
+
isRowHeader: rowHeader,
|
|
9581
|
+
alignX,
|
|
9582
|
+
...props,
|
|
9583
|
+
children: ({ allowsSorting, sortDirection }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9584
|
+
className: (0, __marigold_system.cn)("flex items-center gap-1", __marigold_system.alignment.horizontal.alignmentX[alignX]),
|
|
9585
|
+
children: [allowsSorting && sortDirection != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9586
|
+
"aria-hidden": "true",
|
|
9587
|
+
children: sortDirection === "ascending" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SortAscending, { size: 14 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SortDescending, { size: 14 })
|
|
9588
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Group, {
|
|
9589
|
+
className: "cursor-default outline-none",
|
|
9590
|
+
role: "presentation",
|
|
9591
|
+
tabIndex: -1,
|
|
9592
|
+
children: props.children
|
|
9593
|
+
})]
|
|
9295
9594
|
})
|
|
9296
9595
|
});
|
|
9297
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
9298
|
-
...rowGroupProps,
|
|
9299
|
-
className,
|
|
9300
|
-
"data-rac": true,
|
|
9301
|
-
children
|
|
9302
|
-
});
|
|
9303
9596
|
};
|
|
9304
9597
|
|
|
9305
9598
|
//#endregion
|
|
9306
|
-
//#region src/Table/
|
|
9307
|
-
const
|
|
9308
|
-
const
|
|
9309
|
-
const
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
...gridCellProps,
|
|
9314
|
-
onMouseDown: (e$1) => e$1.stopPropagation(),
|
|
9315
|
-
onPointerDown: (e$1) => e$1.stopPropagation()
|
|
9316
|
-
};
|
|
9317
|
-
const { focusProps, isFocusVisible } = (0, __react_aria_focus.useFocusRing)();
|
|
9318
|
-
const stateProps = (0, __marigold_system.useStateProps)({
|
|
9319
|
-
disabled,
|
|
9320
|
-
focusVisible: isFocusVisible
|
|
9599
|
+
//#region src/Table/TableDragPreview.tsx
|
|
9600
|
+
const TableDragPreview = ({ items, variant, size: size$1 }) => {
|
|
9601
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
9602
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
9603
|
+
component: "Table",
|
|
9604
|
+
variant,
|
|
9605
|
+
size: size$1
|
|
9321
9606
|
});
|
|
9322
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
valign: alignY,
|
|
9329
|
-
"data-rac": true,
|
|
9330
|
-
children: cell.rendered
|
|
9607
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9608
|
+
className: (0, __marigold_system.cn)("flex transform-gpu items-center gap-2", classNames$2.dragPreview),
|
|
9609
|
+
children: [items[0]["text/plain"] ?? stringFormatter.format("items"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9610
|
+
className: classNames$2.dragPreviewCounter,
|
|
9611
|
+
children: items.length
|
|
9612
|
+
})]
|
|
9331
9613
|
});
|
|
9332
9614
|
};
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
//#region src/Table/utils.ts
|
|
9336
|
-
/**
|
|
9337
|
-
* Map `react-aria` props to ours (no "is"-prefix)
|
|
9338
|
-
*/
|
|
9339
|
-
const mapCheckboxProps = ({ checkboxProps: { isIndeterminate, isSelected, isDisabled, defaultSelected, ...rest } }) => {
|
|
9340
|
-
return { checkboxProps: {
|
|
9341
|
-
disabled: isDisabled,
|
|
9342
|
-
checked: isSelected,
|
|
9343
|
-
defaultChecked: defaultSelected,
|
|
9344
|
-
indeterminate: isIndeterminate,
|
|
9345
|
-
...rest
|
|
9346
|
-
} };
|
|
9615
|
+
const renderDragPreview = (items) => {
|
|
9616
|
+
if (items.length > 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableDragPreview, { items });
|
|
9347
9617
|
};
|
|
9348
9618
|
|
|
9349
9619
|
//#endregion
|
|
9350
|
-
//#region src/Table/
|
|
9351
|
-
const
|
|
9352
|
-
const
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
focusVisible: isFocusVisible
|
|
9361
|
-
});
|
|
9362
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
9363
|
-
ref,
|
|
9364
|
-
className: (0, __marigold_system.cn)("leading-none", classNames$2?.cell),
|
|
9365
|
-
...(0, __react_aria_utils.mergeProps)(gridCellProps, focusProps),
|
|
9366
|
-
...stateProps,
|
|
9367
|
-
valign: alignY,
|
|
9368
|
-
"data-rac": true,
|
|
9369
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Checkbox, { ...checkboxProps })
|
|
9620
|
+
//#region src/Table/TableDropIndicator.tsx
|
|
9621
|
+
const TableDropIndicator = ({ size: size$1, variant, ...props }) => {
|
|
9622
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
9623
|
+
component: "Table",
|
|
9624
|
+
variant,
|
|
9625
|
+
size: size$1
|
|
9626
|
+
});
|
|
9627
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.DropIndicator, {
|
|
9628
|
+
...props,
|
|
9629
|
+
className: (0, __marigold_system.cn)("transform-gpu", classNames$2.dropIndicator)
|
|
9370
9630
|
});
|
|
9371
9631
|
};
|
|
9632
|
+
const renderDropIndicator = (target) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableDropIndicator, { target });
|
|
9372
9633
|
|
|
9373
9634
|
//#endregion
|
|
9374
|
-
//#region src/icons/
|
|
9375
|
-
const
|
|
9376
|
-
|
|
9377
|
-
height: size$1,
|
|
9378
|
-
viewBox: "0 0 24 24",
|
|
9379
|
-
className: (0, __marigold_system.cn)("flex-none shrink-0 fill-current", className),
|
|
9380
|
-
...props,
|
|
9381
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17.3962 10.0496L12.5042 14.9416C12.3731 15.0727 12.1984 15.1492 12.0128 15.1492C11.8272 15.1492 11.6524 15.0727 11.5214 14.9416L6.62934 10.0496C6.49827 9.91854 6.42188 9.7439 6.42188 9.55816C6.42188 9.17606 6.73856 8.85938 7.12078 8.85938H16.9048C17.287 8.85938 17.6037 9.17606 17.6037 9.55816C17.6037 9.7439 17.5273 9.91854 17.3962 10.0496Z" })
|
|
9382
|
-
});
|
|
9383
|
-
|
|
9384
|
-
//#endregion
|
|
9385
|
-
//#region src/icons/SortUp.tsx
|
|
9386
|
-
const SortUp = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__marigold_system.SVG, {
|
|
9635
|
+
//#region src/icons/Pencil.tsx
|
|
9636
|
+
const Pencil = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
9637
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9387
9638
|
width: size$1,
|
|
9388
9639
|
height: size$1,
|
|
9389
9640
|
viewBox: "0 0 24 24",
|
|
9390
|
-
|
|
9641
|
+
fill: "none",
|
|
9642
|
+
stroke: "currentColor",
|
|
9643
|
+
strokeWidth: "2",
|
|
9644
|
+
strokeLinecap: "round",
|
|
9645
|
+
strokeLinejoin: "round",
|
|
9646
|
+
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
9391
9647
|
...props,
|
|
9392
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "
|
|
9648
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m15 5 4 4" })]
|
|
9393
9649
|
});
|
|
9394
9650
|
|
|
9395
9651
|
//#endregion
|
|
9396
|
-
//#region src/Table/
|
|
9397
|
-
const
|
|
9398
|
-
const
|
|
9399
|
-
const
|
|
9400
|
-
const
|
|
9401
|
-
const
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9652
|
+
//#region src/Table/TableEditableCell.tsx
|
|
9653
|
+
const EditableCellPopover = ({ cellRef, open, onOpenChange, className, children }) => {
|
|
9654
|
+
const popoverRef = (0, react.useRef)(null);
|
|
9655
|
+
const [triggerWidth, setTriggerWidth] = (0, react.useState)(0);
|
|
9656
|
+
const [tableWidth, setTableWidth] = (0, react.useState)(0);
|
|
9657
|
+
const [verticalOffset, setVerticalOffset] = (0, react.useState)(0);
|
|
9658
|
+
(0, react.useLayoutEffect)(() => {
|
|
9659
|
+
if (!open || !cellRef.current) return;
|
|
9660
|
+
const cell = cellRef.current;
|
|
9661
|
+
const rect = cell.getBoundingClientRect();
|
|
9662
|
+
const rowRect = cell.parentElement?.getBoundingClientRect();
|
|
9663
|
+
const offset$1 = (rowRect?.top ?? 0) - (rowRect?.bottom ?? 0);
|
|
9664
|
+
setTriggerWidth(rect.width);
|
|
9665
|
+
setVerticalOffset(offset$1);
|
|
9666
|
+
setTableWidth(cell.closest("[role=\"grid\"]")?.clientWidth ?? 0);
|
|
9667
|
+
}, [cellRef, open]);
|
|
9668
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Popover, {
|
|
9669
|
+
ref: popoverRef,
|
|
9670
|
+
isOpen: open,
|
|
9671
|
+
onOpenChange,
|
|
9672
|
+
triggerRef: cellRef,
|
|
9673
|
+
offset: verticalOffset,
|
|
9674
|
+
placement: "bottom start",
|
|
9675
|
+
style: {
|
|
9676
|
+
minWidth: `min(${triggerWidth}px, ${tableWidth}px)`,
|
|
9677
|
+
maxWidth: tableWidth
|
|
9678
|
+
},
|
|
9679
|
+
className,
|
|
9680
|
+
children
|
|
9681
|
+
});
|
|
9682
|
+
};
|
|
9683
|
+
const TableEditableCell = ({ children, field, saving = false, onSubmit, onCancel, disabled = false, action, alignX, overflow: cellOverflow }) => {
|
|
9684
|
+
const { classNames: classNames$2, allowTextSelection: tableAllowTextSelection, alignY = "middle" } = useTableContext();
|
|
9685
|
+
const { selectionMode } = (0, react_aria_components.useTableOptions)();
|
|
9686
|
+
const hasSelection = selectionMode !== "none";
|
|
9687
|
+
const isSmallScreen = (0, __marigold_system.useSmallScreen)();
|
|
9688
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
9689
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
9690
|
+
const submittedRef = (0, react.useRef)(false);
|
|
9691
|
+
const cellRef = (0, react.useRef)(null);
|
|
9692
|
+
const formRef = (0, react.useRef)(null);
|
|
9693
|
+
const handleFormRef = (0, react.useCallback)((node$1) => {
|
|
9694
|
+
formRef.current = node$1;
|
|
9695
|
+
if (node$1) requestAnimationFrame(() => {
|
|
9696
|
+
const activeElement = (0, __react_aria_utils.getActiveElement)((0, __react_aria_utils.getOwnerDocument)(node$1));
|
|
9697
|
+
if (activeElement && (0, __react_aria_utils.nodeContains)(node$1, activeElement) && (activeElement instanceof HTMLInputElement || activeElement instanceof HTMLTextAreaElement) && typeof activeElement.select === "function") activeElement.select();
|
|
9698
|
+
});
|
|
9699
|
+
}, []);
|
|
9700
|
+
const handleSubmit = (e$1) => {
|
|
9701
|
+
e$1.preventDefault();
|
|
9702
|
+
submittedRef.current = true;
|
|
9703
|
+
onSubmit?.(e$1);
|
|
9704
|
+
setOpen(false);
|
|
9705
|
+
};
|
|
9706
|
+
const handleCancel = () => {
|
|
9707
|
+
submittedRef.current = true;
|
|
9708
|
+
onCancel?.();
|
|
9709
|
+
setOpen(false);
|
|
9710
|
+
};
|
|
9711
|
+
const handleOpenChange = (isOpen) => {
|
|
9712
|
+
if (!isOpen && !submittedRef.current) onCancel?.();
|
|
9713
|
+
submittedRef.current = false;
|
|
9714
|
+
setOpen(isOpen);
|
|
9715
|
+
};
|
|
9716
|
+
const renderField = () => typeof field === "function" ? field() : field;
|
|
9717
|
+
const cancelButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
9718
|
+
className: classNames$2.editCancel,
|
|
9719
|
+
onPress: handleCancel,
|
|
9720
|
+
"aria-label": isSmallScreen ? void 0 : stringFormatter.format("cancel"),
|
|
9721
|
+
children: isSmallScreen ? stringFormatter.format("cancel") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(X, {})
|
|
9722
|
+
});
|
|
9723
|
+
const saveButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
9724
|
+
className: classNames$2.editSave,
|
|
9725
|
+
type: "submit",
|
|
9726
|
+
isPending: saving,
|
|
9727
|
+
"aria-label": isSmallScreen ? void 0 : stringFormatter.format("save"),
|
|
9728
|
+
children: isSmallScreen ? stringFormatter.format("save") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Check, {})
|
|
9729
|
+
});
|
|
9730
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Cell, {
|
|
9731
|
+
ref: cellRef,
|
|
9732
|
+
className: (0, __marigold_system.cn)(classNames$2.cell, __marigold_system.verticalAlign[alignY]),
|
|
9733
|
+
children: ({ columnIndex }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9734
|
+
className: "group/editable-cell flex items-center gap-1",
|
|
9735
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCellContent, {
|
|
9736
|
+
columnIndex,
|
|
9737
|
+
alignX,
|
|
9738
|
+
cellOverflow,
|
|
9739
|
+
className: "min-w-0 flex-1",
|
|
9740
|
+
allowTextSelection: !hasSelection || tableAllowTextSelection,
|
|
9741
|
+
children
|
|
9742
|
+
}), !disabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9743
|
+
className: "shrink-0 opacity-0 not-[@media_((hover:_hover)_and_(pointer:_fine))]:opacity-100 [.group\\/editable-cell:has(:focus-visible)_&]:opacity-100 [[role=row]:hover_&]:opacity-100",
|
|
9744
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
9745
|
+
className: classNames$2.editTrigger,
|
|
9746
|
+
"aria-label": stringFormatter.format("edit"),
|
|
9747
|
+
onPress: () => setOpen(true),
|
|
9748
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pencil, {})
|
|
9749
|
+
})
|
|
9750
|
+
})]
|
|
9751
|
+
}), isSmallScreen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Dialog, {
|
|
9752
|
+
open,
|
|
9753
|
+
onOpenChange: handleOpenChange,
|
|
9754
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_Form, {
|
|
9755
|
+
unstyled: true,
|
|
9756
|
+
ref: handleFormRef,
|
|
9757
|
+
action,
|
|
9758
|
+
onSubmit: handleSubmit,
|
|
9759
|
+
children: [
|
|
9760
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Dialog.Title, { children: stringFormatter.format("editCell") }),
|
|
9761
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Dialog.Content, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__react_aria_focus.FocusScope, {
|
|
9762
|
+
autoFocus: true,
|
|
9763
|
+
restoreFocus: true,
|
|
9764
|
+
children: renderField()
|
|
9765
|
+
}) }),
|
|
9766
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_Dialog.Actions, { children: [cancelButton, saveButton] })
|
|
9767
|
+
]
|
|
9768
|
+
})
|
|
9769
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditableCellPopover, {
|
|
9770
|
+
cellRef,
|
|
9771
|
+
open,
|
|
9772
|
+
onOpenChange: handleOpenChange,
|
|
9773
|
+
className: classNames$2.editablePopover,
|
|
9774
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Form, {
|
|
9775
|
+
unstyled: true,
|
|
9776
|
+
ref: handleFormRef,
|
|
9777
|
+
action,
|
|
9778
|
+
onSubmit: handleSubmit,
|
|
9779
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__react_aria_focus.FocusScope, {
|
|
9780
|
+
autoFocus: true,
|
|
9781
|
+
children: [
|
|
9782
|
+
renderField(),
|
|
9783
|
+
cancelButton,
|
|
9784
|
+
saveButton
|
|
9785
|
+
]
|
|
9786
|
+
})
|
|
9787
|
+
})
|
|
9788
|
+
})] })
|
|
9419
9789
|
});
|
|
9420
9790
|
};
|
|
9421
9791
|
|
|
9422
9792
|
//#endregion
|
|
9423
9793
|
//#region src/Table/TableHeader.tsx
|
|
9424
|
-
const TableHeader = ({
|
|
9425
|
-
const {
|
|
9794
|
+
const TableHeader = ({ sticky, columns, children, ...props }) => {
|
|
9795
|
+
const { selectionBehavior, selectionMode, allowsDragging } = (0, react_aria_components.useTableOptions)();
|
|
9426
9796
|
const { classNames: classNames$2 } = useTableContext();
|
|
9427
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9797
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.TableHeader, {
|
|
9798
|
+
className: (0, __marigold_system.cn)(classNames$2.head, sticky && "sticky top-0 z-1"),
|
|
9799
|
+
...props,
|
|
9800
|
+
children: [
|
|
9801
|
+
allowsDragging && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Column, {
|
|
9802
|
+
className: classNames$2.column,
|
|
9803
|
+
minWidth: 24,
|
|
9804
|
+
width: 24
|
|
9805
|
+
}),
|
|
9806
|
+
selectionBehavior === "toggle" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Column, {
|
|
9807
|
+
minWidth: 36,
|
|
9808
|
+
width: 36,
|
|
9809
|
+
className: classNames$2.column,
|
|
9810
|
+
children: selectionMode === "multiple" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox._Checkbox, { slot: "selection" })
|
|
9811
|
+
}),
|
|
9812
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Collection, {
|
|
9813
|
+
items: columns,
|
|
9814
|
+
children
|
|
9815
|
+
})
|
|
9816
|
+
]
|
|
9432
9817
|
});
|
|
9433
9818
|
};
|
|
9434
9819
|
|
|
9435
9820
|
//#endregion
|
|
9436
|
-
//#region src/
|
|
9437
|
-
const
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9821
|
+
//#region src/icons/GripVertical.tsx
|
|
9822
|
+
const GripVertical = ({ size: size$1 = 24, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
9823
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9824
|
+
width: size$1,
|
|
9825
|
+
height: size$1,
|
|
9826
|
+
fill: "none",
|
|
9827
|
+
stroke: "currentColor",
|
|
9828
|
+
strokeLinecap: "round",
|
|
9829
|
+
strokeLinejoin: "round",
|
|
9830
|
+
strokeWidth: 2,
|
|
9831
|
+
viewBox: "0 0 24 24",
|
|
9832
|
+
className: (0, __marigold_system.cn)("shrink-0", className),
|
|
9833
|
+
...props,
|
|
9834
|
+
children: [
|
|
9835
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
9836
|
+
cx: 9,
|
|
9837
|
+
cy: 12,
|
|
9838
|
+
r: 1
|
|
9839
|
+
}),
|
|
9840
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
9841
|
+
cx: 9,
|
|
9842
|
+
cy: 5,
|
|
9843
|
+
r: 1
|
|
9844
|
+
}),
|
|
9845
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
9846
|
+
cx: 9,
|
|
9847
|
+
cy: 19,
|
|
9848
|
+
r: 1
|
|
9849
|
+
}),
|
|
9850
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
9851
|
+
cx: 15,
|
|
9852
|
+
cy: 12,
|
|
9853
|
+
r: 1
|
|
9854
|
+
}),
|
|
9855
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
9856
|
+
cx: 15,
|
|
9857
|
+
cy: 5,
|
|
9858
|
+
r: 1
|
|
9859
|
+
}),
|
|
9860
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
9861
|
+
cx: 15,
|
|
9862
|
+
cy: 19,
|
|
9863
|
+
r: 1
|
|
9864
|
+
})
|
|
9865
|
+
]
|
|
9866
|
+
});
|
|
9449
9867
|
|
|
9450
9868
|
//#endregion
|
|
9451
9869
|
//#region src/Table/TableRow.tsx
|
|
9452
|
-
const TableRow = ({ children,
|
|
9453
|
-
|
|
9454
|
-
const
|
|
9455
|
-
const { variant, size: size$1 } = row.props;
|
|
9870
|
+
const TableRow = ({ id, columns, children, variant: variantProp, size: sizeProp, ...otherProps }) => {
|
|
9871
|
+
let { selectionBehavior, allowsDragging } = (0, react_aria_components.useTableOptions)();
|
|
9872
|
+
const context = useTableContext();
|
|
9456
9873
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
9457
9874
|
component: "Table",
|
|
9458
|
-
variant:
|
|
9459
|
-
size:
|
|
9460
|
-
});
|
|
9461
|
-
const { rowProps, isPressed } = (0, __react_aria_table.useTableRow)({ node: row }, state, ref);
|
|
9462
|
-
const disabled = state.disabledKeys.has(row.key);
|
|
9463
|
-
const selected = state.selectionManager.isSelected(row.key);
|
|
9464
|
-
const { focusProps, isFocusVisible } = (0, __react_aria_focus.useFocusRing)();
|
|
9465
|
-
const { hoverProps, isHovered } = (0, __react_aria_interactions.useHover)({ isDisabled: disabled || !interactive });
|
|
9466
|
-
const stateProps = (0, __marigold_system.useStateProps)({
|
|
9467
|
-
disabled,
|
|
9468
|
-
selected,
|
|
9469
|
-
hover: isHovered,
|
|
9470
|
-
focusVisible: isFocusVisible,
|
|
9471
|
-
active: isPressed
|
|
9472
|
-
});
|
|
9473
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
|
|
9474
|
-
ref,
|
|
9475
|
-
className: (0, __marigold_system.cn)([!interactive ? "cursor-text" : disabled ? "cursor-default" : "cursor-pointer"], classNames$2?.row),
|
|
9476
|
-
...(0, __react_aria_utils.mergeProps)(rowProps, focusProps, hoverProps),
|
|
9477
|
-
...stateProps,
|
|
9478
|
-
"data-rac": true,
|
|
9479
|
-
children
|
|
9875
|
+
variant: variantProp ?? context.variant,
|
|
9876
|
+
size: sizeProp ?? context.size
|
|
9480
9877
|
});
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
...stateProps,
|
|
9501
|
-
align,
|
|
9502
|
-
"data-rac": true,
|
|
9503
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Checkbox, { ...checkboxProps })
|
|
9878
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Row, {
|
|
9879
|
+
id,
|
|
9880
|
+
className: (0, __marigold_system.cn)("group/row", classNames$2.row),
|
|
9881
|
+
...otherProps,
|
|
9882
|
+
children: [
|
|
9883
|
+
allowsDragging && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Cell, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
9884
|
+
slot: "drag",
|
|
9885
|
+
className: (0, __marigold_system.cn)("grid size-full place-items-center", classNames$2.dragHandle),
|
|
9886
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GripVertical, {})
|
|
9887
|
+
}) }),
|
|
9888
|
+
selectionBehavior === "toggle" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Cell, {
|
|
9889
|
+
className: classNames$2.cell,
|
|
9890
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox._Checkbox, { slot: "selection" })
|
|
9891
|
+
}),
|
|
9892
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Collection, {
|
|
9893
|
+
items: columns,
|
|
9894
|
+
children
|
|
9895
|
+
})
|
|
9896
|
+
]
|
|
9504
9897
|
});
|
|
9505
9898
|
};
|
|
9506
9899
|
|
|
9507
9900
|
//#endregion
|
|
9508
9901
|
//#region src/Table/Table.tsx
|
|
9509
|
-
const
|
|
9510
|
-
const interactive = selectionMode !== "none";
|
|
9511
|
-
const tableRef = (0, react.useRef)(null);
|
|
9512
|
-
const state = (0, __react_stately_table.useTableState)({
|
|
9513
|
-
...props,
|
|
9514
|
-
selectionMode,
|
|
9515
|
-
showSelectionCheckboxes: selectionMode === "multiple" && props.selectionBehavior !== "replace"
|
|
9516
|
-
});
|
|
9517
|
-
/**
|
|
9518
|
-
* Behavior is a bit flacky with the table when using a keyboard
|
|
9519
|
-
* so we test here for undefined here to be save.
|
|
9520
|
-
*/
|
|
9521
|
-
if (disableKeyboardNavigation !== void 0) state.isKeyboardNavigationDisabled = disableKeyboardNavigation;
|
|
9522
|
-
const { gridProps } = (0, __react_aria_table.useTable)(props, state, tableRef);
|
|
9902
|
+
const _Table = ({ variant, size: size$1, overflow = "wrap", allowTextSelection = false, alignY = "middle", ...props }) => {
|
|
9523
9903
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
9524
9904
|
component: "Table",
|
|
9525
9905
|
variant,
|
|
9526
9906
|
size: size$1
|
|
9527
9907
|
});
|
|
9528
|
-
const
|
|
9908
|
+
const ctx = (0, react.useMemo)(() => ({
|
|
9909
|
+
classNames: classNames$2,
|
|
9910
|
+
variant,
|
|
9911
|
+
size: size$1,
|
|
9912
|
+
overflow,
|
|
9913
|
+
allowTextSelection,
|
|
9914
|
+
alignY
|
|
9915
|
+
}), [
|
|
9916
|
+
classNames$2,
|
|
9917
|
+
variant,
|
|
9918
|
+
size$1,
|
|
9919
|
+
overflow,
|
|
9920
|
+
allowTextSelection,
|
|
9921
|
+
alignY
|
|
9922
|
+
]);
|
|
9529
9923
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableContext.Provider, {
|
|
9530
|
-
value:
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
ref: tableRef,
|
|
9539
|
-
"data-rac": true,
|
|
9540
|
-
className: (0, __marigold_system.cn)(
|
|
9541
|
-
"group/table border-collapse",
|
|
9542
|
-
/**
|
|
9543
|
-
* Prevents wide tables from causing overlays to become scrollable on
|
|
9544
|
-
* small screens, ensuring overlays remain fixed as intended.
|
|
9545
|
-
*/
|
|
9546
|
-
"max-[600px]:[[aria-hidden=\"true\"]_&]:overflow-hidden",
|
|
9547
|
-
stretch ? "table w-full" : "block",
|
|
9548
|
-
classNames$2.table
|
|
9549
|
-
),
|
|
9550
|
-
...gridProps,
|
|
9551
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableHeader, {
|
|
9552
|
-
stickyHeader,
|
|
9553
|
-
children: collection.headerRows.map((headerRow) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableHeaderRow, {
|
|
9554
|
-
item: headerRow,
|
|
9555
|
-
className: classNames$2.headerRow,
|
|
9556
|
-
children: [...collection.getChildren(headerRow.key)].map((column$1) => column$1.props?.isSelectionCell ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableSelectAllCell, {
|
|
9557
|
-
width: column$1.props?.width,
|
|
9558
|
-
column: column$1,
|
|
9559
|
-
align: column$1.props?.align
|
|
9560
|
-
}, column$1.key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableColumnHeader, {
|
|
9561
|
-
width: column$1.props?.width,
|
|
9562
|
-
column: column$1,
|
|
9563
|
-
align: column$1.props?.align
|
|
9564
|
-
}, column$1.key))
|
|
9565
|
-
}, headerRow.key))
|
|
9566
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableBody, {
|
|
9567
|
-
className: classNames$2.body,
|
|
9568
|
-
emptyState,
|
|
9569
|
-
children: [...collection.rows.map((row) => row.type === "item" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, {
|
|
9570
|
-
row,
|
|
9571
|
-
children: [...collection.getChildren(row.key)].map((cell, index$1) => {
|
|
9572
|
-
const currentColumn = collection.columns[index$1];
|
|
9573
|
-
return cell.props?.isSelectionCell ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCheckboxCell, {
|
|
9574
|
-
cell,
|
|
9575
|
-
alignY
|
|
9576
|
-
}, cell.key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCell, {
|
|
9577
|
-
align: currentColumn.props?.align,
|
|
9578
|
-
alignY,
|
|
9579
|
-
cell
|
|
9580
|
-
}, cell.key);
|
|
9581
|
-
})
|
|
9582
|
-
}, row.key))]
|
|
9583
|
-
})]
|
|
9924
|
+
value: ctx,
|
|
9925
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.ResizableTableContainer, {
|
|
9926
|
+
className: "w-full",
|
|
9927
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Table, {
|
|
9928
|
+
className: (0, __marigold_system.cn)("group/table", classNames$2.table),
|
|
9929
|
+
selectionBehavior: "toggle",
|
|
9930
|
+
...props
|
|
9931
|
+
})
|
|
9584
9932
|
})
|
|
9585
9933
|
});
|
|
9586
9934
|
};
|
|
9587
|
-
Table
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9935
|
+
const Table = Object.assign(_Table, {
|
|
9936
|
+
Header: TableHeader,
|
|
9937
|
+
Column: TableColumn,
|
|
9938
|
+
Body: TableBody,
|
|
9939
|
+
Row: TableRow,
|
|
9940
|
+
Cell: TableCell,
|
|
9941
|
+
EditableCell: TableEditableCell,
|
|
9942
|
+
renderDropIndicator,
|
|
9943
|
+
renderDragPreview
|
|
9944
|
+
});
|
|
9592
9945
|
|
|
9593
9946
|
//#endregion
|
|
9594
9947
|
//#region src/Tabs/Context.ts
|
|
@@ -9608,11 +9961,11 @@ const _Tab = (props) => {
|
|
|
9608
9961
|
|
|
9609
9962
|
//#endregion
|
|
9610
9963
|
//#region src/Tabs/TabList.tsx
|
|
9611
|
-
const _TabList = (
|
|
9964
|
+
const _TabList = (props) => {
|
|
9612
9965
|
const { classNames: classNames$2 } = useTabContext();
|
|
9613
9966
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.TabList, {
|
|
9614
9967
|
...props,
|
|
9615
|
-
className: (0, __marigold_system.cn)("flex",
|
|
9968
|
+
className: (0, __marigold_system.cn)("flex", classNames$2.tabsList),
|
|
9616
9969
|
children: props.children
|
|
9617
9970
|
});
|
|
9618
9971
|
};
|
|
@@ -9676,7 +10029,7 @@ const TagGroupHiddenInput = ({ name }) => {
|
|
|
9676
10029
|
//#region src/TagGroup/TagGroupRemoveAll.tsx
|
|
9677
10030
|
const TagGroupRemoveAll = ({ className, onRemove }) => {
|
|
9678
10031
|
const state = (0, react.useContext)(react_aria_components.ListStateContext);
|
|
9679
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages, "marigold");
|
|
10032
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages, "marigold");
|
|
9680
10033
|
if (state && state.collection.size < 2) return null;
|
|
9681
10034
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
9682
10035
|
onPress: () => onRemove?.(new Set(state?.collection.getKeys())),
|
|
@@ -9693,7 +10046,7 @@ const _TagGroup = ({ items, children, emptyState, variant, size: size$1, name, r
|
|
|
9693
10046
|
variant,
|
|
9694
10047
|
size: size$1
|
|
9695
10048
|
});
|
|
9696
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FieldBase, {
|
|
10049
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Checkbox.FieldBase, {
|
|
9697
10050
|
as: react_aria_components.TagGroup,
|
|
9698
10051
|
...rest,
|
|
9699
10052
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -9734,27 +10087,136 @@ const _Tag = ({ variant, size: size$1, children, disabled, ...rest }) => {
|
|
|
9734
10087
|
_Tag.Group = _TagGroup;
|
|
9735
10088
|
|
|
9736
10089
|
//#endregion
|
|
9737
|
-
//#region src/
|
|
9738
|
-
const
|
|
10090
|
+
//#region src/TagField/TagField.tsx
|
|
10091
|
+
const TagDisplay = ({ placeholder, classNames: classNames$2, disabled }) => {
|
|
10092
|
+
const state = (0, react.useContext)(react_aria_components.SelectStateContext);
|
|
10093
|
+
if (!state) return null;
|
|
10094
|
+
const selectedKeys = [...state.selectionManager.selectedKeys];
|
|
10095
|
+
if (selectedKeys.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: placeholder });
|
|
10096
|
+
const selectedItems = [];
|
|
10097
|
+
for (const key of selectedKeys) {
|
|
10098
|
+
const item = state.collection.getItem(key);
|
|
10099
|
+
if (item) selectedItems.push({
|
|
10100
|
+
id: key,
|
|
10101
|
+
textValue: item.textValue
|
|
10102
|
+
});
|
|
10103
|
+
}
|
|
10104
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.TagGroup, {
|
|
10105
|
+
"aria-label": "Selected items",
|
|
10106
|
+
className: classNames$2.tagGroup,
|
|
10107
|
+
onRemove: disabled ? void 0 : (keys) => {
|
|
10108
|
+
const currentKeys = new Set(state.selectionManager.selectedKeys);
|
|
10109
|
+
for (const key of keys) currentKeys.delete(key);
|
|
10110
|
+
state.selectionManager.setSelectedKeys(currentKeys);
|
|
10111
|
+
},
|
|
10112
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.TagList, {
|
|
10113
|
+
items: selectedItems,
|
|
10114
|
+
className: classNames$2.listItems,
|
|
10115
|
+
children: (item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Tag, {
|
|
10116
|
+
id: item.id,
|
|
10117
|
+
disabled,
|
|
10118
|
+
children: item.textValue
|
|
10119
|
+
})
|
|
10120
|
+
})
|
|
10121
|
+
});
|
|
10122
|
+
};
|
|
10123
|
+
const TagFieldDropdown = ({ items, children, placeholder, emptyState }) => {
|
|
10124
|
+
const { contains } = (0, react_aria_components.useFilter)({ sensitivity: "base" });
|
|
10125
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
10126
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Autocomplete, {
|
|
10127
|
+
filter: contains,
|
|
10128
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.SearchField, {
|
|
10129
|
+
"aria-label": "Search",
|
|
10130
|
+
autoFocus: true,
|
|
10131
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, { placeholder })
|
|
10132
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ListBox, {
|
|
10133
|
+
items,
|
|
10134
|
+
renderEmptyState: () => emptyState ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10135
|
+
className: "flex items-center",
|
|
10136
|
+
children: stringFormatter.format("noResultsFound")
|
|
10137
|
+
}),
|
|
10138
|
+
children
|
|
10139
|
+
})]
|
|
10140
|
+
});
|
|
10141
|
+
};
|
|
10142
|
+
const _TagField = (0, react.forwardRef)(function TagField$1({ disabled, required, items, variant, size: size$1, error, open, children, placeholder, emptyState, ...rest }, ref) {
|
|
10143
|
+
const triggerRef = (0, react.useRef)(null);
|
|
10144
|
+
const [triggerWidth, setTriggerWidth] = (0, react.useState)(0);
|
|
10145
|
+
const isSmallScreen = (0, __marigold_system.useSmallScreen)();
|
|
10146
|
+
(0, react.useLayoutEffect)(() => {
|
|
10147
|
+
const el = triggerRef.current;
|
|
10148
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
10149
|
+
const observer = new ResizeObserver(() => {
|
|
10150
|
+
setTriggerWidth(el.offsetWidth);
|
|
10151
|
+
});
|
|
10152
|
+
observer.observe(el);
|
|
10153
|
+
return () => observer.disconnect();
|
|
10154
|
+
}, []);
|
|
10155
|
+
const props = {
|
|
10156
|
+
selectionMode: "multiple",
|
|
10157
|
+
isDisabled: disabled,
|
|
10158
|
+
isInvalid: error,
|
|
10159
|
+
isOpen: open,
|
|
10160
|
+
isRequired: required,
|
|
10161
|
+
...rest
|
|
10162
|
+
};
|
|
9739
10163
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
9740
|
-
component: "
|
|
10164
|
+
component: "TagField",
|
|
9741
10165
|
variant,
|
|
9742
10166
|
size: size$1
|
|
9743
10167
|
});
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component$1, {
|
|
10168
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages);
|
|
10169
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Checkbox.FieldBase, {
|
|
10170
|
+
as: react_aria_components.Select,
|
|
10171
|
+
ref,
|
|
10172
|
+
variant,
|
|
10173
|
+
size: size$1,
|
|
9751
10174
|
...props,
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
10175
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Group, {
|
|
10176
|
+
ref: triggerRef,
|
|
10177
|
+
className: (0, __marigold_system.cn)("w-(--field-width) max-w-full min-w-0", classNames$2.trigger),
|
|
10178
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TagDisplay, {
|
|
10179
|
+
placeholder,
|
|
10180
|
+
classNames: classNames$2,
|
|
10181
|
+
disabled
|
|
10182
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
|
|
10183
|
+
className: classNames$2.button,
|
|
10184
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronsVertical, {})
|
|
10185
|
+
})]
|
|
10186
|
+
}), isSmallScreen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tray, { children: [
|
|
10187
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Title, { children: rest.label }),
|
|
10188
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Content, {
|
|
10189
|
+
className: "flex flex-col gap-2",
|
|
10190
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TagFieldDropdown, {
|
|
10191
|
+
items,
|
|
10192
|
+
placeholder,
|
|
10193
|
+
emptyState,
|
|
10194
|
+
children
|
|
10195
|
+
})
|
|
10196
|
+
}),
|
|
10197
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tray.Actions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Button, {
|
|
10198
|
+
slot: "close",
|
|
10199
|
+
children: stringFormatter.format("close")
|
|
10200
|
+
}) })
|
|
10201
|
+
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_Popover, {
|
|
10202
|
+
triggerRef,
|
|
10203
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10204
|
+
className: classNames$2.container,
|
|
10205
|
+
style: (0, __marigold_system.createVar)({ "tagfield-trigger-width": triggerWidth ? `${triggerWidth}px` : void 0 }),
|
|
10206
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TagFieldDropdown, {
|
|
10207
|
+
items,
|
|
10208
|
+
placeholder,
|
|
10209
|
+
emptyState,
|
|
10210
|
+
children
|
|
10211
|
+
})
|
|
10212
|
+
})
|
|
10213
|
+
})]
|
|
9756
10214
|
});
|
|
9757
|
-
};
|
|
10215
|
+
});
|
|
10216
|
+
const TagField = Object.assign(_TagField, {
|
|
10217
|
+
Option: _ListBox.Item,
|
|
10218
|
+
Section: _ListBox.Section
|
|
10219
|
+
});
|
|
9758
10220
|
|
|
9759
10221
|
//#endregion
|
|
9760
10222
|
//#region src/TextArea/TextArea.tsx
|
|
@@ -9764,7 +10226,7 @@ const _TextArea = (0, react.forwardRef)(({ variant, size: size$1, required, disa
|
|
|
9764
10226
|
variant,
|
|
9765
10227
|
size: size$1
|
|
9766
10228
|
});
|
|
9767
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
10229
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
9768
10230
|
as: react_aria_components.TextField,
|
|
9769
10231
|
isDisabled: disabled,
|
|
9770
10232
|
isReadOnly: readOnly,
|
|
@@ -9774,7 +10236,7 @@ const _TextArea = (0, react.forwardRef)(({ variant, size: size$1, required, disa
|
|
|
9774
10236
|
variant,
|
|
9775
10237
|
size: size$1,
|
|
9776
10238
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.TextArea, {
|
|
9777
|
-
className: classNames$2,
|
|
10239
|
+
className: (0, __marigold_system.cn)(classNames$2, "w-(--field-width) max-w-full min-w-0"),
|
|
9778
10240
|
ref,
|
|
9779
10241
|
rows
|
|
9780
10242
|
})
|
|
@@ -9784,7 +10246,7 @@ const _TextArea = (0, react.forwardRef)(({ variant, size: size$1, required, disa
|
|
|
9784
10246
|
//#endregion
|
|
9785
10247
|
//#region src/TextField/TextField.tsx
|
|
9786
10248
|
const _TextField = (0, react.forwardRef)(({ required, disabled, readOnly, error, ...rest }, ref) => {
|
|
9787
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
10249
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
9788
10250
|
as: react_aria_components.TextField,
|
|
9789
10251
|
isDisabled: disabled,
|
|
9790
10252
|
isReadOnly: readOnly,
|
|
@@ -9807,11 +10269,14 @@ const Tiles = ({ space = 0, stretch = false, equalHeight = false, tilesWidth = "
|
|
|
9807
10269
|
if (stretch) column$1 = `minmax(${column$1}, 1fr)`;
|
|
9808
10270
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9809
10271
|
...props,
|
|
9810
|
-
className: (0, __marigold_system.cn)("grid
|
|
9811
|
-
style:
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
10272
|
+
className: (0, __marigold_system.cn)("grid gap-(--space)", "grid-cols-[repeat(auto-fit,var(--column))]", equalHeight && "auto-rows-[1fr]"),
|
|
10273
|
+
style: {
|
|
10274
|
+
...(0, __marigold_system.createVar)({
|
|
10275
|
+
column: column$1,
|
|
10276
|
+
tilesWidth
|
|
10277
|
+
}),
|
|
10278
|
+
...(0, __marigold_system.createSpacingVar)("space", `${space}`)
|
|
10279
|
+
},
|
|
9815
10280
|
children
|
|
9816
10281
|
});
|
|
9817
10282
|
};
|
|
@@ -9824,7 +10289,7 @@ const _TimeField = (0, react.forwardRef)(({ required, disabled, readOnly, error,
|
|
|
9824
10289
|
variant,
|
|
9825
10290
|
size: size$1
|
|
9826
10291
|
});
|
|
9827
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldBase, {
|
|
10292
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.FieldBase, {
|
|
9828
10293
|
as: react_aria_components.TimeField,
|
|
9829
10294
|
variant,
|
|
9830
10295
|
size: size$1,
|
|
@@ -9835,11 +10300,14 @@ const _TimeField = (0, react.forwardRef)(({ required, disabled, readOnly, error,
|
|
|
9835
10300
|
isRequired: required,
|
|
9836
10301
|
...rest,
|
|
9837
10302
|
ref,
|
|
9838
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.
|
|
9839
|
-
className: classNames$2.field,
|
|
9840
|
-
children:
|
|
9841
|
-
className: classNames$2.
|
|
9842
|
-
segment
|
|
10303
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Group, {
|
|
10304
|
+
className: (0, __marigold_system.cn)("w-(--field-width) max-w-full min-w-0", classNames$2.field),
|
|
10305
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.DateInput, {
|
|
10306
|
+
className: (0, __marigold_system.cn)("flex flex-1 items-center", classNames$2.input),
|
|
10307
|
+
children: (segment) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.DateSegment, {
|
|
10308
|
+
className: classNames$2.segment,
|
|
10309
|
+
segment
|
|
10310
|
+
})
|
|
9843
10311
|
})
|
|
9844
10312
|
})
|
|
9845
10313
|
});
|
|
@@ -9851,14 +10319,14 @@ const icons = {
|
|
|
9851
10319
|
success: CircleCheck,
|
|
9852
10320
|
info: Info,
|
|
9853
10321
|
warning: CircleAlert,
|
|
9854
|
-
error: TriangleAlert
|
|
10322
|
+
error: require_Checkbox.TriangleAlert
|
|
9855
10323
|
};
|
|
9856
10324
|
const Toast = ({ toast }) => {
|
|
9857
10325
|
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
9858
10326
|
component: "Toast",
|
|
9859
10327
|
variant: toast.content.variant
|
|
9860
10328
|
});
|
|
9861
|
-
const Icon$
|
|
10329
|
+
const Icon$1 = toast.content.variant ? icons[toast.content.variant] : null;
|
|
9862
10330
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.UNSTABLE_Toast, {
|
|
9863
10331
|
toast,
|
|
9864
10332
|
className: classNames$2.toast,
|
|
@@ -9866,11 +10334,11 @@ const Toast = ({ toast }) => {
|
|
|
9866
10334
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.UNSTABLE_ToastContent, {
|
|
9867
10335
|
className: classNames$2.content,
|
|
9868
10336
|
children: [
|
|
9869
|
-
Icon$
|
|
10337
|
+
Icon$1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9870
10338
|
className: classNames$2.icon,
|
|
9871
10339
|
slot: "icon",
|
|
9872
10340
|
"data-testid": "toast-icon",
|
|
9873
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$
|
|
10341
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$1, { size: "20" })
|
|
9874
10342
|
}),
|
|
9875
10343
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Text, {
|
|
9876
10344
|
slot: "title",
|
|
@@ -9899,15 +10367,18 @@ const Toast = ({ toast }) => {
|
|
|
9899
10367
|
//#endregion
|
|
9900
10368
|
//#region src/Toast/ToastProvider.tsx
|
|
9901
10369
|
const queue = new react_aria_components.UNSTABLE_ToastQueue({ wrapUpdate(fn) {
|
|
9902
|
-
if ("startViewTransition" in document)
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
10370
|
+
if ("startViewTransition" in document) {
|
|
10371
|
+
const transition = document.startViewTransition(() => {
|
|
10372
|
+
(0, react_dom.flushSync)(fn);
|
|
10373
|
+
});
|
|
10374
|
+
transition.ready.catch(() => {});
|
|
10375
|
+
transition.finished.catch(() => {});
|
|
10376
|
+
} else fn();
|
|
9906
10377
|
} });
|
|
9907
10378
|
const ToastProvider = ({ position: position$1 = "bottom-right" }) => {
|
|
9908
10379
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.UNSTABLE_ToastRegion, {
|
|
9909
10380
|
queue,
|
|
9910
|
-
className: `${(0, __marigold_system.useClassNames)({ component: "Toast" })[position$1]} z-
|
|
10381
|
+
className: `${(0, __marigold_system.useClassNames)({ component: "Toast" })[position$1]} z-80 gap-2`,
|
|
9911
10382
|
children: ({ toast }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toast, { toast })
|
|
9912
10383
|
});
|
|
9913
10384
|
};
|
|
@@ -9972,7 +10443,7 @@ const _Tooltip = ({ children, variant, size: size$1, open, ...rest }) => {
|
|
|
9972
10443
|
});
|
|
9973
10444
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.Tooltip, {
|
|
9974
10445
|
...props,
|
|
9975
|
-
className: (0, __marigold_system.cn)("group/tooltip", classNames$2.container),
|
|
10446
|
+
className: (0, __marigold_system.cn)("group/tooltip z-30", classNames$2.container),
|
|
9976
10447
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.OverlayArrow, {
|
|
9977
10448
|
className: classNames$2.arrow,
|
|
9978
10449
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipArrow, {})
|
|
@@ -10130,7 +10601,7 @@ const XLoaderSvg = ({ className }) => {
|
|
|
10130
10601
|
});
|
|
10131
10602
|
};
|
|
10132
10603
|
const BaseLoader = ({ variant, size: size$1, children, "aria-label": ariaLabel, loaderType = "circle", ...props }) => {
|
|
10133
|
-
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(intlMessages, "marigold");
|
|
10604
|
+
const stringFormatter = (0, __react_aria_i18n.useLocalizedStringFormatter)(require_Checkbox.intlMessages, "marigold");
|
|
10134
10605
|
const className = (0, __marigold_system.useClassNames)({
|
|
10135
10606
|
component: "Loader",
|
|
10136
10607
|
variant,
|
|
@@ -10193,6 +10664,50 @@ const Loader = ({ mode, variant, ...props }) => mode === "fullscreen" ? /* @__PU
|
|
|
10193
10664
|
...props
|
|
10194
10665
|
});
|
|
10195
10666
|
|
|
10667
|
+
//#endregion
|
|
10668
|
+
//#region src/ToggleButton/Context.tsx
|
|
10669
|
+
const ToggleButtonContext = (0, react.createContext)({});
|
|
10670
|
+
|
|
10671
|
+
//#endregion
|
|
10672
|
+
//#region src/ToggleButton/ToggleButtonGroup.tsx
|
|
10673
|
+
const _ToggleButtonGroup = ({ children, disabled, variant, size: size$1, ...props }) => {
|
|
10674
|
+
const classNames$2 = (0, __marigold_system.useClassNames)({
|
|
10675
|
+
component: "ToggleButton",
|
|
10676
|
+
variant,
|
|
10677
|
+
size: size$1
|
|
10678
|
+
});
|
|
10679
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleButtonContext.Provider, {
|
|
10680
|
+
value: {
|
|
10681
|
+
variant,
|
|
10682
|
+
size: size$1
|
|
10683
|
+
},
|
|
10684
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.ToggleButtonGroup, {
|
|
10685
|
+
className: classNames$2.group,
|
|
10686
|
+
isDisabled: disabled,
|
|
10687
|
+
...props,
|
|
10688
|
+
children
|
|
10689
|
+
})
|
|
10690
|
+
});
|
|
10691
|
+
};
|
|
10692
|
+
|
|
10693
|
+
//#endregion
|
|
10694
|
+
//#region src/ToggleButton/ToggleButton.tsx
|
|
10695
|
+
const _ToggleButton = ({ children, selected, disabled, variant, size: size$1, ...props }) => {
|
|
10696
|
+
const context = (0, react.useContext)(ToggleButtonContext);
|
|
10697
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.ToggleButton, {
|
|
10698
|
+
isSelected: selected,
|
|
10699
|
+
isDisabled: disabled,
|
|
10700
|
+
className: (0, __marigold_system.useClassNames)({
|
|
10701
|
+
component: "ToggleButton",
|
|
10702
|
+
variant: variant ?? context.variant,
|
|
10703
|
+
size: size$1 ?? context.size
|
|
10704
|
+
}).button,
|
|
10705
|
+
...props,
|
|
10706
|
+
children
|
|
10707
|
+
});
|
|
10708
|
+
};
|
|
10709
|
+
_ToggleButton.Group = _ToggleButtonGroup;
|
|
10710
|
+
|
|
10196
10711
|
//#endregion
|
|
10197
10712
|
//#region src/utils/form.utils.ts
|
|
10198
10713
|
/**
|
|
@@ -10212,6 +10727,8 @@ const parseFormData = (e$1) => {
|
|
|
10212
10727
|
//#endregion
|
|
10213
10728
|
exports.Accordion = Accordion;
|
|
10214
10729
|
exports.AccordionItem = AccordionItem;
|
|
10730
|
+
exports.ActionBar = ActionBar;
|
|
10731
|
+
exports.ActionButton = ActionButton;
|
|
10215
10732
|
exports.ActionMenu = ActionMenu;
|
|
10216
10733
|
exports.Aside = Aside;
|
|
10217
10734
|
exports.Aspect = Aspect;
|
|
@@ -10223,10 +10740,10 @@ exports.Button = _Button;
|
|
|
10223
10740
|
exports.Calendar = _Calendar;
|
|
10224
10741
|
exports.Card = Card;
|
|
10225
10742
|
exports.Center = Center;
|
|
10226
|
-
exports.Checkbox = _Checkbox;
|
|
10227
|
-
exports.CheckboxGroup = _CheckboxGroup;
|
|
10743
|
+
exports.Checkbox = require_Checkbox._Checkbox;
|
|
10744
|
+
exports.CheckboxGroup = require_Checkbox._CheckboxGroup;
|
|
10228
10745
|
exports.CloseButton = CloseButton;
|
|
10229
|
-
exports.Collapsible = Collapsible;
|
|
10746
|
+
exports.Collapsible = require_Checkbox.Collapsible;
|
|
10230
10747
|
exports.Columns = Columns;
|
|
10231
10748
|
exports.ComboBox = _ComboBox;
|
|
10232
10749
|
exports.ConfirmationContext = ConfirmationContext;
|
|
@@ -10245,12 +10762,13 @@ exports.DatePicker = _DatePicker;
|
|
|
10245
10762
|
exports.Dialog = _Dialog;
|
|
10246
10763
|
exports.Divider = _Divider;
|
|
10247
10764
|
exports.Drawer = Drawer;
|
|
10248
|
-
exports.
|
|
10765
|
+
exports.EmptyState = EmptyState;
|
|
10766
|
+
exports.FieldBase = require_Checkbox.FieldBase;
|
|
10249
10767
|
exports.FileField = FileField;
|
|
10250
10768
|
exports.Form = _Form;
|
|
10251
10769
|
exports.Grid = Grid;
|
|
10252
10770
|
exports.Headline = _Headline;
|
|
10253
|
-
exports.HelpText = HelpText;
|
|
10771
|
+
exports.HelpText = require_Checkbox.HelpText;
|
|
10254
10772
|
Object.defineProperty(exports, 'I18nProvider', {
|
|
10255
10773
|
enumerable: true,
|
|
10256
10774
|
get: function () {
|
|
@@ -10261,7 +10779,7 @@ exports.IconButton = IconButton;
|
|
|
10261
10779
|
exports.Inline = Inline;
|
|
10262
10780
|
exports.Input = _Input;
|
|
10263
10781
|
exports.Inset = Inset;
|
|
10264
|
-
exports.Label = _Label;
|
|
10782
|
+
exports.Label = require_Checkbox._Label;
|
|
10265
10783
|
exports.Link = _Link;
|
|
10266
10784
|
exports.LinkButton = _LinkButton;
|
|
10267
10785
|
exports.List = List;
|
|
@@ -10307,6 +10825,7 @@ exports.Switch = _Switch;
|
|
|
10307
10825
|
exports.Table = Table;
|
|
10308
10826
|
exports.Tabs = _Tabs;
|
|
10309
10827
|
exports.Tag = _Tag;
|
|
10828
|
+
exports.TagField = TagField;
|
|
10310
10829
|
exports.TagGroup = _TagGroup;
|
|
10311
10830
|
exports.Text = _Text;
|
|
10312
10831
|
exports.TextArea = _TextArea;
|
|
@@ -10321,7 +10840,10 @@ exports.Tiles = Tiles;
|
|
|
10321
10840
|
exports.TimeField = _TimeField;
|
|
10322
10841
|
exports.Toast = Toast;
|
|
10323
10842
|
exports.ToastProvider = ToastProvider;
|
|
10843
|
+
exports.ToggleButton = _ToggleButton;
|
|
10844
|
+
exports.ToggleButtonGroup = _ToggleButtonGroup;
|
|
10324
10845
|
exports.Tooltip = _Tooltip;
|
|
10846
|
+
exports.Tray = Tray;
|
|
10325
10847
|
exports.Underlay = Underlay;
|
|
10326
10848
|
Object.defineProperty(exports, 'VisuallyHidden', {
|
|
10327
10849
|
enumerable: true,
|
|
@@ -10329,18 +10851,25 @@ Object.defineProperty(exports, 'VisuallyHidden', {
|
|
|
10329
10851
|
return __react_aria_visually_hidden.VisuallyHidden;
|
|
10330
10852
|
}
|
|
10331
10853
|
});
|
|
10854
|
+
exports.__toESM = __toESM;
|
|
10332
10855
|
exports.parseFormData = parseFormData;
|
|
10333
10856
|
Object.defineProperty(exports, 'useAsyncList', {
|
|
10334
10857
|
enumerable: true,
|
|
10335
10858
|
get: function () {
|
|
10336
|
-
return
|
|
10859
|
+
return react_aria_components.useAsyncList;
|
|
10337
10860
|
}
|
|
10338
10861
|
});
|
|
10339
10862
|
exports.useConfirmation = useConfirmation;
|
|
10863
|
+
Object.defineProperty(exports, 'useDragAndDrop', {
|
|
10864
|
+
enumerable: true,
|
|
10865
|
+
get: function () {
|
|
10866
|
+
return react_aria_components.useDragAndDrop;
|
|
10867
|
+
}
|
|
10868
|
+
});
|
|
10340
10869
|
Object.defineProperty(exports, 'useListData', {
|
|
10341
10870
|
enumerable: true,
|
|
10342
10871
|
get: function () {
|
|
10343
|
-
return
|
|
10872
|
+
return react_aria_components.useListData;
|
|
10344
10873
|
}
|
|
10345
10874
|
});
|
|
10346
10875
|
Object.defineProperty(exports, 'useTheme', {
|