@jsswift/ui 1.0.54 → 2.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/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/40-navigation.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const resolveAccent = (value) => {
|
|
13
13
|
const raw = uiUnwrap(value);
|
|
14
14
|
if (raw == null || raw === "") return null;
|
|
15
|
-
return JSswift.uiColors?.includes(raw) ? `var(--
|
|
15
|
+
return JSswift.uiColors?.includes(raw) ? `var(--jss-${raw})` : String(raw);
|
|
16
16
|
};
|
|
17
17
|
const isSameValue = (a, b) => Object.is(a, b) || (a != null && b != null && a == b);
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
const fillTabs = !!uiUnwrap(props.fill ?? props.navFill ?? props.stretch);
|
|
23
23
|
const wrapTabs = !!uiUnwrap(props.wrap);
|
|
24
24
|
const disabledAll = !!uiUnwrap(props.disabled);
|
|
25
|
-
const componentId = props.id || (`
|
|
25
|
+
const componentId = props.id || (`jss-tabs-` + Math.random().toString(36).slice(2, 9));
|
|
26
26
|
const rawTabs = uiUnwrap(props.tabs ?? props.items) || [];
|
|
27
27
|
const tabs = (Array.isArray(rawTabs) ? rawTabs : [rawTabs])
|
|
28
28
|
.map((tab, index) => {
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
const [getValue, setValue] = JSswift.reactive.signal(initialValue);
|
|
87
87
|
|
|
88
88
|
const cls = uiClass([
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
89
|
+
"jss-clear-set",
|
|
90
|
+
"jss-tabs",
|
|
91
|
+
"jss-singularity",
|
|
92
92
|
orientation,
|
|
93
93
|
`variant-${variant}`,
|
|
94
94
|
uiWhen(props.dense, "dense"),
|
|
@@ -117,14 +117,14 @@
|
|
|
117
117
|
wrapProps.style = {
|
|
118
118
|
...(props.style || {})
|
|
119
119
|
};
|
|
120
|
-
if (props.gap != null) wrapProps.style["--
|
|
121
|
-
if (props.tabGap != null) wrapProps.style["--
|
|
120
|
+
if (props.gap != null) wrapProps.style["--jss-tabs-gap"] = toCssSize(props.gap);
|
|
121
|
+
if (props.tabGap != null) wrapProps.style["--jss-tabs-tab-gap"] = toCssSize(props.tabGap);
|
|
122
122
|
const accentColor = resolveAccent(props.color ?? props.state);
|
|
123
|
-
if (accentColor) wrapProps.style["--
|
|
123
|
+
if (accentColor) wrapProps.style["--jss-tabs-accent"] = accentColor;
|
|
124
124
|
const wrap = _.div(wrapProps);
|
|
125
125
|
|
|
126
126
|
const bar = _.div({
|
|
127
|
-
class: uiClass(["
|
|
127
|
+
class: uiClass(["jss-tabs-bar", props.barClass]),
|
|
128
128
|
style: {
|
|
129
129
|
alignItems: props.align || (orientation === "vertical" ? "stretch" : "center"),
|
|
130
130
|
justifyContent: props.justify || "flex-start",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
const nav = _.div({
|
|
135
|
-
class: uiClass(["
|
|
135
|
+
class: uiClass(["jss-tabs-nav", props.navClass]),
|
|
136
136
|
style: props.navStyle || null,
|
|
137
137
|
role: "tablist",
|
|
138
138
|
"aria-orientation": orientation
|
|
@@ -240,13 +240,13 @@
|
|
|
240
240
|
const labelNodes = renderSlotToArray(null, "default", {}, JSswift.ui.renderSlot(slots, "label", ctx, tab.labelFallback));
|
|
241
241
|
const noteNodes = renderSlotToArray(slots, "note", ctx, tab.noteFallback);
|
|
242
242
|
const badgeNodes = renderSlotToArray(slots, "badge", ctx, tab.badgeFallback);
|
|
243
|
-
const fallbackContent = _.span({ class: "
|
|
244
|
-
iconNodes.length ? _.span({ class: "
|
|
245
|
-
_.span({ class: "
|
|
246
|
-
_.span({ class: "
|
|
247
|
-
noteNodes.length ? _.span({ class: "
|
|
243
|
+
const fallbackContent = _.span({ class: "jss-tabs-tab-inner" },
|
|
244
|
+
iconNodes.length ? _.span({ class: "jss-tabs-tab-icon" }, ...iconNodes) : null,
|
|
245
|
+
_.span({ class: "jss-tabs-tab-copy" },
|
|
246
|
+
_.span({ class: "jss-tabs-tab-label" }, ...(labelNodes.length ? labelNodes : [""])),
|
|
247
|
+
noteNodes.length ? _.span({ class: "jss-tabs-tab-note" }, ...noteNodes) : null
|
|
248
248
|
),
|
|
249
|
-
badgeNodes.length ? _.span({ class: "
|
|
249
|
+
badgeNodes.length ? _.span({ class: "jss-tabs-tab-badge" }, ...badgeNodes) : null
|
|
250
250
|
);
|
|
251
251
|
const contentNodes = renderSlotToArray(slots, "tab", {
|
|
252
252
|
...ctx,
|
|
@@ -299,14 +299,14 @@
|
|
|
299
299
|
const itemAccent = resolveAccent(tab.color ?? tab.state);
|
|
300
300
|
const item = _.div({
|
|
301
301
|
class: uiClass([
|
|
302
|
-
"
|
|
302
|
+
"jss-tabs-item",
|
|
303
303
|
uiWhen(isActive, "active"),
|
|
304
304
|
uiWhen(tab.disabled || disabledAll, "disabled"),
|
|
305
305
|
props.itemClass,
|
|
306
306
|
tab.itemClass
|
|
307
307
|
]),
|
|
308
308
|
style: {
|
|
309
|
-
...(itemAccent ? { "--
|
|
309
|
+
...(itemAccent ? { "--jss-tabs-item-accent": itemAccent } : {}),
|
|
310
310
|
...(props.itemStyle || {}),
|
|
311
311
|
...(tab.itemStyle || {})
|
|
312
312
|
},
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
});
|
|
315
315
|
const btn = UI.Btn({
|
|
316
316
|
class: uiClass([
|
|
317
|
-
"
|
|
317
|
+
"jss-tabs-tab",
|
|
318
318
|
uiWhen(isActive, "active"),
|
|
319
319
|
uiWhen(tab.disabled || disabledAll, "disabled"),
|
|
320
320
|
props.tabClass,
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
}, defaultNavNodes);
|
|
351
351
|
renderSlotToArray(null, "default", {}, navContent).forEach((node) => nav.appendChild(node));
|
|
352
352
|
} else {
|
|
353
|
-
renderSlotToArray(slots, "empty", createRootCtx(), props.empty ?? _.div({ class: "
|
|
353
|
+
renderSlotToArray(slots, "empty", createRootCtx(), props.empty ?? _.div({ class: "jss-tabs-empty" }, "Nessuna tab disponibile."))
|
|
354
354
|
.forEach((node) => nav.appendChild(node));
|
|
355
355
|
}
|
|
356
356
|
|
|
@@ -361,7 +361,7 @@
|
|
|
361
361
|
];
|
|
362
362
|
bar.appendChild(nav);
|
|
363
363
|
if (extraNodes.length) {
|
|
364
|
-
bar.appendChild(_.div({ class: "
|
|
364
|
+
bar.appendChild(_.div({ class: "jss-tabs-extra" }, ...extraNodes));
|
|
365
365
|
}
|
|
366
366
|
wrap.appendChild(bar);
|
|
367
367
|
|
|
@@ -403,7 +403,7 @@
|
|
|
403
403
|
const resolveAccent = (value) => {
|
|
404
404
|
const raw = uiUnwrap(value);
|
|
405
405
|
if (raw == null || raw === "") return null;
|
|
406
|
-
return JSswift.uiColors?.includes(raw) ? `var(--
|
|
406
|
+
return JSswift.uiColors?.includes(raw) ? `var(--jss-${raw})` : String(raw);
|
|
407
407
|
};
|
|
408
408
|
const resolvePath = (value) => {
|
|
409
409
|
if (value == null || value === "") return "";
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
const normalizedState = !uiUnwrap(props.color) && uiUnwrap(props.state)
|
|
463
463
|
? normalizeState(uiUnwrap(props.state))
|
|
464
464
|
: "";
|
|
465
|
-
const stateClass = normalizedState ? `
|
|
465
|
+
const stateClass = normalizedState ? `jss-state-${normalizedState}` : "";
|
|
466
466
|
const p = JSswift.omit(props, [
|
|
467
467
|
"active", "selected", "label", "title", "text", "to", "icon", "iconRight", "iconSize",
|
|
468
468
|
"note", "subtitle", "caption", "description", "badge", "counter", "count", "aside", "trailing",
|
|
@@ -473,9 +473,9 @@
|
|
|
473
473
|
]);
|
|
474
474
|
p.href = getHref();
|
|
475
475
|
p.class = uiClass([
|
|
476
|
-
"
|
|
477
|
-
"
|
|
478
|
-
"
|
|
476
|
+
"jss-route-tab",
|
|
477
|
+
"jss-clear-set",
|
|
478
|
+
"jss-singularity",
|
|
479
479
|
`variant-${variant}`,
|
|
480
480
|
uiWhen(props.block ?? props.fill, "block"),
|
|
481
481
|
uiWhen(props.dense, "dense"),
|
|
@@ -487,7 +487,7 @@
|
|
|
487
487
|
};
|
|
488
488
|
|
|
489
489
|
const accent = resolveAccent(props.color ?? props.state);
|
|
490
|
-
if (accent) p.style["--
|
|
490
|
+
if (accent) p.style["--jss-route-tab-accent"] = accent;
|
|
491
491
|
|
|
492
492
|
const iconSize = props.iconSize ?? props.size ?? null;
|
|
493
493
|
const resolveIconNode = (value, as) => {
|
|
@@ -544,15 +544,15 @@
|
|
|
544
544
|
);
|
|
545
545
|
const defaultNodes = renderSlotToArray(slots, "default", ctx(), props.content ?? props.body);
|
|
546
546
|
|
|
547
|
-
const content = _.span({ class: "
|
|
548
|
-
iconNodes.length ? _.span({ class: "
|
|
549
|
-
_.span({ class: "
|
|
550
|
-
_.span({ class: "
|
|
551
|
-
noteNodes.length ? _.span({ class: "
|
|
552
|
-
defaultNodes.length ? _.span({ class: "
|
|
547
|
+
const content = _.span({ class: "jss-route-tab-inner" },
|
|
548
|
+
iconNodes.length ? _.span({ class: "jss-route-tab-icon" }, ...iconNodes) : null,
|
|
549
|
+
_.span({ class: "jss-route-tab-copy" },
|
|
550
|
+
_.span({ class: "jss-route-tab-label" }, ...(labelNodes.length ? labelNodes : [getTo() || getHref() || ""])),
|
|
551
|
+
noteNodes.length ? _.span({ class: "jss-route-tab-note" }, ...noteNodes) : null,
|
|
552
|
+
defaultNodes.length ? _.span({ class: "jss-route-tab-extra" }, ...defaultNodes) : null
|
|
553
553
|
),
|
|
554
|
-
badgeNodes.length ? _.span({ class: "
|
|
555
|
-
asideNodes.length ? _.span({ class: "
|
|
554
|
+
badgeNodes.length ? _.span({ class: "jss-route-tab-badge" }, ...badgeNodes) : null,
|
|
555
|
+
asideNodes.length ? _.span({ class: "jss-route-tab-aside" }, ...asideNodes) : null
|
|
556
556
|
);
|
|
557
557
|
|
|
558
558
|
const wrap = _.a(p, content);
|
|
@@ -618,7 +618,7 @@
|
|
|
618
618
|
const model = resolveModel(props.model, "UI.Breadcrumbs:model");
|
|
619
619
|
const sizeClass = uiComputed(props.size, () => {
|
|
620
620
|
const v = uiUnwrap(props.size);
|
|
621
|
-
return (typeof v === "string" && JSswift.uiSizes?.includes(v)) ? `
|
|
621
|
+
return (typeof v === "string" && JSswift.uiSizes?.includes(v)) ? `jss-size-${v}` : "";
|
|
622
622
|
});
|
|
623
623
|
const variantClass = uiComputed(props.variant, () => {
|
|
624
624
|
const raw = String(uiUnwrap(props.variant || (props.pills ? "pills" : (props.soft ? "soft" : "line"))) || "").toLowerCase();
|
|
@@ -631,8 +631,8 @@
|
|
|
631
631
|
});
|
|
632
632
|
const wrap = _.nav({
|
|
633
633
|
class: uiClass([
|
|
634
|
-
"
|
|
635
|
-
"
|
|
634
|
+
"jss-breadcrumbs",
|
|
635
|
+
"jss-clear-set",
|
|
636
636
|
sizeClass,
|
|
637
637
|
variantClass,
|
|
638
638
|
nowrapClass,
|
|
@@ -643,9 +643,9 @@
|
|
|
643
643
|
role: "navigation",
|
|
644
644
|
"aria-label": props.ariaLabel || "Breadcrumb"
|
|
645
645
|
});
|
|
646
|
-
const beforeEl = _.div({ class: "
|
|
647
|
-
const listEl = _.ol({ class: "
|
|
648
|
-
const afterEl = _.div({ class: "
|
|
646
|
+
const beforeEl = _.div({ class: "jss-breadcrumbs-before" });
|
|
647
|
+
const listEl = _.ol({ class: "jss-breadcrumbs-list" });
|
|
648
|
+
const afterEl = _.div({ class: "jss-breadcrumbs-after" });
|
|
649
649
|
wrap.appendChild(beforeEl);
|
|
650
650
|
wrap.appendChild(listEl);
|
|
651
651
|
wrap.appendChild(afterEl);
|
|
@@ -653,7 +653,7 @@
|
|
|
653
653
|
const resolveAccent = (value) => {
|
|
654
654
|
const raw = uiUnwrap(value);
|
|
655
655
|
if (raw == null || raw === "") return null;
|
|
656
|
-
return JSswift.uiColors?.includes(raw) ? `var(--
|
|
656
|
+
return JSswift.uiColors?.includes(raw) ? `var(--jss-${raw})` : String(raw);
|
|
657
657
|
};
|
|
658
658
|
const isExternalLink = (entry) => {
|
|
659
659
|
if (!entry) return false;
|
|
@@ -778,8 +778,8 @@
|
|
|
778
778
|
const ctx = { index, entry, previous: prev, next };
|
|
779
779
|
const fallback = cloneIfNode(uiUnwrap((entry?.type === "item" ? entry.item?.separator : null) ?? props.separator ?? "/"));
|
|
780
780
|
const nodes = renderNamedSlot(slots, "separator", ctx, fallback);
|
|
781
|
-
return _.li({ class: "
|
|
782
|
-
_.span({ class: "
|
|
781
|
+
return _.li({ class: "jss-breadcrumbs-separator-item", "aria-hidden": "true" },
|
|
782
|
+
_.span({ class: "jss-breadcrumbs-separator" }, ...nodes)
|
|
783
783
|
);
|
|
784
784
|
};
|
|
785
785
|
const createCollapsedEntry = (entry, items, currentIndex) => {
|
|
@@ -792,15 +792,15 @@
|
|
|
792
792
|
from: entry.from,
|
|
793
793
|
to: entry.to
|
|
794
794
|
};
|
|
795
|
-
const fallback = _.span({ class: "
|
|
796
|
-
_.span({ class: "
|
|
797
|
-
_.span({ class: "
|
|
798
|
-
_.span({ class: "
|
|
795
|
+
const fallback = _.span({ class: "jss-breadcrumb jss-breadcrumb-collapsed" },
|
|
796
|
+
_.span({ class: "jss-breadcrumb-inner" },
|
|
797
|
+
_.span({ class: "jss-breadcrumb-copy" },
|
|
798
|
+
_.span({ class: "jss-breadcrumb-label" }, String(uiUnwrap(props.collapsedLabel) || "…"))
|
|
799
799
|
)
|
|
800
800
|
)
|
|
801
801
|
);
|
|
802
802
|
const nodes = renderNamedSlot(slots, "collapsed", ctx, fallback, "item");
|
|
803
|
-
return _.li({ class: "
|
|
803
|
+
return _.li({ class: "jss-breadcrumbs-entry is-collapsed" }, ...nodes);
|
|
804
804
|
};
|
|
805
805
|
const createItemEntry = (entry, items, currentIndex, visibleIndex) => {
|
|
806
806
|
const item = entry.item || {};
|
|
@@ -841,27 +841,27 @@
|
|
|
841
841
|
const asideNodes = renderNamedSlot(slotBag, "aside", ctx, asideFallback);
|
|
842
842
|
const defaultNodes = renderNamedSlot(slotBag, "default", ctx, defaultFallback);
|
|
843
843
|
|
|
844
|
-
const content = _.span({ class: "
|
|
845
|
-
iconNodes.length ? _.span({ class: "
|
|
846
|
-
_.span({ class: "
|
|
847
|
-
_.span({ class: "
|
|
848
|
-
noteNodes.length ? _.span({ class: "
|
|
849
|
-
defaultNodes.length ? _.span({ class: "
|
|
844
|
+
const content = _.span({ class: "jss-breadcrumb-inner" },
|
|
845
|
+
iconNodes.length ? _.span({ class: "jss-breadcrumb-icon" }, ...iconNodes) : null,
|
|
846
|
+
_.span({ class: "jss-breadcrumb-copy" },
|
|
847
|
+
_.span({ class: "jss-breadcrumb-label" }, ...(labelNodes.length ? labelNodes : [href || ""])),
|
|
848
|
+
noteNodes.length ? _.span({ class: "jss-breadcrumb-note" }, ...noteNodes) : null,
|
|
849
|
+
defaultNodes.length ? _.span({ class: "jss-breadcrumb-extra" }, ...defaultNodes) : null
|
|
850
850
|
),
|
|
851
|
-
badgeNodes.length ? _.span({ class: "
|
|
852
|
-
asideNodes.length ? _.span({ class: "
|
|
851
|
+
badgeNodes.length ? _.span({ class: "jss-breadcrumb-badge" }, ...badgeNodes) : null,
|
|
852
|
+
asideNodes.length ? _.span({ class: "jss-breadcrumb-aside" }, ...asideNodes) : null
|
|
853
853
|
);
|
|
854
854
|
|
|
855
855
|
const interactive = !disabled && (!current || !!uiUnwrap(item.linkCurrent ?? props.linkCurrent));
|
|
856
856
|
const sharedProps = {
|
|
857
857
|
class: uiClass([
|
|
858
|
-
"
|
|
859
|
-
"
|
|
860
|
-
"
|
|
858
|
+
"jss-breadcrumb",
|
|
859
|
+
"jss-clear-set",
|
|
860
|
+
"jss-singularity",
|
|
861
861
|
uiWhen(current, "is-current"),
|
|
862
862
|
uiWhen(current, "active"),
|
|
863
863
|
uiWhen(disabled, "is-disabled"),
|
|
864
|
-
state ? `
|
|
864
|
+
state ? `jss-state-${state}` : "",
|
|
865
865
|
item.class
|
|
866
866
|
]),
|
|
867
867
|
style: {
|
|
@@ -869,7 +869,7 @@
|
|
|
869
869
|
},
|
|
870
870
|
"aria-current": current ? String(uiUnwrap(item.ariaCurrent ?? props.ariaCurrent) || "page") : null
|
|
871
871
|
};
|
|
872
|
-
if (accent) sharedProps.style["--
|
|
872
|
+
if (accent) sharedProps.style["--jss-breadcrumb-accent"] = accent;
|
|
873
873
|
|
|
874
874
|
let node = null;
|
|
875
875
|
if (interactive && href) {
|
|
@@ -912,7 +912,7 @@
|
|
|
912
912
|
const rendered = renderNamedSlot(slotBag, "item", ctx, fallback);
|
|
913
913
|
return _.li({
|
|
914
914
|
class: uiClass([
|
|
915
|
-
"
|
|
915
|
+
"jss-breadcrumbs-entry",
|
|
916
916
|
uiWhen(current, "is-current"),
|
|
917
917
|
uiWhen(disabled, "is-disabled")
|
|
918
918
|
])
|
|
@@ -924,8 +924,8 @@
|
|
|
924
924
|
const visibleItems = collapseItems(items);
|
|
925
925
|
const accent = resolveAccent(props.color ?? props.state);
|
|
926
926
|
wrap.classList.toggle("is-empty", items.length === 0);
|
|
927
|
-
if (accent) wrap.style.setProperty("--
|
|
928
|
-
else wrap.style.removeProperty("--
|
|
927
|
+
if (accent) wrap.style.setProperty("--jss-breadcrumb-accent", accent);
|
|
928
|
+
else wrap.style.removeProperty("--jss-breadcrumb-accent");
|
|
929
929
|
|
|
930
930
|
const rootCtx = {
|
|
931
931
|
items,
|
|
@@ -940,7 +940,7 @@
|
|
|
940
940
|
listEl.innerHTML = "";
|
|
941
941
|
if (!items.length) {
|
|
942
942
|
const emptyNodes = renderNamedSlot(slots, "empty", rootCtx, props.empty);
|
|
943
|
-
if (emptyNodes.length) listEl.appendChild(_.li({ class: "
|
|
943
|
+
if (emptyNodes.length) listEl.appendChild(_.li({ class: "jss-breadcrumbs-entry is-empty" }, ...emptyNodes));
|
|
944
944
|
return;
|
|
945
945
|
}
|
|
946
946
|
|
|
@@ -982,12 +982,12 @@
|
|
|
982
982
|
const model = resolveModel(props.model, "UI.Pagination:model");
|
|
983
983
|
const sizeClass = uiComputed(props.size, () => {
|
|
984
984
|
const v = uiUnwrap(props.size);
|
|
985
|
-
return (typeof v === "string" && sizeMap[v]) ? `
|
|
985
|
+
return (typeof v === "string" && sizeMap[v]) ? `jss-size-${v}` : "";
|
|
986
986
|
});
|
|
987
987
|
const wrap = _.nav({
|
|
988
988
|
class: uiClass([
|
|
989
|
-
"
|
|
990
|
-
"
|
|
989
|
+
"jss-pagination",
|
|
990
|
+
"jss-clear-set",
|
|
991
991
|
sizeClass,
|
|
992
992
|
uiWhen(props.dense, "dense"),
|
|
993
993
|
uiWhen(props.simple, "is-simple"),
|
|
@@ -998,11 +998,11 @@
|
|
|
998
998
|
role: "navigation",
|
|
999
999
|
"aria-label": props.ariaLabel || "Pagination"
|
|
1000
1000
|
});
|
|
1001
|
-
const controls = _.div({ class: "
|
|
1002
|
-
const startGroup = _.div({ class: "
|
|
1003
|
-
const pagesGroup = _.div({ class: "
|
|
1004
|
-
const endGroup = _.div({ class: "
|
|
1005
|
-
const summary = _.div({ class: "
|
|
1001
|
+
const controls = _.div({ class: "jss-pagination-controls" });
|
|
1002
|
+
const startGroup = _.div({ class: "jss-pagination-start" });
|
|
1003
|
+
const pagesGroup = _.div({ class: "jss-pagination-pages" });
|
|
1004
|
+
const endGroup = _.div({ class: "jss-pagination-end" });
|
|
1005
|
+
const summary = _.div({ class: "jss-pagination-summary" });
|
|
1006
1006
|
|
|
1007
1007
|
controls.appendChild(startGroup);
|
|
1008
1008
|
controls.appendChild(pagesGroup);
|
|
@@ -1133,8 +1133,8 @@
|
|
|
1133
1133
|
const ctx = { ...getCtx(), kind: name, active: !!options.active };
|
|
1134
1134
|
return UI.Btn({
|
|
1135
1135
|
class: uiClass([
|
|
1136
|
-
"
|
|
1137
|
-
`
|
|
1136
|
+
"jss-pagination-btn",
|
|
1137
|
+
`jss-pagination-${name}`,
|
|
1138
1138
|
uiWhen(options.active, "active"),
|
|
1139
1139
|
options.class
|
|
1140
1140
|
]),
|
|
@@ -1164,7 +1164,7 @@
|
|
|
1164
1164
|
|
|
1165
1165
|
const startNodes = renderNamedSlot("start", props.start, ctx);
|
|
1166
1166
|
if (startNodes.length) {
|
|
1167
|
-
startGroup.appendChild(_.div({ class: "
|
|
1167
|
+
startGroup.appendChild(_.div({ class: "jss-pagination-extra jss-pagination-extra-start" }, ...startNodes));
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
1170
|
if (showFirst()) {
|
|
@@ -1183,15 +1183,15 @@
|
|
|
1183
1183
|
if (item.type === "ellipsis") {
|
|
1184
1184
|
const ellipsisCtx = { ...ctx, kind: "ellipsis" };
|
|
1185
1185
|
const ellipsisNodes = renderNamedSlot("ellipsis", "…", ellipsisCtx);
|
|
1186
|
-
pagesGroup.appendChild(_.span({ class: "
|
|
1186
|
+
pagesGroup.appendChild(_.span({ class: "jss-pagination-ellipsis", "aria-hidden": "true" }, ...ellipsisNodes));
|
|
1187
1187
|
return;
|
|
1188
1188
|
}
|
|
1189
1189
|
const itemPage = item.page;
|
|
1190
1190
|
const itemCtx = { ...ctx, page: itemPage, value: itemPage, item, active: itemPage === currentPage };
|
|
1191
1191
|
pagesGroup.appendChild(UI.Btn({
|
|
1192
1192
|
class: uiClass([
|
|
1193
|
-
"
|
|
1194
|
-
"
|
|
1193
|
+
"jss-pagination-btn",
|
|
1194
|
+
"jss-pagination-page-btn",
|
|
1195
1195
|
uiWhen(itemPage === currentPage, "active")
|
|
1196
1196
|
]),
|
|
1197
1197
|
size: props.itemSize || props.size || (props.dense ? "sm" : "md"),
|
|
@@ -1217,7 +1217,7 @@
|
|
|
1217
1217
|
|
|
1218
1218
|
const endNodes = renderNamedSlot("end", props.end, ctx);
|
|
1219
1219
|
if (endNodes.length) {
|
|
1220
|
-
endGroup.appendChild(_.div({ class: "
|
|
1220
|
+
endGroup.appendChild(_.div({ class: "jss-pagination-extra jss-pagination-extra-end" }, ...endNodes));
|
|
1221
1221
|
}
|
|
1222
1222
|
|
|
1223
1223
|
let summaryText = `Pagina ${currentPage} di ${currentPages}`;
|
package/src/41-tab-panel.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
? props.tabs
|
|
6
6
|
: (Array.isArray(props.items) ? props.items : []);
|
|
7
7
|
const model = resolveModel(props.model, "UI.TabPanel:model");
|
|
8
|
-
const componentId = props.id || (`
|
|
8
|
+
const componentId = props.id || (`jss-tabpanel-` + Math.random().toString(36).slice(2, 9));
|
|
9
9
|
const normalizeOrientation = (value) => String(uiUnwrap(value) || "vertical").toLowerCase() === "horizontal" ? "horizontal" : "vertical";
|
|
10
10
|
const normalizePosition = (value) => String(uiUnwrap(value) || "before").toLowerCase() === "after" ? "after" : "before";
|
|
11
11
|
const normalizeVariant = (value) => {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
const resolveAccent = (value) => {
|
|
18
18
|
const raw = uiUnwrap(value);
|
|
19
19
|
if (raw == null || raw === "") return null;
|
|
20
|
-
return JSswift.uiColors.includes(raw) ? `var(--
|
|
20
|
+
return JSswift.uiColors.includes(raw) ? `var(--jss-${raw})` : String(raw);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const orientation = normalizeOrientation(props.orientation || props.orient || props.direction);
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
}).filter(Boolean).filter((tab) => tab.hidden !== true && tab.visible !== false);
|
|
82
82
|
|
|
83
83
|
const cls = uiClass([
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
84
|
+
"jss-clear-set",
|
|
85
|
+
"jss-tabpanel",
|
|
86
|
+
"jss-singularity",
|
|
87
87
|
orientation,
|
|
88
88
|
`variant-${variant}`,
|
|
89
89
|
uiWhen(wrapTabs, "wrap"),
|
|
@@ -115,19 +115,19 @@
|
|
|
115
115
|
const wrap = _.div(wrapProps);
|
|
116
116
|
|
|
117
117
|
if (animated) {
|
|
118
|
-
wrap.style.setProperty("--
|
|
119
|
-
wrap.style.setProperty("--
|
|
118
|
+
wrap.style.setProperty("--jss-tabpanel-duration", `${transitionDuration}ms`);
|
|
119
|
+
wrap.style.setProperty("--jss-tabpanel-easing", transitionEasing);
|
|
120
120
|
}
|
|
121
121
|
if (accentColor) {
|
|
122
|
-
wrap.style.setProperty("--
|
|
122
|
+
wrap.style.setProperty("--jss-tabpanel-accent", accentColor);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const nav = _.div({
|
|
126
|
-
class: uiClass(["
|
|
126
|
+
class: uiClass(["jss-tabpanel-nav", props.navClass]),
|
|
127
127
|
role: "tablist",
|
|
128
128
|
"aria-orientation": orientation
|
|
129
129
|
});
|
|
130
|
-
const panelsWrap = _.div({ class: uiClass(["
|
|
130
|
+
const panelsWrap = _.div({ class: uiClass(["jss-tabpanel-panels", props.panelsClass]) });
|
|
131
131
|
|
|
132
132
|
const tabButtons = [];
|
|
133
133
|
const panelNodes = [];
|
|
@@ -188,13 +188,13 @@
|
|
|
188
188
|
const iconNodes = renderSlotToArray(slots, "icon", ctx, iconFallback);
|
|
189
189
|
const noteNodes = renderSlotToArray(slots, "note", ctx, tab.noteFallback);
|
|
190
190
|
const badgeNodes = renderSlotToArray(slots, "badge", ctx, tab.badgeFallback);
|
|
191
|
-
const fallbackTabContent = _.span({ class: "
|
|
192
|
-
iconNodes.length ? _.span({ class: "
|
|
193
|
-
_.span({ class: "
|
|
194
|
-
_.span({ class: "
|
|
195
|
-
noteNodes.length ? _.span({ class: "
|
|
191
|
+
const fallbackTabContent = _.span({ class: "jss-tabpanel-tab-inner" },
|
|
192
|
+
iconNodes.length ? _.span({ class: "jss-tabpanel-tab-icon" }, ...iconNodes) : null,
|
|
193
|
+
_.span({ class: "jss-tabpanel-tab-copy" },
|
|
194
|
+
_.span({ class: "jss-tabpanel-tab-label" }, ...(labelNodes.length ? labelNodes : [""])),
|
|
195
|
+
noteNodes.length ? _.span({ class: "jss-tabpanel-tab-note" }, ...noteNodes) : null
|
|
196
196
|
),
|
|
197
|
-
badgeNodes.length ? _.span({ class: "
|
|
197
|
+
badgeNodes.length ? _.span({ class: "jss-tabpanel-tab-badge" }, ...badgeNodes) : null
|
|
198
198
|
);
|
|
199
199
|
const contentNodes = renderSlotToArray(slots, "tab", {
|
|
200
200
|
...ctx,
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
};
|
|
259
259
|
const defaultBtn = UI.Btn({
|
|
260
260
|
class: uiClass([
|
|
261
|
-
"
|
|
261
|
+
"jss-tabpanel-tab",
|
|
262
262
|
uiWhen(isActive, "active"),
|
|
263
263
|
uiWhen(tab.disabled || disabledAll, "disabled"),
|
|
264
264
|
props.tabClass,
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
}, ...contentNodes);
|
|
287
287
|
const navBtn = _.div({
|
|
288
288
|
class: uiClass([
|
|
289
|
-
"
|
|
289
|
+
"jss-tabpanel-nav-btn",
|
|
290
290
|
uiWhen(isActive, "active"),
|
|
291
291
|
tab.navClass
|
|
292
292
|
]),
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
const panelNode = JSswift.ui.renderSlot(slots, "panel", ctx, tab.panelFallback);
|
|
305
305
|
const panel = _.div({
|
|
306
306
|
class: uiClass([
|
|
307
|
-
"
|
|
307
|
+
"jss-tabpanel-panel",
|
|
308
308
|
uiWhen(isActive, "active"),
|
|
309
309
|
props.panelClass,
|
|
310
310
|
tab.panelClass
|
|
@@ -346,7 +346,7 @@
|
|
|
346
346
|
if (tabs.length) {
|
|
347
347
|
tabs.forEach((tab, index) => panelsWrap.appendChild(makePanelNode(tab, index)));
|
|
348
348
|
} else {
|
|
349
|
-
const emptyNodes = renderSlotToArray(slots, "empty", { tabs }, props.empty ?? _.div({ class: "
|
|
349
|
+
const emptyNodes = renderSlotToArray(slots, "empty", { tabs }, props.empty ?? _.div({ class: "jss-tabpanel-empty" }, "Nessun contenuto disponibile."));
|
|
350
350
|
emptyNodes.forEach((node) => panelsWrap.appendChild(node));
|
|
351
351
|
}
|
|
352
352
|
|
|
@@ -354,8 +354,8 @@
|
|
|
354
354
|
if (!animated) return;
|
|
355
355
|
const enter = dir === "next" ? "18px" : "-18px";
|
|
356
356
|
const leave = dir === "next" ? "-18px" : "18px";
|
|
357
|
-
wrap.style.setProperty("--
|
|
358
|
-
wrap.style.setProperty("--
|
|
357
|
+
wrap.style.setProperty("--jss-tabpanel-enter", enter);
|
|
358
|
+
wrap.style.setProperty("--jss-tabpanel-leave", leave);
|
|
359
359
|
};
|
|
360
360
|
|
|
361
361
|
const cleanCustomTransitions = () => {
|
|
@@ -545,7 +545,7 @@
|
|
|
545
545
|
ensureModalRoot();
|
|
546
546
|
|
|
547
547
|
const backdrop = _.div({
|
|
548
|
-
class: "
|
|
548
|
+
class: "jss-dialog-backdrop", onClick: (e) => {
|
|
549
549
|
if (e.target === backdrop && persistent !== true) onCancel?.();
|
|
550
550
|
}
|
|
551
551
|
});
|
|
@@ -554,11 +554,11 @@
|
|
|
554
554
|
const messageNodes = renderSlotToArray(null, "default", {}, message);
|
|
555
555
|
const contentNodes = renderSlotToArray(null, "default", {}, contentNode);
|
|
556
556
|
|
|
557
|
-
const dialog = _.div({ class: "
|
|
557
|
+
const dialog = _.div({ class: "jss-dialog jss-panel" },
|
|
558
558
|
titleNodes.length ? _.h3(...titleNodes) : null,
|
|
559
559
|
messageNodes.length ? _.p(...messageNodes) : null,
|
|
560
560
|
...contentNodes,
|
|
561
|
-
_.div({ class: "
|
|
561
|
+
_.div({ class: "jss-dialog-actions" },
|
|
562
562
|
showCancel ? JSswift.ui.Btn({ onClick: onCancel }, cancelText || "Annulla") : null,
|
|
563
563
|
JSswift.ui.Btn({ color: "primary", onClick: onOk }, okText || "OK")
|
|
564
564
|
)
|
|
@@ -608,7 +608,7 @@
|
|
|
608
608
|
app.dialog.prompt = function (opts = {}) {
|
|
609
609
|
return new Promise((resolve) => {
|
|
610
610
|
const input = JSswift.ui.Input({
|
|
611
|
-
class: "
|
|
611
|
+
class: "jss-dialog-input",
|
|
612
612
|
type: opts.type || "text",
|
|
613
613
|
placeholder: opts.placeholder || ""
|
|
614
614
|
});
|
|
@@ -648,7 +648,7 @@
|
|
|
648
648
|
if (overlay) return overlay;
|
|
649
649
|
|
|
650
650
|
overlay = document.createElement("div");
|
|
651
|
-
overlay.className = "
|
|
651
|
+
overlay.className = "jss-loading-backdrop";
|
|
652
652
|
overlay.style.cssText = `
|
|
653
653
|
position: fixed; inset: 0;
|
|
654
654
|
background: rgba(0,0,0,0.45);
|
|
@@ -658,31 +658,31 @@ z-index: 10001;
|
|
|
658
658
|
padding: 14px;
|
|
659
659
|
`;
|
|
660
660
|
const box = document.createElement("div");
|
|
661
|
-
box.className = "
|
|
661
|
+
box.className = "jss-panel jss-loading-card";
|
|
662
662
|
box.style.cssText = `
|
|
663
663
|
padding: 14px 16px;
|
|
664
|
-
border-radius: var(--
|
|
664
|
+
border-radius: var(--jss-r-lg);
|
|
665
665
|
min-width: 260px;
|
|
666
666
|
display:flex; gap: 12px; align-items:center;
|
|
667
667
|
flex-direction: column;
|
|
668
668
|
`;
|
|
669
669
|
|
|
670
670
|
const spinner = document.createElement("div");
|
|
671
|
-
spinner.className = "
|
|
671
|
+
spinner.className = "jss-loading-spinner";
|
|
672
672
|
spinner.style.cssText = `
|
|
673
673
|
width: 18px; height: 18px;
|
|
674
674
|
border-radius: 50%;
|
|
675
675
|
border: 2px solid rgba(255,255,255,0.25);
|
|
676
|
-
border-top-color: var(--
|
|
677
|
-
animation:
|
|
676
|
+
border-top-color: var(--jss-primary);
|
|
677
|
+
animation: jssSpin 0.9s linear infinite;
|
|
678
678
|
`;
|
|
679
679
|
|
|
680
680
|
const text = document.createElement("div");
|
|
681
|
-
text.className = "
|
|
681
|
+
text.className = "jss-muted jss-loading-text";
|
|
682
682
|
text.textContent = "Loading...";
|
|
683
683
|
|
|
684
684
|
const progressWrap = document.createElement("div");
|
|
685
|
-
progressWrap.className = "
|
|
685
|
+
progressWrap.className = "jss-loading-progress";
|
|
686
686
|
progressWrap.style.cssText = `
|
|
687
687
|
width: 100%;
|
|
688
688
|
height: 6px;
|
|
@@ -692,11 +692,11 @@ background: rgba(255,255,255,0.08);
|
|
|
692
692
|
display: none;
|
|
693
693
|
`;
|
|
694
694
|
const progressBar = document.createElement("div");
|
|
695
|
-
progressBar.className = "
|
|
695
|
+
progressBar.className = "jss-loading-progress-bar";
|
|
696
696
|
progressBar.style.cssText = `
|
|
697
697
|
height: 100%;
|
|
698
698
|
width: 0%;
|
|
699
|
-
background: var(--
|
|
699
|
+
background: var(--jss-primary);
|
|
700
700
|
transition: width 200ms ease;
|
|
701
701
|
`;
|
|
702
702
|
progressWrap.appendChild(progressBar);
|
|
@@ -713,7 +713,7 @@ transition: width 200ms ease;
|
|
|
713
713
|
|
|
714
714
|
const style = document.createElement("style");
|
|
715
715
|
style.textContent = `
|
|
716
|
-
@keyframes
|
|
716
|
+
@keyframes jssSpin { to { transform: rotate(360deg); } }
|
|
717
717
|
`;
|
|
718
718
|
document.head.appendChild(style);
|
|
719
719
|
|