@tedi-design-system/react 17.0.0 → 17.1.0-rc.1
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/bundle-stats.html +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/form/field/field.cjs.js +1 -0
- package/src/tedi/components/form/field/field.d.ts +88 -0
- package/src/tedi/components/form/field/field.es.js +54 -0
- package/src/tedi/components/form/field/field.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/field/field.module.scss.es.js +6 -0
- package/src/tedi/components/form/file-upload/file-upload.cjs.js +1 -1
- package/src/tedi/components/form/file-upload/file-upload.d.ts +14 -2
- package/src/tedi/components/form/file-upload/file-upload.es.js +97 -90
- package/src/tedi/components/form/input-group/components/input/input.cjs.js +1 -0
- package/src/tedi/components/form/input-group/components/input/input.d.ts +19 -0
- package/src/tedi/components/form/input-group/components/input/input.es.js +20 -0
- package/src/tedi/components/form/input-group/components/prefix/prefix.cjs.js +1 -0
- package/src/tedi/components/form/input-group/components/prefix/prefix.d.ts +18 -0
- package/src/tedi/components/form/input-group/components/prefix/prefix.es.js +26 -0
- package/src/tedi/components/form/input-group/components/suffix/suffix.cjs.js +1 -0
- package/src/tedi/components/form/input-group/components/suffix/suffix.d.ts +18 -0
- package/src/tedi/components/form/input-group/components/suffix/suffix.es.js +26 -0
- package/src/tedi/components/form/input-group/index.d.ts +4 -0
- package/src/tedi/components/form/input-group/input-group.cjs.js +1 -0
- package/src/tedi/components/form/input-group/input-group.d.ts +87 -0
- package/src/tedi/components/form/input-group/input-group.es.js +61 -0
- package/src/tedi/components/form/input-group/input-group.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/input-group/input-group.module.scss.es.js +16 -0
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.es.js +35 -25
- package/src/tedi/components/form/select/components/select-control.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-control.es.js +7 -3
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.d.ts +3 -2
- package/src/tedi/components/form/select/select.es.js +168 -166
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.d.ts +118 -36
- package/src/tedi/components/form/textfield/textfield.es.js +134 -172
- package/src/tedi/index.d.ts +2 -0
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +168 -156
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),k=require("../../../../../external/classnames/index.cjs.js"),e=require("react"),m=require("../feedback-text/feedback-text.cjs.js"),R=require("../form-label/form-label.cjs.js"),w=require("./components/input/input.cjs.js"),A=require("./components/prefix/prefix.cjs.js"),F=require("./components/suffix/suffix.cjs.js"),u=require("./input-group.module.scss.cjs.js"),f=e.createContext(null),N=()=>{const n=e.useContext(f);if(!n)throw new Error("InputGroupContext missing");return n},T=()=>e.useContext(f),c=e.forwardRef(({className:n,addons:G=!0,helper:t,label:s,children:S,disabled:i,id:q,...j},P)=>{const x=e.useRef(null),y=e.useId(),o=q??y,[a,l]=e.useState(!1),[p,g]=e.useState(!1);e.useImperativeHandle(P,()=>({get root(){return x.current}}));const b=e.useMemo(()=>({hasPrefix:a,hasSuffix:p,disabled:i,hasExternalLabel:!!s,inputId:o,registerPrefix:()=>l(!0),unregisterPrefix:()=>l(!1),registerSuffix:()=>g(!0),unregisterSuffix:()=>g(!1)}),[o,a,p,i,s]),h=k.default(u.default["tedi-input-group"],{[u.default["tedi-input-group--addons"]]:G,[u.default["tedi-input-group--has-prefix"]]:a,[u.default["tedi-input-group--has-suffix"]]:p,[u.default["tedi-input-group--disabled"]]:i},n),v=()=>!t||Array.isArray(t)&&t.length===0?null:r.jsx("div",{className:u.default["tedi-input-group__feedback-wrapper"],children:Array.isArray(t)?t.map((C,I)=>r.jsx(m.FeedbackText,{...C,id:`group-helper-${I}`},I)):r.jsx(m.FeedbackText,{...t,id:"group-helper"})});return r.jsxs(f.Provider,{value:b,children:[s&&r.jsx(R.FormLabel,{...j,label:s,id:o}),r.jsx("div",{ref:x,className:h,"data-name":"tedi-input-group","aria-disabled":i,children:S}),v()]})});c.displayName="InputGroup";const d=c;d.Prefix=A.Prefix;d.Suffix=F.Suffix;d.Input=w.Input;exports.InputGroupBase=c;exports.useInputGroup=N;exports.useOptionalInputGroup=T;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { FeedbackTextProps } from '../feedback-text/feedback-text';
|
|
3
|
+
import { FormLabelProps } from '../form-label/form-label';
|
|
4
|
+
import { Input } from './components/input/input';
|
|
5
|
+
import { Prefix } from './components/prefix/prefix';
|
|
6
|
+
import { Suffix } from './components/suffix/suffix';
|
|
7
|
+
export interface InputGroupProps extends FormLabelProps {
|
|
8
|
+
/**
|
|
9
|
+
* Additional class name(s) applied to the root element of the InputGroup.
|
|
10
|
+
* Useful for custom styling or layout overrides.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Enables merged styling between input and its prefix/suffix elements.
|
|
15
|
+
* When `true`, borders and radius are visually combined into a single control.
|
|
16
|
+
* Disable this when using non-standard addons (e.g. buttons) that should not visually merge.
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
addons?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Helper or feedback text displayed below the input group.
|
|
23
|
+
* Can be a single item or multiple messages (e.g. error + hint).
|
|
24
|
+
*
|
|
25
|
+
* Accepts the same props as `FeedbackText`.
|
|
26
|
+
*/
|
|
27
|
+
helper?: FeedbackTextProps | FeedbackTextProps[];
|
|
28
|
+
/**
|
|
29
|
+
* InputGroup composition slots.
|
|
30
|
+
* Typically includes `InputGroup.Input` and optionally `InputGroup.Prefix` and/or `InputGroup.Suffix`.
|
|
31
|
+
*/
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Disables the entire input group.
|
|
35
|
+
* Applies disabled styles to the group and propagates the disabled state
|
|
36
|
+
* to the input and any interactive prefix/suffix elements.
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface InputGroupForwardRef {
|
|
41
|
+
root: HTMLDivElement | null;
|
|
42
|
+
}
|
|
43
|
+
export type InputGroupContextValue = {
|
|
44
|
+
/**
|
|
45
|
+
* Registers a prefix element within the InputGroup.
|
|
46
|
+
* Used internally to apply correct styling (e.g. border merging).
|
|
47
|
+
*/
|
|
48
|
+
registerPrefix: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Unregisters the prefix element when it is removed.
|
|
51
|
+
*/
|
|
52
|
+
unregisterPrefix: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Registers a suffix element within the InputGroup.
|
|
55
|
+
* Used internally to apply correct styling.
|
|
56
|
+
*/
|
|
57
|
+
registerSuffix: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Unregisters the suffix element when it is removed.
|
|
60
|
+
*/
|
|
61
|
+
unregisterSuffix: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Whether a prefix is currently present.
|
|
64
|
+
*/
|
|
65
|
+
hasPrefix: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether a suffix is currently present.
|
|
68
|
+
*/
|
|
69
|
+
hasSuffix: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Disabled state inherited from InputGroup.
|
|
72
|
+
* Consumers (Input, Prefix, Suffix) should use this to adjust
|
|
73
|
+
* behavior and styling.
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
hasExternalLabel?: boolean;
|
|
77
|
+
inputId?: string;
|
|
78
|
+
};
|
|
79
|
+
export declare const useInputGroup: () => InputGroupContextValue;
|
|
80
|
+
export declare const useOptionalInputGroup: () => InputGroupContextValue | null;
|
|
81
|
+
export declare const InputGroupBase: React.ForwardRefExoticComponent<InputGroupProps & React.RefAttributes<InputGroupForwardRef>>;
|
|
82
|
+
declare const InputGroup: typeof InputGroupBase & {
|
|
83
|
+
Prefix: typeof Prefix;
|
|
84
|
+
Suffix: typeof Suffix;
|
|
85
|
+
Input: typeof Input;
|
|
86
|
+
};
|
|
87
|
+
export default InputGroup;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as k, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import F from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import g, { forwardRef as H, useState as l, useImperativeHandle as j, useMemo as E, useContext as G, createContext as L } from "react";
|
|
4
|
+
import { FeedbackText as I } from "../feedback-text/feedback-text.es.js";
|
|
5
|
+
import { FormLabel as b } from "../form-label/form-label.es.js";
|
|
6
|
+
import { Input as B } from "./components/input/input.es.js";
|
|
7
|
+
import { Prefix as M } from "./components/prefix/prefix.es.js";
|
|
8
|
+
import { Suffix as O } from "./components/suffix/suffix.es.js";
|
|
9
|
+
import t from "./input-group.module.scss.es.js";
|
|
10
|
+
const a = L(null), U = () => {
|
|
11
|
+
const u = G(a);
|
|
12
|
+
if (!u) throw new Error("InputGroupContext missing");
|
|
13
|
+
return u;
|
|
14
|
+
}, W = () => G(a), P = H(
|
|
15
|
+
({ className: u, addons: S = !0, helper: r, label: o, children: h, disabled: s, id: y, ...v }, C) => {
|
|
16
|
+
const m = g.useRef(null), N = g.useId(), i = y ?? N, [n, c] = l(!1), [p, d] = l(!1);
|
|
17
|
+
j(C, () => ({
|
|
18
|
+
get root() {
|
|
19
|
+
return m.current;
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
const w = E(
|
|
23
|
+
() => ({
|
|
24
|
+
hasPrefix: n,
|
|
25
|
+
hasSuffix: p,
|
|
26
|
+
disabled: s,
|
|
27
|
+
hasExternalLabel: !!o,
|
|
28
|
+
inputId: i,
|
|
29
|
+
registerPrefix: () => c(!0),
|
|
30
|
+
unregisterPrefix: () => c(!1),
|
|
31
|
+
registerSuffix: () => d(!0),
|
|
32
|
+
unregisterSuffix: () => d(!1)
|
|
33
|
+
}),
|
|
34
|
+
[i, n, p, s, o]
|
|
35
|
+
), A = F(
|
|
36
|
+
t["tedi-input-group"],
|
|
37
|
+
{
|
|
38
|
+
[t["tedi-input-group--addons"]]: S,
|
|
39
|
+
[t["tedi-input-group--has-prefix"]]: n,
|
|
40
|
+
[t["tedi-input-group--has-suffix"]]: p,
|
|
41
|
+
[t["tedi-input-group--disabled"]]: s
|
|
42
|
+
},
|
|
43
|
+
u
|
|
44
|
+
), R = () => !r || Array.isArray(r) && r.length === 0 ? null : /* @__PURE__ */ e("div", { className: t["tedi-input-group__feedback-wrapper"], children: Array.isArray(r) ? r.map((_, x) => /* @__PURE__ */ e(I, { ..._, id: `group-helper-${x}` }, x)) : /* @__PURE__ */ e(I, { ...r, id: "group-helper" }) });
|
|
45
|
+
return /* @__PURE__ */ k(a.Provider, { value: w, children: [
|
|
46
|
+
o && /* @__PURE__ */ e(b, { ...v, label: o, id: i }),
|
|
47
|
+
/* @__PURE__ */ e("div", { ref: m, className: A, "data-name": "tedi-input-group", "aria-disabled": s, children: h }),
|
|
48
|
+
R()
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
P.displayName = "InputGroup";
|
|
53
|
+
const f = P;
|
|
54
|
+
f.Prefix = M;
|
|
55
|
+
f.Suffix = O;
|
|
56
|
+
f.Input = B;
|
|
57
|
+
export {
|
|
58
|
+
P as InputGroupBase,
|
|
59
|
+
U as useInputGroup,
|
|
60
|
+
W as useOptionalInputGroup
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i={"tedi-input-group":"tedi-input-group-3de08ee1","tedi-input-group__prefix":"tedi-input-group__prefix-056c2ccf","tedi-input-group__suffix":"tedi-input-group__suffix-9c330042","tedi-input-group__input":"tedi-input-group__input-5454624d","tedi-input-group__prefix--no-inner-div":"tedi-input-group__prefix--no-inner-div-4bc9b815","tedi-input-group__suffix--no-inner-div":"tedi-input-group__suffix--no-inner-div-283ea370","tedi-input-group--addons":"tedi-input-group--addons-7bd99e72","tedi-input-group--disabled":"tedi-input-group--disabled-f5db06aa","tedi-input-group--has-prefix":"tedi-input-group--has-prefix-e845fcb0","tedi-input-group--has-suffix":"tedi-input-group--has-suffix-994ab888","tedi-input-group__feedback-wrapper":"tedi-input-group__feedback-wrapper-bfbe3cb2"};exports.default=i;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const i = {
|
|
2
|
+
"tedi-input-group": "tedi-input-group-3de08ee1",
|
|
3
|
+
"tedi-input-group__prefix": "tedi-input-group__prefix-056c2ccf",
|
|
4
|
+
"tedi-input-group__suffix": "tedi-input-group__suffix-9c330042",
|
|
5
|
+
"tedi-input-group__input": "tedi-input-group__input-5454624d",
|
|
6
|
+
"tedi-input-group__prefix--no-inner-div": "tedi-input-group__prefix--no-inner-div-4bc9b815",
|
|
7
|
+
"tedi-input-group__suffix--no-inner-div": "tedi-input-group__suffix--no-inner-div-283ea370",
|
|
8
|
+
"tedi-input-group--addons": "tedi-input-group--addons-7bd99e72",
|
|
9
|
+
"tedi-input-group--disabled": "tedi-input-group--disabled-f5db06aa",
|
|
10
|
+
"tedi-input-group--has-prefix": "tedi-input-group--has-prefix-e845fcb0",
|
|
11
|
+
"tedi-input-group--has-suffix": "tedi-input-group--has-suffix-994ab888",
|
|
12
|
+
"tedi-input-group__feedback-wrapper": "tedi-input-group__feedback-wrapper-bfbe3cb2"
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
i as default
|
|
16
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("../../../../../external/classnames/index.cjs.js"),j=require("react"),v=require("../../buttons/button/button.cjs.js"),L=require("../textfield/textfield.cjs.js"),s=require("./search.module.scss.cjs.js"),N=require("../../../providers/label-provider/use-labels.cjs.js"),u=j.forwardRef(({placeholder:c,isClearable:d=!0,searchIcon:n="search",onSearch:a,onChange:o,button:e,ariaLabel:f,className:h,...t},_)=>{const{getLabel:l}=N.useLabels(),m=y=>{y.key==="Enter"&&(a==null||a(t.value))},x=()=>{a==null||a(t.value)},b={...t,ref:_,inputClassName:i.default(s.default["tedi-search__input"],e&&s.default["tedi-search__input--has-button"],h),placeholder:c,isClearable:d,onKeyDown:m,onChange:o,...e?{}:{icon:n}},p=c||l("search"),q=f??p;return r.jsxs("div",{className:i.default(s.default["tedi-search__wrapper"]),role:"search","aria-label":q,children:[r.jsx(L.TextField,{...b}),e&&r.jsx(v.Button,{...e,onClick:x,className:i.default(s.default["tedi-search__button"],e.className),"aria-label":e.children?void 0:l("search"),children:e.children??l("search")})]})});u.displayName="Search";exports.Search=u;
|
|
@@ -1,34 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as v, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import l from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { TextField as
|
|
6
|
-
import
|
|
7
|
-
import { useLabels as
|
|
8
|
-
const
|
|
9
|
-
({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
import { forwardRef as w } from "react";
|
|
4
|
+
import { Button as L } from "../../buttons/button/button.es.js";
|
|
5
|
+
import { TextField as k } from "../textfield/textfield.es.js";
|
|
6
|
+
import a from "./search.module.scss.es.js";
|
|
7
|
+
import { useLabels as C } from "../../../providers/label-provider/use-labels.es.js";
|
|
8
|
+
const b = w(
|
|
9
|
+
({
|
|
10
|
+
placeholder: t,
|
|
11
|
+
isClearable: m = !0,
|
|
12
|
+
searchIcon: o = "search",
|
|
13
|
+
onSearch: s,
|
|
14
|
+
onChange: d,
|
|
15
|
+
button: e,
|
|
16
|
+
ariaLabel: p,
|
|
17
|
+
className: n,
|
|
18
|
+
...r
|
|
19
|
+
}, f) => {
|
|
20
|
+
const { getLabel: i } = C(), h = (y) => {
|
|
21
|
+
y.key === "Enter" && (s == null || s(r.value));
|
|
22
|
+
}, _ = () => {
|
|
23
|
+
s == null || s(r.value);
|
|
24
|
+
}, u = {
|
|
25
|
+
...r,
|
|
26
|
+
ref: f,
|
|
27
|
+
inputClassName: l(a["tedi-search__input"], e && a["tedi-search__input--has-button"], n),
|
|
18
28
|
placeholder: t,
|
|
19
29
|
isClearable: m,
|
|
20
|
-
onKeyDown:
|
|
30
|
+
onKeyDown: h,
|
|
21
31
|
onChange: d,
|
|
22
32
|
...e ? {} : { icon: o }
|
|
23
|
-
},
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */ c(
|
|
33
|
+
}, N = t || i("search"), x = p ?? N;
|
|
34
|
+
return /* @__PURE__ */ v("div", { className: l(a["tedi-search__wrapper"]), role: "search", "aria-label": x, children: [
|
|
35
|
+
/* @__PURE__ */ c(k, { ...u }),
|
|
26
36
|
e && /* @__PURE__ */ c(
|
|
27
|
-
|
|
37
|
+
L,
|
|
28
38
|
{
|
|
29
39
|
...e,
|
|
30
|
-
onClick:
|
|
31
|
-
className: l(
|
|
40
|
+
onClick: _,
|
|
41
|
+
className: l(a["tedi-search__button"], e.className),
|
|
32
42
|
"aria-label": e.children ? void 0 : i("search"),
|
|
33
43
|
children: e.children ?? i("search")
|
|
34
44
|
}
|
|
@@ -36,7 +46,7 @@ const C = v(
|
|
|
36
46
|
] });
|
|
37
47
|
}
|
|
38
48
|
);
|
|
39
|
-
|
|
49
|
+
b.displayName = "Search";
|
|
40
50
|
export {
|
|
41
|
-
|
|
51
|
+
b as Search
|
|
42
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),l=require("../../../../../../external/classnames/index.cjs.js"),t=require("../select.module.scss.cjs.js"),s=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),n=e=>{const o=l.default(t.default["tedi-select__control"],
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),l=require("../../../../../../external/classnames/index.cjs.js"),t=require("../select.module.scss.cjs.js"),s=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),n=e=>{const o=l.default(t.default["tedi-select__control"],{[t.default["tedi-select__control--focused"]]:e.isFocused},e.className);return c.jsx(s.c.Control,{...e,className:o})};exports.SelectControl=n;
|
|
@@ -3,9 +3,13 @@ import c from "../../../../../../external/classnames/index.es.js";
|
|
|
3
3
|
import t from "../select.module.scss.es.js";
|
|
4
4
|
import { c as r } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
5
5
|
const i = (o) => {
|
|
6
|
-
const s = c(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const s = c(
|
|
7
|
+
t["tedi-select__control"],
|
|
8
|
+
{
|
|
9
|
+
[t["tedi-select__control--focused"]]: o.isFocused
|
|
10
|
+
},
|
|
11
|
+
o.className
|
|
12
|
+
);
|
|
9
13
|
return /* @__PURE__ */ e(r.Control, { ...o, className: s });
|
|
10
14
|
};
|
|
11
15
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),Ce=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),Oe=require("../../../../../external/react-select/dist/react-select.esm.cjs.js"),Le=require("../../../../../external/react-select/async/dist/react-select-async.esm.cjs.js"),ve=require("../feedback-text/feedback-text.cjs.js"),Ve=require("../form-label/form-label.cjs.js"),g=require("../input-group/input-group.cjs.js"),he=require("./components/select-clear-indicator.cjs.js"),xe=require("./components/select-control.cjs.js"),ye=require("./components/select-dropdown-indicator.cjs.js"),Re=require("./components/select-group.cjs.js"),je=require("./components/select-group-heading.cjs.js"),we=require("./components/select-indicators-container.cjs.js"),Ne=require("./components/select-input.cjs.js"),_e=require("./components/select-loading-indicator.cjs.js"),He=require("./components/select-menu.cjs.js"),Pe=require("./components/select-menu-list.cjs.js"),Te=require("./components/select-menu-portal.cjs.js"),De=require("./components/select-multi-value.cjs.js"),ke=require("./components/select-multi-value-remove.cjs.js"),Fe=require("./components/select-option.cjs.js"),Ee=require("./components/select-value-container.cjs.js"),s=require("./select.module.scss.cjs.js"),Ge=require("../../../providers/label-provider/use-labels.cjs.js"),j=a.forwardRef((S,w)=>{var R;const{options:N,defaultOptions:_,id:b,name:H,iconName:P="arrow_drop_down",label:T,required:M,value:D,defaultValue:k,tagsDirection:I="row",onChange:u,onInputChange:F,inputValue:E,loadOptions:G,isLoading:B,openMenuOnFocus:$=!1,openMenuOnClick:z=!0,tabSelectsValue:A=!1,disabled:q=!1,className:C,hideLabel:W=!1,helper:t,placeholder:J,invalid:K,valid:Q,size:d,async:U=!1,renderOption:X,renderMessageListFooter:O,noOptionsMessage:Y,loadingMessage:Z,multiple:p=!1,closeMenuOnSelect:ee=!p,blurInputOnSelect:L=!1,autoFocus:te=!1,isClearable:se=!0,isClearIndicatorVisible:ne=!1,isSearchable:v=!0,menuIsOpen:le,onMenuClose:oe,onMenuOpen:ae,onBlur:re,inputIsHidden:ie,isTagRemovable:V=!1,optionGroupHeadingText:ce={modifiers:"small",color:"tertiary"},cacheOptions:ue=!0,showRadioButtons:de=!1,renderWithoutLabel:pe,tooltip:me,classNames:h}=S,n=(R=g.useOptionalInputGroup)==null?void 0:R.call(g),fe=a.useId(),ge=n==null?void 0:n.hasExternalLabel,m=S.id??(n==null?void 0:n.inputId)??fe,x=t?(t==null?void 0:t.id)??`${m}-helper`:void 0,r=a.useRef(null),{getLabel:y}=Ge.useLabels();a.useImperativeHandle(w,()=>r.current);const Se=o=>{u==null||u(o),!L&&r.current&&setTimeout(()=>{var i,c;return(c=(i=r.current)==null?void 0:i.inputRef)==null?void 0:c.focus()},0)},be=a.useCallback(o=>l.jsx(Pe.SelectMenuList,{...o,renderMessageListFooter:O}),[O]),Me=()=>{const o={ClearIndicator:e=>he.SelectClearIndicator({isClearIndicatorVisible:ne,...e}),DropdownIndicator:()=>ye.SelectDropDownIndicator({iconName:P}),IndicatorSeparator:()=>null,MenuPortal:Te.SelectMenuPortal,Menu:He.SelectMenu,MenuList:be,Option:e=>Fe.SelectOption({renderOption:X,multiple:p,showRadioButtons:de,...e}),Control:e=>xe.SelectControl({...e,className:C}),Input:Ne.SelectInput,MultiValue:e=>De.SelectMultiValue({isTagRemovable:V,...e}),MultiValueRemove:ke.SelectMultiValueRemove,Group:Re.SelectGroup,GroupHeading:e=>je.SelectGroupHeading({optionGroupHeadingText:ce,...e}),IndicatorsContainer:we.SelectIndicatorsContainer,ValueContainer:Ee.SelectValueContainer,LoadingIndicator:_e.SelectLoadingIndicator},i=U?Le.default:Oe.default,c=()=>y("select.no-options"),qe=()=>y("select.loading");return l.jsx(i,{id:m,"aria-describedby":x,autoFocus:te,ref:r,instanceId:b,className:"tedi-select__wrapper",name:H,options:N,defaultOptions:_,value:D,defaultValue:k,cacheOptions:ue,onChange:Se,onInputChange:F,onBlur:re,inputValue:E,inputId:`${b}-input`,loadOptions:G,isLoading:B,noOptionsMessage:Y||c,loadingMessage:Z||qe,classNamePrefix:"select",components:o,isDisabled:q,isSearchable:v,menuIsOpen:le,openMenuOnFocus:$,openMenuOnClick:z,tabSelectsValue:A,onMenuClose:oe,onMenuOpen:ae,placeholder:J||"",isClearable:se,backspaceRemovesValue:V,menuShouldScrollIntoView:!0,isMulti:p,hideSelectedOptions:!1,closeMenuOnSelect:ee,blurInputOnSelect:L,menuPlacement:"auto",inputIsHidden:ie,required:M,menuPortalTarget:document.body,menuPosition:"absolute",classNames:h?Object.fromEntries(Object.entries(h).map(([e,f])=>[e,typeof f=="string"?()=>f:f])):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"})}})},Ie=Ce.default(s.default["tedi-select"],C,{[s.default["tedi-select--invalid"]]:K||(t==null?void 0:t.type)==="error"},{[s.default["tedi-select--valid"]]:Q||(t==null?void 0:t.type)==="valid"},{[s.default[`tedi-select--${d}`]]:d},{[s.default[`tedi-select--tags-${I}`]]:I},{[s.default["tedi-select--searchable"]]:v},{[s.default["tedi-select--disabled"]]:q});return l.jsxs("div",{"data-name":"select",className:Ie,children:[l.jsxs("div",{className:s.default["tedi-select__inner"],children:[!ge&&l.jsx(Ve.FormLabel,{id:`${m}-input`,label:T,required:M,hideLabel:W,size:d,renderWithoutLabel:pe,tooltip:me}),Me()]}),t&&l.jsx(ve.FeedbackText,{...t,id:x})]})});j.displayName="Select";exports.Select=j;
|
|
@@ -8,8 +8,9 @@ declare module 'react-select/dist/declarations/src/Select' {
|
|
|
8
8
|
inputIsHidden?: boolean;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export interface SelectProps extends FormLabelProps {
|
|
12
|
-
id
|
|
11
|
+
export interface SelectProps extends Omit<FormLabelProps, 'id' | 'label'> {
|
|
12
|
+
id?: string;
|
|
13
|
+
label?: string;
|
|
13
14
|
options?: OptionsOrGroups<ISelectOption, IGroupedOptions<ISelectOption>>;
|
|
14
15
|
defaultOptions?: OptionsOrGroups<ISelectOption, IGroupedOptions<ISelectOption>> | boolean;
|
|
15
16
|
placeholder?: string;
|