@paubox/ui 0.12.0 → 0.12.2
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/index.esm.js +57 -15
- package/package.json +1 -1
- package/src/lib/Inputs/MultiSelect.d.ts +3 -1
- package/src/lib/Inputs/MultiText.d.ts +2 -1
package/index.esm.js
CHANGED
|
@@ -1676,7 +1676,7 @@ function _templateObject6$2() {
|
|
|
1676
1676
|
};
|
|
1677
1677
|
return data;
|
|
1678
1678
|
}
|
|
1679
|
-
function _templateObject7() {
|
|
1679
|
+
function _templateObject7$1() {
|
|
1680
1680
|
var data = _tagged_template_literal$t([
|
|
1681
1681
|
"\n ",
|
|
1682
1682
|
"\n font-size: ",
|
|
@@ -1684,7 +1684,7 @@ function _templateObject7() {
|
|
|
1684
1684
|
"rem;\n letter-spacing: ",
|
|
1685
1685
|
"px;\n font-weight: 400;\n"
|
|
1686
1686
|
]);
|
|
1687
|
-
_templateObject7 = function _templateObject() {
|
|
1687
|
+
_templateObject7$1 = function _templateObject() {
|
|
1688
1688
|
return data;
|
|
1689
1689
|
};
|
|
1690
1690
|
return data;
|
|
@@ -1932,7 +1932,7 @@ var $headline200Semibold = css(_templateObject4$8(), commonStyles, headline200Fo
|
|
|
1932
1932
|
var $headline300Regular = css(_templateObject5$4(), commonStyles, headline300FontSize / BASE_FONT_SIZE, headline300LineHeight / BASE_FONT_SIZE, headline300LetterSpacing);
|
|
1933
1933
|
var $headline300Semibold = css(_templateObject6$2(), commonStyles, headline300FontSize / BASE_FONT_SIZE, headline300LineHeight / BASE_FONT_SIZE, headline300LetterSpacing);
|
|
1934
1934
|
// PARAGRAPH
|
|
1935
|
-
var $paragraph100Regular = css(_templateObject7(), commonStyles, paragraph100FontSize / BASE_FONT_SIZE, paragraph100LineHeight / BASE_FONT_SIZE, paragraph100LetterSpacing);
|
|
1935
|
+
var $paragraph100Regular = css(_templateObject7$1(), commonStyles, paragraph100FontSize / BASE_FONT_SIZE, paragraph100LineHeight / BASE_FONT_SIZE, paragraph100LetterSpacing);
|
|
1936
1936
|
var $paragraph100Semibold = css(_templateObject8(), commonStyles, paragraph100FontSize / BASE_FONT_SIZE, paragraph100LineHeight / BASE_FONT_SIZE, paragraph100LetterSpacing);
|
|
1937
1937
|
var $paragraph200Regular = css(_templateObject9(), commonStyles, paragraph200FontSize / BASE_FONT_SIZE, paragraph200LineHeight / BASE_FONT_SIZE, paragraph200LetterSpacing);
|
|
1938
1938
|
var $paragraph200Semibold = css(_templateObject10(), commonStyles, paragraph200FontSize / BASE_FONT_SIZE, paragraph200LineHeight / BASE_FONT_SIZE, paragraph200LetterSpacing);
|
|
@@ -23213,6 +23213,17 @@ function _templateObject6() {
|
|
|
23213
23213
|
};
|
|
23214
23214
|
return data;
|
|
23215
23215
|
}
|
|
23216
|
+
function _templateObject7() {
|
|
23217
|
+
var data = _tagged_template_literal$i([
|
|
23218
|
+
"\n ",
|
|
23219
|
+
"\n color: ",
|
|
23220
|
+
";\n"
|
|
23221
|
+
]);
|
|
23222
|
+
_templateObject7 = function _templateObject() {
|
|
23223
|
+
return data;
|
|
23224
|
+
};
|
|
23225
|
+
return data;
|
|
23226
|
+
}
|
|
23216
23227
|
// Wrapper for the Input and Icons
|
|
23217
23228
|
var InputWrapper$2 = styled.div(_templateObject$i());
|
|
23218
23229
|
var MultiSelectWrapper = styled.div(_templateObject1$c());
|
|
@@ -23225,7 +23236,7 @@ var BaseSelect$1 = styled.select(_templateObject2$a(), function(param) {
|
|
|
23225
23236
|
return disabled || type === 'secondary' ? neutral100 : 'white';
|
|
23226
23237
|
}, neutral500, function(param) {
|
|
23227
23238
|
var value = param.value;
|
|
23228
|
-
return value ? textPrimary : neutral500;
|
|
23239
|
+
return Array.isArray(value) && value.length > 0 ? textPrimary : neutral500;
|
|
23229
23240
|
}, function(param) {
|
|
23230
23241
|
var sz = param.sz;
|
|
23231
23242
|
return sz === 'lg' ? '0.5rem 0.563rem' : '0.375rem 0.563rem';
|
|
@@ -23268,13 +23279,16 @@ var MultiSelectChip = function(option) {
|
|
|
23268
23279
|
// Style for the Icons
|
|
23269
23280
|
var IconWrapper$2 = styled.span(_templateObject5$1());
|
|
23270
23281
|
var PlaceholderOption = styled.option(_templateObject6(), $paragraph100Semibold, textSecondary);
|
|
23282
|
+
var SelectedOption = styled.option(_templateObject7(), $paragraph200Regular, textPrimary);
|
|
23271
23283
|
var MultiSelect = function(_param) {
|
|
23272
|
-
var _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz; _param.error; var _param_options = _param.options, options = _param_options === void 0 ? [] : _param_options; _param.checkbox; var placeholder = _param.placeholder, values = _param.values, setValues = _param.setValues, _param_type = _param.type, type = _param_type === void 0 ? 'primary' : _param_type, props = _object_without_properties$d(_param, [
|
|
23284
|
+
var _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz; _param.error; var _param_options = _param.options, options = _param_options === void 0 ? [] : _param_options; _param.checkbox; var placeholder = _param.placeholder, label = _param.label, _param_chips = _param.chips, chips = _param_chips === void 0 ? false : _param_chips, values = _param.values, setValues = _param.setValues, _param_type = _param.type, type = _param_type === void 0 ? 'primary' : _param_type, props = _object_without_properties$d(_param, [
|
|
23273
23285
|
"sz",
|
|
23274
23286
|
"error",
|
|
23275
23287
|
"options",
|
|
23276
23288
|
"checkbox",
|
|
23277
23289
|
"placeholder",
|
|
23290
|
+
"label",
|
|
23291
|
+
"chips",
|
|
23278
23292
|
"values",
|
|
23279
23293
|
"setValues",
|
|
23280
23294
|
"type"
|
|
@@ -23304,19 +23318,25 @@ var MultiSelect = function(_param) {
|
|
|
23304
23318
|
}, props), {
|
|
23305
23319
|
type: type,
|
|
23306
23320
|
sz: sz,
|
|
23321
|
+
value: values,
|
|
23307
23322
|
defaultValue: '',
|
|
23308
|
-
children: !values.length
|
|
23323
|
+
children: !values.length ? /*#__PURE__*/ jsx(PlaceholderOption, {
|
|
23309
23324
|
value: "",
|
|
23310
23325
|
disabled: true,
|
|
23311
23326
|
hidden: true,
|
|
23312
23327
|
selected: true,
|
|
23313
23328
|
children: "".concat(placeholder || 'Please select...')
|
|
23329
|
+
}) : !chips && /*#__PURE__*/ jsx(SelectedOption, {
|
|
23330
|
+
value: "",
|
|
23331
|
+
hidden: true,
|
|
23332
|
+
selected: true,
|
|
23333
|
+
children: "".concat(label || 'Selected', " (").concat(values.length, ")")
|
|
23314
23334
|
})
|
|
23315
23335
|
})),
|
|
23316
23336
|
/*#__PURE__*/ jsx(IconWrapper$2, {
|
|
23317
23337
|
children: /*#__PURE__*/ jsx(ChevronDown, {})
|
|
23318
23338
|
}),
|
|
23319
|
-
/*#__PURE__*/ jsx(ChipWrapper$1, {
|
|
23339
|
+
chips && /*#__PURE__*/ jsx(ChipWrapper$1, {
|
|
23320
23340
|
sz: sz,
|
|
23321
23341
|
children: values.map(function(value) {
|
|
23322
23342
|
var optionData = options.find(function(o) {
|
|
@@ -23689,7 +23709,7 @@ function _templateObject$g() {
|
|
|
23689
23709
|
}
|
|
23690
23710
|
function _templateObject1$b() {
|
|
23691
23711
|
var data = _tagged_template_literal$g([
|
|
23692
|
-
"\n flex: 1;\n border: none;\n overflow: scroll;\n min-width: 10rem;\n background-color: transparent;\n width: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n\n :focus-visible {\n outline: none;\n }\n\n &::placeholder {\n color: ",
|
|
23712
|
+
"\n flex: 1;\n border: none;\n overflow: scroll;\n min-width: 10rem;\n background-color: transparent;\n width: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n padding: 0;\n\n :focus-visible {\n outline: none;\n }\n\n &::placeholder {\n color: ",
|
|
23693
23713
|
";\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n }\n\n ",
|
|
23694
23714
|
"\n"
|
|
23695
23715
|
]);
|
|
@@ -23711,7 +23731,7 @@ function _templateObject2$9() {
|
|
|
23711
23731
|
}
|
|
23712
23732
|
function _templateObject3$7() {
|
|
23713
23733
|
var data = _tagged_template_literal$g([
|
|
23714
|
-
"\n display: flex;\n gap: 0.25rem;\n
|
|
23734
|
+
"\n display: flex;\n gap: 0.25rem;\n flex-wrap: wrap;\n height: auto;\n"
|
|
23715
23735
|
]);
|
|
23716
23736
|
_templateObject3$7 = function _templateObject() {
|
|
23717
23737
|
return data;
|
|
@@ -23751,16 +23771,19 @@ var MultiInputChip = function(param) {
|
|
|
23751
23771
|
});
|
|
23752
23772
|
};
|
|
23753
23773
|
var MultiInput = function(_param) {
|
|
23754
|
-
var _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz, _param_error = _param.error, error = _param_error === void 0 ? false : _param_error, _param_type = _param.type, type = _param_type === void 0 ? 'primary' : _param_type, values = _param.values, setValues = _param.setValues, placeholder = _param.placeholder, props = _object_without_properties$b(_param, [
|
|
23774
|
+
var _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz, _param_error = _param.error, error = _param_error === void 0 ? false : _param_error, _param_type = _param.type, type = _param_type === void 0 ? 'primary' : _param_type, values = _param.values, setValues = _param.setValues, placeholder = _param.placeholder, _param_chips = _param.chips, chips = _param_chips === void 0 ? false : _param_chips, props = _object_without_properties$b(_param, [
|
|
23755
23775
|
"sz",
|
|
23756
23776
|
"error",
|
|
23757
23777
|
"type",
|
|
23758
23778
|
"values",
|
|
23759
23779
|
"setValues",
|
|
23760
|
-
"placeholder"
|
|
23780
|
+
"placeholder",
|
|
23781
|
+
"chips"
|
|
23761
23782
|
]);
|
|
23783
|
+
var _popperRef_current;
|
|
23762
23784
|
var _useState = _sliced_to_array$9(useState(''), 2), inputValue = _useState[0], setInputValue = _useState[1];
|
|
23763
23785
|
var _useState1 = _sliced_to_array$9(useState(false), 2), isFocused = _useState1[0], setIsFocused = _useState1[1];
|
|
23786
|
+
var popperRef = useRef(null);
|
|
23764
23787
|
var handleKeyDown = function(e) {
|
|
23765
23788
|
if (e.key === 'Enter' && inputValue.trim()) {
|
|
23766
23789
|
e.preventDefault();
|
|
@@ -23781,6 +23804,7 @@ var MultiInput = function(_param) {
|
|
|
23781
23804
|
error: error,
|
|
23782
23805
|
isFocused: isFocused
|
|
23783
23806
|
}, props), {
|
|
23807
|
+
ref: popperRef,
|
|
23784
23808
|
children: [
|
|
23785
23809
|
/*#__PURE__*/ jsx(BaseInput, _object_spread_props$i(_object_spread$k({}, props), {
|
|
23786
23810
|
value: inputValue,
|
|
@@ -23793,12 +23817,9 @@ var MultiInput = function(_param) {
|
|
|
23793
23817
|
sz: sz,
|
|
23794
23818
|
onFocus: function() {
|
|
23795
23819
|
return setIsFocused(true);
|
|
23796
|
-
},
|
|
23797
|
-
onBlur: function() {
|
|
23798
|
-
return setIsFocused(false);
|
|
23799
23820
|
}
|
|
23800
23821
|
})),
|
|
23801
|
-
/*#__PURE__*/ jsx(ChipWrapper, {
|
|
23822
|
+
chips ? /*#__PURE__*/ jsx(ChipWrapper, {
|
|
23802
23823
|
sz: sz,
|
|
23803
23824
|
children: values === null || values === void 0 ? void 0 : values.map(function(value, index) {
|
|
23804
23825
|
return /*#__PURE__*/ jsx(MultiInputChip, {
|
|
@@ -23809,6 +23830,27 @@ var MultiInput = function(_param) {
|
|
|
23809
23830
|
}
|
|
23810
23831
|
}, value);
|
|
23811
23832
|
})
|
|
23833
|
+
}) : /*#__PURE__*/ jsx(Popper, {
|
|
23834
|
+
anchorRef: popperRef,
|
|
23835
|
+
maxWidth: popperRef === null || popperRef === void 0 ? void 0 : (_popperRef_current = popperRef.current) === null || _popperRef_current === void 0 ? void 0 : _popperRef_current.offsetWidth,
|
|
23836
|
+
side: "bottom",
|
|
23837
|
+
align: "start",
|
|
23838
|
+
open: isFocused && values.length > 0,
|
|
23839
|
+
onClose: function() {
|
|
23840
|
+
return setIsFocused(false);
|
|
23841
|
+
},
|
|
23842
|
+
children: /*#__PURE__*/ jsx(ChipWrapper, {
|
|
23843
|
+
sz: sz,
|
|
23844
|
+
children: values === null || values === void 0 ? void 0 : values.map(function(value, index) {
|
|
23845
|
+
return /*#__PURE__*/ jsx(MultiInputChip, {
|
|
23846
|
+
label: value,
|
|
23847
|
+
type: type,
|
|
23848
|
+
onClick: function() {
|
|
23849
|
+
return removeValue(index);
|
|
23850
|
+
}
|
|
23851
|
+
}, value);
|
|
23852
|
+
})
|
|
23853
|
+
})
|
|
23812
23854
|
})
|
|
23813
23855
|
]
|
|
23814
23856
|
}));
|
package/package.json
CHANGED
|
@@ -8,11 +8,13 @@ export interface MultiSelectProps extends BaseSelectProps {
|
|
|
8
8
|
setValues: (values: string[]) => void;
|
|
9
9
|
options: MultiSelectOption[];
|
|
10
10
|
placeholder?: string;
|
|
11
|
+
label?: string;
|
|
11
12
|
value?: string | string[];
|
|
13
|
+
chips?: boolean;
|
|
12
14
|
sz?: 'sm' | 'lg';
|
|
13
15
|
}
|
|
14
16
|
export interface ChipProps {
|
|
15
17
|
sz?: 'sm' | 'lg';
|
|
16
18
|
secondary?: boolean;
|
|
17
19
|
}
|
|
18
|
-
export declare const MultiSelect: ({ sz, error, options, checkbox, placeholder, values, setValues, type, ...props }: MultiSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const MultiSelect: ({ sz, error, options, checkbox, placeholder, label, chips, values, setValues, type, ...props }: MultiSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -3,10 +3,11 @@ interface MultiInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
|
3
3
|
error?: boolean;
|
|
4
4
|
type?: 'primary' | 'secondary';
|
|
5
5
|
isFocused?: boolean;
|
|
6
|
+
chips?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface MultiInputValues extends MultiInputProps {
|
|
8
9
|
values: string[];
|
|
9
10
|
setValues: (values: string[]) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare const MultiInput: ({ sz, error, type, values, setValues, placeholder, ...props }: MultiInputValues) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const MultiInput: ({ sz, error, type, values, setValues, placeholder, chips, ...props }: MultiInputValues) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|