@alfadocs/ui-kit 0.50.1 → 0.52.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/{agenda-card-BaSfVfrL.js → agenda-card-Bl-SBiCh.js} +55 -45
- package/dist/_chunks/agenda-tray-DA6qj8BL.js +203 -0
- package/dist/_chunks/{ai-consent-banner-F2md5JD3.js → ai-consent-banner-DBKV27je.js} +2 -2
- package/dist/_chunks/ai-tools-rail-7tC3GT4h.js +340 -0
- package/dist/_chunks/{alert-CUTxnym2.js → alert-_mUKLmwA.js} +54 -44
- package/dist/_chunks/{audio-recorder-DVJXV7_k.js → audio-recorder-D6OVfNiZ.js} +2 -2
- package/dist/_chunks/{booking-DljH0JkS.js → booking-BUV9fspj.js} +2 -2
- package/dist/_chunks/{document-scanner-Cxqvq7GR.js → document-scanner-biBS_f6c.js} +2 -2
- package/dist/_chunks/dropdown-menu-DwwPovMZ.js +354 -0
- package/dist/_chunks/{editable-currency-cell-renderer-Bh48OHRv.js → editable-currency-cell-renderer-D5C5tCfu.js} +3 -3
- package/dist/_chunks/{freemium-paywall-BWaLWje-.js → freemium-paywall-gHGA44dW.js} +2 -2
- package/dist/_chunks/{header-settings-Bx0Biimh.js → header-settings-D5Z2B_Yz.js} +3 -3
- package/dist/_chunks/{logo-yituK7sE.js → logo-1FuSGx0n.js} +2 -1
- package/dist/_chunks/marketplace-app-shell-C4OYAC22.js +513 -0
- package/dist/_chunks/maximize-2-Cm9OUQ2m.js +17 -0
- package/dist/_chunks/{patient-search-BJOmTmDA.js → patient-search-CArmRKeg.js} +3 -3
- package/dist/_chunks/patient-shell-Coarf346.js +162 -0
- package/dist/_chunks/{payment-form-xmeCkxas.js → payment-form-DJ9vnzrT.js} +2 -2
- package/dist/_chunks/{pdf-viewer-q1D3Uion.js → pdf-viewer-4odMFuFW.js} +2 -2
- package/dist/_chunks/{practice-results-Cq1y8JFD.js → practice-results-CtfciF2v.js} +3 -3
- package/dist/_chunks/{pregnancy-dating-DT_244bG.js → pregnancy-dating-BA37LSkF.js} +15 -15
- package/dist/_chunks/{privacy-lock-BmX_gkvt.js → privacy-lock-BN3L-alb.js} +2 -2
- package/dist/_chunks/{public-footer.agent-okt8ZRc5.js → public-footer.agent-CfXuW1x6.js} +2 -2
- package/dist/_chunks/{recaptcha-widget-CFYyLSEX.js → recaptcha-widget-BCNHsgqt.js} +2 -2
- package/dist/_chunks/{sidebar-h78cTNLh.js → sidebar-DPEHzxLZ.js} +397 -346
- package/dist/_chunks/{sign-document-CZkAf28g.js → sign-document-Bzld9jVM.js} +2 -2
- package/dist/_chunks/{sign-in-with-alfadocs-button-CuYn_kKP.js → sign-in-with-alfadocs-button-BpAjVmsI.js} +2 -2
- package/dist/_chunks/{task-card-CPyQ5AXC.js → task-card-BwY9jaV1.js} +48 -42
- package/dist/_chunks/task-tray-Cb_hK4yb.js +234 -0
- package/dist/_chunks/{theme-toggle-ClATnY4Q.js → theme-toggle-DAW7uC0B.js} +3 -3
- package/dist/_chunks/use-edge-resize-ZnGG7gyO.js +139 -0
- package/dist/_chunks/use-theme-CAuo6EYT.js +159 -0
- package/dist/_chunks/{warning-stack-CXfoAT-_.js → warning-stack-Cv4fr5zo.js} +2 -2
- package/dist/_chunks/{workflow-map-DzX_LI4y.js → workflow-map-BJDUNYlX.js} +3 -3
- package/dist/agent-catalog.json +1 -1
- package/dist/brand/product-lockup/product-lockup.d.ts +47 -12
- package/dist/components/agenda-card/agenda-card.d.ts +19 -2
- package/dist/components/agenda-card/index.js +1 -1
- package/dist/components/agenda-tray/agenda-tray.d.ts +24 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/ai-consent-banner/index.js +1 -1
- package/dist/components/ai-tools-rail/ai-tools-rail.d.ts +8 -0
- package/dist/components/ai-tools-rail/index.js +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/button-group/button-group.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -0
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/form-field/form-field.d.ts +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/header-settings/index.js +1 -1
- package/dist/components/icon-button-group/icon-button-group.d.ts +15 -15
- package/dist/components/key-value-pair/key-value-pair.d.ts +1 -1
- package/dist/components/logo/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/privacy-lock/index.js +1 -1
- package/dist/components/public-footer/index.js +1 -1
- package/dist/components/radio-group/radio-group.d.ts +1 -1
- package/dist/components/recaptcha-widget/index.js +1 -1
- package/dist/components/separator/separator.d.ts +1 -1
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/sidebar/sidebar.d.ts +8 -0
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
- package/dist/components/tabs/tabs.d.ts +2 -2
- package/dist/components/task-card/index.js +1 -1
- package/dist/components/task-card/task-card.d.ts +15 -1
- package/dist/components/task-tray/index.js +1 -1
- package/dist/components/task-tray/task-tray.d.ts +24 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/components/workflow/workflow-map.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +12 -10
- package/dist/hooks/use-edge-resize.d.ts +78 -0
- package/dist/i18n/locales/ar.d.ts +4 -0
- package/dist/i18n/locales/ar.js +7 -3
- package/dist/i18n/locales/de.d.ts +4 -0
- package/dist/i18n/locales/de.js +7 -3
- package/dist/i18n/locales/el.d.ts +4 -0
- package/dist/i18n/locales/el.js +7 -3
- package/dist/i18n/locales/en.d.ts +4 -0
- package/dist/i18n/locales/en.js +7 -3
- package/dist/i18n/locales/es.d.ts +4 -0
- package/dist/i18n/locales/es.js +7 -3
- package/dist/i18n/locales/fr.d.ts +4 -0
- package/dist/i18n/locales/fr.js +7 -3
- package/dist/i18n/locales/hi.d.ts +4 -0
- package/dist/i18n/locales/hi.js +7 -3
- package/dist/i18n/locales/it.d.ts +4 -0
- package/dist/i18n/locales/it.js +7 -3
- package/dist/i18n/locales/ja.d.ts +4 -0
- package/dist/i18n/locales/ja.js +7 -3
- package/dist/i18n/locales/nl.d.ts +4 -0
- package/dist/i18n/locales/nl.js +7 -3
- package/dist/i18n/locales/pl.d.ts +4 -0
- package/dist/i18n/locales/pl.js +7 -3
- package/dist/i18n/locales/pt.d.ts +4 -0
- package/dist/i18n/locales/pt.js +7 -3
- package/dist/i18n/locales/ro.d.ts +4 -0
- package/dist/i18n/locales/ro.js +7 -3
- package/dist/i18n/locales/ru.d.ts +4 -0
- package/dist/i18n/locales/ru.js +7 -3
- package/dist/i18n/locales/sq.d.ts +4 -0
- package/dist/i18n/locales/sq.js +7 -3
- package/dist/i18n/locales/sv.d.ts +4 -0
- package/dist/i18n/locales/sv.js +7 -3
- package/dist/i18n/locales/tr.d.ts +4 -0
- package/dist/i18n/locales/tr.js +7 -3
- package/dist/i18n/locales/zh.d.ts +4 -0
- package/dist/i18n/locales/zh.js +7 -3
- package/dist/index.js +31 -31
- package/dist/locales/ar.json +7 -3
- package/dist/locales/de.json +7 -3
- package/dist/locales/el.json +7 -3
- package/dist/locales/en.json +7 -3
- package/dist/locales/es.json +7 -3
- package/dist/locales/fr.json +7 -3
- package/dist/locales/hi.json +7 -3
- package/dist/locales/it.json +7 -3
- package/dist/locales/ja.json +7 -3
- package/dist/locales/nl.json +7 -3
- package/dist/locales/pl.json +7 -3
- package/dist/locales/pt.json +7 -3
- package/dist/locales/ro.json +7 -3
- package/dist/locales/ru.json +7 -3
- package/dist/locales/sq.json +7 -3
- package/dist/locales/sv.json +7 -3
- package/dist/locales/tr.json +7 -3
- package/dist/locales/zh.json +7 -3
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +8 -6
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/agenda-tray-DQayYmQ0.js +0 -165
- package/dist/_chunks/ai-tools-rail-CYLWrRmm.js +0 -280
- package/dist/_chunks/circle-arrow-up-CC_85SuH.js +0 -16
- package/dist/_chunks/dropdown-menu-CUEXqKis.js +0 -299
- package/dist/_chunks/marketplace-app-shell-UKSLx9K_.js +0 -428
- package/dist/_chunks/patient-shell-DUmhXnFq.js +0 -174
- package/dist/_chunks/task-tray-B8jFv5FV.js +0 -196
- package/dist/_chunks/use-theme-C2dHKUAN.js +0 -145
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as j, useRef as v, useMemo as q, useImperativeHandle as z } from "react";
|
|
3
|
-
import { c as M } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as S } from "react-i18next";
|
|
5
|
-
import { I as C } from "./icon-button-CKEOrN37.js";
|
|
6
|
-
import { S as K } from "./skeleton-CZbwyJAA.js";
|
|
7
|
-
import { E } from "./empty-state-BLy7tigq.js";
|
|
8
|
-
import { T as L } from "./task-card-CPyQ5AXC.js";
|
|
9
|
-
import { u as P } from "./registry-nPAVE19X.js";
|
|
10
|
-
import { c as H } from "./createLucideIcon-CrFbzy84.js";
|
|
11
|
-
import { P as V } from "./plus-CYKNmfuA.js";
|
|
12
|
-
/**
|
|
13
|
-
* @license lucide-react v1.8.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/
|
|
18
|
-
const B = [
|
|
19
|
-
["path", { d: "M13 5h8", key: "a7qcls" }],
|
|
20
|
-
["path", { d: "M13 12h8", key: "h98zly" }],
|
|
21
|
-
["path", { d: "M13 19h8", key: "c3s6r1" }],
|
|
22
|
-
["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
|
|
23
|
-
["rect", { x: "3", y: "4", width: "6", height: "6", rx: "1", key: "cif1o7" }]
|
|
24
|
-
], F = H("list-todo", B), G = {
|
|
25
|
-
id: "task-tray",
|
|
26
|
-
capabilities: ["select_single", "dismiss"],
|
|
27
|
-
state: {
|
|
28
|
-
items: {
|
|
29
|
-
type: "Array<{ id: string; status: string }>",
|
|
30
|
-
descriptionKey: "ui.agent.taskTray.state.items",
|
|
31
|
-
description: "Currently-displayed tasks. Ids + status only — never task title / patient.",
|
|
32
|
-
read: (e) => e.getItems()
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
actions: {
|
|
36
|
-
select_item: {
|
|
37
|
-
safety: "read",
|
|
38
|
-
argsType: "{ id: string }",
|
|
39
|
-
descriptionKey: "ui.agent.taskTray.actions.selectItem",
|
|
40
|
-
description: "Activate the task with the given id.",
|
|
41
|
-
invoke: (e, s) => {
|
|
42
|
-
e.selectItem(s.id);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
toggle_done: {
|
|
46
|
-
safety: "write",
|
|
47
|
-
argsType: "{ id: string }",
|
|
48
|
-
descriptionKey: "ui.agent.taskTray.actions.toggleDone",
|
|
49
|
-
description: "Request the host to toggle the done state of a task.",
|
|
50
|
-
invoke: (e, s) => {
|
|
51
|
-
e.toggleDone(s.id);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
dismiss: {
|
|
55
|
-
safety: "destructive",
|
|
56
|
-
argsType: "{ id: string }",
|
|
57
|
-
descriptionKey: "ui.agent.taskTray.actions.dismiss",
|
|
58
|
-
description: "Request the host to dismiss / remove the task with the given id.",
|
|
59
|
-
invoke: (e, s) => {
|
|
60
|
-
e.dismiss(s.id);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
domHooks: {
|
|
65
|
-
root: {
|
|
66
|
-
attr: "data-component",
|
|
67
|
-
value: "task-tray",
|
|
68
|
-
description: "Marks the TaskTray wrapper."
|
|
69
|
-
},
|
|
70
|
-
instanceId: {
|
|
71
|
-
attr: "data-component-id",
|
|
72
|
-
sourceProp: "id",
|
|
73
|
-
description: "Sourced from the id prop. Required to address a specific tray from the agent."
|
|
74
|
-
},
|
|
75
|
-
item: {
|
|
76
|
-
attr: "data-task-id",
|
|
77
|
-
description: "Stable task id emitted on each rendered TaskCard inside the tray."
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, J = M(
|
|
81
|
-
[
|
|
82
|
-
"ds:flex ds:flex-col",
|
|
83
|
-
"ds:rounded-[var(--radius-md)] ds:shadow-[var(--shadow-card)]",
|
|
84
|
-
"ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2",
|
|
85
|
-
"ds:bg-[color:var(--card)] ds:text-[color:var(--card-foreground)]",
|
|
86
|
-
"ds:overflow-hidden"
|
|
87
|
-
].join(" "),
|
|
88
|
-
{
|
|
89
|
-
variants: {
|
|
90
|
-
size: {
|
|
91
|
-
sm: "",
|
|
92
|
-
md: ""
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
defaultVariants: {
|
|
96
|
-
size: "sm"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
), Q = j(
|
|
100
|
-
({
|
|
101
|
-
id: e,
|
|
102
|
-
items: s,
|
|
103
|
-
title: k,
|
|
104
|
-
size: f = "sm",
|
|
105
|
-
onOpenTask: i,
|
|
106
|
-
onToggleDone: n,
|
|
107
|
-
onDismissTask: c,
|
|
108
|
-
onAddTask: y,
|
|
109
|
-
addLabel: x,
|
|
110
|
-
loading: h = !1,
|
|
111
|
-
emptyTitle: b,
|
|
112
|
-
emptyDescription: w,
|
|
113
|
-
className: I,
|
|
114
|
-
...N
|
|
115
|
-
}, T) => {
|
|
116
|
-
const { t: l } = S(), u = k ?? l("taskTray.title", "Tasks"), R = x ?? l("taskTray.add", "Add task"), A = !h && s.length === 0;
|
|
117
|
-
let m;
|
|
118
|
-
h ? m = /* @__PURE__ */ a("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)]", children: [0, 1, 2].map((t) => /* @__PURE__ */ a(K, { variant: "rectangular", height: "2.5rem" }, t)) }) : A ? m = /* @__PURE__ */ a("div", { className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ a(
|
|
119
|
-
E,
|
|
120
|
-
{
|
|
121
|
-
variant: "first-use",
|
|
122
|
-
size: "sm",
|
|
123
|
-
title: b ?? l("taskTray.empty.title", "No tasks yet"),
|
|
124
|
-
description: w ?? l("taskTray.empty.description", "New tasks will appear here.")
|
|
125
|
-
}
|
|
126
|
-
) }) : m = /* @__PURE__ */ a("ul", { className: "ds:flex ds:list-none ds:flex-col", children: s.map((t) => /* @__PURE__ */ a(
|
|
127
|
-
L,
|
|
128
|
-
{
|
|
129
|
-
item: t,
|
|
130
|
-
size: f,
|
|
131
|
-
onActivate: i,
|
|
132
|
-
"data-task-id": t.id
|
|
133
|
-
},
|
|
134
|
-
t.id
|
|
135
|
-
)) });
|
|
136
|
-
const d = v(s);
|
|
137
|
-
d.current = s;
|
|
138
|
-
const _ = q(
|
|
139
|
-
() => ({
|
|
140
|
-
getItems: () => d.current.map((t) => ({
|
|
141
|
-
id: t.id,
|
|
142
|
-
status: t.status ?? "open"
|
|
143
|
-
})),
|
|
144
|
-
selectItem: (t) => {
|
|
145
|
-
const r = d.current.find((o) => o.id === t);
|
|
146
|
-
r && (i == null || i(r));
|
|
147
|
-
},
|
|
148
|
-
toggleDone: (t) => {
|
|
149
|
-
const r = d.current.find((o) => o.id === t);
|
|
150
|
-
r && (n == null || n(r));
|
|
151
|
-
},
|
|
152
|
-
dismiss: (t) => {
|
|
153
|
-
const r = d.current.find((o) => o.id === t);
|
|
154
|
-
r && (c == null || c(r));
|
|
155
|
-
}
|
|
156
|
-
}),
|
|
157
|
-
[i, n, c]
|
|
158
|
-
), g = v(null);
|
|
159
|
-
return z(T, () => g.current, []), P(G, _, e), /* @__PURE__ */ p(
|
|
160
|
-
"section",
|
|
161
|
-
{
|
|
162
|
-
ref: g,
|
|
163
|
-
"aria-label": u,
|
|
164
|
-
"data-component": "task-tray",
|
|
165
|
-
"data-component-id": e,
|
|
166
|
-
className: J({ size: f, className: I }),
|
|
167
|
-
...N,
|
|
168
|
-
children: [
|
|
169
|
-
/* @__PURE__ */ p("header", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)]", children: [
|
|
170
|
-
/* @__PURE__ */ p("h3", { className: "ds:m-0 ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-title-card", children: [
|
|
171
|
-
/* @__PURE__ */ a(F, { "aria-hidden": "true", className: "ds:size-4" }),
|
|
172
|
-
u
|
|
173
|
-
] }),
|
|
174
|
-
y ? /* @__PURE__ */ a(
|
|
175
|
-
C,
|
|
176
|
-
{
|
|
177
|
-
icon: /* @__PURE__ */ a(V, {}),
|
|
178
|
-
intent: "outline",
|
|
179
|
-
size: "sm",
|
|
180
|
-
"aria-label": R,
|
|
181
|
-
onClick: y
|
|
182
|
-
}
|
|
183
|
-
) : null
|
|
184
|
-
] }),
|
|
185
|
-
m
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
Q.displayName = "TaskTray";
|
|
192
|
-
export {
|
|
193
|
-
Q as T,
|
|
194
|
-
G as t
|
|
195
|
-
};
|
|
196
|
-
//# sourceMappingURL=task-tray-B8jFv5FV.js.map
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore as D, useEffect as b, useCallback as p } from "react";
|
|
2
|
-
const y = "alfadocs-ui.theme", w = "alfadocs-ui.accessibility", r = {
|
|
3
|
-
light: "theme-light",
|
|
4
|
-
dark: "theme-dark",
|
|
5
|
-
accessible: "theme-accessible"
|
|
6
|
-
}, M = "(prefers-color-scheme: dark)", C = "(prefers-contrast: more)";
|
|
7
|
-
function g(e) {
|
|
8
|
-
if (typeof window > "u") return null;
|
|
9
|
-
try {
|
|
10
|
-
return window.localStorage.getItem(e);
|
|
11
|
-
} catch {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function S(e, t) {
|
|
16
|
-
if (!(typeof window > "u"))
|
|
17
|
-
try {
|
|
18
|
-
t === null ? window.localStorage.removeItem(e) : window.localStorage.setItem(e, t);
|
|
19
|
-
} catch {
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function L(e) {
|
|
23
|
-
return e === "light" || e === "dark" || e === "system";
|
|
24
|
-
}
|
|
25
|
-
function T(e) {
|
|
26
|
-
return e === "default" || e === "accessible" || e === "system";
|
|
27
|
-
}
|
|
28
|
-
function O() {
|
|
29
|
-
const e = g(y), t = g(w), i = typeof window < "u" && typeof window.matchMedia == "function", s = typeof document < "u" ? document.documentElement.classList : null, A = s ? s.contains(r.dark) ? "dark" : s.contains(r.light) ? "light" : null : null, _ = s != null && s.contains(r.accessible) ? "accessible" : null;
|
|
30
|
-
return {
|
|
31
|
-
theme: L(e) ? e : A ?? "system",
|
|
32
|
-
accessibility: T(t) ? t : _ ?? "system",
|
|
33
|
-
prefersDark: i ? window.matchMedia(M).matches : !1,
|
|
34
|
-
prefersMoreContrast: i ? window.matchMedia(C).matches : !1
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
let n = O();
|
|
38
|
-
const h = /* @__PURE__ */ new Set();
|
|
39
|
-
function c(e) {
|
|
40
|
-
e.theme === n.theme && e.accessibility === n.accessibility && e.prefersDark === n.prefersDark && e.prefersMoreContrast === n.prefersMoreContrast || (n = e, h.forEach((t) => t()));
|
|
41
|
-
}
|
|
42
|
-
function I(e) {
|
|
43
|
-
return h.add(e), () => {
|
|
44
|
-
h.delete(e);
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function R() {
|
|
48
|
-
return n;
|
|
49
|
-
}
|
|
50
|
-
function V() {
|
|
51
|
-
return {
|
|
52
|
-
theme: "system",
|
|
53
|
-
accessibility: "system",
|
|
54
|
-
prefersDark: !1,
|
|
55
|
-
prefersMoreContrast: !1
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
let d = 0, u = null, f = null, l = null;
|
|
59
|
-
function v(e) {
|
|
60
|
-
c({ ...n, prefersDark: e.matches });
|
|
61
|
-
}
|
|
62
|
-
function H(e) {
|
|
63
|
-
c({ ...n, prefersMoreContrast: e.matches });
|
|
64
|
-
}
|
|
65
|
-
function Y(e) {
|
|
66
|
-
if (e.key === y) {
|
|
67
|
-
const t = L(e.newValue) ? e.newValue : "system";
|
|
68
|
-
c({ ...n, theme: t });
|
|
69
|
-
} else if (e.key === w) {
|
|
70
|
-
const t = T(e.newValue) ? e.newValue : "system";
|
|
71
|
-
c({ ...n, accessibility: t });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function E(e, t) {
|
|
75
|
-
return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : (e.addListener(t), () => e.removeListener(t));
|
|
76
|
-
}
|
|
77
|
-
function G() {
|
|
78
|
-
return d += 1, d > 1 || typeof window > "u" || (typeof window.matchMedia == "function" && (u = window.matchMedia(M), f = window.matchMedia(C), c({
|
|
79
|
-
...n,
|
|
80
|
-
prefersDark: u.matches,
|
|
81
|
-
prefersMoreContrast: f.matches
|
|
82
|
-
}), o = E(u, v), a = E(f, H)), l = Y, window.addEventListener("storage", l)), m;
|
|
83
|
-
}
|
|
84
|
-
let o = null, a = null;
|
|
85
|
-
function m() {
|
|
86
|
-
d -= 1, !(d > 0) && (o == null || o(), a == null || a(), o = null, a = null, u = null, f = null, l && typeof window < "u" && window.removeEventListener("storage", l), l = null);
|
|
87
|
-
}
|
|
88
|
-
function k(e) {
|
|
89
|
-
const t = e.theme === "system" ? e.prefersDark ? "dark" : "light" : e.theme, i = e.accessibility === "system" ? e.prefersMoreContrast : e.accessibility === "accessible";
|
|
90
|
-
return t === "dark" && i ? "dark-accessible" : t === "dark" ? "dark" : i ? "light-accessible" : "light";
|
|
91
|
-
}
|
|
92
|
-
function K(e) {
|
|
93
|
-
switch (e) {
|
|
94
|
-
case "light":
|
|
95
|
-
return [r.light];
|
|
96
|
-
case "dark":
|
|
97
|
-
return [r.dark];
|
|
98
|
-
case "light-accessible":
|
|
99
|
-
return [r.light, r.accessible];
|
|
100
|
-
case "dark-accessible":
|
|
101
|
-
return [r.dark, r.accessible];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
const Q = [
|
|
105
|
-
r.light,
|
|
106
|
-
r.dark,
|
|
107
|
-
r.accessible
|
|
108
|
-
];
|
|
109
|
-
function U(e) {
|
|
110
|
-
if (typeof document > "u") return;
|
|
111
|
-
const t = document.documentElement, i = new Set(K(e));
|
|
112
|
-
Q.forEach((s) => {
|
|
113
|
-
i.has(s) ? t.classList.add(s) : t.classList.remove(s);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function N() {
|
|
117
|
-
const e = D(I, R, V);
|
|
118
|
-
b(() => G(), []), b(() => {
|
|
119
|
-
U(k(e));
|
|
120
|
-
}, [e]);
|
|
121
|
-
const t = p((s) => {
|
|
122
|
-
S(y, s === "system" ? null : s), c({ ...n, theme: s });
|
|
123
|
-
}, []), i = p((s) => {
|
|
124
|
-
S(
|
|
125
|
-
w,
|
|
126
|
-
s === "system" ? null : s
|
|
127
|
-
), c({ ...n, accessibility: s });
|
|
128
|
-
}, []);
|
|
129
|
-
return {
|
|
130
|
-
theme: e.theme,
|
|
131
|
-
accessibility: e.accessibility,
|
|
132
|
-
resolvedTheme: k(e),
|
|
133
|
-
setTheme: t,
|
|
134
|
-
setAccessibility: i
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
export {
|
|
138
|
-
w as A,
|
|
139
|
-
r as T,
|
|
140
|
-
y as a,
|
|
141
|
-
k as r,
|
|
142
|
-
K as t,
|
|
143
|
-
N as u
|
|
144
|
-
};
|
|
145
|
-
//# sourceMappingURL=use-theme-C2dHKUAN.js.map
|