@coreui/react 5.9.2 → 5.10.0

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 (34) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/dist/cjs/components/chip/CChip.d.ts +76 -0
  4. package/dist/cjs/components/chip/CChip.js +178 -0
  5. package/dist/cjs/components/chip/CChip.js.map +1 -0
  6. package/dist/cjs/components/chip/index.d.ts +2 -0
  7. package/dist/cjs/components/form/CChipInput.d.ts +92 -0
  8. package/dist/cjs/components/form/CChipInput.js +253 -0
  9. package/dist/cjs/components/form/CChipInput.js.map +1 -0
  10. package/dist/cjs/components/form/index.d.ts +2 -1
  11. package/dist/cjs/components/index.d.ts +1 -0
  12. package/dist/cjs/index.js +4 -0
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/esm/components/chip/CChip.d.ts +76 -0
  15. package/dist/esm/components/chip/CChip.js +176 -0
  16. package/dist/esm/components/chip/CChip.js.map +1 -0
  17. package/dist/esm/components/chip/index.d.ts +2 -0
  18. package/dist/esm/components/form/CChipInput.d.ts +92 -0
  19. package/dist/esm/components/form/CChipInput.js +251 -0
  20. package/dist/esm/components/form/CChipInput.js.map +1 -0
  21. package/dist/esm/components/form/index.d.ts +2 -1
  22. package/dist/esm/components/index.d.ts +1 -0
  23. package/dist/esm/index.js +2 -0
  24. package/dist/esm/index.js.map +1 -1
  25. package/package.json +5 -5
  26. package/src/components/chip/CChip.tsx +372 -0
  27. package/src/components/chip/__tests__/CChip.spec.tsx +113 -0
  28. package/src/components/chip/__tests__/__snapshots__/CChip.spec.tsx.snap +65 -0
  29. package/src/components/chip/index.ts +3 -0
  30. package/src/components/form/CChipInput.tsx +477 -0
  31. package/src/components/form/__tests__/CChipInput.spec.tsx +62 -0
  32. package/src/components/form/__tests__/__snapshots__/CChipInput.spec.tsx.snap +91 -0
  33. package/src/components/form/index.ts +2 -0
  34. package/src/components/index.ts +1 -0
@@ -0,0 +1,251 @@
1
+ import { __rest } from '../../node_modules/tslib/tslib.es6.js';
2
+ import React, { forwardRef, useState, useRef, useMemo, useEffect } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import classNames from '../../_virtual/index.js';
5
+ import { CChip } from '../chip/CChip.js';
6
+ import { useForkedRef } from '../../hooks/useForkedRef.js';
7
+ import '@popperjs/core';
8
+
9
+ const resolveChipClassName = (chipClassName, value) => {
10
+ if (!chipClassName) {
11
+ return;
12
+ }
13
+ if (typeof chipClassName === 'function') {
14
+ const resolvedClassName = chipClassName(value);
15
+ return typeof resolvedClassName === 'string' ? resolvedClassName : undefined;
16
+ }
17
+ return chipClassName;
18
+ };
19
+ const uniqueValues = (values) => [
20
+ ...new Set(values.map((value) => value.trim()).filter(Boolean)),
21
+ ];
22
+ const CChipInput = forwardRef((_a, ref) => {
23
+ var { className, chipClassName, createOnBlur = true, defaultValue = [], disabled, id, label, maxChips = null, name, onAdd, onChange, onInput, onRemove, onSelect, placeholder = '', readOnly, removable = true, selectable, separator = ',', size, value } = _a, rest = __rest(_a, ["className", "chipClassName", "createOnBlur", "defaultValue", "disabled", "id", "label", "maxChips", "name", "onAdd", "onChange", "onInput", "onRemove", "onSelect", "placeholder", "readOnly", "removable", "selectable", "separator", "size", "value"]);
24
+ const isControlled = value !== undefined;
25
+ const [_values, setValues] = useState(() => uniqueValues(defaultValue));
26
+ const [inputValue, setInputValue] = useState('');
27
+ const [selectedValues, setSelectedValues] = useState([]);
28
+ const rootRef = useRef(null);
29
+ const inputRef = useRef(null);
30
+ const forkedRef = useForkedRef(ref, rootRef);
31
+ const values = useMemo(() => uniqueValues(isControlled ? value : _values), [isControlled, value, _values]);
32
+ useEffect(() => {
33
+ setSelectedValues((prev) => prev.filter((item) => values.includes(item)));
34
+ }, [values]);
35
+ const emitValuesChange = (nextValues) => {
36
+ if (!isControlled) {
37
+ setValues(nextValues);
38
+ }
39
+ onChange === null || onChange === void 0 ? void 0 : onChange(nextValues);
40
+ };
41
+ const canAddMore = maxChips === null || values.length < maxChips;
42
+ const add = (rawValue) => {
43
+ if (disabled || readOnly) {
44
+ return false;
45
+ }
46
+ const normalizedValue = String(rawValue).trim();
47
+ if (!normalizedValue || values.includes(normalizedValue) || !canAddMore) {
48
+ return false;
49
+ }
50
+ const nextValues = [...values, normalizedValue];
51
+ emitValuesChange(nextValues);
52
+ onAdd === null || onAdd === void 0 ? void 0 : onAdd(normalizedValue);
53
+ return true;
54
+ };
55
+ const remove = (valueToRemove) => {
56
+ if (disabled || readOnly) {
57
+ return false;
58
+ }
59
+ if (!values.includes(valueToRemove)) {
60
+ return false;
61
+ }
62
+ const nextValues = values.filter((item) => item !== valueToRemove);
63
+ emitValuesChange(nextValues);
64
+ setSelectedValues((prev) => {
65
+ const nextSelected = prev.filter((item) => item !== valueToRemove);
66
+ if (nextSelected.length !== prev.length) {
67
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextSelected);
68
+ }
69
+ return nextSelected;
70
+ });
71
+ onRemove === null || onRemove === void 0 ? void 0 : onRemove(valueToRemove);
72
+ return true;
73
+ };
74
+ const createFromInput = () => {
75
+ if (add(inputValue)) {
76
+ setInputValue('');
77
+ }
78
+ };
79
+ const focusLastChip = () => {
80
+ if (!rootRef.current) {
81
+ return;
82
+ }
83
+ const focusableChips = [
84
+ ...rootRef.current.querySelectorAll('[data-coreui-chip-focusable="true"]:not(.disabled)'),
85
+ ];
86
+ if (focusableChips.length === 0) {
87
+ return;
88
+ }
89
+ focusableChips[focusableChips.length - 1].focus();
90
+ };
91
+ const handleInputKeyDown = (event) => {
92
+ switch (event.key) {
93
+ case 'Enter': {
94
+ event.preventDefault();
95
+ createFromInput();
96
+ break;
97
+ }
98
+ case 'Backspace':
99
+ case 'Delete': {
100
+ if (inputValue === '') {
101
+ event.preventDefault();
102
+ focusLastChip();
103
+ }
104
+ break;
105
+ }
106
+ case 'ArrowLeft': {
107
+ if (event.currentTarget.selectionStart === 0 && event.currentTarget.selectionEnd === 0) {
108
+ event.preventDefault();
109
+ focusLastChip();
110
+ }
111
+ break;
112
+ }
113
+ case 'Escape': {
114
+ setInputValue('');
115
+ event.currentTarget.blur();
116
+ break;
117
+ }
118
+ // No default
119
+ }
120
+ };
121
+ const handleInputChange = (value) => {
122
+ if (disabled || readOnly) {
123
+ return;
124
+ }
125
+ if (separator && value.includes(separator)) {
126
+ const parts = value.split(separator);
127
+ const chipsToAdd = uniqueValues(parts.slice(0, -1));
128
+ const nextValues = [...values];
129
+ for (const chipValue of chipsToAdd) {
130
+ if (maxChips !== null && nextValues.length >= maxChips) {
131
+ break;
132
+ }
133
+ if (!nextValues.includes(chipValue)) {
134
+ nextValues.push(chipValue);
135
+ onAdd === null || onAdd === void 0 ? void 0 : onAdd(chipValue);
136
+ }
137
+ }
138
+ if (nextValues.length !== values.length) {
139
+ emitValuesChange(nextValues);
140
+ }
141
+ const tail = parts[parts.length - 1] || '';
142
+ setInputValue(tail);
143
+ onInput === null || onInput === void 0 ? void 0 : onInput(tail);
144
+ return;
145
+ }
146
+ setInputValue(value);
147
+ onInput === null || onInput === void 0 ? void 0 : onInput(value);
148
+ };
149
+ const handlePaste = (event) => {
150
+ if (disabled || readOnly || !separator) {
151
+ return;
152
+ }
153
+ const pastedData = event.clipboardData.getData('text');
154
+ if (!pastedData.includes(separator)) {
155
+ return;
156
+ }
157
+ event.preventDefault();
158
+ const chipsToAdd = uniqueValues(pastedData.split(separator));
159
+ const nextValues = [...values];
160
+ for (const chipValue of chipsToAdd) {
161
+ if (maxChips !== null && nextValues.length >= maxChips) {
162
+ break;
163
+ }
164
+ if (!nextValues.includes(chipValue)) {
165
+ nextValues.push(chipValue);
166
+ onAdd === null || onAdd === void 0 ? void 0 : onAdd(chipValue);
167
+ }
168
+ }
169
+ if (nextValues.length !== values.length) {
170
+ emitValuesChange(nextValues);
171
+ }
172
+ setInputValue('');
173
+ onInput === null || onInput === void 0 ? void 0 : onInput('');
174
+ };
175
+ const handleInputBlur = (event) => {
176
+ var _a;
177
+ if (!createOnBlur) {
178
+ return;
179
+ }
180
+ if ((_a = event.relatedTarget) === null || _a === void 0 ? void 0 : _a.closest('.chip')) {
181
+ return;
182
+ }
183
+ createFromInput();
184
+ };
185
+ const handleContainerKeyDown = (event) => {
186
+ var _a;
187
+ if (event.target === inputRef.current) {
188
+ return;
189
+ }
190
+ if (event.key.length === 1) {
191
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
192
+ }
193
+ };
194
+ const handleContainerClick = (event) => {
195
+ var _a;
196
+ if (event.target === rootRef.current) {
197
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
198
+ }
199
+ };
200
+ const handleSelectedChange = (chipValue, selected) => {
201
+ setSelectedValues((prev) => {
202
+ const nextSelected = selected
203
+ ? uniqueValues([...prev, chipValue])
204
+ : prev.filter((value) => value !== chipValue);
205
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextSelected);
206
+ return nextSelected;
207
+ });
208
+ };
209
+ const inputSize = Math.max(placeholder.length, inputValue.length, 1);
210
+ return (React.createElement("div", Object.assign({ className: classNames('chip-input', {
211
+ 'chip-input-sm': size === 'sm',
212
+ 'chip-input-lg': size === 'lg',
213
+ disabled,
214
+ }, className), "aria-disabled": disabled ? true : undefined, "aria-readonly": readOnly ? true : undefined, onClick: handleContainerClick, onKeyDown: handleContainerKeyDown }, rest, { ref: forkedRef }),
215
+ label && (React.createElement("label", { className: "chip-input-label", htmlFor: id }, label)),
216
+ values.map((chipValue) => (React.createElement(CChip, { key: chipValue, className: resolveChipClassName(chipClassName, chipValue), removable: Boolean(removable && !disabled && !readOnly), ariaRemoveLabel: `Remove ${chipValue}`, disabled: disabled, onRemove: () => remove(chipValue), selectable: selectable, selected: selectedValues.includes(chipValue), onSelectedChange: (selected) => handleSelectedChange(chipValue, selected) }, chipValue))),
217
+ React.createElement("input", { type: "text", id: id, className: "chip-input-field", disabled: disabled, readOnly: Boolean(!disabled && readOnly), placeholder: placeholder, size: inputSize, value: inputValue, onBlur: handleInputBlur, onChange: (event) => handleInputChange(event.target.value), onKeyDown: handleInputKeyDown, onPaste: handlePaste, onFocus: () => {
218
+ if (selectedValues.length > 0) {
219
+ setSelectedValues([]);
220
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect([]);
221
+ }
222
+ }, ref: inputRef }),
223
+ name && React.createElement("input", { type: "hidden", name: name, value: values.join(',') })));
224
+ });
225
+ CChipInput.propTypes = {
226
+ chipClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
227
+ className: PropTypes.string,
228
+ createOnBlur: PropTypes.bool,
229
+ defaultValue: PropTypes.array,
230
+ disabled: PropTypes.bool,
231
+ id: PropTypes.string,
232
+ label: PropTypes.node,
233
+ maxChips: PropTypes.number,
234
+ name: PropTypes.string,
235
+ onAdd: PropTypes.func,
236
+ onChange: PropTypes.func,
237
+ onInput: PropTypes.func,
238
+ onRemove: PropTypes.func,
239
+ onSelect: PropTypes.func,
240
+ placeholder: PropTypes.string,
241
+ readOnly: PropTypes.bool,
242
+ removable: PropTypes.bool,
243
+ selectable: PropTypes.bool,
244
+ separator: PropTypes.string,
245
+ size: PropTypes.oneOf(['sm', 'lg']),
246
+ value: PropTypes.array,
247
+ };
248
+ CChipInput.displayName = 'CChipInput';
249
+
250
+ export { CChipInput };
251
+ //# sourceMappingURL=CChipInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CChipInput.js","sources":["../../../../src/components/form/CChipInput.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAgHA,MAAM,oBAAoB,GAAG,CAAC,aAAwC,EAAE,KAAa,KAAI;IACvF,IAAI,CAAC,aAAa,EAAE;QAClB;IACF;AAEA,IAAA,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;AACvC,QAAA,MAAM,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC;AAC9C,QAAA,OAAO,OAAO,iBAAiB,KAAK,QAAQ,GAAG,iBAAiB,GAAG,SAAS;IAC9E;AAEA,IAAA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AAK,EAAE,SAAS,CAAC,KAAK;CACvB;AAED,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { CForm } from './CForm';
2
2
  import { CFormCheck } from './CFormCheck';
3
+ import { CChipInput } from './CChipInput';
3
4
  import { CFormControlValidation } from './CFormControlValidation';
4
5
  import { CFormControlWrapper } from './CFormControlWrapper';
5
6
  import { CFormFeedback } from './CFormFeedback';
@@ -13,4 +14,4 @@ import { CFormText } from './CFormText';
13
14
  import { CFormTextarea } from './CFormTextarea';
14
15
  import { CInputGroup } from './CInputGroup';
15
16
  import { CInputGroupText } from './CInputGroupText';
16
- export { CForm, CFormCheck, CFormControlValidation, CFormControlWrapper, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CInputGroup, CInputGroupText, };
17
+ export { CForm, CFormCheck, CChipInput, CFormControlValidation, CFormControlWrapper, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CInputGroup, CInputGroupText, };
@@ -9,6 +9,7 @@ export * from './button-group';
9
9
  export * from './callout';
10
10
  export * from './card';
11
11
  export * from './carousel';
12
+ export * from './chip';
12
13
  export * from './close-button';
13
14
  export * from './collapse';
14
15
  export * from './conditional-portal';
package/dist/esm/index.js CHANGED
@@ -29,6 +29,7 @@ export { CCardTitle } from './components/card/CCardTitle.js';
29
29
  export { CCarousel } from './components/carousel/CCarousel.js';
30
30
  export { CCarouselCaption } from './components/carousel/CCarouselCaption.js';
31
31
  export { CCarouselItem } from './components/carousel/CCarouselItem.js';
32
+ export { CChip } from './components/chip/CChip.js';
32
33
  export { CCloseButton } from './components/close-button/CCloseButton.js';
33
34
  export { CCollapse } from './components/collapse/CCollapse.js';
34
35
  export { CConditionalPortal } from './components/conditional-portal/CConditionalPortal.js';
@@ -43,6 +44,7 @@ export { CFocusTrap } from './components/focus-trap/CFocusTrap.js';
43
44
  export { CFooter } from './components/footer/CFooter.js';
44
45
  export { CForm } from './components/form/CForm.js';
45
46
  export { CFormCheck } from './components/form/CFormCheck.js';
47
+ export { CChipInput } from './components/form/CChipInput.js';
46
48
  export { CFormControlValidation } from './components/form/CFormControlValidation.js';
47
49
  export { CFormControlWrapper } from './components/form/CFormControlWrapper.js';
48
50
  export { CFormFeedback } from './components/form/CFormFeedback.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreui/react",
3
- "version": "5.9.2",
3
+ "version": "5.10.0",
4
4
  "description": "UI Components Library for React.js",
5
5
  "keywords": [
6
6
  "react",
@@ -41,7 +41,7 @@
41
41
  "test:update": "jest --coverage --updateSnapshot"
42
42
  },
43
43
  "dependencies": {
44
- "@coreui/coreui": "^5.4.3",
44
+ "@coreui/coreui": "^5.6.0",
45
45
  "@popperjs/core": "^2.11.8",
46
46
  "prop-types": "^15.8.1"
47
47
  },
@@ -51,10 +51,10 @@
51
51
  "@rollup/plugin-typescript": "^12.3.0",
52
52
  "@testing-library/dom": "^10.4.1",
53
53
  "@testing-library/jest-dom": "^6.9.1",
54
- "@testing-library/react": "^16.3.0",
54
+ "@testing-library/react": "^16.3.2",
55
55
  "@types/jest": "^30.0.0",
56
56
  "@types/prop-types": "15.7.15",
57
- "@types/react": "^19.2.7",
57
+ "@types/react": "^19.2.14",
58
58
  "@types/react-dom": "^19.2.3",
59
59
  "@types/react-transition-group": "^4.4.12",
60
60
  "classnames": "^2.5.1",
@@ -64,7 +64,7 @@
64
64
  "react": "^18.3.1",
65
65
  "react-dom": "^18.3.1",
66
66
  "react-transition-group": "^4.4.5",
67
- "rollup": "^4.53.3",
67
+ "rollup": "^4.59.0",
68
68
  "ts-jest": "^29.4.6",
69
69
  "tslib": "^2.8.1",
70
70
  "typescript": "^5.9.3"