@wipco/sdui 0.7.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 (79) hide show
  1. package/dist/DatePicker-BndreCPl.d.ts +35 -0
  2. package/dist/{chunk-KAXPN6KT.js → chunk-27APKNEI.js} +8 -5
  3. package/dist/{chunk-Y3HYEWSY.js → chunk-5RWAK5QO.js} +4 -2
  4. package/dist/{chunk-GWVK3BHB.js → chunk-6ALDY64N.js} +5 -3
  5. package/dist/{chunk-CRSY67TZ.js → chunk-6FADQ2SU.js} +18 -19
  6. package/dist/{chunk-5O6PFLFJ.js → chunk-6ZUWN2QX.js} +4 -2
  7. package/dist/{chunk-XY2JKFAV.js → chunk-7MRAY6UD.js} +4 -2
  8. package/dist/{chunk-J2DSDERS.js → chunk-7Y6UFAYZ.js} +4 -2
  9. package/dist/{chunk-7Y4J7EOK.js → chunk-BMZKZGJF.js} +3 -2
  10. package/dist/{chunk-TAFUDHIX.js → chunk-CEFOZOOM.js} +4 -2
  11. package/dist/{chunk-H32WQHB7.js → chunk-H7V35NC2.js} +5 -3
  12. package/dist/{chunk-DN5YNPJS.js → chunk-I5GNJDHQ.js} +5 -3
  13. package/dist/{chunk-63U54JAG.js → chunk-IKLBICOJ.js} +4 -2
  14. package/dist/{chunk-XMMYJSRV.js → chunk-KL554MEM.js} +4 -2
  15. package/dist/{chunk-2ARNY7WZ.js → chunk-KPDUJFVD.js} +4 -2
  16. package/dist/{chunk-USKRM22W.js → chunk-O4U7Y3XL.js} +3 -2
  17. package/dist/{chunk-57LLG32F.js → chunk-OM63D4UH.js} +5 -3
  18. package/dist/{chunk-HGFYXY7F.js → chunk-QTNIUMSM.js} +4 -2
  19. package/dist/{chunk-73ZMMJRX.js → chunk-RQ2FWV24.js} +4 -2
  20. package/dist/{chunk-QBIVW7E6.js → chunk-SAN4IX6N.js} +77 -2
  21. package/dist/{chunk-L4ORCIVN.js → chunk-VCX2XEF6.js} +4 -2
  22. package/dist/{chunk-B4A4KY4K.js → chunk-VPVCVSFH.js} +4 -2
  23. package/dist/{chunk-TKB7H5DB.js → chunk-WUTCZCQH.js} +1 -1
  24. package/dist/{chunk-562QK2G3.js → chunk-YMWU4F7E.js} +4 -2
  25. package/dist/{chunk-QZQDHSMD.js → chunk-Z3WGIFJP.js} +3 -2
  26. package/dist/{chunk-PJRXPMI3.js → chunk-ZH5MLOZS.js} +3 -2
  27. package/dist/index.d.ts +1044 -980
  28. package/dist/index.js +79 -36
  29. package/dist/{layout-BnYUuWC2.d.ts → layout-B1QrIBm6.d.ts} +59 -1
  30. package/dist/meta.d.ts +42 -1
  31. package/dist/meta.js +198 -57
  32. package/dist/rich.d.ts +2 -1
  33. package/dist/rich.js +4 -3
  34. package/dist/widgets/AutocompleteField.d.ts +6 -40
  35. package/dist/widgets/AutocompleteField.js +4 -3
  36. package/dist/widgets/ColumnBoard.d.ts +6 -14
  37. package/dist/widgets/ColumnBoard.js +3 -2
  38. package/dist/widgets/DiffView.d.ts +6 -11
  39. package/dist/widgets/DiffView.js +3 -2
  40. package/dist/widgets/Disclosure.d.ts +6 -9
  41. package/dist/widgets/Disclosure.js +3 -2
  42. package/dist/widgets/EventCalendar.d.ts +6 -1
  43. package/dist/widgets/EventCalendar.js +3 -2
  44. package/dist/widgets/ImageLightbox.d.ts +6 -10
  45. package/dist/widgets/ImageLightbox.js +3 -2
  46. package/dist/widgets/InlineEdit.d.ts +6 -10
  47. package/dist/widgets/InlineEdit.js +3 -2
  48. package/dist/widgets/JsonField.d.ts +6 -1
  49. package/dist/widgets/JsonField.js +3 -2
  50. package/dist/widgets/LiveClock.d.ts +6 -1
  51. package/dist/widgets/LiveClock.js +2 -1
  52. package/dist/widgets/OrgChart.d.ts +7 -3
  53. package/dist/widgets/OrgChart.js +3 -2
  54. package/dist/widgets/PeriodFilter.d.ts +6 -1
  55. package/dist/widgets/PeriodFilter.js +3 -2
  56. package/dist/widgets/PrintSheet.d.ts +6 -12
  57. package/dist/widgets/PrintSheet.js +3 -2
  58. package/dist/widgets/SearchableMultiPicker.d.ts +6 -11
  59. package/dist/widgets/SearchableMultiPicker.js +4 -3
  60. package/dist/widgets/SecureScreen.d.ts +6 -14
  61. package/dist/widgets/SecureScreen.js +3 -2
  62. package/dist/widgets/StackedMeter.d.ts +7 -3
  63. package/dist/widgets/StackedMeter.js +2 -1
  64. package/dist/widgets/Strip.d.ts +6 -10
  65. package/dist/widgets/Strip.js +2 -2
  66. package/dist/widgets/SummaryTable.d.ts +6 -9
  67. package/dist/widgets/SummaryTable.js +2 -1
  68. package/dist/widgets/TagMultiSelect.d.ts +6 -1
  69. package/dist/widgets/TagMultiSelect.js +3 -2
  70. package/dist/widgets/Timeline.d.ts +6 -10
  71. package/dist/widgets/Timeline.js +4 -3
  72. package/dist/widgets/TreePicker.d.ts +6 -1
  73. package/dist/widgets/TreePicker.js +4 -3
  74. package/dist/widgets/TreeView.d.ts +6 -1
  75. package/dist/widgets/TreeView.js +3 -2
  76. package/dist/widgets/index.d.ts +61 -61
  77. package/dist/widgets/index.js +44 -44
  78. package/package.json +1 -1
  79. package/dist/DatePicker-CTDcFR7V.d.ts +0 -48
@@ -1,3 +1,5 @@
1
+ import React from 'react';
2
+
1
3
  // src/layout.ts
2
4
  var GAP_CSS = {
3
5
  "2": "2px",
@@ -34,6 +36,19 @@ var TEXT_ALIGN_CSS = {
34
36
  right: "right"
35
37
  };
36
38
  var COLUMNS = /* @__PURE__ */ new Set([1, 2, 3, 4, 5, 6]);
39
+ var SIZE_CSS = {
40
+ "96": "96px",
41
+ "128": "128px",
42
+ "160": "160px",
43
+ "192": "192px",
44
+ "224": "224px",
45
+ "256": "256px",
46
+ "288": "288px",
47
+ "320": "320px",
48
+ "384": "384px",
49
+ "480": "480px",
50
+ full: "100%"
51
+ };
37
52
  function lookup(table, value) {
38
53
  if (value === void 0 || value === null) return void 0;
39
54
  return table[String(value)];
@@ -57,7 +72,13 @@ var CHILD_LAYOUT_PROPS = /* @__PURE__ */ new Set([
57
72
  "shrink",
58
73
  "span",
59
74
  "selfAlign",
60
- "truncate"
75
+ "truncate",
76
+ "width",
77
+ "maxWidth",
78
+ "minWidth",
79
+ "marginTop",
80
+ "marginBottom",
81
+ "pushEnd"
61
82
  ]);
62
83
  function childLayoutFrom(props) {
63
84
  const style = {};
@@ -67,11 +88,31 @@ function childLayoutFrom(props) {
67
88
  if (Number.isInteger(span) && COLUMNS.has(span)) style.gridColumn = `span ${span}`;
68
89
  const alignSelf = lookup(ALIGN_CSS, props.selfAlign);
69
90
  if (alignSelf !== void 0) style.alignSelf = alignSelf;
91
+ const width = lookup(SIZE_CSS, props.width);
92
+ if (width !== void 0) style.width = width;
93
+ const maxWidth = lookup(SIZE_CSS, props.maxWidth);
94
+ if (maxWidth !== void 0) style.maxWidth = maxWidth;
95
+ const minWidth = lookup(SIZE_CSS, props.minWidth);
96
+ if (minWidth !== void 0) style.minWidth = minWidth;
97
+ const marginTop = lookup(GAP_CSS, props.marginTop);
98
+ if (marginTop !== void 0) style.marginTop = marginTop;
99
+ const marginBottom = lookup(GAP_CSS, props.marginBottom);
100
+ if (marginBottom !== void 0) style.marginBottom = marginBottom;
101
+ if (props.pushEnd === true) style.marginInlineStart = "auto";
70
102
  const className = props.truncate ? "wp-truncate" : void 0;
71
103
  const hasStyle = Object.keys(style).length > 0;
72
104
  if (!hasStyle && className === void 0) return void 0;
73
105
  return { style: hasStyle ? style : void 0, className };
74
106
  }
107
+ function mergeStyle(own, given) {
108
+ if (!own) return given;
109
+ if (!given) return own;
110
+ return { ...own, ...given };
111
+ }
112
+ function joinClass(...parts) {
113
+ const kept = parts.filter((part) => typeof part === "string" && part.length > 0);
114
+ return kept.length > 0 ? kept.join(" ") : void 0;
115
+ }
75
116
  function typographyStyle(props) {
76
117
  const fontWeight = lookup(WEIGHT_CSS, props.weight);
77
118
  const textAlign = lookup(TEXT_ALIGN_CSS, props.textAlign);
@@ -86,5 +127,39 @@ var LAYOUT_CSS = `
86
127
  @media (max-width:900px){.wp-grid--5,.wp-grid--6{grid-template-columns:repeat(2,minmax(0,1fr))}}
87
128
  @media (max-width:600px){.wp-grid--5,.wp-grid--6{grid-template-columns:minmax(0,1fr)}}
88
129
  `;
130
+ var BOXED = /* @__PURE__ */ Symbol.for("wipco.sdui.boxed");
131
+ function apply(element, box) {
132
+ const own = element.props;
133
+ return React.cloneElement(element, {
134
+ className: joinClass(own.className, box.className),
135
+ style: mergeStyle(own.style, box.style)
136
+ });
137
+ }
138
+ function boxed(Inner, displayName) {
139
+ if (Inner[BOXED] === true) return Inner;
140
+ const plainFunction = typeof Inner === "function" && Inner.prototype?.isReactComponent === void 0;
141
+ if (!plainFunction) return Inner;
142
+ const render = Inner;
143
+ const Wrapped = (props) => {
144
+ const { style, className, ...rest } = props;
145
+ const element = render(rest);
146
+ if (style === void 0 && className === void 0) return element;
147
+ if (!React.isValidElement(element)) return element;
148
+ if (element.type === React.Fragment) {
149
+ const kids = React.Children.toArray(
150
+ element.props.children
151
+ );
152
+ const at = kids.findIndex((kid) => React.isValidElement(kid));
153
+ if (at < 0) return element;
154
+ const next = kids.slice();
155
+ next[at] = apply(kids[at], { style, className });
156
+ return React.createElement(React.Fragment, null, ...next);
157
+ }
158
+ return apply(element, { style, className });
159
+ };
160
+ Wrapped[BOXED] = true;
161
+ Wrapped.displayName = displayName ?? `boxed(${Inner.displayName ?? Inner.name ?? "Component"})`;
162
+ return Wrapped;
163
+ }
89
164
 
90
- export { CHILD_LAYOUT_PROPS, LAYOUT_CSS, childLayoutFrom, columnsClass, containerLayoutStyle, typographyStyle };
165
+ export { CHILD_LAYOUT_PROPS, LAYOUT_CSS, boxed, childLayoutFrom, columnsClass, containerLayoutStyle, joinClass, mergeStyle, typographyStyle };
@@ -1,4 +1,5 @@
1
- import { Textarea, Icon } from './chunk-CRSY67TZ.js';
1
+ import { Textarea, Icon } from './chunk-6FADQ2SU.js';
2
+ import { boxed } from './chunk-SAN4IX6N.js';
2
3
  import { useState, useRef, useId, useEffect, useCallback } from 'react';
3
4
  import { jsxs, jsx } from 'react/jsx-runtime';
4
5
 
@@ -41,7 +42,7 @@ function describeParseError(err, text) {
41
42
  }
42
43
  return `JSON \uAD6C\uBB38 \uC624\uB958: ${message}`;
43
44
  }
44
- function JsonField({
45
+ function JsonFieldImpl({
45
46
  value,
46
47
  onChange,
47
48
  rows = 6,
@@ -115,5 +116,6 @@ function JsonField({
115
116
  }
116
117
  );
117
118
  }
119
+ var JsonField = boxed(JsonFieldImpl, "JsonField");
118
120
 
119
121
  export { JsonField };
@@ -1,4 +1,5 @@
1
- import { IconButton, Input } from './chunk-CRSY67TZ.js';
1
+ import { IconButton, Input } from './chunk-6FADQ2SU.js';
2
+ import { boxed } from './chunk-SAN4IX6N.js';
2
3
  import { useState, useRef, useEffect, useCallback } from 'react';
3
4
  import { jsxs, jsx } from 'react/jsx-runtime';
4
5
 
@@ -20,7 +21,7 @@ function saveErrorMessage(err) {
20
21
  if (err instanceof Error && err.message) return err.message;
21
22
  return "\uC800\uC7A5\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.";
22
23
  }
23
- function InlineEdit({
24
+ function InlineEditImpl({
24
25
  value,
25
26
  onSave,
26
27
  type = "text",
@@ -155,5 +156,6 @@ function InlineEdit({
155
156
  saveError !== null ? /* @__PURE__ */ jsx("span", { className: "wp-field__error", role: "alert", children: saveError }) : null
156
157
  ] });
157
158
  }
159
+ var InlineEdit = boxed(InlineEditImpl, "InlineEdit");
158
160
 
159
161
  export { InlineEdit };
@@ -1,4 +1,4 @@
1
- import { Tag, Input, Button, IconButton, Field, Checkbox } from './chunk-CRSY67TZ.js';
1
+ import { Tag, Input, Button, IconButton, Field, Checkbox } from './chunk-6FADQ2SU.js';
2
2
  import { useRef, useEffect, useState, useMemo } from 'react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
 
@@ -1,4 +1,5 @@
1
- import { Icon } from './chunk-CRSY67TZ.js';
1
+ import { Icon } from './chunk-6FADQ2SU.js';
2
+ import { boxed } from './chunk-SAN4IX6N.js';
2
3
  import { useRef, useState, useEffect } from 'react';
3
4
  import { jsxs, jsx } from 'react/jsx-runtime';
4
5
 
@@ -28,7 +29,7 @@ function overwriteClipboard() {
28
29
  } catch {
29
30
  }
30
31
  }
31
- function SecureScreen({ enabled = true, notice, children }) {
32
+ function SecureScreenImpl({ enabled = true, notice, children }) {
32
33
  const hostRef = useRef(null);
33
34
  const [cover, setCover] = useState(null);
34
35
  const [prevEnabled, setPrevEnabled] = useState(enabled);
@@ -106,5 +107,6 @@ function SecureScreen({ enabled = true, notice, children }) {
106
107
  ] }) : null
107
108
  ] });
108
109
  }
110
+ var SecureScreen = boxed(SecureScreenImpl, "SecureScreen");
109
111
 
110
112
  export { SecureScreen };
@@ -1,7 +1,7 @@
1
+ import { boxed } from './chunk-SAN4IX6N.js';
1
2
  import { useSyncExternalStore } from 'react';
2
3
  import { jsxs, jsx } from 'react/jsx-runtime';
3
4
 
4
- // src/widgets/LiveClock.tsx
5
5
  var PLACEHOLDER = "--:--:--";
6
6
  var WEEKDAYS = ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"];
7
7
  function pad2(value) {
@@ -31,7 +31,7 @@ function getSecondSnapshot() {
31
31
  function getServerSnapshot() {
32
32
  return null;
33
33
  }
34
- function LiveClock({ startedAt, showDate = false }) {
34
+ function LiveClockImpl({ startedAt, showDate = false }) {
35
35
  const nowSeconds = useSyncExternalStore(
36
36
  subscribeEverySecond,
37
37
  getSecondSnapshot,
@@ -74,5 +74,6 @@ function LiveClock({ startedAt, showDate = false }) {
74
74
  }
75
75
  );
76
76
  }
77
+ var LiveClock = boxed(LiveClockImpl, "LiveClock");
77
78
 
78
79
  export { LiveClock };
@@ -1,4 +1,4 @@
1
- import { containerLayoutStyle } from './chunk-QBIVW7E6.js';
1
+ import { boxed, containerLayoutStyle } from './chunk-SAN4IX6N.js';
2
2
  import React from 'react';
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
 
@@ -14,7 +14,7 @@ var STRIP_CSS = `
14
14
  function StripStyles() {
15
15
  return /* @__PURE__ */ jsx("style", { href: "erp-strip", precedence: "medium", children: STRIP_CSS });
16
16
  }
17
- function Strip({ children, gap = "12", snap = false }) {
17
+ function StripImpl({ children, gap = "12", snap = false }) {
18
18
  const items = React.Children.toArray(children);
19
19
  return /* @__PURE__ */ jsxs(
20
20
  "div",
@@ -28,5 +28,6 @@ function Strip({ children, gap = "12", snap = false }) {
28
28
  }
29
29
  );
30
30
  }
31
+ var Strip = boxed(StripImpl, "Strip");
31
32
 
32
33
  export { Strip };