@alfadocs/ui-kit 0.67.0 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{ai-tools-rail-DfmewPUN.js → ai-tools-rail-CInA_1-E.js} +2 -2
- package/dist/_chunks/{appointment-tray-CQJ3Nbi5.js → appointment-tray-BMl89NPW.js} +2 -2
- package/dist/_chunks/{care-plan-card-CJei-nl9.js → care-plan-card-BwVUyUBb.js} +3 -3
- package/dist/_chunks/{care-plan-entry-card-EmfrbHu8.js → care-plan-entry-card-VzdQHcOL.js} +2 -2
- package/dist/_chunks/{color-picker-B7xsn6tX.js → color-picker-FXpItIaF.js} +171 -167
- package/dist/_chunks/{editable-currency-cell-renderer-BVJ04DkB.js → editable-currency-cell-renderer-DHOspPee.js} +906 -881
- package/dist/_chunks/{marketplace-app-shell-Bu-HD3fy.js → marketplace-app-shell-D4-T9Qzz.js} +2 -2
- package/dist/_chunks/{patient-shell-DrV_iekt.js → patient-shell-BfgufL_q.js} +2 -2
- package/dist/_chunks/{patient-summary-card-ByfIU8N0.js → patient-summary-card-hEmr4eTW.js} +2 -2
- package/dist/_chunks/{payment-request-card-yTjzKQCU.js → payment-request-card-CYE5vhZ0.js} +2 -2
- package/dist/_chunks/{rich-text-editor-BOQr5lHx.js → rich-text-editor-VawKN1FI.js} +884 -801
- package/dist/_chunks/{scroll-area-eccd_Uf-.js → scroll-area-5wNK0Cyz.js} +3 -3
- package/dist/_chunks/{sidebar-CGjIk_FQ.js → sidebar-DaB4ulxH.js} +344 -340
- package/dist/_chunks/{transaction-chip-BrW8P50O.js → transaction-chip-DK84XCBU.js} +31 -18
- package/dist/agent-catalog.json +1 -1
- package/dist/components/ai-tools-rail/index.js +1 -1
- package/dist/components/appointment-card/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/data-table/data-table.d.ts +1 -1
- package/dist/components/data-table/filters/date-range-filter.d.ts +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/data-table/toolbar.d.ts +4 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +15 -0
- package/dist/components/scroll-area/index.js +1 -1
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/transaction-chip/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +6 -1
- package/dist/i18n/locales/ar.js +8 -3
- package/dist/i18n/locales/de.d.ts +6 -1
- package/dist/i18n/locales/de.js +8 -3
- package/dist/i18n/locales/el.d.ts +6 -1
- package/dist/i18n/locales/el.js +8 -3
- package/dist/i18n/locales/en.d.ts +6 -1
- package/dist/i18n/locales/en.js +8 -3
- package/dist/i18n/locales/es.d.ts +6 -1
- package/dist/i18n/locales/es.js +8 -3
- package/dist/i18n/locales/fr.d.ts +6 -1
- package/dist/i18n/locales/fr.js +8 -3
- package/dist/i18n/locales/hi.d.ts +6 -1
- package/dist/i18n/locales/hi.js +8 -3
- package/dist/i18n/locales/it.d.ts +6 -1
- package/dist/i18n/locales/it.js +8 -3
- package/dist/i18n/locales/ja.d.ts +6 -1
- package/dist/i18n/locales/ja.js +8 -3
- package/dist/i18n/locales/nl.d.ts +6 -1
- package/dist/i18n/locales/nl.js +8 -3
- package/dist/i18n/locales/pl.d.ts +6 -1
- package/dist/i18n/locales/pl.js +8 -3
- package/dist/i18n/locales/pt.d.ts +6 -1
- package/dist/i18n/locales/pt.js +8 -3
- package/dist/i18n/locales/ro.d.ts +6 -1
- package/dist/i18n/locales/ro.js +8 -3
- package/dist/i18n/locales/ru.d.ts +6 -1
- package/dist/i18n/locales/ru.js +8 -3
- package/dist/i18n/locales/sq.d.ts +6 -1
- package/dist/i18n/locales/sq.js +8 -3
- package/dist/i18n/locales/sv.d.ts +6 -1
- package/dist/i18n/locales/sv.js +8 -3
- package/dist/i18n/locales/tr.d.ts +6 -1
- package/dist/i18n/locales/tr.js +8 -3
- package/dist/i18n/locales/zh.d.ts +6 -1
- package/dist/i18n/locales/zh.js +8 -3
- package/dist/index.js +14 -14
- package/dist/locales/ar.json +8 -3
- package/dist/locales/de.json +8 -3
- package/dist/locales/el.json +8 -3
- package/dist/locales/en.json +8 -3
- package/dist/locales/es.json +8 -3
- package/dist/locales/fr.json +8 -3
- package/dist/locales/hi.json +8 -3
- package/dist/locales/it.json +8 -3
- package/dist/locales/ja.json +8 -3
- package/dist/locales/nl.json +8 -3
- package/dist/locales/pl.json +8 -3
- package/dist/locales/pt.json +8 -3
- package/dist/locales/ro.json +8 -3
- package/dist/locales/ru.json +8 -3
- package/dist/locales/sq.json +8 -3
- package/dist/locales/sv.json +8 -3
- package/dist/locales/tr.json +8 -3
- package/dist/locales/zh.json +8 -3
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as l, jsxs as h, Fragment as
|
|
2
|
-
import { forwardRef as $e, useId as
|
|
1
|
+
import { jsx as l, jsxs as h, Fragment as ke } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as $e, useId as ye, useState as z, useMemo as T, useCallback as Ne, useRef as G, useEffect as Z } from "react";
|
|
3
3
|
import * as H from "@radix-ui/react-popover";
|
|
4
|
-
import { c as
|
|
5
|
-
import { useTranslation as
|
|
4
|
+
import { c as te } from "./index-D2ZczOXr.js";
|
|
5
|
+
import { useTranslation as Pe } from "react-i18next";
|
|
6
6
|
import { u as Ae } from "./form-field-context-B3APVHKx.js";
|
|
7
|
-
import { S as
|
|
8
|
-
import { u as
|
|
7
|
+
import { S as ae } from "./slider-BHWzXdjt.js";
|
|
8
|
+
import { u as Se } from "./registry-nPAVE19X.js";
|
|
9
9
|
import { C as re } from "./check-DPdL_Sm7.js";
|
|
10
|
-
import { X as
|
|
10
|
+
import { X as Me } from "./x-CCcI3eJp.js";
|
|
11
11
|
const ze = {
|
|
12
12
|
id: "color-picker",
|
|
13
13
|
capabilities: ["pick"],
|
|
@@ -25,8 +25,8 @@ const ze = {
|
|
|
25
25
|
argsType: "{ hex: string }",
|
|
26
26
|
descriptionKey: "ui.agent.colorPicker.actions.setValue",
|
|
27
27
|
description: "Set the picked colour from a hex string.",
|
|
28
|
-
invoke: (e,
|
|
29
|
-
e.setValue(
|
|
28
|
+
invoke: (e, t) => {
|
|
29
|
+
e.setValue(t.hex);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
},
|
|
@@ -44,50 +44,50 @@ const ze = {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
function Te(e) {
|
|
47
|
-
let
|
|
48
|
-
(
|
|
49
|
-
const r = parseInt(
|
|
50
|
-
return ne(r,
|
|
47
|
+
let t = e.startsWith("#") ? e.slice(1) : e;
|
|
48
|
+
(t.length === 3 || t.length === 4) && (t = t.split("").map((c) => c + c).join(""));
|
|
49
|
+
const r = parseInt(t.slice(0, 2), 16) / 255, a = parseInt(t.slice(2, 4), 16) / 255, n = parseInt(t.slice(4, 6), 16) / 255, d = t.length === 8 ? parseInt(t.slice(6, 8), 16) / 255 : 1;
|
|
50
|
+
return ne(r, a, n, d);
|
|
51
51
|
}
|
|
52
|
-
function ne(e,
|
|
53
|
-
const n = Math.max(e,
|
|
54
|
-
let m = 0,
|
|
55
|
-
if (n !==
|
|
56
|
-
const x = n -
|
|
57
|
-
|
|
52
|
+
function ne(e, t, r, a) {
|
|
53
|
+
const n = Math.max(e, t, r), d = Math.min(e, t, r), c = (n + d) / 2;
|
|
54
|
+
let m = 0, w = 0;
|
|
55
|
+
if (n !== d) {
|
|
56
|
+
const x = n - d;
|
|
57
|
+
w = c > 0.5 ? x / (2 - n - d) : x / (n + d), n === e ? m = ((t - r) / x + (t < r ? 6 : 0)) / 6 : n === t ? m = ((r - e) / x + 2) / 6 : m = ((e - t) / x + 4) / 6;
|
|
58
58
|
}
|
|
59
59
|
return {
|
|
60
60
|
h: Math.round(m * 360),
|
|
61
|
-
s: Math.round(
|
|
61
|
+
s: Math.round(w * 100),
|
|
62
62
|
l: Math.round(c * 100),
|
|
63
|
-
a: Math.round(
|
|
63
|
+
a: Math.round(a * 100) / 100
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
function C(e) {
|
|
67
|
-
const { r:
|
|
68
|
-
return e.a < 1 ? `${
|
|
67
|
+
const { r: t, g: r, b: a } = W(e), n = (c) => Math.round(c * 255).toString(16).padStart(2, "0"), d = `#${n(t)}${n(r)}${n(a)}`;
|
|
68
|
+
return e.a < 1 ? `${d}${n(e.a)}` : d;
|
|
69
69
|
}
|
|
70
70
|
function Ee(e) {
|
|
71
|
-
const { r:
|
|
72
|
-
return e.a < 1 ? `rgba(${n}, ${
|
|
71
|
+
const { r: t, g: r, b: a } = W(e), n = Math.round(t * 255), d = Math.round(r * 255), c = Math.round(a * 255);
|
|
72
|
+
return e.a < 1 ? `rgba(${n}, ${d}, ${c}, ${e.a})` : `rgba(${n}, ${d}, ${c}, 1)`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const
|
|
74
|
+
function W(e) {
|
|
75
|
+
const t = e.h / 360, r = e.s / 100, a = e.l / 100;
|
|
76
76
|
if (r === 0)
|
|
77
|
-
return { r:
|
|
78
|
-
const n =
|
|
77
|
+
return { r: a, g: a, b: a };
|
|
78
|
+
const n = a < 0.5 ? a * (1 + r) : a + r - a * r, d = 2 * a - n;
|
|
79
79
|
return {
|
|
80
|
-
r:
|
|
81
|
-
g:
|
|
82
|
-
b:
|
|
80
|
+
r: j(d, n, t + 1 / 3),
|
|
81
|
+
g: j(d, n, t),
|
|
82
|
+
b: j(d, n, t - 1 / 3)
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
let
|
|
87
|
-
return
|
|
85
|
+
function j(e, t, r) {
|
|
86
|
+
let a = r;
|
|
87
|
+
return a < 0 && (a += 1), a > 1 && (a -= 1), a < 1 / 6 ? e + (t - e) * 6 * a : a < 1 / 2 ? t : a < 2 / 3 ? e + (t - e) * (2 / 3 - a) * 6 : e;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
switch (
|
|
89
|
+
function D(e, t) {
|
|
90
|
+
switch (t) {
|
|
91
91
|
case "hex":
|
|
92
92
|
return C(e);
|
|
93
93
|
case "hsl":
|
|
@@ -96,14 +96,14 @@ function j(e, a) {
|
|
|
96
96
|
return Ee(e);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
102
|
-
if (
|
|
103
|
-
const n =
|
|
104
|
-
return !/^[0-9a-fA-F]{3,8}$/.test(n) || ![3, 4, 6, 8].includes(n.length) ? null : Te(
|
|
99
|
+
function $(e) {
|
|
100
|
+
const t = e.trim();
|
|
101
|
+
if (!t) return null;
|
|
102
|
+
if (t.startsWith("#")) {
|
|
103
|
+
const n = t.slice(1);
|
|
104
|
+
return !/^[0-9a-fA-F]{3,8}$/.test(n) || ![3, 4, 6, 8].includes(n.length) ? null : Te(t);
|
|
105
105
|
}
|
|
106
|
-
const r =
|
|
106
|
+
const r = t.match(
|
|
107
107
|
/^hsla?\(\s*([\d.]+)\s*[,/]\s*([\d.]+)%?\s*[,/]\s*([\d.]+)%?\s*(?:[,/]\s*([\d.]+))?\s*\)$/
|
|
108
108
|
);
|
|
109
109
|
if (r)
|
|
@@ -113,30 +113,30 @@ function w(e) {
|
|
|
113
113
|
l: Math.round(parseFloat(r[3])),
|
|
114
114
|
a: r[4] !== void 0 ? parseFloat(r[4]) : 1
|
|
115
115
|
};
|
|
116
|
-
const
|
|
116
|
+
const a = t.match(
|
|
117
117
|
/^rgba?\(\s*([\d.]+)\s*[,/]\s*([\d.]+)\s*[,/]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+))?\s*\)$/
|
|
118
118
|
);
|
|
119
|
-
if (
|
|
120
|
-
const n = parseFloat(
|
|
121
|
-
return ne(n,
|
|
119
|
+
if (a) {
|
|
120
|
+
const n = parseFloat(a[1]) / 255, d = parseFloat(a[2]) / 255, c = parseFloat(a[3]) / 255, m = a[4] !== void 0 ? parseFloat(a[4]) : 1;
|
|
121
|
+
return ne(n, d, c, m);
|
|
122
122
|
}
|
|
123
123
|
return null;
|
|
124
124
|
}
|
|
125
125
|
function ee(e) {
|
|
126
|
-
const { r:
|
|
127
|
-
return 0.2126 * n(
|
|
126
|
+
const { r: t, g: r, b: a } = W(e), n = (d) => d <= 0.03928 ? d / 12.92 : Math.pow((d + 0.055) / 1.055, 2.4);
|
|
127
|
+
return 0.2126 * n(t) + 0.7152 * n(r) + 0.0722 * n(a);
|
|
128
128
|
}
|
|
129
|
-
function Ie(e,
|
|
130
|
-
const r = ee(e),
|
|
131
|
-
return Math.round((n + 0.05) / (
|
|
129
|
+
function Ie(e, t) {
|
|
130
|
+
const r = ee(e), a = ee(t), n = Math.max(r, a), d = Math.min(r, a);
|
|
131
|
+
return Math.round((n + 0.05) / (d + 0.05) * 100) / 100;
|
|
132
132
|
}
|
|
133
133
|
function Le(e) {
|
|
134
134
|
return e >= 4.5;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function Re(e) {
|
|
137
137
|
return e >= 7;
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const He = [
|
|
140
140
|
{ name: "Pink 500", hex: "#e91e63", textColor: "#ffffff" },
|
|
141
141
|
{ name: "Black", hex: "#000000", textColor: "#ffffff" },
|
|
142
142
|
{ name: "Blue 500", hex: "#2196f3", textColor: "#ffffff" },
|
|
@@ -167,7 +167,7 @@ const Re = [
|
|
|
167
167
|
{ name: "Orange 900", hex: "#e65100", textColor: "#000000" },
|
|
168
168
|
{ name: "White", hex: "#ffffff", textColor: "#000000" },
|
|
169
169
|
{ name: "Yellow 500", hex: "#ffeb3b", textColor: "#000000" }
|
|
170
|
-
],
|
|
170
|
+
], ts = [
|
|
171
171
|
{ name: "Blue 300", hex: "#70738c" },
|
|
172
172
|
{ name: "Blue 500", hex: "#292e53" },
|
|
173
173
|
{ name: "Blue 700", hex: "#1d213b" },
|
|
@@ -186,7 +186,7 @@ const Re = [
|
|
|
186
186
|
{ name: "Grey 300", hex: "#f9f6f3" },
|
|
187
187
|
{ name: "Grey 500", hex: "#f6f1ed" },
|
|
188
188
|
{ name: "Grey 700", hex: "#afaba8" }
|
|
189
|
-
], u = 6, Fe =
|
|
189
|
+
], u = 6, Fe = te(
|
|
190
190
|
[
|
|
191
191
|
"ds:inline-flex ds:items-center ds:w-full",
|
|
192
192
|
"ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
@@ -205,7 +205,7 @@ const Re = [
|
|
|
205
205
|
},
|
|
206
206
|
defaultVariants: { size: "md" }
|
|
207
207
|
}
|
|
208
|
-
), _e =
|
|
208
|
+
), _e = te(
|
|
209
209
|
[
|
|
210
210
|
"ds:relative ds:rounded-[var(--radius-sm)] ds:border-2 ds:cursor-pointer",
|
|
211
211
|
"ds:transition-[transform,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
@@ -230,6 +230,9 @@ const Re = [
|
|
|
230
230
|
// bump (48px) — a dense colour grid is opt-in and the full roving-tabindex
|
|
231
231
|
// keyboard path is the mitigation for the sub-AAA pointer target.
|
|
232
232
|
size: {
|
|
233
|
+
// sm = 28px: clears WCAG 2.5.8 (AA, 24px) but intentionally opts out of
|
|
234
|
+
// the accessible-theme 48px min-target bump — a conscious, signed-off
|
|
235
|
+
// trade-off (dense opt-in grid; keyboard roving-tabindex is the mitigation).
|
|
233
236
|
sm: "ds:min-w-7 ds:min-h-7",
|
|
234
237
|
md: "ds:min-w-[var(--min-target-size)] ds:min-h-[var(--min-target-size)]",
|
|
235
238
|
lg: "ds:min-w-[var(--min-target-size)] ds:min-h-[var(--min-target-size)]"
|
|
@@ -260,85 +263,86 @@ const Re = [
|
|
|
260
263
|
"ds:data-[side=left]:slide-in-from-right-2 ds:data-[side=right]:slide-in-from-left-2"
|
|
261
264
|
].join(" "), De = [
|
|
262
265
|
"ds:w-full ds:rounded-[var(--radius-sm)] ds:border ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
263
|
-
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:text-[var(--font-size-sm)]",
|
|
266
|
+
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)]",
|
|
264
267
|
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
265
268
|
"ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
266
269
|
"ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
|
|
267
270
|
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none"
|
|
268
271
|
].join(" "), oe = "ds:[&>span:first-child]:bg-transparent ds:[&>span:first-child>span]:bg-transparent", Ke = $e(
|
|
269
|
-
(e,
|
|
272
|
+
(e, t) => {
|
|
270
273
|
const {
|
|
271
274
|
value: r,
|
|
272
|
-
defaultValue:
|
|
275
|
+
defaultValue: a,
|
|
273
276
|
onChange: n,
|
|
274
|
-
format:
|
|
277
|
+
format: d = "hex",
|
|
275
278
|
allowOpacity: c = !1,
|
|
276
279
|
palette: m,
|
|
277
|
-
against:
|
|
280
|
+
against: w,
|
|
278
281
|
size: x = "md",
|
|
279
282
|
disabled: ie = !1,
|
|
280
283
|
variant: de = "inline",
|
|
281
|
-
compact:
|
|
282
|
-
className:
|
|
283
|
-
} = e, { t: g } =
|
|
284
|
-
const s = r ??
|
|
284
|
+
compact: M = !0,
|
|
285
|
+
className: U
|
|
286
|
+
} = e, { t: g } = Pe(), P = Ae(), le = ye(), y = P.id || le, v = P.disabled || ie, E = r !== void 0, [X, ce] = z(() => {
|
|
287
|
+
const s = r ?? a;
|
|
285
288
|
if (s) {
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
289
|
+
const i = $(s);
|
|
290
|
+
if (i) return i;
|
|
288
291
|
}
|
|
289
292
|
return { h: 0, s: 100, l: 50, a: 1 };
|
|
290
293
|
}), o = T(() => {
|
|
291
294
|
if (E && r) {
|
|
292
|
-
const s =
|
|
295
|
+
const s = $(r);
|
|
293
296
|
if (s) return s;
|
|
294
297
|
}
|
|
295
|
-
return
|
|
296
|
-
}, [E, r,
|
|
298
|
+
return X;
|
|
299
|
+
}, [E, r, X]), b = Ne(
|
|
297
300
|
(s) => {
|
|
298
|
-
const
|
|
299
|
-
E || ce(
|
|
301
|
+
const i = c ? s : { ...s, a: 1 };
|
|
302
|
+
E || ce(i), n == null || n(D(i, d));
|
|
300
303
|
},
|
|
301
|
-
[c,
|
|
302
|
-
), [
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
[c, d, E, n]
|
|
305
|
+
), [Y, F] = z(() => C(o)), [fe, I] = z(!1), N = G(void 0), _ = G(o);
|
|
306
|
+
_.current = o, Z(() => {
|
|
307
|
+
F(C(o)), I(!1), N.current !== void 0 && (clearTimeout(N.current), N.current = void 0);
|
|
305
308
|
}, [o]), Z(() => () => {
|
|
306
309
|
N.current !== void 0 && clearTimeout(N.current);
|
|
307
310
|
}, []);
|
|
308
311
|
const ue = () => {
|
|
309
|
-
const s =
|
|
312
|
+
const s = $(Y);
|
|
310
313
|
s ? (I(!1), b(s)) : (I(!0), N.current = setTimeout(() => {
|
|
311
|
-
N.current = void 0, I(!1),
|
|
314
|
+
N.current = void 0, I(!1), F(C(_.current));
|
|
312
315
|
}, 800));
|
|
313
|
-
},
|
|
316
|
+
}, A = T(() => m ? m.map(
|
|
314
317
|
(s) => typeof s == "string" ? { name: s.toUpperCase(), hex: s } : s
|
|
315
|
-
) :
|
|
316
|
-
() =>
|
|
317
|
-
const
|
|
318
|
-
return
|
|
318
|
+
) : He, [m]), he = C(o), V = T(
|
|
319
|
+
() => A.map((s) => {
|
|
320
|
+
const i = $(s.hex);
|
|
321
|
+
return i ? C(i).toLowerCase() : null;
|
|
319
322
|
}),
|
|
320
|
-
[
|
|
323
|
+
[A]
|
|
321
324
|
).findIndex(
|
|
322
325
|
(s) => s !== null && s === he.toLowerCase()
|
|
323
|
-
),
|
|
324
|
-
|
|
326
|
+
), L = G(null), [p, q] = z(
|
|
327
|
+
V >= 0 ? V : 0
|
|
325
328
|
), me = (s) => {
|
|
326
329
|
var f;
|
|
327
|
-
const
|
|
328
|
-
|
|
330
|
+
const i = (f = L.current) == null ? void 0 : f.querySelectorAll('[role="gridcell"]');
|
|
331
|
+
i != null && i[s] && (i[s].focus(), q(s));
|
|
329
332
|
}, ge = (s) => {
|
|
330
333
|
if (v) return;
|
|
331
|
-
const
|
|
334
|
+
const i = A.length;
|
|
332
335
|
let f = p;
|
|
336
|
+
const k = (typeof window < "u" && L.current ? window.getComputedStyle(L.current).direction === "rtl" : !1) ? -1 : 1;
|
|
333
337
|
switch (s.key) {
|
|
334
338
|
case "ArrowRight":
|
|
335
|
-
f = (p +
|
|
339
|
+
f = (p + k + i) % i;
|
|
336
340
|
break;
|
|
337
341
|
case "ArrowLeft":
|
|
338
|
-
f = (p -
|
|
342
|
+
f = (p - k + i) % i;
|
|
339
343
|
break;
|
|
340
344
|
case "ArrowDown":
|
|
341
|
-
f = Math.min(p + u,
|
|
345
|
+
f = Math.min(p + u, i - 1);
|
|
342
346
|
break;
|
|
343
347
|
case "ArrowUp":
|
|
344
348
|
f = Math.max(p - u, 0);
|
|
@@ -349,22 +353,22 @@ const Re = [
|
|
|
349
353
|
case "End":
|
|
350
354
|
f = Math.min(
|
|
351
355
|
Math.floor(p / u) * u + u - 1,
|
|
352
|
-
|
|
356
|
+
i - 1
|
|
353
357
|
);
|
|
354
358
|
break;
|
|
355
359
|
case "PageUp":
|
|
356
360
|
f = p % u;
|
|
357
361
|
break;
|
|
358
362
|
case "PageDown": {
|
|
359
|
-
const
|
|
360
|
-
f = Math.min(
|
|
363
|
+
const S = Math.floor((i - 1) / u) * u;
|
|
364
|
+
f = Math.min(S + p % u, i - 1);
|
|
361
365
|
break;
|
|
362
366
|
}
|
|
363
367
|
case "Enter":
|
|
364
368
|
case " ": {
|
|
365
369
|
s.preventDefault();
|
|
366
|
-
const
|
|
367
|
-
|
|
370
|
+
const S = $(A[p].hex);
|
|
371
|
+
S && b(S);
|
|
368
372
|
return;
|
|
369
373
|
}
|
|
370
374
|
default:
|
|
@@ -373,55 +377,55 @@ const Re = [
|
|
|
373
377
|
s.preventDefault(), me(f);
|
|
374
378
|
}, [pe, xe] = z(!1), ve = T(
|
|
375
379
|
() => ({
|
|
376
|
-
getValue: () => C(
|
|
380
|
+
getValue: () => C(_.current),
|
|
377
381
|
setValue: (s) => {
|
|
378
|
-
const
|
|
379
|
-
|
|
382
|
+
const i = $(s);
|
|
383
|
+
i && b(i);
|
|
380
384
|
}
|
|
381
385
|
}),
|
|
382
386
|
[b]
|
|
383
387
|
);
|
|
384
|
-
|
|
385
|
-
const
|
|
386
|
-
if (!
|
|
387
|
-
const s = w
|
|
388
|
+
Se(ze, ve, y);
|
|
389
|
+
const R = T(() => {
|
|
390
|
+
if (!w) return null;
|
|
391
|
+
const s = $(w);
|
|
388
392
|
if (!s) return null;
|
|
389
|
-
const
|
|
390
|
-
return { ratio:
|
|
391
|
-
}, [
|
|
393
|
+
const i = Ie(o, s);
|
|
394
|
+
return { ratio: i, aa: Le(i), aaa: Re(i) };
|
|
395
|
+
}, [w, o]), be = (
|
|
392
396
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus -- inner gridcells are individually focusable via roving tabindex
|
|
393
397
|
/* @__PURE__ */ l(
|
|
394
398
|
"div",
|
|
395
399
|
{
|
|
396
|
-
ref:
|
|
400
|
+
ref: L,
|
|
397
401
|
role: "grid",
|
|
398
|
-
"aria-label": g("inputs.colorPicker.paletteLabel", "Colour
|
|
402
|
+
"aria-label": g("inputs.colorPicker.paletteLabel", "Colour palette"),
|
|
399
403
|
onKeyDown: ge,
|
|
400
404
|
className: "ds:grid ds:grid-cols-6 ds:gap-[var(--spacing-xs)]",
|
|
401
|
-
children:
|
|
402
|
-
const f = Math.floor(
|
|
403
|
-
return
|
|
404
|
-
const
|
|
405
|
+
children: A.map((s, i) => {
|
|
406
|
+
const f = Math.floor(i / u) * u;
|
|
407
|
+
return i === f ? /* @__PURE__ */ l("div", { role: "row", className: "ds:contents", children: A.slice(f, f + u).map((k, S) => {
|
|
408
|
+
const O = f + S, B = O === V;
|
|
405
409
|
return (
|
|
406
410
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events -- parent grid handles keyboard navigation via onKeyDown
|
|
407
411
|
/* @__PURE__ */ l(
|
|
408
412
|
"div",
|
|
409
413
|
{
|
|
410
414
|
role: "gridcell",
|
|
411
|
-
"aria-selected":
|
|
415
|
+
"aria-selected": B,
|
|
412
416
|
"aria-label": g("inputs.colorPicker.swatchLabel", {
|
|
413
|
-
name:
|
|
414
|
-
hex:
|
|
417
|
+
name: k.name,
|
|
418
|
+
hex: k.hex
|
|
415
419
|
}),
|
|
416
|
-
tabIndex:
|
|
420
|
+
tabIndex: O === p ? 0 : -1,
|
|
417
421
|
onClick: () => {
|
|
418
422
|
if (v) return;
|
|
419
|
-
const Q =
|
|
420
|
-
Q && b(Q), q(
|
|
423
|
+
const Q = $(k.hex);
|
|
424
|
+
Q && b(Q), q(O);
|
|
421
425
|
},
|
|
422
|
-
className: _e({ selected:
|
|
423
|
-
style: { "--swatch-bg":
|
|
424
|
-
children:
|
|
426
|
+
className: _e({ selected: B, size: x }),
|
|
427
|
+
style: { "--swatch-bg": k.hex },
|
|
428
|
+
children: B ? /* @__PURE__ */ l(
|
|
425
429
|
re,
|
|
426
430
|
{
|
|
427
431
|
"aria-hidden": "true",
|
|
@@ -429,19 +433,19 @@ const Re = [
|
|
|
429
433
|
}
|
|
430
434
|
) : null
|
|
431
435
|
},
|
|
432
|
-
|
|
436
|
+
k.hex
|
|
433
437
|
)
|
|
434
438
|
);
|
|
435
|
-
}) },
|
|
439
|
+
}) }, i) : null;
|
|
436
440
|
})
|
|
437
441
|
}
|
|
438
442
|
)
|
|
439
|
-
), Ce =
|
|
443
|
+
), Ce = M ? null : /* @__PURE__ */ h(ke, { children: [
|
|
440
444
|
/* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
441
445
|
/* @__PURE__ */ l(
|
|
442
446
|
"label",
|
|
443
447
|
{
|
|
444
|
-
htmlFor: `${
|
|
448
|
+
htmlFor: `${y}-hex`,
|
|
445
449
|
className: "ds:text-[length:var(--font-size-xs)] ds:text-[var(--muted-foreground)]",
|
|
446
450
|
children: g("inputs.colorPicker.hex", "Hex")
|
|
447
451
|
}
|
|
@@ -449,11 +453,11 @@ const Re = [
|
|
|
449
453
|
/* @__PURE__ */ l("bdi", { dir: "ltr", children: /* @__PURE__ */ l(
|
|
450
454
|
"input",
|
|
451
455
|
{
|
|
452
|
-
id: `${
|
|
456
|
+
id: `${y}-hex`,
|
|
453
457
|
type: "text",
|
|
454
|
-
value:
|
|
458
|
+
value: Y,
|
|
455
459
|
disabled: v,
|
|
456
|
-
onChange: (s) =>
|
|
460
|
+
onChange: (s) => F(s.target.value),
|
|
457
461
|
onBlur: ue,
|
|
458
462
|
className: `${De} ${fe ? "ds:border-[var(--destructive)]" : "ds:border-[color:var(--border)]"}`
|
|
459
463
|
}
|
|
@@ -461,7 +465,7 @@ const Re = [
|
|
|
461
465
|
] }),
|
|
462
466
|
/* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
463
467
|
/* @__PURE__ */ l(
|
|
464
|
-
|
|
468
|
+
K,
|
|
465
469
|
{
|
|
466
470
|
label: g("inputs.colorPicker.hue", "Hue"),
|
|
467
471
|
gradient: "linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))",
|
|
@@ -474,7 +478,7 @@ const Re = [
|
|
|
474
478
|
}
|
|
475
479
|
),
|
|
476
480
|
/* @__PURE__ */ l(
|
|
477
|
-
|
|
481
|
+
K,
|
|
478
482
|
{
|
|
479
483
|
label: g("inputs.colorPicker.saturation", "Saturation"),
|
|
480
484
|
gradient: `linear-gradient(to right, hsl(${o.h},0%,${o.l}%), hsl(${o.h},100%,${o.l}%))`,
|
|
@@ -487,7 +491,7 @@ const Re = [
|
|
|
487
491
|
}
|
|
488
492
|
),
|
|
489
493
|
/* @__PURE__ */ l(
|
|
490
|
-
|
|
494
|
+
K,
|
|
491
495
|
{
|
|
492
496
|
label: g("inputs.colorPicker.lightness", "Lightness"),
|
|
493
497
|
gradient: `linear-gradient(to right, hsl(${o.h},${o.s}%,0%), hsl(${o.h},${o.s}%,50%), hsl(${o.h},${o.s}%,100%))`,
|
|
@@ -520,7 +524,7 @@ const Re = [
|
|
|
520
524
|
}
|
|
521
525
|
),
|
|
522
526
|
/* @__PURE__ */ l(
|
|
523
|
-
|
|
527
|
+
ae,
|
|
524
528
|
{
|
|
525
529
|
min: 0,
|
|
526
530
|
max: 100,
|
|
@@ -536,7 +540,7 @@ const Re = [
|
|
|
536
540
|
] })
|
|
537
541
|
] }) : null
|
|
538
542
|
] }),
|
|
539
|
-
|
|
543
|
+
R ? /* @__PURE__ */ h(
|
|
540
544
|
"div",
|
|
541
545
|
{
|
|
542
546
|
className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:text-[length:var(--font-size-sm)]",
|
|
@@ -544,10 +548,10 @@ const Re = [
|
|
|
544
548
|
"aria-live": "polite",
|
|
545
549
|
children: [
|
|
546
550
|
/* @__PURE__ */ l("span", { className: "ds:tabular-nums", children: g("inputs.colorPicker.contrastRatio", {
|
|
547
|
-
ratio:
|
|
551
|
+
ratio: R.ratio.toFixed(1)
|
|
548
552
|
}) }),
|
|
549
|
-
/* @__PURE__ */ l(se, { level: "AA", passes:
|
|
550
|
-
/* @__PURE__ */ l(se, { level: "AAA", passes:
|
|
553
|
+
/* @__PURE__ */ l(se, { level: "AA", passes: R.aa, t: g }),
|
|
554
|
+
/* @__PURE__ */ l(se, { level: "AAA", passes: R.aaa, t: g })
|
|
551
555
|
]
|
|
552
556
|
}
|
|
553
557
|
) : null,
|
|
@@ -560,12 +564,12 @@ const Re = [
|
|
|
560
564
|
"aria-hidden": "true"
|
|
561
565
|
}
|
|
562
566
|
),
|
|
563
|
-
/* @__PURE__ */ l("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[var(--muted-foreground)] ds:tabular-nums", children:
|
|
567
|
+
/* @__PURE__ */ l("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[var(--muted-foreground)] ds:tabular-nums", children: D(o, d) })
|
|
564
568
|
] })
|
|
565
569
|
] }), J = /* @__PURE__ */ h(
|
|
566
570
|
"div",
|
|
567
571
|
{
|
|
568
|
-
className:
|
|
572
|
+
className: M ? x === "sm" ? Ge : Be : Ve,
|
|
569
573
|
children: [
|
|
570
574
|
be,
|
|
571
575
|
Ce
|
|
@@ -575,14 +579,14 @@ const Re = [
|
|
|
575
579
|
return de === "inline" ? /* @__PURE__ */ l(
|
|
576
580
|
"div",
|
|
577
581
|
{
|
|
578
|
-
ref:
|
|
579
|
-
id:
|
|
580
|
-
className:
|
|
582
|
+
ref: t,
|
|
583
|
+
id: y,
|
|
584
|
+
className: U,
|
|
581
585
|
"aria-describedby": P.describedBy || void 0,
|
|
582
586
|
"aria-invalid": P.invalid || void 0,
|
|
583
587
|
"aria-disabled": v || void 0,
|
|
584
588
|
"data-component": "color-picker",
|
|
585
|
-
"data-component-id":
|
|
589
|
+
"data-component-id": y,
|
|
586
590
|
"data-testid": "color-picker",
|
|
587
591
|
children: J
|
|
588
592
|
}
|
|
@@ -590,26 +594,26 @@ const Re = [
|
|
|
590
594
|
/* @__PURE__ */ l(H.Trigger, { asChild: !0, disabled: v, children: /* @__PURE__ */ h(
|
|
591
595
|
"button",
|
|
592
596
|
{
|
|
593
|
-
ref:
|
|
597
|
+
ref: t,
|
|
594
598
|
type: "button",
|
|
595
|
-
id:
|
|
599
|
+
id: y,
|
|
596
600
|
"aria-describedby": P.describedBy || void 0,
|
|
597
601
|
"aria-invalid": P.invalid || void 0,
|
|
598
|
-
"aria-label":
|
|
599
|
-
className: Fe({ size: x, className:
|
|
602
|
+
"aria-label": M ? g("inputs.colorPicker.triggerLabel", "Choose colour") : void 0,
|
|
603
|
+
className: Fe({ size: x, className: U }),
|
|
600
604
|
"data-component": "color-picker",
|
|
601
|
-
"data-component-id":
|
|
605
|
+
"data-component-id": y,
|
|
602
606
|
"data-testid": "color-picker-trigger",
|
|
603
607
|
children: [
|
|
604
608
|
/* @__PURE__ */ l(
|
|
605
609
|
"span",
|
|
606
610
|
{
|
|
607
|
-
className: `ds:inline-block ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ds:shrink-0 ds:bg-[var(--swatch-bg)]${
|
|
611
|
+
className: `ds:inline-block ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ds:shrink-0 ds:bg-[var(--swatch-bg)]${M ? "" : " ds:me-[var(--spacing-sm)]"}`,
|
|
608
612
|
"aria-hidden": "true",
|
|
609
613
|
style: { "--swatch-bg": C(o) }
|
|
610
614
|
}
|
|
611
615
|
),
|
|
612
|
-
|
|
616
|
+
M ? null : /* @__PURE__ */ l("span", { className: "ds:text-start ds:truncate ds:tabular-nums", children: D(o, d) })
|
|
613
617
|
]
|
|
614
618
|
}
|
|
615
619
|
) }),
|
|
@@ -628,7 +632,7 @@ const Re = [
|
|
|
628
632
|
Ke.displayName = "ColorPicker";
|
|
629
633
|
function se({
|
|
630
634
|
level: e,
|
|
631
|
-
passes:
|
|
635
|
+
passes: t,
|
|
632
636
|
t: r
|
|
633
637
|
}) {
|
|
634
638
|
return /* @__PURE__ */ h("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
@@ -640,29 +644,29 @@ function se({
|
|
|
640
644
|
children: e
|
|
641
645
|
}
|
|
642
646
|
),
|
|
643
|
-
|
|
647
|
+
t ? /* @__PURE__ */ l(
|
|
644
648
|
re,
|
|
645
649
|
{
|
|
646
650
|
"aria-hidden": "true",
|
|
647
651
|
className: "ds:size-4 ds:text-[var(--success)]"
|
|
648
652
|
}
|
|
649
653
|
) : /* @__PURE__ */ l(
|
|
650
|
-
|
|
654
|
+
Me,
|
|
651
655
|
{
|
|
652
656
|
"aria-hidden": "true",
|
|
653
657
|
className: "ds:size-4 ds:text-[var(--destructive)]"
|
|
654
658
|
}
|
|
655
659
|
),
|
|
656
|
-
/* @__PURE__ */ l("span", { className: "ds:sr-only", children:
|
|
660
|
+
/* @__PURE__ */ l("span", { className: "ds:sr-only", children: t ? r("inputs.colorPicker.contrastPass", "Pass") : r("inputs.colorPicker.contrastFail", "Fail") })
|
|
657
661
|
] });
|
|
658
662
|
}
|
|
659
|
-
function
|
|
663
|
+
function K({
|
|
660
664
|
label: e,
|
|
661
|
-
gradient:
|
|
665
|
+
gradient: t,
|
|
662
666
|
min: r,
|
|
663
|
-
max:
|
|
667
|
+
max: a,
|
|
664
668
|
value: n,
|
|
665
|
-
onChange:
|
|
669
|
+
onChange: d,
|
|
666
670
|
formatValue: c,
|
|
667
671
|
disabled: m
|
|
668
672
|
}) {
|
|
@@ -673,18 +677,18 @@ function D({
|
|
|
673
677
|
"div",
|
|
674
678
|
{
|
|
675
679
|
className: "ds:absolute ds:inset-0 ds:rounded-[var(--radius-full)] ds:pointer-events-none ds:bg-[image:var(--slider-gradient)]",
|
|
676
|
-
style: { "--slider-gradient":
|
|
680
|
+
style: { "--slider-gradient": t },
|
|
677
681
|
"aria-hidden": "true"
|
|
678
682
|
}
|
|
679
683
|
),
|
|
680
684
|
/* @__PURE__ */ l(
|
|
681
|
-
|
|
685
|
+
ae,
|
|
682
686
|
{
|
|
683
687
|
min: r,
|
|
684
|
-
max:
|
|
688
|
+
max: a,
|
|
685
689
|
step: 1,
|
|
686
690
|
value: [n],
|
|
687
|
-
onValueChange: ([
|
|
691
|
+
onValueChange: ([w]) => d(w),
|
|
688
692
|
"aria-label": e,
|
|
689
693
|
formatValue: c,
|
|
690
694
|
disabled: m,
|
|
@@ -695,8 +699,8 @@ function D({
|
|
|
695
699
|
] });
|
|
696
700
|
}
|
|
697
701
|
export {
|
|
698
|
-
|
|
699
|
-
|
|
702
|
+
He as A,
|
|
703
|
+
ts as B,
|
|
700
704
|
Ke as C
|
|
701
705
|
};
|
|
702
|
-
//# sourceMappingURL=color-picker-
|
|
706
|
+
//# sourceMappingURL=color-picker-FXpItIaF.js.map
|