@jsswift/ui 1.0.54 → 2.0.0
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/css/animation.css +36 -36
- package/dist/css/base.css +374 -374
- package/dist/css/docs.css +54 -54
- package/dist/css/fonts-nunito.css +2 -2
- package/dist/css/min-ui.css +1 -1
- package/dist/css/responsive-base.css +549 -549
- package/dist/css/responsive.css +3225 -3225
- package/dist/css/ui-components.css +2902 -2930
- package/dist/css/ui-light.css +3853 -3881
- package/dist/css/ui-light.min.css +1 -1
- package/dist/css/ui.css +6530 -6558
- package/dist/css/ui.min.css +1 -1
- package/dist/min-ui.js +12 -12
- package/dist/ui.js +4354 -9379
- package/dist/ui.min.js +12 -12
- package/package.json +2 -2
- package/src/00-bootstrap.js +305 -305
- package/src/01-foundation-helpers.js +328 -325
- package/src/10-primitives-layout.js +242 -242
- package/src/20-display-content.js +76 -76
- package/src/21-list-content.js +21 -21
- package/src/22-banner-content.js +376 -376
- package/src/23-tooltip.js +9 -9
- package/src/31-form-advanced.js +141 -141
- package/src/40-navigation.js +81 -81
- package/src/41-tab-panel.js +37 -37
- package/src/50-feedback.js +52 -52
- package/src/51-feedback-service.js +166 -166
- package/src/60-shell-app.js +1082 -1082
- package/src/61-form-service.js +5 -5
- package/src/70-dialog.js +34 -34
- package/src/71-menu-overlays.js +73 -73
- package/src/80-data.js +38 -38
- package/src/css/animation.css +36 -36
- package/src/css/base.css +374 -374
- package/src/css/docs.css +54 -54
- package/src/css/fonts-nunito.css +2 -2
- package/src/css/responsive.css +3225 -3225
- package/src/css/ui-components.css +2902 -2930
package/src/61-form-service.js
CHANGED
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
const { props, children } = JSswift.uiNormalizeArgs(args);
|
|
248
248
|
const form = props.form; // required-ish
|
|
249
249
|
const onSubmit = props.onSubmit; // async (model, form) => ...
|
|
250
|
-
const cls = uiClass(["
|
|
250
|
+
const cls = uiClass(["jss-form", props.class]);
|
|
251
251
|
|
|
252
252
|
const p = JSswift.omit(props, ["form", "onSubmit"]);
|
|
253
253
|
p.class = cls;
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
if (modalRoot) return modalRoot;
|
|
298
298
|
|
|
299
299
|
modalRoot = document.createElement("div");
|
|
300
|
-
modalRoot.setAttribute("data-
|
|
300
|
+
modalRoot.setAttribute("data-jss-modal-root", "true");
|
|
301
301
|
document.body.appendChild(modalRoot);
|
|
302
302
|
return modalRoot;
|
|
303
303
|
}
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
UI.cardHeader = (...args) => {
|
|
306
306
|
const { props, children } = JSswift.uiNormalizeArgs(args);
|
|
307
307
|
const slots = props.slots || {};
|
|
308
|
-
const cls = uiClass(["
|
|
308
|
+
const cls = uiClass(["jss-card-header", uiWhen(props.divider, "divider"), props.class]);
|
|
309
309
|
const p = JSswift.omit(props, ["divider", "align", "justify", "gap", "wrap", "direction", "slots"]);
|
|
310
310
|
p.class = cls;
|
|
311
311
|
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
UI.cardBody = (...args) => {
|
|
331
331
|
const { props, children } = JSswift.uiNormalizeArgs(args);
|
|
332
332
|
const slots = props.slots || {};
|
|
333
|
-
const cls = uiClass(["
|
|
333
|
+
const cls = uiClass(["jss-card-body", props.class]);
|
|
334
334
|
const p = JSswift.omit(props, [
|
|
335
335
|
"slots", "display", "direction", "wrap", "align", "justify", "gap",
|
|
336
336
|
"rowGap", "columnGap", "padding", "width"
|
|
@@ -344,7 +344,7 @@
|
|
|
344
344
|
UI.cardFooter = (...args) => {
|
|
345
345
|
const { props, children } = JSswift.uiNormalizeArgs(args);
|
|
346
346
|
const slots = props.slots || {};
|
|
347
|
-
const cls = uiClass(["
|
|
347
|
+
const cls = uiClass(["jss-card-footer", uiWhen(props.divider, "divider"), props.class]);
|
|
348
348
|
const p = JSswift.omit(props, ["divider", "align", "justify", "gap", "wrap", "direction", "slots"]);
|
|
349
349
|
p.class = cls;
|
|
350
350
|
|
package/src/70-dialog.js
CHANGED
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
setStyleValue(currentEntry.panel, "border-radius", 0, (v) => `${v}px`);
|
|
54
54
|
setStyleValue(currentEntry.panel, "transform", "none");
|
|
55
55
|
setStyleValue(currentEntry.panel, "overflow", "hidden");
|
|
56
|
-
setStyleValue(currentEntry.panel, "--
|
|
57
|
-
setStyleValue(currentEntry.panel, "--
|
|
58
|
-
setStyleValue(currentEntry.panel, "--
|
|
59
|
-
setStyleValue(currentEntry.panel, "--
|
|
56
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-left", left, (v) => `${v}px`);
|
|
57
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-top", top, (v) => `${v}px`);
|
|
58
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-width", width, (v) => `${v}px`);
|
|
59
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-height", height, (v) => `${v}px`);
|
|
60
60
|
};
|
|
61
61
|
const clearFullscreenViewport = (currentEntry) => {
|
|
62
62
|
if (!currentEntry?.panel) return;
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
setStyleValue(currentEntry.panel, "border-radius", null);
|
|
79
79
|
setStyleValue(currentEntry.panel, "transform", null);
|
|
80
80
|
setStyleValue(currentEntry.panel, "overflow", null);
|
|
81
|
-
setStyleValue(currentEntry.panel, "--
|
|
82
|
-
setStyleValue(currentEntry.panel, "--
|
|
83
|
-
setStyleValue(currentEntry.panel, "--
|
|
84
|
-
setStyleValue(currentEntry.panel, "--
|
|
81
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-left", null);
|
|
82
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-top", null);
|
|
83
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-width", null);
|
|
84
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-fullscreen-height", null);
|
|
85
85
|
};
|
|
86
86
|
const ensureFullscreenViewportTracking = (currentEntry, enabled) => {
|
|
87
87
|
if (!currentEntry) return;
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
};
|
|
140
140
|
const getVerticalAlignClass = (opts) => {
|
|
141
141
|
const raw = String(uiUnwrap(opts.align ?? opts.verticalAlign ?? opts.position ?? "center")).toLowerCase();
|
|
142
|
-
if (["top", "start", "flex-start"].includes(raw)) return "
|
|
143
|
-
if (["bottom", "end", "flex-end"].includes(raw)) return "
|
|
142
|
+
if (["top", "start", "flex-start"].includes(raw)) return "jss-dialog-align-top";
|
|
143
|
+
if (["bottom", "end", "flex-end"].includes(raw)) return "jss-dialog-align-bottom";
|
|
144
144
|
return "";
|
|
145
145
|
};
|
|
146
146
|
const isClosable = (opts) => {
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
const customHeaderNodes = renderSlotToArray(slots, "header", ctx, resolveRender(opts.headerContent ?? opts.head, ctx));
|
|
172
172
|
const closeSlotNodes = isClosable(opts)
|
|
173
173
|
? renderSlotToArray(slots, "close", ctx, UI.Btn({
|
|
174
|
-
class: "
|
|
174
|
+
class: "jss-dialog-close",
|
|
175
175
|
size: "sm",
|
|
176
176
|
outline: true,
|
|
177
177
|
"aria-label": opts.closeLabel || "Chiudi dialog",
|
|
@@ -188,29 +188,29 @@
|
|
|
188
188
|
|
|
189
189
|
let headerEl = null;
|
|
190
190
|
if (customHeaderNodes.length) {
|
|
191
|
-
headerEl = _.div({ class: "
|
|
191
|
+
headerEl = _.div({ class: "jss-dialog-head jss-dialog-head-custom" }, ...customHeaderNodes);
|
|
192
192
|
} else if (eyebrowNodes.length || titleNodes.length || subtitleNodes.length || iconNodes.length || closeSlotNodes.length) {
|
|
193
193
|
headerEl = _.div(
|
|
194
|
-
{ class: "
|
|
195
|
-
iconNodes.length ? _.div({ class: "
|
|
194
|
+
{ class: "jss-dialog-head" },
|
|
195
|
+
iconNodes.length ? _.div({ class: "jss-dialog-icon" }, ...iconNodes) : null,
|
|
196
196
|
_.div(
|
|
197
|
-
{ class: "
|
|
198
|
-
eyebrowNodes.length ? _.div({ class: "
|
|
199
|
-
titleNodes.length ? _.div({ class: "
|
|
200
|
-
subtitleNodes.length ? _.div({ class: "
|
|
197
|
+
{ class: "jss-dialog-head-main" },
|
|
198
|
+
eyebrowNodes.length ? _.div({ class: "jss-dialog-eyebrow" }, ...eyebrowNodes) : null,
|
|
199
|
+
titleNodes.length ? _.div({ class: "jss-dialog-title" }, ...titleNodes) : null,
|
|
200
|
+
subtitleNodes.length ? _.div({ class: "jss-dialog-subtitle" }, ...subtitleNodes) : null
|
|
201
201
|
),
|
|
202
|
-
closeSlotNodes.length ? _.div({ class: "
|
|
202
|
+
closeSlotNodes.length ? _.div({ class: "jss-dialog-close-wrap" }, ...closeSlotNodes) : null
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
const bodyEl = _.div(
|
|
207
|
-
{ class: uiClass(["
|
|
207
|
+
{ class: uiClass(["jss-dialog-body", opts.bodyClass]) },
|
|
208
208
|
...contentNodes
|
|
209
209
|
);
|
|
210
210
|
const footerEl = footerNodes.length
|
|
211
211
|
? _.div({
|
|
212
212
|
class: uiClass([
|
|
213
|
-
"
|
|
213
|
+
"jss-dialog-actions",
|
|
214
214
|
`is-${getAlignClass(opts)}`,
|
|
215
215
|
uiWhen(opts.stackActions, "is-stacked"),
|
|
216
216
|
opts.actionsClass,
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
|
|
222
222
|
return _.div({
|
|
223
223
|
class: uiClass([
|
|
224
|
-
"
|
|
224
|
+
"jss-dialog-shell",
|
|
225
225
|
uiWhen(!!headerEl, "has-head"),
|
|
226
226
|
uiWhen(!!footerEl, "has-footer"),
|
|
227
227
|
uiWhen(opts.divider !== false, "with-divider")
|
|
@@ -234,12 +234,12 @@
|
|
|
234
234
|
const stateClass = getStateClass(opts);
|
|
235
235
|
const sizeClass = getSizeClass(opts);
|
|
236
236
|
setTrackedClasses(currentEntry.panel, "_dialogClassTokens", [
|
|
237
|
-
"
|
|
238
|
-
"
|
|
239
|
-
"
|
|
240
|
-
sizeClass ? `
|
|
237
|
+
"jss-dialog",
|
|
238
|
+
"jss-singularity",
|
|
239
|
+
"jss-clear-set",
|
|
240
|
+
sizeClass ? `jss-dialog-${sizeClass}` : "",
|
|
241
241
|
stateClass,
|
|
242
|
-
stateClass ? `
|
|
242
|
+
stateClass ? `jss-state-${stateClass}` : "",
|
|
243
243
|
uiUnwrap(opts.fullscreen) ? "fullscreen" : "",
|
|
244
244
|
uiUnwrap(opts.scrollable) ? "scrollable" : "",
|
|
245
245
|
uiUnwrap(opts.stickyHeader) ? "sticky-head" : "",
|
|
@@ -250,14 +250,14 @@
|
|
|
250
250
|
]);
|
|
251
251
|
setTrackedClasses(currentEntry.overlay, "_dialogOverlayClassTokens", [
|
|
252
252
|
getVerticalAlignClass(opts),
|
|
253
|
-
uiUnwrap(opts.backdropBlur) ? "
|
|
253
|
+
uiUnwrap(opts.backdropBlur) ? "jss-dialog-overlay-blur" : "",
|
|
254
254
|
...splitClasses(opts.overlayClass)
|
|
255
255
|
]);
|
|
256
|
-
setStyleValue(currentEntry.panel, "--
|
|
257
|
-
setStyleValue(currentEntry.panel, "--
|
|
258
|
-
setStyleValue(currentEntry.panel, "--
|
|
259
|
-
setStyleValue(currentEntry.panel, "--
|
|
260
|
-
setStyleValue(currentEntry.panel, "--
|
|
256
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-width", uiUnwrap(opts.width), toCssSize);
|
|
257
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-min-width", uiUnwrap(opts.minWidth), toCssSize);
|
|
258
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-max-width", uiUnwrap(opts.maxWidth), toCssSize);
|
|
259
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-max-height", uiUnwrap(opts.maxHeight), toCssSize);
|
|
260
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-body-max-height", uiUnwrap(opts.bodyMaxHeight ?? opts.contentMaxHeight), toCssSize);
|
|
261
261
|
if (opts.style) Object.assign(currentEntry.panel.style, opts.style);
|
|
262
262
|
setPropertyProps(currentEntry.panel, opts);
|
|
263
263
|
ensureFullscreenViewportTracking(currentEntry, uiUnwrap(opts.fullscreen));
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
closeOnOutside: opts.closeOnOutside ?? !persistent,
|
|
298
298
|
closeOnBackdrop: opts.closeOnBackdrop ?? !persistent,
|
|
299
299
|
closeOnEsc: opts.closeOnEsc ?? !persistent,
|
|
300
|
-
className: uiClassStatic(["
|
|
300
|
+
className: uiClassStatic(["jss-dialog"]),
|
|
301
301
|
onClose: () => {
|
|
302
302
|
entry?._dialogViewportCleanup?.();
|
|
303
303
|
entry?.panel?.removeEventListener("click", onPanelClick);
|
package/src/71-menu-overlays.js
CHANGED
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
return { anchorEl, nextProps };
|
|
94
94
|
};
|
|
95
95
|
const getFocusableItems = (root = entry?.panel) => Array.from(root?.querySelectorAll?.(
|
|
96
|
-
"[data-menu-item]:not([disabled]):not([tabindex='-1']), .
|
|
96
|
+
"[data-menu-item]:not([disabled]):not([tabindex='-1']), .jss-menu-item:not([disabled]):not([tabindex='-1']), [role='menuitem']:not([disabled]):not([tabindex='-1']), a[href]:not([tabindex='-1']), button:not([disabled]):not([tabindex='-1'])"
|
|
97
97
|
) || []).filter((el) => el.offsetParent !== null && el.getAttribute("aria-hidden") !== "true");
|
|
98
98
|
const focusInitialItem = () => {
|
|
99
99
|
if (uiUnwrap(getOptions().autoFocus) === false) return;
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
|
|
126
126
|
const kind = String(raw.type ?? raw.kind ?? "").toLowerCase();
|
|
127
127
|
if (kind === "separator" || kind === "divider" || raw.separator === true || raw.divider === true) {
|
|
128
|
-
return [_.div({ class: "
|
|
128
|
+
return [_.div({ class: "jss-menu-divider", role: "separator" })];
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
const groupItems = raw.items ?? raw.children;
|
|
@@ -135,9 +135,9 @@
|
|
|
135
135
|
const contentNodes = renderItemEntries(groupItems, groupCtx);
|
|
136
136
|
if (!contentNodes.length) return [];
|
|
137
137
|
return [_.div(
|
|
138
|
-
{ class: uiClass(["
|
|
139
|
-
labelNodes.length ? _.div({ class: "
|
|
140
|
-
_.div({ class: "
|
|
138
|
+
{ class: uiClass(["jss-menu-group", raw.class]) },
|
|
139
|
+
labelNodes.length ? _.div({ class: "jss-menu-group-label" }, ...labelNodes) : null,
|
|
140
|
+
_.div({ class: "jss-menu-group-items" }, ...contentNodes)
|
|
141
141
|
)];
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -175,14 +175,14 @@
|
|
|
175
175
|
...badgeNodes,
|
|
176
176
|
...shortcutNodes,
|
|
177
177
|
...(checked === true && !iconRightNodes.length && !badgeNodes.length
|
|
178
|
-
? [_.span({ class: "
|
|
178
|
+
? [_.span({ class: "jss-menu-entry-check" }, UI.Icon({ name: raw.checkedIcon || "check", size: "sm" }))]
|
|
179
179
|
: []),
|
|
180
180
|
...iconRightNodes
|
|
181
181
|
];
|
|
182
182
|
const entryClass = uiClass([
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
itemState ? `
|
|
183
|
+
"jss-menu-entry",
|
|
184
|
+
"jss-menu-item",
|
|
185
|
+
itemState ? `jss-state-${itemState}` : "",
|
|
186
186
|
uiWhen(active, "is-active"),
|
|
187
187
|
uiWhen(checked === true, "is-checked"),
|
|
188
188
|
uiWhen(disabled, "is-disabled"),
|
|
@@ -226,18 +226,18 @@
|
|
|
226
226
|
const bodyNodes = customBodyNodes.length
|
|
227
227
|
? customBodyNodes
|
|
228
228
|
: [
|
|
229
|
-
titleNodes.length ? _.div({ class: "
|
|
230
|
-
subtitleNodes.length ? _.div({ class: "
|
|
229
|
+
titleNodes.length ? _.div({ class: "jss-menu-entry-title" }, ...titleNodes) : null,
|
|
230
|
+
subtitleNodes.length ? _.div({ class: "jss-menu-entry-subtitle" }, ...subtitleNodes) : null
|
|
231
231
|
].filter(Boolean);
|
|
232
232
|
|
|
233
233
|
return [Tag(
|
|
234
234
|
entryProps,
|
|
235
|
-
iconNodes.length ? _.span({ class: "
|
|
235
|
+
iconNodes.length ? _.span({ class: "jss-menu-entry-icon" }, ...iconNodes) : null,
|
|
236
236
|
_.span(
|
|
237
|
-
{ class: "
|
|
237
|
+
{ class: "jss-menu-entry-main" },
|
|
238
238
|
...bodyNodes
|
|
239
239
|
),
|
|
240
|
-
asideNodes.length ? _.span({ class: "
|
|
240
|
+
asideNodes.length ? _.span({ class: "jss-menu-entry-aside" }, ...asideNodes) : null
|
|
241
241
|
)];
|
|
242
242
|
};
|
|
243
243
|
const buildContent = () => {
|
|
@@ -276,16 +276,16 @@
|
|
|
276
276
|
|
|
277
277
|
let headerEl = null;
|
|
278
278
|
if (headerNodes.length) {
|
|
279
|
-
headerEl = _.div({ class: uiClass(["
|
|
279
|
+
headerEl = _.div({ class: uiClass(["jss-menu-head", "jss-menu-head-custom", opts.headerClass]) }, ...headerNodes);
|
|
280
280
|
} else if (iconNodes.length || eyebrowNodes.length || titleNodes.length || subtitleNodes.length) {
|
|
281
281
|
headerEl = _.div(
|
|
282
|
-
{ class: uiClass(["
|
|
283
|
-
iconNodes.length ? _.div({ class: "
|
|
282
|
+
{ class: uiClass(["jss-menu-head", opts.headerClass]) },
|
|
283
|
+
iconNodes.length ? _.div({ class: "jss-menu-head-icon" }, ...iconNodes) : null,
|
|
284
284
|
_.div(
|
|
285
|
-
{ class: "
|
|
286
|
-
eyebrowNodes.length ? _.div({ class: "
|
|
287
|
-
titleNodes.length ? _.div({ class: "
|
|
288
|
-
subtitleNodes.length ? _.div({ class: "
|
|
285
|
+
{ class: "jss-menu-head-main" },
|
|
286
|
+
eyebrowNodes.length ? _.div({ class: "jss-menu-eyebrow" }, ...eyebrowNodes) : null,
|
|
287
|
+
titleNodes.length ? _.div({ class: "jss-menu-title" }, ...titleNodes) : null,
|
|
288
|
+
subtitleNodes.length ? _.div({ class: "jss-menu-subtitle" }, ...subtitleNodes) : null
|
|
289
289
|
)
|
|
290
290
|
);
|
|
291
291
|
}
|
|
@@ -293,8 +293,8 @@
|
|
|
293
293
|
return _.div(
|
|
294
294
|
{
|
|
295
295
|
class: uiClass([
|
|
296
|
-
"
|
|
297
|
-
"
|
|
296
|
+
"jss-menu",
|
|
297
|
+
"jss-menu-shell",
|
|
298
298
|
uiWhen(opts.dense, "dense"),
|
|
299
299
|
uiWhen(itemNodes.length > 0, "has-items"),
|
|
300
300
|
uiWhen(footerNodes.length > 0 || statusNodes.length > 0, "has-footer"),
|
|
@@ -304,17 +304,17 @@
|
|
|
304
304
|
role: opts.role || "menu",
|
|
305
305
|
"aria-label": opts.ariaLabel || null
|
|
306
306
|
},
|
|
307
|
-
beforeNodes.length ? _.div({ class: "
|
|
307
|
+
beforeNodes.length ? _.div({ class: "jss-menu-before" }, ...beforeNodes) : null,
|
|
308
308
|
headerEl,
|
|
309
|
-
contentNodes.length ? _.div({ class: uiClass(["
|
|
310
|
-
itemNodes.length ? _.div({ class: uiClass(["
|
|
311
|
-
(!itemNodes.length && emptyNodes.length) ? _.div({ class: "
|
|
312
|
-
afterNodes.length ? _.div({ class: "
|
|
309
|
+
contentNodes.length ? _.div({ class: uiClass(["jss-menu-content", opts.contentClass]) }, ...contentNodes) : null,
|
|
310
|
+
itemNodes.length ? _.div({ class: uiClass(["jss-menu-items", opts.itemsClass]) }, ...itemNodes) : null,
|
|
311
|
+
(!itemNodes.length && emptyNodes.length) ? _.div({ class: "jss-menu-empty" }, ...emptyNodes) : null,
|
|
312
|
+
afterNodes.length ? _.div({ class: "jss-menu-after" }, ...afterNodes) : null,
|
|
313
313
|
(statusNodes.length || footerNodes.length)
|
|
314
314
|
? _.div(
|
|
315
|
-
{ class: uiClass(["
|
|
316
|
-
statusNodes.length ? _.div({ class: "
|
|
317
|
-
footerNodes.length ? _.div({ class: "
|
|
315
|
+
{ class: uiClass(["jss-menu-footer", opts.footerClass]) },
|
|
316
|
+
statusNodes.length ? _.div({ class: "jss-menu-status" }, ...statusNodes) : null,
|
|
317
|
+
footerNodes.length ? _.div({ class: "jss-menu-footer-actions" }, ...footerNodes) : null
|
|
318
318
|
)
|
|
319
319
|
: null
|
|
320
320
|
);
|
|
@@ -325,11 +325,11 @@
|
|
|
325
325
|
const stateClass = getStateClass(opts);
|
|
326
326
|
const sizeClass = getSizeClass(opts);
|
|
327
327
|
setTrackedClasses(currentEntry.panel, "_menuClassTokens", [
|
|
328
|
-
"
|
|
329
|
-
"
|
|
330
|
-
"
|
|
331
|
-
sizeClass ? `
|
|
332
|
-
stateClass ? `
|
|
328
|
+
"jss-menu-panel",
|
|
329
|
+
"jss-clear-set",
|
|
330
|
+
"jss-singularity",
|
|
331
|
+
sizeClass ? `jss-menu-${sizeClass}` : "",
|
|
332
|
+
stateClass ? `jss-state-${stateClass}` : "",
|
|
333
333
|
uiUnwrap(opts.outline) ? "outline" : "",
|
|
334
334
|
...splitClasses(opts.panelClass)
|
|
335
335
|
]);
|
|
@@ -337,11 +337,11 @@
|
|
|
337
337
|
...splitClasses(opts.overlayClass)
|
|
338
338
|
]);
|
|
339
339
|
currentEntry.panel.dataset.placement = getPlacement(opts);
|
|
340
|
-
setStyleValue(currentEntry.panel, "--
|
|
341
|
-
setStyleValue(currentEntry.panel, "--
|
|
342
|
-
setStyleValue(currentEntry.panel, "--
|
|
343
|
-
setStyleValue(currentEntry.panel, "--
|
|
344
|
-
setStyleValue(currentEntry.panel, "--
|
|
340
|
+
setStyleValue(currentEntry.panel, "--jss-menu-width", uiUnwrap(opts.width), toCssSize);
|
|
341
|
+
setStyleValue(currentEntry.panel, "--jss-menu-min-width", uiUnwrap(opts.minWidth), toCssSize);
|
|
342
|
+
setStyleValue(currentEntry.panel, "--jss-menu-max-width", uiUnwrap(opts.maxWidth), toCssSize);
|
|
343
|
+
setStyleValue(currentEntry.panel, "--jss-menu-max-height", uiUnwrap(opts.maxHeight), toCssSize);
|
|
344
|
+
setStyleValue(currentEntry.panel, "--jss-menu-body-max-height", uiUnwrap(opts.bodyMaxHeight ?? opts.contentMaxHeight), toCssSize);
|
|
345
345
|
if (opts.panelStyle) Object.assign(currentEntry.panel.style, opts.panelStyle);
|
|
346
346
|
setPropertyProps(currentEntry.panel, opts);
|
|
347
347
|
};
|
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
closeOnOutside: opts.closeOnOutside !== false,
|
|
409
409
|
closeOnBackdrop: opts.closeOnBackdrop ?? opts.backdrop === true,
|
|
410
410
|
closeOnEsc: opts.closeOnEsc !== false,
|
|
411
|
-
className: uiClassStatic(["
|
|
411
|
+
className: uiClassStatic(["jss-menu-panel"]),
|
|
412
412
|
onClose: () => {
|
|
413
413
|
currentRef?._menuCleanup?.();
|
|
414
414
|
getOptions().onClose?.(currentRef);
|
|
@@ -436,7 +436,7 @@
|
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
438
438
|
if (getOptions().closeOnSelect === false) return;
|
|
439
|
-
const selected = target.closest("[data-menu-item], [data-menu-select], .
|
|
439
|
+
const selected = target.closest("[data-menu-item], [data-menu-select], .jss-menu-item, [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], a[href], button:not([disabled])");
|
|
440
440
|
if (!selected) return;
|
|
441
441
|
if (selected.closest("[data-menu-keep-open]")) return;
|
|
442
442
|
if (selected.getAttribute("data-menu-select") === "false") return;
|
|
@@ -725,7 +725,7 @@
|
|
|
725
725
|
const headerNodes = renderSlotToArray(slots, "header", ctx, resolveRender(opts.headerContent ?? opts.head ?? opts.header, ctx));
|
|
726
726
|
const closeSlotNodes = isClosable(opts)
|
|
727
727
|
? renderSlotToArray(slots, "close", ctx, UI.Btn({
|
|
728
|
-
class: "
|
|
728
|
+
class: "jss-dialog-close",
|
|
729
729
|
size: "sm",
|
|
730
730
|
outline: true,
|
|
731
731
|
"aria-label": opts.closeLabel || "Chiudi popover",
|
|
@@ -745,30 +745,30 @@
|
|
|
745
745
|
|
|
746
746
|
let headerEl = null;
|
|
747
747
|
if (headerNodes.length) {
|
|
748
|
-
headerEl = _.div({ class: "
|
|
748
|
+
headerEl = _.div({ class: "jss-dialog-head jss-dialog-head-custom" }, ...headerNodes);
|
|
749
749
|
} else if (eyebrowNodes.length || titleNodes.length || subtitleNodes.length || iconNodes.length || closeSlotNodes.length) {
|
|
750
750
|
headerEl = _.div(
|
|
751
|
-
{ class: "
|
|
752
|
-
iconNodes.length ? _.div({ class: "
|
|
751
|
+
{ class: "jss-dialog-head" },
|
|
752
|
+
iconNodes.length ? _.div({ class: "jss-dialog-icon" }, ...iconNodes) : null,
|
|
753
753
|
_.div(
|
|
754
|
-
{ class: "
|
|
755
|
-
eyebrowNodes.length ? _.div({ class: "
|
|
756
|
-
titleNodes.length ? _.div({ class: "
|
|
757
|
-
subtitleNodes.length ? _.div({ class: "
|
|
754
|
+
{ class: "jss-dialog-head-main" },
|
|
755
|
+
eyebrowNodes.length ? _.div({ class: "jss-dialog-eyebrow" }, ...eyebrowNodes) : null,
|
|
756
|
+
titleNodes.length ? _.div({ class: "jss-dialog-title" }, ...titleNodes) : null,
|
|
757
|
+
subtitleNodes.length ? _.div({ class: "jss-dialog-subtitle" }, ...subtitleNodes) : null
|
|
758
758
|
),
|
|
759
|
-
closeSlotNodes.length ? _.div({ class: "
|
|
759
|
+
closeSlotNodes.length ? _.div({ class: "jss-dialog-close-wrap" }, ...closeSlotNodes) : null
|
|
760
760
|
);
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
const sections = [];
|
|
764
764
|
if (headerEl) sections.push(headerEl);
|
|
765
765
|
if (contentNodes.length) {
|
|
766
|
-
sections.push(_.div({ class: uiClass(["
|
|
766
|
+
sections.push(_.div({ class: uiClass(["jss-dialog-body", opts.bodyClass]) }, ...contentNodes));
|
|
767
767
|
}
|
|
768
768
|
if (footerNodes.length) {
|
|
769
769
|
sections.push(_.div({
|
|
770
770
|
class: uiClass([
|
|
771
|
-
"
|
|
771
|
+
"jss-dialog-actions",
|
|
772
772
|
`is-${getAlignClass(opts)}`,
|
|
773
773
|
uiWhen(opts.stackActions, "is-stacked"),
|
|
774
774
|
opts.actionsClass,
|
|
@@ -777,13 +777,13 @@
|
|
|
777
777
|
}, ...footerNodes));
|
|
778
778
|
}
|
|
779
779
|
if (!sections.length) {
|
|
780
|
-
sections.push(_.div({ class: uiClass(["
|
|
780
|
+
sections.push(_.div({ class: uiClass(["jss-dialog-body", opts.bodyClass]) }));
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
return _.div({
|
|
784
784
|
class: uiClass([
|
|
785
|
-
"
|
|
786
|
-
"
|
|
785
|
+
"jss-dialog-shell",
|
|
786
|
+
"jss-popover-shell",
|
|
787
787
|
uiWhen(!!headerEl, "has-head"),
|
|
788
788
|
uiWhen(footerNodes.length > 0, "has-footer"),
|
|
789
789
|
uiWhen(opts.divider !== false, "with-divider")
|
|
@@ -796,13 +796,13 @@
|
|
|
796
796
|
const stateClass = getStateClass(opts);
|
|
797
797
|
const sizeClass = getSizeClass(opts);
|
|
798
798
|
setTrackedClasses(currentEntry.panel, "_popoverClassTokens", [
|
|
799
|
-
"
|
|
800
|
-
"
|
|
801
|
-
"
|
|
802
|
-
"
|
|
803
|
-
sizeClass ? `
|
|
799
|
+
"jss-dialog",
|
|
800
|
+
"jss-popover",
|
|
801
|
+
"jss-singularity",
|
|
802
|
+
"jss-clear-set",
|
|
803
|
+
sizeClass ? `jss-dialog-${sizeClass}` : "",
|
|
804
804
|
stateClass,
|
|
805
|
-
stateClass ? `
|
|
805
|
+
stateClass ? `jss-state-${stateClass}` : "",
|
|
806
806
|
uiUnwrap(opts.scrollable) ? "scrollable" : "",
|
|
807
807
|
uiUnwrap(opts.stickyHeader) ? "sticky-head" : "",
|
|
808
808
|
uiUnwrap(opts.stickyActions) ? "sticky-actions" : "",
|
|
@@ -814,11 +814,11 @@
|
|
|
814
814
|
...splitClasses(opts.overlayClass)
|
|
815
815
|
]);
|
|
816
816
|
currentEntry.panel.dataset.placement = getPlacement(opts);
|
|
817
|
-
setStyleValue(currentEntry.panel, "--
|
|
818
|
-
setStyleValue(currentEntry.panel, "--
|
|
819
|
-
setStyleValue(currentEntry.panel, "--
|
|
820
|
-
setStyleValue(currentEntry.panel, "--
|
|
821
|
-
setStyleValue(currentEntry.panel, "--
|
|
817
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-width", uiUnwrap(opts.width), toCssSize);
|
|
818
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-min-width", uiUnwrap(opts.minWidth), toCssSize);
|
|
819
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-max-width", uiUnwrap(opts.maxWidth), toCssSize);
|
|
820
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-max-height", uiUnwrap(opts.maxHeight), toCssSize);
|
|
821
|
+
setStyleValue(currentEntry.panel, "--jss-dialog-body-max-height", uiUnwrap(opts.bodyMaxHeight ?? opts.contentMaxHeight), toCssSize);
|
|
822
822
|
if (opts.style) Object.assign(currentEntry.panel.style, opts.style);
|
|
823
823
|
setPropertyProps(currentEntry.panel, opts);
|
|
824
824
|
currentEntry.panel.setAttribute("role", opts.role || "dialog");
|
|
@@ -876,7 +876,7 @@
|
|
|
876
876
|
closeOnOutside: opts.closeOnOutside !== false,
|
|
877
877
|
closeOnBackdrop: opts.closeOnBackdrop ?? opts.backdrop === true,
|
|
878
878
|
closeOnEsc: opts.closeOnEsc !== false,
|
|
879
|
-
className: uiClassStatic(["
|
|
879
|
+
className: uiClassStatic(["jss-dialog", "jss-popover"]),
|
|
880
880
|
onClose: () => {
|
|
881
881
|
currentRef?._popoverCleanup?.();
|
|
882
882
|
getOptions().onClose?.(currentRef);
|
|
@@ -1043,7 +1043,7 @@
|
|
|
1043
1043
|
return { x: px, y: py };
|
|
1044
1044
|
};
|
|
1045
1045
|
const createVirtualAnchor = (point) => point ? {
|
|
1046
|
-
|
|
1046
|
+
_jssContextPoint: point,
|
|
1047
1047
|
getBoundingClientRect: () => ({
|
|
1048
1048
|
top: point.y,
|
|
1049
1049
|
bottom: point.y,
|
|
@@ -1087,8 +1087,8 @@
|
|
|
1087
1087
|
closeOnEsc: opts.closeOnEsc !== false,
|
|
1088
1088
|
role: opts.role || "menu",
|
|
1089
1089
|
ariaLabel: opts.ariaLabel || opts.title || "Context menu",
|
|
1090
|
-
class: uiClass(["
|
|
1091
|
-
panelClass: uiClass(["
|
|
1090
|
+
class: uiClass(["jss-context-menu-shell", opts.class]),
|
|
1091
|
+
panelClass: uiClass(["jss-context-menu-panel", opts.panelClass])
|
|
1092
1092
|
};
|
|
1093
1093
|
};
|
|
1094
1094
|
const menu = UI.Menu(buildMenuProps(), ...children);
|
|
@@ -1128,7 +1128,7 @@
|
|
|
1128
1128
|
};
|
|
1129
1129
|
const rememberAnchor = (anchor, point = null) => {
|
|
1130
1130
|
lastAnchor = anchor || lastAnchor;
|
|
1131
|
-
lastPoint = point || (anchor && anchor.
|
|
1131
|
+
lastPoint = point || (anchor && anchor._jssContextPoint) || lastPoint;
|
|
1132
1132
|
};
|
|
1133
1133
|
const mergeProps = (nextProps = null) => {
|
|
1134
1134
|
if (isPlainObject(nextProps) && Object.keys(nextProps).length) {
|