@orioro/react-ui-core 0.0.6 → 0.0.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,96 @@
1
1
  # @orioro/react-ui-core
2
2
 
3
+ ## 0.0.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @orioro/react-select@3.0.3
9
+
10
+ ## 0.0.13
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ - @orioro/util@0.15.1
16
+ - @orioro/resolve@0.1.9
17
+ - @orioro/tree-model@0.0.9
18
+ - @orioro/react-select@3.0.2
19
+ - @orioro/validate@0.0.9
20
+ - @orioro/react-tree@0.0.9
21
+
22
+ ## 0.0.12
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+ - @orioro/util@0.15.0
28
+ - @orioro/resolve@0.1.8
29
+ - @orioro/tree-model@0.0.8
30
+ - @orioro/react-select@3.0.2
31
+ - @orioro/validate@0.0.8
32
+ - @orioro/react-tree@0.0.8
33
+
34
+ ## 0.0.11
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies
39
+ - @orioro/util@0.14.0
40
+ - @orioro/resolve@0.1.7
41
+ - @orioro/tree-model@0.0.7
42
+ - @orioro/react-select@3.0.2
43
+ - @orioro/validate@0.0.7
44
+ - @orioro/react-tree@0.0.7
45
+
46
+ ## 0.0.10
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies
51
+ - @orioro/util@0.13.2
52
+ - @orioro/resolve@0.1.6
53
+ - @orioro/tree-model@0.0.6
54
+ - @orioro/react-select@3.0.2
55
+ - @orioro/validate@0.0.6
56
+ - @orioro/react-tree@0.0.6
57
+
58
+ ## 0.0.9
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies
63
+ - @orioro/util@0.13.1
64
+ - @orioro/resolve@0.1.5
65
+ - @orioro/tree-model@0.0.5
66
+ - @orioro/react-select@3.0.2
67
+ - @orioro/validate@0.0.5
68
+ - @orioro/react-tree@0.0.5
69
+
70
+ ## 0.0.8
71
+
72
+ ### Patch Changes
73
+
74
+ - Updated dependencies
75
+ - @orioro/util@0.13.0
76
+ - @orioro/resolve@0.1.4
77
+ - @orioro/tree-model@0.0.4
78
+ - @orioro/react-select@3.0.2
79
+ - @orioro/validate@0.0.4
80
+ - @orioro/react-tree@0.0.4
81
+
82
+ ## 0.0.7
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies
87
+ - @orioro/util@0.12.0
88
+ - @orioro/resolve@0.1.3
89
+ - @orioro/tree-model@0.0.3
90
+ - @orioro/react-select@3.0.2
91
+ - @orioro/validate@0.0.3
92
+ - @orioro/react-tree@0.0.3
93
+
3
94
  ## 0.0.6
4
95
 
5
96
  ### Patch Changes
@@ -7,6 +7,7 @@ export declare const BooleanCheckboxInput: React.ForwardRefExoticComponent<{
7
7
  onBlur?: (() => void) | undefined;
8
8
  disabled?: boolean | undefined;
9
9
  required?: string | boolean | undefined;
10
+ size?: "1" | "2" | "3" | undefined;
10
11
  error?: Error | import("../types").ErrorLike | undefined;
11
12
  errorStyle?: React.CSSProperties | undefined;
12
13
  validate?: boolean | (string | ((input: any, context: {
@@ -8,5 +8,5 @@ type CheckboxSelectInputProps<ValueType = string> = FlexProps & Merge<InputProps
8
8
  options: OptionsInput<ValueType>;
9
9
  sort?: boolean | ((a: ValueType, b: ValueType) => number);
10
10
  }>;
11
- export declare function CheckboxSelectInput<ValueType = string>({ value: arrayValue, onSetValue: onSetArrayValue, options, sort, ...flexProps }: CheckboxSelectInputProps<ValueType>): React.JSX.Element;
11
+ export declare function CheckboxSelectInput<ValueType = string>({ value: arrayValue, onSetValue: onSetArrayValue, options, sort, size, ...flexProps }: CheckboxSelectInputProps<ValueType>): React.JSX.Element;
12
12
  export {};
@@ -27,6 +27,7 @@ export declare const ObjectInput: React.ForwardRefExoticComponent<InputProps<Any
27
27
  onBlur?: (() => void) | undefined;
28
28
  disabled?: boolean | undefined;
29
29
  required?: string | boolean | undefined;
30
+ size?: "1" | "2" | "3" | undefined;
30
31
  error?: Error | ErrorLike | undefined;
31
32
  errorStyle?: React.CSSProperties | undefined;
32
33
  validate?: boolean | (string | ((input: any, context: {
@@ -9,5 +9,5 @@ type RadioSelectInputProps<ValueType = string> = FlexProps & Merge<InputProps, {
9
9
  sort?: boolean | ((a: ValueType, b: ValueType) => number);
10
10
  valueStringify?: (value: ValueType) => string;
11
11
  }>;
12
- export declare function RadioSelectInput<ValueType = string>({ value, onSetValue, disabled, options, ...flexProps }: RadioSelectInputProps<ValueType>): React.JSX.Element;
12
+ export declare function RadioSelectInput<ValueType = string>({ value, onSetValue, disabled, options, size, ...flexProps }: RadioSelectInputProps<ValueType>): React.JSX.Element;
13
13
  export {};
@@ -12,6 +12,7 @@ export declare const RichTextInput: React.ForwardRefExoticComponent<{
12
12
  onBlur?: (() => void) | undefined;
13
13
  disabled?: boolean | undefined;
14
14
  required?: string | boolean | undefined;
15
+ size?: "1" | "2" | "3" | undefined;
15
16
  error?: Error | import("..").ErrorLike | undefined;
16
17
  errorStyle?: React.CSSProperties | undefined;
17
18
  validate?: boolean | (string | ((input: any, context: {
@@ -12,6 +12,7 @@ export declare const RichTextInput: React.ForwardRefExoticComponent<{
12
12
  onBlur?: (() => void) | undefined;
13
13
  disabled?: boolean | undefined;
14
14
  required?: string | boolean | undefined;
15
+ size?: "1" | "2" | "3" | undefined;
15
16
  error?: Error | import("..").ErrorLike | undefined;
16
17
  errorStyle?: React.CSSProperties | undefined;
17
18
  validate?: boolean | (string | ((input: any, context: {
@@ -7,6 +7,7 @@ export declare const SingleFileInput: React.ForwardRefExoticComponent<{
7
7
  onSetValue: (value: File | null) => void;
8
8
  onBlur?: (() => void) | undefined;
9
9
  required?: string | boolean | undefined;
10
+ size?: "1" | "2" | "3" | undefined;
10
11
  error?: Error | import("../types").ErrorLike | undefined;
11
12
  errorStyle?: React.CSSProperties | undefined;
12
13
  validate?: boolean | (string | ((input: any, context: {
@@ -8,6 +8,7 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
8
8
  onBlur?: (() => void) | undefined;
9
9
  disabled?: boolean | undefined;
10
10
  required?: string | boolean | undefined;
11
+ size?: "1" | "2" | "3" | undefined;
11
12
  error?: Error | ErrorLike | undefined;
12
13
  errorStyle?: React.CSSProperties | undefined;
13
14
  validate?: boolean | (string | ((input: any, context: {
@@ -7,6 +7,7 @@ export declare const TextareaInput: React.ForwardRefExoticComponent<{
7
7
  onBlur?: (() => void) | undefined;
8
8
  disabled?: boolean | undefined;
9
9
  required?: string | boolean | undefined;
10
+ size?: "1" | "2" | "3" | undefined;
10
11
  error?: Error | import("..").ErrorLike | undefined;
11
12
  errorStyle?: React.CSSProperties | undefined;
12
13
  validate?: boolean | (string | ((input: any, context: {
@@ -16,6 +16,7 @@ export type InputProps<ValueType = any> = {
16
16
  onBlur?: () => void;
17
17
  disabled?: boolean;
18
18
  required?: boolean | string;
19
+ size?: '1' | '2' | '3';
19
20
  error?: ErrorLike | Error;
20
21
  errorStyle?: CSSProperties;
21
22
  validate?: AsyncValidatorSystem['ValidatorInput'] | boolean;
@@ -1,13 +1,13 @@
1
- import { AsyncValidatorSystem, DetailedInvalid } from '@orioro/util/dist/validate/types';
2
- import { ErrorLike, InputProps } from '../types';
1
+ import { AsyncValidatorSystem } from '@orioro/util/dist/validate/types';
2
+ import { InputProps } from '../types';
3
3
  export type UseValidationProps = {
4
4
  value: InputProps['value'];
5
5
  error: InputProps['error'];
6
6
  validator: AsyncValidatorSystem['ValidatorInput'] | false;
7
7
  };
8
8
  export declare function useValidation({ value, error, validator }: UseValidationProps): {
9
- validationState: "loading" | "idle" | ErrorLike | DetailedInvalid | "valid";
10
- setValidationState: (v: "loading" | "idle" | ErrorLike | DetailedInvalid | "valid" | ((currValue: "loading" | "idle" | ErrorLike | DetailedInvalid | "valid") => "loading" | "idle" | ErrorLike | DetailedInvalid | "valid")) => void;
11
- validationError: ErrorLike | DetailedInvalid | null;
9
+ validationState: any;
10
+ setValidationState: (v: any) => void;
11
+ validationError: any;
12
12
  runValidation: () => Promise<true | import("@orioro/validate").DetailedInvalid>;
13
13
  };
@@ -2,10 +2,12 @@ export type ParsedOption<ValueType = any> = {
2
2
  key: string;
3
3
  label: string;
4
4
  value: ValueType;
5
+ [key: string]: any;
5
6
  };
6
7
  export type Option<ValueType = any> = {
7
8
  label: string;
8
9
  value: ValueType;
10
+ [key: string]: any;
9
11
  };
10
12
  export type OptionsInput<ValueType = any> = (Option<ValueType> | string | [string, ValueType])[];
11
13
  export declare function parseOptions(optionsInput?: OptionsInput): ParsedOption[];
package/dist/index.mjs CHANGED
@@ -10,8 +10,8 @@ import { switchExec, typeOf, promiseReduce, deprecateFn } from '@orioro/util';
10
10
  export { switchExec, switchValue, typeOf } from '@orioro/util';
11
11
  import { useFirstMountState, useDebounce, useMeasure as useMeasure$1, useClickAway, useLocation, useBeforeUnload } from 'react-use';
12
12
  import { FaceIcon, ImageIcon, SunIcon, MagnifyingGlassIcon, CrossCircledIcon, Link2Icon, Cross2Icon, ExclamationTriangleIcon, CheckIcon, DragHandleHorizontalIcon, TrashIcon, PlusCircledIcon } from '@radix-ui/react-icons';
13
- import Icon$1, { Icon } from '@mdi/react';
14
- import { mdiPencil, mdiAlertCircle, mdiFilePdfBox, mdiFileWordBox, mdiGoogleSpreadsheet, mdiFileExcelBox, mdiFilePresentationBox, mdiZipBoxOutline, mdiCodeBlockTags, mdiVolumeHigh, mdiImageArea, mdiPlayBox, mdiFileOutline, mdiClose, mdiPlus, mdiCheck, mdiTranslate } from '@mdi/js';
13
+ import { Icon } from '@mdi/react';
14
+ import { mdiPencil, mdiAlertCircle, mdiFilePdfBox, mdiFileWordBox, mdiGoogleSpreadsheet, mdiFileExcelBox, mdiFilePresentationBox, mdiZipBoxOutline, mdiCodeBlockTags, mdiVolumeHigh, mdiImageArea, mdiPlayBox, mdiFileOutline, mdiClose, mdiPlus, mdiHelpCircleOutline, mdiCheck, mdiTranslate } from '@mdi/js';
15
15
  import { useDropzone } from 'react-dropzone';
16
16
  import bytes from 'bytes';
17
17
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
@@ -3392,7 +3392,7 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInputInner(props, ref) {
3392
3392
  onClick: function onClick() {
3393
3393
  return clear();
3394
3394
  }
3395
- }, /*#__PURE__*/React.createElement(Icon$1, {
3395
+ }, /*#__PURE__*/React.createElement(Icon, {
3396
3396
  path: mdiClose,
3397
3397
  size: "14px"
3398
3398
  })))))), !noValidationState && Boolean(validationError) && ( /*#__PURE__*/React.createElement(ErrorDisplay, null, validationError.message)));
@@ -3755,9 +3755,9 @@ function richTextTrimEmptyBlocks(blocks) {
3755
3755
 
3756
3756
  // Define a function to extract text from InlineContent
3757
3757
  function extractTextFromInlineContent(content) {
3758
- if (content.type === 'text') {
3758
+ if ((content === null || content === void 0 ? void 0 : content.type) === 'text') {
3759
3759
  return content.text;
3760
- } else if (content.type === 'link') {
3760
+ } else if ((content === null || content === void 0 ? void 0 : content.type) === 'link') {
3761
3761
  return content.content.map(extractTextFromInlineContent).join('');
3762
3762
  }
3763
3763
  return '';
@@ -3783,9 +3783,12 @@ function richTextToPlainText(blocks) {
3783
3783
  return inlineContent.map(extractTextFromInlineContent).join(CHARACTERS.whitespace);
3784
3784
  case 'table':
3785
3785
  var tableContent = block.content;
3786
- return tableContent.rows.map(function (row) {
3787
- return row.cells.map(extractTextFromInlineContent).join(CHARACTERS.tableCellBreak);
3788
- }).join(CHARACTERS.tableRowBreak);
3786
+ var rowStrs = tableContent.rows.map(function (row) {
3787
+ return row.cells.map(function (cell) {
3788
+ return Array.isArray(cell) ? cell.map(extractTextFromInlineContent).join(' ') : extractTextFromInlineContent(cell);
3789
+ }).join(CHARACTERS.tableCellBreak);
3790
+ });
3791
+ return rowStrs.join(CHARACTERS.tableRowBreak);
3789
3792
  case 'image':
3790
3793
  return block.props.caption;
3791
3794
  default:
@@ -4363,18 +4366,24 @@ function MenuItem(_a) {
4363
4366
  onClick: function onClick() {
4364
4367
  return onSelect(item);
4365
4368
  }
4366
- }, item), item.label);
4369
+ }, item, {
4370
+ type: "button"
4371
+ }), item.label);
4367
4372
  }
4368
4373
  case 'link':
4369
4374
  {
4370
- return /*#__PURE__*/React.createElement(cp.Button, _assign({}, item), item.label);
4375
+ return /*#__PURE__*/React.createElement(cp.Button, _assign({}, item, {
4376
+ type: "button"
4377
+ }), item.label);
4371
4378
  }
4372
4379
  case 'subMenu':
4373
4380
  {
4374
4381
  return /*#__PURE__*/React.createElement(cp.DropdownMenu, {
4375
4382
  options: item.options,
4376
4383
  onSelect: onSelect
4377
- }, /*#__PURE__*/React.createElement(cp.Button, _assign({}, item), item.label, " ", /*#__PURE__*/React.createElement(cp.DropdownMenu.TriggerIcon, null)));
4384
+ }, /*#__PURE__*/React.createElement(cp.Button, _assign({}, item, {
4385
+ type: "button"
4386
+ }), item.label, " ", /*#__PURE__*/React.createElement(cp.DropdownMenu.TriggerIcon, null)));
4378
4387
  }
4379
4388
  }
4380
4389
  }
@@ -4827,7 +4836,7 @@ function ArrayInputProvider(_a) {
4827
4836
  }
4828
4837
  setValue(arrayRemoveAt(localValue, index));
4829
4838
  } : onRemoveItem;
4830
- }, [onRemoveItem, localValue]);
4839
+ }, [onRemoveItem, localValue, setValue]);
4831
4840
  //
4832
4841
  // TODO: move operations into separate data context
4833
4842
  //
@@ -4871,7 +4880,7 @@ function ArrayInputProvider(_a) {
4871
4880
  return function (index, nextItem) {
4872
4881
  setValue(arrayReplaceAt(localValue, index, nextItem));
4873
4882
  };
4874
- }, [localValue]);
4883
+ }, [localValue, setValue]);
4875
4884
  var viewItem = useMemo(function () {
4876
4885
  return typeof onViewItem === 'function' ? onViewItem : null;
4877
4886
  }, [onViewItem]);
@@ -5295,8 +5304,9 @@ function CheckboxSelectInput(_a) {
5295
5304
  _c = _a.options,
5296
5305
  options = _c === void 0 ? [] : _c,
5297
5306
  _d = _a.sort,
5298
- sort = _d === void 0 ? true : _d;
5299
- __rest(_a, ["value", "onSetValue", "options", "sort"]);
5307
+ sort = _d === void 0 ? true : _d,
5308
+ size = _a.size;
5309
+ __rest(_a, ["value", "onSetValue", "options", "sort", "size"]);
5300
5310
  var _options = useMemo(function () {
5301
5311
  return parseOptions(options);
5302
5312
  }, [options]);
@@ -5309,7 +5319,8 @@ function CheckboxSelectInput(_a) {
5309
5319
  }, _options.map(function (option) {
5310
5320
  return /*#__PURE__*/React.createElement(Text, {
5311
5321
  as: "label",
5312
- key: option.key
5322
+ key: option.key,
5323
+ size: size
5313
5324
  }, /*#__PURE__*/React.createElement(Flex, {
5314
5325
  direction: "row",
5315
5326
  alignItems: "center",
@@ -5322,7 +5333,19 @@ function CheckboxSelectInput(_a) {
5322
5333
  });
5323
5334
  onSetArrayValue(sort ? typeof sort === 'function' ? nextArrayValue.sort(sort) : nextArrayValue.sort() : nextArrayValue);
5324
5335
  }
5325
- }), /*#__PURE__*/React.createElement("span", null, option.label)));
5336
+ }), /*#__PURE__*/React.createElement(Flex, {
5337
+ direction: "row",
5338
+ gap: "2",
5339
+ alignItems: "center"
5340
+ }, /*#__PURE__*/React.createElement(Text, {
5341
+ size: size
5342
+ }, option.label), option.tooltip && ( /*#__PURE__*/React.createElement(Tooltip, {
5343
+ content: option.tooltip
5344
+ }, /*#__PURE__*/React.createElement(Icon, {
5345
+ path: mdiHelpCircleOutline,
5346
+ size: "16px",
5347
+ "aria-label": "Ajuda"
5348
+ }))))));
5326
5349
  }))
5327
5350
  );
5328
5351
  }
@@ -5826,7 +5849,8 @@ function RadioSelectInput(_a) {
5826
5849
  disabled = _b === void 0 ? false : _b,
5827
5850
  _c = _a.options,
5828
5851
  options = _c === void 0 ? [] : _c,
5829
- flexProps = __rest(_a, ["value", "onSetValue", "disabled", "options"]);
5852
+ size = _a.size,
5853
+ flexProps = __rest(_a, ["value", "onSetValue", "disabled", "options", "size"]);
5830
5854
  var _options = useMemo(function () {
5831
5855
  return parseOptions(options);
5832
5856
  }, [options]);
@@ -5837,7 +5861,8 @@ function RadioSelectInput(_a) {
5837
5861
  }, flexProps), _options.map(function (option) {
5838
5862
  return /*#__PURE__*/React.createElement(Text, {
5839
5863
  as: "label",
5840
- key: option.key
5864
+ key: option.key,
5865
+ size: size
5841
5866
  }, /*#__PURE__*/React.createElement(Flex, {
5842
5867
  direction: "row",
5843
5868
  alignItems: "center",
@@ -5853,7 +5878,20 @@ function RadioSelectInput(_a) {
5853
5878
  }
5854
5879
  },
5855
5880
  disabled: disabled
5856
- }), /*#__PURE__*/React.createElement("span", null, option.label)));
5881
+ }), /*#__PURE__*/React.createElement(Flex, {
5882
+ direction: "row",
5883
+ gap: "2",
5884
+ alignItems: "center"
5885
+ }, /*#__PURE__*/React.createElement(Text, {
5886
+ size: size
5887
+ }, option.label), option.tooltip && ( /*#__PURE__*/React.createElement(Tooltip, {
5888
+ content: option.tooltip
5889
+ }, /*#__PURE__*/React.createElement(Icon, {
5890
+ color: "var(--gray-9)",
5891
+ path: mdiHelpCircleOutline,
5892
+ size: "16px",
5893
+ "aria-label": "Ajuda"
5894
+ }))))));
5857
5895
  }));
5858
5896
  }
5859
5897
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orioro/react-ui-core",
3
- "version": "0.0.6",
3
+ "version": "0.0.14",
4
4
  "packageManager": "yarn@4.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -37,12 +37,12 @@
37
37
  "@mdi/js": "^7.4.47",
38
38
  "@mdi/react": "^1.6.1",
39
39
  "@mui/base": "^5.0.0-beta.40",
40
- "@orioro/react-select": "^3.0.2",
41
- "@orioro/react-tree": "^0.0.2",
42
- "@orioro/resolve": "^0.1.2",
43
- "@orioro/tree-model": "^0.0.2",
44
- "@orioro/util": "^0.11.2",
45
- "@orioro/validate": "^0.0.2",
40
+ "@orioro/react-select": "^3.0.3",
41
+ "@orioro/react-tree": "^0.0.9",
42
+ "@orioro/resolve": "^0.1.9",
43
+ "@orioro/tree-model": "^0.0.9",
44
+ "@orioro/util": "^0.15.1",
45
+ "@orioro/validate": "^0.0.9",
46
46
  "@radix-ui/react-collapsible": "^1.1.0",
47
47
  "@radix-ui/react-dialog": "^1.0.5",
48
48
  "@radix-ui/react-icons": "^1.3.0",