@dcs-tech/ui 0.6.0 → 0.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.
Files changed (56) hide show
  1. package/README.md +43 -0
  2. package/dist/{ChartImageMenu-CuuFnW9q.js → ChartImageMenu-AsfvmdTH.js} +99 -81
  3. package/dist/{ChartView-nS4f4EU_.js → ChartView-CW3m4Z_1.js} +1 -1
  4. package/dist/{SummaryChart-CVg6i2mx.js → SummaryChart-CxRjK_HU.js} +2 -2
  5. package/dist/{SummaryImage-CoEFzMl6.js → SummaryImage-DeYs2Jgj.js} +2 -2
  6. package/dist/{SummarySeeAll-C_OUs3kn.js → SummarySeeAll-CrmROhBv.js} +5 -5
  7. package/dist/assets/fileTask.worker-BHT1olUk.js +1 -0
  8. package/dist/{columnValue-K98ElfJc.js → columnValue-DwUqueZ6.js} +1 -1
  9. package/dist/{exportContext-CJaIv8R-.js → exportContext-BKFnNQ0q.js} +1 -1
  10. package/dist/{exportEngine-CDLYHH0d.js → exportEngine-CZ22cX7a.js} +377 -382
  11. package/dist/file-worker.js +1 -0
  12. package/dist/{fileActions-KSaVGnaE.js → fileActions-COf5Q4Eg.js} +2 -2
  13. package/dist/{geometry-ChwYB45B.js → geometry-yZmKN662.js} +11 -2
  14. package/dist/index.js +6534 -6118
  15. package/dist/runFileTask--4YjQH7Y.js +210 -0
  16. package/dist/scrollArea-Dd2dNMV4.js +236 -0
  17. package/dist/style.css +1 -1
  18. package/dist/{summaryChartData-pNvzaEHp.js → summaryChartData-CARqGRUl.js} +1 -1
  19. package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  20. package/dist/types/components/DataTable/export/exportEngine.d.ts +11 -4
  21. package/dist/types/components/DataTable/layout/useFillHeight.d.ts +1 -0
  22. package/dist/types/components/DataTable/rows/RowActions.d.ts +5 -2
  23. package/dist/types/components/DataTable/types.d.ts +1 -0
  24. package/dist/types/components/Dialog/DialogHost.d.ts +1 -0
  25. package/dist/types/components/Dialog/dialogOpen.d.ts +7 -0
  26. package/dist/types/components/Dialog/index.d.ts +1 -0
  27. package/dist/types/components/Fields/Field.d.ts +1 -1
  28. package/dist/types/components/Fields/hooks/useFieldBlur.d.ts +1 -1
  29. package/dist/types/components/FileEngine/FileEngineProvider.d.ts +20 -1
  30. package/dist/types/components/FileEngine/index.d.ts +1 -1
  31. package/dist/types/components/Popover/floatingPosition.d.ts +11 -1
  32. package/dist/types/components/Scroll/ScrollStrip.d.ts +4 -2
  33. package/dist/types/components/Sidebar/Sidebar.d.ts +12 -3
  34. package/dist/types/components/Sidebar/index.d.ts +1 -1
  35. package/dist/types/components/UIProvider/UIHostContext.d.ts +20 -0
  36. package/dist/types/components/UIProvider/UILabelsContext.d.ts +9 -0
  37. package/dist/types/components/UIProvider/UIProvider.d.ts +2 -0
  38. package/dist/types/components/UIProvider/index.d.ts +2 -0
  39. package/dist/types/core/logic/index.d.ts +1 -0
  40. package/dist/types/core/logic/popover.logic.d.ts +2 -0
  41. package/dist/types/core/logic/standardSchema.logic.d.ts +9 -0
  42. package/dist/types/core/types/fields.types.d.ts +2 -0
  43. package/dist/types/core/types/fileEngine.types.d.ts +51 -0
  44. package/dist/types/core/types/form.types.d.ts +4 -0
  45. package/dist/types/core/types/index.d.ts +1 -0
  46. package/dist/types/core/types/standardSchema.types.d.ts +30 -0
  47. package/dist/types/core/types/suggest.types.d.ts +1 -0
  48. package/dist/types/core/types/tooltip.types.d.ts +2 -0
  49. package/dist/types/file/fileEngine.d.ts +2 -1
  50. package/dist/types/file/tasks/runFileTask.d.ts +4 -1
  51. package/dist/types/file/workerPool.d.ts +1 -0
  52. package/dist/types/index.d.ts +11 -6
  53. package/package.json +7 -3
  54. package/dist/assets/fileTask.worker-FQSUtwcz.js +0 -1
  55. package/dist/runFileTask-BClLQjmv.js +0 -109
  56. package/dist/scrollArea-DAlVT5U7.js +0 -214
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcs-tech/ui",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "React UI component library — fields, buttons, tooltips, tables and design tokens.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -18,13 +18,14 @@
18
18
  "import": "./dist/index.js"
19
19
  },
20
20
  "./style.css": "./dist/style.css",
21
+ "./file-worker": "./dist/file-worker.js",
21
22
  "./package.json": "./package.json"
22
23
  },
23
24
  "publishConfig": {
24
25
  "access": "public"
25
26
  },
26
27
  "scripts": {
27
- "build": "vite build && npm run build:types && npm run verify:types && npm run verify:no-leak && npm run verify:tokens",
28
+ "build": "vite build && node scripts/copy-worker.mjs && npm run build:types && npm run verify:types && npm run verify:no-leak && npm run verify:tokens",
28
29
  "build:types": "tsc -p tsconfig.build.json",
29
30
  "verify:types": "tsc -p tsconfig.verify.json",
30
31
  "verify:no-leak": "node scripts/verify-no-leak.mjs",
@@ -52,7 +53,10 @@
52
53
  },
53
54
  "devDependencies": {
54
55
  "@storybook/react-vite": "^10.5.5",
55
- "@types/pdfmake": "^0.2.7"
56
+ "@types/pdfmake": "^0.2.7",
57
+ "valibot": "^1.5.0",
58
+ "yup": "^1.7.1",
59
+ "zod": "^4.6.7"
56
60
  },
57
61
  "keywords": [
58
62
  "react",
@@ -1 +0,0 @@
1
- const e=()=>new DOMException(`Aborted`,`AbortError`);async function t(t,n){if(n.signal?.aborted)throw e();switch(t.kind){case`xlsx`:return o(t.workbook,n);case`pdf`:return c(t.document,t.fonts,n);default:throw Error(`Unknown file task: ${t.kind}`)}}const n=globalThis;async function r(){let e=await import(`exceljs`),t=[e.default?.default,e.default,e,n.ExcelJS].find(e=>e&&typeof e.Workbook==`function`);if(!t)throw Error(`ExcelJS did not load`);return t}async function i(){let e=await import(`pdfmake/build/pdfmake.js`),t=[e.default?.default,e.default,e,n.pdfMake].find(e=>e&&typeof e.createPdf==`function`);if(!t)throw Error(`pdfmake did not load`);let r=await import(`pdfmake/build/vfs_fonts.js`);return{pdfMake:t,vfs:[r?.default,r,r?.pdfMake?.vfs,r?.default?.pdfMake?.vfs,t.vfs,n.pdfMake?.vfs].find(e=>e&&e[`Roboto-Regular.ttf`])}}const a=e=>ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e;async function o(t,n){let i=new(await(r())).Workbook,o=Math.max(1,t.sheets.reduce((e,t)=>e+t.rows.length,0)),s=Math.max(1,Math.floor(o/50)),c=0;for(let r of t.sheets){let t=i.addWorksheet(r.name);t.columns=r.columns.map((e,t)=>({key:String(t),width:e.width}));let a=t.addRow(r.columns.map(e=>e.header));r.freezeHeader!==!1&&(a.font={bold:!0},t.views=[{state:`frozen`,ySplit:1}]);for(let i of r.rows){let a=t.addRow(i);if(r.columns.forEach((e,t)=>{if(!e.numFmt&&!e.align)return;let n=a.getCell(t+1);e.numFmt&&(n.numFmt=e.numFmt),e.align&&(n.alignment={horizontal:e.align})}),++c%s===0){if(n.signal?.aborted)throw e();n.progress(c/o*.9)}}}let l=await i.xlsx.writeBuffer();return n.progress(1),a(l)}const s={Roboto:{normal:`Roboto-Regular.ttf`,bold:`Roboto-Medium.ttf`,italics:`Roboto-Italic.ttf`,bolditalics:`Roboto-MediumItalic.ttf`}};async function c(t,n,r){let{pdfMake:a,vfs:o}=await i();if(r.progress(.1),r.signal?.aborted)throw e();let c={...s,...n?.fonts??{}},l=n?.vfs?{...o??{},...n.vfs}:o,u=await new Promise((e,n)=>{try{let r=a.createPdf(t,void 0,c,l).getStream(),i=[];r.on(`data`,e=>i.push(e)),r.on(`error`,n),r.on(`end`,()=>{let t=new Uint8Array(i.reduce((e,t)=>e+t.byteLength,0)),n=0;for(let e of i)t.set(e,n),n+=e.byteLength;e(t.buffer)}),r.end()}catch(e){n(e)}});return r.progress(1),u}const l=self;l.onmessage=async e=>{let{id:n,task:r}=e.data;try{let e=await t(r,{progress:e=>l.postMessage({type:`progress`,id:n,fraction:e})});l.postMessage({type:`done`,id:n,buffer:e},[e])}catch(e){l.postMessage({type:`error`,id:n,message:e instanceof Error?e.message:String(e)})}};
@@ -1,109 +0,0 @@
1
- "use client";
2
- // \0rolldown/runtime.js
3
- var e = Object.defineProperty, t = (t, n) => {
4
- let r = {};
5
- for (var i in t) e(r, i, {
6
- get: t[i],
7
- enumerable: !0
8
- });
9
- return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
10
- }, n = /* @__PURE__ */ t({ runFileTask: () => i }), r = () => new DOMException("Aborted", "AbortError");
11
- async function i(e, t) {
12
- if (t.signal?.aborted) throw r();
13
- switch (e.kind) {
14
- case "xlsx": return l(e.workbook, t);
15
- case "pdf": return d(e.document, e.fonts, t);
16
- default: throw Error(`Unknown file task: ${e.kind}`);
17
- }
18
- }
19
- var a = globalThis;
20
- async function o() {
21
- let e = await import("exceljs"), t = [
22
- e.default?.default,
23
- e.default,
24
- e,
25
- a.ExcelJS
26
- ].find((e) => e && typeof e.Workbook == "function");
27
- if (!t) throw Error("ExcelJS did not load");
28
- return t;
29
- }
30
- async function s() {
31
- let e = await import("pdfmake/build/pdfmake.js"), t = [
32
- e.default?.default,
33
- e.default,
34
- e,
35
- a.pdfMake
36
- ].find((e) => e && typeof e.createPdf == "function");
37
- if (!t) throw Error("pdfmake did not load");
38
- let n = await import("pdfmake/build/vfs_fonts.js");
39
- return {
40
- pdfMake: t,
41
- vfs: [
42
- n?.default,
43
- n,
44
- n?.pdfMake?.vfs,
45
- n?.default?.pdfMake?.vfs,
46
- t.vfs,
47
- a.pdfMake?.vfs
48
- ].find((e) => e && e["Roboto-Regular.ttf"])
49
- };
50
- }
51
- var c = (e) => ArrayBuffer.isView(e) ? e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength) : e;
52
- async function l(e, t) {
53
- let n = new (await (o())).Workbook(), i = Math.max(1, e.sheets.reduce((e, t) => e + t.rows.length, 0)), a = Math.max(1, Math.floor(i / 50)), s = 0;
54
- for (let o of e.sheets) {
55
- let e = n.addWorksheet(o.name);
56
- e.columns = o.columns.map((e, t) => ({
57
- key: String(t),
58
- width: e.width
59
- }));
60
- let c = e.addRow(o.columns.map((e) => e.header));
61
- o.freezeHeader !== !1 && (c.font = { bold: !0 }, e.views = [{
62
- state: "frozen",
63
- ySplit: 1
64
- }]);
65
- for (let n of o.rows) {
66
- let c = e.addRow(n);
67
- if (o.columns.forEach((e, t) => {
68
- if (!e.numFmt && !e.align) return;
69
- let n = c.getCell(t + 1);
70
- e.numFmt && (n.numFmt = e.numFmt), e.align && (n.alignment = { horizontal: e.align });
71
- }), ++s % a === 0) {
72
- if (t.signal?.aborted) throw r();
73
- t.progress(s / i * .9);
74
- }
75
- }
76
- }
77
- let l = await n.xlsx.writeBuffer();
78
- return t.progress(1), c(l);
79
- }
80
- var u = { Roboto: {
81
- normal: "Roboto-Regular.ttf",
82
- bold: "Roboto-Medium.ttf",
83
- italics: "Roboto-Italic.ttf",
84
- bolditalics: "Roboto-MediumItalic.ttf"
85
- } };
86
- async function d(e, t, n) {
87
- let { pdfMake: i, vfs: a } = await s();
88
- if (n.progress(.1), n.signal?.aborted) throw r();
89
- let o = {
90
- ...u,
91
- ...t?.fonts ?? {}
92
- }, c = t?.vfs ? {
93
- ...a ?? {},
94
- ...t.vfs
95
- } : a, l = await new Promise((t, n) => {
96
- try {
97
- let r = i.createPdf(e, void 0, o, c).getStream(), a = [];
98
- r.on("data", (e) => a.push(e)), r.on("error", n), r.on("end", () => {
99
- let e = new Uint8Array(a.reduce((e, t) => e + t.byteLength, 0)), n = 0;
100
- for (let t of a) e.set(t, n), n += t.byteLength;
101
- t(e.buffer);
102
- }), r.end();
103
- } catch (e) {
104
- n(e);
105
- }
106
- });
107
- return n.progress(1), l;
108
- }
109
- export { n, t as r, i as t };
@@ -1,214 +0,0 @@
1
- "use client";
2
- import { Nn as e, wn as t } from "./geometry-ChwYB45B.js";
3
- import { n, t as r } from "./labels-CnqqTrne.js";
4
- import { createContext as i, useCallback as a, useContext as o, useEffect as s, useId as ee, useRef as c, useState as l } from "react";
5
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
6
- import { createPortal as te } from "react-dom";
7
- var f = {
8
- root: "_root_1rswg_7",
9
- nonModal: "_nonModal_1rswg_30",
10
- panel: "_panel_1rswg_3",
11
- center: "_center_1rswg_41",
12
- right: "_right_1rswg_42",
13
- left: "_left_1rswg_43",
14
- top: "_top_1rswg_44",
15
- bottom: "_bottom_1rswg_45",
16
- sm: "_sm_1rswg_86",
17
- md: "_md_1rswg_87",
18
- lg: "_lg_1rswg_88",
19
- xl: "_xl_1rswg_89",
20
- full: "_full_1rswg_90",
21
- header: "_header_1rswg_96",
22
- headText: "_headText_1rswg_106",
23
- title: "_title_1rswg_108",
24
- subtitle: "_subtitle_1rswg_114",
25
- body: "_body_1rswg_120",
26
- flush: "_flush_1rswg_128",
27
- footer: "_footer_1rswg_130",
28
- close: "_close_1rswg_141",
29
- dialogPop: "_dialogPop_1rswg_1",
30
- slideFromRight: "_slideFromRight_1rswg_1",
31
- slideFromLeft: "_slideFromLeft_1rswg_1",
32
- slideFromTop: "_slideFromTop_1rswg_1",
33
- slideFromBottom: "_slideFromBottom_1rswg_1",
34
- backdropIn: "_backdropIn_1rswg_1",
35
- closing: "_closing_1rswg_168"
36
- }, p = 0, m = null, h = (e) => {
37
- if (typeof document < "u") {
38
- if (p === 0) {
39
- let t = document.body;
40
- m = {
41
- overflow: t.style.overflow,
42
- paddingRight: t.style.paddingRight
43
- };
44
- let n = window.innerWidth - document.documentElement.clientWidth;
45
- if (e && n > 0) {
46
- let e = parseFloat(window.getComputedStyle(t).paddingRight) || 0;
47
- t.style.paddingRight = `${e + n}px`;
48
- }
49
- t.style.overflow = "hidden";
50
- }
51
- p += 1;
52
- }
53
- }, g = () => {
54
- typeof document < "u" && (p = Math.max(0, p - 1), p === 0 && m && (document.body.style.overflow = m.overflow, document.body.style.paddingRight = m.paddingRight, m = null));
55
- }, _ = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, ne = /* @__PURE__ */ d("svg", {
56
- width: "16",
57
- height: "16",
58
- viewBox: "0 0 24 24",
59
- fill: "none",
60
- stroke: "currentColor",
61
- strokeWidth: "2",
62
- strokeLinecap: "round",
63
- "aria-hidden": "true",
64
- children: [/* @__PURE__ */ u("line", {
65
- x1: "18",
66
- y1: "6",
67
- x2: "6",
68
- y2: "18"
69
- }), /* @__PURE__ */ u("line", {
70
- x1: "6",
71
- y1: "6",
72
- x2: "18",
73
- y2: "18"
74
- })]
75
- }), v = ({ open: n, onClose: r, onBeforeClose: i, onEscKeyDown: o, onOverlayClick: p, onAnimationEnd: m, children: v, title: y, subtitle: b, footer: x, modal: S = !0, placement: C = "center", size: w = "md", closeOnBackdrop: re = !0, closeOnEscape: T = !0, showCloseButton: E = !0, closeIcon: D, closeIconId: O, blockScroll: k = !0, reserveScrollBarGap: A = !0, initialFocusRef: j, container: ie, animationDuration: ae = 200, padded: oe = !0, classNames: M = {}, styleSlots: N = {}, className: P = "", style: F, role: I = "dialog", id: L, "aria-label": R, "aria-labelledby": z, "aria-describedby": B }) => {
76
- let V = e(), H = c(null), [U, W] = l(null), G = ee(), [K, q] = l(n), [se, J] = l(!1), Y = c(null), X = _() ? 0 : ae;
77
- s(() => {
78
- n ? (Y.current &&= (clearTimeout(Y.current), null), J(!1), q(!0)) : K && (J(!0), Y.current = setTimeout(() => {
79
- H.current?.close(), q(!1), J(!1), m?.();
80
- }, X));
81
- }, [n]), s(() => () => {
82
- Y.current && clearTimeout(Y.current);
83
- }, []);
84
- let Z = a(() => {
85
- i && i() === !1 || r?.();
86
- }, [i, r]);
87
- s(() => {
88
- let e = H.current;
89
- if (e && K && (e.open || (S ? e.showModal() : e.show(), j?.current && j.current.focus({ focusVisible: !0 })), k && S)) return h(A), () => g();
90
- }, [
91
- K,
92
- S,
93
- k,
94
- A,
95
- j
96
- ]), s(() => {
97
- let e = H.current;
98
- if (!e || !K) return;
99
- let t = (e) => {
100
- e.preventDefault(), o?.(e), T && Z();
101
- };
102
- return e.addEventListener("cancel", t), () => e.removeEventListener("cancel", t);
103
- }, [
104
- K,
105
- T,
106
- Z,
107
- o
108
- ]);
109
- let Q = c(!1), ce = (e) => {
110
- Q.current = e.target === H.current;
111
- }, le = (e) => {
112
- let t = Q.current && e.target === H.current;
113
- Q.current = !1, t && (p?.(e), re && Z());
114
- };
115
- if (!K) return null;
116
- let ue = y !== void 0 || b !== void 0 || E, de = z ?? (y !== void 0 && !R ? G : void 0), fe = /* @__PURE__ */ u("dialog", {
117
- ref: (e) => {
118
- H.current = e, W(e);
119
- },
120
- id: L,
121
- className: [
122
- f.root,
123
- f[C],
124
- f[w],
125
- S ? "" : f.nonModal,
126
- se ? f.closing : "",
127
- M.root,
128
- P
129
- ].filter(Boolean).join(" "),
130
- style: {
131
- "--dialog-anim": `${X}ms`,
132
- ...N.root,
133
- ...F
134
- },
135
- role: I,
136
- "aria-label": R,
137
- "aria-labelledby": de,
138
- "aria-describedby": B,
139
- "aria-modal": S || void 0,
140
- onPointerDown: ce,
141
- onPointerUp: le,
142
- children: /* @__PURE__ */ u(t.Provider, {
143
- value: U,
144
- children: /* @__PURE__ */ d("div", {
145
- className: [f.panel, M.panel].filter(Boolean).join(" "),
146
- style: N.panel,
147
- children: [
148
- ue && /* @__PURE__ */ d("div", {
149
- className: [f.header, M.header].filter(Boolean).join(" "),
150
- style: N.header,
151
- children: [/* @__PURE__ */ d("span", {
152
- className: f.headText,
153
- children: [y !== void 0 && /* @__PURE__ */ u("span", {
154
- className: f.title,
155
- id: G,
156
- children: y
157
- }), b !== void 0 && /* @__PURE__ */ u("span", {
158
- className: f.subtitle,
159
- children: b
160
- })]
161
- }), E && /* @__PURE__ */ u("button", {
162
- type: "button",
163
- id: O,
164
- className: [f.close, M.closeButton].filter(Boolean).join(" "),
165
- style: N.closeButton,
166
- onClick: Z,
167
- "aria-label": V.dialog.close,
168
- children: D ?? ne
169
- })]
170
- }),
171
- v !== void 0 && /* @__PURE__ */ u("div", {
172
- className: [
173
- f.body,
174
- oe ? "" : f.flush,
175
- M.body
176
- ].filter(Boolean).join(" "),
177
- style: N.body,
178
- children: v
179
- }),
180
- x !== void 0 && /* @__PURE__ */ u("div", {
181
- className: [f.footer, M.footer].filter(Boolean).join(" "),
182
- style: N.footer,
183
- children: x
184
- })
185
- ]
186
- })
187
- })
188
- }), $ = ie ?? (typeof document > "u" ? null : document.body);
189
- return $ ? te(fe, $) : null;
190
- };
191
- v.displayName = "Dialog";
192
- var y = i({
193
- authorize: () => !0,
194
- exportOptions: {},
195
- serverMode: !1,
196
- labels: r,
197
- format: n(),
198
- text: {
199
- yes: r.yes,
200
- no: r.no
201
- }
202
- });
203
- function b() {
204
- return o(y);
205
- }
206
- function x() {
207
- return o(y).labels;
208
- }
209
- function S(e, t, n) {
210
- return !e || e(t, n) !== !1;
211
- }
212
- // src/components/DataTable/layout/scrollArea.ts
213
- var C = "dt-scroll-area scroll-fade-y scroll-gutter", w = "dt-scroll-area scroll-fade-x scroll-fade-y scroll-gutter";
214
- export { x as a, S as i, C as n, b as o, y as r, v as s, w as t };