@orion-ds/react 5.3.0 → 5.3.2
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/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/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 +3 -2
|
@@ -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"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=new Map,a=new Map;async function d(t){const e=Array.isArray(t)?t:[t];return(await Promise.all(e.map(async r=>{if(o.has(r))return o.get(r)??!1;if(a.has(r))return a.get(r);const n=(async()=>{try{return await import(r),o.set(r,!0),!0}catch{return o.set(r,!1),!1}})();a.set(r,n);const c=await n;return a.delete(r),c}))).every(Boolean)}function p(t){return(Array.isArray(t)?t:[t]).every(s=>o.has(s)?o.get(s)??!1:!0)}async function i(t,e,s){const n=(Array.isArray(e)?e:[e]).join(" ");return{available:await d(e),componentName:t,depName:e,installCommand:`npm install ${n}`,pnpmCommand:`pnpm add ${n}`,docsUrl:s}}const l={Chart:{depName:"recharts",docsUrl:"https://docs.orion-ds.dev/components/chart"},Calendar:{depName:"date-fns",docsUrl:"https://docs.orion-ds.dev/components/calendar"},DatePicker:{depName:"date-fns",docsUrl:"https://docs.orion-ds.dev/components/date-picker"},CodeEditor:{depName:"react-syntax-highlighter",docsUrl:"https://docs.orion-ds.dev/components/code-editor"},Chat:{depName:["react-markdown","remark-gfm"],docsUrl:"https://docs.orion-ds.dev/components/chat"},CollapsibleFolder:{depName:["@dnd-kit/core","@dnd-kit/sortable","@dnd-kit/utilities"],docsUrl:"https://docs.orion-ds.dev/components/collapsible-folder"}};function u(t){const e=l[t],s=Array.isArray(e.depName)?[...e.depName]:e.depName;if(!p(s))return i(t,s,e.docsUrl).then(n=>n.available?void 0:n)}exports.OPTIONAL_DEP_COMPONENTS=l;exports.checkComponent=u;exports.getOptionalDepError=i;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Optional Dependency Error Handling
|
|
2
|
+
* Optional Dependency Error Handling (ESM-Safe v5.3.1+)
|
|
3
3
|
*
|
|
4
4
|
* Provides helpful error messages when users try to use components
|
|
5
5
|
* that require optional peer dependencies (recharts, date-fns, etc.)
|
|
6
6
|
* without having them installed.
|
|
7
|
+
*
|
|
8
|
+
* Uses async import() instead of require() for ESM spec compliance.
|
|
9
|
+
* Results are cached for performance (cache hit = O(1) lookup).
|
|
10
|
+
*
|
|
11
|
+
* @see V5_3_0_ESM_REQUIRE_BUG_ANALYSIS.md for RCA of v5.3.0 regression
|
|
7
12
|
*/
|
|
8
13
|
/**
|
|
9
14
|
* Metadata for an optional dependency error
|
|
@@ -17,13 +22,14 @@ export interface OptionalDepError {
|
|
|
17
22
|
docsUrl: string;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
|
-
* Get error information for a missing optional dependency
|
|
25
|
+
* Get error information for a missing optional dependency (async)
|
|
26
|
+
*
|
|
21
27
|
* @param componentName - Name of the Orion component
|
|
22
28
|
* @param depName - NPM package name or array of package names
|
|
23
29
|
* @param docsUrl - URL to component documentation
|
|
24
|
-
* @returns OptionalDepError with installation instructions
|
|
30
|
+
* @returns Promise<OptionalDepError> with installation instructions
|
|
25
31
|
*/
|
|
26
|
-
export declare function getOptionalDepError(componentName: string, depName: string | string[], docsUrl: string): OptionalDepError
|
|
32
|
+
export declare function getOptionalDepError(componentName: string, depName: string | string[], docsUrl: string): Promise<OptionalDepError>;
|
|
27
33
|
/**
|
|
28
34
|
* Registry of all optional-dependency components
|
|
29
35
|
* Used to validate component registrations
|
|
@@ -56,8 +62,20 @@ export declare const OPTIONAL_DEP_COMPONENTS: {
|
|
|
56
62
|
};
|
|
57
63
|
/**
|
|
58
64
|
* Type-safe way to get optional dependency info
|
|
65
|
+
*
|
|
66
|
+
* Returns synchronously if result is cached (dependency already checked).
|
|
67
|
+
* Returns Promise if result needs async validation.
|
|
68
|
+
*
|
|
59
69
|
* @param componentName - One of the optional-dependency component names
|
|
60
|
-
* @returns Error info if dependency is missing, undefined if available
|
|
70
|
+
* @returns Error info if dependency is missing, undefined if available,
|
|
71
|
+
* or Promise for async validation
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Sync usage (cache hit or assumed available)
|
|
75
|
+
* const error = checkComponent('Calendar');
|
|
76
|
+
* if (error instanceof Promise) {
|
|
77
|
+
* const resolvedError = await error;
|
|
78
|
+
* }
|
|
61
79
|
*/
|
|
62
|
-
export declare function checkComponent(componentName: keyof typeof OPTIONAL_DEP_COMPONENTS): OptionalDepError | undefined;
|
|
80
|
+
export declare function checkComponent(componentName: keyof typeof OPTIONAL_DEP_COMPONENTS): OptionalDepError | Promise<OptionalDepError | undefined> | undefined;
|
|
63
81
|
//# sourceMappingURL=optionalDeps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionalDeps.d.ts","sourceRoot":"","sources":["../../src/utils/optionalDeps.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"optionalDeps.d.ts","sourceRoot":"","sources":["../../src/utils/optionalDeps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAyFD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAa3B;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;CAyB1B,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,OAAO,uBAAuB,GAClD,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,GAAG,SAAS,CAiBtE"}
|