@caseparts-org/caseblocks 0.0.262 → 0.0.263
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.
|
@@ -4,10 +4,15 @@ export interface SelectOption {
|
|
|
4
4
|
value: string;
|
|
5
5
|
label: string;
|
|
6
6
|
}
|
|
7
|
+
export interface SelectOptionGroup {
|
|
8
|
+
label: string;
|
|
9
|
+
options: SelectOption[];
|
|
10
|
+
}
|
|
7
11
|
export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "children">, HideAtProps {
|
|
8
12
|
label: string | null;
|
|
9
13
|
placeholder?: string;
|
|
10
|
-
options
|
|
14
|
+
options?: SelectOption[];
|
|
15
|
+
groups?: SelectOptionGroup[];
|
|
11
16
|
error?: string | null;
|
|
12
17
|
}
|
|
13
18
|
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -1,79 +1,81 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as D, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import F, { useState as V } from "react";
|
|
3
3
|
import { c as f } from "../../clsx-OuTLNxxd.js";
|
|
4
|
-
import { getHideAtStyles as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import '../../assets/Select.css';const
|
|
4
|
+
import { getHideAtStyles as j } from "../HideAt.js";
|
|
5
|
+
import { Icon as p } from "../Icon/Icon.js";
|
|
6
|
+
import '../../assets/Select.css';const I = "_select_kfi8n_1", L = "_icon_kfi8n_29", P = "_selectError_kfi8n_59", R = "_label_kfi8n_63", z = "_labelPlaceholder_kfi8n_78", A = "_labelDisabled_kfi8n_99", B = "_errorMessage_kfi8n_103", l = {
|
|
7
7
|
"select-container": "_select-container_kfi8n_1",
|
|
8
|
-
select:
|
|
9
|
-
icon:
|
|
10
|
-
selectError:
|
|
11
|
-
label:
|
|
12
|
-
labelPlaceholder:
|
|
13
|
-
labelDisabled:
|
|
14
|
-
errorMessage:
|
|
15
|
-
},
|
|
8
|
+
select: I,
|
|
9
|
+
icon: L,
|
|
10
|
+
selectError: P,
|
|
11
|
+
label: R,
|
|
12
|
+
labelPlaceholder: z,
|
|
13
|
+
labelDisabled: A,
|
|
14
|
+
errorMessage: B
|
|
15
|
+
}, C = F.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
label: s,
|
|
18
|
-
placeholder:
|
|
19
|
-
options:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
placeholder: c,
|
|
19
|
+
options: N = [],
|
|
20
|
+
groups: i,
|
|
21
|
+
value: v,
|
|
22
|
+
defaultValue: t,
|
|
23
|
+
hideAt: S,
|
|
24
|
+
className: x,
|
|
25
|
+
error: d,
|
|
25
26
|
onFocus: r,
|
|
26
|
-
onBlur:
|
|
27
|
-
...
|
|
28
|
-
},
|
|
29
|
-
const [
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
(s ||
|
|
27
|
+
onBlur: _,
|
|
28
|
+
...o
|
|
29
|
+
}, y) => {
|
|
30
|
+
const [w, h] = V(!1), E = !!o.disabled, n = v !== void 0, k = n ? String(v ?? "") : void 0, u = !n && t !== void 0 && t !== null ? String(t) : "", b = !!s && (w || (n ? k !== "" : u !== "")), M = !!c && !b, g = s ? "" : c ?? "";
|
|
31
|
+
return /* @__PURE__ */ D("div", { className: f(l["select-container"], j(S)), children: [
|
|
32
|
+
(s || M) && /* @__PURE__ */ a(
|
|
32
33
|
"label",
|
|
33
34
|
{
|
|
34
|
-
htmlFor:
|
|
35
|
+
htmlFor: o.name,
|
|
35
36
|
className: f(
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
b ? l.label : l.labelPlaceholder,
|
|
38
|
+
E ? l.labelDisabled : void 0
|
|
38
39
|
),
|
|
39
|
-
children:
|
|
40
|
+
children: b ? s : c ?? s
|
|
40
41
|
}
|
|
41
42
|
),
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ D(
|
|
43
44
|
"select",
|
|
44
45
|
{
|
|
45
|
-
...
|
|
46
|
-
ref:
|
|
47
|
-
id:
|
|
48
|
-
value:
|
|
49
|
-
defaultValue: n ? void 0 :
|
|
50
|
-
className: f(
|
|
51
|
-
onFocus: (
|
|
52
|
-
|
|
46
|
+
...o,
|
|
47
|
+
ref: y,
|
|
48
|
+
id: o.name,
|
|
49
|
+
value: k,
|
|
50
|
+
defaultValue: n ? void 0 : u,
|
|
51
|
+
className: f(l.select, d ? l.selectError : void 0, x),
|
|
52
|
+
onFocus: (e) => {
|
|
53
|
+
h(!0), r == null || r(e);
|
|
53
54
|
},
|
|
54
|
-
onBlur: (
|
|
55
|
-
|
|
55
|
+
onBlur: (e) => {
|
|
56
|
+
h(!1), _ == null || _(e);
|
|
56
57
|
},
|
|
57
58
|
children: [
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
c ? /* @__PURE__ */ a("option", { value: "", disabled: !0, hidden: !!s, children: g }) : null,
|
|
60
|
+
N.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value)),
|
|
61
|
+
i == null ? void 0 : i.map((e) => /* @__PURE__ */ a("optgroup", { label: e.label, children: e.options.map((m) => /* @__PURE__ */ a("option", { value: m.value, children: m.label }, m.value)) }, e.label))
|
|
60
62
|
]
|
|
61
63
|
}
|
|
62
64
|
),
|
|
63
65
|
/* @__PURE__ */ a(
|
|
64
|
-
|
|
66
|
+
p,
|
|
65
67
|
{
|
|
66
|
-
className:
|
|
68
|
+
className: l.icon,
|
|
67
69
|
iconKey: "fa-solid fa-chevron-down",
|
|
68
70
|
size: "3xs",
|
|
69
71
|
colorToken: "secondary"
|
|
70
72
|
}
|
|
71
73
|
),
|
|
72
|
-
|
|
74
|
+
d ? /* @__PURE__ */ a("div", { className: l.errorMessage, children: d }) : null
|
|
73
75
|
] });
|
|
74
76
|
}
|
|
75
77
|
);
|
|
76
|
-
|
|
78
|
+
C.displayName = "Select";
|
|
77
79
|
export {
|
|
78
|
-
|
|
80
|
+
C as Select
|
|
79
81
|
};
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as s } from "react";
|
|
3
3
|
import { Select as n } from "./Select.js";
|
|
4
|
-
const
|
|
4
|
+
const o = [
|
|
5
5
|
{ value: "US", label: "United States" },
|
|
6
6
|
{ value: "CA", label: "Canada" },
|
|
7
7
|
{ value: "MX", label: "Mexico" }
|
|
8
|
+
], c = [
|
|
9
|
+
{
|
|
10
|
+
label: "North America",
|
|
11
|
+
options: o
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: "Europe",
|
|
15
|
+
options: [
|
|
16
|
+
{ value: "DE", label: "Germany" },
|
|
17
|
+
{ value: "GB", label: "United Kingdom" }
|
|
18
|
+
]
|
|
19
|
+
}
|
|
8
20
|
], S = {
|
|
9
21
|
title: "Case Parts/Atoms/Select",
|
|
10
22
|
component: n,
|
|
@@ -12,34 +24,40 @@ const i = [
|
|
|
12
24
|
name: "country",
|
|
13
25
|
label: "Country",
|
|
14
26
|
placeholder: "Select country",
|
|
15
|
-
options:
|
|
27
|
+
options: o
|
|
16
28
|
},
|
|
17
29
|
parameters: {
|
|
18
30
|
layout: "centered"
|
|
19
31
|
}
|
|
20
32
|
};
|
|
21
33
|
function a(e) {
|
|
22
|
-
const [
|
|
34
|
+
const [u, i] = s(String(e.value ?? ""));
|
|
23
35
|
return /* @__PURE__ */ t("div", { style: { width: 320 }, children: /* @__PURE__ */ t(
|
|
24
36
|
n,
|
|
25
37
|
{
|
|
26
38
|
...e,
|
|
27
|
-
value:
|
|
39
|
+
value: u,
|
|
28
40
|
onChange: (r) => {
|
|
29
41
|
var l;
|
|
30
|
-
|
|
42
|
+
i(r.target.value), (l = e.onChange) == null || l.call(e, r);
|
|
31
43
|
}
|
|
32
44
|
}
|
|
33
45
|
) });
|
|
34
46
|
}
|
|
35
|
-
const
|
|
47
|
+
const g = {
|
|
36
48
|
render: (e) => /* @__PURE__ */ t(a, { ...e })
|
|
37
|
-
},
|
|
49
|
+
}, b = {
|
|
38
50
|
args: {
|
|
39
51
|
value: "US"
|
|
40
52
|
},
|
|
41
53
|
render: (e) => /* @__PURE__ */ t(a, { ...e })
|
|
42
|
-
},
|
|
54
|
+
}, h = {
|
|
55
|
+
args: {
|
|
56
|
+
options: void 0,
|
|
57
|
+
groups: c
|
|
58
|
+
},
|
|
59
|
+
render: (e) => /* @__PURE__ */ t(a, { ...e })
|
|
60
|
+
}, y = {
|
|
43
61
|
args: {
|
|
44
62
|
value: "",
|
|
45
63
|
error: "Country is required"
|
|
@@ -47,8 +65,9 @@ const v = {
|
|
|
47
65
|
render: (e) => /* @__PURE__ */ t(a, { ...e })
|
|
48
66
|
};
|
|
49
67
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
g as Default,
|
|
69
|
+
y as ErrorState,
|
|
70
|
+
h as WithOptionGroups,
|
|
71
|
+
b as WithSelectedValue,
|
|
53
72
|
S as default
|
|
54
73
|
};
|
package/dist/main-client.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type { InputProps } from './atoms/Input/Input';
|
|
|
10
10
|
export { InputEndAdornmentButton } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
|
|
11
11
|
export type { InputEndAdornmentButtonProps } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
|
|
12
12
|
export { Select } from './atoms/Select/Select';
|
|
13
|
-
export type { SelectProps, SelectOption } from './atoms/Select/Select';
|
|
13
|
+
export type { SelectProps, SelectOption, SelectOptionGroup } from './atoms/Select/Select';
|
|
14
14
|
export { Tooltip } from './atoms/Tooltip/Tooltip';
|
|
15
15
|
export { Popover } from './atoms/Popover/Popover';
|
|
16
16
|
export type { PopoverProps } from './atoms/Popover/Popover';
|
package/dist/main.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type { InputProps } from './atoms/Input/Input';
|
|
|
16
16
|
export { InputEndAdornmentButton } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
|
|
17
17
|
export type { InputEndAdornmentButtonProps } from './atoms/InputEndAdornmentButton/InputEndAdornmentButton';
|
|
18
18
|
export { Select } from './atoms/Select/Select';
|
|
19
|
-
export type { SelectProps } from './atoms/Select/Select';
|
|
19
|
+
export type { SelectProps, SelectOption, SelectOptionGroup } from './atoms/Select/Select';
|
|
20
20
|
export { Account } from './molecules/Account/Account';
|
|
21
21
|
export type { AccountProps } from './molecules/Account/Account';
|
|
22
22
|
export { Avatar } from './molecules/Avatar/Avatar';
|