@orion-ds/react 5.2.0 → 5.3.1
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 +1 -5
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.mjs +86 -80
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.d.ts.map +1 -1
- package/dist/components/Chart/Chart.mjs +101 -121
- package/dist/components/CodeEditor/CodeEditor.cjs +6 -6
- package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeEditor/CodeEditor.mjs +130 -127
- package/dist/components/CollapsibleFolder/CollapsibleFolder.cjs +1 -1
- package/dist/components/CollapsibleFolder/CollapsibleFolder.d.ts.map +1 -1
- package/dist/components/CollapsibleFolder/CollapsibleFolder.mjs +110 -106
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +81 -77
- package/dist/components/ThemeController/ThemeController.cjs +1 -1
- package/dist/components/ThemeController/ThemeController.d.ts.map +1 -1
- package/dist/components/ThemeController/ThemeController.mjs +21 -26
- package/dist/tokens/types.d.ts +77 -33
- package/dist/tokens/types.d.ts.map +1 -1
- package/dist/utils/optionalDeps.cjs +1 -1
- package/dist/utils/optionalDeps.d.ts +24 -6
- package/dist/utils/optionalDeps.d.ts.map +1 -1
- package/dist/utils/optionalDeps.mjs +40 -21
- package/package.json +1 -1
|
@@ -1,98 +1,102 @@
|
|
|
1
1
|
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { MissingDependencyError as
|
|
2
|
+
import se, { useState as s, useRef as de, useEffect as ce } from "react";
|
|
3
|
+
import { ChevronDown as z, MoreHorizontal as me } from "lucide-react";
|
|
4
|
+
import { MissingDependencyError as pe } from "../MissingDependencyError.mjs";
|
|
5
|
+
import { checkComponent as fe } from "../../utils/optionalDeps.mjs";
|
|
5
6
|
import r from "./CollapsibleFolder.module.css.mjs";
|
|
6
|
-
import { Collapsible as
|
|
7
|
-
import { Badge as
|
|
8
|
-
import { Dropdown as
|
|
9
|
-
import { Button as
|
|
10
|
-
let
|
|
7
|
+
import { Collapsible as D } from "../Collapsible/Collapsible.mjs";
|
|
8
|
+
import { Badge as ge } from "../Badge/Badge.mjs";
|
|
9
|
+
import { Dropdown as A } from "../Dropdown/Dropdown.mjs";
|
|
10
|
+
import { Button as O } from "../Button/Button.mjs";
|
|
11
|
+
let B;
|
|
11
12
|
try {
|
|
12
|
-
|
|
13
|
-
} catch
|
|
14
|
-
O = l instanceof Error ? l : new Error("@dnd-kit/core not found");
|
|
13
|
+
B = require("@dnd-kit/core").useDroppable;
|
|
14
|
+
} catch {
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
if (O)
|
|
18
|
-
return /* @__PURE__ */ t(
|
|
19
|
-
se,
|
|
20
|
-
{
|
|
21
|
-
available: !1,
|
|
22
|
-
componentName: "CollapsibleFolder",
|
|
23
|
-
depName: ["@dnd-kit/core", "@dnd-kit/sortable", "@dnd-kit/utilities"],
|
|
24
|
-
installCommand: "npm install @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities",
|
|
25
|
-
pnpmCommand: "pnpm add @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities",
|
|
26
|
-
docsUrl: "https://docs.orion-ds.dev/components/collapsible-folder"
|
|
27
|
-
}
|
|
28
|
-
);
|
|
16
|
+
function he(p) {
|
|
29
17
|
const {
|
|
30
|
-
id:
|
|
31
|
-
title:
|
|
32
|
-
itemCount:
|
|
18
|
+
id: f,
|
|
19
|
+
title: j,
|
|
20
|
+
itemCount: b,
|
|
33
21
|
items: i,
|
|
34
|
-
renderItem:
|
|
35
|
-
itemLabel:
|
|
36
|
-
itemLabelPlural:
|
|
37
|
-
emptyText:
|
|
38
|
-
sortLabel:
|
|
39
|
-
defaultExpanded:
|
|
22
|
+
renderItem: $,
|
|
23
|
+
itemLabel: q = "Item",
|
|
24
|
+
itemLabelPlural: K = "Items",
|
|
25
|
+
emptyText: M = "No items in this folder",
|
|
26
|
+
sortLabel: N = "Sort",
|
|
27
|
+
defaultExpanded: P = !0,
|
|
40
28
|
sortOptions: d,
|
|
41
29
|
selectedSort: Y,
|
|
42
30
|
onSortChange: H,
|
|
43
|
-
onDrop:
|
|
44
|
-
onFolderEdit:
|
|
45
|
-
onFolderDelete:
|
|
31
|
+
onDrop: C,
|
|
32
|
+
onFolderEdit: y,
|
|
33
|
+
onFolderDelete: I,
|
|
46
34
|
onFolderInvite: T,
|
|
47
|
-
isDropTarget:
|
|
48
|
-
isDropCompleted:
|
|
49
|
-
onDragEnter:
|
|
35
|
+
isDropTarget: Z = !1,
|
|
36
|
+
isDropCompleted: G = !1,
|
|
37
|
+
onDragEnter: J,
|
|
50
38
|
onDragLeaveFolder: x,
|
|
51
|
-
className:
|
|
52
|
-
...
|
|
53
|
-
} =
|
|
54
|
-
|
|
39
|
+
className: Q,
|
|
40
|
+
...U
|
|
41
|
+
} = p, [L, g] = s(), [V, W] = s(!0), [h, X] = s(P), [u, c] = s(null), [E, v] = s(!1), k = de(null), { setNodeRef: _ } = B({ id: f });
|
|
42
|
+
if (ce(() => {
|
|
43
|
+
(async () => {
|
|
44
|
+
try {
|
|
45
|
+
const n = fe("CollapsibleFolder");
|
|
46
|
+
n instanceof Promise ? g(await n) : g(n);
|
|
47
|
+
} catch {
|
|
48
|
+
g(void 0);
|
|
49
|
+
} finally {
|
|
50
|
+
W(!1);
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
}, []), L)
|
|
54
|
+
return /* @__PURE__ */ t(pe, { ...L });
|
|
55
|
+
if (V)
|
|
56
|
+
return /* @__PURE__ */ t("div", { children: "Loading folder..." });
|
|
57
|
+
const ee = (e) => {
|
|
58
|
+
if (e.preventDefault(), e.dataTransfer.dropEffect = "move", E || (v(!0), J?.()), !h || i.length === 0) {
|
|
55
59
|
c(0);
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
58
|
-
const n =
|
|
62
|
+
const n = k.current;
|
|
59
63
|
if (!n) return;
|
|
60
64
|
const o = Array.from(
|
|
61
65
|
n.querySelectorAll("[data-item-id]")
|
|
62
|
-
),
|
|
63
|
-
let
|
|
66
|
+
), le = e.clientY;
|
|
67
|
+
let S = o.length;
|
|
64
68
|
for (let m = 0; m < o.length; m++) {
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
|
|
69
|
+
const R = o[m];
|
|
70
|
+
if (!R) continue;
|
|
71
|
+
const w = R.getBoundingClientRect();
|
|
72
|
+
if (le < w.top + w.height / 2) {
|
|
73
|
+
S = m;
|
|
70
74
|
break;
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
|
-
c(
|
|
74
|
-
},
|
|
75
|
-
e.currentTarget.contains(e.relatedTarget) || (
|
|
76
|
-
},
|
|
77
|
+
c(S);
|
|
78
|
+
}, te = (e) => {
|
|
79
|
+
e.currentTarget.contains(e.relatedTarget) || (v(!1), c(null), x?.());
|
|
80
|
+
}, re = (e) => {
|
|
77
81
|
e.preventDefault();
|
|
78
82
|
const n = e.dataTransfer.getData("text/plain") || e.dataTransfer.getData("itemId");
|
|
79
|
-
if (n &&
|
|
80
|
-
const o =
|
|
81
|
-
|
|
83
|
+
if (n && C) {
|
|
84
|
+
const o = u ?? i.length;
|
|
85
|
+
C(n, f, o);
|
|
82
86
|
}
|
|
83
|
-
|
|
84
|
-
},
|
|
87
|
+
v(!1), c(null), x?.();
|
|
88
|
+
}, ne = (e, n) => {
|
|
85
89
|
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", n);
|
|
86
|
-
},
|
|
90
|
+
}, ae = d?.map((e) => ({
|
|
87
91
|
id: e.value,
|
|
88
92
|
label: e.label,
|
|
89
93
|
onClick: () => H?.(e.value)
|
|
90
|
-
})),
|
|
91
|
-
...
|
|
94
|
+
})), F = [
|
|
95
|
+
...y ? [
|
|
92
96
|
{
|
|
93
97
|
id: "rename",
|
|
94
98
|
label: "Rename",
|
|
95
|
-
onClick:
|
|
99
|
+
onClick: y
|
|
96
100
|
}
|
|
97
101
|
] : [],
|
|
98
102
|
...T ? [
|
|
@@ -102,90 +106,90 @@ function ce(l) {
|
|
|
102
106
|
onClick: T
|
|
103
107
|
}
|
|
104
108
|
] : [],
|
|
105
|
-
...
|
|
109
|
+
...I ? [
|
|
106
110
|
{
|
|
107
111
|
id: "delete",
|
|
108
112
|
label: "Delete folder",
|
|
109
113
|
danger: !0,
|
|
110
|
-
onClick:
|
|
114
|
+
onClick: I
|
|
111
115
|
}
|
|
112
116
|
] : []
|
|
113
|
-
],
|
|
117
|
+
], l = Z || E, oe = [
|
|
114
118
|
r.folder,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
].filter(Boolean).join(" "),
|
|
119
|
+
l && r.dropTarget,
|
|
120
|
+
G && r.dropCompleted,
|
|
121
|
+
Q
|
|
122
|
+
].filter(Boolean).join(" "), ie = b === 1 ? q : K;
|
|
119
123
|
return /* @__PURE__ */ t(
|
|
120
124
|
"div",
|
|
121
125
|
{
|
|
122
|
-
ref:
|
|
123
|
-
className:
|
|
124
|
-
"data-folder-id":
|
|
125
|
-
"data-drop-active":
|
|
126
|
-
onDragOver:
|
|
127
|
-
onDragLeave:
|
|
128
|
-
onDrop:
|
|
129
|
-
...
|
|
130
|
-
children: /* @__PURE__ */ a(
|
|
126
|
+
ref: _,
|
|
127
|
+
className: oe,
|
|
128
|
+
"data-folder-id": f,
|
|
129
|
+
"data-drop-active": l,
|
|
130
|
+
onDragOver: ee,
|
|
131
|
+
onDragLeave: te,
|
|
132
|
+
onDrop: re,
|
|
133
|
+
...U,
|
|
134
|
+
children: /* @__PURE__ */ a(D, { open: h, onOpenChange: X, children: [
|
|
131
135
|
/* @__PURE__ */ a("div", { className: r.header, children: [
|
|
132
|
-
/* @__PURE__ */ a(
|
|
136
|
+
/* @__PURE__ */ a(D.Trigger, { className: r.trigger, children: [
|
|
133
137
|
/* @__PURE__ */ t(
|
|
134
|
-
|
|
138
|
+
z,
|
|
135
139
|
{
|
|
136
140
|
size: 20,
|
|
137
|
-
className: `${r.chevron} ${
|
|
141
|
+
className: `${r.chevron} ${h ? r.expanded : ""}`
|
|
138
142
|
}
|
|
139
143
|
),
|
|
140
|
-
/* @__PURE__ */ t("h2", { className: r.title, children:
|
|
141
|
-
/* @__PURE__ */ a(
|
|
142
|
-
|
|
144
|
+
/* @__PURE__ */ t("h2", { className: r.title, children: j }),
|
|
145
|
+
/* @__PURE__ */ a(ge, { variant: "secondary", className: r.badge, children: [
|
|
146
|
+
b,
|
|
143
147
|
/* @__PURE__ */ a("span", { className: r.badgeLabel, children: [
|
|
144
148
|
" ",
|
|
145
|
-
|
|
149
|
+
ie
|
|
146
150
|
] })
|
|
147
151
|
] })
|
|
148
152
|
] }),
|
|
149
153
|
/* @__PURE__ */ a("div", { className: r.actions, children: [
|
|
150
154
|
d && d.length > 0 && /* @__PURE__ */ t("div", { className: r.sortDropdown, children: /* @__PURE__ */ t(
|
|
151
|
-
|
|
155
|
+
A,
|
|
152
156
|
{
|
|
153
157
|
trigger: /* @__PURE__ */ t(
|
|
154
|
-
|
|
158
|
+
O,
|
|
155
159
|
{
|
|
156
160
|
variant: "ghost",
|
|
157
161
|
size: "sm",
|
|
158
|
-
iconRight: /* @__PURE__ */ t(
|
|
159
|
-
"aria-label": `Sort by ${
|
|
160
|
-
children: d.find((e) => e.value === Y)?.label ||
|
|
162
|
+
iconRight: /* @__PURE__ */ t(z, { size: 16 }),
|
|
163
|
+
"aria-label": `Sort by ${N}`,
|
|
164
|
+
children: d.find((e) => e.value === Y)?.label || N
|
|
161
165
|
}
|
|
162
166
|
),
|
|
163
|
-
items:
|
|
167
|
+
items: ae,
|
|
164
168
|
placement: "bottom-end"
|
|
165
169
|
}
|
|
166
170
|
) }),
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
F.length > 0 && /* @__PURE__ */ t(
|
|
172
|
+
A,
|
|
169
173
|
{
|
|
170
174
|
trigger: /* @__PURE__ */ t(
|
|
171
|
-
|
|
175
|
+
O,
|
|
172
176
|
{
|
|
173
177
|
variant: "ghost",
|
|
174
178
|
size: "sm",
|
|
175
179
|
iconOnly: !0,
|
|
176
|
-
icon: /* @__PURE__ */ t(
|
|
180
|
+
icon: /* @__PURE__ */ t(me, { size: 20 }),
|
|
177
181
|
"aria-label": "Folder actions"
|
|
178
182
|
}
|
|
179
183
|
),
|
|
180
|
-
items:
|
|
184
|
+
items: F,
|
|
181
185
|
placement: "bottom-end"
|
|
182
186
|
}
|
|
183
187
|
)
|
|
184
188
|
] })
|
|
185
189
|
] }),
|
|
186
|
-
/* @__PURE__ */ t(
|
|
187
|
-
i.map((e, n) => /* @__PURE__ */ a(
|
|
188
|
-
|
|
190
|
+
/* @__PURE__ */ t(D.Content, { children: /* @__PURE__ */ t("div", { className: r.content, children: i.length === 0 ? l ? /* @__PURE__ */ t("div", { className: r.emptyDropZone, children: /* @__PURE__ */ t("div", { className: r.insertionLine, role: "presentation" }) }) : /* @__PURE__ */ t("div", { className: r.emptyState, children: /* @__PURE__ */ t("p", { className: r.emptyText, children: M }) }) : /* @__PURE__ */ a("div", { className: r.grid, ref: k, children: [
|
|
191
|
+
i.map((e, n) => /* @__PURE__ */ a(se.Fragment, { children: [
|
|
192
|
+
l && u === n && /* @__PURE__ */ t(
|
|
189
193
|
"div",
|
|
190
194
|
{
|
|
191
195
|
className: r.insertionLine,
|
|
@@ -197,18 +201,18 @@ function ce(l) {
|
|
|
197
201
|
{
|
|
198
202
|
"data-item-id": e.id,
|
|
199
203
|
draggable: e.draggable,
|
|
200
|
-
onDragStart: (o) =>
|
|
201
|
-
children:
|
|
204
|
+
onDragStart: (o) => ne(o, e.id),
|
|
205
|
+
children: $(e, n)
|
|
202
206
|
}
|
|
203
207
|
)
|
|
204
208
|
] }, e.id)),
|
|
205
|
-
|
|
209
|
+
l && u === i.length && /* @__PURE__ */ t("div", { className: r.insertionLine, role: "presentation" })
|
|
206
210
|
] }) }) })
|
|
207
211
|
] })
|
|
208
212
|
}
|
|
209
213
|
);
|
|
210
214
|
}
|
|
211
|
-
|
|
215
|
+
he.displayName = "CollapsibleFolder";
|
|
212
216
|
export {
|
|
213
|
-
|
|
217
|
+
he as CollapsibleFolder
|
|
214
218
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),R=require("lucide-react"),I=require("../MissingDependencyError.cjs"),T=require("../../utils/optionalDeps.cjs"),l=require("./DatePicker.module.css.cjs"),C=require("../Calendar/Calendar.cjs"),$=require("../Popover/Popover.cjs"),z=require("../Button/Button.cjs");let o;try{o=require("date-fns").format}catch{}const S=e=>{const{mode:a="single",min:k,max:v,disabledDates:P,placeholder:m="Pick a date",presets:d,format:c="PPP",disabled:b=!1,triggerClassName:D,className:y}=e,[g,u]=r.useState(),[N,q]=r.useState(!0),[w,i]=r.useState(!1),h=r.useMemo(()=>a==="single"&&e.mode!=="range"?e.selected?o(e.selected,c):null:a==="range"&&e.mode==="range"&&e.selected?.from?e.selected.to?`${o(e.selected.from,c)} - ${o(e.selected.to,c)}`:o(e.selected.from,c):null,[a,e,c]),j=r.useCallback(s=>{if(a==="single"&&e.mode!=="range"){const n=e.onSelect;n?.(s),i(!1)}else if(a==="range"&&e.mode==="range"){const n=e.onSelect,f=s;n?.(f),f?.from&&f?.to&&i(!1)}},[a,e]),B=r.useCallback(s=>{if(a==="single"&&e.mode!=="range"){const n=e.onSelect;n?.(s.value)}else if(a==="range"&&e.mode==="range"){const n=e.onSelect;n?.(s.value)}i(!1)},[a,e]);if(r.useEffect(()=>{(async()=>{try{const n=T.checkComponent("DatePicker");n instanceof Promise?u(await n):u(n)}catch{u(void 0)}finally{q(!1)}})()},[]),g)return t.jsx(I.MissingDependencyError,{...g});if(N)return t.jsx("div",{children:"Loading date picker..."});const E=[l.default.trigger,D].filter(Boolean).join(" "),M=[l.default.wrapper,y].filter(Boolean).join(" "),x={min:k,max:v,disabled:P},F=t.jsxs("div",{className:l.default.popoverContent,children:[d&&d.length>0&&t.jsx("div",{className:l.default.presets,children:d.map(s=>t.jsx("button",{type:"button",className:l.default.presetButton,onClick:()=>B(s),children:s.label},s.label))}),a==="single"?t.jsx(C.Calendar,{mode:"single",selected:e.mode!=="range"?e.selected:void 0,onSelect:j,...x}):t.jsx(C.Calendar,{mode:"range",selected:e.mode==="range"?e.selected:void 0,onSelect:j,...x})]}),O=t.jsx(z.Button,{variant:"secondary",className:E,disabled:b,"aria-label":m,icon:t.jsx(R.Calendar,{size:16,className:l.default.triggerIcon}),children:h?t.jsx("span",{children:h}):t.jsx("span",{className:l.default.placeholder,children:m})});return t.jsx("div",{className:M,children:t.jsx($.Popover,{trigger:O,content:F,placement:"bottom-start",open:w,onOpenChange:i,showArrow:!1,offset:4,className:l.default.popover})})};S.displayName="DatePicker";exports.DatePicker=S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAoD,MAAM,OAAO,CAAC;AAWzE,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAc5E,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0LhD,CAAC"}
|
|
@@ -1,114 +1,118 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Calendar as
|
|
4
|
-
import { MissingDependencyError as
|
|
1
|
+
import { jsx as n, jsxs as O } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useMemo as q, useCallback as k, useEffect as z } from "react";
|
|
3
|
+
import { Calendar as A } from "lucide-react";
|
|
4
|
+
import { MissingDependencyError as L } from "../MissingDependencyError.mjs";
|
|
5
|
+
import { checkComponent as T } from "../../utils/optionalDeps.mjs";
|
|
5
6
|
import l from "./DatePicker.module.css.mjs";
|
|
6
|
-
import { Calendar as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Button as
|
|
9
|
-
let s
|
|
7
|
+
import { Calendar as S } from "../Calendar/Calendar.mjs";
|
|
8
|
+
import { Popover as G } from "../Popover/Popover.mjs";
|
|
9
|
+
import { Button as H } from "../Button/Button.mjs";
|
|
10
|
+
let s;
|
|
10
11
|
try {
|
|
11
12
|
s = require("date-fns").format;
|
|
12
|
-
} catch
|
|
13
|
-
C = e instanceof Error ? e : new Error("date-fns not found");
|
|
13
|
+
} catch {
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
if (C)
|
|
17
|
-
return /* @__PURE__ */ n(
|
|
18
|
-
q,
|
|
19
|
-
{
|
|
20
|
-
available: !1,
|
|
21
|
-
componentName: "DatePicker",
|
|
22
|
-
depName: "date-fns",
|
|
23
|
-
installCommand: "npm install date-fns",
|
|
24
|
-
pnpmCommand: "pnpm add date-fns",
|
|
25
|
-
docsUrl: "https://docs.orion-ds.dev/components/date-picker"
|
|
26
|
-
}
|
|
27
|
-
);
|
|
15
|
+
const J = (e) => {
|
|
28
16
|
const {
|
|
29
|
-
mode:
|
|
17
|
+
mode: a = "single",
|
|
30
18
|
min: N,
|
|
31
|
-
max:
|
|
19
|
+
max: P,
|
|
32
20
|
disabledDates: b,
|
|
33
|
-
placeholder:
|
|
34
|
-
presets:
|
|
35
|
-
format:
|
|
36
|
-
disabled:
|
|
37
|
-
triggerClassName:
|
|
38
|
-
className:
|
|
39
|
-
} = e, [
|
|
40
|
-
(
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
} else if (
|
|
45
|
-
const
|
|
46
|
-
|
|
21
|
+
placeholder: g = "Pick a date",
|
|
22
|
+
presets: i,
|
|
23
|
+
format: o = "PPP",
|
|
24
|
+
disabled: y = !1,
|
|
25
|
+
triggerClassName: D,
|
|
26
|
+
className: w
|
|
27
|
+
} = e, [u, d] = f(), [x, j] = f(!0), [B, c] = f(!1), h = q(() => a === "single" && e.mode !== "range" ? e.selected ? s(e.selected, o) : null : a === "range" && e.mode === "range" && e.selected?.from ? e.selected.to ? `${s(e.selected.from, o)} - ${s(e.selected.to, o)}` : s(e.selected.from, o) : null, [a, e, o]), C = k(
|
|
28
|
+
(r) => {
|
|
29
|
+
if (a === "single" && e.mode !== "range") {
|
|
30
|
+
const t = e.onSelect;
|
|
31
|
+
t?.(r), c(!1);
|
|
32
|
+
} else if (a === "range" && e.mode === "range") {
|
|
33
|
+
const t = e.onSelect, m = r;
|
|
34
|
+
t?.(m), m?.from && m?.to && c(!1);
|
|
47
35
|
}
|
|
48
36
|
},
|
|
49
|
-
[
|
|
50
|
-
),
|
|
51
|
-
(
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
} else if (
|
|
56
|
-
const
|
|
57
|
-
|
|
37
|
+
[a, e]
|
|
38
|
+
), E = k(
|
|
39
|
+
(r) => {
|
|
40
|
+
if (a === "single" && e.mode !== "range") {
|
|
41
|
+
const t = e.onSelect;
|
|
42
|
+
t?.(r.value);
|
|
43
|
+
} else if (a === "range" && e.mode === "range") {
|
|
44
|
+
const t = e.onSelect;
|
|
45
|
+
t?.(r.value);
|
|
58
46
|
}
|
|
59
47
|
c(!1);
|
|
60
48
|
},
|
|
61
|
-
[
|
|
62
|
-
)
|
|
49
|
+
[a, e]
|
|
50
|
+
);
|
|
51
|
+
if (z(() => {
|
|
52
|
+
(async () => {
|
|
53
|
+
try {
|
|
54
|
+
const t = T("DatePicker");
|
|
55
|
+
t instanceof Promise ? d(await t) : d(t);
|
|
56
|
+
} catch {
|
|
57
|
+
d(void 0);
|
|
58
|
+
} finally {
|
|
59
|
+
j(!1);
|
|
60
|
+
}
|
|
61
|
+
})();
|
|
62
|
+
}, []), u)
|
|
63
|
+
return /* @__PURE__ */ n(L, { ...u });
|
|
64
|
+
if (x)
|
|
65
|
+
return /* @__PURE__ */ n("div", { children: "Loading date picker..." });
|
|
66
|
+
const F = [l.trigger, D].filter(Boolean).join(" "), $ = [l.wrapper, w].filter(Boolean).join(" "), v = {
|
|
63
67
|
min: N,
|
|
64
|
-
max:
|
|
68
|
+
max: P,
|
|
65
69
|
disabled: b
|
|
66
|
-
},
|
|
67
|
-
|
|
70
|
+
}, I = /* @__PURE__ */ O("div", { className: l.popoverContent, children: [
|
|
71
|
+
i && i.length > 0 && /* @__PURE__ */ n("div", { className: l.presets, children: i.map((r) => /* @__PURE__ */ n(
|
|
68
72
|
"button",
|
|
69
73
|
{
|
|
70
74
|
type: "button",
|
|
71
75
|
className: l.presetButton,
|
|
72
|
-
onClick: () =>
|
|
73
|
-
children:
|
|
76
|
+
onClick: () => E(r),
|
|
77
|
+
children: r.label
|
|
74
78
|
},
|
|
75
|
-
|
|
79
|
+
r.label
|
|
76
80
|
)) }),
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
a === "single" ? /* @__PURE__ */ n(
|
|
82
|
+
S,
|
|
79
83
|
{
|
|
80
84
|
mode: "single",
|
|
81
85
|
selected: e.mode !== "range" ? e.selected : void 0,
|
|
82
|
-
onSelect:
|
|
83
|
-
...
|
|
86
|
+
onSelect: C,
|
|
87
|
+
...v
|
|
84
88
|
}
|
|
85
89
|
) : /* @__PURE__ */ n(
|
|
86
|
-
|
|
90
|
+
S,
|
|
87
91
|
{
|
|
88
92
|
mode: "range",
|
|
89
93
|
selected: e.mode === "range" ? e.selected : void 0,
|
|
90
|
-
onSelect:
|
|
91
|
-
...
|
|
94
|
+
onSelect: C,
|
|
95
|
+
...v
|
|
92
96
|
}
|
|
93
97
|
)
|
|
94
|
-
] }),
|
|
95
|
-
|
|
98
|
+
] }), M = /* @__PURE__ */ n(
|
|
99
|
+
H,
|
|
96
100
|
{
|
|
97
101
|
variant: "secondary",
|
|
98
|
-
className:
|
|
99
|
-
disabled:
|
|
100
|
-
"aria-label":
|
|
101
|
-
icon: /* @__PURE__ */ n(
|
|
102
|
-
children:
|
|
102
|
+
className: F,
|
|
103
|
+
disabled: y,
|
|
104
|
+
"aria-label": g,
|
|
105
|
+
icon: /* @__PURE__ */ n(A, { size: 16, className: l.triggerIcon }),
|
|
106
|
+
children: h ? /* @__PURE__ */ n("span", { children: h }) : /* @__PURE__ */ n("span", { className: l.placeholder, children: g })
|
|
103
107
|
}
|
|
104
108
|
);
|
|
105
|
-
return /* @__PURE__ */ n("div", { className:
|
|
106
|
-
|
|
109
|
+
return /* @__PURE__ */ n("div", { className: $, children: /* @__PURE__ */ n(
|
|
110
|
+
G,
|
|
107
111
|
{
|
|
108
|
-
trigger:
|
|
109
|
-
content:
|
|
112
|
+
trigger: M,
|
|
113
|
+
content: I,
|
|
110
114
|
placement: "bottom-start",
|
|
111
|
-
open:
|
|
115
|
+
open: B,
|
|
112
116
|
onOpenChange: c,
|
|
113
117
|
showArrow: !1,
|
|
114
118
|
offset: 4,
|
|
@@ -116,7 +120,7 @@ const I = (e) => {
|
|
|
116
120
|
}
|
|
117
121
|
) });
|
|
118
122
|
};
|
|
119
|
-
|
|
123
|
+
J.displayName = "DatePicker";
|
|
120
124
|
export {
|
|
121
|
-
|
|
125
|
+
J as DatePicker
|
|
122
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("../../contexts/ThemeContext.cjs"),z=require("../../hooks/useTheme.cjs"),h=require("../Switch/Switch.cjs"),c=require("../Button/Button.cjs"),d=require("../Card/Card.cjs"),i=require("../Badge/Badge.cjs"),T=require("../Radio/Radio.cjs"),w=require("../Alert/Alert.cjs"),n={orion:{accent:"#1B5BFF",radius:"12px",description:"Blue accent • 12px radius"},red:{accent:"#D7282F",radius:"9999px",description:"Red accent • Pill buttons"},deepblue:{accent:"#006FBA",radius:"12px",description:"Deep Blue accent • 12px radius"},orange:{accent:"#F15D22",radius:"9999px",description:"Red-Orange accent • Pill buttons"},lemon:{accent:"#72FF43",radius:"9999px",description:"Lime green accent • Highly rounded"}},v=({showBrandSelector:o=!0,showThemeToggle:p=!0,showSummary:y=!0,compact:m=!1,className:g,style:u,onThemeChange:j,onBrandChange:f})=>{const B=z.useTheme();let x=null;try{x=S.useThemeContext()}catch{}const{theme:t,brand:C,setTheme:k,setBrand:b}=x??B,a=C,s=r=>{k(r),j?.(r)},l=r=>{b(r),f?.(r)};return m?e.jsxs("div",{className:g,style:{display:"flex",gap:"var(--spacing-3)",alignItems:"center",flexWrap:"wrap"},children:[p&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-2)"},children:[e.jsx("span",{style:{fontSize:"20px"},children:"☀️"}),e.jsx(h.Switch,{checked:t==="dark",onChange:r=>s(r.target.checked?"dark":"light")}),e.jsx("span",{style:{fontSize:"20px"},children:"🌙"})]}),o&&e.jsx("div",{style:{display:"flex",gap:"var(--spacing-2)"},children:Object.keys(n).map(r=>e.jsx(c.Button,{variant:a===r?"primary":"secondary",size:"sm",onClick:()=>l(r),children:r.charAt(0).toUpperCase()+r.slice(1)},r))})]}):e.jsxs(d.Card,{variant:"elevated",className:g,style:{background:"var(--interactive-primary)",color:"var(--interactive-primary-text)",...u},children:[e.jsx(d.Card.Header,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-2)"},children:[e.jsx("span",{style:{fontSize:"24px"},children:"🎨"}),e.jsxs("div",{children:[e.jsx("h3",{style:{margin:0,color:"var(--interactive-primary-text)"},children:"Theme & Brand Settings"}),e.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",opacity:.9,color:"var(--interactive-primary-text)"},children:"Customize the appearance in real-time"})]})]})}),e.jsx(d.Card.Body,{style:{background:"var(--surface-base)",color:"var(--text-primary)"},children:e.jsxs("div",{style:{display:"grid",gap:"var(--spacing-6)"},children:[p&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"var(--spacing-3)"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-bold)",color:"var(--text-primary)",marginBottom:"var(--spacing-1)"},children:"Color Mode"}),e.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--text-secondary)",margin:0},children:"Switch between light and dark themes"})]}),e.jsx(i.Badge,{variant:t==="light"?"warning":"primary",size:"lg",children:t==="light"?"☀️ Light":"🌙 Dark"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-3)",padding:"var(--spacing-4)",background:"var(--surface-subtle)",borderRadius:"var(--radius-control)",border:"2px solid var(--border-subtle)"},children:[e.jsx("span",{style:{fontSize:"32px"},children:"☀️"}),e.jsx(h.Switch,{checked:t==="dark",onChange:r=>s(r.target.checked?"dark":"light"),size:"lg"}),e.jsx("span",{style:{fontSize:"32px"},children:"🌙"}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:"var(--spacing-2)"},children:[e.jsx(c.Button,{variant:t==="light"?"primary":"ghost",size:"sm",onClick:()=>s("light"),children:"Light"}),e.jsx(c.Button,{variant:t==="dark"?"primary":"ghost",size:"sm",onClick:()=>s("dark"),children:"Dark"})]})]})]}),o&&e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"var(--spacing-3)"},children:[e.jsx("label",{style:{display:"block",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-bold)",color:"var(--text-primary)",marginBottom:"var(--spacing-1)"},children:"Brand Identity"}),e.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--text-secondary)",margin:0},children:"Select a brand to see different accent colors and styling"})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"var(--spacing-3)"},children:Object.keys(n).map(r=>e.jsxs("div",{onClick:()=>l(r),style:{padding:"var(--spacing-4)",background:a===r?"var(--interactive-primary)":"var(--surface-subtle)",color:a===r?"white":"var(--text-primary)",borderRadius:"var(--radius-control)",border:`2px solid ${a===r?"var(--interactive-primary)":"var(--border-subtle)"}`,cursor:"pointer",transition:"all 150ms ease"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"var(--spacing-2)"},children:[e.jsx(T.Radio,{name:"brand",value:r,checked:a===r,onChange:()=>l(r),label:r.charAt(0).toUpperCase()+r.slice(1),size:"lg"}),a===r&&e.jsx(i.Badge,{variant:"success",children:"Active"})]}),e.jsx("p",{style:{fontSize:"var(--text-sm)",margin:0,opacity:.8},children:n[r].description})]},r))})]}),y&&e.jsx(w.Alert,{variant:"info",title:"Current Settings",children:e.jsxs("div",{style:{display:"flex",gap:"var(--spacing-2)",flexWrap:"wrap"},children:[e.jsxs(i.Badge,{variant:"primary",children:["Theme: ",t]}),e.jsxs(i.Badge,{variant:"secondary",children:["Brand: ",a]}),e.jsxs(i.Badge,{variant:"secondary",children:["Accent: ",n[a].accent]}),e.jsxs(i.Badge,{variant:"secondary",children:["Radius:"," ",n[a].radius==="9999px"?"9999px (pills)":n[a].radius]})]})})]})})]})};v.displayName="ThemeController";exports.ThemeController=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeController.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeController/ThemeController.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeController.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeController/ThemeController.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA8CpE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwU1D,CAAC"}
|