@hitachivantara/uikit-cli 6.0.1 → 6.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-cli",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "author": "Hitachi Vantara UI Kit Team",
@@ -25,12 +25,7 @@
25
25
  "url": "https://github.com/pentaho/hv-uikit-react/issues"
26
26
  },
27
27
  "scripts": {
28
- "clean": "npx rimraf package",
29
- "prepare": "npx cpy ../../templates src",
30
- "pretest": "node src/index.js create uikit-app -t Form,ListView",
31
- "test": "cd uikit-app",
32
- "posttest": "npx rimraf uikit-app",
33
- "prepublishOnly": "npm run clean && npx clean-publish"
28
+ "prepare": "npx cpy ../../templates src"
34
29
  },
35
30
  "dependencies": {
36
31
  "chalk": "^5.2.0",
@@ -40,16 +35,6 @@
40
35
  "inquirer": "^9.1.4",
41
36
  "node-plop": "^0.31.1"
42
37
  },
43
- "devDependencies": {
44
- "@types/fs-extra": "^11.0.1",
45
- "cpy-cli": "^5.0.0",
46
- "i18next": "^24.2.2",
47
- "i18next-browser-languagedetector": "^8.0.3",
48
- "i18next-http-backend": "^3.0.2",
49
- "react-i18next": "15.7.1",
50
- "react-router-dom": "^6.29.0",
51
- "vite-tsconfig-paths": "^5.1.0"
52
- },
53
38
  "engineStrict": true,
54
39
  "engines": {
55
40
  "node": ">=16"
@@ -61,8 +46,5 @@
61
46
  "access": "public",
62
47
  "directory": "package"
63
48
  },
64
- "clean-publish": {
65
- "withoutPublish": true,
66
- "tempDir": "package"
67
- }
49
+ "gitHead": "f2b8a9e107bc8886231d527b37b30716d891105c"
68
50
  }
@@ -14,11 +14,9 @@ export function withProvider<
14
14
  >(WrappedComponent: React.ComponentType<P>) {
15
15
  const ComponentWithProvider: React.FC<P> = (props) => {
16
16
  return (
17
- <Provider>
18
- <Suspense fallback={null}>
19
- <WrappedComponent {...props} />
20
- </Suspense>
21
- </Provider>
17
+ <Suspense fallback={null}>
18
+ <WrappedComponent {...props} />
19
+ </Suspense>
22
20
  );
23
21
  };
24
22
 
@@ -87,7 +87,7 @@ export function useServerPagination<T extends DataObject = DataObject>({
87
87
 
88
88
  return {
89
89
  data: items
90
- .sort(
90
+ .toSorted(
91
91
  sort
92
92
  ? (a, b) => {
93
93
  return order === "desc"
@@ -84,7 +84,7 @@ export function useServerPagination<T extends DataObject = DataObject>({
84
84
 
85
85
  return {
86
86
  data: items
87
- .sort(
87
+ .toSorted(
88
88
  sort
89
89
  ? (a, b) => {
90
90
  return order === "desc"
@@ -87,7 +87,7 @@ export function useServerPagination<T extends DataObject = DataObject>({
87
87
 
88
88
  return {
89
89
  data: items
90
- .sort(
90
+ .toSorted(
91
91
  sort
92
92
  ? (a, b) => {
93
93
  return order === "desc"
@@ -1,475 +0,0 @@
1
- import { useCallback, useMemo, useRef, useState } from "react";
2
- import { css, cx } from "@emotion/css";
3
- import Popover from "@mui/material/Popover";
4
- import {
5
- NodeProps,
6
- NodeResizer,
7
- NodeToolbar,
8
- Position,
9
- useReactFlow,
10
- } from "reactflow";
11
- import {
12
- HvButton,
13
- HvCheckBox,
14
- HvColorAny,
15
- HvColorPicker,
16
- HvDialogContent,
17
- HvDialogTitle,
18
- HvIconButton,
19
- HvListItem,
20
- HvMultiButton,
21
- HvSelectionList,
22
- theme,
23
- } from "@hitachivantara/uikit-react-core";
24
- import {
25
- ActualSize,
26
- Bold,
27
- Delete,
28
- FontSize,
29
- Fullscreen,
30
- Italic,
31
- Palette,
32
- } from "@hitachivantara/uikit-react-icons";
33
-
34
- export type StickyNodeData =
35
- | undefined
36
- | {
37
- title?: string;
38
- backgroundColor?: HvColorAny;
39
- borderColor?: HvColorAny;
40
- textColor?: HvColorAny;
41
- hasShadow?: boolean;
42
- bold?: boolean;
43
- italic?: boolean;
44
- fontSize?: number;
45
- expanded?: boolean;
46
- visible?: boolean;
47
- onDelete?: () => void;
48
- };
49
-
50
- const defaultData: StickyNodeData = {
51
- title: "Sticky Note",
52
- backgroundColor: theme.colors.warningSubtle,
53
- borderColor: theme.colors.warningSubtle,
54
- textColor: theme.colors.text,
55
- hasShadow: true,
56
- bold: false,
57
- italic: false,
58
- fontSize: 14,
59
- expanded: true,
60
- visible: true,
61
- };
62
-
63
- const classes = {
64
- root: css({
65
- width: "100%",
66
- height: "100%",
67
- position: "relative",
68
- display: "flex",
69
- outline: "none",
70
- }),
71
- nodeToolbar: css({
72
- backgroundColor: "transparent",
73
- borderRadius: theme.radii.full,
74
- top: 10,
75
- }),
76
- buttonsContainer: css({
77
- padding: theme.space.xs,
78
- }),
79
- textAreaRoot: css({
80
- flex: 1,
81
- width: "100%",
82
- border: "none",
83
- background: "transparent",
84
- outline: "none",
85
- }),
86
- textAreaInput: css({
87
- resize: "none",
88
- height: "100%",
89
- width: "100%",
90
- padding: theme.space.xs,
91
- "&:focus-visible": {
92
- outline: "none",
93
- },
94
- paddingRight: 32,
95
- }),
96
- textAreaInputFolded: css({
97
- resize: "none",
98
- width: "100%",
99
- padding: 0,
100
- border: "none",
101
- overflow: "hidden",
102
- minHeight: "1.5rem",
103
- height: "auto",
104
- }),
105
- colorConfig: css({
106
- display: "flex",
107
- flexDirection: "column",
108
- gap: theme.space.sm,
109
- }),
110
- folded: css({
111
- width: 34,
112
- height: 34,
113
- }),
114
- expandButton: css({
115
- position: "absolute",
116
- top: theme.space.xxs,
117
- right: theme.space.xxs,
118
- }),
119
- fontSizes: css({
120
- maxHeight: 160,
121
- overflowY: "auto",
122
- padding: theme.space.xs,
123
- }),
124
- };
125
-
126
- const colorsToConfig = ["textColor", "backgroundColor", "borderColor"];
127
- const fontSizes = [10, 11, 12, 14, 16, 20, 24, 32, 36, 40, 48, 64, 96, 128];
128
-
129
- export const StickyNode = ({
130
- id,
131
- selected,
132
- data = {},
133
- }: NodeProps<StickyNodeData>) => {
134
- const mergedData = useMemo(() => ({ ...defaultData, ...data }), [data]);
135
-
136
- const [text, setText] = useState("");
137
- const { setNodes } = useReactFlow();
138
-
139
- const [editing, setEditing] = useState(false);
140
-
141
- const [toolbarVisible, setToolbarVisible] = useState(false);
142
- const [colorsConfigOpen, setColorsConfigOpen] = useState(false);
143
- const [fontSizeConfigOpen, setFontSizeConfigOpen] = useState(false);
144
-
145
- const [fontSize, setFontSize] = useState(mergedData.fontSize ?? 14);
146
-
147
- const colorConfigBtnRef = useRef<HTMLButtonElement>(null);
148
- const fontSizeConfigBtnRef = useRef<HTMLButtonElement>(null);
149
-
150
- const handleToggleBold = useCallback(() => {
151
- setNodes((nds) =>
152
- nds.map((node) => {
153
- if (node.id === id) {
154
- node.data = {
155
- ...node.data,
156
- bold: !node.data?.bold,
157
- };
158
- }
159
- return node;
160
- }),
161
- );
162
- }, [setNodes, id]);
163
-
164
- const handleToggleItalic = useCallback(() => {
165
- setNodes((nds) =>
166
- nds.map((node) => {
167
- if (node.id === id) {
168
- node.data = {
169
- ...node.data,
170
- italic: !node.data?.italic,
171
- };
172
- }
173
- return node;
174
- }),
175
- );
176
- }, [setNodes, id]);
177
-
178
- const handleChangeFontSize = useCallback(
179
- (size: number) => {
180
- setFontSize(size);
181
- setNodes((nds) =>
182
- nds.map((node) => {
183
- if (node.id === id) {
184
- node.data = {
185
- ...node.data,
186
- fontSize: size,
187
- };
188
- }
189
- return node;
190
- }),
191
- );
192
- setFontSizeConfigOpen(false);
193
- },
194
- [setNodes, id],
195
- );
196
-
197
- const handleToggleExpand = useCallback(() => {
198
- setNodes((nds) =>
199
- nds.map((node) => {
200
- if (node.id === id) {
201
- node.data = {
202
- ...node.data,
203
- expanded: !node.data?.expanded,
204
- };
205
- }
206
- return node;
207
- }),
208
- );
209
- }, [setNodes, id]);
210
-
211
- const handleResetColors = useCallback(() => {
212
- setNodes((nds) =>
213
- nds.map((node) => {
214
- if (node.id === id) {
215
- node.data = {
216
- ...node.data,
217
- backgroundColor: defaultData.backgroundColor,
218
- borderColor: defaultData.borderColor,
219
- textColor: defaultData.textColor,
220
- hasShadow: defaultData.hasShadow,
221
- };
222
- }
223
- return node;
224
- }),
225
- );
226
- }, [setNodes, id]);
227
-
228
- const handleDeleteSticky = useCallback(() => {
229
- setNodes((nds) => nds.filter((node) => node.id !== id));
230
- mergedData.onDelete?.();
231
- }, [mergedData, setNodes, id]);
232
-
233
- if (!mergedData.visible) return null;
234
-
235
- return (
236
- <>
237
- <Popover
238
- open={colorsConfigOpen}
239
- anchorEl={colorConfigBtnRef.current}
240
- onClose={() => {
241
- setColorsConfigOpen(false);
242
- setEditing(false);
243
- }}
244
- anchorOrigin={{
245
- vertical: "bottom",
246
- horizontal: "left",
247
- }}
248
- transformOrigin={{
249
- vertical: "top",
250
- horizontal: "left",
251
- }}
252
- >
253
- <HvDialogTitle>Customize Colors</HvDialogTitle>
254
- <HvDialogContent>
255
- <div className={classes.colorConfig}>
256
- {colorsToConfig.map((c) => (
257
- <HvColorPicker
258
- key={c}
259
- label={`${c.charAt(0).toUpperCase() + c.slice(1).replace("Color", " Color")}`}
260
- value={mergedData[c as keyof StickyNodeData] ?? ""}
261
- onChange={(color) => {
262
- setNodes((nds) =>
263
- nds.map((node) => {
264
- if (node.id === id) {
265
- node.data = {
266
- ...node.data,
267
- [c]: color,
268
- };
269
- }
270
- return node;
271
- }),
272
- );
273
- }}
274
- />
275
- ))}
276
- <HvCheckBox
277
- label="Drop Shadow"
278
- defaultChecked={mergedData.hasShadow}
279
- onChange={(_, checked) => {
280
- setNodes((nds) =>
281
- nds.map((node) => {
282
- if (node.id === id) {
283
- node.data = {
284
- ...node.data,
285
- hasShadow: checked,
286
- };
287
- }
288
- return node;
289
- }),
290
- );
291
- }}
292
- />
293
- <HvButton variant="secondarySubtle" onClick={handleResetColors}>
294
- Reset to defaults
295
- </HvButton>
296
- </div>
297
- </HvDialogContent>
298
- </Popover>
299
- <Popover
300
- open={fontSizeConfigOpen}
301
- anchorEl={fontSizeConfigBtnRef.current}
302
- onClose={() => {
303
- setFontSizeConfigOpen(false);
304
- setEditing(false);
305
- }}
306
- anchorOrigin={{
307
- vertical: "bottom",
308
- horizontal: "right",
309
- }}
310
- transformOrigin={{
311
- vertical: "top",
312
- horizontal: "right",
313
- }}
314
- >
315
- <HvSelectionList
316
- className={classes.fontSizes}
317
- value={fontSize}
318
- onChange={(evt, newValue) => {
319
- handleChangeFontSize(newValue);
320
- }}
321
- >
322
- {fontSizes.map((size) => (
323
- <HvListItem value={size} key={size}>
324
- {size}
325
- </HvListItem>
326
- ))}
327
- </HvSelectionList>
328
- </Popover>
329
- <div
330
- className={cx(
331
- classes.root,
332
- "nowheel",
333
- !mergedData.expanded && classes.folded,
334
- )}
335
- style={{
336
- backgroundColor:
337
- mergedData.backgroundColor ?? theme.colors.bgContainer,
338
- boxShadow: mergedData.hasShadow
339
- ? "0 8px 12px rgba(65,65,65,0.25)"
340
- : "none",
341
- border: mergedData.borderColor
342
- ? `1px solid ${mergedData.borderColor}`
343
- : "none",
344
- fontSize: `${mergedData.fontSize ?? 14}px`,
345
- lineHeight: `${mergedData.fontSize ?? 14}px`,
346
- }}
347
- >
348
- {mergedData.expanded && (
349
- <>
350
- <NodeResizer
351
- isVisible={selected}
352
- minWidth={100}
353
- minHeight={75}
354
- lineStyle={{
355
- color: theme.colors.primary,
356
- borderStyle: "solid",
357
- }}
358
- handleStyle={{
359
- width: 6,
360
- height: 6,
361
- border: `1px solid ${theme.colors.primary}`,
362
- backgroundColor: mergedData.backgroundColor ?? "transparent",
363
- borderRadius: theme.radii.full,
364
- }}
365
- />
366
- <NodeToolbar
367
- isVisible={editing || toolbarVisible || selected}
368
- position={Position.Top}
369
- className={classes.nodeToolbar}
370
- onMouseEnter={() => setToolbarVisible(true)}
371
- onMouseLeave={() => setToolbarVisible(false)}
372
- >
373
- <div className={classes.buttonsContainer}>
374
- <HvMultiButton>
375
- <HvIconButton
376
- aria-label="Font Size"
377
- title="Font Size"
378
- ref={fontSizeConfigBtnRef}
379
- onClick={() => {
380
- setEditing(true);
381
- setFontSizeConfigOpen(true);
382
- }}
383
- >
384
- <FontSize />
385
- </HvIconButton>
386
- <HvIconButton
387
- aria-label="Bold"
388
- title="Bold"
389
- selected={mergedData.bold}
390
- onClick={handleToggleBold}
391
- >
392
- <Bold />
393
- </HvIconButton>
394
- <HvIconButton
395
- aria-label="Italic"
396
- title="Italic"
397
- selected={mergedData.italic}
398
- onClick={handleToggleItalic}
399
- >
400
- <Italic />
401
- </HvIconButton>
402
- <HvIconButton
403
- aria-label="Customize Colors"
404
- title="Customize Colors"
405
- ref={colorConfigBtnRef}
406
- onClick={() => {
407
- setEditing(true);
408
- setColorsConfigOpen(true);
409
- }}
410
- >
411
- <Palette />
412
- </HvIconButton>
413
- <HvIconButton
414
- aria-label="Delete"
415
- title="Delete"
416
- onClick={handleDeleteSticky}
417
- >
418
- <Delete />
419
- </HvIconButton>
420
- </HvMultiButton>
421
- </div>
422
- </NodeToolbar>
423
- <div
424
- onMouseEnter={() => setToolbarVisible(true)}
425
- onMouseLeave={() => setToolbarVisible(false)}
426
- className={classes.textAreaRoot}
427
- >
428
- <HvIconButton
429
- className={classes.expandButton}
430
- title="Fold"
431
- onClick={handleToggleExpand}
432
- >
433
- <ActualSize />
434
- </HvIconButton>
435
- <textarea
436
- id={`sticky-textarea-${id}`}
437
- value={text || ""}
438
- onChange={(e) => setText(e.target.value)}
439
- className={classes.textAreaInput}
440
- placeholder="Type here..."
441
- style={{
442
- color: mergedData.textColor ?? theme.colors.text,
443
- fontWeight: mergedData.bold ? "bold" : "normal",
444
- fontStyle: mergedData.italic ? "italic" : "normal",
445
- fontSize: mergedData.fontSize ?? "14px",
446
- }}
447
- onFocus={() => setEditing(true)}
448
- onBlur={() => {
449
- setEditing(false);
450
- setColorsConfigOpen(false);
451
- }}
452
- />
453
- </div>
454
- </>
455
- )}
456
- {!mergedData.expanded && (
457
- <>
458
- <HvIconButton
459
- title={
460
- <span
461
- style={{ whiteSpace: "pre-wrap", wordBreak: "break-word" }}
462
- >
463
- {text}
464
- </span>
465
- }
466
- onClick={handleToggleExpand}
467
- >
468
- <Fullscreen />
469
- </HvIconButton>
470
- </>
471
- )}
472
- </div>
473
- </>
474
- );
475
- };