@dt-dds/react-select 1.0.0-beta.95 → 1.0.0-beta.97
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/CHANGELOG.md +20 -0
- package/dist/index.js +13 -10
- package/dist/index.mjs +6 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @dt-ui/react-select
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.97
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: multi select option styling
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @dt-dds/react-dropdown@1.0.0-beta.103
|
|
10
|
+
|
|
11
|
+
## 1.0.0-beta.96
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- fix: add displayName to Icon and IconButton for production builds
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @dt-dds/react-icon@1.0.0-beta.63
|
|
18
|
+
- @dt-dds/react-icon-button@1.0.0-beta.29
|
|
19
|
+
- @dt-dds/react-checkbox@1.0.0-beta.64
|
|
20
|
+
- @dt-dds/react-dropdown@1.0.0-beta.102
|
|
21
|
+
- @dt-dds/react-label-field@1.0.0-beta.61
|
|
22
|
+
|
|
3
23
|
## 1.0.0-beta.95
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ __export(index_exports, {
|
|
|
64
64
|
module.exports = __toCommonJS(index_exports);
|
|
65
65
|
|
|
66
66
|
// src/Select.tsx
|
|
67
|
-
var
|
|
67
|
+
var import_react3 = require("react");
|
|
68
68
|
var Downshift = __toESM(require("downshift"));
|
|
69
69
|
var import_react_box = require("@dt-dds/react-box");
|
|
70
70
|
var import_react_icon = require("@dt-dds/react-icon");
|
|
@@ -73,6 +73,7 @@ var import_react_label_field = require("@dt-dds/react-label-field");
|
|
|
73
73
|
var import_react_tooltip = require("@dt-dds/react-tooltip");
|
|
74
74
|
|
|
75
75
|
// src/components/SelectOption.tsx
|
|
76
|
+
var import_react2 = require("@emotion/react");
|
|
76
77
|
var import_react_dropdown = require("@dt-dds/react-dropdown");
|
|
77
78
|
|
|
78
79
|
// src/context/SelectProvider.tsx
|
|
@@ -132,6 +133,7 @@ var SelectOption = ({
|
|
|
132
133
|
value,
|
|
133
134
|
isDisabled = false
|
|
134
135
|
}) => {
|
|
136
|
+
const { spacing } = (0, import_react2.useTheme)();
|
|
135
137
|
const { getItemProps, isItemHighlighted, isItemSelected, isMulti } = useSelectContext();
|
|
136
138
|
const item = { value, isDisabled };
|
|
137
139
|
const isSelected = isItemSelected(value);
|
|
@@ -143,13 +145,14 @@ var SelectOption = ({
|
|
|
143
145
|
isDisabled,
|
|
144
146
|
isHighlighted,
|
|
145
147
|
isSelected,
|
|
146
|
-
style: __spreadValues(__spreadValues({}, style), isMulti ? {
|
|
148
|
+
style: __spreadValues(__spreadValues({}, style), isMulti ? { paddingY: spacing.spacing_40, paddingX: spacing.spacing_50 } : {})
|
|
147
149
|
}, getItemProps({ item, index })), {
|
|
148
150
|
children: isMulti ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
149
151
|
SelectCheckboxStyled,
|
|
150
152
|
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
isChecked: isSelected,
|
|
154
|
+
isDisabled,
|
|
155
|
+
size: "small",
|
|
153
156
|
tabIndex: -1,
|
|
154
157
|
children
|
|
155
158
|
}
|
|
@@ -321,7 +324,7 @@ var Select = (_a) => {
|
|
|
321
324
|
"onFocus"
|
|
322
325
|
]);
|
|
323
326
|
var _a2;
|
|
324
|
-
const anchorRef = (0,
|
|
327
|
+
const anchorRef = (0, import_react3.useRef)(null);
|
|
325
328
|
const handleClearKeyDown = (e) => {
|
|
326
329
|
if (e.code === "Enter" || e.code === "Space") {
|
|
327
330
|
handleClearSelection(e);
|
|
@@ -331,11 +334,11 @@ var Select = (_a) => {
|
|
|
331
334
|
e.stopPropagation();
|
|
332
335
|
isMulti && (onChange == null ? void 0 : onChange([]));
|
|
333
336
|
};
|
|
334
|
-
const options = (0,
|
|
337
|
+
const options = (0, import_react3.useMemo)(() => {
|
|
335
338
|
var _a3;
|
|
336
|
-
const tempOptions =
|
|
339
|
+
const tempOptions = import_react3.Children.map(children, (child) => {
|
|
337
340
|
var _a4, _b2, _c;
|
|
338
|
-
if ((0,
|
|
341
|
+
if ((0, import_react3.isValidElement)(child) && child.props.value != void 0) {
|
|
339
342
|
return {
|
|
340
343
|
value: child.props.value,
|
|
341
344
|
isDisabled: child.props.isDisabled,
|
|
@@ -346,11 +349,11 @@ var Select = (_a) => {
|
|
|
346
349
|
});
|
|
347
350
|
return (_a3 = tempOptions == null ? void 0 : tempOptions.filter(Boolean)) != null ? _a3 : [];
|
|
348
351
|
}, [children]);
|
|
349
|
-
const selectedOptionsSet = (0,
|
|
352
|
+
const selectedOptionsSet = (0, import_react3.useMemo)(
|
|
350
353
|
() => new Set(value ? [value].flat() : []),
|
|
351
354
|
[value]
|
|
352
355
|
);
|
|
353
|
-
const selectedItems = (0,
|
|
356
|
+
const selectedItems = (0, import_react3.useMemo)(
|
|
354
357
|
() => options.filter((o) => selectedOptionsSet.has(o.value)),
|
|
355
358
|
[options, selectedOptionsSet]
|
|
356
359
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -45,6 +45,7 @@ import { LabelField } from "@dt-dds/react-label-field";
|
|
|
45
45
|
import { Tooltip } from "@dt-dds/react-tooltip";
|
|
46
46
|
|
|
47
47
|
// src/components/SelectOption.tsx
|
|
48
|
+
import { useTheme } from "@emotion/react";
|
|
48
49
|
import { Dropdown } from "@dt-dds/react-dropdown";
|
|
49
50
|
|
|
50
51
|
// src/context/SelectProvider.tsx
|
|
@@ -104,6 +105,7 @@ var SelectOption = ({
|
|
|
104
105
|
value,
|
|
105
106
|
isDisabled = false
|
|
106
107
|
}) => {
|
|
108
|
+
const { spacing } = useTheme();
|
|
107
109
|
const { getItemProps, isItemHighlighted, isItemSelected, isMulti } = useSelectContext();
|
|
108
110
|
const item = { value, isDisabled };
|
|
109
111
|
const isSelected = isItemSelected(value);
|
|
@@ -115,13 +117,14 @@ var SelectOption = ({
|
|
|
115
117
|
isDisabled,
|
|
116
118
|
isHighlighted,
|
|
117
119
|
isSelected,
|
|
118
|
-
style: __spreadValues(__spreadValues({}, style), isMulti ? {
|
|
120
|
+
style: __spreadValues(__spreadValues({}, style), isMulti ? { paddingY: spacing.spacing_40, paddingX: spacing.spacing_50 } : {})
|
|
119
121
|
}, getItemProps({ item, index })), {
|
|
120
122
|
children: isMulti ? /* @__PURE__ */ jsx2(
|
|
121
123
|
SelectCheckboxStyled,
|
|
122
124
|
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
isChecked: isSelected,
|
|
126
|
+
isDisabled,
|
|
127
|
+
size: "small",
|
|
125
128
|
tabIndex: -1,
|
|
126
129
|
children
|
|
127
130
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dt-dds/react-select",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.97",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@dt-dds/react-box": "1.0.0-beta.76",
|
|
24
|
-
"@dt-dds/react-checkbox": "1.0.0-beta.
|
|
24
|
+
"@dt-dds/react-checkbox": "1.0.0-beta.64",
|
|
25
25
|
"@dt-dds/react-core": "1.0.0-beta.59",
|
|
26
|
-
"@dt-dds/react-dropdown": "1.0.0-beta.
|
|
27
|
-
"@dt-dds/react-icon": "1.0.0-beta.
|
|
28
|
-
"@dt-dds/react-icon-button": "1.0.0-beta.
|
|
29
|
-
"@dt-dds/react-label-field": "1.0.0-beta.
|
|
26
|
+
"@dt-dds/react-dropdown": "1.0.0-beta.103",
|
|
27
|
+
"@dt-dds/react-icon": "1.0.0-beta.63",
|
|
28
|
+
"@dt-dds/react-icon-button": "1.0.0-beta.29",
|
|
29
|
+
"@dt-dds/react-label-field": "1.0.0-beta.61",
|
|
30
30
|
"@dt-dds/react-tooltip": "1.0.0-beta.69",
|
|
31
31
|
"@dt-dds/react-typography": "1.0.0-beta.50",
|
|
32
32
|
"@dt-dds/themes": "1.0.0-beta.14",
|