@rescui/chip-list 0.10.0 → 0.11.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.
- package/lib/chip-list-multi.d.ts +3 -1
- package/lib/chip-list-multi.js +5 -1
- package/lib/chip-list.d.ts +2 -1
- package/lib/chip-list.js +5 -1
- package/lib/index.css +54 -42
- package/lib/parts/chip-list-base.d.ts +2 -1
- package/lib/parts/chip-list-base.js +5 -2
- package/lib/parts/chip-list-context.js +2 -1
- package/lib/parts/chip-list.p.module.css.js +23 -22
- package/lib/parts/chip.js +13 -7
- package/lib/parts/types.d.ts +1 -0
- package/lib/parts/use-items-ids.js +7 -1
- package/package.json +2 -2
package/lib/chip-list-multi.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare type ChipListMultiProps<ValueType> = {
|
|
|
10
10
|
sparse?: boolean;
|
|
11
11
|
/** Decrease horizontal paddings, gap and border-radius values */
|
|
12
12
|
compact?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
13
14
|
theme?: Theme;
|
|
14
15
|
mode?: ChipListModeType;
|
|
15
16
|
alignItems?: ChipListAlignItemsType;
|
|
@@ -20,13 +21,14 @@ export declare type ChipListMultiProps<ValueType> = {
|
|
|
20
21
|
/** Identifier for e2e tests */
|
|
21
22
|
'data-e2e'?: string;
|
|
22
23
|
};
|
|
23
|
-
export declare function ChipListMulti<ValueType>({ onChange, compareValues, value, children, size, sparse, compact, mode, alignItems, ...props }: ChipListMultiProps<ValueType>): JSX.Element;
|
|
24
|
+
export declare function ChipListMulti<ValueType>({ onChange, compareValues, value, children, size, sparse, compact, disabled, mode, alignItems, ...props }: ChipListMultiProps<ValueType>): JSX.Element;
|
|
24
25
|
export declare namespace ChipListMulti {
|
|
25
26
|
var displayName: string;
|
|
26
27
|
var propTypes: {
|
|
27
28
|
size: PropTypes.Requireable<string>;
|
|
28
29
|
sparse: PropTypes.Requireable<boolean>;
|
|
29
30
|
compact: PropTypes.Requireable<boolean>;
|
|
31
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
30
32
|
theme: PropTypes.Requireable<string>;
|
|
31
33
|
className: PropTypes.Requireable<string>;
|
|
32
34
|
mode: PropTypes.Requireable<string>;
|
package/lib/chip-list-multi.js
CHANGED
|
@@ -7,7 +7,7 @@ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-st
|
|
|
7
7
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/esm/toConsumableArray";
|
|
8
8
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
10
|
-
var _excluded = ["onChange", "compareValues", "value", "children", "size", "sparse", "compact", "mode", "alignItems"];
|
|
10
|
+
var _excluded = ["onChange", "compareValues", "value", "children", "size", "sparse", "compact", "disabled", "mode", "alignItems"];
|
|
11
11
|
|
|
12
12
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
13
|
|
|
@@ -36,6 +36,8 @@ function ChipListMulti(_ref) {
|
|
|
36
36
|
sparse = _ref$sparse === void 0 ? false : _ref$sparse,
|
|
37
37
|
_ref$compact = _ref.compact,
|
|
38
38
|
compact = _ref$compact === void 0 ? false : _ref$compact,
|
|
39
|
+
_ref$disabled = _ref.disabled,
|
|
40
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
39
41
|
_ref$mode = _ref.mode,
|
|
40
42
|
mode = _ref$mode === void 0 ? 'classic' : _ref$mode,
|
|
41
43
|
_ref$alignItems = _ref.alignItems,
|
|
@@ -57,6 +59,7 @@ function ChipListMulti(_ref) {
|
|
|
57
59
|
size: size,
|
|
58
60
|
sparse: sparse,
|
|
59
61
|
compact: compact,
|
|
62
|
+
disabled: disabled,
|
|
60
63
|
mode: mode,
|
|
61
64
|
alignItems: alignItems
|
|
62
65
|
}, props), children);
|
|
@@ -67,6 +70,7 @@ ChipListMulti.propTypes = {
|
|
|
67
70
|
size: PropTypes.oneOf(['xs', 's', 'm', 'l']),
|
|
68
71
|
sparse: PropTypes.bool,
|
|
69
72
|
compact: PropTypes.bool,
|
|
73
|
+
disabled: PropTypes.bool,
|
|
70
74
|
theme: PropTypes.oneOf(['light', 'dark']),
|
|
71
75
|
className: PropTypes.string,
|
|
72
76
|
mode: PropTypes.oneOf(['classic', 'rock']),
|
package/lib/chip-list.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare type ChipListProps<ValueType> = {
|
|
|
9
9
|
sparse?: boolean;
|
|
10
10
|
/** Decrease horizontal paddings, gap and border-radius values */
|
|
11
11
|
compact?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
theme?: Theme;
|
|
13
14
|
mode?: ChipListModeType;
|
|
14
15
|
alignItems?: ChipListAlignItemsType;
|
|
@@ -19,7 +20,7 @@ export declare type ChipListProps<ValueType> = {
|
|
|
19
20
|
/** Identifier for e2e tests */
|
|
20
21
|
'data-e2e'?: string;
|
|
21
22
|
};
|
|
22
|
-
export declare function ChipList<ValueType>({ children, compareValues, value, onChange, size, sparse, compact, mode, alignItems, ...props }: ChipListProps<ValueType>): JSX.Element;
|
|
23
|
+
export declare function ChipList<ValueType>({ children, compareValues, value, onChange, size, sparse, compact, disabled, mode, alignItems, ...props }: ChipListProps<ValueType>): JSX.Element;
|
|
23
24
|
export declare namespace ChipList {
|
|
24
25
|
var displayName: string;
|
|
25
26
|
var propTypes: {};
|
package/lib/chip-list.js
CHANGED
|
@@ -7,7 +7,7 @@ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-sta
|
|
|
7
7
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
8
8
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
10
|
-
var _excluded = ["children", "compareValues", "value", "onChange", "size", "sparse", "compact", "mode", "alignItems"];
|
|
10
|
+
var _excluded = ["children", "compareValues", "value", "onChange", "size", "sparse", "compact", "disabled", "mode", "alignItems"];
|
|
11
11
|
|
|
12
12
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
13
|
|
|
@@ -33,6 +33,8 @@ function ChipList(_ref) {
|
|
|
33
33
|
sparse = _ref$sparse === void 0 ? false : _ref$sparse,
|
|
34
34
|
_ref$compact = _ref.compact,
|
|
35
35
|
compact = _ref$compact === void 0 ? false : _ref$compact,
|
|
36
|
+
_ref$disabled = _ref.disabled,
|
|
37
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
36
38
|
_ref$mode = _ref.mode,
|
|
37
39
|
mode = _ref$mode === void 0 ? 'classic' : _ref$mode,
|
|
38
40
|
_ref$alignItems = _ref.alignItems,
|
|
@@ -48,6 +50,7 @@ function ChipList(_ref) {
|
|
|
48
50
|
size: size,
|
|
49
51
|
sparse: sparse,
|
|
50
52
|
compact: compact,
|
|
53
|
+
disabled: disabled,
|
|
51
54
|
mode: mode,
|
|
52
55
|
alignItems: alignItems
|
|
53
56
|
}, props), children);
|
|
@@ -58,6 +61,7 @@ ChipList.propTypes = {
|
|
|
58
61
|
size: PropTypes.oneOf(['xs', 's', 'm', 'l']),
|
|
59
62
|
sparse: PropTypes.bool,
|
|
60
63
|
compact: PropTypes.bool,
|
|
64
|
+
disabled: PropTypes.bool,
|
|
61
65
|
theme: PropTypes.oneOf(['light', 'dark']),
|
|
62
66
|
className: PropTypes.string,
|
|
63
67
|
mode: PropTypes.oneOf(['classic', 'rock']),
|
package/lib/index.css
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
.
|
|
1
|
+
._light_1xl8zrw_8{
|
|
2
2
|
--rs-theme-dark:0;
|
|
3
3
|
}
|
|
4
|
-
.
|
|
4
|
+
._dark_1xl8zrw_11{
|
|
5
5
|
--rs-theme-dark:1;
|
|
6
6
|
}
|
|
7
|
-
.
|
|
7
|
+
._alignLeft_1xl8zrw_15{
|
|
8
8
|
--_rs-cl-align:left;
|
|
9
9
|
}
|
|
10
|
-
.
|
|
10
|
+
._alignCenter_1xl8zrw_18{
|
|
11
11
|
--_rs-cl-align:center;
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
._alignRight_1xl8zrw_21{
|
|
14
14
|
--_rs-cl-align:right;
|
|
15
15
|
}
|
|
16
|
-
.
|
|
16
|
+
._sizeXs_1xl8zrw_25{
|
|
17
17
|
--_rs-cl-chip-base-border-radius:4px;
|
|
18
18
|
--_rs-cl-chip-compact-border-radius:var(--_rs-cl-chip-base-border-radius);
|
|
19
19
|
--_rs-cl-chip-vertical-padding:2px;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--_rs-cl-compact-horizontal-gap:4px;
|
|
28
28
|
--_rs-cl-sparse-horizontal-gap:12px;
|
|
29
29
|
}
|
|
30
|
-
.
|
|
30
|
+
._sizeXs_1xl8zrw_25 [data-rs-internal='chip-list__chip']{
|
|
31
31
|
--_rs-typography-letter-spacing:0.0045em;
|
|
32
32
|
--_rs-typography-text-transform:initial;
|
|
33
33
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
--_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
|
|
62
62
|
--_rs-typography-link-border-bottom-width-from-text:1px;
|
|
63
63
|
}
|
|
64
|
-
.
|
|
64
|
+
._sizeS_1xl8zrw_28{
|
|
65
65
|
--_rs-cl-chip-base-border-radius:16px;
|
|
66
66
|
--_rs-cl-chip-compact-border-radius:4px;
|
|
67
67
|
--_rs-cl-chip-vertical-padding:6px;
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
--_rs-cl-compact-horizontal-gap:6px;
|
|
76
76
|
--_rs-cl-sparse-horizontal-gap:12px;
|
|
77
77
|
}
|
|
78
|
-
.
|
|
78
|
+
._sizeS_1xl8zrw_28 [data-rs-internal='chip-list__chip']{
|
|
79
79
|
--_rs-typography-letter-spacing:0.0045em;
|
|
80
80
|
--_rs-typography-text-transform:initial;
|
|
81
81
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
--_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
|
|
110
110
|
--_rs-typography-link-border-bottom-width-from-text:1px;
|
|
111
111
|
}
|
|
112
|
-
.
|
|
112
|
+
._sizeM_1xl8zrw_31{
|
|
113
113
|
--_rs-cl-chip-base-border-radius:20px;
|
|
114
114
|
--_rs-cl-chip-compact-border-radius:8px;
|
|
115
115
|
--_rs-cl-chip-vertical-padding:8px;
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
--_rs-cl-compact-horizontal-gap:6px;
|
|
124
124
|
--_rs-cl-sparse-horizontal-gap:16px;
|
|
125
125
|
}
|
|
126
|
-
.
|
|
126
|
+
._sizeM_1xl8zrw_31 [data-rs-internal='chip-list__chip']{
|
|
127
127
|
--_rs-typography-letter-spacing:0.0015em;
|
|
128
128
|
--_rs-typography-text-transform:initial;
|
|
129
129
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -158,11 +158,11 @@
|
|
|
158
158
|
--_rs-typography-link-border-bottom-width-from-text:1px;
|
|
159
159
|
}
|
|
160
160
|
@media screen and (max-width: 640px){
|
|
161
|
-
.
|
|
161
|
+
._sizeM_1xl8zrw_31 [data-rs-internal='chip-list__chip']{
|
|
162
162
|
--_rs-typography-list-li-margin-top-from-text:12px;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
.
|
|
165
|
+
._sizeL_1xl8zrw_34{
|
|
166
166
|
--_rs-cl-chip-base-border-radius:26px;
|
|
167
167
|
--_rs-cl-chip-compact-border-radius:12px;
|
|
168
168
|
--_rs-cl-chip-vertical-padding:12px;
|
|
@@ -177,11 +177,11 @@
|
|
|
177
177
|
--_rs-cl-sparse-horizontal-gap:16px;
|
|
178
178
|
}
|
|
179
179
|
@media screen and (max-width: 640px){
|
|
180
|
-
.
|
|
180
|
+
._sizeL_1xl8zrw_34{
|
|
181
181
|
--_rs-cl-vertical-gap:12px;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
.
|
|
184
|
+
._sizeL_1xl8zrw_34 [data-rs-internal='chip-list__chip']{
|
|
185
185
|
--_rs-typography-letter-spacing:normal;
|
|
186
186
|
--_rs-typography-text-transform:initial;
|
|
187
187
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -216,34 +216,34 @@
|
|
|
216
216
|
--_rs-typography-link-border-bottom-width-from-text:1px;
|
|
217
217
|
}
|
|
218
218
|
@media screen and (max-width: 640px){
|
|
219
|
-
.
|
|
219
|
+
._sizeL_1xl8zrw_34 [data-rs-internal='chip-list__chip']{
|
|
220
220
|
--_rs-typography-list-li-margin-top-from-text:16px;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
.
|
|
223
|
+
._innerOffsetL_1xl8zrw_38{
|
|
224
224
|
--_rs-cl-horizontal-gap-from-sparse:var(--_rs-cl-sparse-horizontal-gap);
|
|
225
225
|
}
|
|
226
226
|
@media screen and (max-width: 640px){
|
|
227
|
-
.
|
|
227
|
+
._innerOffsetL_1xl8zrw_38{
|
|
228
228
|
--_rs-cl-horizontal-gap-from-sparse:var(--_rs-cl-base-horizontal-gap);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
.
|
|
231
|
+
._innerOffsetM_1xl8zrw_41{
|
|
232
232
|
--_rs-cl-horizontal-gap-from-sparse:initial;
|
|
233
233
|
}
|
|
234
|
-
.
|
|
234
|
+
._classic_1xl8zrw_45{
|
|
235
235
|
--_rs-cl-chip-active-border-color:var(--_rs-color-primary);
|
|
236
236
|
--_rs-cl-chip-selected-border-color:var(--_rs-color-primary);
|
|
237
237
|
--_rs-cl-chip-hover-background:var(--_rs-color-primary-t-fog);
|
|
238
238
|
--_rs-cl-chip-active-background:var(--_rs-color-primary-t-fog);
|
|
239
239
|
}
|
|
240
|
-
.
|
|
240
|
+
._rock_1xl8zrw_48{
|
|
241
241
|
--_rs-cl-chip-active-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
242
242
|
--_rs-cl-chip-selected-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
243
243
|
--_rs-cl-chip-hover-background:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.1);
|
|
244
244
|
--_rs-cl-chip-active-background:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.1);
|
|
245
245
|
}
|
|
246
|
-
.
|
|
246
|
+
._compact_1xl8zrw_52{
|
|
247
247
|
--_rs-cl-chip-border-radius-from-compact:var(
|
|
248
248
|
--_rs-cl-chip-compact-border-radius
|
|
249
249
|
);
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
);
|
|
253
253
|
--_rs-cl-horizontal-gap-from-compact:var(--_rs-cl-compact-horizontal-gap);
|
|
254
254
|
}
|
|
255
|
-
.
|
|
255
|
+
._main_1xl8zrw_56{
|
|
256
256
|
--_rs-theme-dark:var(
|
|
257
257
|
--_rs-internal-force-theme-dark-consult-rescui-before-using,
|
|
258
258
|
var(--rs-theme-dark, 0)
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
--_rs-theme-light-coefficient:calc(1 - var(--_rs-theme-dark-coefficient));
|
|
263
263
|
}
|
|
264
264
|
@supports (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
265
|
-
.
|
|
265
|
+
._main_1xl8zrw_56{
|
|
266
266
|
--_rs-color-primary:color-mix(in srgb, var(--rs-color-primary-light-theme, #6B57FF) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dark-theme, #8473FF) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
267
267
|
--_rs-color-primary-dim:color-mix(in srgb, var(--rs-color-primary-dim-light-theme, #8979ff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dim-dark-theme, #6f61d2) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
268
268
|
--_rs-color-primary-fog:color-mix(in srgb, var(--rs-color-primary-fog-light-theme, #e1ddff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-fog-dark-theme, #2e2b49) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
@supports not (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
274
|
-
.
|
|
274
|
+
._main_1xl8zrw_56{
|
|
275
275
|
--_rs-color-primary:rgb(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255);
|
|
276
276
|
--_rs-color-primary-dim:rgb(calc(var(--_rs-theme-light-coefficient, 1)*137 + var(--_rs-theme-dark-coefficient, 0)*111), calc(var(--_rs-theme-light-coefficient, 1)*121 + var(--_rs-theme-dark-coefficient, 0)*97), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*210));
|
|
277
277
|
--_rs-color-primary-fog:rgb(calc(var(--_rs-theme-light-coefficient, 1)*225 + var(--_rs-theme-dark-coefficient, 0)*46), calc(var(--_rs-theme-light-coefficient, 1)*221 + var(--_rs-theme-dark-coefficient, 0)*43), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*73));
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
--_rs-color-primary-t-fog:rgba(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255, calc(var(--_rs-theme-light-coefficient, 1)*0.2 + var(--_rs-theme-dark-coefficient, 0)*0.3));
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
.
|
|
282
|
+
._main_1xl8zrw_56 {
|
|
283
283
|
--_rs-cl-chip-border-radius:var(
|
|
284
284
|
--_rs-cl-chip-border-radius-from-compact,
|
|
285
285
|
var(--_rs-cl-chip-base-border-radius)
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
var(--_rs-cl-horizontal-gap-from-sparse, var(--_rs-cl-base-horizontal-gap))
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
|
-
.
|
|
296
|
+
._chipsContainer_1xl8zrw_62{
|
|
297
297
|
position:relative;
|
|
298
298
|
|
|
299
299
|
display:-webkit-box;
|
|
@@ -309,17 +309,17 @@
|
|
|
309
309
|
|
|
310
310
|
gap:var(--_rs-cl-vertical-gap) var(--_rs-cl-horizontal-gap);
|
|
311
311
|
}
|
|
312
|
-
.
|
|
312
|
+
._alignIconLeft_1xl8zrw_72{
|
|
313
313
|
--_rs-cl-chip-icon-flex-direction:row;
|
|
314
314
|
--_rs-cl-chip-icon-position-multiplier-left:1;
|
|
315
315
|
--_rs-cl-chip-icon-position-multiplier-right:0;
|
|
316
316
|
}
|
|
317
|
-
.
|
|
317
|
+
._alignIconRight_1xl8zrw_75{
|
|
318
318
|
--_rs-cl-chip-icon-flex-direction:row-reverse;
|
|
319
319
|
--_rs-cl-chip-icon-position-multiplier-left:0;
|
|
320
320
|
--_rs-cl-chip-icon-position-multiplier-right:1;
|
|
321
321
|
}
|
|
322
|
-
.
|
|
322
|
+
._chip_1xl8zrw_62{
|
|
323
323
|
letter-spacing:var(
|
|
324
324
|
--rs-text-base-letter-spacing,
|
|
325
325
|
var(--_rs-typography-letter-spacing)
|
|
@@ -390,23 +390,23 @@
|
|
|
390
390
|
-moz-osx-font-smoothing:inherit;
|
|
391
391
|
-webkit-appearance:none;
|
|
392
392
|
}
|
|
393
|
-
.
|
|
393
|
+
._chip_1xl8zrw_62::-moz-focus-inner{
|
|
394
394
|
padding:0;
|
|
395
395
|
|
|
396
396
|
border:none;
|
|
397
397
|
}
|
|
398
|
-
.
|
|
399
|
-
.
|
|
400
|
-
.
|
|
398
|
+
._chip_1xl8zrw_62:hover,
|
|
399
|
+
._chip_1xl8zrw_62:focus,
|
|
400
|
+
._chip_1xl8zrw_62:active{
|
|
401
401
|
outline:none;
|
|
402
402
|
|
|
403
403
|
text-decoration:none;
|
|
404
404
|
}
|
|
405
|
-
.
|
|
405
|
+
._chip_1xl8zrw_62:focus[data-focus-method='key']{
|
|
406
406
|
-webkit-box-shadow:var(--_rs-color-primary-t-dim) 0 0 0 4px;
|
|
407
407
|
box-shadow:var(--_rs-color-primary-t-dim) 0 0 0 4px;
|
|
408
408
|
}
|
|
409
|
-
.
|
|
409
|
+
._chip_1xl8zrw_62:focus{
|
|
410
410
|
--_rs-cl-chip-border-color:rgba(
|
|
411
411
|
calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227),
|
|
412
412
|
calc(0.3 + var(--_rs-theme-dark-coefficient)*0.1)
|
|
@@ -415,7 +415,7 @@
|
|
|
415
415
|
color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
416
416
|
}
|
|
417
417
|
@media (hover: hover){
|
|
418
|
-
.
|
|
418
|
+
._chip_1xl8zrw_62:hover{
|
|
419
419
|
--_rs-cl-chip-border-color:rgba(
|
|
420
420
|
calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227),
|
|
421
421
|
calc(0.3 + var(--_rs-theme-dark-coefficient)*0.1)
|
|
@@ -426,20 +426,32 @@
|
|
|
426
426
|
background:var(--_rs-cl-chip-hover-background);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
.
|
|
429
|
+
._chip_1xl8zrw_62:active{
|
|
430
430
|
--_rs-cl-chip-border-color:var(--_rs-cl-chip-active-border-color);
|
|
431
431
|
|
|
432
432
|
color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
433
433
|
|
|
434
434
|
background:var(--_rs-cl-chip-active-background);
|
|
435
435
|
}
|
|
436
|
-
.
|
|
436
|
+
._chip_1xl8zrw_62._selected_1xl8zrw_172{
|
|
437
437
|
--_rs-cl-chip-border-color:var(--_rs-cl-chip-selected-border-color);
|
|
438
438
|
--_rs-cl-chip-border-width:2px;
|
|
439
439
|
|
|
440
440
|
color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
441
441
|
}
|
|
442
|
-
.
|
|
442
|
+
._disabled_1xl8zrw_179 ._chip_1xl8zrw_62{
|
|
443
|
+
--_rs-cl-chip-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.2);
|
|
444
|
+
|
|
445
|
+
pointer-events:none;
|
|
446
|
+
|
|
447
|
+
color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.5);
|
|
448
|
+
|
|
449
|
+
background:transparent;
|
|
450
|
+
}
|
|
451
|
+
._disabled_1xl8zrw_179 ._chip_1xl8zrw_62._selected_1xl8zrw_172{
|
|
452
|
+
--_rs-cl-chip-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.4);
|
|
453
|
+
}
|
|
454
|
+
._chip_1xl8zrw_62::before{
|
|
443
455
|
position:absolute;
|
|
444
456
|
top:0;
|
|
445
457
|
right:0;
|
|
@@ -458,7 +470,7 @@
|
|
|
458
470
|
|
|
459
471
|
transition:border-color 100ms;
|
|
460
472
|
}
|
|
461
|
-
.
|
|
473
|
+
._chip_1xl8zrw_62 ._icon_1xl8zrw_212{
|
|
462
474
|
-webkit-box-flex:0;
|
|
463
475
|
-ms-flex:0 0 auto;
|
|
464
476
|
flex:0 0 auto;
|
|
@@ -469,7 +481,7 @@
|
|
|
469
481
|
margin:0;
|
|
470
482
|
fill:currentColor;
|
|
471
483
|
}
|
|
472
|
-
.
|
|
484
|
+
._withoutText_1xl8zrw_223{
|
|
473
485
|
--_rs-cl-chip-horizontal-real-padding:var(--_rs-cl-chip-icon-only-padding);
|
|
474
486
|
--_rs-cl-chip-vertical-real-padding:var(--_rs-cl-chip-icon-only-padding);
|
|
475
487
|
}
|
|
@@ -8,6 +8,7 @@ export declare type ChipListBaseProps<V> = {
|
|
|
8
8
|
sparse?: boolean;
|
|
9
9
|
/** Decrease horizontal paddings, gap and border-radius values */
|
|
10
10
|
compact?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
11
12
|
theme?: Theme;
|
|
12
13
|
mode?: ChipListModeType;
|
|
13
14
|
alignItems?: ChipListAlignItemsType;
|
|
@@ -18,4 +19,4 @@ export declare type ChipListBaseProps<V> = {
|
|
|
18
19
|
/** Identifier for e2e tests */
|
|
19
20
|
'data-e2e'?: string;
|
|
20
21
|
};
|
|
21
|
-
export declare function ChipListBase<V>({ size, sparse, compact, className, mode, alignItems, theme: themeFromProps, value, onChange, compareValues, children, ['data-e2e']: e2eId }: ChipListBaseProps<V>): JSX.Element;
|
|
22
|
+
export declare function ChipListBase<V>({ size, sparse, compact, disabled, className, mode, alignItems, theme: themeFromProps, value, onChange, compareValues, children, ['data-e2e']: e2eId }: ChipListBaseProps<V>): JSX.Element;
|
|
@@ -23,6 +23,8 @@ function ChipListBase(_ref) {
|
|
|
23
23
|
sparse = _ref$sparse === void 0 ? false : _ref$sparse,
|
|
24
24
|
_ref$compact = _ref.compact,
|
|
25
25
|
compact = _ref$compact === void 0 ? false : _ref$compact,
|
|
26
|
+
_ref$disabled = _ref.disabled,
|
|
27
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
26
28
|
className = _ref.className,
|
|
27
29
|
_ref$mode = _ref.mode,
|
|
28
30
|
mode = _ref$mode === void 0 ? 'classic' : _ref$mode,
|
|
@@ -47,10 +49,11 @@ function ChipListBase(_ref) {
|
|
|
47
49
|
return /*#__PURE__*/React.createElement(ChipListContext.Provider, {
|
|
48
50
|
value: {
|
|
49
51
|
onChange: onChange,
|
|
50
|
-
selectedIds: selectedIds
|
|
52
|
+
selectedIds: selectedIds,
|
|
53
|
+
disabled: disabled
|
|
51
54
|
}
|
|
52
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: cn(styles.main, styles[theme], styles[mode], STYLES_SIZES[size], sparse ? styles.innerOffsetL : styles.innerOffsetM, compact && styles.compact, ALIGN_ITEMS_STYLES[alignItems], className),
|
|
56
|
+
className: cn(styles.main, styles[theme], styles[mode], STYLES_SIZES[size], sparse ? styles.innerOffsetL : styles.innerOffsetM, compact && styles.compact, disabled && styles.disabled, ALIGN_ITEMS_STYLES[alignItems], className),
|
|
54
57
|
"data-e2e": e2eId ? "".concat(e2eId, "__chips-container") : null,
|
|
55
58
|
"data-rs-internal": 'chip-list',
|
|
56
59
|
"data-test": 'chip-list'
|
|
@@ -2,7 +2,8 @@ import { createContext, useContext } from 'react';
|
|
|
2
2
|
var ChipListContext = /*#__PURE__*/createContext({
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
4
4
|
onChange: function onChange() {},
|
|
5
|
-
selectedIds: []
|
|
5
|
+
selectedIds: [],
|
|
6
|
+
disabled: false
|
|
6
7
|
});
|
|
7
8
|
|
|
8
9
|
var useChipListContext = function useChipListContext() {
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"light": "
|
|
3
|
-
"dark": "
|
|
4
|
-
"alignLeft": "
|
|
5
|
-
"alignCenter": "
|
|
6
|
-
"alignRight": "
|
|
7
|
-
"sizeXs": "
|
|
8
|
-
"sizeS": "
|
|
9
|
-
"sizeM": "
|
|
10
|
-
"sizeL": "
|
|
11
|
-
"innerOffsetL": "
|
|
12
|
-
"innerOffsetM": "
|
|
13
|
-
"classic": "
|
|
14
|
-
"rock": "
|
|
15
|
-
"compact": "
|
|
16
|
-
"main": "
|
|
17
|
-
"chipsContainer": "
|
|
18
|
-
"alignIconLeft": "
|
|
19
|
-
"alignIconRight": "
|
|
20
|
-
"chip": "
|
|
21
|
-
"selected": "
|
|
22
|
-
"
|
|
23
|
-
"
|
|
2
|
+
"light": "_light_1xl8zrw_8",
|
|
3
|
+
"dark": "_dark_1xl8zrw_11",
|
|
4
|
+
"alignLeft": "_alignLeft_1xl8zrw_15",
|
|
5
|
+
"alignCenter": "_alignCenter_1xl8zrw_18",
|
|
6
|
+
"alignRight": "_alignRight_1xl8zrw_21",
|
|
7
|
+
"sizeXs": "_sizeXs_1xl8zrw_25",
|
|
8
|
+
"sizeS": "_sizeS_1xl8zrw_28",
|
|
9
|
+
"sizeM": "_sizeM_1xl8zrw_31",
|
|
10
|
+
"sizeL": "_sizeL_1xl8zrw_34",
|
|
11
|
+
"innerOffsetL": "_innerOffsetL_1xl8zrw_38",
|
|
12
|
+
"innerOffsetM": "_innerOffsetM_1xl8zrw_41",
|
|
13
|
+
"classic": "_classic_1xl8zrw_45",
|
|
14
|
+
"rock": "_rock_1xl8zrw_48",
|
|
15
|
+
"compact": "_compact_1xl8zrw_52",
|
|
16
|
+
"main": "_main_1xl8zrw_56",
|
|
17
|
+
"chipsContainer": "_chipsContainer_1xl8zrw_62",
|
|
18
|
+
"alignIconLeft": "_alignIconLeft_1xl8zrw_72",
|
|
19
|
+
"alignIconRight": "_alignIconRight_1xl8zrw_75",
|
|
20
|
+
"chip": "_chip_1xl8zrw_62",
|
|
21
|
+
"selected": "_selected_1xl8zrw_172",
|
|
22
|
+
"disabled": "_disabled_1xl8zrw_179",
|
|
23
|
+
"icon": "_icon_1xl8zrw_212",
|
|
24
|
+
"withoutText": "_withoutText_1xl8zrw_223"
|
|
24
25
|
};
|
|
25
26
|
export { styles as default };
|
package/lib/parts/chip.js
CHANGED
|
@@ -20,15 +20,21 @@ import cn from 'classnames';
|
|
|
20
20
|
import styles from './chip-list.p.module.css.js';
|
|
21
21
|
import { useChipListContext } from './chip-list-context.js';
|
|
22
22
|
var ChipTag = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
23
|
+
var _useChipListContext = useChipListContext(),
|
|
24
|
+
disabled = _useChipListContext.disabled;
|
|
25
|
+
|
|
23
26
|
if (typeof props.href !== 'undefined') {
|
|
24
|
-
return /*#__PURE__*/React.createElement("a", _objectSpread({
|
|
27
|
+
return /*#__PURE__*/React.createElement("a", _objectSpread(_objectSpread({
|
|
25
28
|
ref: ref
|
|
26
|
-
}, props),
|
|
29
|
+
}, props), {}, {
|
|
30
|
+
tabIndex: disabled ? -1 : props.tabIndex
|
|
31
|
+
}), props.children);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
return /*#__PURE__*/React.createElement("button", _objectSpread(_objectSpread({
|
|
30
35
|
ref: ref
|
|
31
36
|
}, props), {}, {
|
|
37
|
+
disabled: disabled,
|
|
32
38
|
type: "button"
|
|
33
39
|
}), props.children);
|
|
34
40
|
});
|
|
@@ -39,7 +45,7 @@ var isWithoutChildren = function isWithoutChildren(children) {
|
|
|
39
45
|
};
|
|
40
46
|
|
|
41
47
|
var Chip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
42
|
-
var _cn;
|
|
48
|
+
var _cn, _restProps$tabIndex;
|
|
43
49
|
|
|
44
50
|
var value = _ref.value,
|
|
45
51
|
className = _ref.className,
|
|
@@ -53,9 +59,9 @@ var Chip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
53
59
|
e2eId = _ref['data-e2e'],
|
|
54
60
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
61
|
|
|
56
|
-
var
|
|
57
|
-
onChange =
|
|
58
|
-
selectedIds =
|
|
62
|
+
var _useChipListContext2 = useChipListContext(),
|
|
63
|
+
onChange = _useChipListContext2.onChange,
|
|
64
|
+
selectedIds = _useChipListContext2.selectedIds;
|
|
59
65
|
|
|
60
66
|
var selected = _includesInstanceProperty(selectedIds).call(selectedIds, itemId);
|
|
61
67
|
|
|
@@ -80,7 +86,7 @@ var Chip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
80
86
|
}
|
|
81
87
|
},
|
|
82
88
|
role: "tab",
|
|
83
|
-
tabIndex: 0,
|
|
89
|
+
tabIndex: (_restProps$tabIndex = restProps.tabIndex) !== null && _restProps$tabIndex !== void 0 ? _restProps$tabIndex : 0,
|
|
84
90
|
ref: ref,
|
|
85
91
|
"data-e2e": e2eId,
|
|
86
92
|
"data-test": "chip".concat(selected ? ' chip-selected' : ''),
|
package/lib/parts/types.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ function patchItemIfNeeded(_ref) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
var hasElValue = function hasElValue(el) {
|
|
19
|
+
var _el$props, _el$props2;
|
|
20
|
+
|
|
21
|
+
return ((_el$props = el.props) === null || _el$props === void 0 ? void 0 : _el$props.value) !== null && typeof ((_el$props2 = el.props) === null || _el$props2 === void 0 ? void 0 : _el$props2.value) !== 'undefined';
|
|
22
|
+
};
|
|
23
|
+
|
|
18
24
|
var useItemsIds = function useItemsIds(_ref2) {
|
|
19
25
|
var children = _ref2.children,
|
|
20
26
|
compareValues = _ref2.compareValues,
|
|
@@ -25,7 +31,7 @@ var useItemsIds = function useItemsIds(_ref2) {
|
|
|
25
31
|
var currentSelectedItemIds = [];
|
|
26
32
|
var items = deepMap(children, function (child) {
|
|
27
33
|
if (child.type === Chip) {
|
|
28
|
-
var childValue = child.props.value
|
|
34
|
+
var childValue = hasElValue(child) ? child.props.value : counter;
|
|
29
35
|
var isSelectedItem = compareValues(value, childValue);
|
|
30
36
|
|
|
31
37
|
if (isSelectedItem) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/chip-list",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
36
36
|
},
|
|
37
37
|
"nx": {},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "8854056aed712313cea5db9d1876647d349a7db5"
|
|
39
39
|
}
|