@mattermost/compass-ui 0.1.0-alpha.16 → 0.1.0-alpha.18
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/dist/components/error-message/ErrorMessage.cjs +1 -1
- package/dist/components/error-message/ErrorMessage.cjs.map +1 -1
- package/dist/components/error-message/ErrorMessage.d.ts +2 -3
- package/dist/components/error-message/ErrorMessage.d.ts.map +1 -1
- package/dist/components/error-message/ErrorMessage.js +16 -14
- package/dist/components/error-message/ErrorMessage.js.map +1 -1
- package/dist/components/field/FieldClearButton.cjs +2 -0
- package/dist/components/field/FieldClearButton.cjs.map +1 -0
- package/dist/components/field/FieldClearButton.css +1 -0
- package/dist/components/field/FieldClearButton.d.ts +17 -0
- package/dist/components/field/FieldClearButton.d.ts.map +1 -0
- package/dist/components/field/FieldClearButton.js +40 -0
- package/dist/components/field/FieldClearButton.js.map +1 -0
- package/dist/components/field/FieldClearButton.module.scss.cjs +2 -0
- package/dist/components/field/FieldClearButton.module.scss.cjs.map +1 -0
- package/dist/components/field/FieldClearButton.module.scss.js +7 -0
- package/dist/components/field/FieldClearButton.module.scss.js.map +1 -0
- package/dist/components/field/fieldDescribedBy.cjs +2 -0
- package/dist/components/field/fieldDescribedBy.cjs.map +1 -0
- package/dist/components/field/fieldDescribedBy.d.ts +11 -0
- package/dist/components/field/fieldDescribedBy.d.ts.map +1 -0
- package/dist/components/field/fieldDescribedBy.js +15 -0
- package/dist/components/field/fieldDescribedBy.js.map +1 -0
- package/dist/components/field/useFieldClear.cjs +2 -0
- package/dist/components/field/useFieldClear.cjs.map +1 -0
- package/dist/components/field/useFieldClear.d.ts +21 -0
- package/dist/components/field/useFieldClear.d.ts.map +1 -0
- package/dist/components/field/useFieldClear.js +73 -0
- package/dist/components/field/useFieldClear.js.map +1 -0
- package/dist/components/field-message/FieldMessage.cjs +2 -0
- package/dist/components/field-message/FieldMessage.cjs.map +1 -0
- package/dist/components/field-message/FieldMessage.css +1 -0
- package/dist/components/field-message/FieldMessage.d.ts +17 -0
- package/dist/components/field-message/FieldMessage.d.ts.map +1 -0
- package/dist/components/field-message/FieldMessage.js +28 -0
- package/dist/components/field-message/FieldMessage.js.map +1 -0
- package/dist/components/field-message/FieldMessage.module.scss.cjs +2 -0
- package/dist/components/field-message/FieldMessage.module.scss.cjs.map +1 -0
- package/dist/components/field-message/FieldMessage.module.scss.js +13 -0
- package/dist/components/field-message/FieldMessage.module.scss.js.map +1 -0
- package/dist/components/field-message/index.cjs +2 -0
- package/dist/components/field-message/index.cjs.map +1 -0
- package/dist/components/field-message/index.d.ts +3 -0
- package/dist/components/field-message/index.d.ts.map +1 -0
- package/dist/components/field-message/index.js +5 -0
- package/dist/components/field-message/index.js.map +1 -0
- package/dist/components/password-input/PasswordInput.cjs +2 -0
- package/dist/components/password-input/PasswordInput.cjs.map +1 -0
- package/dist/components/password-input/PasswordInput.css +1 -0
- package/dist/components/password-input/PasswordInput.d.ts +49 -0
- package/dist/components/password-input/PasswordInput.d.ts.map +1 -0
- package/dist/components/password-input/PasswordInput.js +140 -0
- package/dist/components/password-input/PasswordInput.js.map +1 -0
- package/dist/components/password-input/PasswordInput.module.scss.cjs +2 -0
- package/dist/components/password-input/PasswordInput.module.scss.cjs.map +1 -0
- package/dist/components/password-input/PasswordInput.module.scss.js +18 -0
- package/dist/components/password-input/PasswordInput.module.scss.js.map +1 -0
- package/dist/components/password-input/index.cjs +2 -0
- package/dist/components/password-input/index.cjs.map +1 -0
- package/dist/components/password-input/index.d.ts +3 -0
- package/dist/components/password-input/index.d.ts.map +1 -0
- package/dist/components/password-input/index.js +5 -0
- package/dist/components/password-input/index.js.map +1 -0
- package/dist/components/search-input/SearchInput.cjs +1 -1
- package/dist/components/search-input/SearchInput.cjs.map +1 -1
- package/dist/components/search-input/SearchInput.css +1 -1
- package/dist/components/search-input/SearchInput.d.ts +8 -0
- package/dist/components/search-input/SearchInput.d.ts.map +1 -1
- package/dist/components/search-input/SearchInput.js +114 -115
- package/dist/components/search-input/SearchInput.js.map +1 -1
- package/dist/components/search-input/SearchInput.module.scss.cjs +1 -1
- package/dist/components/search-input/SearchInput.module.scss.js +15 -16
- package/dist/components/search-input/SearchInput.module.scss.js.map +1 -1
- package/dist/components/section-notice/SectionNotice.css +1 -1
- package/dist/components/section-notice/SectionNotice.module.scss.cjs +1 -1
- package/dist/components/section-notice/SectionNotice.module.scss.js +12 -12
- package/dist/components/text-area/TextArea.cjs +1 -1
- package/dist/components/text-area/TextArea.cjs.map +1 -1
- package/dist/components/text-area/TextArea.css +1 -1
- package/dist/components/text-area/TextArea.d.ts +8 -0
- package/dist/components/text-area/TextArea.d.ts.map +1 -1
- package/dist/components/text-area/TextArea.js +86 -67
- package/dist/components/text-area/TextArea.js.map +1 -1
- package/dist/components/text-area/TextArea.module.scss.cjs +1 -1
- package/dist/components/text-area/TextArea.module.scss.js +12 -10
- package/dist/components/text-area/TextArea.module.scss.js.map +1 -1
- package/dist/components/text-input/TextInput.cjs +1 -1
- package/dist/components/text-input/TextInput.cjs.map +1 -1
- package/dist/components/text-input/TextInput.css +1 -1
- package/dist/components/text-input/TextInput.d.ts +38 -1
- package/dist/components/text-input/TextInput.d.ts.map +1 -1
- package/dist/components/text-input/TextInput.js +149 -93
- package/dist/components/text-input/TextInput.js.map +1 -1
- package/dist/components/text-input/TextInput.module.scss.cjs +1 -1
- package/dist/components/text-input/TextInput.module.scss.js +19 -14
- package/dist/components/text-input/TextInput.module.scss.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +133 -129
- package/dist/index.js.map +1 -1
- package/package.json +7 -1
- package/dist/components/error-message/ErrorMessage.css +0 -1
- package/dist/components/error-message/ErrorMessage.module.scss.cjs +0 -2
- package/dist/components/error-message/ErrorMessage.module.scss.cjs.map +0 -1
- package/dist/components/error-message/ErrorMessage.module.scss.js +0 -9
- package/dist/components/error-message/ErrorMessage.module.scss.js.map +0 -1
|
@@ -1,130 +1,129 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { toKebab as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ie, useId as ne, useRef as te, useState as j, useCallback as r } from "react";
|
|
3
|
+
import { toKebab as le } from "../../utils/string.js";
|
|
4
|
+
import ce from "../icon/Icon.js";
|
|
5
|
+
import __oe from "@mattermost/compass-icons/components/magnify.js";const oe=__oe&&__oe.default?__oe.default:__oe;
|
|
6
|
+
import re from "../field/FieldClearButton.js";
|
|
7
|
+
import { mergeFieldDescribedBy as de, hasFieldMessage as ue, isFieldInvalid as he } from "../field/fieldDescribedBy.js";
|
|
8
|
+
import { useFieldClear as me } from "../field/useFieldClear.js";
|
|
9
|
+
import pe from "../field-message/FieldMessage.js";
|
|
10
|
+
import e from "./SearchInput.module.scss.js";
|
|
11
|
+
const fe = {
|
|
10
12
|
small: "12",
|
|
11
13
|
medium: "16",
|
|
12
14
|
large: "20"
|
|
13
|
-
},
|
|
14
|
-
small: "12",
|
|
15
|
-
medium: "16",
|
|
16
|
-
large: "16"
|
|
17
|
-
}, _e = P(
|
|
15
|
+
}, Me = ie(
|
|
18
16
|
function({
|
|
19
|
-
className:
|
|
20
|
-
size:
|
|
21
|
-
label:
|
|
22
|
-
invalid:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
x(!1), d == null || d(e);
|
|
17
|
+
className: D = "",
|
|
18
|
+
size: d = "medium",
|
|
19
|
+
label: u,
|
|
20
|
+
invalid: K = !1,
|
|
21
|
+
message: h,
|
|
22
|
+
messageTone: v,
|
|
23
|
+
onClear: V,
|
|
24
|
+
clearLabel: k = "Clear search",
|
|
25
|
+
clearButtonProps: t,
|
|
26
|
+
id: z,
|
|
27
|
+
value: m,
|
|
28
|
+
defaultValue: I,
|
|
29
|
+
placeholder: E,
|
|
30
|
+
onFocus: l,
|
|
31
|
+
onBlur: c,
|
|
32
|
+
onChange: o,
|
|
33
|
+
disabled: b,
|
|
34
|
+
readOnly: _,
|
|
35
|
+
onKeyDown: $,
|
|
36
|
+
"aria-describedby": A,
|
|
37
|
+
...L
|
|
38
|
+
}, n) {
|
|
39
|
+
const T = ne(), p = z ?? T, C = te(null), i = m !== void 0, [U, g] = j(
|
|
40
|
+
I ?? ""
|
|
41
|
+
), y = i ? m : U, F = y != null && y !== "", [Z, N] = j(!1), q = Z || F, G = r(
|
|
42
|
+
(s) => {
|
|
43
|
+
N(!0), l == null || l(s);
|
|
47
44
|
},
|
|
48
|
-
[
|
|
49
|
-
),
|
|
50
|
-
(
|
|
51
|
-
|
|
45
|
+
[l]
|
|
46
|
+
), H = r(
|
|
47
|
+
(s) => {
|
|
48
|
+
N(!1), c == null || c(s);
|
|
52
49
|
},
|
|
53
|
-
[
|
|
54
|
-
), w =
|
|
55
|
-
(
|
|
56
|
-
|
|
50
|
+
[c]
|
|
51
|
+
), w = r(
|
|
52
|
+
(s) => {
|
|
53
|
+
i || g(s.target.value), o == null || o(s);
|
|
57
54
|
},
|
|
58
|
-
[
|
|
59
|
-
),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (p) {
|
|
63
|
-
p(), (R = I.current) == null || R.focus();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const e = I.current;
|
|
67
|
-
e != null && (e.value = "", l || C(""), a == null || a({
|
|
68
|
-
target: e,
|
|
69
|
-
currentTarget: e
|
|
70
|
-
}), e.focus());
|
|
71
|
-
}, [c, l, a, p]), G = n(
|
|
72
|
-
(e) => {
|
|
73
|
-
m == null || m(e), !(e.defaultPrevented || c) && e.key === "Escape" && o && (e.preventDefault(), v());
|
|
55
|
+
[i, o]
|
|
56
|
+
), J = r(
|
|
57
|
+
(s) => {
|
|
58
|
+
C.current = s, typeof n == "function" ? n(s) : n && (n.current = s);
|
|
74
59
|
},
|
|
75
|
-
[
|
|
76
|
-
),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
[n]
|
|
61
|
+
), { showClearButton: x, handleClear: O, handleKeyDown: Q } = me({
|
|
62
|
+
disabled: !!(b || _),
|
|
63
|
+
hasValue: F,
|
|
64
|
+
clearEnabled: !0,
|
|
65
|
+
isControlled: i,
|
|
66
|
+
onClear: V,
|
|
67
|
+
onChange: w,
|
|
68
|
+
onKeyDown: $,
|
|
69
|
+
inputRef: C,
|
|
70
|
+
setUncontrolledValue: g
|
|
71
|
+
}), M = he(K, h, v), S = ue(h), W = e[`search-input--size-${le(d)}`], X = M ? e["search-input--invalid"] : "", Y = u != null && q ? e["search-input--label-floated"] : "", B = e["search-input--has-leading-icon"], P = x ? e["search-input--has-trailing-icon"] : "", ee = fe[d], se = [
|
|
72
|
+
e["search-input"],
|
|
81
73
|
W,
|
|
82
74
|
X,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
75
|
+
Y,
|
|
76
|
+
B,
|
|
77
|
+
P,
|
|
78
|
+
D
|
|
79
|
+
].filter(Boolean).join(" "), R = S ? `${p}-message` : void 0, ae = v ?? "error";
|
|
80
|
+
return /* @__PURE__ */ f("div", { className: se, children: [
|
|
81
|
+
/* @__PURE__ */ f("div", { className: e["search-input__wrapper"], children: [
|
|
82
|
+
u != null && /* @__PURE__ */ a("label", { className: e["search-input__label"], htmlFor: p, children: u }),
|
|
83
|
+
/* @__PURE__ */ f("div", { className: e["search-input__inner"], children: [
|
|
84
|
+
/* @__PURE__ */ a("span", { className: e["search-input__leading-icon"], "aria-hidden": !0, children: /* @__PURE__ */ a(ce, { size: ee, glyph: /* @__PURE__ */ a(oe, {}) }) }),
|
|
85
|
+
/* @__PURE__ */ a(
|
|
86
|
+
"input",
|
|
87
|
+
{
|
|
88
|
+
ref: J,
|
|
89
|
+
id: p,
|
|
90
|
+
type: "search",
|
|
91
|
+
className: e["search-input__input"],
|
|
92
|
+
value: i ? m : void 0,
|
|
93
|
+
defaultValue: i ? void 0 : I,
|
|
94
|
+
placeholder: E,
|
|
95
|
+
disabled: b,
|
|
96
|
+
readOnly: _,
|
|
97
|
+
onFocus: G,
|
|
98
|
+
onBlur: H,
|
|
99
|
+
onChange: w,
|
|
100
|
+
onKeyDown: Q,
|
|
101
|
+
"aria-invalid": M ? !0 : void 0,
|
|
102
|
+
"aria-describedby": de(
|
|
103
|
+
A,
|
|
104
|
+
R,
|
|
105
|
+
void 0
|
|
106
|
+
),
|
|
107
|
+
...L
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
x && /* @__PURE__ */ a("span", { className: e["search-input__trailing-icon"], children: /* @__PURE__ */ a(
|
|
111
|
+
re,
|
|
112
|
+
{
|
|
113
|
+
size: d,
|
|
114
|
+
clearLabel: k,
|
|
115
|
+
clearButtonProps: t,
|
|
116
|
+
onClick: O,
|
|
117
|
+
tabIndex: (t == null ? void 0 : t.tabIndex) ?? -1
|
|
118
|
+
}
|
|
119
|
+
) })
|
|
120
|
+
] })
|
|
121
|
+
] }),
|
|
122
|
+
S && /* @__PURE__ */ a(pe, { id: R, message: h, tone: ae })
|
|
123
|
+
] });
|
|
125
124
|
}
|
|
126
125
|
);
|
|
127
126
|
export {
|
|
128
|
-
|
|
127
|
+
Me as default
|
|
129
128
|
};
|
|
130
129
|
//# sourceMappingURL=SearchInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sources":["../../../src/components/search-input/SearchInput.tsx"],"sourcesContent":["import type {\n ChangeEvent,\n InputHTMLAttributes,\n KeyboardEvent,\n ReactNode,\n} from 'react';\nimport { forwardRef, useId, useState, useCallback, useRef } from 'react';\nimport { toKebab } from '@/utils/string';\nimport type { IconSize } from '@/components/icon/Icon';\nimport Icon from '@/components/icon/Icon';\nimport MagnifyIcon from '@mattermost/compass-icons/components/magnify';\nimport CloseCircleIcon from '@mattermost/compass-icons/components/close-circle';\nimport type { BuiltInButtonProps } from '@/utils/props';\nimport { mergeClassNames } from '@/utils/props';\nimport styles from './SearchInput.module.scss';\n\nexport type SearchInputSize = 'small' | 'medium' | 'large';\n\nconst ICON_SIZE_MAP: Record<SearchInputSize, IconSize> = {\n small: '12',\n medium: '16',\n large: '20',\n};\n\nconst CLEAR_ICON_SIZE_MAP: Record<SearchInputSize, IconSize> = {\n small: '12',\n medium: '16',\n large: '16',\n};\n\nexport interface SearchInputProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'type'\n> {\n /** Optional CSS class name. */\n className?: string;\n /** When true, shows invalid/error styling. */\n invalid?: boolean;\n /** Floating label (placeholder-style). Floats above border when filled. */\n label?: ReactNode;\n /** Size variant. Default: Medium. */\n size?: SearchInputSize;\n /** Called when the clear button is pressed. Omit to use built-in clearing. */\n onClear?: () => void;\n /** Accessible name for the clear button. Default: \"Clear search\". */\n clearLabel?: string;\n /** Extra attributes for the clear button (e.g. `data-testid`). */\n clearButtonProps?: BuiltInButtonProps;\n}\n\n/**\n * Search Inputs are the entry point to filtering or finding content — global search, channel\n * switcher, member picker, file finder. They look like a text input with a leading magnifier\n * so the affordance is obvious before the user reads a single word.\n */\nconst SearchInput = forwardRef<HTMLInputElement, SearchInputProps>(\n function SearchInput(\n {\n className = '',\n size = 'medium',\n label,\n invalid = false,\n onClear,\n clearLabel = 'Clear search',\n clearButtonProps,\n id: idProp,\n value: valueProp,\n defaultValue,\n placeholder,\n onFocus,\n onBlur,\n onChange,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n ) {\n const generatedId = useId();\n const id = idProp ?? generatedId;\n const inputRef = useRef<HTMLInputElement>(null);\n\n const isControlled = valueProp !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(\n defaultValue ?? '',\n );\n const value = isControlled ? (valueProp as string) : uncontrolledValue;\n const hasValue = value != null && value !== '';\n\n const [isFocused, setIsFocused] = useState(false);\n const labelFloated = isFocused || hasValue;\n\n const handleFocus = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true);\n onFocus?.(e);\n },\n [onFocus],\n );\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false);\n onBlur?.(e);\n },\n [onBlur],\n );\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) setUncontrolledValue(e.target.value);\n onChange?.(e);\n },\n [isControlled, onChange],\n );\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n const handleClear = useCallback(() => {\n if (disabled) return;\n\n if (onClear) {\n onClear();\n inputRef.current?.focus();\n return;\n }\n\n const input = inputRef.current;\n if (input == null) return;\n\n input.value = '';\n if (!isControlled) setUncontrolledValue('');\n\n onChange?.({\n target: input,\n currentTarget: input,\n } as ChangeEvent<HTMLInputElement>);\n\n input.focus();\n }, [disabled, isControlled, onChange, onClear]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented || disabled) return;\n if (e.key === 'Escape' && hasValue) {\n e.preventDefault();\n handleClear();\n }\n },\n [disabled, handleClear, hasValue, onKeyDown],\n );\n\n const showClearButton = hasValue && !disabled;\n\n const sizeClass = styles[`search-input--size-${toKebab(size)}`];\n const invalidClass = invalid ? styles['search-input--invalid'] : '';\n const labelFloatedClass =\n label != null && labelFloated\n ? styles['search-input--label-floated']\n : '';\n const hasLeadingClass = styles['search-input--has-leading-icon'];\n const hasTrailingClass = showClearButton\n ? styles['search-input--has-trailing-icon']\n : '';\n const iconSize = ICON_SIZE_MAP[size];\n const clearIconSize = CLEAR_ICON_SIZE_MAP[size];\n\n const rootClass = [\n styles['search-input'],\n sizeClass,\n invalidClass,\n labelFloatedClass,\n hasLeadingClass,\n hasTrailingClass,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass}>\n <div className={styles['search-input__wrapper']}>\n {label != null && (\n <label className={styles['search-input__label']} htmlFor={id}>\n {label}\n </label>\n )}\n <div className={styles['search-input__inner']}>\n <span className={styles['search-input__leading-icon']} aria-hidden>\n <Icon size={iconSize} glyph={<MagnifyIcon />} />\n </span>\n <input\n ref={setInputRef}\n id={id}\n type=\"search\"\n className={styles['search-input__input']}\n value={isControlled ? valueProp : undefined}\n defaultValue={isControlled ? undefined : defaultValue}\n placeholder={placeholder}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n aria-invalid={invalid ? true : undefined}\n {...rest}\n />\n {showClearButton && (\n <span className={styles['search-input__trailing-icon']}>\n <button\n {...clearButtonProps}\n type=\"button\"\n className={mergeClassNames(\n styles['search-input__clear-button'],\n clearButtonProps?.className,\n )}\n onClick={handleClear}\n aria-label={clearLabel}\n tabIndex={clearButtonProps?.tabIndex ?? -1}\n >\n <Icon size={clearIconSize} glyph={<CloseCircleIcon />} />\n </button>\n </span>\n )}\n </div>\n </div>\n </div>\n );\n },\n);\n\nexport default SearchInput;\n"],"names":["ICON_SIZE_MAP","CLEAR_ICON_SIZE_MAP","SearchInput","forwardRef","className","size","label","invalid","onClear","clearLabel","clearButtonProps","idProp","valueProp","defaultValue","placeholder","onFocus","onBlur","onChange","disabled","onKeyDown","rest","ref","generatedId","useId","id","inputRef","useRef","isControlled","uncontrolledValue","setUncontrolledValue","useState","value","hasValue","isFocused","setIsFocused","labelFloated","handleFocus","useCallback","handleBlur","handleChange","setInputRef","node","handleClear","_a","input","handleKeyDown","showClearButton","sizeClass","styles","toKebab","invalidClass","labelFloatedClass","hasLeadingClass","hasTrailingClass","iconSize","clearIconSize","rootClass","jsx","jsxs","Icon","MagnifyIcon","mergeClassNames","CloseCircleIcon"],"mappings":";;;;;;;;AAkBA,MAAMA,KAAmD;AAAA,EACvD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT,GAEMC,KAAyD;AAAA,EAC7D,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT,GA2BMC,KAAcC;AAAA,EAClB,SACE;AAAA,IACE,WAAAC,IAAY;AAAA,IACZ,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,SAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,kBAAAC;AAAA,IACA,IAAIC;AAAA,IACJ,OAAOC;AAAA,IACP,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,GACA;AACA,UAAMC,IAAcC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CAAY,GAAI,GAChD;AAAA,QACA,gBAAAH;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKjB;AAAA,YACL,IAAAhB;AAAA,YACA,MAAK;AAAA,YACL,WAAWwB,EAAO,qBAAqB;AAAA,YACvC,OAAOrB,IAAef,IAAY;AAAA,YAClC,cAAce,IAAe,SAAYd;AAAA,YACzC,aAAAC;AAAA,YACA,UAAAI;AAAA,YACA,SAASkB;AAAA,YACT,QAAQE;AAAA,YACR,UAAUC;AAAA,YACV,WAAWM;AAAA,YACX,gBAActC,IAAU,KAAO;AAAA,YAC9B,GAAGa;AAAA,UAAA;AAAA,QAAA;AAAA,QAEL0B,KACC,gBAAAW,EAAC,QAAA,EAAK,WAAWT,EAAO,6BAA6B,GACnD,UAAA,gBAAAS;AAAA,UAAC;AAAA,UAAA;AAAA,YACE,GAAG/C;AAAA,YACJ,MAAK;AAAA,YACL,WAAWmD;AAAA,cACTb,EAAO,4BAA4B;AAAA,cACnCtC,KAAA,gBAAAA,EAAkB;AAAA,YAAA;AAAA,YAEpB,SAASgC;AAAA,YACT,cAAYjC;AAAA,YACZ,WAAUC,KAAA,gBAAAA,EAAkB,aAAY;AAAA,YAExC,4BAACiD,GAAA,EAAK,MAAMJ,GAAe,OAAO,gBAAAE,EAACK,MAAgB,EAAA,CAAI;AAAA,UAAA;AAAA,QAAA,EACzD,CACF;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,EAEJ;AACF;"}
|
|
1
|
+
{"version":3,"file":"SearchInput.js","sources":["../../../src/components/search-input/SearchInput.tsx"],"sourcesContent":["import type {\n ChangeEvent,\n InputHTMLAttributes,\n KeyboardEvent,\n ReactNode,\n} from 'react';\nimport { forwardRef, useId, useState, useCallback, useRef } from 'react';\nimport { toKebab } from '@/utils/string';\nimport type { IconSize } from '@/components/icon/Icon';\nimport Icon from '@/components/icon/Icon';\nimport MagnifyIcon from '@mattermost/compass-icons/components/magnify';\nimport FieldClearButton from '@/components/field/FieldClearButton';\nimport {\n hasFieldMessage,\n isFieldInvalid,\n mergeFieldDescribedBy,\n} from '@/components/field/fieldDescribedBy';\nimport { useFieldClear } from '@/components/field/useFieldClear';\nimport FieldMessage from '@/components/field-message/FieldMessage';\nimport type { FieldMessageTone } from '@/components/field-message/FieldMessage';\nimport type { BuiltInButtonProps } from '@/utils/props';\nimport styles from './SearchInput.module.scss';\n\nexport type SearchInputSize = 'small' | 'medium' | 'large';\n\nconst ICON_SIZE_MAP: Record<SearchInputSize, IconSize> = {\n small: '12',\n medium: '16',\n large: '20',\n};\n\nexport interface SearchInputProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'type'\n> {\n /** Optional CSS class name. */\n className?: string;\n /** When true, shows invalid/error styling. */\n invalid?: boolean;\n /** Floating label (placeholder-style). Floats above border when filled. */\n label?: ReactNode;\n /** Size variant. Default: Medium. */\n size?: SearchInputSize;\n /**\n * Field message under the field. Accepts translated nodes (e.g. `<FormattedMessage/>`).\n * Defaults to error tone (invalid chrome) when set without `messageTone`.\n */\n message?: ReactNode;\n /** Visual tone for `message`. Default: `error` when `message` is set. */\n messageTone?: FieldMessageTone;\n /** Called when the clear button is pressed. Omit to use built-in clearing. */\n onClear?: () => void;\n /** Accessible name for the clear button. Default: \"Clear search\". */\n clearLabel?: string;\n /** Extra attributes for the clear button (e.g. `data-testid`). */\n clearButtonProps?: BuiltInButtonProps;\n}\n\n/**\n * Search Inputs are the entry point to filtering or finding content — global search, channel\n * switcher, member picker, file finder. They look like a text input with a leading magnifier\n * so the affordance is obvious before the user reads a single word.\n */\nconst SearchInput = forwardRef<HTMLInputElement, SearchInputProps>(\n function SearchInput(\n {\n className = '',\n size = 'medium',\n label,\n invalid = false,\n message,\n messageTone,\n onClear,\n clearLabel = 'Clear search',\n clearButtonProps,\n id: idProp,\n value: valueProp,\n defaultValue,\n placeholder,\n onFocus,\n onBlur,\n onChange,\n disabled,\n readOnly,\n onKeyDown,\n 'aria-describedby': describedBy,\n ...rest\n },\n ref,\n ) {\n const generatedId = useId();\n const id = idProp ?? generatedId;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const isControlled = valueProp !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(\n defaultValue ?? '',\n );\n const value = isControlled ? (valueProp as string) : uncontrolledValue;\n const hasValue = value != null && value !== '';\n\n const [isFocused, setIsFocused] = useState(false);\n const labelFloated = isFocused || hasValue;\n\n const handleFocus = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true);\n onFocus?.(e);\n },\n [onFocus],\n );\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false);\n onBlur?.(e);\n },\n [onBlur],\n );\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) setUncontrolledValue(e.target.value);\n onChange?.(e);\n },\n [isControlled, onChange],\n );\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n const { showClearButton, handleClear, handleKeyDown } = useFieldClear({\n disabled: Boolean(disabled || readOnly),\n hasValue,\n clearEnabled: true,\n isControlled,\n onClear,\n onChange: handleChange,\n onKeyDown: onKeyDown as\n | ((e: KeyboardEvent<HTMLInputElement>) => void)\n | undefined,\n inputRef,\n setUncontrolledValue,\n });\n\n const showInvalid = isFieldInvalid(invalid, message, messageTone);\n const showMessage = hasFieldMessage(message);\n const sizeClass = styles[`search-input--size-${toKebab(size)}`];\n const invalidClass = showInvalid ? styles['search-input--invalid'] : '';\n const labelFloatedClass =\n label != null && labelFloated\n ? styles['search-input--label-floated']\n : '';\n const hasLeadingClass = styles['search-input--has-leading-icon'];\n const hasTrailingClass = showClearButton\n ? styles['search-input--has-trailing-icon']\n : '';\n const iconSize = ICON_SIZE_MAP[size];\n\n const rootClass = [\n styles['search-input'],\n sizeClass,\n invalidClass,\n labelFloatedClass,\n hasLeadingClass,\n hasTrailingClass,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const messageId = showMessage ? `${id}-message` : undefined;\n const resolvedTone = messageTone ?? 'error';\n\n return (\n <div className={rootClass}>\n <div className={styles['search-input__wrapper']}>\n {label != null && (\n <label className={styles['search-input__label']} htmlFor={id}>\n {label}\n </label>\n )}\n <div className={styles['search-input__inner']}>\n <span className={styles['search-input__leading-icon']} aria-hidden>\n <Icon size={iconSize} glyph={<MagnifyIcon />} />\n </span>\n <input\n ref={setInputRef}\n id={id}\n type=\"search\"\n className={styles['search-input__input']}\n value={isControlled ? valueProp : undefined}\n defaultValue={isControlled ? undefined : defaultValue}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n aria-invalid={showInvalid ? true : undefined}\n aria-describedby={mergeFieldDescribedBy(\n describedBy,\n messageId,\n undefined,\n )}\n {...rest}\n />\n {showClearButton && (\n <span className={styles['search-input__trailing-icon']}>\n <FieldClearButton\n size={size}\n clearLabel={clearLabel}\n clearButtonProps={clearButtonProps}\n onClick={handleClear}\n tabIndex={clearButtonProps?.tabIndex ?? -1}\n />\n </span>\n )}\n </div>\n </div>\n {showMessage && (\n <FieldMessage id={messageId} message={message} tone={resolvedTone} />\n )}\n </div>\n );\n },\n);\n\nexport default SearchInput;\n"],"names":["ICON_SIZE_MAP","SearchInput","forwardRef","className","size","label","invalid","message","messageTone","onClear","clearLabel","clearButtonProps","idProp","valueProp","defaultValue","placeholder","onFocus","onBlur","onChange","disabled","readOnly","onKeyDown","describedBy","rest","ref","generatedId","useId","id","inputRef","useRef","isControlled","uncontrolledValue","setUncontrolledValue","useState","value","hasValue","isFocused","setIsFocused","labelFloated","handleFocus","useCallback","e","handleBlur","handleChange","setInputRef","node","showClearButton","handleClear","handleKeyDown","useFieldClear","showInvalid","isFieldInvalid","showMessage","hasFieldMessage","sizeClass","styles","toKebab","invalidClass","labelFloatedClass","hasLeadingClass","hasTrailingClass","iconSize","rootClass","messageId","resolvedTone","jsxs","jsx","Icon","MagnifyIcon","mergeFieldDescribedBy","FieldClearButton","FieldMessage"],"mappings":";;;;;;;;;;AAyBA,MAAMA,KAAmD;AAAA,EACvD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT,GAkCMC,KAAcC;AAAA,EAClB,SACE;AAAA,IACE,WAAAC,IAAY;AAAA,IACZ,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,kBAAAC;AAAA,IACA,IAAIC;AAAA,IACJ,OAAOC;AAAA,IACP,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,oBAAoBC;AAAA,IACpB,GAAGC;AAAA,EAAA,GAELC,GACA;AACA,UAAMC,IAAcC,GAAA,GACdC,IAAKf,KAAUa,GACfG,IAAWC,GAAgC,IAAI,GAE/CC,IAAejB,MAAc,QAC7B,CAACkB,GAAmBC,CAAoB,IAAIC;AAAA,MAChDnB,KAAgB;AAAA,IAAA,GAEZoB,IAAQJ,IAAgBjB,IAAuBkB,GAC/CI,IAAWD,KAAS,QAAQA,MAAU,IAEtC,CAACE,GAAWC,CAAY,IAAIJ,EAAS,EAAK,GAC1CK,IAAeF,KAAaD,GAE5BI,IAAcC;AAAA,MAClB,CAACC,MAA0C;AACzC,QAAAJ,EAAa,EAAI,GACjBrB,KAAA,QAAAA,EAAUyB;AAAA,MACZ;AAAA,MACA,CAACzB,CAAO;AAAA,IAAA,GAEJ0B,IAAaF;AAAA,MACjB,CAACC,MAA0C;AACzC,QAAAJ,EAAa,EAAK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AY;AAAA,YAAA;AAAA,UAAA,EAC1C,CACF;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA,GACF;AAAA,MACCyC,KACC,gBAAAc,EAACK,IAAA,EAAa,IAAIR,GAAW,SAAAxD,GAAkB,MAAMyD,GAAA,CAAc;AAAA,IAAA,GAEvE;AAAA,EAEJ;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./SearchInput.css');const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./SearchInput.css');const _={"search-input":"_search-input_1h7hr_2","search-input__wrapper":"_search-input__wrapper_1h7hr_8","search-input__input":"_search-input__input_1h7hr_18","search-input__label":"_search-input__label_1h7hr_28","search-input--label-floated":"_search-input--label-floated_1h7hr_48","search-input__inner":"_search-input__inner_1h7hr_55","search-input__leading-icon":"_search-input__leading-icon_1h7hr_86","search-input__trailing-icon":"_search-input__trailing-icon_1h7hr_86","search-input--size-small":"_search-input--size-small_1h7hr_100","search-input--size-medium":"_search-input--size-medium_1h7hr_116","search-input--size-large":"_search-input--size-large_1h7hr_136","search-input--has-leading-icon":"_search-input--has-leading-icon_1h7hr_157","search-input--invalid":"_search-input--invalid_1h7hr_181"};exports.default=_;
|
|
2
2
|
//# sourceMappingURL=SearchInput.module.scss.cjs.map
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import './SearchInput.css';const
|
|
2
|
-
"search-input": "_search-
|
|
3
|
-
"search-input__wrapper": "_search-
|
|
4
|
-
"search-input__input": "_search-
|
|
5
|
-
"search-input__label": "_search-
|
|
6
|
-
"search-input--label-floated": "_search-input--label-
|
|
7
|
-
"search-input__inner": "_search-
|
|
8
|
-
"search-input__leading-icon": "_search-input__leading-
|
|
9
|
-
"search-input__trailing-icon": "_search-input__trailing-
|
|
10
|
-
"search-
|
|
11
|
-
"search-input--size-
|
|
12
|
-
"search-input--size-
|
|
13
|
-
"search-input--
|
|
14
|
-
"search-input--
|
|
15
|
-
"search-input--invalid": "_search-input--invalid_1iq6i_189"
|
|
1
|
+
import './SearchInput.css';const _ = {
|
|
2
|
+
"search-input": "_search-input_1h7hr_2",
|
|
3
|
+
"search-input__wrapper": "_search-input__wrapper_1h7hr_8",
|
|
4
|
+
"search-input__input": "_search-input__input_1h7hr_18",
|
|
5
|
+
"search-input__label": "_search-input__label_1h7hr_28",
|
|
6
|
+
"search-input--label-floated": "_search-input--label-floated_1h7hr_48",
|
|
7
|
+
"search-input__inner": "_search-input__inner_1h7hr_55",
|
|
8
|
+
"search-input__leading-icon": "_search-input__leading-icon_1h7hr_86",
|
|
9
|
+
"search-input__trailing-icon": "_search-input__trailing-icon_1h7hr_86",
|
|
10
|
+
"search-input--size-small": "_search-input--size-small_1h7hr_100",
|
|
11
|
+
"search-input--size-medium": "_search-input--size-medium_1h7hr_116",
|
|
12
|
+
"search-input--size-large": "_search-input--size-large_1h7hr_136",
|
|
13
|
+
"search-input--has-leading-icon": "_search-input--has-leading-icon_1h7hr_157",
|
|
14
|
+
"search-input--invalid": "_search-input--invalid_1h7hr_181"
|
|
16
15
|
};
|
|
17
16
|
export {
|
|
18
|
-
|
|
17
|
+
_ as default
|
|
19
18
|
};
|
|
20
19
|
//# sourceMappingURL=SearchInput.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchInput.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._section-
|
|
1
|
+
._section-notice_1x4j7_2{display:flex;flex-direction:column;align-items:flex-end;position:relative;border-radius:var(--radius-s);border:1px solid rgba(var(--color-info-rgb),.16);background-color:rgba(var(--color-info-rgb),.04)}._section-notice__content_1x4j7_11{display:flex;align-items:flex-start;gap:var(--spacing-m);padding:var(--spacing-m);width:100%}._section-notice__icon_1x4j7_18{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--color-info)}._section-notice__body_1x4j7_25{display:flex;flex:1 0 0;flex-direction:column;gap:var(--spacing-xs);min-width:0;overflow:hidden;padding-right:var(--spacing-xl)}._section-notice__title_1x4j7_34._section-notice__title_1x4j7_34{margin:0;font-weight:var(--font-weight-semibold)}._section-notice__title_1x4j7_34{padding:0;font-family:var(--font-family-body);font-size:var(--font-size-100);line-height:var(--line-height-100);letter-spacing:var(--letter-spacing-normal);text-transform:none;color:var(--center-channel-color)}._section-notice__description_1x4j7_47{font-size:var(--font-size-100);font-weight:var(--font-weight-regular);line-height:var(--line-height-100);color:var(--center-channel-color)}._section-notice__actions_1x4j7_53{display:flex;align-items:center;gap:var(--spacing-s);padding:var(--spacing-xxs) 0}._section-notice__dismiss_1x4j7_59{position:absolute;top:var(--spacing-xxs);right:var(--spacing-xxs)}._section-notice--type-warning_1x4j7_64{background-color:rgba(var(--color-warning-rgb),.04);border-color:rgba(var(--color-warning-rgb),.16)}._section-notice--type-warning_1x4j7_64 ._section-notice__icon_1x4j7_18{color:var(--color-warning)}._section-notice--type-danger_1x4j7_71{background-color:rgba(var(--error-text-color-rgb, var(--color-danger-rgb)),.04);border-color:rgba(var(--error-text-color-rgb, var(--color-danger-rgb)),.16)}._section-notice--type-danger_1x4j7_71 ._section-notice__icon_1x4j7_18{color:var(--error-text, var(--color-danger))}._section-notice--type-success_1x4j7_78{background-color:rgba(var(--color-success-rgb),.04);border-color:rgba(var(--color-success-rgb),.16)}._section-notice--type-success_1x4j7_78 ._section-notice__icon_1x4j7_18{color:var(--color-success)}._section-notice--type-hint_1x4j7_85{background-color:rgba(var(--center-channel-color-rgb),.04);border-color:rgba(var(--center-channel-color-rgb),.16)}._section-notice--type-hint_1x4j7_85 ._section-notice__icon_1x4j7_18{color:rgba(var(--center-channel-color-rgb),.64)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./SectionNotice.css');const e={"section-notice":"_section-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./SectionNotice.css');const e={"section-notice":"_section-notice_1x4j7_2","section-notice__content":"_section-notice__content_1x4j7_11","section-notice__icon":"_section-notice__icon_1x4j7_18","section-notice__body":"_section-notice__body_1x4j7_25","section-notice__title":"_section-notice__title_1x4j7_34","section-notice__description":"_section-notice__description_1x4j7_47","section-notice__actions":"_section-notice__actions_1x4j7_53","section-notice__dismiss":"_section-notice__dismiss_1x4j7_59","section-notice--type-warning":"_section-notice--type-warning_1x4j7_64","section-notice--type-danger":"_section-notice--type-danger_1x4j7_71","section-notice--type-success":"_section-notice--type-success_1x4j7_78","section-notice--type-hint":"_section-notice--type-hint_1x4j7_85"};exports.default=e;
|
|
2
2
|
//# sourceMappingURL=SectionNotice.module.scss.cjs.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import './SectionNotice.css';const t = {
|
|
2
|
-
"section-notice": "_section-
|
|
3
|
-
"section-notice__content": "_section-
|
|
4
|
-
"section-notice__icon": "_section-
|
|
5
|
-
"section-notice__body": "_section-
|
|
6
|
-
"section-notice__title": "_section-
|
|
7
|
-
"section-notice__description": "_section-
|
|
8
|
-
"section-notice__actions": "_section-
|
|
9
|
-
"section-notice__dismiss": "_section-
|
|
10
|
-
"section-notice--type-warning": "_section-notice--type-
|
|
11
|
-
"section-notice--type-danger": "_section-notice--type-
|
|
12
|
-
"section-notice--type-success": "_section-notice--type-
|
|
13
|
-
"section-notice--type-hint": "_section-notice--type-
|
|
2
|
+
"section-notice": "_section-notice_1x4j7_2",
|
|
3
|
+
"section-notice__content": "_section-notice__content_1x4j7_11",
|
|
4
|
+
"section-notice__icon": "_section-notice__icon_1x4j7_18",
|
|
5
|
+
"section-notice__body": "_section-notice__body_1x4j7_25",
|
|
6
|
+
"section-notice__title": "_section-notice__title_1x4j7_34",
|
|
7
|
+
"section-notice__description": "_section-notice__description_1x4j7_47",
|
|
8
|
+
"section-notice__actions": "_section-notice__actions_1x4j7_53",
|
|
9
|
+
"section-notice__dismiss": "_section-notice__dismiss_1x4j7_59",
|
|
10
|
+
"section-notice--type-warning": "_section-notice--type-warning_1x4j7_64",
|
|
11
|
+
"section-notice--type-danger": "_section-notice--type-danger_1x4j7_71",
|
|
12
|
+
"section-notice--type-success": "_section-notice--type-success_1x4j7_78",
|
|
13
|
+
"section-notice--type-hint": "_section-notice--type-hint_1x4j7_85"
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
16
|
t as default
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("react"),_=require("../field/fieldDescribedBy.cjs"),X=require("../field-message/FieldMessage.cjs"),Y=require("../../utils/string.cjs"),e=require("./TextArea.module.scss.cjs"),Z=s.forwardRef(function({className:F="",size:g="medium",label:u,invalid:M=!1,maxLength:l,showCharacterCount:f=!1,message:v,messageTone:j,id:h,value:x,defaultValue:m,placeholder:p,onFocus:i,onBlur:r,onChange:c,disabled:S,readOnly:T,rows:k=3,"aria-describedby":A,...R},V){const $=s.useId(),o=h??$,d=x!==void 0,[w,z]=s.useState(m??""),n=d?x:w,D=n!=null&&n!=="",[C,I]=s.useState(!1),K=C||D,O=s.useCallback(a=>{I(!0),i==null||i(a)},[i]),U=s.useCallback(a=>{I(!1),r==null||r(a)},[r]),B=s.useCallback(a=>{d||z(a.target.value),c==null||c(a)},[d,c]),N=_.isFieldInvalid(M,v,j),b=_.hasFieldMessage(v),E=e.default[`text-area--size-${Y.toKebab(g)}`],G=N?e.default["text-area--invalid"]:"",H=u!=null&&K?e.default["text-area--label-floated"]:"",J=[e.default["text-area"],E,G,H,F].filter(Boolean).join(" "),Q=typeof n=="string"?n.length:0,q=f&&l!=null?`${o}-counter`:void 0,y=b?`${o}-message`:void 0,W=j??"error";return t.jsxs("div",{className:J,children:[t.jsxs("div",{className:e.default["text-area__wrapper"],children:[u!=null&&t.jsx("label",{className:e.default["text-area__label"],htmlFor:o,children:u}),t.jsx("textarea",{ref:V,id:o,className:e.default["text-area__input"],value:d?x:void 0,defaultValue:d?void 0:m,placeholder:p,maxLength:l,disabled:S,readOnly:T,rows:k,"aria-invalid":N?!0:void 0,"aria-describedby":_.mergeFieldDescribedBy(A,y,q),onFocus:O,onBlur:U,onChange:B,...R})]}),(b||f&&l!=null)&&t.jsxs("div",{className:e.default["text-area__footer"],children:[b&&t.jsx(X.default,{id:y,className:e.default["text-area__footer-message"],message:v,tone:W}),f&&l!=null&&t.jsxs("div",{id:q,className:e.default["text-area__counter"],"aria-live":"polite",children:[Q," / ",l]})]})]})});exports.default=Z;
|
|
2
2
|
//# sourceMappingURL=TextArea.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.cjs","sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import type { TextareaHTMLAttributes, ReactNode, ChangeEvent } from 'react';\nimport { forwardRef, useId, useState, useCallback } from 'react';\nimport { toKebab } from '@/utils/string';\nimport styles from './TextArea.module.scss';\n\nexport type TextAreaSize = 'small' | 'medium' | 'large';\n\nexport interface TextAreaProps extends Omit<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n 'size'\n> {\n /** Optional CSS class name. */\n className?: string;\n /** When true, shows invalid/error styling. */\n invalid?: boolean;\n /** Floating label content. When provided, label floats on focus or when value is non-empty. */\n label?: ReactNode;\n /** Max length for the textarea; used with showCharacterCount for counter. */\n maxLength?: number;\n /** When true with maxLength, shows \"current / max\" character count below textarea. */\n showCharacterCount?: boolean;\n /** Size variant. Default: Medium. */\n size?: TextAreaSize;\n}\n\n/**\n * Text Areas let people write long-form text that spans multiple lines — descriptions,\n * channel purposes, message drafts, admin notes. They share their visual rhythm with Text\n * Input but trade the single-line constraint for room to breathe.\n */\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(\n {\n className = '',\n size = 'medium',\n label,\n invalid = false,\n maxLength,\n showCharacterCount = false,\n id: idProp,\n value: valueProp,\n defaultValue,\n placeholder,\n onFocus,\n onBlur,\n onChange,\n disabled,\n readOnly,\n rows = 3,\n 'aria-describedby': describedBy,\n ...rest\n },\n ref,\n ) {\n const generatedId = useId();\n const id = idProp ?? generatedId;\n\n const isControlled = valueProp !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(\n defaultValue ?? '',\n );\n const value = isControlled ? (valueProp as string) : uncontrolledValue;\n const hasValue = value != null && value !== '';\n\n const [isFocused, setIsFocused] = useState(false);\n const labelFloated = isFocused || hasValue;\n\n const handleFocus = useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true);\n onFocus?.(e);\n },\n [onFocus],\n );\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(false);\n onBlur?.(e);\n },\n [onBlur],\n );\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) setUncontrolledValue(e.target.value);\n onChange?.(e);\n },\n [isControlled, onChange],\n );\n\n const sizeClass = styles[`text-area--size-${toKebab(size)}`];\n const invalidClass =
|
|
1
|
+
{"version":3,"file":"TextArea.cjs","sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import type { TextareaHTMLAttributes, ReactNode, ChangeEvent } from 'react';\nimport { forwardRef, useId, useState, useCallback } from 'react';\nimport {\n hasFieldMessage,\n isFieldInvalid,\n mergeFieldDescribedBy,\n} from '@/components/field/fieldDescribedBy';\nimport FieldMessage from '@/components/field-message/FieldMessage';\nimport type { FieldMessageTone } from '@/components/field-message/FieldMessage';\nimport { toKebab } from '@/utils/string';\nimport styles from './TextArea.module.scss';\n\nexport type TextAreaSize = 'small' | 'medium' | 'large';\n\nexport interface TextAreaProps extends Omit<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n 'size'\n> {\n /** Optional CSS class name. */\n className?: string;\n /** When true, shows invalid/error styling. */\n invalid?: boolean;\n /** Floating label content. When provided, label floats on focus or when value is non-empty. */\n label?: ReactNode;\n /** Max length for the textarea; used with showCharacterCount for counter. */\n maxLength?: number;\n /** When true with maxLength, shows \"current / max\" character count below textarea. */\n showCharacterCount?: boolean;\n /** Size variant. Default: Medium. */\n size?: TextAreaSize;\n /**\n * Field message under the field. Accepts translated nodes (e.g. `<FormattedMessage/>`).\n * Defaults to error tone (invalid chrome) when set without `messageTone`.\n */\n message?: ReactNode;\n /** Visual tone for `message`. Default: `error` when `message` is set. */\n messageTone?: FieldMessageTone;\n}\n\n/**\n * Text Areas let people write long-form text that spans multiple lines — descriptions,\n * channel purposes, message drafts, admin notes. They share their visual rhythm with Text\n * Input but trade the single-line constraint for room to breathe.\n */\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(\n {\n className = '',\n size = 'medium',\n label,\n invalid = false,\n maxLength,\n showCharacterCount = false,\n message,\n messageTone,\n id: idProp,\n value: valueProp,\n defaultValue,\n placeholder,\n onFocus,\n onBlur,\n onChange,\n disabled,\n readOnly,\n rows = 3,\n 'aria-describedby': describedBy,\n ...rest\n },\n ref,\n ) {\n const generatedId = useId();\n const id = idProp ?? generatedId;\n\n const isControlled = valueProp !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(\n defaultValue ?? '',\n );\n const value = isControlled ? (valueProp as string) : uncontrolledValue;\n const hasValue = value != null && value !== '';\n\n const [isFocused, setIsFocused] = useState(false);\n const labelFloated = isFocused || hasValue;\n\n const handleFocus = useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true);\n onFocus?.(e);\n },\n [onFocus],\n );\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(false);\n onBlur?.(e);\n },\n [onBlur],\n );\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) setUncontrolledValue(e.target.value);\n onChange?.(e);\n },\n [isControlled, onChange],\n );\n\n const showInvalid = isFieldInvalid(invalid, message, messageTone);\n const showMessage = hasFieldMessage(message);\n const sizeClass = styles[`text-area--size-${toKebab(size)}`];\n const invalidClass = showInvalid ? styles['text-area--invalid'] : '';\n const labelFloatedClass =\n label != null && labelFloated ? styles['text-area--label-floated'] : '';\n\n const rootClass = [\n styles['text-area'],\n sizeClass,\n invalidClass,\n labelFloatedClass,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const currentLength = typeof value === 'string' ? value.length : 0;\n const counterId =\n showCharacterCount && maxLength != null ? `${id}-counter` : undefined;\n const messageId = showMessage ? `${id}-message` : undefined;\n const resolvedTone = messageTone ?? 'error';\n\n return (\n <div className={rootClass}>\n <div className={styles['text-area__wrapper']}>\n {label != null && (\n <label className={styles['text-area__label']} htmlFor={id}>\n {label}\n </label>\n )}\n <textarea\n ref={ref}\n id={id}\n className={styles['text-area__input']}\n value={isControlled ? valueProp : undefined}\n defaultValue={isControlled ? undefined : defaultValue}\n placeholder={placeholder}\n maxLength={maxLength}\n disabled={disabled}\n readOnly={readOnly}\n rows={rows}\n aria-invalid={showInvalid ? true : undefined}\n aria-describedby={mergeFieldDescribedBy(\n describedBy,\n messageId,\n counterId,\n )}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n {...rest}\n />\n </div>\n {(showMessage || (showCharacterCount && maxLength != null)) && (\n <div className={styles['text-area__footer']}>\n {showMessage && (\n <FieldMessage\n id={messageId}\n className={styles['text-area__footer-message']}\n message={message}\n tone={resolvedTone}\n />\n )}\n {showCharacterCount && maxLength != null && (\n <div\n id={counterId}\n className={styles['text-area__counter']}\n aria-live=\"polite\"\n >\n {currentLength} / {maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nexport default TextArea;\n"],"names":["TextArea","forwardRef","className","size","label","invalid","maxLength","showCharacterCount","message","messageTone","idProp","valueProp","defaultValue","placeholder","onFocus","onBlur","onChange","disabled","readOnly","rows","describedBy","rest","ref","generatedId","useId","id","isControlled","uncontrolledValue","setUncontrolledValue","useState","value","hasValue","isFocused","setIsFocused","labelFloated","handleFocus","useCallback","e","handleBlur","handleChange","showInvalid","isFieldInvalid","showMessage","hasFieldMessage","sizeClass","styles","toKebab","invalidClass","labelFloatedClass","rootClass","currentLength","counterId","messageId","resolvedTone","jsxs","jsx","mergeFieldDescribedBy","FieldMessage"],"mappings":"yUA4CMA,EAAWC,EAAAA,WACf,SACE,CACE,UAAAC,EAAY,GACZ,KAAAC,EAAO,SACP,MAAAC,EACA,QAAAC,EAAU,GACV,UAAAC,EACA,mBAAAC,EAAqB,GACrB,QAAAC,EACA,YAAAC,EACA,GAAIC,EACJ,MAAOC,EACP,aAAAC,EACA,YAAAC,EACA,QAAAC,EACA,OAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,KAAAC,EAAO,EACP,mBAAoBC,EACpB,GAAGC,CAAA,EAELC,EACA,CACA,MAAMC,EAAcC,EAAAA,MAAA,EACdC,EAAKf,GAAUa,EAEfG,EAAef,IAAc,OAC7B,CAACgB,EAAmBC,CAAoB,EAAIC,EAAAA,SAChDjB,GAAgB,EAAA,EAEZkB,EAAQJ,EAAgBf,EAAuBgB,EAC/CI,EAAWD,GAAS,MAAQA,IAAU,GAEtC,CAACE,EAAWC,CAAY,EAAIJ,EAAAA,SAAS,EAAK,EAC1CK,EAAeF,GAAaD,EAE5BI,EAAcC,EAAAA,YACjBC,GAA6C,CAC5CJ,EAAa,EAAI,EACjBnB,GAAA,MAAAA,EAAUuB,EACZ,EACA,CAACvB,CAAO,CAAA,EAEJwB,EAAaF,EAAAA,YAChBC,GAA6C,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AAO,OACnC,mBAAkBgB,EAAAA,sBAChBpC,EACAgC,EACAD,CAAA,EAEF,QAAShB,EACT,OAAQG,EACR,SAAUC,EACT,GAAGlB,CAAA,CAAA,CACN,EACF,GACEqB,GAAgBnC,GAAsBD,GAAa,cAClD,MAAA,CAAI,UAAWuC,EAAAA,QAAO,mBAAmB,EACvC,SAAA,CAAAH,GACCa,EAAAA,IAACE,EAAAA,QAAA,CACC,GAAIL,EACJ,UAAWP,EAAAA,QAAO,2BAA2B,EAC7C,QAAArC,EACA,KAAM6C,CAAA,CAAA,EAGT9C,GAAsBD,GAAa,MAClCgD,EAAAA,KAAC,MAAA,CACC,GAAIH,EACJ,UAAWN,EAAAA,QAAO,oBAAoB,EACtC,YAAU,SAET,SAAA,CAAAK,EAAc,MAAI5C,CAAA,CAAA,CAAA,CACrB,CAAA,CAEJ,CAAA,EAEJ,CAEJ,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._text-
|
|
1
|
+
._text-area_r07x5_2{display:flex;flex-direction:column;gap:var(--spacing-xs);width:100%}._text-area__wrapper_r07x5_8{position:relative;background-color:var(--center-channel-bg);border-radius:var(--radius-s);box-shadow:inset 0 0 0 1px rgba(var(--center-channel-color-rgb),.16);transition:box-shadow var(--duration-quick) var(--ease-transition)}._text-area_r07x5_2:has(._text-area__input_r07x5_15:not(:disabled)):hover:not(:focus-within) ._text-area__wrapper_r07x5_8{box-shadow:inset 0 0 0 1px rgba(var(--center-channel-color-rgb),.24)}._text-area_r07x5_2:has(._text-area__input_r07x5_15:focus-visible) ._text-area__wrapper_r07x5_8{box-shadow:inset 0 0 0 1px var(--focus-ring-color),0 0 0 1px var(--focus-ring-color)}._text-area_r07x5_2:has(._text-area__input_r07x5_15:disabled) ._text-area__wrapper_r07x5_8{background-color:var(--center-channel-bg);opacity:.56}._text-area__label_r07x5_25{position:absolute;left:var(--spacing-xs);top:var(--spacing-s);padding:0 var(--spacing-xxxs);margin:0;font-family:Open Sans,sans-serif;font-size:var(--font-size-100);line-height:var(--line-height-100);font-weight:var(--font-weight-regular);color:rgba(var(--center-channel-color-rgb),.64);background-color:var(--center-channel-bg);pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 24px);transition:font-size var(--duration-quick) var(--ease-transition),top var(--duration-quick) var(--ease-transition),color var(--duration-quick) var(--ease-transition)}._text-area--label-floated_r07x5_44 ._text-area__label_r07x5_25{top:0;transform:translateY(-50%);font-size:var(--font-size-25);line-height:14px;color:rgba(var(--center-channel-color-rgb),.64)}._text-area__input_r07x5_15{display:block;width:100%;margin:0;border:0;background:transparent;resize:vertical;font-family:Open Sans,sans-serif;font-size:var(--font-size-100);line-height:var(--line-height-100);font-weight:var(--font-weight-regular);color:var(--center-channel-color);box-sizing:border-box}._text-area__input_r07x5_15:focus{outline:none}._text-area__input_r07x5_15::placeholder{color:rgba(var(--center-channel-color-rgb),.64)}._text-area__input_r07x5_15:disabled{cursor:not-allowed;resize:none}._text-area__footer_r07x5_75{display:flex;align-items:flex-start;gap:var(--spacing-xs);width:100%}._text-area__footer-message_r07x5_81{flex:1 1 0;min-width:0}._text-area__counter_r07x5_85{flex-shrink:0;margin-inline-start:auto;font-family:Open Sans,sans-serif;font-size:var(--font-size-75);font-weight:var(--font-weight-regular);line-height:var(--line-height-75);color:rgba(var(--center-channel-color-rgb),.64)}._text-area--size-small_r07x5_94 ._text-area__input_r07x5_15{padding:var(--spacing-xs) var(--spacing-m);font-size:var(--font-size-75);line-height:var(--line-height-75)}._text-area--size-small_r07x5_94 ._text-area__label_r07x5_25{top:var(--spacing-xs);font-size:var(--font-size-75);line-height:var(--line-height-25)}._text-area--size-small_r07x5_94._text-area--label-floated_r07x5_44 ._text-area__label_r07x5_25{top:0;font-size:var(--font-size-25);line-height:14px}._text-area--size-medium_r07x5_109 ._text-area__input_r07x5_15{padding:var(--spacing-s) var(--spacing-l);font-size:var(--font-size-100);line-height:var(--line-height-100)}._text-area--size-medium_r07x5_109 ._text-area__label_r07x5_25{top:var(--spacing-s);left:var(--spacing-m);font-size:var(--font-size-100)}._text-area--size-medium_r07x5_109._text-area--label-floated_r07x5_44 ._text-area__label_r07x5_25{top:0;font-size:var(--font-size-25);line-height:14px}._text-area--size-large_r07x5_124 ._text-area__input_r07x5_15{padding:var(--spacing-m) var(--spacing-l);font-size:var(--font-size-200);line-height:var(--line-height-200)}._text-area--size-large_r07x5_124 ._text-area__label_r07x5_25{top:var(--spacing-m);left:var(--spacing-m);font-size:var(--font-size-200);line-height:var(--line-height-200)}._text-area--size-large_r07x5_124._text-area--label-floated_r07x5_44 ._text-area__label_r07x5_25{top:0;font-size:var(--font-size-25);line-height:14px}._text-area_r07x5_2:has(._text-area__input_r07x5_15:focus-visible) ._text-area__label_r07x5_25{color:var(--button-bg)}._text-area_r07x5_2:has(._text-area__label_r07x5_25):not(._text-area--label-floated_r07x5_44) ._text-area__input_r07x5_15::placeholder{color:transparent}._text-area--invalid_r07x5_146 ._text-area__wrapper_r07x5_8{box-shadow:inset 0 0 0 1px var(--error-text, var(--color-danger))}._text-area--invalid_r07x5_146:has(._text-area__input_r07x5_15:focus-visible) ._text-area__wrapper_r07x5_8{box-shadow:inset 0 0 0 1px var(--error-text, var(--color-danger)),0 0 0 1px var(--error-text, var(--color-danger))}._text-area--invalid_r07x5_146 ._text-area__label_r07x5_25{color:var(--error-text, var(--color-danger))}._text-area--invalid_r07x5_146:has(._text-area__input_r07x5_15:focus-visible) ._text-area__label_r07x5_25{color:var(--error-text, var(--color-danger))}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TextareaHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { FieldMessageTone } from '../field-message/FieldMessage';
|
|
2
3
|
export type TextAreaSize = 'small' | 'medium' | 'large';
|
|
3
4
|
export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
|
|
4
5
|
/** Optional CSS class name. */
|
|
@@ -13,6 +14,13 @@ export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaE
|
|
|
13
14
|
showCharacterCount?: boolean;
|
|
14
15
|
/** Size variant. Default: Medium. */
|
|
15
16
|
size?: TextAreaSize;
|
|
17
|
+
/**
|
|
18
|
+
* Field message under the field. Accepts translated nodes (e.g. `<FormattedMessage/>`).
|
|
19
|
+
* Defaults to error tone (invalid chrome) when set without `messageTone`.
|
|
20
|
+
*/
|
|
21
|
+
message?: ReactNode;
|
|
22
|
+
/** Visual tone for `message`. Default: `error` when `message` is set. */
|
|
23
|
+
messageTone?: FieldMessageTone;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Text Areas let people write long-form text that spans multiple lines — descriptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/text-area/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/text-area/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAQ5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAI/E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExD,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,MAAM,CACP;IACC,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+FAA+F;IAC/F,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qCAAqC;IACrC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,yEAAyE;IACzE,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;GAIG;AACH,QAAA,MAAM,QAAQ,+GA2Ib,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|