@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.esm.js
CHANGED
|
@@ -789,9 +789,9 @@ var SwitchInput = styled7.input.attrs({
|
|
|
789
789
|
// src/components/TextField/index.tsx
|
|
790
790
|
import { useTextField } from "@react-aria/textfield";
|
|
791
791
|
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
792
|
-
import { useCallback as useCallback3, useEffect, useRef, useState } from "react";
|
|
792
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState } from "react";
|
|
793
793
|
import * as React5 from "react";
|
|
794
|
-
import styled9 from "styled-components";
|
|
794
|
+
import styled9, { css as css2 } from "styled-components";
|
|
795
795
|
|
|
796
796
|
// src/components/FieldLabel/index.tsx
|
|
797
797
|
import * as React4 from "react";
|
|
@@ -843,6 +843,25 @@ var FieldLabelWrapper = styled8.div`
|
|
|
843
843
|
}
|
|
844
844
|
`;
|
|
845
845
|
|
|
846
|
+
// src/components/TextField/useFocusWithClick.tsx
|
|
847
|
+
import { useEffect } from "react";
|
|
848
|
+
function useFocusWithClick(containerRef, inputRef) {
|
|
849
|
+
useEffect(() => {
|
|
850
|
+
const el = containerRef.current;
|
|
851
|
+
if (el) {
|
|
852
|
+
const handleDown = (e) => {
|
|
853
|
+
if (e.target !== inputRef.current) {
|
|
854
|
+
inputRef.current?.focus();
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
el.addEventListener("click", handleDown);
|
|
858
|
+
return () => {
|
|
859
|
+
el.removeEventListener("click", handleDown);
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
|
|
846
865
|
// src/components/TextField/index.tsx
|
|
847
866
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
848
867
|
var TextField = React5.forwardRef(
|
|
@@ -864,13 +883,9 @@ var TextField = React5.forwardRef(
|
|
|
864
883
|
} = props;
|
|
865
884
|
const { visuallyHiddenProps } = useVisuallyHidden();
|
|
866
885
|
const ariaRef = useRef(null);
|
|
867
|
-
const prefixRef = useRef(null);
|
|
868
|
-
const suffixRef = useRef(null);
|
|
869
886
|
const [count, setCount] = useState(
|
|
870
887
|
countCodePointsInString(props.value ?? "")
|
|
871
888
|
);
|
|
872
|
-
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
873
|
-
const [suffixWidth, setSuffixWidth] = useState(0);
|
|
874
889
|
const nonControlled = props.value === void 0;
|
|
875
890
|
const handleChange = useCallback3(
|
|
876
891
|
(value) => {
|
|
@@ -885,7 +900,7 @@ var TextField = React5.forwardRef(
|
|
|
885
900
|
},
|
|
886
901
|
[maxLength, nonControlled, onChange]
|
|
887
902
|
);
|
|
888
|
-
|
|
903
|
+
useEffect2(() => {
|
|
889
904
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
890
905
|
}, [props.value]);
|
|
891
906
|
const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField(
|
|
@@ -901,24 +916,8 @@ var TextField = React5.forwardRef(
|
|
|
901
916
|
},
|
|
902
917
|
ariaRef
|
|
903
918
|
);
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
setPrefixWidth(entries[0].contentRect.width);
|
|
907
|
-
});
|
|
908
|
-
const suffixObserver = new ResizeObserver((entries) => {
|
|
909
|
-
setSuffixWidth(entries[0].contentRect.width);
|
|
910
|
-
});
|
|
911
|
-
if (prefixRef.current !== null) {
|
|
912
|
-
prefixObserver.observe(prefixRef.current);
|
|
913
|
-
}
|
|
914
|
-
if (suffixRef.current !== null) {
|
|
915
|
-
suffixObserver.observe(suffixRef.current);
|
|
916
|
-
}
|
|
917
|
-
return () => {
|
|
918
|
-
suffixObserver.disconnect();
|
|
919
|
-
prefixObserver.disconnect();
|
|
920
|
-
};
|
|
921
|
-
}, []);
|
|
919
|
+
const containerRef = useRef(null);
|
|
920
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
922
921
|
return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
923
922
|
/* @__PURE__ */ jsx10(
|
|
924
923
|
TextFieldLabel,
|
|
@@ -931,23 +930,31 @@ var TextField = React5.forwardRef(
|
|
|
931
930
|
...!showLabel ? visuallyHiddenProps : {}
|
|
932
931
|
}
|
|
933
932
|
),
|
|
934
|
-
/* @__PURE__ */ jsxs6(
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
933
|
+
/* @__PURE__ */ jsxs6(
|
|
934
|
+
StyledInputContainer,
|
|
935
|
+
{
|
|
936
|
+
ref: containerRef,
|
|
937
|
+
invalid,
|
|
938
|
+
"aria-disabled": disabled === true ? true : void 0,
|
|
939
|
+
hasPrefix: prefix != null,
|
|
940
|
+
hasSuffix: suffix != null || showCount,
|
|
941
|
+
children: [
|
|
942
|
+
prefix && /* @__PURE__ */ jsx10(PrefixContainer, { children: prefix }),
|
|
943
|
+
/* @__PURE__ */ jsx10(
|
|
944
|
+
StyledInput,
|
|
945
|
+
{
|
|
946
|
+
ref: mergeRefs(forwardRef18, ariaRef),
|
|
947
|
+
invalid,
|
|
948
|
+
...inputProps
|
|
949
|
+
}
|
|
950
|
+
),
|
|
951
|
+
(suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
|
|
952
|
+
suffix,
|
|
953
|
+
showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
954
|
+
] })
|
|
955
|
+
]
|
|
956
|
+
}
|
|
957
|
+
),
|
|
951
958
|
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(
|
|
952
959
|
AssistiveText,
|
|
953
960
|
{
|
|
@@ -967,34 +974,53 @@ var TextFieldRoot = styled9.div`
|
|
|
967
974
|
${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
|
|
968
975
|
`;
|
|
969
976
|
var TextFieldLabel = styled9(FieldLabel_default)`
|
|
970
|
-
|
|
977
|
+
margin-bottom: 8px;
|
|
971
978
|
`;
|
|
972
979
|
var StyledInputContainer = styled9.div`
|
|
973
|
-
height: 40px;
|
|
974
980
|
display: grid;
|
|
975
|
-
|
|
981
|
+
grid-template-columns: ${(p) => [p.hasPrefix && "auto", "1fr", p.hasSuffix && "auto"].filter(Boolean).join(" ")};
|
|
982
|
+
height: 40px;
|
|
983
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
984
|
+
color: var(--charcoal-text2);
|
|
985
|
+
background-color: var(--charcoal-surface3);
|
|
986
|
+
border-radius: 4px;
|
|
987
|
+
gap: 4px;
|
|
988
|
+
padding: 0 8px;
|
|
989
|
+
line-height: 22px;
|
|
990
|
+
font-size: 14px;
|
|
991
|
+
|
|
992
|
+
:not(:disabled):not([aria-disabled]):hover,
|
|
993
|
+
[aria-disabled='false']:hover {
|
|
994
|
+
background-color: var(--charcoal-surface3-hover);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
:not(:disabled):not([aria-disabled]):active,
|
|
998
|
+
[aria-disabled='false']:active {
|
|
999
|
+
outline: none;
|
|
1000
|
+
box-shadow: 0 0 0 4px
|
|
1001
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
:focus-within {
|
|
1005
|
+
outline: none;
|
|
1006
|
+
box-shadow: 0 0 0 4px
|
|
1007
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
${(p) => p.invalid && css2`
|
|
1011
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1012
|
+
`}
|
|
976
1013
|
`;
|
|
977
|
-
var PrefixContainer = styled9.
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
transform: translateY(-50%);
|
|
982
|
-
z-index: 1;
|
|
1014
|
+
var PrefixContainer = styled9.div`
|
|
1015
|
+
display: flex;
|
|
1016
|
+
padding-left: 8px;
|
|
1017
|
+
align-items: center;
|
|
983
1018
|
`;
|
|
984
1019
|
var SuffixContainer = styled9.span`
|
|
985
|
-
position: absolute;
|
|
986
|
-
top: 50%;
|
|
987
|
-
right: 8px;
|
|
988
|
-
transform: translateY(-50%);
|
|
989
|
-
|
|
990
1020
|
display: flex;
|
|
1021
|
+
align-items: center;
|
|
991
1022
|
gap: 8px;
|
|
992
1023
|
`;
|
|
993
|
-
var Affix = styled9.span`
|
|
994
|
-
user-select: none;
|
|
995
|
-
|
|
996
|
-
${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}
|
|
997
|
-
`;
|
|
998
1024
|
var StyledInput = styled9.input`
|
|
999
1025
|
border: none;
|
|
1000
1026
|
box-sizing: border-box;
|
|
@@ -1008,41 +1034,37 @@ var StyledInput = styled9.input`
|
|
|
1008
1034
|
height: calc(100% / 0.875);
|
|
1009
1035
|
font-size: calc(14px / 0.875);
|
|
1010
1036
|
line-height: calc(22px / 0.875);
|
|
1011
|
-
padding-left:
|
|
1012
|
-
padding-right:
|
|
1037
|
+
padding-left: 0;
|
|
1038
|
+
padding-right: 0;
|
|
1013
1039
|
border-radius: calc(4px / 0.875);
|
|
1014
1040
|
|
|
1015
1041
|
/* Display box-shadow for iOS Safari */
|
|
1016
1042
|
appearance: none;
|
|
1043
|
+
background: transparent;
|
|
1017
1044
|
|
|
1018
|
-
|
|
1019
|
-
o.bg.surface3.hover,
|
|
1020
|
-
o.outline.default.focus,
|
|
1021
|
-
p.invalid && o.outline.assertive,
|
|
1022
|
-
o.font.text2
|
|
1023
|
-
])}
|
|
1024
|
-
|
|
1045
|
+
color: var(--charcoal-text2);
|
|
1025
1046
|
&::placeholder {
|
|
1026
|
-
|
|
1047
|
+
color: var(--charcoal-text3);
|
|
1027
1048
|
}
|
|
1028
1049
|
`;
|
|
1029
1050
|
var SingleLineCounter = styled9.span`
|
|
1030
|
-
|
|
1051
|
+
line-height: 22px;
|
|
1052
|
+
font-size: 14px;
|
|
1053
|
+
color: var(--charcoal-text3);
|
|
1031
1054
|
`;
|
|
1032
1055
|
var AssistiveText = styled9.p`
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
])}
|
|
1056
|
+
font-size: 14px;
|
|
1057
|
+
line-height: 22px;
|
|
1058
|
+
margin-top: 4px;
|
|
1059
|
+
margin-bottom: -4px;
|
|
1060
|
+
color: ${(p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`};
|
|
1039
1061
|
`;
|
|
1040
1062
|
|
|
1041
1063
|
// src/components/TextArea/index.tsx
|
|
1042
1064
|
import { useTextField as useTextField2 } from "@react-aria/textfield";
|
|
1043
1065
|
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
1044
|
-
import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as
|
|
1045
|
-
import styled10, { css as
|
|
1066
|
+
import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
1067
|
+
import styled10, { css as css3 } from "styled-components";
|
|
1046
1068
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1047
1069
|
var TextArea = forwardRef10(
|
|
1048
1070
|
function TextAreaInner({ onChange, ...props }, forwardRef18) {
|
|
@@ -1093,7 +1115,7 @@ var TextArea = forwardRef10(
|
|
|
1093
1115
|
},
|
|
1094
1116
|
[autoHeight, maxLength, nonControlled, onChange, syncHeight]
|
|
1095
1117
|
);
|
|
1096
|
-
|
|
1118
|
+
useEffect3(() => {
|
|
1097
1119
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
1098
1120
|
}, [props.value]);
|
|
1099
1121
|
const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField2(
|
|
@@ -1109,14 +1131,16 @@ var TextArea = forwardRef10(
|
|
|
1109
1131
|
},
|
|
1110
1132
|
ariaRef
|
|
1111
1133
|
);
|
|
1112
|
-
|
|
1134
|
+
useEffect3(() => {
|
|
1113
1135
|
if (autoHeight && textareaRef.current !== null) {
|
|
1114
1136
|
syncHeight(textareaRef.current);
|
|
1115
1137
|
}
|
|
1116
1138
|
}, [autoHeight, syncHeight]);
|
|
1139
|
+
const containerRef = useRef2(null);
|
|
1140
|
+
useFocusWithClick(containerRef, ariaRef);
|
|
1117
1141
|
return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
1118
1142
|
/* @__PURE__ */ jsx11(
|
|
1119
|
-
|
|
1143
|
+
TextFieldLabel,
|
|
1120
1144
|
{
|
|
1121
1145
|
label,
|
|
1122
1146
|
requiredText,
|
|
@@ -1129,8 +1153,10 @@ var TextArea = forwardRef10(
|
|
|
1129
1153
|
/* @__PURE__ */ jsxs7(
|
|
1130
1154
|
StyledTextareaContainer,
|
|
1131
1155
|
{
|
|
1156
|
+
ref: containerRef,
|
|
1132
1157
|
invalid,
|
|
1133
1158
|
rows: showCount ? rows + 1 : rows,
|
|
1159
|
+
"aria-disabled": disabled === true ? "true" : void 0,
|
|
1134
1160
|
children: [
|
|
1135
1161
|
/* @__PURE__ */ jsx11(
|
|
1136
1162
|
StyledTextarea,
|
|
@@ -1146,7 +1172,7 @@ var TextArea = forwardRef10(
|
|
|
1146
1172
|
}
|
|
1147
1173
|
),
|
|
1148
1174
|
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(
|
|
1149
|
-
|
|
1175
|
+
AssistiveText,
|
|
1150
1176
|
{
|
|
1151
1177
|
invalid,
|
|
1152
1178
|
...invalid ? errorMessageProps : descriptionProps,
|
|
@@ -1163,29 +1189,32 @@ var TextFieldRoot2 = styled10.div`
|
|
|
1163
1189
|
|
|
1164
1190
|
${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
|
|
1165
1191
|
`;
|
|
1166
|
-
var TextFieldLabel2 = styled10(FieldLabel_default)`
|
|
1167
|
-
${theme((o) => o.margin.bottom(8))}
|
|
1168
|
-
`;
|
|
1169
1192
|
var StyledTextareaContainer = styled10.div`
|
|
1170
1193
|
position: relative;
|
|
1171
1194
|
overflow: hidden;
|
|
1172
|
-
padding: 0 8px;
|
|
1173
1195
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
o.font.text2,
|
|
1179
|
-
o.borderRadius(4)
|
|
1180
|
-
])}
|
|
1181
|
-
|
|
1182
|
-
&:focus-within {
|
|
1183
|
-
${(p) => theme((o) => p.invalid ? o.outline.assertive : o.outline.default)}
|
|
1184
|
-
}
|
|
1196
|
+
color: var(--charcoal-text2);
|
|
1197
|
+
background-color: var(--charcoal-surface3);
|
|
1198
|
+
border-radius: 4px;
|
|
1199
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
1185
1200
|
|
|
1186
|
-
${({ rows }) =>
|
|
1201
|
+
${({ rows }) => css3`
|
|
1187
1202
|
height: calc(22px * ${rows} + 18px);
|
|
1188
1203
|
`};
|
|
1204
|
+
|
|
1205
|
+
:not([aria-disabled]):hover,
|
|
1206
|
+
[aria-disabled='false']:hover {
|
|
1207
|
+
background-color: var(--charcoal-surface3-hover);
|
|
1208
|
+
}
|
|
1209
|
+
:focus-within {
|
|
1210
|
+
outline: none;
|
|
1211
|
+
box-shadow: 0 0 0 4px
|
|
1212
|
+
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
${(p) => p.invalid && css3`
|
|
1216
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
1217
|
+
`}
|
|
1189
1218
|
`;
|
|
1190
1219
|
var StyledTextarea = styled10.textarea`
|
|
1191
1220
|
border: none;
|
|
@@ -1193,6 +1222,7 @@ var StyledTextarea = styled10.textarea`
|
|
|
1193
1222
|
resize: none;
|
|
1194
1223
|
font-family: inherit;
|
|
1195
1224
|
color: inherit;
|
|
1225
|
+
box-sizing: border-box;
|
|
1196
1226
|
|
|
1197
1227
|
/* Prevent zooming for iOS Safari */
|
|
1198
1228
|
transform-origin: top left;
|
|
@@ -1200,10 +1230,11 @@ var StyledTextarea = styled10.textarea`
|
|
|
1200
1230
|
width: calc(100% / 0.875);
|
|
1201
1231
|
font-size: calc(14px / 0.875);
|
|
1202
1232
|
line-height: calc(22px / 0.875);
|
|
1203
|
-
padding: calc(9px / 0.875)
|
|
1233
|
+
padding: calc(9px / 0.875) calc(8px / 0.875)
|
|
1234
|
+
${(p) => p.noBottomPadding ? 0 : ""};
|
|
1204
1235
|
|
|
1205
|
-
${({ rows = 1 }) =>
|
|
1206
|
-
height: calc(22px / 0.875 * ${rows});
|
|
1236
|
+
${({ rows = 1, noBottomPadding }) => css3`
|
|
1237
|
+
height: calc(22px / 0.875 * ${rows} + ${noBottomPadding ? 9 : 20}px);
|
|
1207
1238
|
`};
|
|
1208
1239
|
|
|
1209
1240
|
/* Display box-shadow for iOS Safari */
|
|
@@ -1212,31 +1243,17 @@ var StyledTextarea = styled10.textarea`
|
|
|
1212
1243
|
background: none;
|
|
1213
1244
|
|
|
1214
1245
|
&::placeholder {
|
|
1215
|
-
|
|
1246
|
+
color: var(--charcoal-text3);
|
|
1216
1247
|
}
|
|
1217
|
-
|
|
1218
|
-
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
1219
|
-
&::-webkit-scrollbar {
|
|
1220
|
-
display: none;
|
|
1221
|
-
}
|
|
1222
|
-
/* Hide scrollbar for IE, Edge and Firefox */
|
|
1223
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
1224
|
-
scrollbar-width: none; /* Firefox */
|
|
1225
1248
|
`;
|
|
1226
1249
|
var MultiLineCounter = styled10.span`
|
|
1227
1250
|
position: absolute;
|
|
1228
1251
|
bottom: 9px;
|
|
1229
1252
|
right: 8px;
|
|
1230
1253
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
var
|
|
1234
|
-
${(p) => theme((o) => [
|
|
1235
|
-
o.typography(14),
|
|
1236
|
-
o.margin.top(8),
|
|
1237
|
-
o.margin.bottom(0),
|
|
1238
|
-
o.font[p.invalid ? "assertive" : "text1"]
|
|
1239
|
-
])}
|
|
1254
|
+
line-height: 22px;
|
|
1255
|
+
font-size: 14px;
|
|
1256
|
+
color: var(--charcoal-text3);
|
|
1240
1257
|
`;
|
|
1241
1258
|
|
|
1242
1259
|
// src/components/Icon/index.tsx
|
|
@@ -1265,7 +1282,7 @@ import {
|
|
|
1265
1282
|
Overlay,
|
|
1266
1283
|
useModalOverlay
|
|
1267
1284
|
} from "@react-aria/overlays";
|
|
1268
|
-
import styled12, { css as
|
|
1285
|
+
import styled12, { css as css5, useTheme } from "styled-components";
|
|
1269
1286
|
import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
|
|
1270
1287
|
import { useMedia } from "@charcoal-ui/styled";
|
|
1271
1288
|
import { animated as animated2, useTransition, easings } from "react-spring";
|
|
@@ -1273,7 +1290,7 @@ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
|
1273
1290
|
|
|
1274
1291
|
// src/components/Modal/Dialog/index.tsx
|
|
1275
1292
|
import { forwardRef as forwardRef12 } from "react";
|
|
1276
|
-
import styled11, { css as
|
|
1293
|
+
import styled11, { css as css4 } from "styled-components";
|
|
1277
1294
|
import { useDialog } from "@react-aria/dialog";
|
|
1278
1295
|
|
|
1279
1296
|
// ../foundation/src/grid.ts
|
|
@@ -1352,12 +1369,12 @@ var AnimatedStyledDialogDiv = animated(styled11.div`
|
|
|
1352
1369
|
@media ${({ theme: theme3 }) => maxWidth(theme3.breakpoint.screen1)} {
|
|
1353
1370
|
max-width: 440px;
|
|
1354
1371
|
width: calc(100% - 48px);
|
|
1355
|
-
${(p) => p.bottomSheet !== false &&
|
|
1372
|
+
${(p) => p.bottomSheet !== false && css4`
|
|
1356
1373
|
max-width: unset;
|
|
1357
1374
|
width: 100%;
|
|
1358
1375
|
border-radius: 0;
|
|
1359
1376
|
margin: auto 0 0 0;
|
|
1360
|
-
${p.bottomSheet === "full" &&
|
|
1377
|
+
${p.bottomSheet === "full" && css4`
|
|
1361
1378
|
min-height: 100%;
|
|
1362
1379
|
`}
|
|
1363
1380
|
`}
|
|
@@ -1498,7 +1515,7 @@ var ModalBackground = animated2(styled12.div`
|
|
|
1498
1515
|
background-color: ${({ theme: theme3 }) => theme3.color.surface4};
|
|
1499
1516
|
|
|
1500
1517
|
@media ${({ theme: theme3 }) => maxWidth2(theme3.breakpoint.screen1)} {
|
|
1501
|
-
${(p) => p.$bottomSheet !== false &&
|
|
1518
|
+
${(p) => p.$bottomSheet !== false && css5`
|
|
1502
1519
|
padding: 0;
|
|
1503
1520
|
`}
|
|
1504
1521
|
}
|
|
@@ -1521,7 +1538,7 @@ var ModalHeading = styled12.h3`
|
|
|
1521
1538
|
`;
|
|
1522
1539
|
|
|
1523
1540
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1524
|
-
import styled13, { css as
|
|
1541
|
+
import styled13, { css as css6 } from "styled-components";
|
|
1525
1542
|
import { useContext as useContext5 } from "react";
|
|
1526
1543
|
import { maxWidth as maxWidth3 } from "@charcoal-ui/utils";
|
|
1527
1544
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
@@ -1535,7 +1552,7 @@ var ModalHeaderRoot = styled13.div`
|
|
|
1535
1552
|
align-content: center;
|
|
1536
1553
|
justify-content: center;
|
|
1537
1554
|
@media ${({ theme: theme3 }) => maxWidth3(theme3.breakpoint.screen1)} {
|
|
1538
|
-
${(p) => p.$bottomSheet !== false &&
|
|
1555
|
+
${(p) => p.$bottomSheet !== false && css6`
|
|
1539
1556
|
height: 48px;
|
|
1540
1557
|
`}
|
|
1541
1558
|
}
|
|
@@ -1637,7 +1654,7 @@ import styled17 from "styled-components";
|
|
|
1637
1654
|
import { disabledSelector as disabledSelector4 } from "@charcoal-ui/utils";
|
|
1638
1655
|
|
|
1639
1656
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1640
|
-
import { useEffect as
|
|
1657
|
+
import { useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
1641
1658
|
|
|
1642
1659
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1643
1660
|
import { useContext as useContext6, useRef as useRef6 } from "react";
|
|
@@ -1645,9 +1662,9 @@ import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/over
|
|
|
1645
1662
|
import styled15 from "styled-components";
|
|
1646
1663
|
|
|
1647
1664
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1648
|
-
import { useEffect as
|
|
1665
|
+
import { useEffect as useEffect5 } from "react";
|
|
1649
1666
|
function usePreventScroll(element, isOpen) {
|
|
1650
|
-
|
|
1667
|
+
useEffect5(() => {
|
|
1651
1668
|
if (isOpen && element) {
|
|
1652
1669
|
const defaultPaddingRight = element.style.paddingRight;
|
|
1653
1670
|
const defaultOverflow = element.style.overflow;
|
|
@@ -1722,12 +1739,12 @@ var DropdownPopoverDiv = styled15.div`
|
|
|
1722
1739
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1723
1740
|
function DropdownPopover({ children, ...props }) {
|
|
1724
1741
|
const ref = useRef7(null);
|
|
1725
|
-
|
|
1742
|
+
useEffect6(() => {
|
|
1726
1743
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1727
1744
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1728
1745
|
}
|
|
1729
1746
|
}, [props.triggerRef, props.isOpen]);
|
|
1730
|
-
|
|
1747
|
+
useEffect6(() => {
|
|
1731
1748
|
if (props.isOpen && props.value !== void 0) {
|
|
1732
1749
|
const windowScrollY = window.scrollY;
|
|
1733
1750
|
const windowScrollX = window.scrollX;
|
|
@@ -2263,7 +2280,7 @@ var SegmentedLabelInner = styled21.div`
|
|
|
2263
2280
|
|
|
2264
2281
|
// src/components/Checkbox/index.tsx
|
|
2265
2282
|
import { forwardRef as forwardRef16, memo as memo7, useMemo as useMemo3 } from "react";
|
|
2266
|
-
import styled22, { css as
|
|
2283
|
+
import styled22, { css as css7 } from "styled-components";
|
|
2267
2284
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
2268
2285
|
import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
2269
2286
|
import { useToggleState as useToggleState2 } from "react-stately";
|
|
@@ -2296,7 +2313,7 @@ var Checkbox = forwardRef16(
|
|
|
2296
2313
|
}
|
|
2297
2314
|
);
|
|
2298
2315
|
var Checkbox_default = memo7(Checkbox);
|
|
2299
|
-
var hiddenCss =
|
|
2316
|
+
var hiddenCss = css7`
|
|
2300
2317
|
visibility: hidden;
|
|
2301
2318
|
`;
|
|
2302
2319
|
var InputRoot = styled22.label`
|
|
@@ -2362,7 +2379,7 @@ var InputLabel = styled22.div`
|
|
|
2362
2379
|
// src/components/TagItem/index.tsx
|
|
2363
2380
|
import { forwardRef as forwardRef17, memo as memo8, useMemo as useMemo4 } from "react";
|
|
2364
2381
|
import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
|
|
2365
|
-
import styled23, { css as
|
|
2382
|
+
import styled23, { css as css8 } from "styled-components";
|
|
2366
2383
|
import { disabledSelector as disabledSelector7, px as px4 } from "@charcoal-ui/utils";
|
|
2367
2384
|
import { useButton } from "@react-aria/button";
|
|
2368
2385
|
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
@@ -2452,7 +2469,7 @@ var Background = styled23.div`
|
|
|
2452
2469
|
background-color: ${({ bgColor }) => bgColor};
|
|
2453
2470
|
${({ status }) => status === "inactive" && theme((o) => o.bg.surface3)}
|
|
2454
2471
|
|
|
2455
|
-
${({ bgImage }) => bgImage !== void 0 &&
|
|
2472
|
+
${({ bgImage }) => bgImage !== void 0 && css8`
|
|
2456
2473
|
${theme((o) => [o.bg.surface4])}
|
|
2457
2474
|
&::before {
|
|
2458
2475
|
content: '';
|
|
@@ -2474,10 +2491,10 @@ var Inner = styled23.div`
|
|
|
2474
2491
|
align-items: center;
|
|
2475
2492
|
z-index: 2;
|
|
2476
2493
|
`;
|
|
2477
|
-
var labelCSS =
|
|
2494
|
+
var labelCSS = css8`
|
|
2478
2495
|
${theme((o) => [o.typography(14).bold])}
|
|
2479
2496
|
`;
|
|
2480
|
-
var translateLabelCSS =
|
|
2497
|
+
var translateLabelCSS = css8`
|
|
2481
2498
|
display: flex;
|
|
2482
2499
|
align-items: center;
|
|
2483
2500
|
flex-direction: column;
|