@tedi-design-system/react 14.4.0-rc.7 → 14.4.0-rc.8
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/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),ge=require("../../../../../external/classnames/index.cjs.js"),c=require("react"),Se=require("../../../../../external/react-select/dist/react-select.esm.cjs.js"),Me=require("../../../../../external/react-select/async/dist/react-select-async.esm.cjs.js"),be=require("../feedback-text/feedback-text.cjs.js"),Ie=require("../form-label/form-label.cjs.js"),qe=require("./components/select-clear-indicator.cjs.js"),Ce=require("./components/select-control.cjs.js"),Oe=require("./components/select-dropdown-indicator.cjs.js"),ve=require("./components/select-group.cjs.js"),Le=require("./components/select-group-heading.cjs.js"),Ve=require("./components/select-indicators-container.cjs.js"),Re=require("./components/select-input.cjs.js"),he=require("./components/select-loading-indicator.cjs.js"),xe=require("./components/select-menu.cjs.js"),ye=require("./components/select-menu-list.cjs.js"),_e=require("./components/select-menu-portal.cjs.js"),je=require("./components/select-multi-value.cjs.js"),we=require("./components/select-multi-value-remove.cjs.js"),Ne=require("./components/select-option.cjs.js"),Pe=require("./components/select-value-container.cjs.js"),n=require("./select.module.scss.cjs.js"),Te=require("../../../providers/label-provider/use-labels.cjs.js"),f=c.forwardRef((V,R)=>{const{options:h,defaultOptions:x,id:l,name:y,iconName:_="arrow_drop_down",label:j,required:g,value:w,defaultValue:N,tagsDirection:S="row",onChange:u,onInputChange:P,inputValue:T,loadOptions:G,isLoading:H,openMenuOnFocus:D=!1,openMenuOnClick:k=!0,tabSelectsValue:F=!1,disabled:M=!1,className:$,hideLabel:B=!1,helper:t,placeholder:E,invalid:z,valid:A,size:d,async:W=!1,renderOption:J,renderMessageListFooter:b,noOptionsMessage:K,loadingMessage:Q,multiple:p=!1,closeMenuOnSelect:U=!p,blurInputOnSelect:I=!1,autoFocus:X=!1,isClearable:Y=!0,isClearIndicatorVisible:Z=!1,isSearchable:q=!0,menuIsOpen:ee,onMenuClose:te,onMenuOpen:ne,onBlur:se,inputIsHidden:le,isTagRemovable:C=!1,optionGroupHeadingText:oe={modifiers:"small",color:"tertiary"},cacheOptions:ae=!0,showRadioButtons:re=!1,renderWithoutLabel:ie,tooltip:ce,classNames:O}=V,v=t?(t==null?void 0:t.id)??`${l}-helper`:void 0,a=c.useRef(null),{getLabel:L}=Te.useLabels();c.useImperativeHandle(R,()=>a.current);const ue=o=>{u==null||u(o),!I&&a.current&&setTimeout(()=>{var r,i;return(i=(r=a.current)==null?void 0:r.inputRef)==null?void 0:i.focus()},0)},de=c.useCallback(o=>s.jsx(ye.SelectMenuList,{...o,renderMessageListFooter:b}),[b]),pe=()=>{const o={ClearIndicator:e=>qe.SelectClearIndicator({isClearIndicatorVisible:Z,...e}),DropdownIndicator:()=>Oe.SelectDropDownIndicator({iconName:_}),IndicatorSeparator:()=>null,MenuPortal:_e.SelectMenuPortal,Menu:xe.SelectMenu,MenuList:de,Option:e=>Ne.SelectOption({renderOption:J,multiple:p,showRadioButtons:re,...e}),Control:Ce.SelectControl,Input:Re.SelectInput,MultiValue:e=>je.SelectMultiValue({isTagRemovable:C,...e}),MultiValueRemove:we.SelectMultiValueRemove,Group:ve.SelectGroup,GroupHeading:e=>Le.SelectGroupHeading({optionGroupHeadingText:oe,...e}),IndicatorsContainer:Ve.SelectIndicatorsContainer,ValueContainer:Pe.SelectValueContainer,LoadingIndicator:he.SelectLoadingIndicator},r=W?Me.default:Se.default,i=()=>L("select.no-options"),fe=()=>L("select.loading");return s.jsx(r,{id:l,"aria-describedby":v,autoFocus:X,ref:a,instanceId:l,className:"tedi-select__wrapper",name:y,options:h,defaultOptions:x,value:w,defaultValue:N,cacheOptions:ae,onChange:ue,onInputChange:P,onBlur:se,inputValue:T,inputId:`${l}-input`,loadOptions:G,isLoading:H,noOptionsMessage:K||i,loadingMessage:Q||fe,classNamePrefix:"select",components:o,isDisabled:M,isSearchable:q,menuIsOpen:ee,openMenuOnFocus:D,openMenuOnClick:k,tabSelectsValue:F,onMenuClose:te,onMenuOpen:ne,placeholder:E||"",isClearable:Y,backspaceRemovesValue:C,menuShouldScrollIntoView:!0,isMulti:p,hideSelectedOptions:!1,closeMenuOnSelect:U,blurInputOnSelect:I,menuPlacement:"auto",inputIsHidden:le,required:g,menuPortalTarget:document.body,menuPosition:"absolute",classNames:O?Object.fromEntries(Object.entries(O).map(([e,m])=>[e,typeof m=="string"?()=>m:m])):void 0,theme:e=>({...e,colors:{...e.colors,primary:"var(--tedi-blue-600)",danger:"var(--tedi-red-600)",dangerLight:"var(--tedi-red-200)"}}),styles:{input:e=>({...e,gridTemplateColumns:"0fr"})}})},me=ge.default(n.default["tedi-select"],$,{[n.default["tedi-select--invalid"]]:z||(t==null?void 0:t.type)==="error"},{[n.default["tedi-select--valid"]]:A||(t==null?void 0:t.type)==="valid"},{[n.default[`tedi-select--${d}`]]:d},{[n.default[`tedi-select--tags-${S}`]]:S},{[n.default["tedi-select--searchable"]]:q},{[n.default["tedi-select--disabled"]]:M});return s.jsxs("div",{"data-name":"select",className:me,children:[s.jsxs("div",{className:n.default["tedi-select__inner"],children:[s.jsx(Ie.FormLabel,{id:`${l}-input`,label:j,required:g,hideLabel:B,size:d,renderWithoutLabel:ie,tooltip:ce}),pe()]}),t&&s.jsx(be.FeedbackText,{...t,id:v})]})});f.displayName="Select";exports.Select=f;exports.default=f;
|
|
@@ -1,160 +1,163 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as s, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import ge from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import p, { forwardRef as Se } from "react";
|
|
4
|
+
import Me from "../../../../../external/react-select/dist/react-select.esm.es.js";
|
|
5
5
|
import be from "../../../../../external/react-select/async/dist/react-select-async.esm.es.js";
|
|
6
|
-
import { FeedbackText as
|
|
7
|
-
import { FormLabel as
|
|
8
|
-
import { SelectClearIndicator as
|
|
6
|
+
import { FeedbackText as Ie } from "../feedback-text/feedback-text.es.js";
|
|
7
|
+
import { FormLabel as Oe } from "../form-label/form-label.es.js";
|
|
8
|
+
import { SelectClearIndicator as Ce } from "./components/select-clear-indicator.es.js";
|
|
9
9
|
import { SelectControl as ve } from "./components/select-control.es.js";
|
|
10
|
-
import { SelectDropDownIndicator as
|
|
11
|
-
import { SelectGroup as
|
|
12
|
-
import { SelectGroupHeading as
|
|
13
|
-
import { SelectIndicatorsContainer as
|
|
14
|
-
import { SelectInput as
|
|
15
|
-
import { SelectLoadingIndicator as
|
|
16
|
-
import { SelectMenu as
|
|
17
|
-
import { SelectMenuList as
|
|
18
|
-
import { SelectMenuPortal as
|
|
19
|
-
import { SelectMultiValue as
|
|
20
|
-
import { SelectMultiValueRemove as
|
|
21
|
-
import { SelectOption as
|
|
22
|
-
import { SelectValueContainer as
|
|
10
|
+
import { SelectDropDownIndicator as Le } from "./components/select-dropdown-indicator.es.js";
|
|
11
|
+
import { SelectGroup as he } from "./components/select-group.es.js";
|
|
12
|
+
import { SelectGroupHeading as ye } from "./components/select-group-heading.es.js";
|
|
13
|
+
import { SelectIndicatorsContainer as Ne } from "./components/select-indicators-container.es.js";
|
|
14
|
+
import { SelectInput as Ve } from "./components/select-input.es.js";
|
|
15
|
+
import { SelectLoadingIndicator as Re } from "./components/select-loading-indicator.es.js";
|
|
16
|
+
import { SelectMenu as we } from "./components/select-menu.es.js";
|
|
17
|
+
import { SelectMenuList as _e } from "./components/select-menu-list.es.js";
|
|
18
|
+
import { SelectMenuPortal as $e } from "./components/select-menu-portal.es.js";
|
|
19
|
+
import { SelectMultiValue as xe } from "./components/select-multi-value.es.js";
|
|
20
|
+
import { SelectMultiValueRemove as He } from "./components/select-multi-value-remove.es.js";
|
|
21
|
+
import { SelectOption as Pe } from "./components/select-option.es.js";
|
|
22
|
+
import { SelectValueContainer as Te } from "./components/select-value-container.es.js";
|
|
23
23
|
import o from "./select.module.scss.es.js";
|
|
24
|
-
import { useLabels as
|
|
25
|
-
const
|
|
26
|
-
(
|
|
24
|
+
import { useLabels as De } from "../../../providers/label-provider/use-labels.es.js";
|
|
25
|
+
const Fe = Se(
|
|
26
|
+
(y, N) => {
|
|
27
27
|
const {
|
|
28
|
-
options:
|
|
29
|
-
defaultOptions:
|
|
28
|
+
options: V,
|
|
29
|
+
defaultOptions: R,
|
|
30
30
|
id: a,
|
|
31
|
-
name:
|
|
32
|
-
iconName:
|
|
33
|
-
label:
|
|
34
|
-
required:
|
|
35
|
-
value:
|
|
36
|
-
defaultValue:
|
|
37
|
-
tagsDirection:
|
|
38
|
-
onChange:
|
|
39
|
-
onInputChange:
|
|
40
|
-
inputValue:
|
|
41
|
-
loadOptions:
|
|
42
|
-
isLoading:
|
|
43
|
-
openMenuOnFocus:
|
|
44
|
-
openMenuOnClick:
|
|
45
|
-
tabSelectsValue:
|
|
46
|
-
disabled:
|
|
47
|
-
className:
|
|
48
|
-
hideLabel:
|
|
31
|
+
name: w,
|
|
32
|
+
iconName: _ = "arrow_drop_down",
|
|
33
|
+
label: $,
|
|
34
|
+
required: f,
|
|
35
|
+
value: x,
|
|
36
|
+
defaultValue: H,
|
|
37
|
+
tagsDirection: g = "row",
|
|
38
|
+
onChange: c,
|
|
39
|
+
onInputChange: P,
|
|
40
|
+
inputValue: T,
|
|
41
|
+
loadOptions: D,
|
|
42
|
+
isLoading: F,
|
|
43
|
+
openMenuOnFocus: G = !1,
|
|
44
|
+
openMenuOnClick: j = !0,
|
|
45
|
+
tabSelectsValue: k = !1,
|
|
46
|
+
disabled: S = !1,
|
|
47
|
+
className: B,
|
|
48
|
+
hideLabel: E = !1,
|
|
49
49
|
helper: t,
|
|
50
|
-
placeholder:
|
|
51
|
-
invalid:
|
|
52
|
-
valid:
|
|
53
|
-
size:
|
|
54
|
-
async:
|
|
55
|
-
renderOption:
|
|
56
|
-
renderMessageListFooter:
|
|
50
|
+
placeholder: q,
|
|
51
|
+
invalid: z,
|
|
52
|
+
valid: A,
|
|
53
|
+
size: d,
|
|
54
|
+
async: W = !1,
|
|
55
|
+
renderOption: J,
|
|
56
|
+
renderMessageListFooter: M,
|
|
57
57
|
noOptionsMessage: K,
|
|
58
58
|
loadingMessage: Q,
|
|
59
|
-
multiple:
|
|
60
|
-
closeMenuOnSelect: U = !
|
|
61
|
-
blurInputOnSelect:
|
|
59
|
+
multiple: m = !1,
|
|
60
|
+
closeMenuOnSelect: U = !m,
|
|
61
|
+
blurInputOnSelect: b = !1,
|
|
62
62
|
autoFocus: X = !1,
|
|
63
63
|
isClearable: Y = !0,
|
|
64
64
|
isClearIndicatorVisible: Z = !1,
|
|
65
|
-
isSearchable:
|
|
65
|
+
isSearchable: I = !0,
|
|
66
66
|
menuIsOpen: ee,
|
|
67
67
|
onMenuClose: te,
|
|
68
68
|
onMenuOpen: oe,
|
|
69
69
|
onBlur: ae,
|
|
70
70
|
inputIsHidden: re,
|
|
71
|
-
isTagRemovable:
|
|
71
|
+
isTagRemovable: O = !1,
|
|
72
72
|
optionGroupHeadingText: ie = { modifiers: "small", color: "tertiary" },
|
|
73
73
|
cacheOptions: ne = !0,
|
|
74
74
|
showRadioButtons: le = !1,
|
|
75
75
|
renderWithoutLabel: se,
|
|
76
76
|
tooltip: ce,
|
|
77
|
-
classNames:
|
|
78
|
-
} =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
() =>
|
|
77
|
+
classNames: C
|
|
78
|
+
} = y, v = t ? (t == null ? void 0 : t.id) ?? `${a}-helper` : void 0, i = p.useRef(null), { getLabel: L } = De();
|
|
79
|
+
p.useImperativeHandle(
|
|
80
|
+
N,
|
|
81
|
+
() => i.current
|
|
82
82
|
);
|
|
83
|
-
const de = (
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
return (
|
|
83
|
+
const de = (r) => {
|
|
84
|
+
c == null || c(r), !b && i.current && setTimeout(() => {
|
|
85
|
+
var n, l;
|
|
86
|
+
return (l = (n = i.current) == null ? void 0 : n.inputRef) == null ? void 0 : l.focus();
|
|
87
87
|
}, 0);
|
|
88
|
-
}, me = (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
}, me = p.useCallback(
|
|
89
|
+
(r) => /* @__PURE__ */ s(_e, { ...r, renderMessageListFooter: M }),
|
|
90
|
+
[M]
|
|
91
|
+
), ue = () => {
|
|
92
|
+
const r = {
|
|
93
|
+
ClearIndicator: (e) => Ce({ isClearIndicatorVisible: Z, ...e }),
|
|
94
|
+
DropdownIndicator: () => Le({ iconName: _ }),
|
|
92
95
|
IndicatorSeparator: () => null,
|
|
93
|
-
MenuPortal:
|
|
94
|
-
Menu:
|
|
95
|
-
MenuList:
|
|
96
|
-
Option: (e) =>
|
|
96
|
+
MenuPortal: $e,
|
|
97
|
+
Menu: we,
|
|
98
|
+
MenuList: me,
|
|
99
|
+
Option: (e) => Pe({ renderOption: J, multiple: m, showRadioButtons: le, ...e }),
|
|
97
100
|
Control: ve,
|
|
98
|
-
Input:
|
|
99
|
-
MultiValue: (e) =>
|
|
100
|
-
MultiValueRemove:
|
|
101
|
-
Group:
|
|
102
|
-
GroupHeading: (e) =>
|
|
103
|
-
IndicatorsContainer:
|
|
104
|
-
ValueContainer:
|
|
105
|
-
LoadingIndicator:
|
|
106
|
-
},
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
|
|
101
|
+
Input: Ve,
|
|
102
|
+
MultiValue: (e) => xe({ isTagRemovable: O, ...e }),
|
|
103
|
+
MultiValueRemove: He,
|
|
104
|
+
Group: he,
|
|
105
|
+
GroupHeading: (e) => ye({ optionGroupHeadingText: ie, ...e }),
|
|
106
|
+
IndicatorsContainer: Ne,
|
|
107
|
+
ValueContainer: Te,
|
|
108
|
+
LoadingIndicator: Re
|
|
109
|
+
}, n = W ? be : Me, l = () => L("select.no-options"), fe = () => L("select.loading");
|
|
110
|
+
return /* @__PURE__ */ s(
|
|
111
|
+
n,
|
|
109
112
|
{
|
|
110
113
|
id: a,
|
|
111
|
-
"aria-describedby":
|
|
114
|
+
"aria-describedby": v,
|
|
112
115
|
autoFocus: X,
|
|
113
|
-
ref:
|
|
116
|
+
ref: i,
|
|
114
117
|
instanceId: a,
|
|
115
118
|
className: "tedi-select__wrapper",
|
|
116
|
-
name:
|
|
117
|
-
options:
|
|
118
|
-
defaultOptions:
|
|
119
|
-
value:
|
|
120
|
-
defaultValue:
|
|
119
|
+
name: w,
|
|
120
|
+
options: V,
|
|
121
|
+
defaultOptions: R,
|
|
122
|
+
value: x,
|
|
123
|
+
defaultValue: H,
|
|
121
124
|
cacheOptions: ne,
|
|
122
125
|
onChange: de,
|
|
123
|
-
onInputChange:
|
|
126
|
+
onInputChange: P,
|
|
124
127
|
onBlur: ae,
|
|
125
|
-
inputValue:
|
|
128
|
+
inputValue: T,
|
|
126
129
|
inputId: `${a}-input`,
|
|
127
|
-
loadOptions:
|
|
128
|
-
isLoading:
|
|
129
|
-
noOptionsMessage: K ||
|
|
130
|
-
loadingMessage: Q ||
|
|
130
|
+
loadOptions: D,
|
|
131
|
+
isLoading: F,
|
|
132
|
+
noOptionsMessage: K || l,
|
|
133
|
+
loadingMessage: Q || fe,
|
|
131
134
|
classNamePrefix: "select",
|
|
132
|
-
components:
|
|
133
|
-
isDisabled:
|
|
134
|
-
isSearchable:
|
|
135
|
+
components: r,
|
|
136
|
+
isDisabled: S,
|
|
137
|
+
isSearchable: I,
|
|
135
138
|
menuIsOpen: ee,
|
|
136
|
-
openMenuOnFocus:
|
|
137
|
-
openMenuOnClick:
|
|
138
|
-
tabSelectsValue:
|
|
139
|
+
openMenuOnFocus: G,
|
|
140
|
+
openMenuOnClick: j,
|
|
141
|
+
tabSelectsValue: k,
|
|
139
142
|
onMenuClose: te,
|
|
140
143
|
onMenuOpen: oe,
|
|
141
|
-
placeholder:
|
|
144
|
+
placeholder: q || "",
|
|
142
145
|
isClearable: Y,
|
|
143
|
-
backspaceRemovesValue:
|
|
146
|
+
backspaceRemovesValue: O,
|
|
144
147
|
menuShouldScrollIntoView: !0,
|
|
145
|
-
isMulti:
|
|
148
|
+
isMulti: m,
|
|
146
149
|
hideSelectedOptions: !1,
|
|
147
150
|
closeMenuOnSelect: U,
|
|
148
|
-
blurInputOnSelect:
|
|
151
|
+
blurInputOnSelect: b,
|
|
149
152
|
menuPlacement: "auto",
|
|
150
153
|
inputIsHidden: re,
|
|
151
|
-
required:
|
|
154
|
+
required: f,
|
|
152
155
|
menuPortalTarget: document.body,
|
|
153
156
|
menuPosition: "absolute",
|
|
154
|
-
classNames:
|
|
155
|
-
Object.entries(
|
|
157
|
+
classNames: C ? Object.fromEntries(
|
|
158
|
+
Object.entries(C).map(([e, u]) => [
|
|
156
159
|
e,
|
|
157
|
-
typeof
|
|
160
|
+
typeof u == "string" ? () => u : u
|
|
158
161
|
])
|
|
159
162
|
) : void 0,
|
|
160
163
|
theme: (e) => ({
|
|
@@ -174,38 +177,38 @@ const De = ge(
|
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
);
|
|
177
|
-
},
|
|
180
|
+
}, pe = ge(
|
|
178
181
|
o["tedi-select"],
|
|
179
|
-
|
|
180
|
-
{ [o["tedi-select--invalid"]]:
|
|
181
|
-
{ [o["tedi-select--valid"]]:
|
|
182
|
-
{ [o[`tedi-select--${
|
|
183
|
-
{ [o[`tedi-select--tags-${
|
|
184
|
-
{ [o["tedi-select--searchable"]]:
|
|
185
|
-
{ [o["tedi-select--disabled"]]:
|
|
182
|
+
B,
|
|
183
|
+
{ [o["tedi-select--invalid"]]: z || (t == null ? void 0 : t.type) === "error" },
|
|
184
|
+
{ [o["tedi-select--valid"]]: A || (t == null ? void 0 : t.type) === "valid" },
|
|
185
|
+
{ [o[`tedi-select--${d}`]]: d },
|
|
186
|
+
{ [o[`tedi-select--tags-${g}`]]: g },
|
|
187
|
+
{ [o["tedi-select--searchable"]]: I },
|
|
188
|
+
{ [o["tedi-select--disabled"]]: S }
|
|
186
189
|
);
|
|
187
|
-
return /* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
190
|
+
return /* @__PURE__ */ h("div", { "data-name": "select", className: pe, children: [
|
|
191
|
+
/* @__PURE__ */ h("div", { className: o["tedi-select__inner"], children: [
|
|
192
|
+
/* @__PURE__ */ s(
|
|
193
|
+
Oe,
|
|
191
194
|
{
|
|
192
195
|
id: `${a}-input`,
|
|
193
|
-
label:
|
|
194
|
-
required:
|
|
195
|
-
hideLabel:
|
|
196
|
-
size:
|
|
196
|
+
label: $,
|
|
197
|
+
required: f,
|
|
198
|
+
hideLabel: E,
|
|
199
|
+
size: d,
|
|
197
200
|
renderWithoutLabel: se,
|
|
198
201
|
tooltip: ce
|
|
199
202
|
}
|
|
200
203
|
),
|
|
201
|
-
|
|
204
|
+
ue()
|
|
202
205
|
] }),
|
|
203
|
-
t && /* @__PURE__ */
|
|
206
|
+
t && /* @__PURE__ */ s(Ie, { ...t, id: v })
|
|
204
207
|
] });
|
|
205
208
|
}
|
|
206
209
|
);
|
|
207
|
-
|
|
210
|
+
Fe.displayName = "Select";
|
|
208
211
|
export {
|
|
209
|
-
|
|
210
|
-
|
|
212
|
+
Fe as Select,
|
|
213
|
+
Fe as default
|
|
211
214
|
};
|