@geneui/components 2.11.1

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 (154) hide show
  1. package/ActionableList.js +1761 -0
  2. package/AdvancedSearch.js +872 -0
  3. package/Alert.js +98 -0
  4. package/Avatar.js +77 -0
  5. package/Badge.js +76 -0
  6. package/Breadcrumb.js +128 -0
  7. package/BusyLoader.js +69 -0
  8. package/Button.js +130 -0
  9. package/CHANGELOG.md +424 -0
  10. package/Card.js +513 -0
  11. package/CardList.js +705 -0
  12. package/CellMeasurerCache-c11cec83.js +229 -0
  13. package/Charts.js +99 -0
  14. package/Checkbox.js +232 -0
  15. package/CheckboxGroup.js +206 -0
  16. package/CheckboxGroupWithSearch.js +279 -0
  17. package/Collapse.js +196 -0
  18. package/ColorPicker.js +210 -0
  19. package/ComboBox.js +99 -0
  20. package/Counter.js +99 -0
  21. package/DateFilter.js +179 -0
  22. package/DatePicker.js +1231 -0
  23. package/DatePickerInput.js +30 -0
  24. package/Divider.js +56 -0
  25. package/Drawer.js +264 -0
  26. package/Dropdown.js +99 -0
  27. package/Editor.js +22965 -0
  28. package/Empty.js +132 -0
  29. package/ExtendedInput.js +578 -0
  30. package/Form.js +116 -0
  31. package/FormContainer.js +189 -0
  32. package/FormableCheckbox.js +27 -0
  33. package/FormableDatePicker.js +39 -0
  34. package/FormableDropdown.js +105 -0
  35. package/FormableEditor.js +24 -0
  36. package/FormableHOC-21051057.js +83 -0
  37. package/FormableMultiSelectDropdown.js +105 -0
  38. package/FormableNumberInput.js +31 -0
  39. package/FormableRadio.js +23 -0
  40. package/FormableSwitcher.js +23 -0
  41. package/FormableTextInput.js +31 -0
  42. package/FormableUploader.js +40 -0
  43. package/GeneUIProvider.js +256 -0
  44. package/Grid.js +166 -0
  45. package/Holder.js +99 -0
  46. package/Icon.js +63 -0
  47. package/Image.js +130 -0
  48. package/ImagePreview.js +99 -0
  49. package/KeyValue.js +63 -0
  50. package/Label.js +58 -0
  51. package/LinkButton.js +104 -0
  52. package/Menu.js +277 -0
  53. package/MobileNavigation.js +95 -0
  54. package/MobilePopup.js +180 -0
  55. package/Modal.js +251 -0
  56. package/ModuleTitle.js +99 -0
  57. package/NavigationMenu.js +212 -0
  58. package/Notification.js +120 -0
  59. package/Option.js +186 -0
  60. package/Overlay.js +99 -0
  61. package/Overspread.js +343 -0
  62. package/Pagination.js +258 -0
  63. package/Paper.js +97 -0
  64. package/Popover-f4d1cac0.js +411 -0
  65. package/Popover.js +20 -0
  66. package/PopoverV2.js +19 -0
  67. package/Portal.js +58 -0
  68. package/Products.js +115 -0
  69. package/Profile.js +99 -0
  70. package/Progress.js +200 -0
  71. package/QRCode.js +816 -0
  72. package/README.md +90 -0
  73. package/Radio.js +152 -0
  74. package/RadioGroup.js +105 -0
  75. package/Range.js +14 -0
  76. package/RichEditor-b7928765.js +228 -0
  77. package/RichEditor.js +13 -0
  78. package/Scrollbar.js +1587 -0
  79. package/Search.js +72 -0
  80. package/SearchWithDropdown.js +195 -0
  81. package/Section.js +62 -0
  82. package/SkeletonLoader.js +82 -0
  83. package/Slider.js +256 -0
  84. package/Status.js +104 -0
  85. package/Steps.js +312 -0
  86. package/SuggestionList.js +15 -0
  87. package/Switcher.js +194 -0
  88. package/Table.js +102 -0
  89. package/TableCompositions.js +17028 -0
  90. package/Tabs.js +236 -0
  91. package/Tag.js +103 -0
  92. package/TextLink.js +22 -0
  93. package/Textarea.js +239 -0
  94. package/Time.js +63 -0
  95. package/TimePicker.js +99 -0
  96. package/Timeline.js +114 -0
  97. package/Title.js +66 -0
  98. package/Toaster.js +116 -0
  99. package/Tooltip.js +157 -0
  100. package/TransferList.js +502 -0
  101. package/Uploader.js +32 -0
  102. package/ValidatableCheckbox.js +126 -0
  103. package/ValidatableDatePicker.js +312 -0
  104. package/ValidatableDropdown.js +99 -0
  105. package/ValidatableElements.js +99 -0
  106. package/ValidatableMultiSelectDropdown.js +99 -0
  107. package/ValidatableNumberInput.js +194 -0
  108. package/ValidatableRadio.js +117 -0
  109. package/ValidatableSwitcher.js +94 -0
  110. package/ValidatableTextInput.js +164 -0
  111. package/ValidatableTimeInput.js +171 -0
  112. package/ValidatableUploader.js +94 -0
  113. package/Widget.js +99 -0
  114. package/_commonjsHelpers-24198af3.js +35 -0
  115. package/_rollupPluginBabelHelpers-e8fb2e5c.js +16 -0
  116. package/checkTimeValidation-e56771be.js +16 -0
  117. package/checkboxRadioSwitcher-5b69d7bd.js +4 -0
  118. package/clsx.m-2bb6df4b.js +3 -0
  119. package/configs-91c86664.js +96 -0
  120. package/configs.js +131 -0
  121. package/dateValidation-67caec66.js +225 -0
  122. package/debounce-4419bc2f.js +17 -0
  123. package/globalStyling-9c60a159.js +4 -0
  124. package/guid-8ddf77b3.js +16 -0
  125. package/index-00fe8887.js +193 -0
  126. package/index-0cf65939.js +30991 -0
  127. package/index-122432cd.js +270 -0
  128. package/index-262edd7a.js +77 -0
  129. package/index-5cea9a7d.js +407 -0
  130. package/index-5e722d91.js +867 -0
  131. package/index-67f4d4d1.js +6568 -0
  132. package/index-6ff23041.js +66 -0
  133. package/index-702bf24a.js +1938 -0
  134. package/index-a4635754.js +329 -0
  135. package/index-a59530cd.js +4 -0
  136. package/index-ac59cb10.js +169 -0
  137. package/index-b7a33c58.js +11 -0
  138. package/index-d9e8a888.js +987 -0
  139. package/index-e0af0caf.js +1182 -0
  140. package/index-e8776f3d.js +807 -0
  141. package/index.js +128 -0
  142. package/localization-4ba17032.js +46 -0
  143. package/objectWithoutPropertiesLoose-299691d8.js +78 -0
  144. package/package.json +190 -0
  145. package/rangeAndSlider-20599da4.js +8839 -0
  146. package/react-beautiful-dnd.esm-38c37304.js +10117 -0
  147. package/style-inject.es-746bb8ed.js +28 -0
  148. package/useClickOutside-5183e396.js +25 -0
  149. package/useDeviceType-dd51db38.js +15 -0
  150. package/useEllipsisDetection-ef536015.js +23 -0
  151. package/useKeyDown-38102ae7.js +21 -0
  152. package/useMount-6fef51a5.js +9 -0
  153. package/useWidth-9f4647f8.js +15 -0
  154. package/useWindowSize-80369d76.js +33 -0
@@ -0,0 +1,206 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useState, useEffect, useCallback } from 'react';
3
+ import { c as classnames } from './index-6ff23041.js';
4
+ import { p as propTypesExports } from './index-e0af0caf.js';
5
+ import { c as checkboxRadioSwitcherConfig } from './configs-91c86664.js';
6
+ import { n as noop } from './index-ac59cb10.js';
7
+ import Checkbox from './Checkbox.js';
8
+ import './globalStyling-9c60a159.js';
9
+ import './dateValidation-67caec66.js';
10
+ import './_commonjsHelpers-24198af3.js';
11
+ import 'react-dom';
12
+ import './Tooltip.js';
13
+ import './Popover-f4d1cac0.js';
14
+ import './useDeviceType-dd51db38.js';
15
+ import './useWindowSize-80369d76.js';
16
+ import './GeneUIProvider.js';
17
+ import './style-inject.es-746bb8ed.js';
18
+ import './checkboxRadioSwitcher-5b69d7bd.js';
19
+ import './guid-8ddf77b3.js';
20
+
21
+ function CheckboxGroup(props) {
22
+ const {
23
+ defaultSelected,
24
+ hoveredState,
25
+ labelAlignment,
26
+ showSelectAll,
27
+ labelPosition,
28
+ checkAllText,
29
+ description,
30
+ errorText,
31
+ className,
32
+ disabled,
33
+ onChange,
34
+ readOnly,
35
+ required,
36
+ isValid,
37
+ data,
38
+ size,
39
+ ...restProps
40
+ } = props;
41
+ const [valueState, setValueState] = useState(defaultSelected);
42
+ const isControlled = 'value' in props && props.value;
43
+ const values = isControlled ? props.value : valueState;
44
+ useEffect(() => {
45
+ setValueState(defaultSelected);
46
+ }, [defaultSelected]);
47
+ const handleChange = useCallback(e => {
48
+ const {
49
+ checked,
50
+ value
51
+ } = e.target;
52
+ const newValues = checked ? values.concat(value) : values.filter(item => item !== value);
53
+ !isControlled && setValueState(newValues);
54
+ onChange && onChange(newValues);
55
+ }, [isControlled, onChange, values]);
56
+ const handleChangeAll = useCallback(e => {
57
+ const {
58
+ checked
59
+ } = e.target;
60
+ const newValues = checked ? data.filter(option => !option.disabled).map(option => option.value) : [];
61
+ !isControlled && setValueState(newValues);
62
+ onChange && onChange(newValues);
63
+ }, [data, isControlled, onChange]);
64
+ const dataLength = data.filter(item => !item.disabled).length;
65
+ const valuesLength = values.length;
66
+ return /*#__PURE__*/React__default.createElement("div", _extends({
67
+ className: classnames('cha-ra-group', className)
68
+ }, restProps), showSelectAll && data.length > 1 && /*#__PURE__*/React__default.createElement(Checkbox, {
69
+ value: "all",
70
+ disabled: dataLength ? disabled : true,
71
+ checked: valuesLength === dataLength,
72
+ indeterminate: valuesLength > 0 && valuesLength < dataLength,
73
+ onChange: handleChangeAll,
74
+ label: checkAllText,
75
+ size: size,
76
+ labelPosition: labelPosition,
77
+ labelAlignment: labelAlignment,
78
+ readOnly: readOnly
79
+ }), data.map((option, index) => {
80
+ const isTypeofString = typeof option === 'string';
81
+ const label = isTypeofString ? option : option.label;
82
+ const value = isTypeofString ? option : option.value;
83
+ return /*#__PURE__*/React__default.createElement(Checkbox, {
84
+ labelTooltip: option.labelTooltip || '',
85
+ className: classnames(option.className, {
86
+ active: hoveredState === index
87
+ }),
88
+ key: value,
89
+ disabled: disabled || option.disabled,
90
+ label: label,
91
+ value: value,
92
+ checked: values.includes(value),
93
+ onChange: handleChange,
94
+ description: description || option.description,
95
+ readOnly: readOnly || option.readOnly,
96
+ required: required || option.required,
97
+ isValid: !(isValid || option.isValid),
98
+ errorText: errorText || option.errorText,
99
+ size: size,
100
+ labelPosition: labelPosition,
101
+ labelAlignment: labelAlignment
102
+ });
103
+ }));
104
+ }
105
+ CheckboxGroup.propTypes = {
106
+ /** Initially selected value */
107
+ defaultSelected: propTypesExports.arrayOf(propTypesExports.oneOfType([propTypesExports.string, propTypesExports.bool, propTypesExports.number])),
108
+ /**
109
+ * Disables events
110
+ */
111
+ disabled: propTypesExports.bool,
112
+ /**
113
+ * If data item is typeof string than value will apply both as checkbox label and value,
114
+ * Label: The text of the associated element.
115
+ * Value: The input value
116
+ * Disabled: A checkbox can appear disabled and be unable to change states
117
+ * readOnly: A checkbox can be read-only and unable to change states.
118
+ * required: If true, the input element will be required.
119
+ * labelTooltip: Tooltip for label.
120
+ * description: Checkbox description.
121
+ * isValid: Check validity of input value
122
+ * errorText: Displays custom error text when input value is not valid
123
+ */
124
+ data: propTypesExports.arrayOf(propTypesExports.oneOfType([propTypesExports.string, propTypesExports.shape({
125
+ label: propTypesExports.node,
126
+ value: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.bool, propTypesExports.number]),
127
+ disabled: propTypesExports.bool,
128
+ description: propTypesExports.string,
129
+ labelTooltip: propTypesExports.string,
130
+ readOnly: propTypesExports.bool,
131
+ required: propTypesExports.bool,
132
+ isValid: propTypesExports.bool,
133
+ errorText: propTypesExports.string
134
+ })])),
135
+ /**
136
+ * Custom text for checkAll checkbox
137
+ */
138
+ checkAllText: propTypesExports.string,
139
+ /**
140
+ * Displays select all checkbox
141
+ */
142
+ showSelectAll: propTypesExports.bool,
143
+ /**
144
+ * Array of values of the input elements
145
+ */
146
+ value: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.bool, propTypesExports.number]),
147
+ /**
148
+ * Fires an event when Checkbox is clicked or "enter" key is pressed
149
+ * (event: SyntheticEvent) => void
150
+ */
151
+ onChange: propTypesExports.func,
152
+ /**
153
+ * Additional className which applies to group holder div element
154
+ */
155
+ className: propTypesExports.string,
156
+ /**
157
+ * Accepts same values as Checkbox component(check in Checkbox component(molecules) propTable)
158
+ */
159
+ size: propTypesExports.oneOf(checkboxRadioSwitcherConfig.size),
160
+ /**
161
+ * Specify "label" position
162
+ */
163
+ labelPosition: propTypesExports.oneOf(checkboxRadioSwitcherConfig.labelPosition),
164
+ /**
165
+ * Specify "label" alignment
166
+ */
167
+ labelAlignment: propTypesExports.oneOf(checkboxRadioSwitcherConfig.labelAlignment),
168
+ /**
169
+ * Description for checkboxes
170
+ */
171
+ description: propTypesExports.string,
172
+ /**
173
+ * Define is field read only or no.
174
+ */
175
+ readOnly: propTypesExports.bool,
176
+ /**
177
+ * Define is field required or no.
178
+ */
179
+ required: propTypesExports.bool,
180
+ /**
181
+ * Additional state for field validation
182
+ */
183
+ isValid: propTypesExports.bool,
184
+ /**
185
+ * Text that will be shown id field is invalid
186
+ */
187
+ errorText: propTypesExports.string
188
+ };
189
+ CheckboxGroup.defaultProps = {
190
+ defaultSelected: [],
191
+ disabled: false,
192
+ showSelectAll: true,
193
+ data: [],
194
+ description: '',
195
+ checkAllText: 'Select All',
196
+ readOnly: false,
197
+ required: false,
198
+ isValid: true,
199
+ onChange: noop,
200
+ errorText: '',
201
+ size: checkboxRadioSwitcherConfig.size[0],
202
+ labelPosition: checkboxRadioSwitcherConfig.labelPosition[0],
203
+ labelAlignment: checkboxRadioSwitcherConfig.labelAlignment[0]
204
+ };
205
+
206
+ export { CheckboxGroup as default };
@@ -0,0 +1,279 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useRef, useState, useCallback, useEffect } from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import { n as noop } from './index-b7a33c58.js';
6
+ import './dateValidation-67caec66.js';
7
+ import 'react-dom';
8
+ import { u as useKeyDown } from './useKeyDown-38102ae7.js';
9
+ import './configs-91c86664.js';
10
+ import { checkboxRadioSwitcherConfig, noDataConfig } from './configs.js';
11
+ import CheckboxGroup from './CheckboxGroup.js';
12
+ import ExtendedInput from './ExtendedInput.js';
13
+ import CustomScrollbar from './Scrollbar.js';
14
+ import Button from './Button.js';
15
+ import Empty from './Empty.js';
16
+ import './index-a59530cd.js';
17
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
18
+ import './_commonjsHelpers-24198af3.js';
19
+ import './index-ac59cb10.js';
20
+ import './Checkbox.js';
21
+ import './Tooltip.js';
22
+ import './Popover-f4d1cac0.js';
23
+ import './useDeviceType-dd51db38.js';
24
+ import './useWindowSize-80369d76.js';
25
+ import './GeneUIProvider.js';
26
+ import './globalStyling-9c60a159.js';
27
+ import './checkboxRadioSwitcher-5b69d7bd.js';
28
+ import './guid-8ddf77b3.js';
29
+ import './index-5cea9a7d.js';
30
+ import './useClickOutside-5183e396.js';
31
+ import './Icon.js';
32
+
33
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .checkbox-group-with-search-holder{background:var(--background);width:100%}[data-gene-ui-version=\"2.11.0\"] .empty-data-holder{align-items:center;display:flex;height:19rem;justify-content:center;width:100%}[data-gene-ui-version=\"2.11.0\"] .c-g-w-s-content{background:rgba(var(--background-sc-rgb),.01);display:flex;flex-direction:column;width:100%}[data-gene-ui-version=\"2.11.0\"] .c-g-w-s-content>li{display:flex;width:100%}[data-gene-ui-version=\"2.11.0\"] .c-g-w-s-head{border-bottom:1px solid rgba(var(--background-sc-rgb),.1);padding:1.5rem}[data-gene-ui-version=\"2.11.0\"] .c-g-w-s-footer{border-top:1px solid rgba(var(--background-sc-rgb),.1);display:flex;justify-content:center;padding:1.5rem 0}[data-gene-ui-version=\"2.11.0\"] .c-g-w-s-footer>*+*{margin-inline-start:1rem}[data-gene-ui-version=\"2.11.0\"] .c-g-w-s-body-content{max-height:31rem;padding:1.5rem 0;width:100%}[data-gene-ui-version=\"2.11.0\"] .grouped-checkbox-with-search{flex-direction:column}[data-gene-ui-version=\"2.11.0\"] .grouped-checkbox-with-search>div{padding:1rem!important}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .checkbox-group-with-search-holder .crs-holder.active{background:rgba(var(--background-sc-rgb),.05)}}";
34
+ styleInject(css_248z);
35
+
36
+ function CheckboxGroupWithSearch(_ref) {
37
+ let {
38
+ className,
39
+ onSave,
40
+ onCancel,
41
+ saveText,
42
+ cancelText,
43
+ onSearch,
44
+ value,
45
+ defaultSelected,
46
+ onChange,
47
+ data: options,
48
+ noDataText,
49
+ noDataWithImage,
50
+ noDataTypes,
51
+ disableSave,
52
+ autofocusSearchField,
53
+ isSaveButtonLoading,
54
+ ...rest
55
+ } = _ref;
56
+ const parentRef = useRef(null);
57
+ const scrollbarRef = useRef(null);
58
+ const [query, setQuery] = useState('');
59
+ const [data, setData] = useState(options);
60
+ const [values, setValues] = useState(defaultSelected);
61
+ const [hoveredState, setHoveredState] = useState(-1);
62
+ const handleSearchChange = useCallback(e => {
63
+ const {
64
+ value
65
+ } = e.target;
66
+ onSearch ? onSearch(e) : setData(() => options.filter(item => !value || item.label.toLowerCase().includes(value.toLowerCase())));
67
+ setQuery(value);
68
+ }, [onSearch, options]);
69
+ const handleChange = useCallback(e => {
70
+ setValues(e);
71
+ onChange(e);
72
+ }, [onChange]);
73
+ function scroll(type, index) {
74
+ let newIndex = index;
75
+ if (type === 'prev' && data.length - 1 > index) {
76
+ newIndex++;
77
+ } else if (type === 'next' && index !== 0) {
78
+ newIndex--;
79
+ }
80
+ scrollbarRef.current.scrollTop(newIndex * Math.round(scrollbarRef.current.getScrollHeight() / data.length));
81
+ return newIndex;
82
+ }
83
+ useKeyDown(e => {
84
+ if (e.key === 'ArrowDown') {
85
+ setHoveredState(index => scroll('prev', index));
86
+ }
87
+ if (e.key === 'ArrowUp') {
88
+ setHoveredState(index => scroll('next', index));
89
+ }
90
+ if (e.key === 'Enter') {
91
+ onChange(e, hoveredState);
92
+ if (!value && data.length && hoveredState >= 0) {
93
+ setValues(v => {
94
+ const index = v.indexOf(data[hoveredState].value);
95
+ const newValues = [...v];
96
+ index > -1 ? newValues.splice(index, 1) : newValues.push(data[hoveredState].value);
97
+ return newValues;
98
+ });
99
+ }
100
+ }
101
+ }, [data, hoveredState, onChange], parentRef, ['ArrowUp', 'ArrowDown', 'Enter']);
102
+ useEffect(() => {
103
+ setData(options);
104
+ }, [options]);
105
+ useEffect(() => {
106
+ value && setValues(value);
107
+ }, [value]);
108
+ return /*#__PURE__*/React__default.createElement("div", {
109
+ ref: parentRef,
110
+ className: classnames('checkbox-group-with-search-holder', className)
111
+ }, /*#__PURE__*/React__default.createElement("ul", {
112
+ className: "c-g-w-s-content"
113
+ }, /*#__PURE__*/React__default.createElement("li", {
114
+ className: "c-g-w-s-head"
115
+ }, /*#__PURE__*/React__default.createElement(ExtendedInput, {
116
+ autoFocus: autofocusSearchField,
117
+ value: query,
118
+ type: "search",
119
+ onChange: handleSearchChange,
120
+ icon: "bc-icon-search"
121
+ })), /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement(CustomScrollbar, {
122
+ ref: scrollbarRef,
123
+ autoHeight: true
124
+ }, data.length ? /*#__PURE__*/React__default.createElement("div", {
125
+ className: "c-g-w-s-body-content"
126
+ }, /*#__PURE__*/React__default.createElement(CheckboxGroup, _extends({
127
+ hoveredState: hoveredState,
128
+ className: "grouped-checkbox-with-search",
129
+ data: data,
130
+ value: values,
131
+ onChange: handleChange
132
+ }, rest))) : /*#__PURE__*/React__default.createElement("div", {
133
+ className: "empty-data-holder"
134
+ }, /*#__PURE__*/React__default.createElement(Empty, {
135
+ title: noDataText,
136
+ appearance: "greyscale",
137
+ withImage: noDataWithImage,
138
+ className: "absolute",
139
+ type: noDataTypes,
140
+ size: "small"
141
+ })))), /*#__PURE__*/React__default.createElement("li", {
142
+ className: "c-g-w-s-footer"
143
+ }, onCancel && /*#__PURE__*/React__default.createElement(Button, {
144
+ appearance: "minimal",
145
+ color: "default",
146
+ onClick: onCancel
147
+ }, cancelText), onSave && /*#__PURE__*/React__default.createElement(Button, {
148
+ disabled: disableSave || isSaveButtonLoading,
149
+ onClick: onSave,
150
+ loading: isSaveButtonLoading
151
+ }, saveText))));
152
+ }
153
+ CheckboxGroupWithSearch.propTypes = {
154
+ /** Text for save button * */
155
+ saveText: propTypesExports.string,
156
+ /** Text for cancel button * */
157
+ cancelText: propTypesExports.string,
158
+ /** Save button click callback * */
159
+ onSave: propTypesExports.func,
160
+ /** Cancel button click callback * */
161
+ onCancel: propTypesExports.func,
162
+ /** Search input on change callback * */
163
+ onSearch: propTypesExports.func,
164
+ /** Initially selected value */
165
+ defaultSelected: propTypesExports.arrayOf(propTypesExports.oneOfType([propTypesExports.string, propTypesExports.bool, propTypesExports.number])),
166
+ /**
167
+ * Disables events
168
+ */
169
+ disabled: propTypesExports.bool,
170
+ /**
171
+ * Disables save button
172
+ */
173
+ disableSave: propTypesExports.bool,
174
+ /**
175
+ * If data item is typeof string than value will apply both as checkbox label and value,
176
+ * Label: The text of the associated element.
177
+ * Value: The input value
178
+ * Disabled: A checkbox can appear disabled and be unable to change states
179
+ * readOnly: A checkbox can be read-only and unable to change states.
180
+ * required: If true, the input element will be required.
181
+ * isValid: Check validity of input value
182
+ * errorText: Displays custom error text when input value is not valid
183
+ */
184
+ data: propTypesExports.arrayOf(propTypesExports.oneOfType([propTypesExports.string, propTypesExports.shape({
185
+ label: propTypesExports.node,
186
+ value: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.bool, propTypesExports.number]),
187
+ disabled: propTypesExports.bool,
188
+ description: propTypesExports.string,
189
+ readOnly: propTypesExports.bool,
190
+ required: propTypesExports.bool,
191
+ isValid: propTypesExports.bool,
192
+ errorText: propTypesExports.string
193
+ })])),
194
+ /**
195
+ * Custom text for checkAll checkbox
196
+ */
197
+ checkAllText: propTypesExports.string,
198
+ /**
199
+ * Displays select all checkbox
200
+ */
201
+ showSelectAll: propTypesExports.bool,
202
+ /**
203
+ * Array of values of the input elements
204
+ */
205
+ value: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.bool, propTypesExports.number]),
206
+ /**
207
+ * Fires an event when Checkbox is clicked or "enter" key is pressed
208
+ * (event: SyntheticEvent) => void
209
+ */
210
+ onChange: propTypesExports.func,
211
+ /**
212
+ * Additional className which applies to group holder div element
213
+ */
214
+ className: propTypesExports.string,
215
+ /**
216
+ * Accepts same values as Checkbox component(check in Checkbox component(molecules) propTable)
217
+ */
218
+ size: propTypesExports.oneOf(checkboxRadioSwitcherConfig.size),
219
+ /**
220
+ * Specify "label" position
221
+ */
222
+ labelPosition: propTypesExports.oneOf(checkboxRadioSwitcherConfig.labelPosition),
223
+ /**
224
+ * Specify "label" alignment
225
+ */
226
+ labelAlignment: propTypesExports.oneOf(checkboxRadioSwitcherConfig.labelAlignment),
227
+ /**
228
+ * Description for checkboxes
229
+ */
230
+ description: propTypesExports.string,
231
+ /**
232
+ * Define is field read only or no.
233
+ */
234
+ readOnly: propTypesExports.bool,
235
+ /**
236
+ * Define is field required or no.
237
+ */
238
+ required: propTypesExports.bool,
239
+ /**
240
+ * Additional state for field validation
241
+ */
242
+ isValid: propTypesExports.bool,
243
+ /**
244
+ * Text that will be shown id field is invalid
245
+ */
246
+ errorText: propTypesExports.string,
247
+ /**
248
+ * Different types/views for no data view
249
+ */
250
+ noDataTypes: propTypesExports.oneOf(noDataConfig),
251
+ /**
252
+ * Showing no data with image
253
+ */
254
+ noDataWithImage: propTypesExports.bool,
255
+ /**
256
+ * Custom No data text
257
+ */
258
+ noDataText: propTypesExports.string,
259
+ /*
260
+ * When rendering a component, the search field will automatically focused
261
+ */
262
+ autofocusSearchField: propTypesExports.bool,
263
+ /*
264
+ * Loader for save button
265
+ */
266
+ isSaveButtonLoading: propTypesExports.bool
267
+ };
268
+ CheckboxGroupWithSearch.defaultProps = {
269
+ onSave: noop,
270
+ onCancel: noop,
271
+ saveText: 'Save',
272
+ cancelText: 'Cancel',
273
+ noDataText: 'No data found',
274
+ noDataWithImage: true,
275
+ noDataTypes: 'image',
276
+ autofocusSearchField: false
277
+ };
278
+
279
+ export { CheckboxGroupWithSearch as default };
package/Collapse.js ADDED
@@ -0,0 +1,196 @@
1
+ import './globalStyling-9c60a159.js';
2
+ import React__default, { useMemo, useState, useEffect } from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { a as conflictPropsLog } from './index-ac59cb10.js';
5
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
6
+ import { c as classnames } from './index-6ff23041.js';
7
+ import Icon from './Icon.js';
8
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
9
+ import './dateValidation-67caec66.js';
10
+ import './_commonjsHelpers-24198af3.js';
11
+ import 'react-dom';
12
+
13
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .accordion-holder{overflow:hidden;width:100%}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-minimal:not(.active)+.a-minimal{margin:1.5rem 0 0}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-minimal.active .accordion-head-arrow{transform:rotate(180deg)}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-minimal .a-minimal:not(.active) .accordion-head-arrow{transform:rotate(-90deg)}html[dir=rtl] .accordion-holder.a-minimal .a-minimal:not(.active) .accordion-head-arrow{transform:rotate(90deg)}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-default{border:1px solid rgba(var(--background-sc-rgb),.05)}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-default+.a-default{margin:.5rem 0 0}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-default:first-of-type{border-top-left-radius:1rem;border-top-right-radius:1rem}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-default:last-of-type{border-bottom-left-radius:1rem;border-bottom-right-radius:1rem}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.a-default:not(.active) .accordion-head-arrow{transform:rotate(-90deg)}html[dir=rtl] .accordion-holder.a-default:not(.active) .accordion-head-arrow{transform:rotate(90deg)}[data-gene-ui-version=\"2.11.0\"] .accordion-holder.disabled{opacity:.5;pointer-events:none}[data-gene-ui-version=\"2.11.0\"] .accordion-head{align-items:center;cursor:pointer;display:flex;font:600 1.4rem/2.4rem var(--font-family);-webkit-user-select:none;user-select:none}[data-gene-ui-version=\"2.11.0\"] .a-default>.accordion-head{background:rgba(var(--background-sc-rgb),.02);height:4rem;padding:0 1.2rem}[data-gene-ui-version=\"2.11.0\"] .a-default>.accordion-head>li{flex-shrink:0}[data-gene-ui-version=\"2.11.0\"] .a-default>.accordion-head>li+li{margin:0 0 0 1.8rem}html[dir=rtl] .a-default>.accordion-head>li+li{margin:0 1.8rem 0 0}[data-gene-ui-version=\"2.11.0\"] .a-default>.accordion-head>li.ellipsis-text{flex:auto}[data-gene-ui-version=\"2.11.0\"] .a-minimal>.accordion-head>li{flex-shrink:0}[data-gene-ui-version=\"2.11.0\"] .a-minimal>.accordion-head>li.ellipsis-text{margin:0 1rem 0 .4rem}html[dir=rtl] .a-minimal>.accordion-head>li.ellipsis-text{margin:0 .4rem 0 1rem}[data-gene-ui-version=\"2.11.0\"] .a-minimal>.accordion-head>li.line{flex:auto}[data-gene-ui-version=\"2.11.0\"] .a-minimal>.accordion-head .line{background:rgba(var(--background-sc-rgb),.1);height:1px}[data-gene-ui-version=\"2.11.0\"] .accordion-head .accordion-head-arrow{transition:transform .3s}[data-gene-ui-version=\"2.11.0\"] .accordion-body{font:1.2rem/1.33 var(--font-family)}[data-gene-ui-version=\"2.11.0\"] .a-default .accordion-body{padding:1rem 2rem}[data-gene-ui-version=\"2.11.0\"] .a-minimal .accordion-body{padding:1rem 0 1rem 2.8rem}html[dir=rtl] .a-minimal .accordion-body{padding:1rem 2.8rem 1rem 0}";
14
+ styleInject(css_248z);
15
+
16
+ const appearances$1 = ['default', 'minimal'];
17
+ function Panel(props) {
18
+ const {
19
+ appearance,
20
+ disabled,
21
+ opened,
22
+ title,
23
+ children,
24
+ onClick,
25
+ expandIcon,
26
+ showIcon,
27
+ className,
28
+ rightAction,
29
+ ...restProps
30
+ } = props;
31
+ return /*#__PURE__*/React__default.createElement("div", _extends({}, restProps, {
32
+ className: classnames('accordion-holder', className, "a-".concat(appearance), {
33
+ disabled,
34
+ active: opened
35
+ })
36
+ }), /*#__PURE__*/React__default.createElement("ul", {
37
+ className: "accordion-head",
38
+ onClick: onClick
39
+ }, showIcon && /*#__PURE__*/React__default.createElement("li", null, expandIcon ? expandIcon(opened, props) : /*#__PURE__*/React__default.createElement(Icon, {
40
+ type: "bc-icon-arrow-down",
41
+ className: "accordion-head-arrow"
42
+ })), /*#__PURE__*/React__default.createElement("li", {
43
+ className: "ellipsis-text"
44
+ }, title), /*#__PURE__*/React__default.createElement("li", {
45
+ className: "line"
46
+ }), /*#__PURE__*/React__default.createElement("li", null, rightAction)), opened && /*#__PURE__*/React__default.createElement("div", {
47
+ className: "accordion-body"
48
+ }, children));
49
+ }
50
+ Panel.propTypes = {
51
+ /**
52
+ * Same as "Collapse" appearance. Note that you must not specify this prop in Panel itself
53
+ */
54
+ appearance: propTypesExports.oneOf(appearances$1),
55
+ /**
56
+ * Disabled state of Panel. Note it will set css "pointer-events" to "none" when set to "true"
57
+ */
58
+ disabled: propTypesExports.bool,
59
+ /**
60
+ * Panel is opened when set to "true". Note that you must not specify this prop in Panel itself
61
+ */
62
+ opened: propTypesExports.bool,
63
+ /**
64
+ * Use this prop to specify Panel's title. Any valid React node
65
+ */
66
+ title: propTypesExports.node,
67
+ /**
68
+ * Use this prop to specify Panel's content. Any valid React node
69
+ */
70
+ children: propTypesExports.node,
71
+ /**
72
+ * Fires an event on Panel click((event: Event) => void)
73
+ */
74
+ onClick: propTypesExports.func,
75
+ /**
76
+ * Same as Collapse. Note that you must not specify this prop in Panel itself
77
+ */
78
+ expandIcon: propTypesExports.func,
79
+ /**
80
+ * Hides the Panel icon when set to "false"
81
+ */
82
+ showIcon: propTypesExports.bool,
83
+ /**
84
+ * Additional className
85
+ */
86
+ className: propTypesExports.string,
87
+ /**
88
+ * Right action bar. Any valid React node
89
+ */
90
+ rightAction: propTypesExports.node
91
+ };
92
+ Panel.defaultProps = {
93
+ disabled: false,
94
+ showIcon: true
95
+ };
96
+
97
+ const deepCheck = children => {
98
+ Array.from(children).every(child => {
99
+ Array.isArray(child) && deepCheck(child);
100
+ return propTypesExports.shape({
101
+ type: propTypesExports.instanceOf(Panel)
102
+ });
103
+ });
104
+ };
105
+
106
+ const appearances = ['default', 'minimal'];
107
+ const getActiveKeys = (activeKeys, key, accordion, isControlled) => !isControlled && accordion ? activeKeys[0] === key ? [] : [key] : activeKeys.includes(key) ? activeKeys.filter(item => item !== key) : [...activeKeys, key];
108
+ function Collapse(props) {
109
+ const {
110
+ children,
111
+ defaultActiveKeys,
112
+ onChange,
113
+ appearance,
114
+ accordion,
115
+ expandIcon,
116
+ allActive
117
+ } = props;
118
+ const allKeys = useMemo(() => React__default.Children.map(children, _ref => {
119
+ let {
120
+ key
121
+ } = _ref;
122
+ return key;
123
+ }), [children]);
124
+ const isControlled = ('activeKeys' in props);
125
+ const [activeKeysState, setActiveKeysState] = useState(() => allActive ? allKeys : defaultActiveKeys);
126
+ const activeKeys = isControlled ? props.activeKeys : activeKeysState;
127
+ isControlled && accordion && conflictPropsLog('Collapse', ['activeKeys', 'accordion'], true);
128
+ useEffect(() => {
129
+ accordion && setActiveKeysState(prev => [prev[0]]);
130
+ }, [accordion]);
131
+ useEffect(() => {
132
+ allActive && setActiveKeysState(allKeys);
133
+ }, [allActive, allKeys]);
134
+ return React__default.Children.map(children, (child, index) => {
135
+ var _childProps$opened;
136
+ const {
137
+ key,
138
+ props: childProps
139
+ } = child;
140
+ const handleClick = e => {
141
+ const newActiveKeys = getActiveKeys(activeKeys, key, accordion, isControlled);
142
+ !isControlled && setActiveKeysState(newActiveKeys);
143
+ onChange && onChange(newActiveKeys);
144
+ childProps.onClick && childProps.onClick(e, childProps, index);
145
+ };
146
+ return /*#__PURE__*/React__default.cloneElement(child, {
147
+ opened: (_childProps$opened = childProps.opened) !== null && _childProps$opened !== void 0 ? _childProps$opened : activeKeys.includes(key),
148
+ onClick: handleClick,
149
+ appearance,
150
+ expandIcon
151
+ });
152
+ });
153
+ }
154
+ Collapse.propTypes = {
155
+ /**
156
+ * The child or children of Collapse molecule is "Panel"
157
+ */
158
+ children: (props, propName, componentName) => deepCheck(props.children),
159
+ /**
160
+ * Keys provided in array must correspond the keys which are set on child "Panel"'s. Also they will be opened.
161
+ * Using this prop means that you are controlling Collapse molecule
162
+ */
163
+ activeKeys: propTypesExports.arrayOf(propTypesExports.string),
164
+ /**
165
+ * Provide default state of opened "Panel"-s. Note that using this key does not mean to control Collapse
166
+ */
167
+ defaultActiveKeys: propTypesExports.arrayOf(propTypesExports.string),
168
+ /**
169
+ * Fires an event on Panel click((arrayOfKeys: string[]) => void)
170
+ */
171
+ onChange: propTypesExports.func,
172
+ /**
173
+ * Collapse appearance
174
+ */
175
+ appearance: propTypesExports.oneOf(appearances),
176
+ /**
177
+ * Only one "Panel" can be opened at a time when set to "true"
178
+ */
179
+ accordion: propTypesExports.bool,
180
+ /**
181
+ * Use this prop to override default icons of "Panel"(opened: boolean) => ReactElement
182
+ */
183
+ expandIcon: propTypesExports.func,
184
+ /**
185
+ * All 'Panel'-s are open/close by this prop
186
+ */
187
+ allActive: propTypesExports.bool
188
+ };
189
+ Collapse.defaultProps = {
190
+ appearance: appearances[1],
191
+ accordion: false,
192
+ defaultActiveKeys: [],
193
+ allActive: false
194
+ };
195
+
196
+ export { Collapse, Panel };