@charcoal-ui/react 3.4.0 → 3.5.0
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/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +4 -0
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/components/TextField/useFocusWithClick.d.ts +3 -0
- package/dist/components/TextField/useFocusWithClick.d.ts.map +1 -0
- package/dist/index.cjs.js +201 -184
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +156 -139
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +88 -245
- package/src/components/TextArea/index.tsx +38 -43
- package/src/components/TextField/TextField.story.tsx +2 -3
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +258 -455
- package/src/components/TextField/index.tsx +86 -84
- package/src/components/TextField/useFocusWithClick.tsx +22 -0
package/dist/index.cjs.js
CHANGED
|
@@ -849,7 +849,7 @@ var SwitchInput = import_styled_components8.default.input.attrs({
|
|
|
849
849
|
// src/components/TextField/index.tsx
|
|
850
850
|
var import_textfield = require("@react-aria/textfield");
|
|
851
851
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
852
|
-
var
|
|
852
|
+
var import_react9 = require("react");
|
|
853
853
|
var React5 = __toESM(require("react"));
|
|
854
854
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
855
855
|
|
|
@@ -903,6 +903,25 @@ var FieldLabelWrapper = import_styled_components9.default.div`
|
|
|
903
903
|
}
|
|
904
904
|
`;
|
|
905
905
|
|
|
906
|
+
// src/components/TextField/useFocusWithClick.tsx
|
|
907
|
+
var import_react8 = require("react");
|
|
908
|
+
function useFocusWithClick(containerRef, inputRef) {
|
|
909
|
+
(0, import_react8.useEffect)(() => {
|
|
910
|
+
const el = containerRef.current;
|
|
911
|
+
if (el) {
|
|
912
|
+
const handleDown = (e) => {
|
|
913
|
+
if (e.target !== inputRef.current) {
|
|
914
|
+
inputRef.current?.focus();
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
el.addEventListener("click", handleDown);
|
|
918
|
+
return () => {
|
|
919
|
+
el.removeEventListener("click", handleDown);
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
|
|
906
925
|
// src/components/TextField/index.tsx
|
|
907
926
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
908
927
|
var TextField = React5.forwardRef(
|
|
@@ -923,16 +942,12 @@ var TextField = React5.forwardRef(
|
|
|
923
942
|
suffix = null
|
|
924
943
|
} = props;
|
|
925
944
|
const { visuallyHiddenProps } = (0, import_visually_hidden.useVisuallyHidden)();
|
|
926
|
-
const ariaRef = (0,
|
|
927
|
-
const
|
|
928
|
-
const suffixRef = (0, import_react8.useRef)(null);
|
|
929
|
-
const [count, setCount] = (0, import_react8.useState)(
|
|
945
|
+
const ariaRef = (0, import_react9.useRef)(null);
|
|
946
|
+
const [count, setCount] = (0, import_react9.useState)(
|
|
930
947
|
countCodePointsInString(props.value ?? "")
|
|
931
948
|
);
|
|
932
|
-
const [prefixWidth, setPrefixWidth] = (0, import_react8.useState)(0);
|
|
933
|
-
const [suffixWidth, setSuffixWidth] = (0, import_react8.useState)(0);
|
|
934
949
|
const nonControlled = props.value === void 0;
|
|
935
|
-
const handleChange = (0,
|
|
950
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
936
951
|
(value) => {
|
|
937
952
|
const count2 = countCodePointsInString(value);
|
|
938
953
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -945,7 +960,7 @@ var TextField = React5.forwardRef(
|
|
|
945
960
|
},
|
|
946
961
|
[maxLength, nonControlled, onChange]
|
|
947
962
|
);
|
|
948
|
-
(0,
|
|
963
|
+
(0, import_react9.useEffect)(() => {
|
|
949
964
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
950
965
|
}, [props.value]);
|
|
951
966
|
const { inputProps, labelProps, descriptionProps, errorMessageProps } = (0, import_textfield.useTextField)(
|
|
@@ -961,24 +976,8 @@ var TextField = React5.forwardRef(
|
|
|
961
976
|
},
|
|
962
977
|
ariaRef
|
|
963
978
|
);
|
|
964
|
-
(0,
|
|
965
|
-
|
|
966
|
-
setPrefixWidth(entries[0].contentRect.width);
|
|
967
|
-
});
|
|
968
|
-
const suffixObserver = new ResizeObserver((entries) => {
|
|
969
|
-
setSuffixWidth(entries[0].contentRect.width);
|
|
970
|
-
});
|
|
971
|
-
if (prefixRef.current !== null) {
|
|
972
|
-
prefixObserver.observe(prefixRef.current);
|
|
973
|
-
}
|
|
974
|
-
if (suffixRef.current !== null) {
|
|
975
|
-
suffixObserver.observe(suffixRef.current);
|
|
976
|
-
}
|
|
977
|
-
return () => {
|
|
978
|
-
suffixObserver.disconnect();
|
|
979
|
-
prefixObserver.disconnect();
|
|
980
|
-
};
|
|
981
|
-
}, []);
|
|
979
|
+
const containerRef = (0, import_react9.useRef)(null);
|
|
980
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
982
981
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
983
982
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
984
983
|
TextFieldLabel,
|
|
@@ -991,23 +990,31 @@ var TextField = React5.forwardRef(
|
|
|
991
990
|
...!showLabel ? visuallyHiddenProps : {}
|
|
992
991
|
}
|
|
993
992
|
),
|
|
994
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
994
|
+
StyledInputContainer,
|
|
995
|
+
{
|
|
996
|
+
ref: containerRef,
|
|
997
|
+
invalid,
|
|
998
|
+
"aria-disabled": disabled === true ? true : void 0,
|
|
999
|
+
hasPrefix: prefix != null,
|
|
1000
|
+
hasSuffix: suffix != null || showCount,
|
|
1001
|
+
children: [
|
|
1002
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PrefixContainer, { children: prefix }),
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1004
|
+
StyledInput,
|
|
1005
|
+
{
|
|
1006
|
+
ref: mergeRefs(forwardRef18, ariaRef),
|
|
1007
|
+
invalid,
|
|
1008
|
+
...inputProps
|
|
1009
|
+
}
|
|
1010
|
+
),
|
|
1011
|
+
(suffix || showCount) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(SuffixContainer, { children: [
|
|
1012
|
+
suffix,
|
|
1013
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
1014
|
+
] })
|
|
1015
|
+
]
|
|
1016
|
+
}
|
|
1017
|
+
),
|
|
1011
1018
|
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1012
1019
|
AssistiveText,
|
|
1013
1020
|
{
|
|
@@ -1027,34 +1034,53 @@ var TextFieldRoot = import_styled_components10.default.div`
|
|
|
1027
1034
|
${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
|
|
1028
1035
|
`;
|
|
1029
1036
|
var TextFieldLabel = (0, import_styled_components10.default)(FieldLabel_default)`
|
|
1030
|
-
|
|
1037
|
+
margin-bottom: 8px;
|
|
1031
1038
|
`;
|
|
1032
1039
|
var StyledInputContainer = import_styled_components10.default.div`
|
|
1033
|
-
height: 40px;
|
|
1034
1040
|
display: grid;
|
|
1035
|
-
|
|
1041
|
+
grid-template-columns: ${(p) => [p.hasPrefix && "auto", "1fr", p.hasSuffix && "auto"].filter(Boolean).join(" ")};
|
|
1042
|
+
height: 40px;
|
|
1043
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
1044
|
+
color: var(--charcoal-text2);
|
|
1045
|
+
background-color: var(--charcoal-surface3);
|
|
1046
|
+
border-radius: 4px;
|
|
1047
|
+
gap: 4px;
|
|
1048
|
+
padding: 0 8px;
|
|
1049
|
+
line-height: 22px;
|
|
1050
|
+
font-size: 14px;
|
|
1051
|
+
|
|
1052
|
+
:not(:disabled):not([aria-disabled]):hover,
|
|
1053
|
+
[aria-disabled='false']:hover {
|
|
1054
|
+
background-color: var(--charcoal-surface3-hover);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
:not(:disabled):not([aria-disabled]):active,
|
|
1058
|
+
[aria-disabled='false']:active {
|
|
1059
|
+
outline: none;
|
|
1060
|
+
box-shadow: 0 0 0 4px
|
|
1061
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
:focus-within {
|
|
1065
|
+
outline: none;
|
|
1066
|
+
box-shadow: 0 0 0 4px
|
|
1067
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
${(p) => p.invalid && import_styled_components10.css`
|
|
1071
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1072
|
+
`}
|
|
1036
1073
|
`;
|
|
1037
|
-
var PrefixContainer = import_styled_components10.default.
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
transform: translateY(-50%);
|
|
1042
|
-
z-index: 1;
|
|
1074
|
+
var PrefixContainer = import_styled_components10.default.div`
|
|
1075
|
+
display: flex;
|
|
1076
|
+
padding-left: 8px;
|
|
1077
|
+
align-items: center;
|
|
1043
1078
|
`;
|
|
1044
1079
|
var SuffixContainer = import_styled_components10.default.span`
|
|
1045
|
-
position: absolute;
|
|
1046
|
-
top: 50%;
|
|
1047
|
-
right: 8px;
|
|
1048
|
-
transform: translateY(-50%);
|
|
1049
|
-
|
|
1050
1080
|
display: flex;
|
|
1081
|
+
align-items: center;
|
|
1051
1082
|
gap: 8px;
|
|
1052
1083
|
`;
|
|
1053
|
-
var Affix = import_styled_components10.default.span`
|
|
1054
|
-
user-select: none;
|
|
1055
|
-
|
|
1056
|
-
${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}
|
|
1057
|
-
`;
|
|
1058
1084
|
var StyledInput = import_styled_components10.default.input`
|
|
1059
1085
|
border: none;
|
|
1060
1086
|
box-sizing: border-box;
|
|
@@ -1068,43 +1094,39 @@ var StyledInput = import_styled_components10.default.input`
|
|
|
1068
1094
|
height: calc(100% / 0.875);
|
|
1069
1095
|
font-size: calc(14px / 0.875);
|
|
1070
1096
|
line-height: calc(22px / 0.875);
|
|
1071
|
-
padding-left:
|
|
1072
|
-
padding-right:
|
|
1097
|
+
padding-left: 0;
|
|
1098
|
+
padding-right: 0;
|
|
1073
1099
|
border-radius: calc(4px / 0.875);
|
|
1074
1100
|
|
|
1075
1101
|
/* Display box-shadow for iOS Safari */
|
|
1076
1102
|
appearance: none;
|
|
1103
|
+
background: transparent;
|
|
1077
1104
|
|
|
1078
|
-
|
|
1079
|
-
o.bg.surface3.hover,
|
|
1080
|
-
o.outline.default.focus,
|
|
1081
|
-
p.invalid && o.outline.assertive,
|
|
1082
|
-
o.font.text2
|
|
1083
|
-
])}
|
|
1084
|
-
|
|
1105
|
+
color: var(--charcoal-text2);
|
|
1085
1106
|
&::placeholder {
|
|
1086
|
-
|
|
1107
|
+
color: var(--charcoal-text3);
|
|
1087
1108
|
}
|
|
1088
1109
|
`;
|
|
1089
1110
|
var SingleLineCounter = import_styled_components10.default.span`
|
|
1090
|
-
|
|
1111
|
+
line-height: 22px;
|
|
1112
|
+
font-size: 14px;
|
|
1113
|
+
color: var(--charcoal-text3);
|
|
1091
1114
|
`;
|
|
1092
1115
|
var AssistiveText = import_styled_components10.default.p`
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
])}
|
|
1116
|
+
font-size: 14px;
|
|
1117
|
+
line-height: 22px;
|
|
1118
|
+
margin-top: 4px;
|
|
1119
|
+
margin-bottom: -4px;
|
|
1120
|
+
color: ${(p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`};
|
|
1099
1121
|
`;
|
|
1100
1122
|
|
|
1101
1123
|
// src/components/TextArea/index.tsx
|
|
1102
1124
|
var import_textfield2 = require("@react-aria/textfield");
|
|
1103
1125
|
var import_visually_hidden2 = require("@react-aria/visually-hidden");
|
|
1104
|
-
var
|
|
1126
|
+
var import_react10 = require("react");
|
|
1105
1127
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
1106
1128
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1107
|
-
var TextArea = (0,
|
|
1129
|
+
var TextArea = (0, import_react10.forwardRef)(
|
|
1108
1130
|
function TextAreaInner({ onChange, ...props }, forwardRef18) {
|
|
1109
1131
|
const {
|
|
1110
1132
|
className,
|
|
@@ -1122,13 +1144,13 @@ var TextArea = (0, import_react9.forwardRef)(
|
|
|
1122
1144
|
rows: initialRows = 4
|
|
1123
1145
|
} = props;
|
|
1124
1146
|
const { visuallyHiddenProps } = (0, import_visually_hidden2.useVisuallyHidden)();
|
|
1125
|
-
const textareaRef = (0,
|
|
1126
|
-
const ariaRef = (0,
|
|
1127
|
-
const [count, setCount] = (0,
|
|
1147
|
+
const textareaRef = (0, import_react10.useRef)(null);
|
|
1148
|
+
const ariaRef = (0, import_react10.useRef)(null);
|
|
1149
|
+
const [count, setCount] = (0, import_react10.useState)(
|
|
1128
1150
|
countCodePointsInString(props.value ?? "")
|
|
1129
1151
|
);
|
|
1130
|
-
const [rows, setRows] = (0,
|
|
1131
|
-
const syncHeight = (0,
|
|
1152
|
+
const [rows, setRows] = (0, import_react10.useState)(initialRows);
|
|
1153
|
+
const syncHeight = (0, import_react10.useCallback)(
|
|
1132
1154
|
(textarea) => {
|
|
1133
1155
|
const rows2 = (`${textarea.value}
|
|
1134
1156
|
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
@@ -1137,7 +1159,7 @@ var TextArea = (0, import_react9.forwardRef)(
|
|
|
1137
1159
|
[initialRows]
|
|
1138
1160
|
);
|
|
1139
1161
|
const nonControlled = props.value === void 0;
|
|
1140
|
-
const handleChange = (0,
|
|
1162
|
+
const handleChange = (0, import_react10.useCallback)(
|
|
1141
1163
|
(value) => {
|
|
1142
1164
|
const count2 = countCodePointsInString(value);
|
|
1143
1165
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
@@ -1153,7 +1175,7 @@ var TextArea = (0, import_react9.forwardRef)(
|
|
|
1153
1175
|
},
|
|
1154
1176
|
[autoHeight, maxLength, nonControlled, onChange, syncHeight]
|
|
1155
1177
|
);
|
|
1156
|
-
(0,
|
|
1178
|
+
(0, import_react10.useEffect)(() => {
|
|
1157
1179
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
1158
1180
|
}, [props.value]);
|
|
1159
1181
|
const { inputProps, labelProps, descriptionProps, errorMessageProps } = (0, import_textfield2.useTextField)(
|
|
@@ -1169,14 +1191,16 @@ var TextArea = (0, import_react9.forwardRef)(
|
|
|
1169
1191
|
},
|
|
1170
1192
|
ariaRef
|
|
1171
1193
|
);
|
|
1172
|
-
(0,
|
|
1194
|
+
(0, import_react10.useEffect)(() => {
|
|
1173
1195
|
if (autoHeight && textareaRef.current !== null) {
|
|
1174
1196
|
syncHeight(textareaRef.current);
|
|
1175
1197
|
}
|
|
1176
1198
|
}, [autoHeight, syncHeight]);
|
|
1199
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
1200
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
1177
1201
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
1178
1202
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1179
|
-
|
|
1203
|
+
TextFieldLabel,
|
|
1180
1204
|
{
|
|
1181
1205
|
label,
|
|
1182
1206
|
requiredText,
|
|
@@ -1189,8 +1213,10 @@ var TextArea = (0, import_react9.forwardRef)(
|
|
|
1189
1213
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1190
1214
|
StyledTextareaContainer,
|
|
1191
1215
|
{
|
|
1216
|
+
ref: containerRef,
|
|
1192
1217
|
invalid,
|
|
1193
1218
|
rows: showCount ? rows + 1 : rows,
|
|
1219
|
+
"aria-disabled": disabled === true ? "true" : void 0,
|
|
1194
1220
|
children: [
|
|
1195
1221
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1196
1222
|
StyledTextarea,
|
|
@@ -1206,7 +1232,7 @@ var TextArea = (0, import_react9.forwardRef)(
|
|
|
1206
1232
|
}
|
|
1207
1233
|
),
|
|
1208
1234
|
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1209
|
-
|
|
1235
|
+
AssistiveText,
|
|
1210
1236
|
{
|
|
1211
1237
|
invalid,
|
|
1212
1238
|
...invalid ? errorMessageProps : descriptionProps,
|
|
@@ -1223,29 +1249,32 @@ var TextFieldRoot2 = import_styled_components11.default.div`
|
|
|
1223
1249
|
|
|
1224
1250
|
${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
|
|
1225
1251
|
`;
|
|
1226
|
-
var TextFieldLabel2 = (0, import_styled_components11.default)(FieldLabel_default)`
|
|
1227
|
-
${theme((o) => o.margin.bottom(8))}
|
|
1228
|
-
`;
|
|
1229
1252
|
var StyledTextareaContainer = import_styled_components11.default.div`
|
|
1230
1253
|
position: relative;
|
|
1231
1254
|
overflow: hidden;
|
|
1232
|
-
padding: 0 8px;
|
|
1233
1255
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
o.font.text2,
|
|
1239
|
-
o.borderRadius(4)
|
|
1240
|
-
])}
|
|
1241
|
-
|
|
1242
|
-
&:focus-within {
|
|
1243
|
-
${(p) => theme((o) => p.invalid ? o.outline.assertive : o.outline.default)}
|
|
1244
|
-
}
|
|
1256
|
+
color: var(--charcoal-text2);
|
|
1257
|
+
background-color: var(--charcoal-surface3);
|
|
1258
|
+
border-radius: 4px;
|
|
1259
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
1245
1260
|
|
|
1246
1261
|
${({ rows }) => import_styled_components11.css`
|
|
1247
1262
|
height: calc(22px * ${rows} + 18px);
|
|
1248
1263
|
`};
|
|
1264
|
+
|
|
1265
|
+
:not([aria-disabled]):hover,
|
|
1266
|
+
[aria-disabled='false']:hover {
|
|
1267
|
+
background-color: var(--charcoal-surface3-hover);
|
|
1268
|
+
}
|
|
1269
|
+
:focus-within {
|
|
1270
|
+
outline: none;
|
|
1271
|
+
box-shadow: 0 0 0 4px
|
|
1272
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
${(p) => p.invalid && import_styled_components11.css`
|
|
1276
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1277
|
+
`}
|
|
1249
1278
|
`;
|
|
1250
1279
|
var StyledTextarea = import_styled_components11.default.textarea`
|
|
1251
1280
|
border: none;
|
|
@@ -1253,6 +1282,7 @@ var StyledTextarea = import_styled_components11.default.textarea`
|
|
|
1253
1282
|
resize: none;
|
|
1254
1283
|
font-family: inherit;
|
|
1255
1284
|
color: inherit;
|
|
1285
|
+
box-sizing: border-box;
|
|
1256
1286
|
|
|
1257
1287
|
/* Prevent zooming for iOS Safari */
|
|
1258
1288
|
transform-origin: top left;
|
|
@@ -1260,10 +1290,11 @@ var StyledTextarea = import_styled_components11.default.textarea`
|
|
|
1260
1290
|
width: calc(100% / 0.875);
|
|
1261
1291
|
font-size: calc(14px / 0.875);
|
|
1262
1292
|
line-height: calc(22px / 0.875);
|
|
1263
|
-
padding: calc(9px / 0.875)
|
|
1293
|
+
padding: calc(9px / 0.875) calc(8px / 0.875)
|
|
1294
|
+
${(p) => p.noBottomPadding ? 0 : ""};
|
|
1264
1295
|
|
|
1265
|
-
${({ rows = 1 }) => import_styled_components11.css`
|
|
1266
|
-
height: calc(22px / 0.875 * ${rows});
|
|
1296
|
+
${({ rows = 1, noBottomPadding }) => import_styled_components11.css`
|
|
1297
|
+
height: calc(22px / 0.875 * ${rows} + ${noBottomPadding ? 9 : 20}px);
|
|
1267
1298
|
`};
|
|
1268
1299
|
|
|
1269
1300
|
/* Display box-shadow for iOS Safari */
|
|
@@ -1272,31 +1303,17 @@ var StyledTextarea = import_styled_components11.default.textarea`
|
|
|
1272
1303
|
background: none;
|
|
1273
1304
|
|
|
1274
1305
|
&::placeholder {
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
1279
|
-
&::-webkit-scrollbar {
|
|
1280
|
-
display: none;
|
|
1306
|
+
color: var(--charcoal-text3);
|
|
1281
1307
|
}
|
|
1282
|
-
/* Hide scrollbar for IE, Edge and Firefox */
|
|
1283
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
1284
|
-
scrollbar-width: none; /* Firefox */
|
|
1285
1308
|
`;
|
|
1286
1309
|
var MultiLineCounter = import_styled_components11.default.span`
|
|
1287
1310
|
position: absolute;
|
|
1288
1311
|
bottom: 9px;
|
|
1289
1312
|
right: 8px;
|
|
1290
1313
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
var
|
|
1294
|
-
${(p) => theme((o) => [
|
|
1295
|
-
o.typography(14),
|
|
1296
|
-
o.margin.top(8),
|
|
1297
|
-
o.margin.bottom(0),
|
|
1298
|
-
o.font[p.invalid ? "assertive" : "text1"]
|
|
1299
|
-
])}
|
|
1314
|
+
line-height: 22px;
|
|
1315
|
+
font-size: 14px;
|
|
1316
|
+
color: var(--charcoal-text3);
|
|
1300
1317
|
`;
|
|
1301
1318
|
|
|
1302
1319
|
// src/components/Icon/index.tsx
|
|
@@ -1319,17 +1336,17 @@ var Icon = React6.forwardRef(function IconInner({ name, scale, unsafeNonGuidelin
|
|
|
1319
1336
|
var Icon_default = Icon;
|
|
1320
1337
|
|
|
1321
1338
|
// src/components/Modal/index.tsx
|
|
1322
|
-
var
|
|
1339
|
+
var import_react12 = require("react");
|
|
1323
1340
|
var React9 = __toESM(require("react"));
|
|
1324
1341
|
var import_overlays2 = require("@react-aria/overlays");
|
|
1325
1342
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
1326
1343
|
var import_utils7 = require("@charcoal-ui/utils");
|
|
1327
|
-
var
|
|
1344
|
+
var import_styled10 = require("@charcoal-ui/styled");
|
|
1328
1345
|
var import_react_spring2 = require("react-spring");
|
|
1329
1346
|
var import_utils8 = require("@react-aria/utils");
|
|
1330
1347
|
|
|
1331
1348
|
// src/components/Modal/Dialog/index.tsx
|
|
1332
|
-
var
|
|
1349
|
+
var import_react11 = require("react");
|
|
1333
1350
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
1334
1351
|
var import_dialog = require("@react-aria/dialog");
|
|
1335
1352
|
|
|
@@ -1362,7 +1379,7 @@ function useForwardedRef(ref) {
|
|
|
1362
1379
|
|
|
1363
1380
|
// src/components/Modal/Dialog/index.tsx
|
|
1364
1381
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1365
|
-
var Dialog = (0,
|
|
1382
|
+
var Dialog = (0, import_react11.forwardRef)(function Dialog2(props, forwardRef18) {
|
|
1366
1383
|
const ref = useForwardedRef(forwardRef18);
|
|
1367
1384
|
const { dialogProps } = (0, import_dialog.useDialog)(
|
|
1368
1385
|
{
|
|
@@ -1433,7 +1450,7 @@ var ModalBackgroundContext = React8.createContext(
|
|
|
1433
1450
|
// src/components/Modal/index.tsx
|
|
1434
1451
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1435
1452
|
var DEFAULT_Z_INDEX = 10;
|
|
1436
|
-
var Modal = (0,
|
|
1453
|
+
var Modal = (0, import_react12.forwardRef)(function ModalInner({ children, zIndex = DEFAULT_Z_INDEX, portalContainer, ...props }, external) {
|
|
1437
1454
|
const {
|
|
1438
1455
|
title,
|
|
1439
1456
|
size = "M",
|
|
@@ -1459,7 +1476,7 @@ var Modal = (0, import_react11.forwardRef)(function ModalInner({ children, zInde
|
|
|
1459
1476
|
ref
|
|
1460
1477
|
);
|
|
1461
1478
|
const theme3 = (0, import_styled_components13.useTheme)();
|
|
1462
|
-
const isMobile = (0,
|
|
1479
|
+
const isMobile = (0, import_styled10.useMedia)((0, import_utils7.maxWidth)(theme3.breakpoint.screen1)) ?? false;
|
|
1463
1480
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
1464
1481
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
1465
1482
|
const transition = (0, import_react_spring2.useTransition)(isOpen, {
|
|
@@ -1530,7 +1547,7 @@ var Modal = (0, import_react11.forwardRef)(function ModalInner({ children, zInde
|
|
|
1530
1547
|
) })
|
|
1531
1548
|
);
|
|
1532
1549
|
});
|
|
1533
|
-
var Modal_default = (0,
|
|
1550
|
+
var Modal_default = (0, import_react12.memo)(Modal);
|
|
1534
1551
|
var ModalContext = React9.createContext({
|
|
1535
1552
|
titleProps: {},
|
|
1536
1553
|
title: "",
|
|
@@ -1568,7 +1585,7 @@ var ModalCrossButton = (0, import_styled_components13.default)(IconButton_defaul
|
|
|
1568
1585
|
${theme((o) => [o.font.text3.hover.press])}
|
|
1569
1586
|
`;
|
|
1570
1587
|
function ModalTitle(props) {
|
|
1571
|
-
const { titleProps, title } = (0,
|
|
1588
|
+
const { titleProps, title } = (0, import_react12.useContext)(ModalContext);
|
|
1572
1589
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1573
1590
|
}
|
|
1574
1591
|
var ModalHeading = import_styled_components13.default.h3`
|
|
@@ -1579,11 +1596,11 @@ var ModalHeading = import_styled_components13.default.h3`
|
|
|
1579
1596
|
|
|
1580
1597
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1581
1598
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
1582
|
-
var
|
|
1599
|
+
var import_react13 = require("react");
|
|
1583
1600
|
var import_utils9 = require("@charcoal-ui/utils");
|
|
1584
1601
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1585
1602
|
function ModalHeader() {
|
|
1586
|
-
const modalCtx = (0,
|
|
1603
|
+
const modalCtx = (0, import_react13.useContext)(ModalContext);
|
|
1587
1604
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledModalTitle, {}) });
|
|
1588
1605
|
}
|
|
1589
1606
|
var ModalHeaderRoot = import_styled_components14.default.div`
|
|
@@ -1615,10 +1632,10 @@ var ModalButtons = import_styled_components14.default.div`
|
|
|
1615
1632
|
`;
|
|
1616
1633
|
|
|
1617
1634
|
// src/components/LoadingSpinner/index.tsx
|
|
1618
|
-
var
|
|
1635
|
+
var import_react14 = require("react");
|
|
1619
1636
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1620
1637
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1621
|
-
var LoadingSpinner = (0,
|
|
1638
|
+
var LoadingSpinner = (0, import_react14.forwardRef)(
|
|
1622
1639
|
function LoadingSpinnerInner({ size = 48, padding = 16, transparent = false, className }, ref) {
|
|
1623
1640
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1624
1641
|
LoadingSpinnerRoot,
|
|
@@ -1633,7 +1650,7 @@ var LoadingSpinner = (0, import_react13.forwardRef)(
|
|
|
1633
1650
|
);
|
|
1634
1651
|
}
|
|
1635
1652
|
);
|
|
1636
|
-
var LoadingSpinner_default = (0,
|
|
1653
|
+
var LoadingSpinner_default = (0, import_react14.memo)(LoadingSpinner);
|
|
1637
1654
|
var LoadingSpinnerRoot = import_styled_components15.default.div.attrs({ role: "progressbar" })`
|
|
1638
1655
|
box-sizing: content-box;
|
|
1639
1656
|
margin: auto;
|
|
@@ -1671,10 +1688,10 @@ var Icon2 = import_styled_components15.default.div.attrs({ role: "presentation"
|
|
|
1671
1688
|
animation: none;
|
|
1672
1689
|
}
|
|
1673
1690
|
`;
|
|
1674
|
-
var LoadingSpinnerIcon = (0,
|
|
1691
|
+
var LoadingSpinnerIcon = (0, import_react14.forwardRef)(
|
|
1675
1692
|
function LoadingSpinnerIcon2({ once = false }, ref) {
|
|
1676
|
-
const iconRef = (0,
|
|
1677
|
-
(0,
|
|
1693
|
+
const iconRef = (0, import_react14.useRef)(null);
|
|
1694
|
+
(0, import_react14.useImperativeHandle)(ref, () => ({
|
|
1678
1695
|
restart: () => {
|
|
1679
1696
|
if (!iconRef.current) {
|
|
1680
1697
|
return;
|
|
@@ -1689,22 +1706,22 @@ var LoadingSpinnerIcon = (0, import_react13.forwardRef)(
|
|
|
1689
1706
|
);
|
|
1690
1707
|
|
|
1691
1708
|
// src/components/DropdownSelector/index.tsx
|
|
1692
|
-
var
|
|
1709
|
+
var import_react20 = require("react");
|
|
1693
1710
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
1694
1711
|
var import_utils10 = require("@charcoal-ui/utils");
|
|
1695
1712
|
|
|
1696
1713
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1697
|
-
var
|
|
1714
|
+
var import_react17 = require("react");
|
|
1698
1715
|
|
|
1699
1716
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1700
|
-
var
|
|
1717
|
+
var import_react16 = require("react");
|
|
1701
1718
|
var import_overlays3 = require("@react-aria/overlays");
|
|
1702
1719
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
1703
1720
|
|
|
1704
1721
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1705
|
-
var
|
|
1722
|
+
var import_react15 = require("react");
|
|
1706
1723
|
function usePreventScroll(element, isOpen) {
|
|
1707
|
-
(0,
|
|
1724
|
+
(0, import_react15.useEffect)(() => {
|
|
1708
1725
|
if (isOpen && element) {
|
|
1709
1726
|
const defaultPaddingRight = element.style.paddingRight;
|
|
1710
1727
|
const defaultOverflow = element.style.overflow;
|
|
@@ -1722,7 +1739,7 @@ function usePreventScroll(element, isOpen) {
|
|
|
1722
1739
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1723
1740
|
var _empty = () => null;
|
|
1724
1741
|
function Popover(props) {
|
|
1725
|
-
const defaultPopoverRef = (0,
|
|
1742
|
+
const defaultPopoverRef = (0, import_react16.useRef)(null);
|
|
1726
1743
|
const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
|
|
1727
1744
|
const { popoverProps, underlayProps } = (0, import_overlays3.usePopover)(
|
|
1728
1745
|
{
|
|
@@ -1738,7 +1755,7 @@ function Popover(props) {
|
|
|
1738
1755
|
toggle: _empty
|
|
1739
1756
|
}
|
|
1740
1757
|
);
|
|
1741
|
-
const modalBackground = (0,
|
|
1758
|
+
const modalBackground = (0, import_react16.useContext)(ModalBackgroundContext);
|
|
1742
1759
|
usePreventScroll(modalBackground, props.isOpen);
|
|
1743
1760
|
if (!props.isOpen)
|
|
1744
1761
|
return null;
|
|
@@ -1778,13 +1795,13 @@ var DropdownPopoverDiv = import_styled_components16.default.div`
|
|
|
1778
1795
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1779
1796
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1780
1797
|
function DropdownPopover({ children, ...props }) {
|
|
1781
|
-
const ref = (0,
|
|
1782
|
-
(0,
|
|
1798
|
+
const ref = (0, import_react17.useRef)(null);
|
|
1799
|
+
(0, import_react17.useEffect)(() => {
|
|
1783
1800
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1784
1801
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1785
1802
|
}
|
|
1786
1803
|
}, [props.triggerRef, props.isOpen]);
|
|
1787
|
-
(0,
|
|
1804
|
+
(0, import_react17.useEffect)(() => {
|
|
1788
1805
|
if (props.isOpen && props.value !== void 0) {
|
|
1789
1806
|
const windowScrollY = window.scrollY;
|
|
1790
1807
|
const windowScrollX = window.scrollX;
|
|
@@ -1835,12 +1852,12 @@ function findPreviewRecursive(children, value) {
|
|
|
1835
1852
|
}
|
|
1836
1853
|
|
|
1837
1854
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1838
|
-
var
|
|
1855
|
+
var import_react19 = require("react");
|
|
1839
1856
|
var import_styled_components17 = __toESM(require("styled-components"));
|
|
1840
1857
|
|
|
1841
1858
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1842
|
-
var
|
|
1843
|
-
var MenuListContext = (0,
|
|
1859
|
+
var import_react18 = require("react");
|
|
1860
|
+
var MenuListContext = (0, import_react18.createContext)({
|
|
1844
1861
|
root: void 0,
|
|
1845
1862
|
value: "",
|
|
1846
1863
|
values: [],
|
|
@@ -1870,7 +1887,7 @@ function getValuesRecursive(children, values = []) {
|
|
|
1870
1887
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1871
1888
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1872
1889
|
function MenuList(props) {
|
|
1873
|
-
const root = (0,
|
|
1890
|
+
const root = (0, import_react19.useRef)(null);
|
|
1874
1891
|
const values = [];
|
|
1875
1892
|
getValuesRecursive(props.children, values);
|
|
1876
1893
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyledUl, { ref: root, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -1897,8 +1914,8 @@ var StyledUl = import_styled_components17.default.ul`
|
|
|
1897
1914
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1898
1915
|
var defaultRequiredText = "*\u5FC5\u9808";
|
|
1899
1916
|
function DropdownSelector(props) {
|
|
1900
|
-
const triggerRef = (0,
|
|
1901
|
-
const [isOpen, setIsOpen] = (0,
|
|
1917
|
+
const triggerRef = (0, import_react20.useRef)(null);
|
|
1918
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
1902
1919
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
1903
1920
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
|
|
1904
1921
|
props.showLabel === true && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -2038,7 +2055,7 @@ var ItemDiv = import_styled_components19.default.div`
|
|
|
2038
2055
|
`;
|
|
2039
2056
|
|
|
2040
2057
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
2041
|
-
var
|
|
2058
|
+
var import_react21 = require("react");
|
|
2042
2059
|
|
|
2043
2060
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
2044
2061
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -2071,12 +2088,12 @@ function scrollIfNeeded(element) {
|
|
|
2071
2088
|
|
|
2072
2089
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
2073
2090
|
function useMenuItemHandleKeyDown(value) {
|
|
2074
|
-
const { setValue, root, values } = (0,
|
|
2075
|
-
const setContextValue = (0,
|
|
2091
|
+
const { setValue, root, values } = (0, import_react21.useContext)(MenuListContext);
|
|
2092
|
+
const setContextValue = (0, import_react21.useCallback)(() => {
|
|
2076
2093
|
if (value !== void 0)
|
|
2077
2094
|
setValue(value);
|
|
2078
2095
|
}, [value, setValue]);
|
|
2079
|
-
const handleKeyDown = (0,
|
|
2096
|
+
const handleKeyDown = (0, import_react21.useCallback)(
|
|
2080
2097
|
(e) => {
|
|
2081
2098
|
if (e.key === "Enter") {
|
|
2082
2099
|
setContextValue();
|
|
@@ -2123,10 +2140,10 @@ function MenuItem(props) {
|
|
|
2123
2140
|
}
|
|
2124
2141
|
|
|
2125
2142
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
2126
|
-
var
|
|
2143
|
+
var import_react22 = require("react");
|
|
2127
2144
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2128
2145
|
function DropdownMenuItem(props) {
|
|
2129
|
-
const { value: ctxValue } = (0,
|
|
2146
|
+
const { value: ctxValue } = (0, import_react22.useContext)(MenuListContext);
|
|
2130
2147
|
const isSelected = props.value === ctxValue;
|
|
2131
2148
|
const { children, ...rest } = props;
|
|
2132
2149
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(MenuItem, { ...rest, children: [
|
|
@@ -2174,16 +2191,16 @@ var StyledLi2 = import_styled_components21.default.li`
|
|
|
2174
2191
|
`;
|
|
2175
2192
|
|
|
2176
2193
|
// src/components/SegmentedControl/index.tsx
|
|
2177
|
-
var
|
|
2194
|
+
var import_react24 = require("react");
|
|
2178
2195
|
var import_react_stately2 = require("react-stately");
|
|
2179
2196
|
var import_radio = require("@react-aria/radio");
|
|
2180
2197
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2181
2198
|
var import_utils11 = require("@charcoal-ui/utils");
|
|
2182
2199
|
|
|
2183
2200
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
2184
|
-
var
|
|
2201
|
+
var import_react23 = require("react");
|
|
2185
2202
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2186
|
-
var RadioContext = (0,
|
|
2203
|
+
var RadioContext = (0, import_react23.createContext)(null);
|
|
2187
2204
|
var RadioProvider = ({
|
|
2188
2205
|
value,
|
|
2189
2206
|
children
|
|
@@ -2191,7 +2208,7 @@ var RadioProvider = ({
|
|
|
2191
2208
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RadioContext.Provider, { value, children });
|
|
2192
2209
|
};
|
|
2193
2210
|
var useRadioContext = () => {
|
|
2194
|
-
const state = (0,
|
|
2211
|
+
const state = (0, import_react23.useContext)(RadioContext);
|
|
2195
2212
|
if (state === null)
|
|
2196
2213
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
2197
2214
|
return state;
|
|
@@ -2199,9 +2216,9 @@ var useRadioContext = () => {
|
|
|
2199
2216
|
|
|
2200
2217
|
// src/components/SegmentedControl/index.tsx
|
|
2201
2218
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2202
|
-
var SegmentedControl = (0,
|
|
2219
|
+
var SegmentedControl = (0, import_react24.forwardRef)(
|
|
2203
2220
|
function SegmentedControlInner(props, ref) {
|
|
2204
|
-
const ariaRadioGroupProps = (0,
|
|
2221
|
+
const ariaRadioGroupProps = (0, import_react24.useMemo)(
|
|
2205
2222
|
() => ({
|
|
2206
2223
|
...props,
|
|
2207
2224
|
isDisabled: props.disabled,
|
|
@@ -2213,7 +2230,7 @@ var SegmentedControl = (0, import_react23.forwardRef)(
|
|
|
2213
2230
|
);
|
|
2214
2231
|
const state = (0, import_react_stately2.useRadioGroupState)(ariaRadioGroupProps);
|
|
2215
2232
|
const { radioGroupProps } = (0, import_radio.useRadioGroup)(ariaRadioGroupProps, state);
|
|
2216
|
-
const segmentedControlItems = (0,
|
|
2233
|
+
const segmentedControlItems = (0, import_react24.useMemo)(() => {
|
|
2217
2234
|
return props.data.map(
|
|
2218
2235
|
(d) => typeof d === "string" ? { value: d, label: d } : d
|
|
2219
2236
|
);
|
|
@@ -2237,11 +2254,11 @@ var SegmentedControl = (0, import_react23.forwardRef)(
|
|
|
2237
2254
|
);
|
|
2238
2255
|
}
|
|
2239
2256
|
);
|
|
2240
|
-
var SegmentedControl_default = (0,
|
|
2257
|
+
var SegmentedControl_default = (0, import_react24.memo)(SegmentedControl);
|
|
2241
2258
|
var Segmented = (props) => {
|
|
2242
2259
|
const state = useRadioContext();
|
|
2243
|
-
const ref = (0,
|
|
2244
|
-
const ariaRadioProps = (0,
|
|
2260
|
+
const ref = (0, import_react24.useRef)(null);
|
|
2261
|
+
const ariaRadioProps = (0, import_react24.useMemo)(
|
|
2245
2262
|
() => ({
|
|
2246
2263
|
value: props.value,
|
|
2247
2264
|
isDisabled: props.disabled,
|
|
@@ -2316,16 +2333,16 @@ var SegmentedLabelInner = import_styled_components22.default.div`
|
|
|
2316
2333
|
`;
|
|
2317
2334
|
|
|
2318
2335
|
// src/components/Checkbox/index.tsx
|
|
2319
|
-
var
|
|
2336
|
+
var import_react25 = require("react");
|
|
2320
2337
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
2321
2338
|
var import_checkbox = require("@react-aria/checkbox");
|
|
2322
2339
|
var import_utils12 = require("@react-aria/utils");
|
|
2323
2340
|
var import_react_stately3 = require("react-stately");
|
|
2324
2341
|
var import_utils13 = require("@charcoal-ui/utils");
|
|
2325
2342
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2326
|
-
var Checkbox = (0,
|
|
2343
|
+
var Checkbox = (0, import_react25.forwardRef)(
|
|
2327
2344
|
function CheckboxInner({ invalid = false, ...props }, ref) {
|
|
2328
|
-
const ariaCheckboxProps = (0,
|
|
2345
|
+
const ariaCheckboxProps = (0, import_react25.useMemo)(
|
|
2329
2346
|
() => ({
|
|
2330
2347
|
...props,
|
|
2331
2348
|
isSelected: props.checked,
|
|
@@ -2349,7 +2366,7 @@ var Checkbox = (0, import_react24.forwardRef)(
|
|
|
2349
2366
|
] });
|
|
2350
2367
|
}
|
|
2351
2368
|
);
|
|
2352
|
-
var Checkbox_default = (0,
|
|
2369
|
+
var Checkbox_default = (0, import_react25.memo)(Checkbox);
|
|
2353
2370
|
var hiddenCss = import_styled_components23.css`
|
|
2354
2371
|
visibility: hidden;
|
|
2355
2372
|
`;
|
|
@@ -2414,7 +2431,7 @@ var InputLabel = import_styled_components23.default.div`
|
|
|
2414
2431
|
`;
|
|
2415
2432
|
|
|
2416
2433
|
// src/components/TagItem/index.tsx
|
|
2417
|
-
var
|
|
2434
|
+
var import_react26 = require("react");
|
|
2418
2435
|
var import_utils14 = require("@react-aria/utils");
|
|
2419
2436
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
2420
2437
|
var import_utils15 = require("@charcoal-ui/utils");
|
|
@@ -2424,7 +2441,7 @@ var sizeMap = {
|
|
|
2424
2441
|
S: 32,
|
|
2425
2442
|
M: 40
|
|
2426
2443
|
};
|
|
2427
|
-
var TagItem = (0,
|
|
2444
|
+
var TagItem = (0, import_react26.forwardRef)(
|
|
2428
2445
|
function TagItemInner({
|
|
2429
2446
|
label,
|
|
2430
2447
|
translatedLabel,
|
|
@@ -2437,7 +2454,7 @@ var TagItem = (0, import_react25.forwardRef)(
|
|
|
2437
2454
|
...props
|
|
2438
2455
|
}, _ref) {
|
|
2439
2456
|
const ref = (0, import_utils14.useObjectRef)(_ref);
|
|
2440
|
-
const ariaButtonProps = (0,
|
|
2457
|
+
const ariaButtonProps = (0, import_react26.useMemo)(
|
|
2441
2458
|
() => ({
|
|
2442
2459
|
elementType: "a",
|
|
2443
2460
|
isDisabled: disabled,
|
|
@@ -2469,7 +2486,7 @@ var TagItem = (0, import_react25.forwardRef)(
|
|
|
2469
2486
|
);
|
|
2470
2487
|
}
|
|
2471
2488
|
);
|
|
2472
|
-
var TagItem_default = (0,
|
|
2489
|
+
var TagItem_default = (0, import_react26.memo)(TagItem);
|
|
2473
2490
|
var TagItemRoot = import_styled_components24.default.a`
|
|
2474
2491
|
isolation: isolate;
|
|
2475
2492
|
position: relative;
|