@tedi-design-system/react 18.0.0-rc.18 → 18.0.0-rc.19
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/select/components/select-multi-option.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-multi-option.es.js +43 -51
- package/src/tedi/components/form/select/components/select-single-option.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-single-option.es.js +21 -27
- package/src/tedi/components/form/select/select.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/select/select.module.scss.es.js +0 -1
- package/src/tedi/components/form/textfield/textfield.d.ts +14 -0
- package/src/tedi/components/misc/option-content/option-content.cjs.js +1 -0
- package/src/tedi/components/misc/option-content/option-content.d.ts +71 -0
- package/src/tedi/components/misc/option-content/option-content.es.js +92 -0
- package/src/tedi/components/misc/option-content/option-content.module.scss.cjs.js +1 -0
- package/src/tedi/components/misc/option-content/option-content.module.scss.es.js +21 -0
- package/src/tedi/components/overlays/dropdown/dropdown-item/dropdown-item.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown-item/dropdown-item.d.ts +9 -2
- package/src/tedi/components/overlays/dropdown/dropdown-item/dropdown-item.es.js +42 -39
- package/src/tedi/components/overlays/dropdown/dropdown.d.ts +1 -1
- package/src/tedi/index.d.ts +1 -0
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +255 -251
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),I=require("../../../../../../external/classnames/index.cjs.js"),E=require("../../../misc/option-content/option-content.cjs.js"),a=require("../select.module.scss.cjs.js"),t=require("./select-bulk-helpers.cjs.js"),O=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),g=({renderOption:f,...e})=>{var L;const o=e.data.value===t.SELECT_ALL_VALUE,u=t.isGroupSentinel(e.data),S=!!((L=e.data.customData)!=null&&L.__tediInGroup);let c=e.isSelected,r=!1;if(o){const i=t.getEnabledOptions(e.options).filter(n=>n.value!==t.SELECT_ALL_VALUE),l=(e.getValue()??[]).filter(n=>n.value!==t.SELECT_ALL_VALUE);c=t.areAllSelected(l,i),r=t.isIndeterminate(l,i)}else if(u){const i=e.options,b=i.findIndex(d=>d.value===e.data.value),l=[];for(let d=b+1;d<i.length;d++){const s=i[d];if(!s||typeof s.value=="string"&&(s.value.startsWith(t.GROUP_OPTION_PREFIX)||s.value===t.SELECT_ALL_VALUE))break;s.isDisabled||l.push(s)}const n=e.getValue()??[];c=t.areAllSelected(n,l),r=t.isIndeterminate(n,l)}const m=I.default(a.default["tedi-select__option"],{[a.default["tedi-select__option--disabled"]]:e.isDisabled},{[a.default["tedi-select__option--focused"]]:e.isFocused},{[a.default["tedi-select__option--select-all"]]:o},{[a.default["tedi-select__option--group"]]:u},{[a.default["tedi-select__option--indented"]]:S}),{tabIndex:A,...x}=e.innerProps;return _.jsx(O.c.Option,{...e,innerProps:{...x,tabIndex:A,role:"option","aria-selected":c},className:m,children:f&&!o&&!u?f(e):_.jsx(E.OptionContent,{type:"checkbox",indicatorSemantics:"control",selected:c,indeterminate:r,disabled:e.isDisabled,children:_.jsx(E.OptionContent.Label,{children:e.children})})})};exports.SelectMultiOption=g;
|
|
@@ -1,63 +1,55 @@
|
|
|
1
|
-
import { jsx as m
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { SELECT_ALL_VALUE as
|
|
6
|
-
import { c as
|
|
7
|
-
const
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
let
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
} else if (
|
|
15
|
-
const
|
|
16
|
-
for (let
|
|
17
|
-
const n =
|
|
18
|
-
if (!n || typeof n.value == "string" && (n.value.startsWith(
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import E from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { OptionContent as h } from "../../../misc/option-content/option-content.es.js";
|
|
4
|
+
import s from "../select.module.scss.es.js";
|
|
5
|
+
import { SELECT_ALL_VALUE as c, isGroupSentinel as P, getEnabledOptions as y, areAllSelected as I, isIndeterminate as v, GROUP_OPTION_PREFIX as G } from "./select-bulk-helpers.es.js";
|
|
6
|
+
import { c as L } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
7
|
+
const V = ({ renderOption: f, ...e }) => {
|
|
8
|
+
var _;
|
|
9
|
+
const d = e.data.value === c, r = P(e.data), S = !!((_ = e.data.customData) != null && _.__tediInGroup);
|
|
10
|
+
let a = e.isSelected, u = !1;
|
|
11
|
+
if (d) {
|
|
12
|
+
const t = y(e.options).filter((l) => l.value !== c), i = (e.getValue() ?? []).filter((l) => l.value !== c);
|
|
13
|
+
a = I(i, t), u = v(i, t);
|
|
14
|
+
} else if (r) {
|
|
15
|
+
const t = e.options, b = t.findIndex((o) => o.value === e.data.value), i = [];
|
|
16
|
+
for (let o = b + 1; o < t.length; o++) {
|
|
17
|
+
const n = t[o];
|
|
18
|
+
if (!n || typeof n.value == "string" && (n.value.startsWith(G) || n.value === c))
|
|
19
19
|
break;
|
|
20
20
|
n.isDisabled || i.push(n);
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const l = e.getValue() ?? [];
|
|
23
|
+
a = I(l, i), u = v(l, i);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
{ [
|
|
28
|
-
{ [
|
|
29
|
-
{ [
|
|
30
|
-
{ [
|
|
31
|
-
{ [
|
|
32
|
-
), { tabIndex:
|
|
25
|
+
const g = E(
|
|
26
|
+
s["tedi-select__option"],
|
|
27
|
+
{ [s["tedi-select__option--disabled"]]: e.isDisabled },
|
|
28
|
+
{ [s["tedi-select__option--focused"]]: e.isFocused },
|
|
29
|
+
{ [s["tedi-select__option--select-all"]]: d },
|
|
30
|
+
{ [s["tedi-select__option--group"]]: r },
|
|
31
|
+
{ [s["tedi-select__option--indented"]]: S }
|
|
32
|
+
), { tabIndex: O, ...x } = e.innerProps;
|
|
33
33
|
return /* @__PURE__ */ m(
|
|
34
|
-
|
|
34
|
+
L.Option,
|
|
35
35
|
{
|
|
36
36
|
...e,
|
|
37
|
-
innerProps: { ...
|
|
38
|
-
className:
|
|
39
|
-
children:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
checked: d,
|
|
51
|
-
indeterminate: r,
|
|
52
|
-
onChange: () => null,
|
|
53
|
-
disabled: e.isDisabled,
|
|
54
|
-
hover: e.isFocused
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
] })
|
|
37
|
+
innerProps: { ...x, tabIndex: O, role: "option", "aria-selected": a },
|
|
38
|
+
className: g,
|
|
39
|
+
children: f && !d && !r ? f(e) : /* @__PURE__ */ m(
|
|
40
|
+
h,
|
|
41
|
+
{
|
|
42
|
+
type: "checkbox",
|
|
43
|
+
indicatorSemantics: "control",
|
|
44
|
+
selected: a,
|
|
45
|
+
indeterminate: u,
|
|
46
|
+
disabled: e.isDisabled,
|
|
47
|
+
children: /* @__PURE__ */ m(h.Label, { children: e.children })
|
|
48
|
+
}
|
|
49
|
+
)
|
|
58
50
|
}
|
|
59
51
|
);
|
|
60
52
|
};
|
|
61
53
|
export {
|
|
62
|
-
|
|
54
|
+
V as SelectMultiOption
|
|
63
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),s=require("../../../../../../external/classnames/index.cjs.js"),d=require("../../../misc/option-content/option-content.cjs.js"),t=require("../select.module.scss.cjs.js"),o=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),a=({showRadioButtons:n,renderOption:l,...e})=>{const c=s.default(t.default["tedi-select__option"],{[t.default["tedi-select__option--disabled"]]:e.isDisabled},{[t.default["tedi-select__option--selected"]]:e.isSelected&&!n},{[t.default["tedi-select__option--focused"]]:e.isFocused});return i.jsx(o.c.Option,{...e,innerProps:{role:"option","aria-selected":e.isSelected,"aria-disabled":e.isDisabled,...e.innerProps},className:c,children:n?i.jsx(d.OptionContent,{type:"radio",indicatorSemantics:"control",selected:e.isSelected,disabled:e.isDisabled,children:i.jsx(d.OptionContent.Label,{children:e.children})}):l?l(e):e.children})};exports.SelectSingleOption=a;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import o from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { OptionContent as d } from "../../../misc/option-content/option-content.es.js";
|
|
4
4
|
import i from "../select.module.scss.es.js";
|
|
5
|
-
import { c as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
import { c as s } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
6
|
+
const f = ({ showRadioButtons: l, renderOption: c, ...e }) => {
|
|
7
|
+
const n = o(
|
|
8
8
|
i["tedi-select__option"],
|
|
9
9
|
{ [i["tedi-select__option--disabled"]]: e.isDisabled },
|
|
10
|
-
{ [i["tedi-select__option--selected"]]: e.isSelected && !
|
|
10
|
+
{ [i["tedi-select__option--selected"]]: e.isSelected && !l },
|
|
11
11
|
{ [i["tedi-select__option--focused"]]: e.isFocused }
|
|
12
12
|
);
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
13
|
+
return /* @__PURE__ */ t(
|
|
14
|
+
s.Option,
|
|
15
15
|
{
|
|
16
16
|
...e,
|
|
17
17
|
innerProps: {
|
|
@@ -20,26 +20,20 @@ const h = ({ showRadioButtons: a, renderOption: t, ...e }) => {
|
|
|
20
20
|
"aria-disabled": e.isDisabled,
|
|
21
21
|
...e.innerProps
|
|
22
22
|
},
|
|
23
|
-
className:
|
|
24
|
-
children:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
checked: e.isSelected,
|
|
35
|
-
disabled: e.isDisabled,
|
|
36
|
-
onChange: () => null
|
|
37
|
-
}
|
|
38
|
-
)
|
|
39
|
-
] }) : t ? t(e) : e.children
|
|
23
|
+
className: n,
|
|
24
|
+
children: l ? /* @__PURE__ */ t(
|
|
25
|
+
d,
|
|
26
|
+
{
|
|
27
|
+
type: "radio",
|
|
28
|
+
indicatorSemantics: "control",
|
|
29
|
+
selected: e.isSelected,
|
|
30
|
+
disabled: e.isDisabled,
|
|
31
|
+
children: /* @__PURE__ */ t(d.Label, { children: e.children })
|
|
32
|
+
}
|
|
33
|
+
) : c ? c(e) : e.children
|
|
40
34
|
}
|
|
41
35
|
);
|
|
42
36
|
};
|
|
43
37
|
export {
|
|
44
|
-
|
|
38
|
+
f as SelectSingleOption
|
|
45
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-select__control":"tedi-select__control-dbce8bb7","tedi-select__value-container":"tedi-select__value-container-253d079a","tedi-select__indicators-container":"tedi-select__indicators-container-0fc8fa2a","tedi-select__input":"tedi-select__input-5525b622","tedi-select":"tedi-select-8b014852","tedi-select--disabled":"tedi-select--disabled-2d4b8ddd","tedi-select--invalid":"tedi-select--invalid-3901c89c","tedi-select--valid":"tedi-select--valid-969c0297","tedi-select__control--focused":"tedi-select__control--focused-0e632efe","tedi-select__arrow":"tedi-select__arrow-94b5ef4a","tedi-select__loading-indicator":"tedi-select__loading-indicator-a35a63ca","tedi-select__dropdown-indicator":"tedi-select__dropdown-indicator-5a948baa","tedi-select__clear-indicator":"tedi-select__clear-indicator-68b60b12","tedi-select__menu-portal":"tedi-select__menu-portal-d5349f37","tedi-select__menu":"tedi-select__menu-bf54b75b","tedi-select__menu-list--grid":"tedi-select__menu-list--grid-393f3232","tedi-select__menu-list":"tedi-select__menu-list-0aa06e24","tedi-select__menu-list-inner":"tedi-select__menu-list-inner-471e5cf8","tedi-select__menu-list-footer":"tedi-select__menu-list-footer-eb1d3bbc","tedi-select__option":"tedi-select__option-6f811381","tedi-select__option--disabled":"tedi-select__option--disabled-d3aff112","tedi-select__option--focused":"tedi-select__option--focused-1d972ff1","tedi-select__option--selected":"tedi-select__option--selected-a93e5fb0","tedi-select--small":"tedi-select--small-2659608b","tedi-select__multi-value-item":"tedi-select__multi-value-item-b8ec59ae","tedi-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-select__control":"tedi-select__control-dbce8bb7","tedi-select__value-container":"tedi-select__value-container-253d079a","tedi-select__indicators-container":"tedi-select__indicators-container-0fc8fa2a","tedi-select__input":"tedi-select__input-5525b622","tedi-select":"tedi-select-8b014852","tedi-select--disabled":"tedi-select--disabled-2d4b8ddd","tedi-select--invalid":"tedi-select--invalid-3901c89c","tedi-select--valid":"tedi-select--valid-969c0297","tedi-select__control--focused":"tedi-select__control--focused-0e632efe","tedi-select__arrow":"tedi-select__arrow-94b5ef4a","tedi-select__loading-indicator":"tedi-select__loading-indicator-a35a63ca","tedi-select__dropdown-indicator":"tedi-select__dropdown-indicator-5a948baa","tedi-select__clear-indicator":"tedi-select__clear-indicator-68b60b12","tedi-select__menu-portal":"tedi-select__menu-portal-d5349f37","tedi-select__menu":"tedi-select__menu-bf54b75b","tedi-select__menu-list--grid":"tedi-select__menu-list--grid-393f3232","tedi-select__menu-list":"tedi-select__menu-list-0aa06e24","tedi-select__menu-list-inner":"tedi-select__menu-list-inner-471e5cf8","tedi-select__menu-list-footer":"tedi-select__menu-list-footer-eb1d3bbc","tedi-select__option":"tedi-select__option-6f811381","tedi-select__option--disabled":"tedi-select__option--disabled-d3aff112","tedi-select__option--focused":"tedi-select__option--focused-1d972ff1","tedi-select__option--selected":"tedi-select__option--selected-a93e5fb0","tedi-select--small":"tedi-select--small-2659608b","tedi-select__multi-value-item":"tedi-select__multi-value-item-b8ec59ae","tedi-select__group":"tedi-select__group-b275e954","tedi-select__group-heading":"tedi-select__group-heading-02b3d9bc","tedi-select__group-heading--selectable":"tedi-select__group-heading--selectable-c84cd617","tedi-select__option--indented":"tedi-select__option--indented-bf4a1661","tedi-select__multi-value-clear":"tedi-select__multi-value-clear-d231f7de","tedi-select--tags-row":"tedi-select--tags-row-c9f33e4b","tedi-select__overflow-tag":"tedi-select__overflow-tag-c0391df2","tedi-select__menu-list--keyboard":"tedi-select__menu-list--keyboard-3d066942","tedi-select__select-all":"tedi-select__select-all-12c3e7f1","tedi-select__group-heading-toggle":"tedi-select__group-heading-toggle-34296a63","tedi-select--tags-stack":"tedi-select--tags-stack-ddb929a9","tedi-select__separator":"tedi-select__separator-b1045f3f","tedi-select--searchable":"tedi-select--searchable-d56eb325"};exports.default=e;
|
|
@@ -24,7 +24,6 @@ const e = {
|
|
|
24
24
|
"tedi-select__option--selected": "tedi-select__option--selected-a93e5fb0",
|
|
25
25
|
"tedi-select--small": "tedi-select--small-2659608b",
|
|
26
26
|
"tedi-select__multi-value-item": "tedi-select__multi-value-item-b8ec59ae",
|
|
27
|
-
"tedi-select__checkbox": "tedi-select__checkbox-e4f94b67",
|
|
28
27
|
"tedi-select__group": "tedi-select__group-b275e954",
|
|
29
28
|
"tedi-select__group-heading": "tedi-select__group-heading-02b3d9bc",
|
|
30
29
|
"tedi-select__group-heading--selectable": "tedi-select__group-heading--selectable-c84cd617",
|
|
@@ -65,6 +65,11 @@ export interface TextFieldProps extends BreakpointSupport<TextFieldBreakpointPro
|
|
|
65
65
|
* Also used to generate `aria-describedby` and helper IDs automatically.
|
|
66
66
|
*/
|
|
67
67
|
id?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The text or React node that serves as the label for the text field.
|
|
70
|
+
* If `hideLabel` is `true`, the label will be visually hidden but still accessible to screen readers.
|
|
71
|
+
* If `hideLabel` is `'keep-space'`, the label will be hidden but the space it occupies will be preserved.
|
|
72
|
+
*/
|
|
68
73
|
label?: React.ReactNode;
|
|
69
74
|
/**
|
|
70
75
|
* Name attribute for the underlying input/textarea element.
|
|
@@ -104,7 +109,13 @@ export interface TextFieldProps extends BreakpointSupport<TextFieldBreakpointPro
|
|
|
104
109
|
* Note: These are **not** attached to the input/textarea directly, but to the surrounding container.
|
|
105
110
|
*/
|
|
106
111
|
onKeyPress?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
112
|
+
/**
|
|
113
|
+
* Key-down handler attached to the field's surrounding container (not the input directly).
|
|
114
|
+
*/
|
|
107
115
|
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
116
|
+
/**
|
|
117
|
+
* Key-up handler attached to the field's surrounding container (not the input directly).
|
|
118
|
+
*/
|
|
108
119
|
onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
109
120
|
/**
|
|
110
121
|
* Default value for **uncontrolled** usage.
|
|
@@ -209,6 +220,9 @@ export interface TextFieldProps extends BreakpointSupport<TextFieldBreakpointPro
|
|
|
209
220
|
* Additional attributes for the input element.
|
|
210
221
|
*/
|
|
211
222
|
input?: React.InputHTMLAttributes<HTMLInputElement> | React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
223
|
+
/**
|
|
224
|
+
* Optional start slot element to render inside the input container, before the input field.
|
|
225
|
+
*/
|
|
212
226
|
startSlot?: React.ReactNode;
|
|
213
227
|
/**
|
|
214
228
|
* Optional end slot element to render inside the input container, after the input field.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),l=require("../../../../../external/classnames/index.cjs.js"),o=require("react"),f=require("../../base/icon/icon.cjs.js"),e=require("./option-content.module.scss.cjs.js"),s=o.forwardRef(({children:t,className:n,id:i},c)=>a.jsx("span",{ref:c,id:i,className:l.default(e.default["tedi-option-content__label"],n),children:t}));s.displayName="OptionContentLabel";const _=o.forwardRef(({children:t,className:n},i)=>a.jsx("span",{ref:i,className:l.default(e.default["tedi-option-content__meta"],n),children:t}));_.displayName="OptionContentMeta";const M=(t,n)=>{const i=typeof t=="string"?{name:t}:t;return a.jsx(f.Icon,{size:18,...i,className:l.default(n,i.className)})},k=o.forwardRef(({children:t,type:n="default",layout:i="horizontal",selected:c=!1,indeterminate:r=!1,disabled:u=!1,icon:m,indicatorSemantics:N="presentation",className:j},O)=>{const b=o.useId(),p=N==="control",x=p&&n!=="default"&&o.Children.toArray(t).some(d=>o.isValidElement(d)&&d.type===s),h=x?b:void 0,v=p?{role:"checkbox","aria-checked":r?"mixed":c,"aria-disabled":u||void 0,"aria-labelledby":h}:{"aria-hidden":!0},y=p?{role:"radio","aria-checked":c,"aria-disabled":u||void 0,"aria-labelledby":h}:{"aria-hidden":!0},I=x?o.Children.map(t,d=>o.isValidElement(d)&&d.type===s?o.cloneElement(d,{id:b}):d):t;return a.jsxs("div",{ref:O,className:l.default(e.default["tedi-option-content"],e.default[`tedi-option-content--${i}`],{[e.default["tedi-option-content--checkbox"]]:n==="checkbox",[e.default["tedi-option-content--radio"]]:n==="radio",[e.default["tedi-option-content--disabled"]]:u},j),children:[n==="checkbox"&&a.jsx("span",{...v,className:l.default(e.default["tedi-option-content__indicator"],e.default["tedi-option-content__checkbox"],{[e.default["tedi-option-content__checkbox--checked"]]:c||r}),children:r?a.jsx(f.Icon,{name:"remove",size:16,className:e.default["tedi-option-content__check-icon"]}):c?a.jsx(f.Icon,{name:"check",size:16,className:e.default["tedi-option-content__check-icon"]}):null}),n==="radio"&&a.jsx("span",{...y,className:l.default(e.default["tedi-option-content__indicator"],e.default["tedi-option-content__radio"],{[e.default["tedi-option-content__radio--checked"]]:c})}),m&&M(m,e.default["tedi-option-content__icon"]),a.jsx("div",{className:e.default["tedi-option-content__content"],children:I})]})});k.displayName="OptionContent";const C=Object.assign(k,{Label:s,Meta:_});exports.OptionContent=C;exports.OptionContentLabel=s;exports.OptionContentMeta=_;exports.default=C;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IconProps } from '../../base/icon/icon';
|
|
2
|
+
export type OptionContentType = 'default' | 'checkbox' | 'radio';
|
|
3
|
+
export type OptionContentLayout = 'horizontal' | 'vertical';
|
|
4
|
+
export interface OptionContentSlotProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** Additional class name. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** @internal id wired up by `OptionContent` to link the indicator's `aria-labelledby`. */
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const OptionContentLabel: import('react').ForwardRefExoticComponent<OptionContentSlotProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
12
|
+
export declare const OptionContentMeta: import('react').ForwardRefExoticComponent<OptionContentSlotProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
13
|
+
export interface OptionContentProps {
|
|
14
|
+
/**
|
|
15
|
+
* Content of the value row — typically `OptionContent.Label` and
|
|
16
|
+
* optionally `OptionContent.Meta`, but any node is allowed.
|
|
17
|
+
*/
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Selection-indicator type:
|
|
21
|
+
* - `default` — no indicator
|
|
22
|
+
* - `checkbox` — checkbox indicator (multi-select)
|
|
23
|
+
* - `radio` — radio indicator (single-select listbox)
|
|
24
|
+
* @default default
|
|
25
|
+
*/
|
|
26
|
+
type?: OptionContentType;
|
|
27
|
+
/**
|
|
28
|
+
* Arrange the label and meta side-by-side (`horizontal`) or stacked
|
|
29
|
+
* (`vertical`, e.g. a title with a description below).
|
|
30
|
+
* @default horizontal
|
|
31
|
+
*/
|
|
32
|
+
layout?: OptionContentLayout;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the indicator renders as selected (checked).
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the checkbox indicator renders as indeterminate. Ignored for other types.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
indeterminate?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the row renders as disabled (dims the indicator and text).
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Leading icon, rendered before the content. Accepts an icon name or full `IconProps`.
|
|
50
|
+
*/
|
|
51
|
+
icon?: string | IconProps;
|
|
52
|
+
/**
|
|
53
|
+
* How the selection indicator is exposed to assistive tech:
|
|
54
|
+
* - `presentation` (default) — the indicator is `aria-hidden`; the interactive
|
|
55
|
+
* parent owns selection (menu pattern: `aria-checked` on the `DropdownItem`).
|
|
56
|
+
* - `control` — the indicator itself carries `role="checkbox"`/`"radio"`,
|
|
57
|
+
* `aria-checked` and is named via `aria-labelledby` from `OptionContent.Label`
|
|
58
|
+
* (listbox pattern, e.g. inside a `Select` option). Requires a `Label` child.
|
|
59
|
+
* @default presentation
|
|
60
|
+
*/
|
|
61
|
+
indicatorSemantics?: 'presentation' | 'control';
|
|
62
|
+
/**
|
|
63
|
+
* Additional class name.
|
|
64
|
+
*/
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const OptionContent: import('react').ForwardRefExoticComponent<OptionContentProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
68
|
+
Label: import('react').ForwardRefExoticComponent<OptionContentSlotProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
69
|
+
Meta: import('react').ForwardRefExoticComponent<OptionContentSlotProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
70
|
+
};
|
|
71
|
+
export default OptionContent;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as a, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import s from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { forwardRef as _, useId as A, Children as N, isValidElement as x, cloneElement as M } from "react";
|
|
4
|
+
import { Icon as m } from "../../base/icon/icon.es.js";
|
|
5
|
+
import o from "./option-content.module.scss.es.js";
|
|
6
|
+
const r = _(
|
|
7
|
+
({ children: t, className: n, id: e }, i) => /* @__PURE__ */ a("span", { ref: i, id: e, className: s(o["tedi-option-content__label"], n), children: t })
|
|
8
|
+
);
|
|
9
|
+
r.displayName = "OptionContentLabel";
|
|
10
|
+
const u = _(({ children: t, className: n }, e) => /* @__PURE__ */ a("span", { ref: e, className: s(o["tedi-option-content__meta"], n), children: t }));
|
|
11
|
+
u.displayName = "OptionContentMeta";
|
|
12
|
+
const g = (t, n) => {
|
|
13
|
+
const e = typeof t == "string" ? { name: t } : t;
|
|
14
|
+
return /* @__PURE__ */ a(m, { size: 18, ...e, className: s(n, e.className) });
|
|
15
|
+
}, C = _(
|
|
16
|
+
({
|
|
17
|
+
children: t,
|
|
18
|
+
type: n = "default",
|
|
19
|
+
layout: e = "horizontal",
|
|
20
|
+
selected: i = !1,
|
|
21
|
+
indeterminate: d = !1,
|
|
22
|
+
disabled: l = !1,
|
|
23
|
+
icon: b,
|
|
24
|
+
indicatorSemantics: O = "presentation",
|
|
25
|
+
className: y
|
|
26
|
+
}, v) => {
|
|
27
|
+
const h = A(), p = O === "control", f = p && n !== "default" && N.toArray(t).some((c) => x(c) && c.type === r), k = f ? h : void 0, I = p ? {
|
|
28
|
+
role: "checkbox",
|
|
29
|
+
"aria-checked": d ? "mixed" : i,
|
|
30
|
+
"aria-disabled": l || void 0,
|
|
31
|
+
"aria-labelledby": k
|
|
32
|
+
} : { "aria-hidden": !0 }, z = p ? {
|
|
33
|
+
role: "radio",
|
|
34
|
+
"aria-checked": i,
|
|
35
|
+
"aria-disabled": l || void 0,
|
|
36
|
+
"aria-labelledby": k
|
|
37
|
+
} : { "aria-hidden": !0 }, L = f ? N.map(
|
|
38
|
+
t,
|
|
39
|
+
(c) => x(c) && c.type === r ? M(c, { id: h }) : c
|
|
40
|
+
) : t;
|
|
41
|
+
return /* @__PURE__ */ j(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
ref: v,
|
|
45
|
+
className: s(
|
|
46
|
+
o["tedi-option-content"],
|
|
47
|
+
o[`tedi-option-content--${e}`],
|
|
48
|
+
{
|
|
49
|
+
[o["tedi-option-content--checkbox"]]: n === "checkbox",
|
|
50
|
+
[o["tedi-option-content--radio"]]: n === "radio",
|
|
51
|
+
[o["tedi-option-content--disabled"]]: l
|
|
52
|
+
},
|
|
53
|
+
y
|
|
54
|
+
),
|
|
55
|
+
children: [
|
|
56
|
+
n === "checkbox" && /* @__PURE__ */ a(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
...I,
|
|
60
|
+
className: s(o["tedi-option-content__indicator"], o["tedi-option-content__checkbox"], {
|
|
61
|
+
[o["tedi-option-content__checkbox--checked"]]: i || d
|
|
62
|
+
}),
|
|
63
|
+
children: d ? /* @__PURE__ */ a(m, { name: "remove", size: 16, className: o["tedi-option-content__check-icon"] }) : i ? /* @__PURE__ */ a(m, { name: "check", size: 16, className: o["tedi-option-content__check-icon"] }) : null
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
n === "radio" && /* @__PURE__ */ a(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
...z,
|
|
70
|
+
className: s(o["tedi-option-content__indicator"], o["tedi-option-content__radio"], {
|
|
71
|
+
[o["tedi-option-content__radio--checked"]]: i
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
b && g(b, o["tedi-option-content__icon"]),
|
|
76
|
+
/* @__PURE__ */ a("div", { className: o["tedi-option-content__content"], children: L })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
C.displayName = "OptionContent";
|
|
83
|
+
const $ = Object.assign(C, {
|
|
84
|
+
Label: r,
|
|
85
|
+
Meta: u
|
|
86
|
+
});
|
|
87
|
+
export {
|
|
88
|
+
$ as OptionContent,
|
|
89
|
+
r as OptionContentLabel,
|
|
90
|
+
u as OptionContentMeta,
|
|
91
|
+
$ as default
|
|
92
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-option-content":"tedi-option-content-a433cd53","tedi-option-content--radio":"tedi-option-content--radio-63324c27","tedi-option-content--vertical":"tedi-option-content--vertical-f90f3336","tedi-option-content--checkbox":"tedi-option-content--checkbox-6d08b76f","tedi-option-content__indicator":"tedi-option-content__indicator-cbae42a3","tedi-option-content__icon":"tedi-option-content__icon-919cf745","tedi-option-content--disabled":"tedi-option-content--disabled-947cc3ca","tedi-option-content__label":"tedi-option-content__label-db712a00","tedi-option-content__meta":"tedi-option-content__meta-22706c1d","tedi-option-content__checkbox":"tedi-option-content__checkbox-114cba52","tedi-option-content__checkbox--checked":"tedi-option-content__checkbox--checked-dc7bff22","tedi-option-content__check-icon":"tedi-option-content__check-icon-2c8a9173","tedi-option-content__radio":"tedi-option-content__radio-05184514","tedi-option-content__radio--checked":"tedi-option-content__radio--checked-1980c552","tedi-option-content__content":"tedi-option-content__content-202040f6","tedi-option-content--horizontal":"tedi-option-content--horizontal-292043e8"};exports.default=t;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"tedi-option-content": "tedi-option-content-a433cd53",
|
|
3
|
+
"tedi-option-content--radio": "tedi-option-content--radio-63324c27",
|
|
4
|
+
"tedi-option-content--vertical": "tedi-option-content--vertical-f90f3336",
|
|
5
|
+
"tedi-option-content--checkbox": "tedi-option-content--checkbox-6d08b76f",
|
|
6
|
+
"tedi-option-content__indicator": "tedi-option-content__indicator-cbae42a3",
|
|
7
|
+
"tedi-option-content__icon": "tedi-option-content__icon-919cf745",
|
|
8
|
+
"tedi-option-content--disabled": "tedi-option-content--disabled-947cc3ca",
|
|
9
|
+
"tedi-option-content__label": "tedi-option-content__label-db712a00",
|
|
10
|
+
"tedi-option-content__meta": "tedi-option-content__meta-22706c1d",
|
|
11
|
+
"tedi-option-content__checkbox": "tedi-option-content__checkbox-114cba52",
|
|
12
|
+
"tedi-option-content__checkbox--checked": "tedi-option-content__checkbox--checked-dc7bff22",
|
|
13
|
+
"tedi-option-content__check-icon": "tedi-option-content__check-icon-2c8a9173",
|
|
14
|
+
"tedi-option-content__radio": "tedi-option-content__radio-05184514",
|
|
15
|
+
"tedi-option-content__radio--checked": "tedi-option-content__radio--checked-1980c552",
|
|
16
|
+
"tedi-option-content__content": "tedi-option-content__content-202040f6",
|
|
17
|
+
"tedi-option-content--horizontal": "tedi-option-content--horizontal-292043e8"
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
t as default
|
|
21
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),K=require("../../../../../../external/classnames/index.cjs.js"),R=require("../dropdown-context.cjs.js"),r=require("./dropdown-item.module.scss.cjs.js"),S=({children:c,onClick:t,disabled:n,active:w,index:u,indent:i,asChild:o=!1,closeOnSelect:p=!0,isParent:y=!1,className:_,role:s,...l})=>{const{getItemProps:v,listItemsRef:b,setOpen:f,activeIndex:x,divided:I,variant:a}=R.useDropdownContext(),g=o?"div":"button",q=e=>typeof e!="number"||e<=0?{}:{"--dropdown-indent-level":e,"--dropdown-indent":`${e}rem`},D=e=>{if(n)return;const d=e.currentTarget.querySelector('input[type="checkbox"], input[type="radio"]');if(d){d.click();return}o?t==null||t(e):(t==null||t(e),p&&f(!1))},P=e=>{if(!n&&(e.key==="Enter"||e.key===" ")){e.preventDefault();const d=e.currentTarget.querySelector('input[type="checkbox"], input[type="radio"]');d?d.click():t==null||t(e),!o&&p&&f(!1)}},m={ref(e){typeof u=="number"&&(b.current[u]=e)},tabIndex:x===u?0:-1,className:K.default(r.default["tedi-dropdown__item"],{[r.default["tedi-dropdown__item--active"]]:w,[r.default["tedi-dropdown__item--disabled"]]:n,[r.default["tedi-dropdown__item--divided"]]:I,[r.default["tedi-dropdown__item--indent"]]:i,[r.default["tedi-dropdown__item--tree-item"]]:a==="tree"&&i,[r.default["tedi-dropdown__item--tree-parent"]]:a==="tree"&&y},_),style:q(i),onClick:D,onKeyDown:P,...l},j=o&&p===!1?{...m,role:s}:v({role:s??"menuitem",disabled:o?void 0:n,...m});return T.jsx(g,{...j,children:c})};exports.DropdownItem=S;
|
|
@@ -63,5 +63,12 @@ export type DropdownItemProps = {
|
|
|
63
63
|
*/
|
|
64
64
|
isParent?: boolean;
|
|
65
65
|
className?: string;
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* ARIA role for the item. Defaults to `menuitem`; override to convey selection
|
|
68
|
+
* semantics (e.g. `menuitemcheckbox` / `menuitemradio` / `option`) and pair it
|
|
69
|
+
* with the matching `aria-checked` / `aria-selected`.
|
|
70
|
+
* @default menuitem
|
|
71
|
+
*/
|
|
72
|
+
role?: React.AriaRole;
|
|
73
|
+
} & React.AriaAttributes;
|
|
74
|
+
export declare const DropdownItem: ({ children, onClick, disabled, active, index, indent, asChild, closeOnSelect, isParent, className, role, ...aria }: DropdownItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,67 +1,70 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useDropdownContext as
|
|
1
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import j from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useDropdownContext as E } from "../dropdown-context.es.js";
|
|
4
4
|
import r from "./dropdown-item.module.scss.es.js";
|
|
5
|
-
const
|
|
6
|
-
children:
|
|
5
|
+
const l = ({
|
|
6
|
+
children: y,
|
|
7
7
|
onClick: t,
|
|
8
|
-
disabled:
|
|
9
|
-
active:
|
|
8
|
+
disabled: n,
|
|
9
|
+
active: _,
|
|
10
10
|
index: d,
|
|
11
11
|
indent: i,
|
|
12
12
|
asChild: o = !1,
|
|
13
13
|
closeOnSelect: s = !0,
|
|
14
|
-
isParent:
|
|
15
|
-
className:
|
|
14
|
+
isParent: w = !1,
|
|
15
|
+
className: c,
|
|
16
|
+
role: m,
|
|
17
|
+
...v
|
|
16
18
|
}) => {
|
|
17
|
-
const { getItemProps:
|
|
19
|
+
const { getItemProps: b, listItemsRef: x, setOpen: f, activeIndex: D, divided: I, variant: u } = E(), g = o ? "div" : "button", P = (e) => typeof e != "number" || e <= 0 ? {} : {
|
|
18
20
|
"--dropdown-indent-level": e,
|
|
19
21
|
"--dropdown-indent": `${e}rem`
|
|
20
|
-
},
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
22
|
+
}, q = (e) => {
|
|
23
|
+
if (n) return;
|
|
24
|
+
const p = e.currentTarget.querySelector(
|
|
23
25
|
'input[type="checkbox"], input[type="radio"]'
|
|
24
26
|
);
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
+
if (p) {
|
|
28
|
+
p.click();
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
|
-
o ? t == null || t(e) : (t == null || t(e), s &&
|
|
30
|
-
},
|
|
31
|
-
if (!
|
|
31
|
+
o ? t == null || t(e) : (t == null || t(e), s && f(!1));
|
|
32
|
+
}, K = (e) => {
|
|
33
|
+
if (!n && (e.key === "Enter" || e.key === " ")) {
|
|
32
34
|
e.preventDefault();
|
|
33
|
-
const
|
|
35
|
+
const p = e.currentTarget.querySelector(
|
|
34
36
|
'input[type="checkbox"], input[type="radio"]'
|
|
35
37
|
);
|
|
36
|
-
|
|
38
|
+
p ? p.click() : t == null || t(e), !o && s && f(!1);
|
|
37
39
|
}
|
|
38
|
-
},
|
|
40
|
+
}, a = {
|
|
39
41
|
ref(e) {
|
|
40
|
-
typeof d == "number" && (
|
|
42
|
+
typeof d == "number" && (x.current[d] = e);
|
|
41
43
|
},
|
|
42
|
-
tabIndex:
|
|
43
|
-
className:
|
|
44
|
+
tabIndex: D === d ? 0 : -1,
|
|
45
|
+
className: j(
|
|
44
46
|
r["tedi-dropdown__item"],
|
|
45
47
|
{
|
|
46
|
-
[r["tedi-dropdown__item--active"]]:
|
|
47
|
-
[r["tedi-dropdown__item--disabled"]]:
|
|
48
|
-
[r["tedi-dropdown__item--divided"]]:
|
|
48
|
+
[r["tedi-dropdown__item--active"]]: _,
|
|
49
|
+
[r["tedi-dropdown__item--disabled"]]: n,
|
|
50
|
+
[r["tedi-dropdown__item--divided"]]: I,
|
|
49
51
|
[r["tedi-dropdown__item--indent"]]: i,
|
|
50
|
-
[r["tedi-dropdown__item--tree-item"]]:
|
|
51
|
-
[r["tedi-dropdown__item--tree-parent"]]:
|
|
52
|
+
[r["tedi-dropdown__item--tree-item"]]: u === "tree" && i,
|
|
53
|
+
[r["tedi-dropdown__item--tree-parent"]]: u === "tree" && w
|
|
52
54
|
},
|
|
53
|
-
|
|
55
|
+
c
|
|
54
56
|
),
|
|
55
|
-
style:
|
|
56
|
-
onClick:
|
|
57
|
-
onKeyDown:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
style: P(i),
|
|
58
|
+
onClick: q,
|
|
59
|
+
onKeyDown: K,
|
|
60
|
+
...v
|
|
61
|
+
}, N = o && s === !1 ? { ...a, role: m } : b({
|
|
62
|
+
role: m ?? "menuitem",
|
|
63
|
+
disabled: o ? void 0 : n,
|
|
64
|
+
...a
|
|
62
65
|
});
|
|
63
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ T(g, { ...N, children: y });
|
|
64
67
|
};
|
|
65
68
|
export {
|
|
66
|
-
|
|
69
|
+
l as DropdownItem
|
|
67
70
|
};
|
|
@@ -78,7 +78,7 @@ export declare const Dropdown: {
|
|
|
78
78
|
Content: ({ children }: {
|
|
79
79
|
children: React.ReactNode;
|
|
80
80
|
}) => null;
|
|
81
|
-
Item: ({ children, onClick, disabled, active, index, indent, asChild, closeOnSelect, isParent, className, }: import('./dropdown-item/dropdown-item').DropdownItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
Item: ({ children, onClick, disabled, active, index, indent, asChild, closeOnSelect, isParent, className, role, ...aria }: import('./dropdown-item/dropdown-item').DropdownItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
82
82
|
Separator: () => import("react/jsx-runtime").JSX.Element;
|
|
83
83
|
};
|
|
84
84
|
export {};
|