@tedi-design-system/react 17.1.0-rc.8 → 17.1.0-rc.9
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/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/form/input-group/components/input/input.es.js +8 -8
- package/src/tedi/components/form/input-group/components/prefix/prefix.es.js +10 -10
- package/src/tedi/components/form/input-group/components/suffix/suffix.es.js +6 -6
- package/src/tedi/components/form/input-group/input-group.es.js +13 -13
- package/src/tedi/components/form/select/components/select-bulk-helpers.cjs.js +1 -0
- package/src/tedi/components/form/select/components/select-bulk-helpers.d.ts +55 -0
- package/src/tedi/components/form/select/components/select-bulk-helpers.es.js +34 -0
- package/src/tedi/components/form/select/components/select-group-bulk-context.cjs.js +1 -0
- package/src/tedi/components/form/select/components/select-group-bulk-context.d.ts +18 -0
- package/src/tedi/components/form/select/components/select-group-bulk-context.es.js +6 -0
- package/src/tedi/components/form/select/components/select-group-heading.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-group-heading.d.ts +4 -1
- package/src/tedi/components/form/select/components/select-group-heading.es.js +43 -8
- package/src/tedi/components/form/select/components/select-group.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-group.d.ts +4 -1
- package/src/tedi/components/form/select/components/select-group.es.js +18 -6
- package/src/tedi/components/form/select/components/select-menu-list.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-menu-list.d.ts +9 -1
- package/src/tedi/components/form/select/components/select-menu-list.es.js +22 -8
- 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 +40 -18
- package/src/tedi/components/form/select/components/select-multi-value.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-multi-value.d.ts +12 -1
- package/src/tedi/components/form/select/components/select-multi-value.es.js +42 -8
- 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 +5 -4
- package/src/tedi/components/form/select/components/select-single-value.cjs.js +1 -0
- package/src/tedi/components/form/select/components/select-single-value.d.ts +3 -0
- package/src/tedi/components/form/select/components/select-single-value.es.js +9 -0
- package/src/tedi/components/form/select/components/select-tags-context.cjs.js +1 -0
- package/src/tedi/components/form/select/components/select-tags-context.d.ts +11 -0
- package/src/tedi/components/form/select/components/select-tags-context.es.js +9 -0
- package/src/tedi/components/form/select/components/select-value-container.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-value-container.d.ts +12 -2
- package/src/tedi/components/form/select/components/select-value-container.es.js +76 -13
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.d.ts +258 -0
- package/src/tedi/components/form/select/select.es.js +265 -175
- package/src/tedi/components/form/select/select.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/select/select.module.scss.es.js +14 -5
- package/src/tedi/components/tags/tag/tag.cjs.js +1 -1
- package/src/tedi/components/tags/tag/tag.d.ts +8 -0
- package/src/tedi/components/tags/tag/tag.es.js +14 -13
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +7 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +9 -2
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { useInputGroup as
|
|
1
|
+
import t from "../../../../../../../external/classnames/index.es.js";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import { useInputGroup as u } from "../../input-group.es.js";
|
|
4
4
|
import o from "../../input-group.module.scss.es.js";
|
|
5
5
|
const f = ({ children: p }) => {
|
|
6
|
-
const { disabled: r, inputId: e } =
|
|
7
|
-
if (!
|
|
6
|
+
const { disabled: r, inputId: e } = u();
|
|
7
|
+
if (!s.isValidElement(p)) return p;
|
|
8
8
|
const a = typeof p.type == "string", i = {
|
|
9
9
|
disabled: r || p.props.disabled,
|
|
10
10
|
id: p.props.id ?? e,
|
|
11
|
-
className:
|
|
11
|
+
className: t(p.props.className, o["tedi-input-group__input"]),
|
|
12
12
|
...!a && {
|
|
13
|
-
wrapperClassName:
|
|
13
|
+
wrapperClassName: t(p.props.wrapperClassName, o["tedi-input-group__input"])
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
return
|
|
16
|
+
return s.cloneElement(p, i);
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
19
|
f as Input
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useEffect as
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import m from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useEffect as n } from "react";
|
|
4
4
|
import { useInputGroup as a } from "../../input-group.es.js";
|
|
5
5
|
import i from "../../input-group.module.scss.es.js";
|
|
6
|
-
const b = ({ children: r, className: o, ...
|
|
7
|
-
const { registerPrefix: e, unregisterPrefix: t, disabled:
|
|
8
|
-
|
|
6
|
+
const b = ({ children: r, className: o, ...p }) => {
|
|
7
|
+
const { registerPrefix: e, unregisterPrefix: t, disabled: s } = a();
|
|
8
|
+
n(() => (e(), () => t()), [e, t]);
|
|
9
9
|
const f = typeof r == "string" || typeof r == "number";
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ u(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
...
|
|
14
|
-
className:
|
|
13
|
+
...p,
|
|
14
|
+
className: m(
|
|
15
15
|
i["tedi-input-group__prefix"],
|
|
16
16
|
{ [i["tedi-input-group__prefix--no-inner-div"]]: f },
|
|
17
17
|
o
|
|
18
18
|
),
|
|
19
|
-
"aria-disabled":
|
|
19
|
+
"aria-disabled": s,
|
|
20
20
|
children: r
|
|
21
21
|
}
|
|
22
22
|
);
|
|
@@ -2,18 +2,18 @@ import { jsx as p } from "react/jsx-runtime";
|
|
|
2
2
|
import m from "../../../../../../../external/classnames/index.es.js";
|
|
3
3
|
import { useEffect as n } from "react";
|
|
4
4
|
import { useInputGroup as a } from "../../input-group.es.js";
|
|
5
|
-
import
|
|
6
|
-
const
|
|
5
|
+
import o from "../../input-group.module.scss.es.js";
|
|
6
|
+
const _ = ({ children: r, className: e, ...s }) => {
|
|
7
7
|
const { registerSuffix: t, unregisterSuffix: i, disabled: f } = a();
|
|
8
8
|
n(() => (t(), () => i()), [t, i]);
|
|
9
9
|
const u = typeof r == "string" || typeof r == "number";
|
|
10
10
|
return /* @__PURE__ */ p(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
...
|
|
13
|
+
...s,
|
|
14
14
|
className: m(
|
|
15
|
-
|
|
16
|
-
{ [
|
|
15
|
+
o["tedi-input-group__suffix"],
|
|
16
|
+
{ [o["tedi-input-group__suffix--no-inner-div"]]: u },
|
|
17
17
|
e
|
|
18
18
|
),
|
|
19
19
|
"aria-disabled": f,
|
|
@@ -22,5 +22,5 @@ const b = ({ children: r, className: e, ...o }) => {
|
|
|
22
22
|
);
|
|
23
23
|
};
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
_ as Suffix
|
|
26
26
|
};
|
|
@@ -7,13 +7,13 @@ import { Input as B } from "./components/input/input.es.js";
|
|
|
7
7
|
import { Prefix as M } from "./components/prefix/prefix.es.js";
|
|
8
8
|
import { Suffix as O } from "./components/suffix/suffix.es.js";
|
|
9
9
|
import t from "./input-group.module.scss.es.js";
|
|
10
|
-
const
|
|
11
|
-
const u = G(
|
|
10
|
+
const a = j(null), U = () => {
|
|
11
|
+
const u = G(a);
|
|
12
12
|
if (!u) throw new Error("InputGroupContext missing");
|
|
13
13
|
return u;
|
|
14
|
-
}, W = () => G(
|
|
15
|
-
({ className: u, addons:
|
|
16
|
-
const m = g.useRef(null), N = g.useId(), i = y ?? N, [n, d] = l(!1), [
|
|
14
|
+
}, W = () => G(a), S = H(
|
|
15
|
+
({ className: u, addons: P = !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, d] = l(!1), [p, c] = l(!1);
|
|
17
17
|
E(C, () => ({
|
|
18
18
|
get root() {
|
|
19
19
|
return m.current;
|
|
@@ -22,7 +22,7 @@ const p = j(null), U = () => {
|
|
|
22
22
|
const w = L(
|
|
23
23
|
() => ({
|
|
24
24
|
hasPrefix: n,
|
|
25
|
-
hasSuffix:
|
|
25
|
+
hasSuffix: p,
|
|
26
26
|
disabled: s,
|
|
27
27
|
hasExternalLabel: !!o,
|
|
28
28
|
inputId: i,
|
|
@@ -31,31 +31,31 @@ const p = j(null), U = () => {
|
|
|
31
31
|
registerSuffix: () => c(!0),
|
|
32
32
|
unregisterSuffix: () => c(!1)
|
|
33
33
|
}),
|
|
34
|
-
[i, n,
|
|
34
|
+
[i, n, p, s, o]
|
|
35
35
|
), A = F(
|
|
36
36
|
t["tedi-input-group"],
|
|
37
37
|
{
|
|
38
|
-
[t["tedi-input-group--addons"]]:
|
|
38
|
+
[t["tedi-input-group--addons"]]: P,
|
|
39
39
|
[t["tedi-input-group--has-prefix"]]: n,
|
|
40
|
-
[t["tedi-input-group--has-suffix"]]:
|
|
40
|
+
[t["tedi-input-group--has-suffix"]]: p,
|
|
41
41
|
[t["tedi-input-group--disabled"]]: s
|
|
42
42
|
},
|
|
43
43
|
u
|
|
44
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(
|
|
45
|
+
return /* @__PURE__ */ k(a.Provider, { value: w, children: [
|
|
46
46
|
o && /* @__PURE__ */ e(b, { ...v, label: o, id: i }),
|
|
47
47
|
/* @__PURE__ */ e("div", { ref: m, className: A, "data-name": "tedi-input-group", "aria-disabled": s, children: h }),
|
|
48
48
|
R()
|
|
49
49
|
] });
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
|
-
|
|
53
|
-
const f =
|
|
52
|
+
S.displayName = "InputGroup";
|
|
53
|
+
const f = S;
|
|
54
54
|
f.Prefix = M;
|
|
55
55
|
f.Suffix = O;
|
|
56
56
|
f.Input = B;
|
|
57
57
|
export {
|
|
58
|
-
|
|
58
|
+
S as InputGroupBase,
|
|
59
59
|
f as default,
|
|
60
60
|
U as useInputGroup,
|
|
61
61
|
W as useOptionalInputGroup
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i="__tedi_select_all__",r="__tedi_select_group__:",u=e=>!!e&&typeof e.value=="string"&&e.value.startsWith(r),a=e=>{if(!e||e.length===0)return[];const t=[];for(const s of e)if(s&&typeof s=="object"&&Array.isArray(s.options))for(const n of s.options)n.isDisabled||t.push(n);else{const n=s;n&&!n.isDisabled&&t.push(n)}return t},f=e=>!e||!Array.isArray(e.options)?[]:e.options.filter(t=>!t.isDisabled),l=(e,t)=>t.length===0?!1:t.every(s=>e.some(n=>n.value===s.value)),c=(e,t)=>{if(t.length===0)return!1;const s=t.filter(n=>e.some(o=>o.value===n.value)).length;return s>0&&s<t.length},_=(e,t)=>{if(l(e,t))return e.filter(n=>!t.some(o=>o.value===n.value));const s=[...e];for(const n of t)s.some(o=>o.value===n.value)||s.push(n);return s};exports.GROUP_OPTION_PREFIX=r;exports.SELECT_ALL_VALUE=i;exports.areAllSelected=l;exports.getEnabledOptions=a;exports.getGroupEnabledOptions=f;exports.isGroupSentinel=u;exports.isIndeterminate=c;exports.toggleBulkSelection=_;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { GroupBase, OptionsOrGroups } from 'react-select';
|
|
2
|
+
import { ISelectOption } from '../select';
|
|
3
|
+
/**
|
|
4
|
+
* Sentinel value used by the "Select all" option when it is injected into
|
|
5
|
+
* react-select's option list. The sentinel is stripped from the value before
|
|
6
|
+
* it is exposed to consumers via onChange — it never leaks outside the
|
|
7
|
+
* component.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SELECT_ALL_VALUE = "__tedi_select_all__";
|
|
10
|
+
export declare const isSelectAllSentinel: (option: {
|
|
11
|
+
value?: string;
|
|
12
|
+
} | null | undefined) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Prefix for group sentinel options. When `selectableGroups + multiple` is on,
|
|
15
|
+
* each group is flattened into the option list with a sentinel option at the
|
|
16
|
+
* top of its run; toggling the sentinel toggles every enabled child of that
|
|
17
|
+
* group. The label after the prefix is the original group's label.
|
|
18
|
+
*/
|
|
19
|
+
export declare const GROUP_OPTION_PREFIX = "__tedi_select_group__:";
|
|
20
|
+
export declare const isGroupSentinel: (option: {
|
|
21
|
+
value?: string;
|
|
22
|
+
} | null | undefined) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Returns true when `options` is a grouped tree (i.e. each top-level entry
|
|
25
|
+
* has its own `options` array).
|
|
26
|
+
*/
|
|
27
|
+
export declare const isGroupedOptions: (options: OptionsOrGroups<ISelectOption, GroupBase<ISelectOption>>) => options is ReadonlyArray<GroupBase<ISelectOption>>;
|
|
28
|
+
/**
|
|
29
|
+
* Flattens grouped/non-grouped options into a single list of enabled
|
|
30
|
+
* `ISelectOption`s. Used by Select All and group toggles to decide which
|
|
31
|
+
* options to flip on/off.
|
|
32
|
+
*
|
|
33
|
+
* Handles a mixed input where a flat option (e.g. the injected Select-all
|
|
34
|
+
* sentinel) sits alongside groups in the same top-level array, by checking
|
|
35
|
+
* each item individually rather than only inspecting `options[0]`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const getEnabledOptions: (options: OptionsOrGroups<ISelectOption, GroupBase<ISelectOption>>) => ISelectOption[];
|
|
38
|
+
/**
|
|
39
|
+
* Returns the enabled options of a specific group. Pass the group object
|
|
40
|
+
* directly (e.g. `GroupHeadingProps.data` from react-select) — looking groups
|
|
41
|
+
* up by label is unsafe because duplicate labels would always resolve to the
|
|
42
|
+
* first match, mutating the wrong group.
|
|
43
|
+
*/
|
|
44
|
+
export declare const getGroupEnabledOptions: (group: GroupBase<ISelectOption> | null | undefined) => ISelectOption[];
|
|
45
|
+
/** True iff every enabled option is currently in the selection. */
|
|
46
|
+
export declare const areAllSelected: (selected: ReadonlyArray<ISelectOption>, enabled: ReadonlyArray<ISelectOption>) => boolean;
|
|
47
|
+
/** True when some — but not all — enabled options are selected. */
|
|
48
|
+
export declare const isIndeterminate: (selected: ReadonlyArray<ISelectOption>, enabled: ReadonlyArray<ISelectOption>) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Toggle behaviour for both Select All and group toggle: when every enabled
|
|
51
|
+
* option in `target` is selected, remove them all; otherwise add the missing
|
|
52
|
+
* ones to the existing selection. Other selected values (e.g. options
|
|
53
|
+
* outside `target`) are preserved.
|
|
54
|
+
*/
|
|
55
|
+
export declare const toggleBulkSelection: (selected: ReadonlyArray<ISelectOption>, target: ReadonlyArray<ISelectOption>) => ISelectOption[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const i = "__tedi_select_all__", o = "__tedi_select_group__:", u = (t) => !!t && typeof t.value == "string" && t.value.startsWith(o), f = (t) => {
|
|
2
|
+
if (!t || t.length === 0) return [];
|
|
3
|
+
const e = [];
|
|
4
|
+
for (const n of t)
|
|
5
|
+
if (n && typeof n == "object" && Array.isArray(n.options))
|
|
6
|
+
for (const s of n.options)
|
|
7
|
+
s.isDisabled || e.push(s);
|
|
8
|
+
else {
|
|
9
|
+
const s = n;
|
|
10
|
+
s && !s.isDisabled && e.push(s);
|
|
11
|
+
}
|
|
12
|
+
return e;
|
|
13
|
+
}, a = (t) => !t || !Array.isArray(t.options) ? [] : t.options.filter((e) => !e.isDisabled), l = (t, e) => e.length === 0 ? !1 : e.every((n) => t.some((s) => s.value === n.value)), c = (t, e) => {
|
|
14
|
+
if (e.length === 0) return !1;
|
|
15
|
+
const n = e.filter((s) => t.some((r) => r.value === s.value)).length;
|
|
16
|
+
return n > 0 && n < e.length;
|
|
17
|
+
}, _ = (t, e) => {
|
|
18
|
+
if (l(t, e))
|
|
19
|
+
return t.filter((s) => !e.some((r) => r.value === s.value));
|
|
20
|
+
const n = [...t];
|
|
21
|
+
for (const s of e)
|
|
22
|
+
n.some((r) => r.value === s.value) || n.push(s);
|
|
23
|
+
return n;
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
o as GROUP_OPTION_PREFIX,
|
|
27
|
+
i as SELECT_ALL_VALUE,
|
|
28
|
+
l as areAllSelected,
|
|
29
|
+
f as getEnabledOptions,
|
|
30
|
+
a as getGroupEnabledOptions,
|
|
31
|
+
u as isGroupSentinel,
|
|
32
|
+
c as isIndeterminate,
|
|
33
|
+
_ as toggleBulkSelection
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.createContext(null),u=()=>e.useContext(t);exports.SelectGroupBulkContext=t;exports.useSelectGroupBulkApi=u;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SetValueAction } from 'react-select';
|
|
2
|
+
import { ISelectOption } from '../select';
|
|
3
|
+
/**
|
|
4
|
+
* Exposes react-select's `getValue` / `setValue` helpers from the `Group`
|
|
5
|
+
* component down to `GroupHeading`. react-select only forwards `selectProps`
|
|
6
|
+
* + theme/styles to the heading at runtime, so the heading can't read these
|
|
7
|
+
* helpers from its own props — it has to grab them from this context.
|
|
8
|
+
*
|
|
9
|
+
* Using `selectProps.value` / `selectProps.onChange` instead would only work
|
|
10
|
+
* in fully controlled mode: in uncontrolled mode `value` is undefined and
|
|
11
|
+
* `onChange` bypasses react-select's internal state.
|
|
12
|
+
*/
|
|
13
|
+
export interface SelectGroupBulkApi {
|
|
14
|
+
getValue: () => ReadonlyArray<ISelectOption>;
|
|
15
|
+
setValue: (value: ReadonlyArray<ISelectOption>, action: SetValueAction) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const SelectGroupBulkContext: import('react').Context<SelectGroupBulkApi | null>;
|
|
18
|
+
export declare const useSelectGroupBulkApi: () => SelectGroupBulkApi | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),S=require("../../../../../../external/classnames/index.cjs.js"),q=require("react"),u=require("../../../base/typography/text/text.cjs.js"),G=require("../../checkbox/checkbox.cjs.js"),i=require("../select.module.scss.cjs.js"),s=require("./select-bulk-helpers.cjs.js"),f=require("./select-group-bulk-context.cjs.js"),j=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),g=({optionGroupHeadingText:x,...e})=>{const _=q.useId(),d=e.data.text||x,{selectableGroups:h,isMulti:b}=e.selectProps,t=f.useSelectGroupBulkApi(),l=!!b&&!!h&&!!t,c=l?s.getGroupEnabledOptions(e.data):[],o=(t==null?void 0:t.getValue())??[],r=l&&s.areAllSelected(o,c),p=l&&s.isIndeterminate(o,c),m=()=>{if(!l||!t||c.length===0)return;const a=s.toggleBulkSelection(o,c);t.setValue(a,r?"deselect-option":"select-option")};return n.jsx(j.c.GroupHeading,{...e,className:S.default(i.default["tedi-select__group-heading"],{[i.default["tedi-select__group-heading--selectable"]]:l}),children:l?n.jsx("div",{className:i.default["tedi-select__group-heading-toggle"],onMouseDown:a=>a.preventDefault(),children:n.jsx(G.Checkbox,{id:`${e.selectProps.instanceId??"tedi-select"}-group-${_}`,name:"tedi-select__group-toggle",value:`__group_${e.data.label}__`,label:n.jsx(u.Text,{...d,children:e.data.label}),checked:r,indeterminate:p,onChange:m})}):n.jsx(u.Text,{...d,children:e.data.label})})};g.displayName="SelectGroupHeading";exports.SelectGroupHeading=g;
|
|
@@ -5,5 +5,8 @@ import { IGroupedOptions, ISelectOption } from '../select';
|
|
|
5
5
|
type GroupHeadingType = GroupHeadingProps<ISelectOption, boolean, IGroupedOptions<ISelectOption>> & {
|
|
6
6
|
optionGroupHeadingText?: Pick<TextProps, 'modifiers' | 'color'>;
|
|
7
7
|
};
|
|
8
|
-
export declare const SelectGroupHeading:
|
|
8
|
+
export declare const SelectGroupHeading: {
|
|
9
|
+
({ optionGroupHeadingText, ...props }: GroupHeadingType): ReactElement;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
9
12
|
export {};
|
|
@@ -1,12 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import f from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useId as b } from "react";
|
|
4
|
+
import { Text as d } from "../../../base/typography/text/text.es.js";
|
|
5
|
+
import { Checkbox as x } from "../../checkbox/checkbox.es.js";
|
|
4
6
|
import i from "../select.module.scss.es.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import { getGroupEnabledOptions as S, areAllSelected as G, isIndeterminate as v, toggleBulkSelection as H } from "./select-bulk-helpers.es.js";
|
|
8
|
+
import { useSelectGroupBulkApi as I } from "./select-group-bulk-context.es.js";
|
|
9
|
+
import { c as N } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
10
|
+
const k = ({ optionGroupHeadingText: g, ...e }) => {
|
|
11
|
+
const m = b(), s = e.data.text || g, { selectableGroups: u, isMulti: p } = e.selectProps, t = I(), o = !!p && !!u && !!t, n = o ? S(e.data) : [], a = (t == null ? void 0 : t.getValue()) ?? [], r = o && G(a, n), _ = o && v(a, n), h = () => {
|
|
12
|
+
if (!o || !t || n.length === 0) return;
|
|
13
|
+
const c = H(a, n);
|
|
14
|
+
t.setValue(c, r ? "deselect-option" : "select-option");
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ l(
|
|
17
|
+
N.GroupHeading,
|
|
18
|
+
{
|
|
19
|
+
...e,
|
|
20
|
+
className: f(i["tedi-select__group-heading"], {
|
|
21
|
+
[i["tedi-select__group-heading--selectable"]]: o
|
|
22
|
+
}),
|
|
23
|
+
children: o ? (
|
|
24
|
+
// The Checkbox owns the toggle path through its own `onChange`;
|
|
25
|
+
// attaching another handler to the wrapper would fire `handleToggle`
|
|
26
|
+
// twice on a single user click. The wrapper stays only to swallow the
|
|
27
|
+
// mousedown that would otherwise close react-select's menu.
|
|
28
|
+
/* @__PURE__ */ l("div", { className: i["tedi-select__group-heading-toggle"], onMouseDown: (c) => c.preventDefault(), children: /* @__PURE__ */ l(
|
|
29
|
+
x,
|
|
30
|
+
{
|
|
31
|
+
id: `${e.selectProps.instanceId ?? "tedi-select"}-group-${m}`,
|
|
32
|
+
name: "tedi-select__group-toggle",
|
|
33
|
+
value: `__group_${e.data.label}__`,
|
|
34
|
+
label: /* @__PURE__ */ l(d, { ...s, children: e.data.label }),
|
|
35
|
+
checked: r,
|
|
36
|
+
indeterminate: _,
|
|
37
|
+
onChange: h
|
|
38
|
+
}
|
|
39
|
+
) })
|
|
40
|
+
) : /* @__PURE__ */ l(d, { ...s, children: e.data.label })
|
|
41
|
+
}
|
|
42
|
+
);
|
|
9
43
|
};
|
|
44
|
+
k.displayName = "SelectGroupHeading";
|
|
10
45
|
export {
|
|
11
|
-
|
|
46
|
+
k as SelectGroupHeading
|
|
12
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("../../../../../../external/classnames/index.cjs.js"),i=require("react"),n=require("../select.module.scss.cjs.js"),s=require("./select-group-bulk-context.cjs.js"),a=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),u=e=>{const l=i.useMemo(()=>({getValue:()=>e.getValue(),setValue:(r,c)=>e.setValue(r,c)}),[e]);return t.jsx(s.SelectGroupBulkContext.Provider,{value:l,children:t.jsx(a.c.Group,{...e,className:o.default(n.default["tedi-select__group"]),children:e.children})})};u.displayName="SelectGroup";exports.SelectGroup=u;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { GroupProps } from 'react-select';
|
|
2
2
|
import { IGroupedOptions, ISelectOption } from '../select';
|
|
3
|
-
export declare const SelectGroup:
|
|
3
|
+
export declare const SelectGroup: {
|
|
4
|
+
(props: GroupProps<ISelectOption, boolean, IGroupedOptions<ISelectOption>>): JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import m from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useMemo as u } from "react";
|
|
4
|
+
import c from "../select.module.scss.es.js";
|
|
5
|
+
import { SelectGroupBulkContext as i } from "./select-group-bulk-context.es.js";
|
|
6
|
+
import { c as s } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
7
|
+
const a = (e) => {
|
|
8
|
+
const o = u(
|
|
9
|
+
() => ({
|
|
10
|
+
getValue: () => e.getValue(),
|
|
11
|
+
setValue: (r, l) => e.setValue(r, l)
|
|
12
|
+
}),
|
|
13
|
+
[e]
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ t(i.Provider, { value: o, children: /* @__PURE__ */ t(s.Group, { ...e, className: m(c["tedi-select__group"]), children: e.children }) });
|
|
16
|
+
};
|
|
17
|
+
a.displayName = "SelectGroup";
|
|
6
18
|
export {
|
|
7
|
-
|
|
19
|
+
a as SelectGroup
|
|
8
20
|
};
|
|
@@ -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"),u=require("../../../../../../external/classnames/index.cjs.js"),t=require("../select.module.scss.cjs.js"),a=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),d=({renderMessageListFooter:l,...e})=>{const{keyboardMode:s,exitKeyboardMode:c,dropdownType:n}=e.selectProps;return i.jsxs("div",{className:t.default["tedi-select__menu-list-wrapper"],onMouseMove:s?c:void 0,children:[i.jsx(a.c.MenuList,{...e,className:u.default(e.className,t.default["tedi-select__menu-list"],{[t.default["tedi-select__menu-list--keyboard"]]:s,[t.default["tedi-select__menu-list--grid"]]:n==="grid"}),children:e.children}),l&&i.jsx("div",{className:t.default["tedi-select__menu-list-footer"],children:l(e)})]})};d.displayName="SelectMenuList";exports.SelectMenuList=d;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { MenuListProps } from 'react-select';
|
|
2
2
|
import { ISelectOption } from '../select';
|
|
3
3
|
type MenuListType = MenuListProps<ISelectOption, boolean> & {
|
|
4
|
+
selectProps: MenuListProps<ISelectOption, boolean>['selectProps'] & {
|
|
5
|
+
keyboardMode?: boolean;
|
|
6
|
+
exitKeyboardMode?: () => void;
|
|
7
|
+
dropdownType?: 'menu' | 'grid';
|
|
8
|
+
};
|
|
4
9
|
renderMessageListFooter?: (props: MenuListProps<ISelectOption, boolean>) => JSX.Element;
|
|
5
10
|
};
|
|
6
|
-
export declare const SelectMenuList:
|
|
11
|
+
export declare const SelectMenuList: {
|
|
12
|
+
({ renderMessageListFooter, ...props }: MenuListType): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
7
15
|
export {};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import m from "../../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { c } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import t from "../select.module.scss.es.js";
|
|
4
|
+
import { c as n } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
5
|
+
const r = ({ renderMessageListFooter: s, ...e }) => {
|
|
6
|
+
const { keyboardMode: i, exitKeyboardMode: c, dropdownType: d } = e.selectProps;
|
|
7
|
+
return /* @__PURE__ */ o("div", { className: t["tedi-select__menu-list-wrapper"], onMouseMove: i ? c : void 0, children: [
|
|
8
|
+
/* @__PURE__ */ l(
|
|
9
|
+
n.MenuList,
|
|
10
|
+
{
|
|
11
|
+
...e,
|
|
12
|
+
className: m(e.className, t["tedi-select__menu-list"], {
|
|
13
|
+
[t["tedi-select__menu-list--keyboard"]]: i,
|
|
14
|
+
[t["tedi-select__menu-list--grid"]]: d === "grid"
|
|
15
|
+
}),
|
|
16
|
+
children: e.children
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
s && /* @__PURE__ */ l("div", { className: t["tedi-select__menu-list-footer"], children: s(e) })
|
|
20
|
+
] });
|
|
21
|
+
};
|
|
22
|
+
r.displayName = "SelectMenuList";
|
|
9
23
|
export {
|
|
10
|
-
|
|
24
|
+
r as SelectMenuList
|
|
11
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),S=require("../../../../../../external/classnames/index.cjs.js"),x=require("../../checkbox/checkbox.cjs.js"),l=require("../select.module.scss.cjs.js"),t=require("./select-bulk-helpers.cjs.js"),g=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),A=({renderOption:f,...e})=>{var b;const u=e.data.value===t.SELECT_ALL_VALUE,r=t.isGroupSentinel(e.data),E=!!((b=e.data.customData)!=null&&b.__tediInGroup);let o=e.isSelected,_=!1;if(u){const i=t.getEnabledOptions(e.options).filter(n=>n.value!==t.SELECT_ALL_VALUE),a=(e.getValue()??[]).filter(n=>n.value!==t.SELECT_ALL_VALUE);o=t.areAllSelected(a,i),_=t.isIndeterminate(a,i)}else if(r){const i=e.options,L=i.findIndex(d=>d.value===e.data.value),a=[];for(let d=L+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||a.push(s)}const n=e.getValue()??[];o=t.areAllSelected(n,a),_=t.isIndeterminate(n,a)}const h=S.default(l.default["tedi-select__option"],{[l.default["tedi-select__option--disabled"]]:e.isDisabled},{[l.default["tedi-select__option--focused"]]:e.isFocused},{[l.default["tedi-select__option--select-all"]]:u},{[l.default["tedi-select__option--group"]]:r},{[l.default["tedi-select__option--indented"]]:E}),{tabIndex:m,...v}=e.innerProps;return c.jsx(g.c.Option,{...e,innerProps:{...v,tabIndex:m,role:"option","aria-selected":o},className:h,children:f&&!u&&!r?f(e):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"sr-only",children:e.label}),c.jsx(x.Checkbox,{id:e.data.value,label:e.label,"aria-hidden":!0,className:l.default["tedi-select__checkbox"],value:e.data.value,name:e.data.value,checked:o,indeterminate:_,onChange:()=>null,disabled:e.isDisabled,hover:e.isFocused})]})})};exports.SelectMultiOption=A;
|
|
@@ -1,24 +1,45 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { Checkbox as
|
|
1
|
+
import { jsx as m, jsxs as k, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import O from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { Checkbox as P } from "../../checkbox/checkbox.es.js";
|
|
4
4
|
import t from "../select.module.scss.es.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { SELECT_ALL_VALUE as o, isGroupSentinel as y, getEnabledOptions as G, areAllSelected as h, isIndeterminate as v, GROUP_OPTION_PREFIX as N } from "./select-bulk-helpers.es.js";
|
|
6
|
+
import { c as A } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
7
|
+
const M = ({ renderOption: _, ...e }) => {
|
|
8
|
+
var f;
|
|
9
|
+
const c = e.data.value === o, u = y(e.data), g = !!((f = e.data.customData) != null && f.__tediInGroup);
|
|
10
|
+
let d = e.isSelected, r = !1;
|
|
11
|
+
if (c) {
|
|
12
|
+
const l = G(e.options).filter((a) => a.value !== o), i = (e.getValue() ?? []).filter((a) => a.value !== o);
|
|
13
|
+
d = h(i, l), r = v(i, l);
|
|
14
|
+
} else if (u) {
|
|
15
|
+
const l = e.options, b = l.findIndex((s) => s.value === e.data.value), i = [];
|
|
16
|
+
for (let s = b + 1; s < l.length; s++) {
|
|
17
|
+
const n = l[s];
|
|
18
|
+
if (!n || typeof n.value == "string" && (n.value.startsWith(N) || n.value === o))
|
|
19
|
+
break;
|
|
20
|
+
n.isDisabled || i.push(n);
|
|
21
|
+
}
|
|
22
|
+
const a = e.getValue() ?? [];
|
|
23
|
+
d = h(a, i), r = v(a, i);
|
|
24
|
+
}
|
|
25
|
+
const I = O(
|
|
8
26
|
t["tedi-select__option"],
|
|
9
27
|
{ [t["tedi-select__option--disabled"]]: e.isDisabled },
|
|
10
|
-
{ [t["tedi-select__option--focused"]]: e.isFocused }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
28
|
+
{ [t["tedi-select__option--focused"]]: e.isFocused },
|
|
29
|
+
{ [t["tedi-select__option--select-all"]]: c },
|
|
30
|
+
{ [t["tedi-select__option--group"]]: u },
|
|
31
|
+
{ [t["tedi-select__option--indented"]]: g }
|
|
32
|
+
), { tabIndex: x, ...S } = e.innerProps;
|
|
33
|
+
return /* @__PURE__ */ m(
|
|
34
|
+
A.Option,
|
|
14
35
|
{
|
|
15
36
|
...e,
|
|
16
|
-
innerProps: { ...
|
|
17
|
-
className:
|
|
18
|
-
children:
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
37
|
+
innerProps: { ...S, tabIndex: x, role: "option", "aria-selected": d },
|
|
38
|
+
className: I,
|
|
39
|
+
children: _ && !c && !u ? _(e) : /* @__PURE__ */ k(E, { children: [
|
|
40
|
+
/* @__PURE__ */ m("span", { className: "sr-only", children: e.label }),
|
|
41
|
+
/* @__PURE__ */ m(
|
|
42
|
+
P,
|
|
22
43
|
{
|
|
23
44
|
id: e.data.value,
|
|
24
45
|
label: e.label,
|
|
@@ -26,7 +47,8 @@ const x = ({ renderOption: a, ...e }) => {
|
|
|
26
47
|
className: t["tedi-select__checkbox"],
|
|
27
48
|
value: e.data.value,
|
|
28
49
|
name: e.data.value,
|
|
29
|
-
checked:
|
|
50
|
+
checked: d,
|
|
51
|
+
indeterminate: r,
|
|
30
52
|
onChange: () => null,
|
|
31
53
|
disabled: e.isDisabled,
|
|
32
54
|
hover: e.isFocused
|
|
@@ -37,5 +59,5 @@ const x = ({ renderOption: a, ...e }) => {
|
|
|
37
59
|
);
|
|
38
60
|
};
|
|
39
61
|
export {
|
|
40
|
-
|
|
62
|
+
M as SelectMultiOption
|
|
41
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),p=require("../../../tags/tag/tag.cjs.js"),c=require("./select-bulk-helpers.cjs.js"),f=require("./select-tags-context.cjs.js"),d=t=>o=>{if(o.type==="click"&&t.onClick){t.onClick(o);return}if(o.type==="keydown"){const n=o;(n.key==="Enter"||n.key===" ")&&t.onClick&&(n.preventDefault(),n.stopPropagation(),t.onClick(n))}},x=({isTagRemovable:t,children:o,removeProps:n,...l})=>{const{isSingleRow:y,visibleCount:a}=f.useSelectTagsContext();if(l.data.value===c.SELECT_ALL_VALUE||c.isGroupSentinel(l.data))return null;const s=l.selectProps.value??[],i=Array.isArray(s)?s.findIndex(e=>e.value===l.data.value):-1,C=y&&a!==null&&i!==-1&&i>=a,r=d(n),k=e=>{e.stopPropagation(),r(e)},g=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),r(e))};return C?null:u.jsx("div",{onMouseDown:e=>e.stopPropagation(),"data-tedi-tag-index":i,children:u.jsx(p.Tag,{color:"primary",onClose:t?k:void 0,closeButtonProps:t?{tabIndex:0,onMouseDown:e=>e.stopPropagation(),onKeyDown:g}:void 0,children:o})})};exports.SelectMultiValue=x;exports.createMultiValueCloseHandler=d;
|
|
@@ -3,5 +3,16 @@ import { ISelectOption } from '../select';
|
|
|
3
3
|
type MultiValueType = MultiValueProps<ISelectOption> & {
|
|
4
4
|
isTagRemovable?: boolean;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type RemoveProps = MultiValueProps<ISelectOption>['removeProps'];
|
|
7
|
+
/**
|
|
8
|
+
* Build the close handler that the rendered Tag passes to its inner button.
|
|
9
|
+
*
|
|
10
|
+
* Click activations forward straight to react-select's `removeProps.onClick`.
|
|
11
|
+
* Keyboard activations (Enter / Space) are also accepted as a defensive
|
|
12
|
+
* fallback for consumers who wire the handler directly to a custom keyboard
|
|
13
|
+
* trigger — Tag itself only invokes `onClose` from its click handler, so the
|
|
14
|
+
* keyboard branch only fires when the handler is reused outside Tag.
|
|
15
|
+
*/
|
|
16
|
+
export declare const createMultiValueCloseHandler: (removeProps: RemoveProps) => React.MouseEventHandler<HTMLButtonElement> & React.KeyboardEventHandler<HTMLButtonElement>;
|
|
17
|
+
export declare const SelectMultiValue: ({ isTagRemovable, children, removeProps, ...props }: MultiValueType) => JSX.Element | null;
|
|
7
18
|
export {};
|