@dxc-technology/halstack-react 0.0.0-1819a7a → 0.0.0-1853afe

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 (84) hide show
  1. package/BackgroundColorContext.js +0 -1
  2. package/accordion/Accordion.d.ts +1 -1
  3. package/accordion/Accordion.js +9 -20
  4. package/accordion/Accordion.stories.tsx +9 -2
  5. package/accordion/types.d.ts +3 -7
  6. package/accordion-group/types.d.ts +3 -7
  7. package/bleed/Bleed.d.ts +3 -0
  8. package/bleed/Bleed.js +84 -0
  9. package/bleed/Bleed.stories.tsx +342 -0
  10. package/bleed/types.d.ts +13 -0
  11. package/bleed/types.js +5 -0
  12. package/button/Button.d.ts +1 -1
  13. package/button/Button.js +7 -15
  14. package/button/Button.stories.tsx +6 -8
  15. package/button/types.d.ts +3 -7
  16. package/card/Card.stories.tsx +1 -1
  17. package/checkbox/types.d.ts +1 -1
  18. package/chip/Chip.d.ts +1 -1
  19. package/chip/Chip.js +14 -52
  20. package/chip/Chip.stories.tsx +6 -8
  21. package/chip/types.d.ts +5 -13
  22. package/common/variables.js +38 -1
  23. package/date-input/DateInput.js +6 -6
  24. package/dialog/Dialog.js +2 -1
  25. package/dropdown/Dropdown.stories.tsx +247 -0
  26. package/file-input/FileInput.js +102 -33
  27. package/file-input/FileInput.stories.tsx +507 -0
  28. package/footer/Footer.js +18 -20
  29. package/heading/Heading.stories.tsx +3 -2
  30. package/inset/Inset.d.ts +3 -0
  31. package/inset/Inset.js +84 -0
  32. package/inset/Inset.stories.tsx +229 -0
  33. package/inset/types.d.ts +13 -0
  34. package/inset/types.js +5 -0
  35. package/layout/ApplicationLayout.js +1 -1
  36. package/list/List.d.ts +3 -6
  37. package/list/List.js +17 -7
  38. package/list/List.stories.tsx +25 -0
  39. package/list/types.d.ts +7 -0
  40. package/list/types.js +5 -0
  41. package/package.json +4 -2
  42. package/password-input/PasswordInput.stories.tsx +3 -3
  43. package/progress-bar/ProgressBar.js +2 -2
  44. package/radio-group/Radio.d.ts +4 -0
  45. package/radio-group/Radio.js +140 -0
  46. package/radio-group/RadioGroup.d.ts +4 -0
  47. package/radio-group/RadioGroup.js +273 -0
  48. package/radio-group/RadioGroup.stories.tsx +79 -0
  49. package/radio-group/RadioGroup.test.js +248 -0
  50. package/radio-group/types.d.ts +36 -0
  51. package/radio-group/types.js +5 -0
  52. package/resultsetTable/ResultsetTable.js +1 -1
  53. package/resultsetTable/ResultsetTable.stories.tsx +7 -8
  54. package/row/Row.d.ts +3 -11
  55. package/row/Row.js +12 -9
  56. package/row/Row.stories.tsx +20 -6
  57. package/row/types.d.ts +10 -0
  58. package/row/types.js +5 -0
  59. package/select/Select.d.ts +4 -0
  60. package/select/Select.js +5 -5
  61. package/select/types.d.ts +170 -0
  62. package/select/types.js +5 -0
  63. package/sidenav/Sidenav.stories.tsx +18 -1
  64. package/spinner/Spinner.stories.jsx +1 -0
  65. package/stack/Stack.d.ts +3 -10
  66. package/stack/Stack.js +12 -9
  67. package/stack/Stack.stories.tsx +20 -6
  68. package/stack/types.d.ts +9 -0
  69. package/stack/types.js +5 -0
  70. package/switch/Switch.stories.tsx +1 -1
  71. package/table/Table.stories.jsx +2 -1
  72. package/tabs/Tabs.js +7 -7
  73. package/tabs/Tabs.stories.tsx +7 -8
  74. package/tabs/types.d.ts +23 -15
  75. package/tag/Tag.stories.tsx +1 -1
  76. package/text/Text.js +1 -1
  77. package/text-input/TextInput.js +12 -4
  78. package/text-input/TextInput.stories.tsx +4 -4
  79. package/text-input/types.d.ts +1 -1
  80. package/textarea/Textarea.stories.jsx +4 -3
  81. package/toggle-group/ToggleGroup.js +10 -13
  82. package/toggle-group/ToggleGroup.stories.tsx +23 -28
  83. package/toggle-group/types.d.ts +38 -25
  84. package/select/index.d.ts +0 -131
@@ -6,16 +6,12 @@ declare type Margin = {
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
9
+ declare type SVG = React.SVGProps<SVGSVGElement>;
10
10
  declare type OptionCommons = {
11
11
  /**
12
12
  * Number with the option inner value.
13
13
  */
14
- value: string;
15
- /**
16
- * @deprecated URL of the icon that will be placed. IconSrc and label can't be used at same time.
17
- */
18
- iconSrc?: string;
14
+ value: number;
19
15
  };
20
16
  declare type OptionIcon = OptionCommons & {
21
17
  /**
@@ -25,7 +21,7 @@ declare type OptionIcon = OptionCommons & {
25
21
  /**
26
22
  * Element used as the icon. Icon and label can't be used at same time.
27
23
  */
28
- icon: SVG;
24
+ icon: string | SVG;
29
25
  };
30
26
  declare type OptionLabel = OptionCommons & {
31
27
  /**
@@ -35,10 +31,10 @@ declare type OptionLabel = OptionCommons & {
35
31
  /**
36
32
  * Element used as the icon. Icon and label can't be used at same time.
37
33
  */
38
- icon?: SVG;
34
+ icon?: string | SVG;
39
35
  };
40
36
  declare type Option = OptionIcon | OptionLabel;
41
- declare type Props = {
37
+ declare type CommonProps = {
42
38
  /**
43
39
  * Text to be placed above the component.
44
40
  */
@@ -47,18 +43,6 @@ declare type Props = {
47
43
  * Helper text to be placed above the component.
48
44
  */
49
45
  helperText?: string;
50
- /**
51
- * The key(s) of the selected value(s). If the toggle group component doesn't allow multiple selection,
52
- * it must be one unique value. If the component allows multiple selection, value must be an array.
53
- * If undefined, the component will be uncontrolled and the value will be managed internally by the component.
54
- */
55
- value?: string | string[];
56
- /**
57
- * This function will be called every time the selection changes. The number with the key of the selected
58
- * value will be passed as a parameter to this function.
59
- * If multiple selection is allowed, an array of keys will be passed.
60
- */
61
- onChange?: (optionIndex: number | number[]) => void;
62
46
  /**
63
47
  * If true, the component will be disabled.
64
48
  */
@@ -67,10 +51,6 @@ declare type Props = {
67
51
  * An array of objects representing the selectable options.
68
52
  */
69
53
  options: Option[];
70
- /**
71
- * If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
72
- */
73
- multiple?: boolean;
74
54
  /**
75
55
  * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
76
56
  * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
@@ -81,4 +61,37 @@ declare type Props = {
81
61
  */
82
62
  tabIndex?: number;
83
63
  };
64
+ declare type SingleSelectionToggle = CommonProps & {
65
+ /**
66
+ * If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
67
+ */
68
+ multiple?: false;
69
+ /**
70
+ * The key of the selected value. If the component allows multiple selection, value must be an array.
71
+ * If undefined, the component will be uncontrolled and the value will be managed internally by the component.
72
+ */
73
+ value?: number;
74
+ /**
75
+ * This function will be called every time the selection changes. The number with the key of the selected
76
+ * value will be passed as a parameter to this function.
77
+ */
78
+ onChange?: (optionIndex: number) => void;
79
+ };
80
+ declare type MultipleSelectionToggle = CommonProps & {
81
+ /**
82
+ * If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
83
+ */
84
+ multiple: true;
85
+ /**
86
+ * An array with the keys of the selected values.
87
+ * If undefined, the component will be uncontrolled and the value will be managed internally by the component.
88
+ */
89
+ value?: number[];
90
+ /**
91
+ * This function will be called every time the selection changes. An array with the key of
92
+ * the selected values will be passed as a parameter to this function.
93
+ */
94
+ onChange?: (optionIndex: number[]) => void;
95
+ };
96
+ declare type Props = SingleSelectionToggle | MultipleSelectionToggle;
84
97
  export default Props;
package/select/index.d.ts DELETED
@@ -1,131 +0,0 @@
1
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
- type Margin = {
3
- top?: Space;
4
- bottom?: Space;
5
- left?: Space;
6
- right?: Space;
7
- };
8
- type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
9
-
10
- type OptionGroup = {
11
- /**
12
- * Label of the group to be shown in the select's listbox.
13
- */
14
- label: string;
15
- /**
16
- * List of the grouped options.
17
- */
18
- options: Option[];
19
- };
20
- type Option = {
21
- /**
22
- * Element used as the icon that will be placed before the option label.
23
- * It can be a url of an image or an inline SVG. If the url option
24
- * is the chosen one, take into account that the component's
25
- * color styling tokens will not be applied to the image.
26
- */
27
- icon?: string | SVG;
28
- /**
29
- * Label of the option to be shown in the select's listbox.
30
- */
31
- label: string;
32
- /**
33
- * Value of the option. It should be unique and
34
- * not an empty string, which is reserved to the empty option added
35
- * by optional prop.
36
- */
37
- value: string;
38
- };
39
-
40
- type Props = {
41
- /**
42
- * Text to be placed above the select.
43
- */
44
- label?: string;
45
- /**
46
- * Name attribute of the input element. This attribute will allow users
47
- * to find the component's value during the submit event. In this event,
48
- * the component's value will always be a regular string, for both single
49
- * and multiple selection modes, been in the first one a single option
50
- * value and in the multiple variant more than one option value,
51
- * separated by commas.
52
- */
53
- name?: string;
54
- /**
55
- * Value of the select. If undefined, the component will be uncontrolled
56
- * and the value will be managed internally by the component.
57
- */
58
- value?: string | string[];
59
- /**
60
- * An array of objects representing the selectable options.
61
- */
62
- options?: Option[] | OptionGroup[];
63
- /**
64
- * Helper text to be placed above the select.
65
- */
66
- helperText?: string;
67
- /**
68
- * Text to be put as placeholder of the select.
69
- */
70
- placeholder?: string;
71
- /**
72
- * If true, the component will be disabled.
73
- */
74
- disabled?: boolean;
75
- /**
76
- * If true, the select will be optional, showing '(Optional)'
77
- * next to the label and adding a default first option with an empty string as value,
78
- * been the placeholder (if defined) its label. Otherwise, the field will be
79
- * considered required and an error will be passed as a parameter to the
80
- * OnBlur and onChange functions if an option wasn't selected.
81
- */
82
- optional?: boolean;
83
- /**
84
- * If true, enables search functionality.
85
- */
86
- searchable?: boolean;
87
- /**
88
- * If true, the select component will support multiple selected options.
89
- * In that case, value will be an array of strings with each selected
90
- * option value.
91
- */
92
- multiple?: boolean;
93
- /**
94
- * This function will be called when the user selects an option.
95
- * An object including the current value and the error (if the value entered is not valid)
96
- * will be passed to this function. If there is no error, error will be null.
97
- */
98
- onChange?: (value: string | string[]) => void;
99
- /**
100
- * This function will be called when the select loses the focus. An
101
- * object including the value (or values) and the error (if the value
102
- * selected is not valid) will be passed to this function. If there is no error,
103
- * error will be null.
104
- */
105
- onBlur?: (val: { value: string | string[]; error: string }) => void;
106
- /**
107
- * If it is defined, the component will change its appearance, showing
108
- * the error below the select component. If it is not defined, the error
109
- * messages will be managed internally, but never displayed on its own.
110
- */
111
- error?: string;
112
- /**
113
- * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
114
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
115
- */
116
- margin?: Space | Margin;
117
- /**
118
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
119
- */
120
- size?: "small" | "medium" | "large" | "fillParent";
121
- /**
122
- * Value of the tabindex attribute.
123
- */
124
- tabIndex?: number;
125
- /**
126
- * Reference to the component.
127
- */
128
- ref?: React.RefObject<HTMLDivElement>;
129
- };
130
-
131
- export default function DxcSelect(props: Props): JSX.Element;