@orioro/react-ui-core 0.0.5 → 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 ADDED
@@ -0,0 +1,118 @@
1
+ # @orioro/react-ui-core
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
+
94
+ ## 0.0.6
95
+
96
+ ### Patch Changes
97
+
98
+ - fix changeset release with yarn
99
+ - Updated dependencies
100
+ - @orioro/resolve@0.1.2
101
+ - @orioro/tree-model@0.0.2
102
+ - @orioro/react-select@3.0.2
103
+ - @orioro/react-tree@0.0.2
104
+ - @orioro/util@0.11.2
105
+ - @orioro/validate@0.0.2
106
+
107
+ ## 0.0.5
108
+
109
+ ### Patch Changes
110
+
111
+ - f26720d: Initialize package version control using changeset
112
+ - Updated dependencies [f26720d]
113
+ - @orioro/tree-model@0.0.1
114
+ - @orioro/resolve@0.1.1
115
+ - @orioro/react-select@3.0.1
116
+ - @orioro/react-tree@0.0.1
117
+ - @orioro/validate@0.0.1
118
+ - @orioro/util@0.11.1
@@ -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:
@@ -4833,7 +4836,7 @@ function ArrayInputProvider(_a) {
4833
4836
  }
4834
4837
  setValue(arrayRemoveAt(localValue, index));
4835
4838
  } : onRemoveItem;
4836
- }, [onRemoveItem, localValue]);
4839
+ }, [onRemoveItem, localValue, setValue]);
4837
4840
  //
4838
4841
  // TODO: move operations into separate data context
4839
4842
  //
@@ -4877,7 +4880,7 @@ function ArrayInputProvider(_a) {
4877
4880
  return function (index, nextItem) {
4878
4881
  setValue(arrayReplaceAt(localValue, index, nextItem));
4879
4882
  };
4880
- }, [localValue]);
4883
+ }, [localValue, setValue]);
4881
4884
  var viewItem = useMemo(function () {
4882
4885
  return typeof onViewItem === 'function' ? onViewItem : null;
4883
4886
  }, [onViewItem]);
@@ -5301,8 +5304,9 @@ function CheckboxSelectInput(_a) {
5301
5304
  _c = _a.options,
5302
5305
  options = _c === void 0 ? [] : _c,
5303
5306
  _d = _a.sort,
5304
- sort = _d === void 0 ? true : _d;
5305
- __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"]);
5306
5310
  var _options = useMemo(function () {
5307
5311
  return parseOptions(options);
5308
5312
  }, [options]);
@@ -5315,7 +5319,8 @@ function CheckboxSelectInput(_a) {
5315
5319
  }, _options.map(function (option) {
5316
5320
  return /*#__PURE__*/React.createElement(Text, {
5317
5321
  as: "label",
5318
- key: option.key
5322
+ key: option.key,
5323
+ size: size
5319
5324
  }, /*#__PURE__*/React.createElement(Flex, {
5320
5325
  direction: "row",
5321
5326
  alignItems: "center",
@@ -5328,7 +5333,19 @@ function CheckboxSelectInput(_a) {
5328
5333
  });
5329
5334
  onSetArrayValue(sort ? typeof sort === 'function' ? nextArrayValue.sort(sort) : nextArrayValue.sort() : nextArrayValue);
5330
5335
  }
5331
- }), /*#__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
+ }))))));
5332
5349
  }))
5333
5350
  );
5334
5351
  }
@@ -5832,7 +5849,8 @@ function RadioSelectInput(_a) {
5832
5849
  disabled = _b === void 0 ? false : _b,
5833
5850
  _c = _a.options,
5834
5851
  options = _c === void 0 ? [] : _c,
5835
- flexProps = __rest(_a, ["value", "onSetValue", "disabled", "options"]);
5852
+ size = _a.size,
5853
+ flexProps = __rest(_a, ["value", "onSetValue", "disabled", "options", "size"]);
5836
5854
  var _options = useMemo(function () {
5837
5855
  return parseOptions(options);
5838
5856
  }, [options]);
@@ -5843,7 +5861,8 @@ function RadioSelectInput(_a) {
5843
5861
  }, flexProps), _options.map(function (option) {
5844
5862
  return /*#__PURE__*/React.createElement(Text, {
5845
5863
  as: "label",
5846
- key: option.key
5864
+ key: option.key,
5865
+ size: size
5847
5866
  }, /*#__PURE__*/React.createElement(Flex, {
5848
5867
  direction: "row",
5849
5868
  alignItems: "center",
@@ -5859,7 +5878,20 @@ function RadioSelectInput(_a) {
5859
5878
  }
5860
5879
  },
5861
5880
  disabled: disabled
5862
- }), /*#__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
+ }))))));
5863
5895
  }));
5864
5896
  }
5865
5897
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orioro/react-ui-core",
3
- "version": "0.0.5",
3
+ "version": "0.0.14",
4
4
  "packageManager": "yarn@4.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "prepublish": "yarn build"
26
26
  },
27
27
  "devDependencies": {
28
- "@orioro/dev": "workspace:^",
28
+ "@orioro/dev": "^0.0.5",
29
29
  "rollup": "^4.13.0",
30
30
  "rollup-plugin-import-css": "^3.5.0",
31
31
  "storybook": "^8.0.0"
@@ -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": "workspace:^",
41
- "@orioro/react-tree": "workspace:^",
42
- "@orioro/resolve": "workspace:^",
43
- "@orioro/tree-model": "workspace:^",
44
- "@orioro/util": "workspace:^",
45
- "@orioro/validate": "workspace:^",
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",
@@ -84,4 +84,4 @@
84
84
  "styled-components": "^6.1.8",
85
85
  "type-fest": "^4.12.0"
86
86
  }
87
- }
87
+ }