@spark-web/select 1.0.5 → 1.0.6
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.
|
@@ -15,7 +15,7 @@ export declare type SelectProps = Pick<SelectHTMLAttributes<HTMLSelectElement>,
|
|
|
15
15
|
options: OptionsOrGroups;
|
|
16
16
|
placeholder?: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const Select: import("react").ForwardRefExoticComponent<Pick<SelectHTMLAttributes<HTMLSelectElement>, "name" | "
|
|
18
|
+
export declare const Select: import("react").ForwardRefExoticComponent<Pick<SelectHTMLAttributes<HTMLSelectElement>, "name" | "defaultValue" | "onBlur" | "onChange" | "value" | "required"> & {
|
|
19
19
|
data?: DataAttributeMap | undefined;
|
|
20
20
|
options: OptionsOrGroups;
|
|
21
21
|
placeholder?: string | undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var
|
|
6
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
7
7
|
var css = require('@emotion/css');
|
|
8
8
|
var box = require('@spark-web/box');
|
|
9
9
|
var field = require('@spark-web/field');
|
|
@@ -13,7 +13,6 @@ var theme = require('@spark-web/theme');
|
|
|
13
13
|
var react = require('react');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
|
|
16
|
-
var _excluded = ["disabled", "invalid"];
|
|
17
16
|
var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
18
17
|
var data = _ref.data,
|
|
19
18
|
defaultValue = _ref.defaultValue,
|
|
@@ -26,9 +25,11 @@ var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
26
25
|
value = _ref.value;
|
|
27
26
|
|
|
28
27
|
var _useFieldContext = field.useFieldContext(),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
29
|
+
_useFieldContext2$ = _useFieldContext2[0],
|
|
30
|
+
disabled = _useFieldContext2$.disabled,
|
|
31
|
+
invalid = _useFieldContext2$.invalid,
|
|
32
|
+
a11yProps = _useFieldContext2[1];
|
|
32
33
|
|
|
33
34
|
var styles = useSelectStyles({
|
|
34
35
|
disabled: disabled,
|
|
@@ -41,10 +42,23 @@ var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
41
42
|
children: opt.label
|
|
42
43
|
}, opt.value);
|
|
43
44
|
}, []);
|
|
44
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
return /*#__PURE__*/jsxRuntime.jsxs(textInput.InputContainer, {
|
|
46
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(box.Box, {
|
|
47
|
+
position: "absolute",
|
|
48
|
+
top: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
right: 0,
|
|
51
|
+
display: "flex",
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
padding: "medium",
|
|
54
|
+
className: css.css({
|
|
55
|
+
pointerEvents: 'none'
|
|
56
|
+
}),
|
|
57
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icon.ChevronDownIcon, {
|
|
58
|
+
size: "xxsmall",
|
|
59
|
+
tone: "placeholder"
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({}, a11yProps), {}, {
|
|
48
62
|
as: "select",
|
|
49
63
|
data: data,
|
|
50
64
|
defaultValue: (defaultValue !== null && defaultValue !== void 0 ? defaultValue : placeholder) ? '' : undefined,
|
|
@@ -79,22 +93,7 @@ var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
79
93
|
|
|
80
94
|
return mapOptions(optionOrGroup);
|
|
81
95
|
})]
|
|
82
|
-
}))
|
|
83
|
-
position: "absolute",
|
|
84
|
-
top: 0,
|
|
85
|
-
bottom: 0,
|
|
86
|
-
right: 0,
|
|
87
|
-
display: "flex",
|
|
88
|
-
alignItems: "center",
|
|
89
|
-
padding: "medium",
|
|
90
|
-
className: css.css({
|
|
91
|
-
pointerEvents: 'none'
|
|
92
|
-
}),
|
|
93
|
-
children: /*#__PURE__*/jsxRuntime.jsx(icon.ChevronDownIcon, {
|
|
94
|
-
size: "xxsmall",
|
|
95
|
-
tone: "placeholder"
|
|
96
|
-
})
|
|
97
|
-
})]
|
|
96
|
+
}))]
|
|
98
97
|
});
|
|
99
98
|
});
|
|
100
99
|
Select.displayName = 'Select';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var
|
|
6
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
7
7
|
var css = require('@emotion/css');
|
|
8
8
|
var box = require('@spark-web/box');
|
|
9
9
|
var field = require('@spark-web/field');
|
|
@@ -13,7 +13,6 @@ var theme = require('@spark-web/theme');
|
|
|
13
13
|
var react = require('react');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
|
|
16
|
-
var _excluded = ["disabled", "invalid"];
|
|
17
16
|
var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
18
17
|
var data = _ref.data,
|
|
19
18
|
defaultValue = _ref.defaultValue,
|
|
@@ -26,9 +25,11 @@ var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
26
25
|
value = _ref.value;
|
|
27
26
|
|
|
28
27
|
var _useFieldContext = field.useFieldContext(),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
29
|
+
_useFieldContext2$ = _useFieldContext2[0],
|
|
30
|
+
disabled = _useFieldContext2$.disabled,
|
|
31
|
+
invalid = _useFieldContext2$.invalid,
|
|
32
|
+
a11yProps = _useFieldContext2[1];
|
|
32
33
|
|
|
33
34
|
var styles = useSelectStyles({
|
|
34
35
|
disabled: disabled,
|
|
@@ -41,10 +42,23 @@ var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
41
42
|
children: opt.label
|
|
42
43
|
}, opt.value);
|
|
43
44
|
}, []);
|
|
44
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
return /*#__PURE__*/jsxRuntime.jsxs(textInput.InputContainer, {
|
|
46
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(box.Box, {
|
|
47
|
+
position: "absolute",
|
|
48
|
+
top: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
right: 0,
|
|
51
|
+
display: "flex",
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
padding: "medium",
|
|
54
|
+
className: css.css({
|
|
55
|
+
pointerEvents: 'none'
|
|
56
|
+
}),
|
|
57
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icon.ChevronDownIcon, {
|
|
58
|
+
size: "xxsmall",
|
|
59
|
+
tone: "placeholder"
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({}, a11yProps), {}, {
|
|
48
62
|
as: "select",
|
|
49
63
|
data: data,
|
|
50
64
|
defaultValue: (defaultValue !== null && defaultValue !== void 0 ? defaultValue : placeholder) ? '' : undefined,
|
|
@@ -79,22 +93,7 @@ var Select = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
79
93
|
|
|
80
94
|
return mapOptions(optionOrGroup);
|
|
81
95
|
})]
|
|
82
|
-
}))
|
|
83
|
-
position: "absolute",
|
|
84
|
-
top: 0,
|
|
85
|
-
bottom: 0,
|
|
86
|
-
right: 0,
|
|
87
|
-
display: "flex",
|
|
88
|
-
alignItems: "center",
|
|
89
|
-
padding: "medium",
|
|
90
|
-
className: css.css({
|
|
91
|
-
pointerEvents: 'none'
|
|
92
|
-
}),
|
|
93
|
-
children: /*#__PURE__*/jsxRuntime.jsx(icon.ChevronDownIcon, {
|
|
94
|
-
size: "xxsmall",
|
|
95
|
-
tone: "placeholder"
|
|
96
|
-
})
|
|
97
|
-
})]
|
|
96
|
+
}))]
|
|
98
97
|
});
|
|
99
98
|
});
|
|
100
99
|
Select.displayName = 'Select';
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
|
|
2
|
-
import
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
3
3
|
import { css } from '@emotion/css';
|
|
4
4
|
import { Box } from '@spark-web/box';
|
|
5
5
|
import { useFieldContext } from '@spark-web/field';
|
|
6
6
|
import { ChevronDownIcon } from '@spark-web/icon';
|
|
7
|
-
import { useInput } from '@spark-web/text-input';
|
|
7
|
+
import { InputContainer, useInput } from '@spark-web/text-input';
|
|
8
8
|
import { useTheme } from '@spark-web/theme';
|
|
9
9
|
import { forwardRef, useCallback } from 'react';
|
|
10
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
|
-
var _excluded = ["disabled", "invalid"];
|
|
13
12
|
var Select = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
14
13
|
var data = _ref.data,
|
|
15
14
|
defaultValue = _ref.defaultValue,
|
|
@@ -22,9 +21,11 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
22
21
|
value = _ref.value;
|
|
23
22
|
|
|
24
23
|
var _useFieldContext = useFieldContext(),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
25
|
+
_useFieldContext2$ = _useFieldContext2[0],
|
|
26
|
+
disabled = _useFieldContext2$.disabled,
|
|
27
|
+
invalid = _useFieldContext2$.invalid,
|
|
28
|
+
a11yProps = _useFieldContext2[1];
|
|
28
29
|
|
|
29
30
|
var styles = useSelectStyles({
|
|
30
31
|
disabled: disabled,
|
|
@@ -37,10 +38,23 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
37
38
|
children: opt.label
|
|
38
39
|
}, opt.value);
|
|
39
40
|
}, []);
|
|
40
|
-
return /*#__PURE__*/jsxs(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
return /*#__PURE__*/jsxs(InputContainer, {
|
|
42
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
43
|
+
position: "absolute",
|
|
44
|
+
top: 0,
|
|
45
|
+
bottom: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
display: "flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
padding: "medium",
|
|
50
|
+
className: css({
|
|
51
|
+
pointerEvents: 'none'
|
|
52
|
+
}),
|
|
53
|
+
children: /*#__PURE__*/jsx(ChevronDownIcon, {
|
|
54
|
+
size: "xxsmall",
|
|
55
|
+
tone: "placeholder"
|
|
56
|
+
})
|
|
57
|
+
}), /*#__PURE__*/jsxs(Box, _objectSpread(_objectSpread({}, a11yProps), {}, {
|
|
44
58
|
as: "select",
|
|
45
59
|
data: data,
|
|
46
60
|
defaultValue: (defaultValue !== null && defaultValue !== void 0 ? defaultValue : placeholder) ? '' : undefined,
|
|
@@ -75,22 +89,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
75
89
|
|
|
76
90
|
return mapOptions(optionOrGroup);
|
|
77
91
|
})]
|
|
78
|
-
}))
|
|
79
|
-
position: "absolute",
|
|
80
|
-
top: 0,
|
|
81
|
-
bottom: 0,
|
|
82
|
-
right: 0,
|
|
83
|
-
display: "flex",
|
|
84
|
-
alignItems: "center",
|
|
85
|
-
padding: "medium",
|
|
86
|
-
className: css({
|
|
87
|
-
pointerEvents: 'none'
|
|
88
|
-
}),
|
|
89
|
-
children: /*#__PURE__*/jsx(ChevronDownIcon, {
|
|
90
|
-
size: "xxsmall",
|
|
91
|
-
tone: "placeholder"
|
|
92
|
-
})
|
|
93
|
-
})]
|
|
92
|
+
}))]
|
|
94
93
|
});
|
|
95
94
|
});
|
|
96
95
|
Select.displayName = 'Select';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/select",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/spark-web-select.cjs.js",
|
|
6
6
|
"module": "dist/spark-web-select.esm.js",
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@babel/runtime": "^7.
|
|
12
|
-
"@emotion/css": "^11.
|
|
13
|
-
"@spark-web/a11y": "^1.0.
|
|
14
|
-
"@spark-web/box": "^1.0.
|
|
15
|
-
"@spark-web/field": "^
|
|
16
|
-
"@spark-web/icon": "^1.1.
|
|
17
|
-
"@spark-web/text": "^1.0.
|
|
18
|
-
"@spark-web/text-input": "^1.
|
|
19
|
-
"@spark-web/theme": "^3.0.
|
|
20
|
-
"@spark-web/utils": "^1.1.
|
|
11
|
+
"@babel/runtime": "^7.18.0",
|
|
12
|
+
"@emotion/css": "^11.9.0",
|
|
13
|
+
"@spark-web/a11y": "^1.0.5",
|
|
14
|
+
"@spark-web/box": "^1.0.5",
|
|
15
|
+
"@spark-web/field": "^2.0.0",
|
|
16
|
+
"@spark-web/icon": "^1.1.3",
|
|
17
|
+
"@spark-web/text": "^1.0.5",
|
|
18
|
+
"@spark-web/text-input": "^1.2.0",
|
|
19
|
+
"@spark-web/theme": "^3.0.1",
|
|
20
|
+
"@spark-web/utils": "^1.1.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "^17.0.12",
|