@alfadocs/ui-kit 1.6.1 → 1.8.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/{anamnesis-summary-rows-F-cCmFAn.js → anamnesis-summary-rows-d44s_whc.js} +2 -2
- package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js → antenatal-schedule-timeline-B1k8QkA6.js} +3 -3
- package/dist/_chunks/{appointment-card-BhcPJpXh.js → appointment-card-Dzr3GeVz.js} +73 -90
- package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js → appointment-timeline-0mwtpErq.js} +3 -3
- package/dist/_chunks/{appointment-tray-3c_FLxXJ.js → appointment-tray-4FUu_5NX.js} +2 -2
- package/dist/_chunks/armchair-BaLDW6Hz.js +23 -0
- package/dist/_chunks/{booking-CQMJUFG-.js → booking-DHkKcUIl.js} +4 -4
- package/dist/_chunks/{calendar-4dXTvsCz.js → calendar-B4Gnyu1C.js} +553 -437
- package/dist/_chunks/calendar-event-card-Bjdbik8G.js +425 -0
- package/dist/_chunks/{care-plan-card-DQjVRDxO.js → care-plan-card-aDN4oem9.js} +3 -3
- package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js → care-plan-entry-card-BEhANdBE.js} +2 -2
- package/dist/_chunks/{care-plan-header-CxYoq23f.js → care-plan-header-CkpPyQqG.js} +2 -2
- package/dist/_chunks/{color-picker-D-tUwxxT.js → color-picker-oZ6zYks8.js} +164 -151
- package/dist/_chunks/control-room-rail-Cj2iX9h_.js +337 -0
- package/dist/_chunks/{cycle-calculator-DzgO1vzP.js → cycle-calculator-DmtYGhqq.js} +3 -3
- package/dist/_chunks/{date-picker-Bp64zk2p.js → date-picker-CepI_oI2.js} +77 -74
- package/dist/_chunks/{date-picker-variants-pKAJfnWr.js → date-picker-variants-DfuooXEK.js} +7 -2
- package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js → date-range-picker-BD8P_rJq.js} +46 -45
- package/dist/_chunks/{date-time-picker-DVETwpzc.js → date-time-picker-3I2vVKGV.js} +2 -2
- package/dist/_chunks/{due-date-calculator-wK8Tajzz.js → due-date-calculator-BF_Ikofx.js} +4 -4
- package/dist/_chunks/{entity-card-9_62gY7l.js → entity-card-DmrgYSEX.js} +4 -4
- package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js → gestational-age-calculator-CxZelpu2.js} +5 -5
- package/dist/_chunks/{hcg-doubling-BaXkJhT-.js → hcg-doubling-CpU7H5rQ.js} +3 -3
- package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js → link-cell-renderer-BZQtsuFz.js} +2 -2
- package/dist/_chunks/{notes-panel-DlnENphf.js → notes-panel-e9cJWVRg.js} +2 -2
- package/dist/_chunks/{operator-hero-CCDnIa1S.js → operator-hero-BnFv-Uef.js} +2 -2
- package/dist/_chunks/{parse-JqixfsU0.js → parse-MN9bGkrY.js} +2 -2
- package/dist/_chunks/{patient-details-qnsqYBGQ.js → patient-details-xrqe13az.js} +160 -159
- package/dist/_chunks/{patient-table-DwshfVsQ.js → patient-table-BqYomX50.js} +2 -2
- package/dist/_chunks/{payment-automation-upsell-BBIG7NFL.js → payment-automation-upsell-DwQW2fRp.js} +52 -63
- package/dist/_chunks/{payment-request-card-BjjBMdsp.js → payment-request-card-YVCcCZ25.js} +2 -2
- package/dist/_chunks/{practice-results-F_Rf7c4H.js → practice-results-BEsAdW-B.js} +719 -633
- package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js → pregnancy-dating-DtToyMyc.js} +5 -5
- package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js → radiograph-panel.agent-C3trfWqB.js} +3 -3
- package/dist/_chunks/repeat-CvQa5rZt.js +17 -0
- package/dist/_chunks/resource-chip-DYTG0IQQ.js +83 -0
- package/dist/_chunks/{rich-text-editor-DARnq_6N.js → rich-text-editor-BDfFtK4H.js} +2 -2
- package/dist/_chunks/subDays-BLl3y3pd.js +8 -0
- package/dist/agent-catalog.json +3 -3
- package/dist/components/appointment-card/index.js +2 -2
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calendar/calendar.d.ts +138 -12
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/calendar-event-card/calendar-event-card.d.ts +48 -11
- package/dist/components/calendar-event-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/care-plan-header/index.js +1 -1
- package/dist/components/color-picker/index.d.ts +1 -1
- package/dist/components/color-picker/index.js +4 -3
- package/dist/components/color-picker/palettes.d.ts +10 -0
- package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
- package/dist/components/control-room-rail/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/date-picker.d.ts +11 -0
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/operator-hero/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-details/patient-details.d.ts +8 -0
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/practice-results/practice-results.d.ts +47 -7
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/resource-chip/index.d.ts +3 -0
- package/dist/components/resource-chip/index.js +5 -0
- package/dist/components/resource-chip/resource-chip.d.ts +26 -0
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/host-compat.css +7 -1
- package/dist/i18n/locales/ar.d.ts +5 -0
- package/dist/i18n/locales/ar.js +6 -1
- package/dist/i18n/locales/de.d.ts +5 -0
- package/dist/i18n/locales/de.js +6 -1
- package/dist/i18n/locales/el.d.ts +5 -0
- package/dist/i18n/locales/el.js +6 -1
- package/dist/i18n/locales/en.d.ts +5 -0
- package/dist/i18n/locales/en.js +6 -1
- package/dist/i18n/locales/es.d.ts +5 -0
- package/dist/i18n/locales/es.js +6 -1
- package/dist/i18n/locales/fr.d.ts +5 -0
- package/dist/i18n/locales/fr.js +6 -1
- package/dist/i18n/locales/hi.d.ts +5 -0
- package/dist/i18n/locales/hi.js +6 -1
- package/dist/i18n/locales/it.d.ts +5 -0
- package/dist/i18n/locales/it.js +6 -1
- package/dist/i18n/locales/ja.d.ts +5 -0
- package/dist/i18n/locales/ja.js +6 -1
- package/dist/i18n/locales/nl.d.ts +5 -0
- package/dist/i18n/locales/nl.js +6 -1
- package/dist/i18n/locales/pl.d.ts +5 -0
- package/dist/i18n/locales/pl.js +6 -1
- package/dist/i18n/locales/pt.d.ts +5 -0
- package/dist/i18n/locales/pt.js +6 -1
- package/dist/i18n/locales/ro.d.ts +5 -0
- package/dist/i18n/locales/ro.js +6 -1
- package/dist/i18n/locales/ru.d.ts +5 -0
- package/dist/i18n/locales/ru.js +6 -1
- package/dist/i18n/locales/sq.d.ts +5 -0
- package/dist/i18n/locales/sq.js +6 -1
- package/dist/i18n/locales/sv.d.ts +5 -0
- package/dist/i18n/locales/sv.js +6 -1
- package/dist/i18n/locales/tr.d.ts +5 -0
- package/dist/i18n/locales/tr.js +6 -1
- package/dist/i18n/locales/zh.d.ts +5 -0
- package/dist/i18n/locales/zh.js +6 -1
- package/dist/index.js +961 -958
- package/dist/locales/ar.json +6 -1
- package/dist/locales/de.json +6 -1
- package/dist/locales/el.json +6 -1
- package/dist/locales/en.json +6 -1
- package/dist/locales/es.json +6 -1
- package/dist/locales/fr.json +6 -1
- package/dist/locales/hi.json +6 -1
- package/dist/locales/it.json +6 -1
- package/dist/locales/ja.json +6 -1
- package/dist/locales/nl.json +6 -1
- package/dist/locales/pl.json +6 -1
- package/dist/locales/pt.json +6 -1
- package/dist/locales/ro.json +6 -1
- package/dist/locales/ru.json +6 -1
- package/dist/locales/sq.json +6 -1
- package/dist/locales/sv.json +6 -1
- package/dist/locales/tr.json +6 -1
- package/dist/locales/zh.json +6 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +1 -1
- package/dist/tokens.css +40 -24
- package/package.json +5 -1
- package/dist/_chunks/calendar-event-card-C6qGtywL.js +0 -257
- package/dist/_chunks/control-room-rail-IH1eBjrK.js +0 -333
- package/dist/_chunks/subDays-CAUv47M1.js +0 -8
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as l, jsxs as h, Fragment as ke } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as ye, useId as
|
|
2
|
+
import { forwardRef as ye, useId as Pe, useState as T, useMemo as E, useCallback as $e, 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
|
|
6
|
-
import { u as
|
|
7
|
-
import { S as
|
|
8
|
-
import { u as
|
|
4
|
+
import { c as te } from "./index-D2ZczOXr.js";
|
|
5
|
+
import { useTranslation as Ne } from "react-i18next";
|
|
6
|
+
import { u as Ae } from "./form-field-context-B3APVHKx.js";
|
|
7
|
+
import { S as se } from "./slider-DN1CWkKB.js";
|
|
8
|
+
import { u as Se } from "./registry-DvAUVLHh.js";
|
|
9
9
|
import { C as re } from "./check-DrFSN__t.js";
|
|
10
10
|
import { X as Me } from "./x-B5YnXwCz.js";
|
|
11
|
-
const
|
|
11
|
+
const Te = {
|
|
12
12
|
id: "color-picker",
|
|
13
13
|
capabilities: ["set_value"],
|
|
14
14
|
state: {
|
|
@@ -37,8 +37,8 @@ const ze = {
|
|
|
37
37
|
descriptionKey: "ui.agent.colorPicker.actions.setValue",
|
|
38
38
|
description: "Set the picked colour from a hex string.",
|
|
39
39
|
examples: [{ args: { hex: "#3b82f6" }, note: "Set to brand blue." }],
|
|
40
|
-
invoke: (e,
|
|
41
|
-
e.setValue(
|
|
40
|
+
invoke: (e, t) => {
|
|
41
|
+
e.setValue(t.hex);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -55,67 +55,67 @@ const ze = {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
function
|
|
59
|
-
let
|
|
60
|
-
(
|
|
61
|
-
const r = parseInt(
|
|
62
|
-
return ne(r,
|
|
58
|
+
function Ee(e) {
|
|
59
|
+
let t = e.startsWith("#") ? e.slice(1) : e;
|
|
60
|
+
(t.length === 3 || t.length === 4) && (t = t.split("").map((c) => c + c).join(""));
|
|
61
|
+
const r = parseInt(t.slice(0, 2), 16) / 255, s = 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;
|
|
62
|
+
return ne(r, s, n, d);
|
|
63
63
|
}
|
|
64
|
-
function ne(e,
|
|
65
|
-
const n = Math.max(e,
|
|
64
|
+
function ne(e, t, r, s) {
|
|
65
|
+
const n = Math.max(e, t, r), d = Math.min(e, t, r), c = (n + d) / 2;
|
|
66
66
|
let m = 0, w = 0;
|
|
67
67
|
if (n !== d) {
|
|
68
68
|
const x = n - d;
|
|
69
|
-
w = c > 0.5 ? x / (2 - n - d) : x / (n + d), n === e ? m = ((
|
|
69
|
+
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;
|
|
70
70
|
}
|
|
71
71
|
return {
|
|
72
72
|
h: Math.round(m * 360),
|
|
73
73
|
s: Math.round(w * 100),
|
|
74
74
|
l: Math.round(c * 100),
|
|
75
|
-
a: Math.round(
|
|
75
|
+
a: Math.round(s * 100) / 100
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
function C(e) {
|
|
79
|
-
const { r:
|
|
79
|
+
const { r: t, g: r, b: s } = W(e), n = (c) => Math.round(c * 255).toString(16).padStart(2, "0"), d = `#${n(t)}${n(r)}${n(s)}`;
|
|
80
80
|
return e.a < 1 ? `${d}${n(e.a)}` : d;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const { r:
|
|
82
|
+
function Le(e) {
|
|
83
|
+
const { r: t, g: r, b: s } = W(e), n = Math.round(t * 255), d = Math.round(r * 255), c = Math.round(s * 255);
|
|
84
84
|
return e.a < 1 ? `rgba(${n}, ${d}, ${c}, ${e.a})` : `rgba(${n}, ${d}, ${c}, 1)`;
|
|
85
85
|
}
|
|
86
86
|
function W(e) {
|
|
87
|
-
const
|
|
87
|
+
const t = e.h / 360, r = e.s / 100, s = e.l / 100;
|
|
88
88
|
if (r === 0)
|
|
89
|
-
return { r:
|
|
90
|
-
const n =
|
|
89
|
+
return { r: s, g: s, b: s };
|
|
90
|
+
const n = s < 0.5 ? s * (1 + r) : s + r - s * r, d = 2 * s - n;
|
|
91
91
|
return {
|
|
92
|
-
r: j(d, n,
|
|
93
|
-
g: j(d, n,
|
|
94
|
-
b: j(d, n,
|
|
92
|
+
r: j(d, n, t + 1 / 3),
|
|
93
|
+
g: j(d, n, t),
|
|
94
|
+
b: j(d, n, t - 1 / 3)
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function j(e,
|
|
98
|
-
let
|
|
99
|
-
return
|
|
97
|
+
function j(e, t, r) {
|
|
98
|
+
let s = r;
|
|
99
|
+
return s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? e + (t - e) * 6 * s : s < 1 / 2 ? t : s < 2 / 3 ? e + (t - e) * (2 / 3 - s) * 6 : e;
|
|
100
100
|
}
|
|
101
|
-
function D(e,
|
|
102
|
-
switch (
|
|
101
|
+
function D(e, t) {
|
|
102
|
+
switch (t) {
|
|
103
103
|
case "hex":
|
|
104
104
|
return C(e);
|
|
105
105
|
case "hsl":
|
|
106
106
|
return e.a < 1 ? `hsla(${e.h}, ${e.s}%, ${e.l}%, ${e.a})` : `hsl(${e.h}, ${e.s}%, ${e.l}%)`;
|
|
107
107
|
case "rgba":
|
|
108
|
-
return
|
|
108
|
+
return Le(e);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function y(e) {
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
114
|
-
if (
|
|
115
|
-
const n =
|
|
116
|
-
return !/^[0-9a-fA-F]{3,8}$/.test(n) || ![3, 4, 6, 8].includes(n.length) ? null :
|
|
112
|
+
const t = e.trim();
|
|
113
|
+
if (!t) return null;
|
|
114
|
+
if (t.startsWith("#")) {
|
|
115
|
+
const n = t.slice(1);
|
|
116
|
+
return !/^[0-9a-fA-F]{3,8}$/.test(n) || ![3, 4, 6, 8].includes(n.length) ? null : Ee(t);
|
|
117
117
|
}
|
|
118
|
-
const r =
|
|
118
|
+
const r = t.match(
|
|
119
119
|
/^hsla?\(\s*([\d.]+)\s*[,/]\s*([\d.]+)%?\s*[,/]\s*([\d.]+)%?\s*(?:[,/]\s*([\d.]+))?\s*\)$/
|
|
120
120
|
);
|
|
121
121
|
if (r)
|
|
@@ -125,27 +125,27 @@ function y(e) {
|
|
|
125
125
|
l: Math.round(parseFloat(r[3])),
|
|
126
126
|
a: r[4] !== void 0 ? parseFloat(r[4]) : 1
|
|
127
127
|
};
|
|
128
|
-
const
|
|
128
|
+
const s = t.match(
|
|
129
129
|
/^rgba?\(\s*([\d.]+)\s*[,/]\s*([\d.]+)\s*[,/]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+))?\s*\)$/
|
|
130
130
|
);
|
|
131
|
-
if (
|
|
132
|
-
const n = parseFloat(
|
|
131
|
+
if (s) {
|
|
132
|
+
const n = parseFloat(s[1]) / 255, d = parseFloat(s[2]) / 255, c = parseFloat(s[3]) / 255, m = s[4] !== void 0 ? parseFloat(s[4]) : 1;
|
|
133
133
|
return ne(n, d, c, m);
|
|
134
134
|
}
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
137
|
function ee(e) {
|
|
138
|
-
const { r:
|
|
139
|
-
return 0.2126 * n(
|
|
138
|
+
const { r: t, g: r, b: s } = W(e), n = (d) => d <= 0.03928 ? d / 12.92 : Math.pow((d + 0.055) / 1.055, 2.4);
|
|
139
|
+
return 0.2126 * n(t) + 0.7152 * n(r) + 0.0722 * n(s);
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
const r = ee(e),
|
|
141
|
+
function ze(e, t) {
|
|
142
|
+
const r = ee(e), s = ee(t), n = Math.max(r, s), d = Math.min(r, s);
|
|
143
143
|
return Math.round((n + 0.05) / (d + 0.05) * 100) / 100;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Re(e) {
|
|
146
146
|
return e >= 4.5;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function Ie(e) {
|
|
149
149
|
return e >= 7;
|
|
150
150
|
}
|
|
151
151
|
const He = [
|
|
@@ -179,7 +179,7 @@ const He = [
|
|
|
179
179
|
{ name: "Orange 900", hex: "#e65100", textColor: "#000000" },
|
|
180
180
|
{ name: "White", hex: "#ffffff", textColor: "#000000" },
|
|
181
181
|
{ name: "Yellow 500", hex: "#ffeb3b", textColor: "#000000" }
|
|
182
|
-
],
|
|
182
|
+
], ta = [
|
|
183
183
|
{ name: "Blue 300", hex: "#70738c" },
|
|
184
184
|
{ name: "Blue 500", hex: "#292e53" },
|
|
185
185
|
{ name: "Blue 700", hex: "#1d213b" },
|
|
@@ -198,7 +198,19 @@ const He = [
|
|
|
198
198
|
{ name: "Grey 300", hex: "#f9f6f3" },
|
|
199
199
|
{ name: "Grey 500", hex: "#f6f1ed" },
|
|
200
200
|
{ name: "Grey 700", hex: "#afaba8" }
|
|
201
|
-
],
|
|
201
|
+
], sa = [
|
|
202
|
+
{ name: "Tomato", hex: "#d50000" },
|
|
203
|
+
{ name: "Flamingo", hex: "#e67c73" },
|
|
204
|
+
{ name: "Tangerine", hex: "#f4511e" },
|
|
205
|
+
{ name: "Banana", hex: "#f6bf26" },
|
|
206
|
+
{ name: "Sage", hex: "#33b679" },
|
|
207
|
+
{ name: "Basil", hex: "#0b8043" },
|
|
208
|
+
{ name: "Peacock", hex: "#039be5" },
|
|
209
|
+
{ name: "Blueberry", hex: "#3f51b5" },
|
|
210
|
+
{ name: "Lavender", hex: "#7986cb" },
|
|
211
|
+
{ name: "Grape", hex: "#8e24aa" },
|
|
212
|
+
{ name: "Graphite", hex: "#616161" }
|
|
213
|
+
], u = 6, _e = te(
|
|
202
214
|
[
|
|
203
215
|
"ds:inline-flex ds:items-center ds:w-full",
|
|
204
216
|
"ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
@@ -217,7 +229,7 @@ const He = [
|
|
|
217
229
|
},
|
|
218
230
|
defaultVariants: { size: "md" }
|
|
219
231
|
}
|
|
220
|
-
), Fe =
|
|
232
|
+
), Fe = te(
|
|
221
233
|
[
|
|
222
234
|
"ds:relative ds:rounded-[var(--radius-sm)] ds:border-2 ds:cursor-pointer",
|
|
223
235
|
"ds:transition-[transform,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
@@ -252,14 +264,14 @@ const He = [
|
|
|
252
264
|
},
|
|
253
265
|
defaultVariants: { selected: !1, size: "md" }
|
|
254
266
|
}
|
|
255
|
-
),
|
|
267
|
+
), Be = [
|
|
256
268
|
"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
257
269
|
"ds:rounded-[var(--radius-md)] ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
258
270
|
"ds:p-[var(--spacing-md)]"
|
|
259
271
|
].join(" "), Oe = [
|
|
260
272
|
"ds:bg-[image:repeating-conic-gradient(var(--color-grey-700)_0%_25%,transparent_0%_50%)]",
|
|
261
273
|
"ds:bg-[size:8px_8px]"
|
|
262
|
-
].join(" "),
|
|
274
|
+
].join(" "), Ve = [
|
|
263
275
|
"ds:rounded-[var(--radius-md)] ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
264
276
|
"ds:p-[var(--spacing-sm)]"
|
|
265
277
|
].join(" "), Ge = [
|
|
@@ -281,10 +293,10 @@ const He = [
|
|
|
281
293
|
"ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
|
|
282
294
|
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none"
|
|
283
295
|
].join(" "), oe = "ds:[&>span:first-child]:bg-transparent ds:[&>span:first-child>span]:bg-transparent", Ke = ye(
|
|
284
|
-
(e,
|
|
296
|
+
(e, t) => {
|
|
285
297
|
const {
|
|
286
298
|
value: r,
|
|
287
|
-
defaultValue:
|
|
299
|
+
defaultValue: s,
|
|
288
300
|
onChange: n,
|
|
289
301
|
format: d = "hex",
|
|
290
302
|
allowOpacity: c = !1,
|
|
@@ -295,58 +307,58 @@ const He = [
|
|
|
295
307
|
variant: de = "inline",
|
|
296
308
|
compact: M = !0,
|
|
297
309
|
className: U
|
|
298
|
-
} = e, { t: g } =
|
|
299
|
-
const
|
|
300
|
-
if (
|
|
301
|
-
const i = y(
|
|
310
|
+
} = e, { t: g } = Ne(), N = Ae(), le = Pe(), P = N.id || le, v = N.disabled || ie, L = r !== void 0, [X, ce] = T(() => {
|
|
311
|
+
const a = r ?? s;
|
|
312
|
+
if (a) {
|
|
313
|
+
const i = y(a);
|
|
302
314
|
if (i) return i;
|
|
303
315
|
}
|
|
304
316
|
return { h: 0, s: 100, l: 50, a: 1 };
|
|
305
|
-
}), o =
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
317
|
+
}), o = E(() => {
|
|
318
|
+
if (L && r) {
|
|
319
|
+
const a = y(r);
|
|
320
|
+
if (a) return a;
|
|
309
321
|
}
|
|
310
322
|
return X;
|
|
311
|
-
}, [
|
|
312
|
-
(
|
|
313
|
-
const i = c ?
|
|
314
|
-
|
|
323
|
+
}, [L, r, X]), b = $e(
|
|
324
|
+
(a) => {
|
|
325
|
+
const i = c ? a : { ...a, a: 1 };
|
|
326
|
+
L || ce(i), n == null || n(D(i, d));
|
|
315
327
|
},
|
|
316
|
-
[c, d,
|
|
317
|
-
), [Y, _] =
|
|
328
|
+
[c, d, L, n]
|
|
329
|
+
), [Y, _] = T(() => C(o)), [fe, z] = T(!1), $ = G(void 0), F = G(o);
|
|
318
330
|
F.current = o, Z(() => {
|
|
319
|
-
_(C(o)),
|
|
331
|
+
_(C(o)), z(!1), $.current !== void 0 && (clearTimeout($.current), $.current = void 0);
|
|
320
332
|
}, [o]), Z(() => () => {
|
|
321
|
-
|
|
333
|
+
$.current !== void 0 && clearTimeout($.current);
|
|
322
334
|
}, []);
|
|
323
335
|
const ue = () => {
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
336
|
+
const a = y(Y);
|
|
337
|
+
a ? (z(!1), b(a)) : (z(!0), $.current = setTimeout(() => {
|
|
338
|
+
$.current = void 0, z(!1), _(C(F.current));
|
|
327
339
|
}, 800));
|
|
328
|
-
},
|
|
329
|
-
(
|
|
330
|
-
) : He, [m]), he = C(o),
|
|
331
|
-
() =>
|
|
332
|
-
const i = y(
|
|
340
|
+
}, A = E(() => m ? m.map(
|
|
341
|
+
(a) => typeof a == "string" ? { name: a.toUpperCase(), hex: a } : a
|
|
342
|
+
) : He, [m]), he = C(o), B = E(
|
|
343
|
+
() => A.map((a) => {
|
|
344
|
+
const i = y(a.hex);
|
|
333
345
|
return i ? C(i).toLowerCase() : null;
|
|
334
346
|
}),
|
|
335
|
-
[
|
|
347
|
+
[A]
|
|
336
348
|
).findIndex(
|
|
337
|
-
(
|
|
338
|
-
),
|
|
339
|
-
|
|
340
|
-
), me = (
|
|
349
|
+
(a) => a !== null && a === he.toLowerCase()
|
|
350
|
+
), R = G(null), [p, q] = T(
|
|
351
|
+
B >= 0 ? B : 0
|
|
352
|
+
), me = (a) => {
|
|
341
353
|
var f;
|
|
342
|
-
const i = (f =
|
|
343
|
-
i != null && i[
|
|
344
|
-
}, ge = (
|
|
354
|
+
const i = (f = R.current) == null ? void 0 : f.querySelectorAll('[role="gridcell"]');
|
|
355
|
+
i != null && i[a] && (i[a].focus(), q(a));
|
|
356
|
+
}, ge = (a) => {
|
|
345
357
|
if (v) return;
|
|
346
|
-
const i =
|
|
358
|
+
const i = A.length;
|
|
347
359
|
let f = p;
|
|
348
|
-
const k = (typeof window < "u" &&
|
|
349
|
-
switch (
|
|
360
|
+
const k = (typeof window < "u" && R.current ? window.getComputedStyle(R.current).direction === "rtl" : !1) ? -1 : 1;
|
|
361
|
+
switch (a.key) {
|
|
350
362
|
case "ArrowRight":
|
|
351
363
|
f = (p + k + i) % i;
|
|
352
364
|
break;
|
|
@@ -372,59 +384,59 @@ const He = [
|
|
|
372
384
|
f = p % u;
|
|
373
385
|
break;
|
|
374
386
|
case "PageDown": {
|
|
375
|
-
const
|
|
376
|
-
f = Math.min(
|
|
387
|
+
const S = Math.floor((i - 1) / u) * u;
|
|
388
|
+
f = Math.min(S + p % u, i - 1);
|
|
377
389
|
break;
|
|
378
390
|
}
|
|
379
391
|
case "Enter":
|
|
380
392
|
case " ": {
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
|
|
393
|
+
a.preventDefault();
|
|
394
|
+
const S = y(A[p].hex);
|
|
395
|
+
S && b(S);
|
|
384
396
|
return;
|
|
385
397
|
}
|
|
386
398
|
default:
|
|
387
399
|
return;
|
|
388
400
|
}
|
|
389
|
-
|
|
390
|
-
}, [pe, xe] =
|
|
401
|
+
a.preventDefault(), me(f);
|
|
402
|
+
}, [pe, xe] = T(!1), ve = E(
|
|
391
403
|
() => ({
|
|
392
404
|
getValue: () => C(F.current),
|
|
393
|
-
setValue: (
|
|
394
|
-
const i = y(
|
|
405
|
+
setValue: (a) => {
|
|
406
|
+
const i = y(a);
|
|
395
407
|
i && b(i);
|
|
396
408
|
}
|
|
397
409
|
}),
|
|
398
410
|
[b]
|
|
399
411
|
);
|
|
400
|
-
|
|
401
|
-
const
|
|
412
|
+
Se(Te, ve, P);
|
|
413
|
+
const I = E(() => {
|
|
402
414
|
if (!w) return null;
|
|
403
|
-
const
|
|
404
|
-
if (!
|
|
405
|
-
const i =
|
|
406
|
-
return { ratio: i, aa:
|
|
415
|
+
const a = y(w);
|
|
416
|
+
if (!a) return null;
|
|
417
|
+
const i = ze(o, a);
|
|
418
|
+
return { ratio: i, aa: Re(i), aaa: Ie(i) };
|
|
407
419
|
}, [w, o]), be = (
|
|
408
420
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus -- inner gridcells are individually focusable via roving tabindex
|
|
409
421
|
/* @__PURE__ */ l(
|
|
410
422
|
"div",
|
|
411
423
|
{
|
|
412
|
-
ref:
|
|
424
|
+
ref: R,
|
|
413
425
|
role: "grid",
|
|
414
426
|
"aria-label": g("inputs.colorPicker.paletteLabel", "Colour palette"),
|
|
415
427
|
onKeyDown: ge,
|
|
416
428
|
className: "ds:grid ds:grid-cols-6 ds:gap-[var(--spacing-xs)]",
|
|
417
|
-
children:
|
|
429
|
+
children: A.map((a, i) => {
|
|
418
430
|
const f = Math.floor(i / u) * u;
|
|
419
|
-
return i === f ? /* @__PURE__ */ l("div", { role: "row", className: "ds:contents", children:
|
|
420
|
-
const O = f +
|
|
431
|
+
return i === f ? /* @__PURE__ */ l("div", { role: "row", className: "ds:contents", children: A.slice(f, f + u).map((k, S) => {
|
|
432
|
+
const O = f + S, V = O === B;
|
|
421
433
|
return (
|
|
422
434
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events -- parent grid handles keyboard navigation via onKeyDown
|
|
423
435
|
/* @__PURE__ */ l(
|
|
424
436
|
"div",
|
|
425
437
|
{
|
|
426
438
|
role: "gridcell",
|
|
427
|
-
"aria-selected":
|
|
439
|
+
"aria-selected": V,
|
|
428
440
|
"aria-label": g("inputs.colorPicker.swatchLabel", {
|
|
429
441
|
name: k.name,
|
|
430
442
|
hex: k.hex
|
|
@@ -435,9 +447,9 @@ const He = [
|
|
|
435
447
|
const Q = y(k.hex);
|
|
436
448
|
Q && b(Q), q(O);
|
|
437
449
|
},
|
|
438
|
-
className: Fe({ selected:
|
|
450
|
+
className: Fe({ selected: V, size: x }),
|
|
439
451
|
style: { "--swatch-bg": k.hex },
|
|
440
|
-
children:
|
|
452
|
+
children: V ? /* @__PURE__ */ l(
|
|
441
453
|
re,
|
|
442
454
|
{
|
|
443
455
|
"aria-hidden": "true",
|
|
@@ -457,7 +469,7 @@ const He = [
|
|
|
457
469
|
/* @__PURE__ */ l(
|
|
458
470
|
"label",
|
|
459
471
|
{
|
|
460
|
-
htmlFor: `${
|
|
472
|
+
htmlFor: `${P}-hex`,
|
|
461
473
|
className: "ds:text-[length:var(--font-size-xs)] ds:text-[var(--muted-foreground)]",
|
|
462
474
|
children: g("inputs.colorPicker.hex", "Hex")
|
|
463
475
|
}
|
|
@@ -465,11 +477,11 @@ const He = [
|
|
|
465
477
|
/* @__PURE__ */ l("bdi", { dir: "ltr", children: /* @__PURE__ */ l(
|
|
466
478
|
"input",
|
|
467
479
|
{
|
|
468
|
-
id: `${
|
|
480
|
+
id: `${P}-hex`,
|
|
469
481
|
type: "text",
|
|
470
482
|
value: Y,
|
|
471
483
|
disabled: v,
|
|
472
|
-
onChange: (
|
|
484
|
+
onChange: (a) => _(a.target.value),
|
|
473
485
|
onBlur: ue,
|
|
474
486
|
className: `${De} ${fe ? "ds:border-[var(--destructive)]" : "ds:border-[color:var(--border)]"}`
|
|
475
487
|
}
|
|
@@ -484,8 +496,8 @@ const He = [
|
|
|
484
496
|
min: 0,
|
|
485
497
|
max: 360,
|
|
486
498
|
value: o.h,
|
|
487
|
-
onChange: (
|
|
488
|
-
formatValue: (
|
|
499
|
+
onChange: (a) => b({ ...o, h: a }),
|
|
500
|
+
formatValue: (a) => `H ${a}°`,
|
|
489
501
|
disabled: v
|
|
490
502
|
}
|
|
491
503
|
),
|
|
@@ -497,8 +509,8 @@ const He = [
|
|
|
497
509
|
min: 0,
|
|
498
510
|
max: 100,
|
|
499
511
|
value: o.s,
|
|
500
|
-
onChange: (
|
|
501
|
-
formatValue: (
|
|
512
|
+
onChange: (a) => b({ ...o, s: a }),
|
|
513
|
+
formatValue: (a) => `S ${a}%`,
|
|
502
514
|
disabled: v
|
|
503
515
|
}
|
|
504
516
|
),
|
|
@@ -510,8 +522,8 @@ const He = [
|
|
|
510
522
|
min: 0,
|
|
511
523
|
max: 100,
|
|
512
524
|
value: o.l,
|
|
513
|
-
onChange: (
|
|
514
|
-
formatValue: (
|
|
525
|
+
onChange: (a) => b({ ...o, l: a }),
|
|
526
|
+
formatValue: (a) => `L ${a}%`,
|
|
515
527
|
disabled: v
|
|
516
528
|
}
|
|
517
529
|
),
|
|
@@ -536,15 +548,15 @@ const He = [
|
|
|
536
548
|
}
|
|
537
549
|
),
|
|
538
550
|
/* @__PURE__ */ l(
|
|
539
|
-
|
|
551
|
+
se,
|
|
540
552
|
{
|
|
541
553
|
min: 0,
|
|
542
554
|
max: 100,
|
|
543
555
|
step: 1,
|
|
544
556
|
value: [Math.round(o.a * 100)],
|
|
545
|
-
onValueChange: ([
|
|
557
|
+
onValueChange: ([a]) => b({ ...o, a: a / 100 }),
|
|
546
558
|
"aria-label": g("inputs.colorPicker.opacity", "Opacity"),
|
|
547
|
-
formatValue: (
|
|
559
|
+
formatValue: (a) => `${a}%`,
|
|
548
560
|
disabled: v,
|
|
549
561
|
className: oe
|
|
550
562
|
}
|
|
@@ -552,7 +564,7 @@ const He = [
|
|
|
552
564
|
] })
|
|
553
565
|
] }) : null
|
|
554
566
|
] }),
|
|
555
|
-
|
|
567
|
+
I ? /* @__PURE__ */ h(
|
|
556
568
|
"div",
|
|
557
569
|
{
|
|
558
570
|
className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:text-[length:var(--font-size-sm)]",
|
|
@@ -560,10 +572,10 @@ const He = [
|
|
|
560
572
|
"aria-live": "polite",
|
|
561
573
|
children: [
|
|
562
574
|
/* @__PURE__ */ l("span", { className: "ds:tabular-nums", children: g("inputs.colorPicker.contrastRatio", {
|
|
563
|
-
ratio:
|
|
575
|
+
ratio: I.ratio.toFixed(1)
|
|
564
576
|
}) }),
|
|
565
|
-
/* @__PURE__ */ l(
|
|
566
|
-
/* @__PURE__ */ l(
|
|
577
|
+
/* @__PURE__ */ l(ae, { level: "AA", passes: I.aa, t: g }),
|
|
578
|
+
/* @__PURE__ */ l(ae, { level: "AAA", passes: I.aaa, t: g })
|
|
567
579
|
]
|
|
568
580
|
}
|
|
569
581
|
) : null,
|
|
@@ -581,7 +593,7 @@ const He = [
|
|
|
581
593
|
] }), J = /* @__PURE__ */ h(
|
|
582
594
|
"div",
|
|
583
595
|
{
|
|
584
|
-
className: M ? x === "sm" ? Ge :
|
|
596
|
+
className: M ? x === "sm" ? Ge : Ve : Be,
|
|
585
597
|
children: [
|
|
586
598
|
be,
|
|
587
599
|
Ce
|
|
@@ -591,14 +603,14 @@ const He = [
|
|
|
591
603
|
return de === "inline" ? /* @__PURE__ */ l(
|
|
592
604
|
"div",
|
|
593
605
|
{
|
|
594
|
-
ref:
|
|
595
|
-
id:
|
|
606
|
+
ref: t,
|
|
607
|
+
id: P,
|
|
596
608
|
className: U,
|
|
597
|
-
"aria-describedby":
|
|
598
|
-
"aria-invalid":
|
|
609
|
+
"aria-describedby": N.describedBy || void 0,
|
|
610
|
+
"aria-invalid": N.invalid || void 0,
|
|
599
611
|
"aria-disabled": v || void 0,
|
|
600
612
|
"data-component": "color-picker",
|
|
601
|
-
"data-component-id":
|
|
613
|
+
"data-component-id": P,
|
|
602
614
|
"data-testid": "color-picker",
|
|
603
615
|
children: J
|
|
604
616
|
}
|
|
@@ -606,15 +618,15 @@ const He = [
|
|
|
606
618
|
/* @__PURE__ */ l(H.Trigger, { asChild: !0, disabled: v, children: /* @__PURE__ */ h(
|
|
607
619
|
"button",
|
|
608
620
|
{
|
|
609
|
-
ref:
|
|
621
|
+
ref: t,
|
|
610
622
|
type: "button",
|
|
611
|
-
id:
|
|
612
|
-
"aria-describedby":
|
|
613
|
-
"aria-invalid":
|
|
623
|
+
id: P,
|
|
624
|
+
"aria-describedby": N.describedBy || void 0,
|
|
625
|
+
"aria-invalid": N.invalid || void 0,
|
|
614
626
|
"aria-label": M ? g("inputs.colorPicker.triggerLabel", "Choose colour") : void 0,
|
|
615
627
|
className: _e({ size: x, className: U }),
|
|
616
628
|
"data-component": "color-picker",
|
|
617
|
-
"data-component-id":
|
|
629
|
+
"data-component-id": P,
|
|
618
630
|
"data-testid": "color-picker-trigger",
|
|
619
631
|
children: [
|
|
620
632
|
/* @__PURE__ */ l(
|
|
@@ -642,9 +654,9 @@ const He = [
|
|
|
642
654
|
}
|
|
643
655
|
);
|
|
644
656
|
Ke.displayName = "ColorPicker";
|
|
645
|
-
function
|
|
657
|
+
function ae({
|
|
646
658
|
level: e,
|
|
647
|
-
passes:
|
|
659
|
+
passes: t,
|
|
648
660
|
t: r
|
|
649
661
|
}) {
|
|
650
662
|
return /* @__PURE__ */ h("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
@@ -656,7 +668,7 @@ function te({
|
|
|
656
668
|
children: e
|
|
657
669
|
}
|
|
658
670
|
),
|
|
659
|
-
|
|
671
|
+
t ? /* @__PURE__ */ l(
|
|
660
672
|
re,
|
|
661
673
|
{
|
|
662
674
|
"aria-hidden": "true",
|
|
@@ -669,14 +681,14 @@ function te({
|
|
|
669
681
|
className: "ds:size-4 ds:text-[var(--destructive)]"
|
|
670
682
|
}
|
|
671
683
|
),
|
|
672
|
-
/* @__PURE__ */ l("span", { className: "ds:sr-only", children:
|
|
684
|
+
/* @__PURE__ */ l("span", { className: "ds:sr-only", children: t ? r("inputs.colorPicker.contrastPass", "Pass") : r("inputs.colorPicker.contrastFail", "Fail") })
|
|
673
685
|
] });
|
|
674
686
|
}
|
|
675
687
|
function K({
|
|
676
688
|
label: e,
|
|
677
|
-
gradient:
|
|
689
|
+
gradient: t,
|
|
678
690
|
min: r,
|
|
679
|
-
max:
|
|
691
|
+
max: s,
|
|
680
692
|
value: n,
|
|
681
693
|
onChange: d,
|
|
682
694
|
formatValue: c,
|
|
@@ -689,15 +701,15 @@ function K({
|
|
|
689
701
|
"div",
|
|
690
702
|
{
|
|
691
703
|
className: "ds:absolute ds:inset-0 ds:rounded-[var(--radius-full)] ds:pointer-events-none ds:bg-[image:var(--slider-gradient)]",
|
|
692
|
-
style: { "--slider-gradient":
|
|
704
|
+
style: { "--slider-gradient": t },
|
|
693
705
|
"aria-hidden": "true"
|
|
694
706
|
}
|
|
695
707
|
),
|
|
696
708
|
/* @__PURE__ */ l(
|
|
697
|
-
|
|
709
|
+
se,
|
|
698
710
|
{
|
|
699
711
|
min: r,
|
|
700
|
-
max:
|
|
712
|
+
max: s,
|
|
701
713
|
step: 1,
|
|
702
714
|
value: [n],
|
|
703
715
|
onValueChange: ([w]) => d(w),
|
|
@@ -712,7 +724,8 @@ function K({
|
|
|
712
724
|
}
|
|
713
725
|
export {
|
|
714
726
|
He as A,
|
|
715
|
-
|
|
716
|
-
Ke as C
|
|
727
|
+
ta as B,
|
|
728
|
+
Ke as C,
|
|
729
|
+
sa as G
|
|
717
730
|
};
|
|
718
|
-
//# sourceMappingURL=color-picker-
|
|
731
|
+
//# sourceMappingURL=color-picker-oZ6zYks8.js.map
|