@efolusi/meridian 1.21.0 → 1.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/code/Diff.d.ts +2 -9
- package/code/Diff.js +2 -28
- package/components.css +47 -18
- package/data/DonutChart.js +1 -0
- package/feedback/Dialog.js +1 -1
- package/feedback/Toast.d.ts +27 -0
- package/feedback/{Sonner.js → Toast.js} +59 -45
- package/finance/PaymentCard.d.ts +1 -1
- package/finance/PaymentCard.js +1 -1
- package/forms/Button.js +1 -1
- package/forms/Input.js +19 -2
- package/forms/Questionnaire.d.ts +20 -0
- package/forms/Questionnaire.js +375 -0
- package/icons/Icon.js +1 -0
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/navigation/SideNav.d.ts +1 -1
- package/navigation/SideNav.js +3 -2
- package/package.json +1 -1
- package/tailwind.preset.cjs +1 -2
- package/tokens/colors.css +1 -1
- package/tokens/effects.css +0 -1
- package/tokens.json +0 -4
- package/feedback/Sonner.d.ts +0 -8
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -20,4 +20,4 @@ The three brand marks (`linkedin.svg`, `x-brand.svg`, `github-brand.svg`) are no
|
|
|
20
20
|
|
|
21
21
|
## Brand assets
|
|
22
22
|
|
|
23
|
-
The
|
|
23
|
+
The Meridian mark (`assets/meridian-mark.svg`) and the names "Meridian" and "Efolusi" are **not** covered by the MIT license. See the brand usage note in [README.md](README.md).
|
package/code/Diff.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
export interface DiffLine {
|
|
2
|
-
/** @default 'ctx' */
|
|
3
|
-
type?: 'add' | 'del' | 'ctx';
|
|
4
|
-
text: string;
|
|
5
|
-
}
|
|
6
1
|
export interface DiffProps {
|
|
7
2
|
/** Header: file path etc. Shows +/− counts */
|
|
8
3
|
title?: React.ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
lines?: DiffLine[];
|
|
11
|
-
/** Original text; diffed against `to` when `lines` is omitted */
|
|
4
|
+
/** Original text; diffed against `to` */
|
|
12
5
|
from?: string;
|
|
13
6
|
/** Changed text */
|
|
14
7
|
to?: string;
|
|
15
8
|
/** Multi-file diff; each file is diffed and collapsible */
|
|
16
|
-
files?: Array<{ name: string; from?: string; to?: string;
|
|
9
|
+
files?: Array<{ name: string; from?: string; to?: string; defaultOpen?: boolean }>;
|
|
17
10
|
/** Highlight changed words inside a changed line @default true */
|
|
18
11
|
wordLevel?: boolean;
|
|
19
12
|
/** Unchanged lines kept around each hunk @default 3 */
|
package/code/Diff.js
CHANGED
|
@@ -230,7 +230,7 @@ function DiffFile({
|
|
|
230
230
|
contextLines
|
|
231
231
|
}) {
|
|
232
232
|
const [open, setOpen] = React.useState(file.defaultOpen !== false);
|
|
233
|
-
const r = React.useMemo(() =>
|
|
233
|
+
const r = React.useMemo(() => computeDiff(file.from || '', file.to || '', {
|
|
234
234
|
wordLevel,
|
|
235
235
|
contextLines
|
|
236
236
|
}), [file, wordLevel, contextLines]);
|
|
@@ -262,33 +262,8 @@ function DiffFile({
|
|
|
262
262
|
rows: r.rows
|
|
263
263
|
})) : null);
|
|
264
264
|
}
|
|
265
|
-
function legacy(lines) {
|
|
266
|
-
let oldNo = 0,
|
|
267
|
-
newNo = 0,
|
|
268
|
-
adds = 0,
|
|
269
|
-
dels = 0;
|
|
270
|
-
const rows = lines.map(l => {
|
|
271
|
-
const t = l.type || 'ctx';
|
|
272
|
-
if (t !== 'add') oldNo++;
|
|
273
|
-
if (t !== 'del') newNo++;
|
|
274
|
-
if (t === 'add') adds++;
|
|
275
|
-
if (t === 'del') dels++;
|
|
276
|
-
return {
|
|
277
|
-
type: t,
|
|
278
|
-
text: l.text,
|
|
279
|
-
oldNo,
|
|
280
|
-
newNo
|
|
281
|
-
};
|
|
282
|
-
});
|
|
283
|
-
return {
|
|
284
|
-
rows,
|
|
285
|
-
adds,
|
|
286
|
-
dels
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
265
|
export function Diff({
|
|
290
266
|
title,
|
|
291
|
-
lines,
|
|
292
267
|
from,
|
|
293
268
|
to,
|
|
294
269
|
files,
|
|
@@ -301,12 +276,11 @@ export function Diff({
|
|
|
301
276
|
}) {
|
|
302
277
|
const single = React.useMemo(() => {
|
|
303
278
|
if (files) return null;
|
|
304
|
-
if (lines) return legacy(lines);
|
|
305
279
|
return computeDiff(from || '', to || '', {
|
|
306
280
|
wordLevel,
|
|
307
281
|
contextLines: from !== undefined ? contextLines : null
|
|
308
282
|
});
|
|
309
|
-
}, [
|
|
283
|
+
}, [from, to, files, wordLevel, contextLines]);
|
|
310
284
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
311
285
|
className: `ef-diff${className ? ' ' + className : ''}`,
|
|
312
286
|
style: style
|
package/components.css
CHANGED
|
@@ -463,7 +463,7 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
463
463
|
.ef-code{background:var(--surface-code);border:1px solid var(--border-code);border-radius:var(--radius-md);overflow:hidden}
|
|
464
464
|
.ef-code__head{display:flex;align-items:center;padding:7px 8px 7px 14px;border-bottom:1px solid var(--code-divider)}
|
|
465
465
|
.ef-code__lang{font-family:var(--font-mono);font-size:11px;color:var(--code-ink-subtle)}
|
|
466
|
-
.ef-code__copy{margin-inline-start:auto;display:inline-flex;align-items:center;gap:5px;border:none;background:none;cursor:pointer;color:var(--code-ink-muted);font-family:var(--font-sans);font-size:12px;font-weight:var(--weight-semibold);padding:4px 8px;border-radius:var(--radius-sm);transition:color var(--dur-fast) var(--ease-out)}
|
|
466
|
+
.ef-code__copy{margin-inline-start:auto;display:inline-flex;min-height:24px;align-items:center;gap:5px;border:none;background:none;cursor:pointer;color:var(--code-ink-muted);font-family:var(--font-sans);font-size:12px;font-weight:var(--weight-semibold);padding:4px 8px;border-radius:var(--radius-sm);transition:color var(--dur-fast) var(--ease-out)}
|
|
467
467
|
.ef-code__copy:hover{color:var(--code-ink-bright)}
|
|
468
468
|
.ef-code__copy--done{color:var(--success-on-dark)}
|
|
469
469
|
.ef-code pre{margin:0;padding:14px 16px;overflow-x:auto;font-family:var(--font-mono);font-size:13px;line-height:1.6;color:var(--text-code)}
|
|
@@ -727,6 +727,8 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
727
727
|
.ef-avatar-group>.ef-avatar{border:2px solid var(--surface-card)}
|
|
728
728
|
.ef-avatar-group>.ef-avatar+.ef-avatar,.ef-avatar-group>.ef-avatar+.ef-avatar-count,.ef-avatar-group>.ef-avatar-count+.ef-avatar{margin-inline-start:-8px}
|
|
729
729
|
.ef-avatar-count{position:relative;display:inline-flex;width:32px;height:32px;align-items:center;justify-content:center;flex:none;border:2px solid var(--surface-card);border-radius:var(--radius-full);background:var(--sand-100);color:var(--text-secondary);font-size:11px;font-weight:var(--weight-semibold)}
|
|
730
|
+
.ef-avatar-group:has(>.ef-avatar--sm)>.ef-avatar-count{width:24px;height:24px;font-size:9px}.ef-avatar-group:has(>.ef-avatar--lg)>.ef-avatar-count{width:40px;height:40px;font-size:13px}
|
|
731
|
+
.ef-avatar-group:has(>.ef-avatar--sm)>*+*{margin-inline-start:-6px}.ef-avatar-group:has(>.ef-avatar--lg)>*+*{margin-inline-start:-10px}
|
|
730
732
|
/* components/display/Badge.jsx */
|
|
731
733
|
.ef-badge{display:inline-flex;align-items:center;justify-content:center;gap:5px;height:20px;padding:0 8px;border:1px solid transparent;border-radius:var(--radius-full);font-size:var(--text-xs);font-weight:var(--weight-medium);line-height:1;white-space:nowrap;text-decoration:none;transition:background var(--dur-fast) var(--ease-out),border-color var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out),box-shadow var(--dur-fast) var(--ease-out)}
|
|
732
734
|
.ef-badge:hover,.ef-badge:focus,.ef-badge:visited{text-decoration:none}
|
|
@@ -858,9 +860,10 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
858
860
|
.ef-tag--interactive{cursor:pointer}
|
|
859
861
|
.ef-tag--interactive:hover{background:var(--surface-sunken);border-color:var(--sand-400)}
|
|
860
862
|
.ef-tag--interactive:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
863
|
+
.ef-tag:has(.ef-tag__x){padding-block:2px;padding-inline-end:2px}
|
|
861
864
|
.ef-tag__body{display:inline-flex;align-items:center;gap:6px;border:none;background:transparent;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;border-radius:var(--radius-sm)}
|
|
862
865
|
.ef-tag__body:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
863
|
-
.ef-tag__x{display:inline-flex;align-items:center;justify-content:center;width:
|
|
866
|
+
.ef-tag__x{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin:0;border:none;border-radius:var(--radius-sm);background:transparent;color:var(--text-muted);cursor:pointer;padding:0;transition:background var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}
|
|
864
867
|
.ef-tag__x:hover{background:var(--sand-200);color:var(--text-primary)}
|
|
865
868
|
.ef-tag__x:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
866
869
|
/* components/display/Timeline.jsx */
|
|
@@ -904,9 +907,9 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
904
907
|
.ef-tree__count{margin-inline-start:auto;font-family:var(--font-mono);font-size:11px;color:var(--text-muted)}
|
|
905
908
|
/* components/feedback/Alert.jsx */
|
|
906
909
|
.ef-alert{position:relative;display:grid;grid-template-columns:0 1fr;align-items:start;gap:2px 10px;width:100%;padding:12px 14px;border:1px solid var(--border-strong);border-radius:var(--radius-md);background:var(--surface-card);color:var(--text-primary)}
|
|
907
|
-
.ef-alert:has(>
|
|
910
|
+
.ef-alert:has(>[data-slot=icon]){grid-template-columns:auto 1fr}
|
|
908
911
|
.ef-alert:has(>.ef-alert__action){padding-inline-end:96px}
|
|
909
|
-
.ef-alert>
|
|
912
|
+
.ef-alert>[data-slot=icon]{grid-column:1;grid-row:1/3;margin-top:2px;color:currentColor}
|
|
910
913
|
.ef-alert>.ef-alert__title,.ef-alert>.ef-alert__description{grid-column:2}
|
|
911
914
|
.ef-alert--success{border-color:var(--success-300);color:var(--success-600)}
|
|
912
915
|
.ef-alert--warning{border-color:var(--warning-300);color:var(--warning-600)}
|
|
@@ -917,7 +920,7 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
917
920
|
.ef-alert__action{position:absolute;inset-block-start:10px;inset-inline-end:12px}
|
|
918
921
|
/* components/feedback/AlertDialog.jsx */
|
|
919
922
|
.ef-alertdialog__overlay{position:fixed;inset:0;z-index:var(--z-overlay);display:grid;place-items:center;padding:24px;background:var(--overlay-scrim);animation:ef-alertdialog-fade var(--dur-med) var(--ease-out)}
|
|
920
|
-
.ef-alertdialog__content{width:100%;max-width:512px;padding:24px;background:var(--surface-card);color:var(--text-primary);border:1px solid var(--border-default);border-radius:var(--radius-lg);box-shadow:var(--shadow-
|
|
923
|
+
.ef-alertdialog__content{width:100%;max-width:512px;padding:24px;background:var(--surface-card);color:var(--text-primary);border:1px solid var(--border-default);border-radius:var(--radius-lg);box-shadow:var(--shadow-xl);animation:ef-alertdialog-pop var(--dur-slow) var(--ease-spring)}
|
|
921
924
|
.ef-alertdialog__content:focus{outline:none}
|
|
922
925
|
.ef-alertdialog__content--sm{max-width:384px}
|
|
923
926
|
.ef-alertdialog__header{display:flex;flex-direction:column;gap:8px;text-align:start}
|
|
@@ -940,10 +943,10 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
940
943
|
.ef-banner__icon{display:inline-flex;flex:none}
|
|
941
944
|
.ef-banner__text{flex:1;min-width:0}
|
|
942
945
|
.ef-banner__text strong{font-weight:var(--weight-semibold)}
|
|
943
|
-
.ef-banner__action{flex:none;font-weight:var(--weight-semibold);font-size:var(--text-sm);color:inherit;text-decoration:underline;text-underline-offset:3px;background:none;border:none;cursor:pointer;font-family:var(--font-sans);padding:0}
|
|
946
|
+
.ef-banner__action{flex:none;display:inline-flex;min-height:24px;align-items:center;font-weight:var(--weight-semibold);font-size:var(--text-sm);color:inherit;text-decoration:underline;text-underline-offset:3px;background:none;border:none;cursor:pointer;font-family:var(--font-sans);padding:4px 0}
|
|
944
947
|
/* components/feedback/Dialog.jsx */
|
|
945
948
|
.ef-dialog__overlay{position:fixed;inset:0;z-index:var(--z-overlay);display:flex;align-items:center;justify-content:center;padding:24px;background:var(--overlay-scrim);animation:ef-fade var(--dur-med) var(--ease-out)}
|
|
946
|
-
.ef-dialog__content{width:100%;max-width:440px;max-height:min(85vh,720px);overflow:auto;border:1px solid var(--border-default);border-radius:var(--radius-lg);background:var(--surface-card);box-shadow:var(--shadow-
|
|
949
|
+
.ef-dialog__content{width:100%;max-width:440px;max-height:min(85vh,720px);overflow:auto;border:1px solid var(--border-default);border-radius:var(--radius-lg);background:var(--surface-card);box-shadow:var(--shadow-xl);animation:ef-pop var(--dur-slow) var(--ease-spring)}
|
|
947
950
|
.ef-dialog__content:focus{outline:none}.ef-dialog__close{position:absolute;inset-block-start:14px;inset-inline-end:14px}
|
|
948
951
|
.ef-dialog__header{display:flex;flex-direction:column;gap:6px;padding:24px 24px 0;padding-inline-end:56px}
|
|
949
952
|
.ef-dialog__title{margin:0;font-family:var(--font-display);font-size:var(--text-xl);font-weight:var(--weight-bold);line-height:var(--leading-tight);letter-spacing:var(--tracking-tight);color:var(--text-primary)}
|
|
@@ -975,7 +978,10 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
975
978
|
@keyframes ef-progress-indeterminate{0%{transform:translateX(-110%)}50%{transform:translateX(125%)}100%{transform:translateX(240%)}}
|
|
976
979
|
[dir="rtl"] .ef-progress[data-state="indeterminate"] .ef-progress__indicator{animation-direction:reverse}
|
|
977
980
|
@media (prefers-reduced-motion:reduce){.ef-progress__indicator{transition:none}.ef-progress[data-state="indeterminate"] .ef-progress__indicator{animation:none;transform:none}}
|
|
978
|
-
/* components/feedback/
|
|
981
|
+
/* components/feedback/Spinner.jsx */
|
|
982
|
+
@keyframes ef-spinner{to{transform:rotate(360deg)}}
|
|
983
|
+
.ef-spinner{display:inline-block;flex:none;color:var(--text-muted);animation:ef-spinner .7s linear infinite}
|
|
984
|
+
/* components/feedback/Toast.jsx */
|
|
979
985
|
.ef-toast{display:flex;align-items:flex-start;gap:10px;width:360px;max-width:100%;padding:12px 14px;background:var(--surface-inverse);color:var(--text-inverse);border-radius:var(--radius-md);box-shadow:var(--shadow-lg);animation:ef-toast-in var(--dur-slow) var(--ease-spring)}
|
|
980
986
|
.ef-toast__icon{display:inline-flex;margin-top:1px}.ef-toast--success .ef-toast__icon{color:var(--success-on-dark)}.ef-toast--danger .ef-toast__icon{color:var(--danger-on-dark)}.ef-toast--warning .ef-toast__icon{color:var(--warning-on-dark)}.ef-toast--info .ef-toast__icon{color:var(--peach-200)}
|
|
981
987
|
.ef-toast__title{font-size:var(--text-md);font-weight:var(--weight-semibold);line-height:1.35}.ef-toast__desc{margin-top:2px;color:var(--text-inverse);font-size:var(--text-sm);line-height:1.4;opacity:.75}.ef-toast__action{margin-top:8px;padding:0;border:0;background:none;color:var(--peach-200);font-family:var(--font-sans);font-size:var(--text-sm);font-weight:var(--weight-semibold);cursor:pointer}.ef-toast__action:hover{color:var(--cream-50);text-decoration:none}.ef-toast .ef-iconbtn{color:var(--text-inverse-muted)}.ef-toast .ef-iconbtn:hover:not(:disabled){background:color-mix(in srgb,var(--text-inverse) 12%,transparent);color:var(--text-inverse)}
|
|
@@ -983,9 +989,6 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
983
989
|
[data-theme="dark"] .ef-toast--success .ef-toast__icon{color:var(--success-600)}[data-theme="dark"] .ef-toast--danger .ef-toast__icon{color:var(--danger-600)}[data-theme="dark"] .ef-toast--warning .ef-toast__icon{color:var(--warning-600)}[data-theme="dark"] .ef-toast--info .ef-toast__icon{color:var(--brand-600)}[data-theme="dark"] .ef-toast__action{color:var(--brand-700)}
|
|
984
990
|
@media(max-width:599px){.ef-toast-stack{inset-inline:16px!important;width:auto;max-width:none;transform:none!important}.ef-toast-stack[data-position^=top]{top:16px}.ef-toast-stack[data-position^=bottom]{bottom:16px}}
|
|
985
991
|
@keyframes ef-toast-in{from{opacity:0;transform:translateY(12px) scale(.96)}}
|
|
986
|
-
/* components/feedback/Spinner.jsx */
|
|
987
|
-
@keyframes ef-spinner{to{transform:rotate(360deg)}}
|
|
988
|
-
.ef-spinner{display:inline-block;flex:none;color:var(--text-muted);animation:ef-spinner .7s linear infinite}
|
|
989
992
|
/* components/feedback/Tooltip.jsx */
|
|
990
993
|
.ef-tooltip__bubble{position:fixed;background:var(--surface-inverse);color:var(--text-inverse);font-size:var(--text-xs);font-weight:var(--weight-medium);line-height:1.35;padding:5px 9px;border-radius:6px;white-space:nowrap;pointer-events:none;z-index:var(--z-tooltip);animation:ef-tooltip-in var(--dur-fast) var(--ease-out)}
|
|
991
994
|
.ef-tooltip__bubble::after{content:'';position:absolute;top:100%;left:var(--ef-tt-arrow,50%);transform:translateX(-50%);border:4px solid transparent;border-top-color:var(--surface-inverse)}
|
|
@@ -1167,8 +1170,12 @@ a.ef-sourcecard:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
1167
1170
|
.ef-input__el:hover:not(:disabled){border-color:var(--sand-400)}
|
|
1168
1171
|
.ef-input__el:focus-visible{outline:none;border-color:var(--accent);box-shadow:var(--focus-ring)}
|
|
1169
1172
|
.ef-input__el:disabled{background:var(--surface-subtle);color:var(--text-muted);cursor:not-allowed;opacity:.5}
|
|
1170
|
-
.ef-
|
|
1171
|
-
.ef-
|
|
1173
|
+
.ef-file-input{position:relative;display:flex;width:100%;height:var(--control-h-md);align-items:center;gap:10px;padding:3px 12px 3px 3px;overflow:hidden;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--surface-sunken);color:var(--text-muted);font-family:var(--font-sans);font-size:var(--text-md);transition:border-color var(--dur-fast) var(--ease-out),box-shadow var(--dur-fast) var(--ease-out)}
|
|
1174
|
+
.ef-file-input:hover{border-color:var(--sand-400)}.ef-file-input:focus-within{border-color:var(--accent);box-shadow:var(--focus-ring)}.ef-file-input:has(.ef-input__el:disabled){background:var(--surface-subtle);cursor:not-allowed;opacity:.5}
|
|
1175
|
+
.ef-file-input__button{display:inline-flex;height:28px;align-items:center;gap:6px;padding-inline:10px;border-radius:var(--radius-sm);background:var(--accent);color:var(--accent-contrast);font-size:var(--text-sm);font-weight:var(--weight-semibold);white-space:nowrap;transition:background var(--dur-fast) var(--ease-out),transform var(--dur-med) var(--ease-spring)}
|
|
1176
|
+
.ef-file-input:hover:not(:has(.ef-input__el:disabled)) .ef-file-input__button{background:var(--accent-hover)}.ef-file-input:active:not(:has(.ef-input__el:disabled)) .ef-file-input__button{background:var(--accent-active);transform:scale(.985)}
|
|
1177
|
+
.ef-file-input__name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1178
|
+
.ef-file-input>.ef-input__el[type="file"]{position:absolute;inset:0;width:100%;height:100%;padding:0;border:0;opacity:0;cursor:pointer}.ef-file-input>.ef-input__el[type="file"]:disabled{cursor:not-allowed}
|
|
1172
1179
|
.ef-input__el--sm{height:var(--control-h-sm);padding-inline:10px;font-size:var(--text-sm)}
|
|
1173
1180
|
.ef-input__el--lg{height:var(--control-h-lg);padding-inline:14px;font-size:var(--text-lg)}
|
|
1174
1181
|
.ef-input--icon .ef-input__el{padding-inline-start:36px}
|
|
@@ -1191,8 +1198,8 @@ input.ef-input-group__control{height:34px;padding:0 11px}textarea.ef-input-group
|
|
|
1191
1198
|
.ef-input-group__addon{display:flex;flex:none;align-items:center;gap:6px;padding:0 10px;color:var(--text-muted);font-size:var(--text-sm);white-space:nowrap}
|
|
1192
1199
|
.ef-input-group__addon[data-align="inline-start"]{order:-1;border-inline-end:1px solid var(--border-default)}.ef-input-group__addon[data-align="inline-end"]{order:2;border-inline-start:1px solid var(--border-default)}
|
|
1193
1200
|
.ef-input-group__addon[data-align="block-start"],.ef-input-group__addon[data-align="block-end"]{width:100%;min-height:34px}.ef-input-group__addon[data-align="block-start"]{order:-1;border-block-end:1px solid var(--border-default)}.ef-input-group__addon[data-align="block-end"]{order:3;border-block-start:1px solid var(--border-default)}
|
|
1194
|
-
.ef-input-group__button{display:inline-flex;height:26px;align-items:center;justify-content:center;gap:5px;padding:0 8px;border:0;border-radius:var(--radius-
|
|
1195
|
-
.ef-input-group__button[data-size^="icon"]{width:26px;padding:0}.ef-input-group__text{font-size:var(--text-sm);color:var(--text-muted)}
|
|
1201
|
+
.ef-input-group__button{display:inline-flex;height:26px;align-items:center;justify-content:center;gap:5px;padding:0 8px;border:0;border-radius:var(--radius-sm);background:transparent;color:var(--text-secondary);font:inherit;font-size:var(--text-xs);cursor:pointer}.ef-input-group__button:hover{background:var(--surface-sunken);color:var(--text-primary)}.ef-input-group__button:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
1202
|
+
.ef-input-group__button[data-size^="icon"]{width:26px;padding:0}.ef-input-group__text{display:inline-flex;align-items:center;line-height:1;font-size:var(--text-sm);color:var(--text-muted)}.ef-input-group__text svg{width:16px;height:16px;stroke-width:2}
|
|
1196
1203
|
/* components/forms/InputOTP.jsx */
|
|
1197
1204
|
.ef-otp{position:relative;display:inline-flex;align-items:center;cursor:text}
|
|
1198
1205
|
.ef-otp__input{position:absolute;inset:0;width:100%;height:100%;opacity:0;color:transparent;background:transparent;border:0;caret-color:transparent;cursor:text}
|
|
@@ -1247,6 +1254,28 @@ input.ef-input-group__control{height:34px;padding:0 11px}textarea.ef-input-group
|
|
|
1247
1254
|
.ef-number__step+.ef-number__step{border-top:1px solid var(--border-default)}
|
|
1248
1255
|
.ef-number--sm .ef-number__step{width:22px}
|
|
1249
1256
|
.ef-number--lg .ef-number__step{width:28px}
|
|
1257
|
+
/* components/forms/Questionnaire.jsx */
|
|
1258
|
+
.ef-questionnaire{display:grid;gap:var(--space-5)}
|
|
1259
|
+
.ef-questionnaire__progress{font-family:var(--font-mono);font-size:var(--text-sm);color:var(--text-muted)}
|
|
1260
|
+
.ef-questionnaire__item{min-width:0;margin:0;padding:0;border:0;display:grid;gap:var(--space-3)}
|
|
1261
|
+
.ef-questionnaire__title{padding:0;font-size:var(--text-xl);font-weight:var(--weight-semibold);color:var(--text-primary)}
|
|
1262
|
+
.ef-questionnaire__description{margin:calc(var(--space-2) * -1) 0 0;color:var(--text-secondary);font-size:var(--text-md)}
|
|
1263
|
+
.ef-questionnaire__choices{display:grid;gap:var(--space-2)}
|
|
1264
|
+
.ef-questionnaire__choice{position:relative;display:flex;align-items:flex-start;gap:var(--space-3);padding:var(--space-3);border:1px solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-card);color:var(--text-primary);cursor:pointer;transition:border-color var(--dur-fast) var(--ease-out),background var(--dur-fast) var(--ease-out)}
|
|
1265
|
+
.ef-questionnaire__choice:hover{border-color:var(--border-strong);background:var(--surface-sunken)}
|
|
1266
|
+
.ef-questionnaire__choice:has(input:checked){border-color:var(--accent);background:var(--accent-subtle)}
|
|
1267
|
+
.ef-questionnaire__choice:has(input:focus-visible){box-shadow:var(--focus-ring)}
|
|
1268
|
+
.ef-questionnaire__choice:has(input:disabled){opacity:.45;cursor:not-allowed}
|
|
1269
|
+
.ef-questionnaire__choice input{width:16px;height:16px;margin:2px 0 0;accent-color:var(--accent);flex:none}
|
|
1270
|
+
.ef-questionnaire__choice-label{display:grid;gap:2px;flex:1;min-width:0}
|
|
1271
|
+
.ef-questionnaire__shortcut{font-family:var(--font-mono);font-size:var(--text-xs);color:var(--text-muted)}
|
|
1272
|
+
.ef-questionnaire__input{width:100%;min-height:var(--control-h-md);padding:0 var(--space-3);border:1px solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-card);color:var(--text-primary);font:inherit;outline:none}
|
|
1273
|
+
.ef-questionnaire__input:focus-visible{border-color:var(--accent);box-shadow:var(--focus-ring)}
|
|
1274
|
+
.ef-questionnaire__error{font-size:var(--text-sm);color:var(--danger-600)}
|
|
1275
|
+
.ef-questionnaire__actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--space-2)}
|
|
1276
|
+
.ef-questionnaire__button{min-height:var(--control-h-md);padding:0 var(--space-4);border:1px solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-card);color:var(--text-primary);font:inherit;font-weight:var(--weight-medium);cursor:pointer}
|
|
1277
|
+
.ef-questionnaire__button[data-primary]{border-color:var(--brand-950);background:var(--brand-950);color:var(--text-inverse)}
|
|
1278
|
+
.ef-questionnaire__button:disabled{opacity:.45;cursor:not-allowed}
|
|
1250
1279
|
/* components/forms/Radio.jsx */
|
|
1251
1280
|
.ef-radio-group{display:grid;gap:var(--space-3)}
|
|
1252
1281
|
.ef-radio-group[data-orientation="horizontal"]{display:flex;align-items:center;flex-wrap:wrap}
|
|
@@ -1391,7 +1420,7 @@ input.ef-input-group__control{height:34px;padding:0 11px}textarea.ef-input-group
|
|
|
1391
1420
|
.ef-seg__opt:disabled{opacity:.4;cursor:not-allowed}
|
|
1392
1421
|
/* components/navigation/SideNav.jsx */
|
|
1393
1422
|
.ef-sidenav{display:flex;flex-direction:column;width:240px;flex:none;background:var(--surface-subtle);border-inline-end:1px solid var(--border-default);align-self:stretch}
|
|
1394
|
-
.ef-sidenav__brand{display:flex;align-items:center;gap:
|
|
1423
|
+
.ef-sidenav__brand{display:flex;align-items:center;gap:6px;padding:16px 16px 14px}
|
|
1395
1424
|
.ef-sidenav__group{font-size:11px;font-weight:600;letter-spacing:0.06em;text-transform:uppercase;color:var(--text-muted);padding:14px 22px 6px}
|
|
1396
1425
|
.ef-sidenav__item{display:flex;align-items:center;gap:10px;width:calc(100% - 24px);margin:0 12px;height:34px;padding:0 10px;border:none;border-radius:var(--radius-sm);cursor:pointer;text-align:start;background:transparent;color:var(--text-secondary);font-family:var(--font-sans);font-size:var(--text-md);font-weight:500;transition:background var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}
|
|
1397
1426
|
.ef-sidenav__item:hover{background:var(--surface-sunken);color:var(--text-primary)}
|
|
@@ -1495,7 +1524,7 @@ input.ef-input-group__control{height:34px;padding:0 11px}textarea.ef-input-group
|
|
|
1495
1524
|
.ef-context-menu__chevron{display:inline-flex;margin-inline-start:auto;color:var(--text-muted)}
|
|
1496
1525
|
/* components/overlay/Drawer.jsx */
|
|
1497
1526
|
.ef-drawer__overlay{padding:0}
|
|
1498
|
-
.ef-drawer{position:fixed;z-index:var(--z-modal);display:flex;max-width:none;max-height:none;flex-direction:column;overflow:auto;border-radius:0;background:var(--surface-card);box-shadow:var(--shadow-
|
|
1527
|
+
.ef-drawer{position:fixed;z-index:var(--z-modal);display:flex;max-width:none;max-height:none;flex-direction:column;overflow:auto;border-radius:0;background:var(--surface-card);box-shadow:var(--shadow-xl);touch-action:none;will-change:transform}
|
|
1499
1528
|
.ef-drawer[data-vaul-drawer-direction=right]{top:0;right:0;bottom:0;width:min(75vw,384px);border-width:0 0 0 1px;animation:ef-drawer-right var(--dur-slow) var(--ease-out)}
|
|
1500
1529
|
.ef-drawer[data-vaul-drawer-direction=left]{top:0;left:0;bottom:0;width:min(75vw,384px);border-width:0 1px 0 0;animation:ef-drawer-left var(--dur-slow) var(--ease-out)}
|
|
1501
1530
|
.ef-drawer[data-vaul-drawer-direction=top]{top:0;left:0;right:0;width:100%;max-height:80vh;border-width:0 0 1px;border-radius:0 0 var(--radius-lg) var(--radius-lg);animation:ef-drawer-top var(--dur-slow) var(--ease-out)}
|
|
@@ -1528,7 +1557,7 @@ input.ef-input-group__control{height:34px;padding:0 11px}textarea.ef-input-group
|
|
|
1528
1557
|
.ef-popover__description{margin:0;color:var(--text-muted);font-size:var(--text-sm);line-height:1.45}
|
|
1529
1558
|
@keyframes ef-pop-in{from{opacity:0;transform:translateY(-3px)}}
|
|
1530
1559
|
/* components/overlay/Portal.jsx */
|
|
1531
|
-
.ef-portal{
|
|
1560
|
+
.ef-portal{display:contents}
|
|
1532
1561
|
/* components/overlay/Sheet.jsx */
|
|
1533
1562
|
.ef-sheet{position:fixed;margin:0;max-width:none;max-height:none;border-radius:0;display:flex;flex-direction:column}
|
|
1534
1563
|
.ef-sheet[data-side=right]{top:0;right:0;bottom:0;width:min(75vw,384px);border-width:0 0 0 1px;animation:ef-sheet-right var(--dur-slow) var(--ease-out)}
|
package/data/DonutChart.js
CHANGED
package/feedback/Dialog.js
CHANGED
|
@@ -217,7 +217,7 @@ export const DialogTitle = /*#__PURE__*/React.forwardRef(function DialogTitle({
|
|
|
217
217
|
...rest
|
|
218
218
|
}, ref) {
|
|
219
219
|
const ctx = React.useContext(DialogContext);
|
|
220
|
-
return /*#__PURE__*/React.createElement("
|
|
220
|
+
return /*#__PURE__*/React.createElement("h2", _extends({}, rest, {
|
|
221
221
|
ref: ref,
|
|
222
222
|
id: id || ctx && ctx.titleId,
|
|
223
223
|
"data-slot": slot,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4
|
+
export type ToastType = 'default' | 'success' | 'info' | 'warning' | 'error' | 'loading';
|
|
5
|
+
export interface ToastOptions {
|
|
6
|
+
id?: string | number;
|
|
7
|
+
title: React.ReactNode;
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
type?: ToastType;
|
|
10
|
+
duration?: number;
|
|
11
|
+
actionProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
12
|
+
closeButton?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ToastPromiseOptions<T> {
|
|
15
|
+
loading: React.ReactNode | Partial<ToastOptions>;
|
|
16
|
+
success: React.ReactNode | Partial<ToastOptions> | ((value: T) => React.ReactNode | Partial<ToastOptions>);
|
|
17
|
+
error: React.ReactNode | Partial<ToastOptions> | ((error: unknown) => React.ReactNode | Partial<ToastOptions>);
|
|
18
|
+
duration?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ToastManager {
|
|
21
|
+
add(options: ToastOptions): string | number;
|
|
22
|
+
close(id?: string | number): void;
|
|
23
|
+
promise<T>(promise: Promise<T> | (() => Promise<T>), options: ToastPromiseOptions<T>): string | number;
|
|
24
|
+
}
|
|
25
|
+
export const toast: ToastManager;
|
|
26
|
+
export interface ToasterProps extends React.HTMLAttributes<HTMLDivElement> { position?: ToastPosition; visibleToasts?: number; closeButton?: boolean; richColors?: boolean; duration?: number; toastOptions?: Partial<ToastOptions>; expand?: boolean; theme?: 'light' | 'dark' | 'system'; dir?: 'ltr' | 'rtl'; gap?: number; offset?: number | string; mobileOffset?: number | string; label?: string; children?: React.ReactNode }
|
|
27
|
+
export function Toaster(props: ToasterProps): React.JSX.Element;
|
|
@@ -10,23 +10,22 @@ const ICONS = {
|
|
|
10
10
|
warning: 'triangle-alert',
|
|
11
11
|
info: 'info'
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function ToastItem({
|
|
14
14
|
tone = 'info',
|
|
15
15
|
title,
|
|
16
16
|
description,
|
|
17
|
-
|
|
17
|
+
actionProps,
|
|
18
18
|
onClose,
|
|
19
19
|
role = 'status',
|
|
20
20
|
style,
|
|
21
21
|
className,
|
|
22
22
|
...rest
|
|
23
23
|
}) {
|
|
24
|
-
const actionNode =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, action) : null;
|
|
24
|
+
const actionNode = actionProps ? /*#__PURE__*/React.createElement("button", _extends({
|
|
25
|
+
type: "button"
|
|
26
|
+
}, actionProps, {
|
|
27
|
+
className: `ef-toast__action${actionProps.className ? ` ${actionProps.className}` : ''}`
|
|
28
|
+
})) : null;
|
|
30
29
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
31
30
|
"data-slot": "toast",
|
|
32
31
|
className: `ef-toast ef-toast--${tone}${className ? ` ${className}` : ''}`,
|
|
@@ -53,7 +52,7 @@ function SonnerToast({
|
|
|
53
52
|
onClick: onClose
|
|
54
53
|
}) : null);
|
|
55
54
|
}
|
|
56
|
-
function
|
|
55
|
+
function ToastStack({
|
|
57
56
|
children,
|
|
58
57
|
position = 'bottom-right',
|
|
59
58
|
style,
|
|
@@ -75,7 +74,7 @@ const listeners = new Set();
|
|
|
75
74
|
const timers = new Map();
|
|
76
75
|
const emit = () => listeners.forEach(listener => listener(records));
|
|
77
76
|
const resolve = (value, payload) => typeof value === 'function' ? value(payload) : value;
|
|
78
|
-
function
|
|
77
|
+
function close(id) {
|
|
79
78
|
if (id == null) {
|
|
80
79
|
timers.forEach(timer => clearTimeout(timer.handle));
|
|
81
80
|
timers.clear();
|
|
@@ -95,10 +94,10 @@ function schedule(id, duration) {
|
|
|
95
94
|
startedAt: Date.now(),
|
|
96
95
|
handle: null
|
|
97
96
|
};
|
|
98
|
-
timer.handle = setTimeout(() =>
|
|
97
|
+
timer.handle = setTimeout(() => close(id), duration);
|
|
99
98
|
timers.set(id, timer);
|
|
100
99
|
}
|
|
101
|
-
function
|
|
100
|
+
function add(options = {}) {
|
|
102
101
|
const merged = {
|
|
103
102
|
...defaultToastOptions,
|
|
104
103
|
...options
|
|
@@ -107,42 +106,57 @@ function create(message, options = {}, type = 'default') {
|
|
|
107
106
|
const next = {
|
|
108
107
|
...merged,
|
|
109
108
|
id,
|
|
110
|
-
|
|
111
|
-
type
|
|
109
|
+
type: merged.type || 'default'
|
|
112
110
|
};
|
|
113
111
|
const previous = timers.get(id);
|
|
114
112
|
if (previous?.handle) clearTimeout(previous.handle);
|
|
115
113
|
timers.delete(id);
|
|
116
114
|
records = records.some(item => item.id === id) ? records.map(item => item.id === id ? next : item) : [...records, next];
|
|
117
|
-
schedule(id, merged.duration ?? (type === 'loading' ? 0 : defaultDuration));
|
|
115
|
+
schedule(id, merged.duration ?? (next.type === 'loading' || next.actionProps ? 0 : defaultDuration));
|
|
118
116
|
emit();
|
|
119
117
|
return id;
|
|
120
118
|
}
|
|
121
|
-
export
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
toast.info = (message, options) => create(message, options, 'info');
|
|
126
|
-
toast.warning = (message, options) => create(message, options, 'warning');
|
|
127
|
-
toast.error = (message, options) => create(message, options, 'error');
|
|
128
|
-
toast.loading = (message, options) => create(message, {
|
|
129
|
-
...options,
|
|
130
|
-
duration: options?.duration ?? 0
|
|
131
|
-
}, 'loading');
|
|
132
|
-
toast.custom = (message, options) => create(message, options, 'custom');
|
|
133
|
-
toast.message = toast;
|
|
134
|
-
toast.dismiss = dismiss;
|
|
119
|
+
export const toast = {
|
|
120
|
+
add,
|
|
121
|
+
close
|
|
122
|
+
};
|
|
135
123
|
toast.promise = (promise, data = {}) => {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
duration:
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
duration:
|
|
145
|
-
}
|
|
124
|
+
const loading = resolve(data.loading);
|
|
125
|
+
const id = add(typeof loading === 'object' && loading !== null ? {
|
|
126
|
+
...loading,
|
|
127
|
+
type: 'loading',
|
|
128
|
+
duration: 0
|
|
129
|
+
} : {
|
|
130
|
+
title: loading,
|
|
131
|
+
type: 'loading',
|
|
132
|
+
duration: 0
|
|
133
|
+
});
|
|
134
|
+
Promise.resolve(typeof promise === 'function' ? promise() : promise).then(value => {
|
|
135
|
+
const result = resolve(data.success, value);
|
|
136
|
+
add(typeof result === 'object' && result !== null ? {
|
|
137
|
+
...result,
|
|
138
|
+
id,
|
|
139
|
+
type: result.type || 'success'
|
|
140
|
+
} : {
|
|
141
|
+
id,
|
|
142
|
+
title: result,
|
|
143
|
+
type: 'success',
|
|
144
|
+
duration: data.duration
|
|
145
|
+
});
|
|
146
|
+
}, error => {
|
|
147
|
+
const result = resolve(data.error, error);
|
|
148
|
+
add(typeof result === 'object' && result !== null ? {
|
|
149
|
+
...result,
|
|
150
|
+
id,
|
|
151
|
+
type: result.type || 'error'
|
|
152
|
+
} : {
|
|
153
|
+
id,
|
|
154
|
+
title: result,
|
|
155
|
+
description: error?.message,
|
|
156
|
+
type: 'error',
|
|
157
|
+
duration: data.duration
|
|
158
|
+
});
|
|
159
|
+
});
|
|
146
160
|
return id;
|
|
147
161
|
};
|
|
148
162
|
function pause() {
|
|
@@ -162,9 +176,9 @@ function resume() {
|
|
|
162
176
|
return;
|
|
163
177
|
}
|
|
164
178
|
timer.startedAt = Date.now();
|
|
165
|
-
timer.handle = setTimeout(() =>
|
|
179
|
+
timer.handle = setTimeout(() => close(id), timer.remaining);
|
|
166
180
|
});
|
|
167
|
-
expired.forEach(
|
|
181
|
+
expired.forEach(close);
|
|
168
182
|
}
|
|
169
183
|
export function Toaster({
|
|
170
184
|
position = 'bottom-right',
|
|
@@ -200,7 +214,7 @@ export function Toaster({
|
|
|
200
214
|
};
|
|
201
215
|
}, [duration, toastOptions]);
|
|
202
216
|
const resolvedOffset = typeof offset === 'number' ? `${offset}px` : offset;
|
|
203
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(
|
|
217
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(ToastStack, _extends({}, rest, {
|
|
204
218
|
dir: dir,
|
|
205
219
|
position: position,
|
|
206
220
|
"data-rich-colors": richColors ? 'true' : 'false',
|
|
@@ -226,13 +240,13 @@ export function Toaster({
|
|
|
226
240
|
onBlurCapture: resume
|
|
227
241
|
}), items.slice(-visibleToasts).map(item => item.type === 'custom' && /*#__PURE__*/React.isValidElement(item.title) ? /*#__PURE__*/React.cloneElement(item.title, {
|
|
228
242
|
key: item.id
|
|
229
|
-
}) : /*#__PURE__*/React.createElement(
|
|
243
|
+
}) : /*#__PURE__*/React.createElement(ToastItem, {
|
|
230
244
|
key: item.id,
|
|
231
245
|
tone: item.type === 'error' ? 'danger' : ['success', 'warning', 'info'].includes(item.type) ? item.type : 'info',
|
|
232
246
|
title: item.title,
|
|
233
247
|
description: item.description,
|
|
234
|
-
|
|
248
|
+
actionProps: item.actionProps,
|
|
235
249
|
role: null,
|
|
236
|
-
onClose: closeButton || item.closeButton ? () =>
|
|
250
|
+
onClose: closeButton || item.closeButton ? () => close(item.id) : undefined
|
|
237
251
|
})))));
|
|
238
252
|
}
|
package/finance/PaymentCard.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface PaymentCardProps {
|
|
|
5
5
|
number?: string;
|
|
6
6
|
/** @default '09/29' */
|
|
7
7
|
expiry?: string;
|
|
8
|
-
/** Top-left brand text @default '
|
|
8
|
+
/** Top-left brand text @default 'Meridian' */
|
|
9
9
|
network?: string;
|
|
10
10
|
/** @default 'espresso' */
|
|
11
11
|
variant?: 'espresso' | 'caramel' | 'paper';
|
package/finance/PaymentCard.js
CHANGED
package/forms/Button.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Icon } from "../icons/Icon.js";
|
|
|
9
9
|
* lands after whatever stylesheet the app shipped, and at equal specificity
|
|
10
10
|
* later wins. Consumer applications otherwise have to double their selectors
|
|
11
11
|
* (`.hide-sm.hide-sm`) because a one-class utility lost to
|
|
12
|
-
* `.ef-badge { display: inline-flex }`, and
|
|
12
|
+
* `.ef-badge { display: inline-flex }`, and Meridian restates radii and colours
|
|
13
13
|
* to get its own back. A design system that has to be out-specified by its
|
|
14
14
|
* consumers is not a foundation, it is a competitor.
|
|
15
15
|
*
|
package/forms/Input.js
CHANGED
|
@@ -22,6 +22,7 @@ export const Input = /*#__PURE__*/React.forwardRef(function Input({
|
|
|
22
22
|
}, ref) {
|
|
23
23
|
const uid = React.useId();
|
|
24
24
|
const [revealed, setRevealed] = React.useState(false);
|
|
25
|
+
const [fileName, setFileName] = React.useState('No file chosen');
|
|
25
26
|
const customSize = typeof size === 'string' && ['sm', 'md', 'lg'].includes(size) ? size : 'md';
|
|
26
27
|
const nativeSize = typeof size === 'number' ? size : undefined;
|
|
27
28
|
const showToggle = !!(revealable && rest.type === 'password');
|
|
@@ -45,9 +46,25 @@ export const Input = /*#__PURE__*/React.forwardRef(function Input({
|
|
|
45
46
|
"aria-invalid": bad || rest['aria-invalid'] || undefined,
|
|
46
47
|
type: showToggle && revealed ? 'text' : rest.type,
|
|
47
48
|
className: classes('ef-input__el', customSize !== 'md' && `ef-input__el--${customSize}`, className),
|
|
48
|
-
style: style
|
|
49
|
+
style: rest.type === 'file' ? undefined : style,
|
|
50
|
+
onChange: rest.type === 'file' ? event => {
|
|
51
|
+
setFileName(event.currentTarget.files?.[0]?.name || 'No file chosen');
|
|
52
|
+
rest.onChange?.(event);
|
|
53
|
+
} : rest.onChange
|
|
49
54
|
}));
|
|
50
|
-
const decorated =
|
|
55
|
+
const decorated = rest.type === 'file' ? /*#__PURE__*/React.createElement("span", {
|
|
56
|
+
className: "ef-file-input",
|
|
57
|
+
style: style
|
|
58
|
+
}, input, /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: "ef-file-input__button",
|
|
60
|
+
"aria-hidden": "true"
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
62
|
+
name: "upload",
|
|
63
|
+
size: 14
|
|
64
|
+
}), "Choose file"), /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
className: "ef-file-input__name",
|
|
66
|
+
"aria-hidden": "true"
|
|
67
|
+
}, fileName)) : iconLeft || showToggle ? /*#__PURE__*/React.createElement("span", {
|
|
51
68
|
className: classes('ef-input', iconLeft && 'ef-input--icon', showToggle && 'ef-input--reveal')
|
|
52
69
|
}, iconLeft ? /*#__PURE__*/React.createElement("span", {
|
|
53
70
|
className: "ef-input__icon",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type QuestionnaireItemStatus = 'unanswered' | 'answered' | 'skipped';
|
|
3
|
+
export interface QuestionnaireItemDefinition { name: string; required?: boolean; multiple?: boolean; disabled?: boolean; choices?: Array<{ value: string; disabled?: boolean }>; }
|
|
4
|
+
export interface QuestionnaireProps extends React.FormHTMLAttributes<HTMLFormElement> { items?: QuestionnaireItemDefinition[]; item?: string; defaultItem?: string; onItemChange?: (item: string) => void; shortcuts?: 'letters' | 'numbers'; }
|
|
5
|
+
export declare const Questionnaire: React.ForwardRefExoticComponent<QuestionnaireProps & React.RefAttributes<HTMLFormElement>>;
|
|
6
|
+
export declare const QuestionnaireProgress: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export interface QuestionnaireItemProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> { name: string; multiple?: boolean; invalid?: boolean; onStatusChange?: (status: QuestionnaireItemStatus) => void; }
|
|
8
|
+
export declare const QuestionnaireItem: React.ForwardRefExoticComponent<QuestionnaireItemProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
9
|
+
export declare const QuestionnaireTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLLegendElement> & React.RefAttributes<HTMLLegendElement>>;
|
|
10
|
+
export declare const QuestionnaireDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
11
|
+
export declare const QuestionnaireChoices: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export interface QuestionnaireChoiceProps extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange'> { value: string; checked?: boolean; defaultChecked?: boolean; disabled?: boolean; onChange?: React.ChangeEventHandler<HTMLInputElement>; }
|
|
13
|
+
export declare const QuestionnaireChoice: React.ForwardRefExoticComponent<QuestionnaireChoiceProps & React.RefAttributes<HTMLInputElement>>;
|
|
14
|
+
export declare const QuestionnaireInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
|
15
|
+
export declare const QuestionnaireError: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
16
|
+
export declare const QuestionnaireActions: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export declare const QuestionnairePrevious: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export declare const QuestionnaireSkip: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
19
|
+
export declare const QuestionnaireNext: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
20
|
+
export declare const QuestionnaireSubmit: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
import React from 'react';
|
|
4
|
+
const RootContext = /*#__PURE__*/React.createContext(null);
|
|
5
|
+
const ItemContext = /*#__PURE__*/React.createContext(null);
|
|
6
|
+
const ChoiceContext = /*#__PURE__*/React.createContext(null);
|
|
7
|
+
const join = (...parts) => parts.filter(Boolean).join(' ');
|
|
8
|
+
function enabledItems(items) {
|
|
9
|
+
return (items || []).filter(item => !item.disabled);
|
|
10
|
+
}
|
|
11
|
+
export const Questionnaire = /*#__PURE__*/React.forwardRef(function Questionnaire({
|
|
12
|
+
items = [],
|
|
13
|
+
item: itemProp,
|
|
14
|
+
defaultItem,
|
|
15
|
+
onItemChange,
|
|
16
|
+
shortcuts,
|
|
17
|
+
onSubmit,
|
|
18
|
+
onReset,
|
|
19
|
+
className,
|
|
20
|
+
children,
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) {
|
|
23
|
+
const formRef = React.useRef(null);
|
|
24
|
+
const mergedRef = node => {
|
|
25
|
+
formRef.current = node;
|
|
26
|
+
if (typeof ref === 'function') ref(node);else if (ref) ref.current = node;
|
|
27
|
+
};
|
|
28
|
+
const available = React.useMemo(() => enabledItems(items), [items]);
|
|
29
|
+
const first = defaultItem || available[0]?.name;
|
|
30
|
+
const [innerItem, setInnerItem] = React.useState(first);
|
|
31
|
+
const activeItem = itemProp !== undefined ? itemProp : innerItem;
|
|
32
|
+
const [statuses, setStatuses] = React.useState({});
|
|
33
|
+
const [invalid, setInvalid] = React.useState({});
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (!activeItem && available[0]) setInnerItem(available[0].name);
|
|
36
|
+
}, [activeItem, available]);
|
|
37
|
+
const setItem = React.useCallback(next => {
|
|
38
|
+
if (!next) return;
|
|
39
|
+
if (itemProp === undefined) setInnerItem(next);
|
|
40
|
+
onItemChange?.(next);
|
|
41
|
+
requestAnimationFrame(() => [...(formRef.current?.querySelectorAll('[data-questionnaire-item]') || [])].find(node => node.getAttribute('data-questionnaire-item') === next)?.focus());
|
|
42
|
+
}, [itemProp, onItemChange]);
|
|
43
|
+
const index = Math.max(0, available.findIndex(entry => entry.name === activeItem));
|
|
44
|
+
const validate = React.useCallback(name => {
|
|
45
|
+
if (statuses[name] === 'skipped') return true;
|
|
46
|
+
const controls = [...(formRef.current?.elements || [])].filter(control => control.name === name && !control.disabled);
|
|
47
|
+
const valid = controls.some(control => control.type === 'checkbox' || control.type === 'radio' ? control.checked : String(control.value || '').trim());
|
|
48
|
+
setInvalid(state => ({
|
|
49
|
+
...state,
|
|
50
|
+
[name]: !valid
|
|
51
|
+
}));
|
|
52
|
+
if (!valid) requestAnimationFrame(() => controls[0]?.focus());
|
|
53
|
+
return valid;
|
|
54
|
+
}, [available, statuses]);
|
|
55
|
+
const move = delta => {
|
|
56
|
+
if (delta > 0 && !validate(activeItem)) return;
|
|
57
|
+
setItem(available[index + delta]?.name);
|
|
58
|
+
};
|
|
59
|
+
const answer = (name, answered) => {
|
|
60
|
+
const status = answered ? 'answered' : 'unanswered';
|
|
61
|
+
setStatuses(state => ({
|
|
62
|
+
...state,
|
|
63
|
+
[name]: status
|
|
64
|
+
}));
|
|
65
|
+
if (answered) setInvalid(state => ({
|
|
66
|
+
...state,
|
|
67
|
+
[name]: false
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
const skip = () => {
|
|
71
|
+
setStatuses(state => ({
|
|
72
|
+
...state,
|
|
73
|
+
[activeItem]: 'skipped'
|
|
74
|
+
}));
|
|
75
|
+
setInvalid(state => ({
|
|
76
|
+
...state,
|
|
77
|
+
[activeItem]: false
|
|
78
|
+
}));
|
|
79
|
+
if (available[index + 1]) setItem(available[index + 1].name);
|
|
80
|
+
};
|
|
81
|
+
const submit = event => {
|
|
82
|
+
const firstInvalid = available.find(entry => !validate(entry.name));
|
|
83
|
+
if (firstInvalid) {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
setItem(firstInvalid.name);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
onSubmit?.(event);
|
|
89
|
+
};
|
|
90
|
+
const reset = event => {
|
|
91
|
+
setStatuses({});
|
|
92
|
+
setInvalid({});
|
|
93
|
+
if (itemProp === undefined) setInnerItem(first);
|
|
94
|
+
onReset?.(event);
|
|
95
|
+
};
|
|
96
|
+
const onKeyDown = event => {
|
|
97
|
+
if (!shortcuts || event.metaKey || event.ctrlKey || event.altKey || /input|textarea|select/i.test(event.target.tagName)) return;
|
|
98
|
+
const keyIndex = shortcuts === 'letters' ? event.key.toLowerCase().charCodeAt(0) - 97 : Number(event.key) - 1;
|
|
99
|
+
if (keyIndex < 0) return;
|
|
100
|
+
const controls = [...(formRef.current?.elements || [])].filter(control => control.name === activeItem && !control.disabled && /radio|checkbox/.test(control.type));
|
|
101
|
+
if (controls[keyIndex]) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
controls[keyIndex].click();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const context = {
|
|
107
|
+
items: available,
|
|
108
|
+
activeItem,
|
|
109
|
+
index,
|
|
110
|
+
statuses,
|
|
111
|
+
invalid,
|
|
112
|
+
setItem,
|
|
113
|
+
move,
|
|
114
|
+
answer,
|
|
115
|
+
skip,
|
|
116
|
+
validate,
|
|
117
|
+
shortcuts
|
|
118
|
+
};
|
|
119
|
+
return /*#__PURE__*/React.createElement(RootContext.Provider, {
|
|
120
|
+
value: context
|
|
121
|
+
}, /*#__PURE__*/React.createElement("form", _extends({}, rest, {
|
|
122
|
+
ref: mergedRef,
|
|
123
|
+
className: join('ef-questionnaire', className),
|
|
124
|
+
onSubmit: submit,
|
|
125
|
+
onReset: reset,
|
|
126
|
+
onKeyDown: onKeyDown
|
|
127
|
+
}), children));
|
|
128
|
+
});
|
|
129
|
+
export const QuestionnaireProgress = /*#__PURE__*/React.forwardRef(function QuestionnaireProgress({
|
|
130
|
+
children,
|
|
131
|
+
className,
|
|
132
|
+
...rest
|
|
133
|
+
}, ref) {
|
|
134
|
+
const root = React.useContext(RootContext);
|
|
135
|
+
const value = root?.items.length ? root.index + 1 : 0;
|
|
136
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
137
|
+
ref: ref,
|
|
138
|
+
role: "progressbar",
|
|
139
|
+
"aria-label": "Questionnaire progress",
|
|
140
|
+
"aria-valuemin": 0,
|
|
141
|
+
"aria-valuemax": root?.items.length || 0,
|
|
142
|
+
"aria-valuenow": value,
|
|
143
|
+
className: join('ef-questionnaire__progress', className)
|
|
144
|
+
}), children ?? `Question ${value} of ${root?.items.length || 0}`);
|
|
145
|
+
});
|
|
146
|
+
export const QuestionnaireItem = /*#__PURE__*/React.forwardRef(function QuestionnaireItem({
|
|
147
|
+
name,
|
|
148
|
+
required,
|
|
149
|
+
multiple,
|
|
150
|
+
disabled,
|
|
151
|
+
invalid: invalidProp,
|
|
152
|
+
onStatusChange,
|
|
153
|
+
className,
|
|
154
|
+
children,
|
|
155
|
+
...rest
|
|
156
|
+
}, ref) {
|
|
157
|
+
const root = React.useContext(RootContext);
|
|
158
|
+
const active = root?.activeItem === name;
|
|
159
|
+
const status = root?.statuses[name] || 'unanswered';
|
|
160
|
+
React.useEffect(() => {
|
|
161
|
+
onStatusChange?.(status);
|
|
162
|
+
}, [onStatusChange, status]);
|
|
163
|
+
const invalid = invalidProp || root?.invalid[name];
|
|
164
|
+
const context = {
|
|
165
|
+
name,
|
|
166
|
+
required,
|
|
167
|
+
multiple,
|
|
168
|
+
disabled,
|
|
169
|
+
invalid,
|
|
170
|
+
status
|
|
171
|
+
};
|
|
172
|
+
return /*#__PURE__*/React.createElement(ItemContext.Provider, {
|
|
173
|
+
value: context
|
|
174
|
+
}, /*#__PURE__*/React.createElement("fieldset", _extends({}, rest, {
|
|
175
|
+
ref: ref,
|
|
176
|
+
tabIndex: -1,
|
|
177
|
+
name: name,
|
|
178
|
+
disabled: disabled,
|
|
179
|
+
hidden: !active,
|
|
180
|
+
"aria-required": required || undefined,
|
|
181
|
+
"aria-invalid": invalid || undefined,
|
|
182
|
+
"data-questionnaire-item": name,
|
|
183
|
+
"data-status": status,
|
|
184
|
+
className: join('ef-questionnaire__item', className)
|
|
185
|
+
}), children));
|
|
186
|
+
});
|
|
187
|
+
export const QuestionnaireTitle = /*#__PURE__*/React.forwardRef(function QuestionnaireTitle({
|
|
188
|
+
className,
|
|
189
|
+
...rest
|
|
190
|
+
}, ref) {
|
|
191
|
+
return /*#__PURE__*/React.createElement("legend", _extends({}, rest, {
|
|
192
|
+
ref: ref,
|
|
193
|
+
className: join('ef-questionnaire__title', className)
|
|
194
|
+
}));
|
|
195
|
+
});
|
|
196
|
+
export const QuestionnaireDescription = /*#__PURE__*/React.forwardRef(function QuestionnaireDescription({
|
|
197
|
+
className,
|
|
198
|
+
...rest
|
|
199
|
+
}, ref) {
|
|
200
|
+
return /*#__PURE__*/React.createElement("p", _extends({}, rest, {
|
|
201
|
+
ref: ref,
|
|
202
|
+
className: join('ef-questionnaire__description', className)
|
|
203
|
+
}));
|
|
204
|
+
});
|
|
205
|
+
export const QuestionnaireChoices = /*#__PURE__*/React.forwardRef(function QuestionnaireChoices({
|
|
206
|
+
className,
|
|
207
|
+
...rest
|
|
208
|
+
}, ref) {
|
|
209
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
210
|
+
ref: ref,
|
|
211
|
+
className: join('ef-questionnaire__choices', className)
|
|
212
|
+
}));
|
|
213
|
+
});
|
|
214
|
+
export const QuestionnaireChoice = /*#__PURE__*/React.forwardRef(function QuestionnaireChoice({
|
|
215
|
+
value,
|
|
216
|
+
checked,
|
|
217
|
+
defaultChecked,
|
|
218
|
+
disabled,
|
|
219
|
+
onChange,
|
|
220
|
+
className,
|
|
221
|
+
children,
|
|
222
|
+
...rest
|
|
223
|
+
}, ref) {
|
|
224
|
+
const root = React.useContext(RootContext);
|
|
225
|
+
const item = React.useContext(ItemContext);
|
|
226
|
+
const inputRef = React.useRef(null);
|
|
227
|
+
const mergedRef = node => {
|
|
228
|
+
inputRef.current = node;
|
|
229
|
+
if (typeof ref === 'function') ref(node);else if (ref) ref.current = node;
|
|
230
|
+
};
|
|
231
|
+
const controls = item?.name ? [...(root?.items.find(entry => entry.name === item.name)?.choices || [])].filter(choice => !choice.disabled) : [];
|
|
232
|
+
const shortcutIndex = Math.max(0, controls.findIndex(choice => choice.value === value));
|
|
233
|
+
const shortcut = root?.shortcuts === 'letters' ? String.fromCharCode(65 + shortcutIndex) : root?.shortcuts === 'numbers' ? String(shortcutIndex + 1) : '';
|
|
234
|
+
const handleChange = event => {
|
|
235
|
+
if (item?.multiple) {
|
|
236
|
+
const form = event.currentTarget.form;
|
|
237
|
+
const answered = [...(form?.elements || [])].some(control => control.name === item.name && control.checked);
|
|
238
|
+
root?.answer(item.name, answered);
|
|
239
|
+
} else root?.answer(item?.name, event.currentTarget.checked);
|
|
240
|
+
onChange?.(event);
|
|
241
|
+
};
|
|
242
|
+
const context = {
|
|
243
|
+
shortcut
|
|
244
|
+
};
|
|
245
|
+
return /*#__PURE__*/React.createElement(ChoiceContext.Provider, {
|
|
246
|
+
value: context
|
|
247
|
+
}, /*#__PURE__*/React.createElement("label", _extends({}, rest, {
|
|
248
|
+
className: join('ef-questionnaire__choice', className)
|
|
249
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
250
|
+
ref: mergedRef,
|
|
251
|
+
type: item?.multiple ? 'checkbox' : 'radio',
|
|
252
|
+
name: item?.name,
|
|
253
|
+
value: value,
|
|
254
|
+
checked: checked,
|
|
255
|
+
defaultChecked: defaultChecked,
|
|
256
|
+
disabled: disabled || item?.disabled,
|
|
257
|
+
required: item?.required && !item?.multiple,
|
|
258
|
+
"aria-invalid": item?.invalid || undefined,
|
|
259
|
+
onChange: handleChange
|
|
260
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
261
|
+
className: "ef-questionnaire__choice-label"
|
|
262
|
+
}, children), shortcut ? /*#__PURE__*/React.createElement("span", {
|
|
263
|
+
className: "ef-questionnaire__shortcut",
|
|
264
|
+
"aria-hidden": "true"
|
|
265
|
+
}, shortcut) : null));
|
|
266
|
+
});
|
|
267
|
+
export const QuestionnaireInput = /*#__PURE__*/React.forwardRef(function QuestionnaireInput({
|
|
268
|
+
onChange,
|
|
269
|
+
className,
|
|
270
|
+
...rest
|
|
271
|
+
}, ref) {
|
|
272
|
+
const root = React.useContext(RootContext);
|
|
273
|
+
const item = React.useContext(ItemContext);
|
|
274
|
+
return /*#__PURE__*/React.createElement("input", _extends({}, rest, {
|
|
275
|
+
ref: ref,
|
|
276
|
+
type: "text",
|
|
277
|
+
name: item?.name,
|
|
278
|
+
"aria-invalid": item?.invalid || undefined,
|
|
279
|
+
className: join('ef-questionnaire__input', className),
|
|
280
|
+
onChange: event => {
|
|
281
|
+
root?.answer(item?.name, !!event.currentTarget.value.trim());
|
|
282
|
+
onChange?.(event);
|
|
283
|
+
}
|
|
284
|
+
}));
|
|
285
|
+
});
|
|
286
|
+
export const QuestionnaireError = /*#__PURE__*/React.forwardRef(function QuestionnaireError({
|
|
287
|
+
children,
|
|
288
|
+
className,
|
|
289
|
+
...rest
|
|
290
|
+
}, ref) {
|
|
291
|
+
const item = React.useContext(ItemContext);
|
|
292
|
+
if (!item?.invalid) return null;
|
|
293
|
+
return /*#__PURE__*/React.createElement("p", _extends({}, rest, {
|
|
294
|
+
ref: ref,
|
|
295
|
+
role: "alert",
|
|
296
|
+
className: join('ef-questionnaire__error', className)
|
|
297
|
+
}), children || 'Choose an answer to continue.');
|
|
298
|
+
});
|
|
299
|
+
export const QuestionnaireActions = /*#__PURE__*/React.forwardRef(function QuestionnaireActions({
|
|
300
|
+
className,
|
|
301
|
+
...rest
|
|
302
|
+
}, ref) {
|
|
303
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
304
|
+
ref: ref,
|
|
305
|
+
className: join('ef-questionnaire__actions', className)
|
|
306
|
+
}));
|
|
307
|
+
});
|
|
308
|
+
const ActionButton = /*#__PURE__*/React.forwardRef(function ActionButton({
|
|
309
|
+
action,
|
|
310
|
+
primary,
|
|
311
|
+
children,
|
|
312
|
+
className,
|
|
313
|
+
...rest
|
|
314
|
+
}, ref) {
|
|
315
|
+
const root = React.useContext(RootContext);
|
|
316
|
+
const last = root?.index === (root?.items.length || 1) - 1;
|
|
317
|
+
const props = action === 'previous' ? {
|
|
318
|
+
type: 'button',
|
|
319
|
+
onClick: () => root?.move(-1),
|
|
320
|
+
disabled: root?.index <= 0
|
|
321
|
+
} : action === 'skip' ? {
|
|
322
|
+
type: 'button',
|
|
323
|
+
onClick: root?.skip
|
|
324
|
+
} : action === 'next' ? {
|
|
325
|
+
type: 'button',
|
|
326
|
+
onClick: () => root?.move(1),
|
|
327
|
+
hidden: last
|
|
328
|
+
} : {
|
|
329
|
+
type: 'submit',
|
|
330
|
+
hidden: !last
|
|
331
|
+
};
|
|
332
|
+
return /*#__PURE__*/React.createElement("button", _extends({}, props, rest, {
|
|
333
|
+
ref: ref,
|
|
334
|
+
"data-primary": primary ? '' : undefined,
|
|
335
|
+
className: join('ef-questionnaire__button', className)
|
|
336
|
+
}), children);
|
|
337
|
+
});
|
|
338
|
+
export const QuestionnairePrevious = /*#__PURE__*/React.forwardRef(function QuestionnairePrevious({
|
|
339
|
+
children = 'Previous',
|
|
340
|
+
...props
|
|
341
|
+
}, ref) {
|
|
342
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
343
|
+
ref: ref,
|
|
344
|
+
action: "previous"
|
|
345
|
+
}), children);
|
|
346
|
+
});
|
|
347
|
+
export const QuestionnaireSkip = /*#__PURE__*/React.forwardRef(function QuestionnaireSkip({
|
|
348
|
+
children = 'Skip',
|
|
349
|
+
...props
|
|
350
|
+
}, ref) {
|
|
351
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
352
|
+
ref: ref,
|
|
353
|
+
action: "skip"
|
|
354
|
+
}), children);
|
|
355
|
+
});
|
|
356
|
+
export const QuestionnaireNext = /*#__PURE__*/React.forwardRef(function QuestionnaireNext({
|
|
357
|
+
children = 'Next',
|
|
358
|
+
...props
|
|
359
|
+
}, ref) {
|
|
360
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
361
|
+
ref: ref,
|
|
362
|
+
action: "next",
|
|
363
|
+
primary: true
|
|
364
|
+
}), children);
|
|
365
|
+
});
|
|
366
|
+
export const QuestionnaireSubmit = /*#__PURE__*/React.forwardRef(function QuestionnaireSubmit({
|
|
367
|
+
children = 'Submit',
|
|
368
|
+
...props
|
|
369
|
+
}, ref) {
|
|
370
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
371
|
+
ref: ref,
|
|
372
|
+
action: "submit",
|
|
373
|
+
primary: true
|
|
374
|
+
}), children);
|
|
375
|
+
});
|
package/icons/Icon.js
CHANGED
|
@@ -21,6 +21,7 @@ export function Icon({ name, size = 16, strokeWidth = 1.5, title, className, sty
|
|
|
21
21
|
: '';
|
|
22
22
|
return React.createElement('span', {
|
|
23
23
|
...rest,
|
|
24
|
+
'data-slot': 'icon',
|
|
24
25
|
'aria-hidden': title ? undefined : true,
|
|
25
26
|
'aria-label': title,
|
|
26
27
|
role: title ? 'img' : undefined,
|
package/index.d.ts
CHANGED
|
@@ -72,8 +72,8 @@ export * from './feedback/ConfirmDialog.js';
|
|
|
72
72
|
export * from './feedback/Dialog.js';
|
|
73
73
|
export * from './feedback/Loader.js';
|
|
74
74
|
export * from './feedback/Progress.js';
|
|
75
|
-
export * from './feedback/Sonner.js';
|
|
76
75
|
export * from './feedback/Spinner.js';
|
|
76
|
+
export * from './feedback/Toast.js';
|
|
77
77
|
export * from './feedback/Tooltip.js';
|
|
78
78
|
export * from './files/Attachment.js';
|
|
79
79
|
export * from './files/FileDrop.js';
|
|
@@ -93,6 +93,7 @@ export * from './forms/InputOTP.js';
|
|
|
93
93
|
export * from './forms/Label.js';
|
|
94
94
|
export * from './forms/NativeSelect.js';
|
|
95
95
|
export * from './forms/NumberInput.js';
|
|
96
|
+
export * from './forms/Questionnaire.js';
|
|
96
97
|
export * from './forms/Radio.js';
|
|
97
98
|
export * from './forms/Select.js';
|
|
98
99
|
export * from './forms/Slider.js';
|
package/index.js
CHANGED
|
@@ -72,8 +72,8 @@ export { ConfirmDialog } from './feedback/ConfirmDialog.js';
|
|
|
72
72
|
export { Dialog, DialogTrigger, DialogPortal, DialogOverlay, DialogClose, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription } from './feedback/Dialog.js';
|
|
73
73
|
export { Loader } from './feedback/Loader.js';
|
|
74
74
|
export { Progress } from './feedback/Progress.js';
|
|
75
|
-
export { toast, Toaster } from './feedback/Sonner.js';
|
|
76
75
|
export { Spinner } from './feedback/Spinner.js';
|
|
76
|
+
export { toast, Toaster } from './feedback/Toast.js';
|
|
77
77
|
export { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from './feedback/Tooltip.js';
|
|
78
78
|
export { Attachment, AttachmentMedia, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentActions, AttachmentAction, AttachmentTrigger, AttachmentGroup } from './files/Attachment.js';
|
|
79
79
|
export { FileDrop } from './files/FileDrop.js';
|
|
@@ -93,6 +93,7 @@ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from './form
|
|
|
93
93
|
export { Label } from './forms/Label.js';
|
|
94
94
|
export { NativeSelect, NativeSelectOption, NativeSelectOptGroup } from './forms/NativeSelect.js';
|
|
95
95
|
export { NumberInput } from './forms/NumberInput.js';
|
|
96
|
+
export { Questionnaire, QuestionnaireProgress, QuestionnaireItem, QuestionnaireTitle, QuestionnaireDescription, QuestionnaireChoices, QuestionnaireChoice, QuestionnaireInput, QuestionnaireError, QuestionnaireActions, QuestionnairePrevious, QuestionnaireSkip, QuestionnaireNext, QuestionnaireSubmit } from './forms/Questionnaire.js';
|
|
96
97
|
export { RadioGroup, RadioGroupItem, Radio } from './forms/Radio.js';
|
|
97
98
|
export { Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectSeparator, SelectItem } from './forms/Select.js';
|
|
98
99
|
export { Slider } from './forms/Slider.js';
|
package/navigation/SideNav.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface SideNavItem { id: string; label: React.ReactNode; icon: string; badge?: React.ReactNode; }
|
|
2
2
|
export interface SideNavGroup { /** Uppercase group heading (omit for main nav) */ label?: string; items: SideNavItem[]; }
|
|
3
3
|
export interface SideNavProps {
|
|
4
|
-
/** @default '
|
|
4
|
+
/** @default 'Meridian' */
|
|
5
5
|
brand?: string;
|
|
6
6
|
/** Badge next to brand (e.g. 'Console') */
|
|
7
7
|
brandBadge?: React.ReactNode;
|
package/navigation/SideNav.js
CHANGED
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { Icon } from "../icons/Icon.js";
|
|
5
5
|
import { Badge } from "../display/Badge.js";
|
|
6
6
|
export function SideNav({
|
|
7
|
-
brand = '
|
|
7
|
+
brand = 'Meridian',
|
|
8
8
|
brandBadge,
|
|
9
9
|
logoSrc,
|
|
10
10
|
groups,
|
|
@@ -25,7 +25,8 @@ export function SideNav({
|
|
|
25
25
|
alt: "",
|
|
26
26
|
style: {
|
|
27
27
|
width: 30,
|
|
28
|
-
height:
|
|
28
|
+
height: 16,
|
|
29
|
+
objectFit: 'contain'
|
|
29
30
|
}
|
|
30
31
|
}) : null, /*#__PURE__*/React.createElement("span", {
|
|
31
32
|
style: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efolusi/meridian",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.2",
|
|
4
4
|
"description": "A general-purpose open-source design system by Efolusi: accessible React components, design tokens, blocks and example apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://meridian.efolusi.com",
|
package/tailwind.preset.cjs
CHANGED
|
@@ -119,8 +119,7 @@ module.exports = { theme: { extend: {
|
|
|
119
119
|
"sm": "var(--shadow-sm)",
|
|
120
120
|
"md": "var(--shadow-md)",
|
|
121
121
|
"lg": "var(--shadow-lg)",
|
|
122
|
-
"xl": "var(--shadow-xl)"
|
|
123
|
-
"pop": "var(--shadow-pop)"
|
|
122
|
+
"xl": "var(--shadow-xl)"
|
|
124
123
|
},
|
|
125
124
|
"fontSize": {},
|
|
126
125
|
"zIndex": {
|
package/tokens/colors.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
:root{
|
|
2
2
|
/* Sand — warm neutrals */
|
|
3
3
|
--sand-25:#FCFBF9;--sand-50:#FAF9F6;--sand-100:#F3F1EB;--sand-200:#E7E3D9;--sand-300:#D5CFC0;--sand-400:#B4AB97;--sand-500:#948A74;--sand-600:#786E59;--sand-700:#5E5545;--sand-800:#443D32;--sand-900:#2E2922;--sand-950:#1E1A14;
|
|
4
|
-
/* Brand — cream→
|
|
4
|
+
/* Brand — cream→latte→caramel→cocoa→espresso coffee ramp */
|
|
5
5
|
--brand-50:#F8F4E6;--brand-100:#F4E9D2;--brand-200:#EFCFAC;--brand-300:#DFB585;--brand-400:#CE9C66;--brand-500:#C08A5A;--brand-600:#A0693C;--brand-700:#7A4E2B;--brand-800:#5C3A1F;--brand-900:#482818;--brand-950:#2C1709;
|
|
6
6
|
/* Named logo tones (aliases into the ramp) */
|
|
7
7
|
--cocoa-950:var(--brand-950);--cocoa-900:#3A2012;--cocoa-700:var(--brand-900);--caramel-500:var(--brand-500);--peach-200:var(--brand-200);--cream-50:var(--brand-50);
|
package/tokens/effects.css
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
--shadow-md:0 4px 12px rgba(46,41,34,.08);
|
|
5
5
|
--shadow-lg:0 12px 28px rgba(46,41,34,.12);
|
|
6
6
|
--shadow-xl:0 16px 40px rgba(31,26,20,.18),0 2px 8px rgba(31,26,20,.08);
|
|
7
|
-
--shadow-pop:var(--shadow-xl);/* deprecated alias of --shadow-xl; kept one major */
|
|
8
7
|
/* Elevation scale — the single source of overlay stacking order */
|
|
9
8
|
--z-dropdown:1000;/* @kind other */
|
|
10
9
|
--z-sticky:1100;/* @kind other */
|
package/tokens.json
CHANGED
package/feedback/Sonner.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
3
|
-
export interface ToastAction { label: React.ReactNode; onClick: () => void }
|
|
4
|
-
export interface ExternalToast { id?: string | number; description?: React.ReactNode | ((value: unknown) => React.ReactNode); duration?: number; action?: React.ReactNode | ToastAction; closeButton?: boolean }
|
|
5
|
-
export interface ToastFunction { (message: React.ReactNode, options?: ExternalToast): string | number; success(message: React.ReactNode, options?: ExternalToast): string | number; info(message: React.ReactNode, options?: ExternalToast): string | number; warning(message: React.ReactNode, options?: ExternalToast): string | number; error(message: React.ReactNode, options?: ExternalToast): string | number; loading(message: React.ReactNode, options?: ExternalToast): string | number; custom(message: React.ReactElement, options?: ExternalToast): string | number; message(message: React.ReactNode, options?: ExternalToast): string | number; dismiss(id?: string | number): void; promise<T>(promise: Promise<T> | (() => Promise<T>), data: { loading?: React.ReactNode; success?: React.ReactNode | ((value: T) => React.ReactNode); error?: React.ReactNode | ((error: unknown) => React.ReactNode); description?: React.ReactNode | ((value: T) => React.ReactNode); duration?: number }): string | number }
|
|
6
|
-
export const toast: ToastFunction;
|
|
7
|
-
export interface ToasterProps extends React.HTMLAttributes<HTMLDivElement> { position?: ToastPosition; visibleToasts?: number; closeButton?: boolean; richColors?: boolean; duration?: number; toastOptions?: ExternalToast; expand?: boolean; theme?: 'light' | 'dark' | 'system'; dir?: 'ltr' | 'rtl'; gap?: number; offset?: number | string; mobileOffset?: number | string; label?: string; children?: React.ReactNode }
|
|
8
|
-
export function Toaster(props: ToasterProps): React.JSX.Element;
|