@salemcobalt/ui 0.2.0-rc.13 → 0.2.0-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/index.d.ts +387 -10
- package/dist/index.js +133 -15
- package/dist/index.js.map +1 -1
- package/dist/styles.css +314 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1342,19 +1342,11 @@ var sizeByLevel = {
|
|
|
1342
1342
|
5: "md",
|
|
1343
1343
|
6: "sm"
|
|
1344
1344
|
};
|
|
1345
|
-
function Heading({
|
|
1346
|
-
level = 2,
|
|
1347
|
-
size,
|
|
1348
|
-
as,
|
|
1349
|
-
tone = "default",
|
|
1350
|
-
truncate = false,
|
|
1351
|
-
className,
|
|
1352
|
-
...rest
|
|
1353
|
-
}) {
|
|
1345
|
+
function Heading({ level = 2, size, as, tone, truncate = false, className, ...rest }) {
|
|
1354
1346
|
return createElement3(as ?? `h${level}`, {
|
|
1355
1347
|
className: cx("sc-heading", className),
|
|
1356
1348
|
"data-size": size ?? sizeByLevel[level],
|
|
1357
|
-
"data-tone": tone,
|
|
1349
|
+
"data-tone": tone ?? (size === "overline" ? "muted" : "default"),
|
|
1358
1350
|
"data-truncate": truncate || void 0,
|
|
1359
1351
|
...rest
|
|
1360
1352
|
});
|
|
@@ -1370,6 +1362,7 @@ function Text({
|
|
|
1370
1362
|
align,
|
|
1371
1363
|
truncate = false,
|
|
1372
1364
|
numeric = false,
|
|
1365
|
+
family = "sans",
|
|
1373
1366
|
className,
|
|
1374
1367
|
style,
|
|
1375
1368
|
...rest
|
|
@@ -1383,6 +1376,7 @@ function Text({
|
|
|
1383
1376
|
"data-align": align,
|
|
1384
1377
|
"data-truncate": truncate === true ? "" : clamp2 !== void 0 ? "clamp" : void 0,
|
|
1385
1378
|
"data-numeric": numeric || void 0,
|
|
1379
|
+
"data-family": family === "mono" ? "mono" : void 0,
|
|
1386
1380
|
style: clamp2 !== void 0 ? { ...style, "--sc-text-lines": clamp2 } : style,
|
|
1387
1381
|
...rest
|
|
1388
1382
|
});
|
|
@@ -3157,7 +3151,6 @@ import {
|
|
|
3157
3151
|
useCallback as useCallback2,
|
|
3158
3152
|
useContext as useContext2,
|
|
3159
3153
|
useEffect as useEffect6,
|
|
3160
|
-
useEffectEvent,
|
|
3161
3154
|
useId as useId5,
|
|
3162
3155
|
useMemo as useMemo3,
|
|
3163
3156
|
useRef as useRef6,
|
|
@@ -3439,12 +3432,14 @@ function Step({
|
|
|
3439
3432
|
const phase = useContext2(FrameContext);
|
|
3440
3433
|
const { announce } = useContext2(FlowContext);
|
|
3441
3434
|
const message = announcement ?? (typeof title === "string" ? title : void 0);
|
|
3442
|
-
const
|
|
3443
|
-
|
|
3444
|
-
|
|
3435
|
+
const latest = useRef6({ message, announce });
|
|
3436
|
+
useEffect6(() => {
|
|
3437
|
+
latest.current = { message, announce };
|
|
3445
3438
|
});
|
|
3446
3439
|
useEffect6(() => {
|
|
3447
|
-
if (phase
|
|
3440
|
+
if (phase !== "enter") return;
|
|
3441
|
+
titleRef.current?.focus({ preventScroll: true });
|
|
3442
|
+
if (latest.current.message) latest.current.announce(latest.current.message);
|
|
3448
3443
|
}, [phase]);
|
|
3449
3444
|
return /* @__PURE__ */ jsxs29("section", { className: cx("sc-flow__step", className), "aria-labelledby": id, ...rest, children: [
|
|
3450
3445
|
/* @__PURE__ */ jsxs29("div", { className: "sc-flow__step-head", children: [
|
|
@@ -3475,6 +3470,125 @@ var FullScreenFlow = {
|
|
|
3475
3470
|
Footer
|
|
3476
3471
|
};
|
|
3477
3472
|
|
|
3473
|
+
// src/components/Score/Score.tsx
|
|
3474
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3475
|
+
function Score({
|
|
3476
|
+
value,
|
|
3477
|
+
max = 100,
|
|
3478
|
+
tone = "accent",
|
|
3479
|
+
variant = "tile",
|
|
3480
|
+
size = "sm",
|
|
3481
|
+
caption,
|
|
3482
|
+
label = "Score",
|
|
3483
|
+
valueText,
|
|
3484
|
+
selected = false,
|
|
3485
|
+
className,
|
|
3486
|
+
style,
|
|
3487
|
+
...rest
|
|
3488
|
+
}) {
|
|
3489
|
+
const fraction = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;
|
|
3490
|
+
return /* @__PURE__ */ jsxs30(
|
|
3491
|
+
"span",
|
|
3492
|
+
{
|
|
3493
|
+
className: cx("sc-score", className),
|
|
3494
|
+
"data-variant": variant,
|
|
3495
|
+
"data-size": variant === "tile" ? size : void 0,
|
|
3496
|
+
"data-tone": tone,
|
|
3497
|
+
"data-selected": selected || void 0,
|
|
3498
|
+
style: variant === "ring" ? { ...style, "--sc-score-fill": (fraction * 100).toFixed(2) } : style,
|
|
3499
|
+
...rest,
|
|
3500
|
+
children: [
|
|
3501
|
+
/* @__PURE__ */ jsx35("span", { className: "sc-visually-hidden", children: valueText ?? `${label} ${value} out of ${max}` }),
|
|
3502
|
+
variant === "ring" ? /* @__PURE__ */ jsxs30("svg", { className: "sc-score__ring", viewBox: "0 0 64 64", "aria-hidden": "true", focusable: "false", children: [
|
|
3503
|
+
/* @__PURE__ */ jsx35("circle", { className: "sc-score__track", cx: "32", cy: "32", r: "29", pathLength: 100 }),
|
|
3504
|
+
fraction > 0 ? /* @__PURE__ */ jsx35("circle", { className: "sc-score__arc", cx: "32", cy: "32", r: "29", pathLength: 100 }) : null
|
|
3505
|
+
] }) : null,
|
|
3506
|
+
/* @__PURE__ */ jsxs30("span", { className: "sc-score__body", "aria-hidden": "true", children: [
|
|
3507
|
+
/* @__PURE__ */ jsx35("span", { className: "sc-score__value", children: value }),
|
|
3508
|
+
caption != null ? /* @__PURE__ */ jsx35("span", { className: "sc-score__caption", children: caption }) : null
|
|
3509
|
+
] })
|
|
3510
|
+
]
|
|
3511
|
+
}
|
|
3512
|
+
);
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
// src/components/ReasonList/ReasonList.tsx
|
|
3516
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3517
|
+
function ReasonListRoot({ tone, size = "md", divider = false, className, ...rest }) {
|
|
3518
|
+
return /* @__PURE__ */ jsx36(
|
|
3519
|
+
"ul",
|
|
3520
|
+
{
|
|
3521
|
+
className: cx("sc-reason-list", className),
|
|
3522
|
+
"data-tone": tone,
|
|
3523
|
+
"data-size": size,
|
|
3524
|
+
"data-divider": divider || void 0,
|
|
3525
|
+
...rest
|
|
3526
|
+
}
|
|
3527
|
+
);
|
|
3528
|
+
}
|
|
3529
|
+
function ReasonListItem({ className, ...rest }) {
|
|
3530
|
+
return /* @__PURE__ */ jsx36("li", { className: cx("sc-reason-list__item", className), ...rest });
|
|
3531
|
+
}
|
|
3532
|
+
var ReasonList = Object.assign(ReasonListRoot, { Item: ReasonListItem });
|
|
3533
|
+
|
|
3534
|
+
// src/components/WordDiff/WordDiff.tsx
|
|
3535
|
+
import { createElement as createElement7, Fragment as Fragment9 } from "react";
|
|
3536
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3537
|
+
var edges = /^(\s*)([\s\S]*?)(\s*)$/;
|
|
3538
|
+
function Change({ kind, text, label }) {
|
|
3539
|
+
const [, lead = "", core = "", trail = ""] = edges.exec(text) ?? [];
|
|
3540
|
+
if (!core) return /* @__PURE__ */ jsx37(Fragment10, { children: text });
|
|
3541
|
+
const Tag = kind === "added" ? "ins" : "del";
|
|
3542
|
+
return /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
3543
|
+
lead,
|
|
3544
|
+
/* @__PURE__ */ jsxs31(Tag, { className: `sc-word-diff__${kind}`, children: [
|
|
3545
|
+
/* @__PURE__ */ jsxs31("span", { className: "sc-visually-hidden", children: [
|
|
3546
|
+
"[",
|
|
3547
|
+
label,
|
|
3548
|
+
": "
|
|
3549
|
+
] }),
|
|
3550
|
+
core,
|
|
3551
|
+
/* @__PURE__ */ jsx37("span", { className: "sc-visually-hidden", children: "]" })
|
|
3552
|
+
] }),
|
|
3553
|
+
trail
|
|
3554
|
+
] });
|
|
3555
|
+
}
|
|
3556
|
+
function WordDiff({
|
|
3557
|
+
parts,
|
|
3558
|
+
as = "p",
|
|
3559
|
+
size = "sm",
|
|
3560
|
+
addedLabel = "added",
|
|
3561
|
+
removedLabel = "removed",
|
|
3562
|
+
className,
|
|
3563
|
+
...rest
|
|
3564
|
+
}) {
|
|
3565
|
+
const children = parts.map(
|
|
3566
|
+
(part, i) => part.kind === "same" ? /* @__PURE__ */ jsx37(Fragment9, { children: part.text }, i) : /* @__PURE__ */ jsx37(
|
|
3567
|
+
Change,
|
|
3568
|
+
{
|
|
3569
|
+
kind: part.kind,
|
|
3570
|
+
text: part.text,
|
|
3571
|
+
label: part.kind === "added" ? addedLabel : removedLabel
|
|
3572
|
+
},
|
|
3573
|
+
i
|
|
3574
|
+
)
|
|
3575
|
+
);
|
|
3576
|
+
return createElement7(
|
|
3577
|
+
as,
|
|
3578
|
+
{ className: cx("sc-word-diff", className), "data-size": size, ...rest },
|
|
3579
|
+
children
|
|
3580
|
+
);
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
// src/components/Quote/Quote.tsx
|
|
3584
|
+
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3585
|
+
function Quote({ label, className, children, ...rest }) {
|
|
3586
|
+
return /* @__PURE__ */ jsxs32("figure", { className: cx("sc-quote", className), ...rest, children: [
|
|
3587
|
+
/* @__PURE__ */ jsx38("figcaption", { className: "sc-quote__label", children: label }),
|
|
3588
|
+
/* @__PURE__ */ jsx38("blockquote", { className: "sc-quote__text", children })
|
|
3589
|
+
] });
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3478
3592
|
// src/index.ts
|
|
3479
3593
|
var version = "0.1.1";
|
|
3480
3594
|
export {
|
|
@@ -3538,7 +3652,10 @@ export {
|
|
|
3538
3652
|
Popover,
|
|
3539
3653
|
PriorityNav,
|
|
3540
3654
|
Progress,
|
|
3655
|
+
Quote,
|
|
3656
|
+
ReasonList,
|
|
3541
3657
|
RefreshIcon,
|
|
3658
|
+
Score,
|
|
3542
3659
|
SearchIcon,
|
|
3543
3660
|
Select,
|
|
3544
3661
|
SelectionBar,
|
|
@@ -3563,6 +3680,7 @@ export {
|
|
|
3563
3680
|
UndoIcon,
|
|
3564
3681
|
UserIcon,
|
|
3565
3682
|
WarningIcon,
|
|
3683
|
+
WordDiff,
|
|
3566
3684
|
XIcon,
|
|
3567
3685
|
iconNames,
|
|
3568
3686
|
useRowSelection,
|