braid-design-system 32.2.0 → 32.3.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/CHANGELOG.md +89 -0
- package/codemod/dist/wrapper.js +1221 -21034
- package/dist/ToastContext.chunk.cjs +52 -80
- package/dist/ToastContext.chunk.mjs +88 -116
- package/dist/Toggle.chunk.cjs +52 -21
- package/dist/Toggle.chunk.mjs +58 -27
- package/dist/reset.d.ts +22 -4
- package/dist/styles/lib/components/Stepper/Stepper.css.cjs +8 -7
- package/dist/styles/lib/components/Stepper/Stepper.css.mjs +8 -7
- package/dist/styles/lib/components/Textarea/Highlight/Highlight.css.cjs +34 -3
- package/dist/styles/lib/components/Textarea/Highlight/Highlight.css.mjs +34 -3
- package/dist/styles/lib/components/TooltipRenderer/TooltipRenderer.css.cjs +0 -4
- package/dist/styles/lib/components/TooltipRenderer/TooltipRenderer.css.mjs +0 -4
- package/dist/styles/lib/css/atoms/atomicProperties.cjs +2 -0
- package/dist/styles/lib/css/atoms/atomicProperties.mjs +2 -0
- package/package.json +2 -2
|
@@ -26,9 +26,8 @@ import { hideFocusRingsClassName } from "./styles/lib/components/private/hideFoc
|
|
|
26
26
|
import { focusOverlay, hoverOverlay, invertedBackgroundsLightMode, invertedBackgroundsDarkMode, forceActive, activeOverlay, padToMinHeight, root, standard, small, bleedVerticallyToCapHeight, loadingDot } from "./styles/lib/components/Button/Button.css.mjs";
|
|
27
27
|
import { usePopperTooltip } from "react-popper-tooltip";
|
|
28
28
|
import isMobile from "is-mobile";
|
|
29
|
-
import { verticalOffsetBeforeEntrance, translateZ0,
|
|
29
|
+
import { verticalOffsetBeforeEntrance, translateZ0, maxWidth, arrow } from "./styles/lib/components/TooltipRenderer/TooltipRenderer.css.mjs";
|
|
30
30
|
import { button } from "./styles/lib/components/ButtonIcon/ButtonIcon.css.mjs";
|
|
31
|
-
import { noRadiusOnRight, largestWidth, width as width$1, tone as tone$1, lightMode, darkMode } from "./styles/lib/components/private/Keyline/Keyline.css.mjs";
|
|
32
31
|
import { toast } from "./styles/lib/components/useToast/Toast.css.mjs";
|
|
33
32
|
const TextContext = createContext(null);
|
|
34
33
|
const BraidPortal = ({ children, container }) => {
|
|
@@ -117,7 +116,7 @@ const BackgroundProvider = backgroundContext.Provider;
|
|
|
117
116
|
const useBackground = () => useContext(backgroundContext);
|
|
118
117
|
const useBackgroundLightness = (backgroundOverride) => {
|
|
119
118
|
const backgroundFromContext = useBackground();
|
|
120
|
-
const
|
|
119
|
+
const background = backgroundOverride || backgroundFromContext;
|
|
121
120
|
const { backgroundLightness } = useBraidTheme();
|
|
122
121
|
const lightnessMap = {
|
|
123
122
|
...backgroundLightness,
|
|
@@ -125,16 +124,16 @@ const useBackgroundLightness = (backgroundOverride) => {
|
|
|
125
124
|
customLight: "light"
|
|
126
125
|
};
|
|
127
126
|
return {
|
|
128
|
-
lightMode: lightnessMap[
|
|
129
|
-
darkMode: lightnessMap[
|
|
127
|
+
lightMode: lightnessMap[background.lightMode],
|
|
128
|
+
darkMode: lightnessMap[background.darkMode]
|
|
130
129
|
};
|
|
131
130
|
};
|
|
132
131
|
const useColorContrast = () => {
|
|
133
|
-
const
|
|
132
|
+
const background = useBackground();
|
|
134
133
|
const backgroundLightness = useBackgroundLightness();
|
|
135
134
|
return (map) => mapColorModeValue(
|
|
136
135
|
backgroundLightness,
|
|
137
|
-
(lightness, mode) => typeof map === "function" ? map(lightness,
|
|
136
|
+
(lightness, mode) => typeof map === "function" ? map(lightness, background[mode]) : map[lightness]
|
|
138
137
|
);
|
|
139
138
|
};
|
|
140
139
|
const adaptiveBackgrounds = {
|
|
@@ -152,6 +151,7 @@ const adaptiveBackgrounds = {
|
|
|
152
151
|
formAccentSoftHover: "neutralHover"
|
|
153
152
|
};
|
|
154
153
|
const adaptiveBoxShadow = {
|
|
154
|
+
borderBrandAccent: "borderBrandAccentLight",
|
|
155
155
|
borderBrandAccentLarge: "borderBrandAccentLightLarge",
|
|
156
156
|
borderCaution: "borderCautionLight",
|
|
157
157
|
borderCritical: "borderCriticalLight",
|
|
@@ -165,16 +165,16 @@ const adaptiveBoxShadow = {
|
|
|
165
165
|
borderPositive: "borderPositiveLight",
|
|
166
166
|
borderPromote: "borderPromoteLight"
|
|
167
167
|
};
|
|
168
|
-
const normaliseBackground = (
|
|
169
|
-
lightMode: typeof
|
|
170
|
-
darkMode: typeof
|
|
168
|
+
const normaliseBackground = (background) => ({
|
|
169
|
+
lightMode: typeof background === "object" ? background.lightMode : background,
|
|
170
|
+
darkMode: typeof background === "object" ? background.darkMode : adaptiveBackgrounds[background] || background
|
|
171
171
|
});
|
|
172
172
|
const normalisedBoxShadow = (boxShadow) => ({
|
|
173
173
|
lightMode: typeof boxShadow === "object" ? boxShadow.lightMode : boxShadow,
|
|
174
174
|
darkMode: typeof boxShadow === "object" ? boxShadow.darkMode : boxShadow
|
|
175
175
|
});
|
|
176
176
|
const useColoredBoxClasses = ({
|
|
177
|
-
background
|
|
177
|
+
background,
|
|
178
178
|
boxShadow
|
|
179
179
|
}) => {
|
|
180
180
|
const parentLightness = useBackgroundLightness();
|
|
@@ -198,12 +198,12 @@ const useColoredBoxClasses = ({
|
|
|
198
198
|
})
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
|
-
if (
|
|
202
|
-
const { lightMode
|
|
203
|
-
classList.push(lightModeTone[lightnessMap[
|
|
204
|
-
classList.push(darkModeTone[lightnessMap[
|
|
205
|
-
const lightModeTone$1 =
|
|
206
|
-
const darkModeTone$1 =
|
|
201
|
+
if (background) {
|
|
202
|
+
const { lightMode, darkMode } = normaliseBackground(background);
|
|
203
|
+
classList.push(lightModeTone[lightnessMap[lightMode]]);
|
|
204
|
+
classList.push(darkModeTone[lightnessMap[darkMode]]);
|
|
205
|
+
const lightModeTone$1 = lightMode === "neutral" ? darkMode : lightMode;
|
|
206
|
+
const darkModeTone$1 = darkMode === "neutral" ? lightMode : darkMode;
|
|
207
207
|
if (lightModeTone$1 && lightModeNeutralOverride[lightModeTone$1]) {
|
|
208
208
|
classList.push(lightModeNeutralOverride[lightModeTone$1]);
|
|
209
209
|
}
|
|
@@ -213,15 +213,15 @@ const useColoredBoxClasses = ({
|
|
|
213
213
|
classList.push(
|
|
214
214
|
atoms({
|
|
215
215
|
background: {
|
|
216
|
-
lightMode:
|
|
217
|
-
darkMode:
|
|
216
|
+
lightMode: lightMode === "customDark" || lightMode === "customLight" ? void 0 : lightMode,
|
|
217
|
+
darkMode: darkMode === "customDark" || darkMode === "customLight" ? void 0 : darkMode
|
|
218
218
|
}
|
|
219
219
|
})
|
|
220
220
|
);
|
|
221
221
|
return {
|
|
222
222
|
backgroundContext: {
|
|
223
|
-
lightMode:
|
|
224
|
-
darkMode:
|
|
223
|
+
lightMode: lightMode || currentBackgroundContext.lightMode,
|
|
224
|
+
darkMode: darkMode || currentBackgroundContext.darkMode
|
|
225
225
|
},
|
|
226
226
|
classList: classList.join(" ")
|
|
227
227
|
};
|
|
@@ -231,9 +231,9 @@ const useColoredBoxClasses = ({
|
|
|
231
231
|
};
|
|
232
232
|
};
|
|
233
233
|
const ColoredBox = forwardRef(
|
|
234
|
-
({ component, background
|
|
234
|
+
({ component, background, boxShadow, className, ...props }, ref) => {
|
|
235
235
|
const { backgroundContext: backgroundContext2, classList: colorClasses } = useColoredBoxClasses(
|
|
236
|
-
{ background
|
|
236
|
+
{ background, boxShadow }
|
|
237
237
|
);
|
|
238
238
|
const element = createElement(component, {
|
|
239
239
|
className: `${className}${colorClasses ? ` ${colorClasses}` : ""}`,
|
|
@@ -245,7 +245,7 @@ const ColoredBox = forwardRef(
|
|
|
245
245
|
);
|
|
246
246
|
ColoredBox.displayName = "ColoredBox";
|
|
247
247
|
const Box = forwardRef(
|
|
248
|
-
({ component = "div", className, background
|
|
248
|
+
({ component = "div", className, background, boxShadow, data, ...restProps }, ref) => {
|
|
249
249
|
const atomProps = {};
|
|
250
250
|
const nativeProps = {
|
|
251
251
|
...data ? (
|
|
@@ -282,11 +282,11 @@ const Box = forwardRef(
|
|
|
282
282
|
...atomProps
|
|
283
283
|
});
|
|
284
284
|
const combinedClasses = `${atomicClasses}${userClasses ? ` ${userClasses}` : ""}`;
|
|
285
|
-
return
|
|
285
|
+
return background || boxShadow ? /* @__PURE__ */ jsx(
|
|
286
286
|
ColoredBox,
|
|
287
287
|
{
|
|
288
288
|
component,
|
|
289
|
-
background
|
|
289
|
+
background,
|
|
290
290
|
boxShadow,
|
|
291
291
|
className: combinedClasses,
|
|
292
292
|
ref,
|
|
@@ -630,13 +630,13 @@ const useDefaultTextProps = ({
|
|
|
630
630
|
function textStyles({
|
|
631
631
|
weight = "regular",
|
|
632
632
|
size: size2 = "standard",
|
|
633
|
-
tone: tone$
|
|
633
|
+
tone: tone$1 = "neutral",
|
|
634
634
|
baseline
|
|
635
635
|
}) {
|
|
636
636
|
return [
|
|
637
637
|
fontFamily,
|
|
638
638
|
fontWeight[weight],
|
|
639
|
-
tone[tone$
|
|
639
|
+
tone[tone$1],
|
|
640
640
|
(baseline ? textSizeTrimmed : textSizeUntrimmed)[size2]
|
|
641
641
|
];
|
|
642
642
|
}
|
|
@@ -881,7 +881,7 @@ const Columns = ({
|
|
|
881
881
|
const Column = ({
|
|
882
882
|
children,
|
|
883
883
|
data,
|
|
884
|
-
width: width$
|
|
884
|
+
width: width$1,
|
|
885
885
|
...restProps
|
|
886
886
|
}) => {
|
|
887
887
|
const {
|
|
@@ -901,11 +901,11 @@ const Column = ({
|
|
|
901
901
|
component,
|
|
902
902
|
display: component === "span" ? "block" : void 0,
|
|
903
903
|
minWidth: 0,
|
|
904
|
-
width: width$
|
|
905
|
-
flexShrink: width$
|
|
904
|
+
width: width$1 !== "content" ? "full" : void 0,
|
|
905
|
+
flexShrink: width$1 === "content" ? 0 : void 0,
|
|
906
906
|
className: [
|
|
907
907
|
column,
|
|
908
|
-
width$
|
|
908
|
+
width$1 !== "content" ? width[width$1] : null
|
|
909
909
|
],
|
|
910
910
|
...buildDataAttributes({ data, validateRestProps: restProps }),
|
|
911
911
|
children: /* @__PURE__ */ jsx(
|
|
@@ -1027,11 +1027,11 @@ const defaultVerticalCorrection = {
|
|
|
1027
1027
|
uppercase: "none",
|
|
1028
1028
|
lowercase: "none"
|
|
1029
1029
|
};
|
|
1030
|
-
const useIcon = ({ size: size2, tone: tone$
|
|
1030
|
+
const useIcon = ({ size: size2, tone: tone$1, alignY: alignY2, data, title, titleId, ...restProps }, { verticalCorrection = defaultVerticalCorrection } = {}) => {
|
|
1031
1031
|
const textContext = useContext(TextContext);
|
|
1032
1032
|
const headingContext = useContext(HeadingContext);
|
|
1033
|
-
const resolvedTone = tone[tone$
|
|
1034
|
-
const toneClass = tone$
|
|
1033
|
+
const resolvedTone = tone[tone$1 || (textContext == null ? void 0 : textContext.tone) || "neutral"];
|
|
1034
|
+
const toneClass = tone$1 || !headingContext && !(textContext == null ? void 0 : textContext.tone) ? resolvedTone : void 0;
|
|
1035
1035
|
const isInline = Boolean(textContext || headingContext);
|
|
1036
1036
|
const a11yProps = title ? { title, titleId, role: "img" } : { "aria-hidden": true };
|
|
1037
1037
|
assert(
|
|
@@ -1146,7 +1146,7 @@ function virtualTouchable({ xAxis } = { xAxis: true }) {
|
|
|
1146
1146
|
const Overlay = ({
|
|
1147
1147
|
component,
|
|
1148
1148
|
zIndex,
|
|
1149
|
-
background
|
|
1149
|
+
background,
|
|
1150
1150
|
borderRadius: borderRadius2,
|
|
1151
1151
|
boxShadow,
|
|
1152
1152
|
transition,
|
|
@@ -1161,7 +1161,7 @@ const Overlay = ({
|
|
|
1161
1161
|
position: "absolute",
|
|
1162
1162
|
zIndex,
|
|
1163
1163
|
pointerEvents: "none",
|
|
1164
|
-
background
|
|
1164
|
+
background,
|
|
1165
1165
|
borderRadius: borderRadius2,
|
|
1166
1166
|
boxShadow,
|
|
1167
1167
|
transition,
|
|
@@ -1175,36 +1175,6 @@ const Overlay = ({
|
|
|
1175
1175
|
}
|
|
1176
1176
|
);
|
|
1177
1177
|
const ActionsContext = createContext(null);
|
|
1178
|
-
const Keyline = ({ tone: tone2, borderRadius: borderRadius2 }) => {
|
|
1179
|
-
const backgroundLightness = useBackgroundLightness();
|
|
1180
|
-
return /* @__PURE__ */ jsx(
|
|
1181
|
-
Box,
|
|
1182
|
-
{
|
|
1183
|
-
component: "span",
|
|
1184
|
-
position: "absolute",
|
|
1185
|
-
top: 0,
|
|
1186
|
-
bottom: 0,
|
|
1187
|
-
left: 0,
|
|
1188
|
-
overflow: "hidden",
|
|
1189
|
-
borderRadius: borderRadius2,
|
|
1190
|
-
className: [noRadiusOnRight, largestWidth],
|
|
1191
|
-
children: /* @__PURE__ */ jsx(
|
|
1192
|
-
Box,
|
|
1193
|
-
{
|
|
1194
|
-
component: "span",
|
|
1195
|
-
height: "full",
|
|
1196
|
-
display: "inlineBlock",
|
|
1197
|
-
className: [
|
|
1198
|
-
width$1,
|
|
1199
|
-
tone$1[tone2],
|
|
1200
|
-
lightMode[backgroundLightness.lightMode],
|
|
1201
|
-
darkMode[backgroundLightness.darkMode]
|
|
1202
|
-
]
|
|
1203
|
-
}
|
|
1204
|
-
)
|
|
1205
|
-
}
|
|
1206
|
-
);
|
|
1207
|
-
};
|
|
1208
1178
|
const boxShadowForVariant = {
|
|
1209
1179
|
default: "borderField",
|
|
1210
1180
|
disabled: "borderNeutralLight",
|
|
@@ -1381,28 +1351,28 @@ const variants = {
|
|
|
1381
1351
|
background: void 0,
|
|
1382
1352
|
backgroundHover: "formAccentSoftHover",
|
|
1383
1353
|
backgroundActive: "formAccentSoftActive",
|
|
1384
|
-
boxShadow: "
|
|
1354
|
+
boxShadow: "borderFormAccent"
|
|
1385
1355
|
},
|
|
1386
1356
|
brandAccent: {
|
|
1387
1357
|
textTone: "brandAccent",
|
|
1388
1358
|
background: void 0,
|
|
1389
1359
|
backgroundHover: "brandAccentSoftHover",
|
|
1390
1360
|
backgroundActive: "brandAccentSoftActive",
|
|
1391
|
-
boxShadow: "
|
|
1361
|
+
boxShadow: "borderBrandAccent"
|
|
1392
1362
|
},
|
|
1393
1363
|
critical: {
|
|
1394
1364
|
textTone: "critical",
|
|
1395
1365
|
background: void 0,
|
|
1396
1366
|
backgroundHover: "criticalSoftHover",
|
|
1397
1367
|
backgroundActive: "criticalSoftActive",
|
|
1398
|
-
boxShadow: "
|
|
1368
|
+
boxShadow: "borderCritical"
|
|
1399
1369
|
},
|
|
1400
1370
|
neutral: {
|
|
1401
1371
|
textTone: "neutral",
|
|
1402
1372
|
background: void 0,
|
|
1403
1373
|
backgroundHover: "neutralSoftHover",
|
|
1404
1374
|
backgroundActive: "neutralSoftActive",
|
|
1405
|
-
boxShadow: "
|
|
1375
|
+
boxShadow: "borderNeutral"
|
|
1406
1376
|
}
|
|
1407
1377
|
}
|
|
1408
1378
|
};
|
|
@@ -1697,10 +1667,10 @@ const TooltipContent = ({
|
|
|
1697
1667
|
Box,
|
|
1698
1668
|
{
|
|
1699
1669
|
boxShadow: "large",
|
|
1700
|
-
background: "
|
|
1670
|
+
background: "neutral",
|
|
1701
1671
|
borderRadius: borderRadius$1,
|
|
1702
1672
|
padding: "small",
|
|
1703
|
-
className: [
|
|
1673
|
+
className: [maxWidth, translateZ0],
|
|
1704
1674
|
children: /* @__PURE__ */ jsxs(TooltipTextDefaultsProvider, { children: [
|
|
1705
1675
|
/* @__PURE__ */ jsx(Box, { position: "relative", zIndex: 1, children }),
|
|
1706
1676
|
/* @__PURE__ */ jsx(
|
|
@@ -1708,7 +1678,8 @@ const TooltipContent = ({
|
|
|
1708
1678
|
{
|
|
1709
1679
|
...arrowProps,
|
|
1710
1680
|
borderRadius: borderRadius$1,
|
|
1711
|
-
|
|
1681
|
+
background: "neutral",
|
|
1682
|
+
className: arrow
|
|
1712
1683
|
}
|
|
1713
1684
|
)
|
|
1714
1685
|
] })
|
|
@@ -2147,7 +2118,17 @@ const Action = ({ label, onClick, removeToast }) => {
|
|
|
2147
2118
|
removeToast();
|
|
2148
2119
|
onClick();
|
|
2149
2120
|
}, [removeToast, onClick]);
|
|
2150
|
-
return /* @__PURE__ */ jsx(Text, { baseline: false, children: /* @__PURE__ */ jsx(Box, { component: "span",
|
|
2121
|
+
return /* @__PURE__ */ jsx(Text, { baseline: false, children: /* @__PURE__ */ jsx(Box, { component: "span", "aria-hidden": true, children: /* @__PURE__ */ jsx(TextLinkButton, { onClick: handleClick, hitArea: "large", children: label }) }) });
|
|
2122
|
+
};
|
|
2123
|
+
const ToastIcon = ({ tone: tone2, icon }) => {
|
|
2124
|
+
if (tone2 !== "neutral") {
|
|
2125
|
+
const Icon = toneToIcon[tone2];
|
|
2126
|
+
return /* @__PURE__ */ jsx(Icon, { tone: tone2 });
|
|
2127
|
+
}
|
|
2128
|
+
if (icon) {
|
|
2129
|
+
return cloneElement(icon, { tone: tone2 });
|
|
2130
|
+
}
|
|
2131
|
+
return null;
|
|
2151
2132
|
};
|
|
2152
2133
|
const Toast = React.forwardRef(
|
|
2153
2134
|
({
|
|
@@ -2179,7 +2160,6 @@ const Toast = React.forwardRef(
|
|
|
2179
2160
|
remove();
|
|
2180
2161
|
}
|
|
2181
2162
|
}, [shouldRemove, remove, stopTimeout]);
|
|
2182
|
-
const Icon = tone2 !== "neutral" ? toneToIcon[tone2] : void 0;
|
|
2183
2163
|
assert(
|
|
2184
2164
|
!icon || icon.props.size === void 0 && icon.props.tone === void 0,
|
|
2185
2165
|
"Icons cannot set the 'size' or 'tone' prop when passed to a Toast component"
|
|
@@ -2189,11 +2169,11 @@ const Toast = React.forwardRef(
|
|
|
2189
2169
|
`Icons cannot be customised on a Toast component using '${tone2}' tone`
|
|
2190
2170
|
);
|
|
2191
2171
|
const content = description ? /* @__PURE__ */ jsxs(Stack, { space: "xxsmall", children: [
|
|
2192
|
-
/* @__PURE__ */ jsx(Text, { weight: "
|
|
2172
|
+
/* @__PURE__ */ jsx(Text, { weight: "medium", tone: tone2, baseline: false, children: message }),
|
|
2193
2173
|
description ? /* @__PURE__ */ jsx(Text, { baseline: false, tone: "secondary", children: description }) : null,
|
|
2194
2174
|
action ? /* @__PURE__ */ jsx(Action, { removeToast: remove, ...action }, action.label) : null
|
|
2195
2175
|
] }) : /* @__PURE__ */ jsxs(Inline, { space: "xxsmall", children: [
|
|
2196
|
-
/* @__PURE__ */ jsx(Box, { paddingRight: "medium", children: /* @__PURE__ */ jsx(Text, { weight: "
|
|
2176
|
+
/* @__PURE__ */ jsx(Box, { paddingRight: "medium", children: /* @__PURE__ */ jsx(Text, { weight: "medium", tone: tone2, baseline: false, children: message }) }),
|
|
2197
2177
|
action ? /* @__PURE__ */ jsx(Action, { removeToast: remove, ...action }, action.label) : null
|
|
2198
2178
|
] });
|
|
2199
2179
|
return /* @__PURE__ */ jsx(
|
|
@@ -2207,50 +2187,43 @@ const Toast = React.forwardRef(
|
|
|
2207
2187
|
onMouseLeave: startTimeout,
|
|
2208
2188
|
className: vanillaTheme,
|
|
2209
2189
|
...buildDataAttributes({ data, validateRestProps: restProps }),
|
|
2210
|
-
children: /* @__PURE__ */ jsx(Box, { boxShadow: "large", borderRadius, children: /* @__PURE__ */ jsx(ContentBlock, { width: "xsmall", children: /* @__PURE__ */
|
|
2190
|
+
children: /* @__PURE__ */ jsx(Box, { boxShadow: "large", borderRadius, children: /* @__PURE__ */ jsx(ContentBlock, { width: "xsmall", children: /* @__PURE__ */ jsx(
|
|
2211
2191
|
Box,
|
|
2212
2192
|
{
|
|
2213
|
-
background: "surface",
|
|
2193
|
+
background: { lightMode: "surfaceDark", darkMode: "surface" },
|
|
2214
2194
|
position: "relative",
|
|
2215
|
-
boxShadow: "borderNeutralLight",
|
|
2216
2195
|
borderRadius,
|
|
2217
2196
|
paddingY: "medium",
|
|
2218
|
-
|
|
2197
|
+
paddingX: "gutter",
|
|
2219
2198
|
overflow: "hidden",
|
|
2220
2199
|
className: toast,
|
|
2221
|
-
children: [
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
)
|
|
2249
|
-
}
|
|
2250
|
-
) })
|
|
2251
|
-
] }),
|
|
2252
|
-
tone2 !== "neutral" ? /* @__PURE__ */ jsx(Keyline, { tone: tone2, borderRadius }) : null
|
|
2253
|
-
]
|
|
2200
|
+
children: /* @__PURE__ */ jsxs(Columns, { space: "none", children: [
|
|
2201
|
+
tone2 !== "neutral" || tone2 === "neutral" && icon ? /* @__PURE__ */ jsx(Column, { width: "content", children: /* @__PURE__ */ jsx(Box, { paddingRight: "small", children: /* @__PURE__ */ jsx(ToastIcon, { tone: tone2, icon }) }) }) : null,
|
|
2202
|
+
/* @__PURE__ */ jsx(Column, { children: content }),
|
|
2203
|
+
/* @__PURE__ */ jsx(Column, { width: "content", children: /* @__PURE__ */ jsx(
|
|
2204
|
+
Box,
|
|
2205
|
+
{
|
|
2206
|
+
width: "touchable",
|
|
2207
|
+
display: "flex",
|
|
2208
|
+
justifyContent: "flexEnd",
|
|
2209
|
+
alignItems: "center",
|
|
2210
|
+
className: lineHeightContainer.standard,
|
|
2211
|
+
"aria-hidden": true,
|
|
2212
|
+
children: /* @__PURE__ */ jsx(
|
|
2213
|
+
ButtonIcon,
|
|
2214
|
+
{
|
|
2215
|
+
id: `${dedupeKey}-clear`,
|
|
2216
|
+
icon: /* @__PURE__ */ jsx(IconClear, {}),
|
|
2217
|
+
tone: "secondary",
|
|
2218
|
+
variant: "transparent",
|
|
2219
|
+
onClick: remove,
|
|
2220
|
+
label: closeLabel,
|
|
2221
|
+
data: process.env.NODE_ENV !== "production" ? { testid: "clearToast" } : {}
|
|
2222
|
+
}
|
|
2223
|
+
)
|
|
2224
|
+
}
|
|
2225
|
+
) })
|
|
2226
|
+
] })
|
|
2254
2227
|
}
|
|
2255
2228
|
) }) })
|
|
2256
2229
|
}
|
|
@@ -2541,7 +2514,6 @@ export {
|
|
|
2541
2514
|
IconPositive,
|
|
2542
2515
|
IconRenderer,
|
|
2543
2516
|
Inline,
|
|
2544
|
-
Keyline,
|
|
2545
2517
|
Overlay,
|
|
2546
2518
|
PublicBox,
|
|
2547
2519
|
Stack,
|
package/dist/Toggle.chunk.cjs
CHANGED
|
@@ -21,6 +21,7 @@ const reactRemoveScroll = require("react-remove-scroll");
|
|
|
21
21
|
const styles_lib_components_Autosuggest_Autosuggest_css_cjs = require("./styles/lib/components/Autosuggest/Autosuggest.css.cjs");
|
|
22
22
|
const matchHighlights = require("autosuggest-highlight/match/index.js");
|
|
23
23
|
const clsx = require("clsx");
|
|
24
|
+
const styles_lib_components_private_Keyline_Keyline_css_cjs = require("./styles/lib/components/private/Keyline/Keyline.css.cjs");
|
|
24
25
|
const FocusLock = require("react-focus-lock");
|
|
25
26
|
const styles_lib_components_private_Modal_ModalExternalGutter_cjs = require("./styles/lib/components/private/Modal/ModalExternalGutter.cjs");
|
|
26
27
|
const styles_lib_components_private_Modal_Modal_css_cjs = require("./styles/lib/components/private/Modal/Modal.css.cjs");
|
|
@@ -2268,7 +2269,8 @@ const Alert = ({
|
|
|
2268
2269
|
{
|
|
2269
2270
|
id,
|
|
2270
2271
|
background: backgroundForTone[tone],
|
|
2271
|
-
|
|
2272
|
+
paddingY: "medium",
|
|
2273
|
+
paddingX: "gutter",
|
|
2272
2274
|
borderRadius: borderRadius$3,
|
|
2273
2275
|
position: "relative",
|
|
2274
2276
|
overflow: "hidden",
|
|
@@ -2342,8 +2344,7 @@ const Alert = ({
|
|
|
2342
2344
|
boxShadow: { lightMode: borderForTone[tone] },
|
|
2343
2345
|
visible: true
|
|
2344
2346
|
}
|
|
2345
|
-
)
|
|
2346
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToastContext.Keyline, { tone, borderRadius: borderRadius$3 })
|
|
2347
|
+
)
|
|
2347
2348
|
]
|
|
2348
2349
|
}
|
|
2349
2350
|
);
|
|
@@ -2456,10 +2457,11 @@ const FieldLabel = ({
|
|
|
2456
2457
|
description ? /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { paddingTop: label ? "xxsmall" : void 0, paddingBottom: "xxsmall", children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { tone: "secondary", id: descriptionId, children: description }) }) : null
|
|
2457
2458
|
] });
|
|
2458
2459
|
};
|
|
2459
|
-
const tones$1 = ["neutral", "critical", "positive"];
|
|
2460
|
+
const tones$1 = ["neutral", "critical", "positive", "caution"];
|
|
2460
2461
|
const icon = {
|
|
2461
2462
|
critical: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.IconCritical, { tone: "critical" }),
|
|
2462
|
-
positive: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.IconPositive, { tone: "positive" })
|
|
2463
|
+
positive: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.IconPositive, { tone: "positive" }),
|
|
2464
|
+
caution: /* @__PURE__ */ jsxRuntime.jsx(IconCaution, { tone: "caution" })
|
|
2463
2465
|
};
|
|
2464
2466
|
const FieldMessage = ({
|
|
2465
2467
|
id,
|
|
@@ -3749,6 +3751,36 @@ const ButtonLink = React.forwardRef(
|
|
|
3749
3751
|
}
|
|
3750
3752
|
);
|
|
3751
3753
|
ButtonLink.displayName = "ButtonLink";
|
|
3754
|
+
const Keyline = ({ tone, borderRadius: borderRadius2 }) => {
|
|
3755
|
+
const backgroundLightness = ToastContext.useBackgroundLightness();
|
|
3756
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3757
|
+
ToastContext.Box,
|
|
3758
|
+
{
|
|
3759
|
+
component: "span",
|
|
3760
|
+
position: "absolute",
|
|
3761
|
+
top: 0,
|
|
3762
|
+
bottom: 0,
|
|
3763
|
+
left: 0,
|
|
3764
|
+
overflow: "hidden",
|
|
3765
|
+
borderRadius: borderRadius2,
|
|
3766
|
+
className: [styles_lib_components_private_Keyline_Keyline_css_cjs.noRadiusOnRight, styles_lib_components_private_Keyline_Keyline_css_cjs.largestWidth],
|
|
3767
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3768
|
+
ToastContext.Box,
|
|
3769
|
+
{
|
|
3770
|
+
component: "span",
|
|
3771
|
+
height: "full",
|
|
3772
|
+
display: "inlineBlock",
|
|
3773
|
+
className: [
|
|
3774
|
+
styles_lib_components_private_Keyline_Keyline_css_cjs.width,
|
|
3775
|
+
styles_lib_components_private_Keyline_Keyline_css_cjs.tone[tone],
|
|
3776
|
+
styles_lib_components_private_Keyline_Keyline_css_cjs.lightMode[backgroundLightness.lightMode],
|
|
3777
|
+
styles_lib_components_private_Keyline_Keyline_css_cjs.darkMode[backgroundLightness.darkMode]
|
|
3778
|
+
]
|
|
3779
|
+
}
|
|
3780
|
+
)
|
|
3781
|
+
}
|
|
3782
|
+
);
|
|
3783
|
+
};
|
|
3752
3784
|
const validCardComponents = [
|
|
3753
3785
|
"div",
|
|
3754
3786
|
"article",
|
|
@@ -3791,7 +3823,7 @@ const Card = ({
|
|
|
3791
3823
|
borderRadius: resolvedRounding,
|
|
3792
3824
|
...ToastContext.buildDataAttributes({ data, validateRestProps: restProps }),
|
|
3793
3825
|
children: [
|
|
3794
|
-
tone ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3826
|
+
tone ? /* @__PURE__ */ jsxRuntime.jsx(Keyline, { tone, borderRadius: resolvedRounding }) : null,
|
|
3795
3827
|
children
|
|
3796
3828
|
]
|
|
3797
3829
|
}
|
|
@@ -7508,17 +7540,9 @@ const Tag = ({
|
|
|
7508
7540
|
}
|
|
7509
7541
|
);
|
|
7510
7542
|
};
|
|
7511
|
-
const
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
component: "mark",
|
|
7515
|
-
borderRadius: "small",
|
|
7516
|
-
background: { lightMode: "criticalLight", darkMode: "critical" },
|
|
7517
|
-
className: styles_lib_components_Textarea_Highlight_Highlight_css_cjs.root,
|
|
7518
|
-
children
|
|
7519
|
-
}
|
|
7520
|
-
);
|
|
7521
|
-
const formatRanges = (value, highlightRanges) => {
|
|
7543
|
+
const styleForTone = { caution: styles_lib_components_Textarea_Highlight_Highlight_css_cjs.caution, critical: styles_lib_components_Textarea_Highlight_Highlight_css_cjs.critical };
|
|
7544
|
+
const Highlight = ({ children, tone }) => /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { component: "mark", className: [styles_lib_components_Textarea_Highlight_Highlight_css_cjs.root, styleForTone[tone]], children });
|
|
7545
|
+
const formatRanges = (value, highlightRanges, tone) => {
|
|
7522
7546
|
if (highlightRanges && value) {
|
|
7523
7547
|
let lastEnd = 0;
|
|
7524
7548
|
const validatedAndSortedRanges = highlightRanges.sort((a, b) => a.start > b.start ? 1 : -1).reduce((acc, { end, start }) => {
|
|
@@ -7545,7 +7569,9 @@ const formatRanges = (value, highlightRanges) => {
|
|
|
7545
7569
|
])
|
|
7546
7570
|
).reduce((acc, { text, highlight }, i) => {
|
|
7547
7571
|
if (text) {
|
|
7548
|
-
acc.push(
|
|
7572
|
+
acc.push(
|
|
7573
|
+
highlight ? /* @__PURE__ */ jsxRuntime.jsx(Highlight, { tone, children: text }, i) : text
|
|
7574
|
+
);
|
|
7549
7575
|
}
|
|
7550
7576
|
return acc;
|
|
7551
7577
|
}, []);
|
|
@@ -7592,6 +7618,8 @@ const Textarea = React.forwardRef(
|
|
|
7592
7618
|
lines = 3,
|
|
7593
7619
|
lineLimit,
|
|
7594
7620
|
grow = true,
|
|
7621
|
+
tone,
|
|
7622
|
+
spellCheck,
|
|
7595
7623
|
...restProps
|
|
7596
7624
|
}, ref) => {
|
|
7597
7625
|
const [rows, setRows] = React.useState(lines);
|
|
@@ -7605,13 +7633,15 @@ const Textarea = React.forwardRef(
|
|
|
7605
7633
|
[highlightsRef]
|
|
7606
7634
|
);
|
|
7607
7635
|
const inputLength = String(value).length;
|
|
7608
|
-
const
|
|
7609
|
-
const
|
|
7636
|
+
const hasExceededCharacterLimit = characterLimit && inputLength > characterLimit;
|
|
7637
|
+
const highlightTone = !hasExceededCharacterLimit && (tone === "critical" || tone === "caution") ? tone : "critical";
|
|
7638
|
+
const highlightRanges = hasExceededCharacterLimit ? [{ start: characterLimit }] : highlightRangesProp;
|
|
7610
7639
|
const hasHighlights = highlightRanges.length > 0;
|
|
7611
7640
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7612
7641
|
Field,
|
|
7613
7642
|
{
|
|
7614
7643
|
...restProps,
|
|
7644
|
+
tone,
|
|
7615
7645
|
value,
|
|
7616
7646
|
icon: void 0,
|
|
7617
7647
|
prefix: void 0,
|
|
@@ -7642,7 +7672,7 @@ const Textarea = React.forwardRef(
|
|
|
7642
7672
|
left: 0,
|
|
7643
7673
|
className: [styles_lib_components_Textarea_Textarea_css_cjs.highlights, className],
|
|
7644
7674
|
...fieldProps,
|
|
7645
|
-
children: formatRanges(String(value), highlightRanges)
|
|
7675
|
+
children: formatRanges(String(value), highlightRanges, highlightTone)
|
|
7646
7676
|
}
|
|
7647
7677
|
) : null,
|
|
7648
7678
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7669,6 +7699,7 @@ const Textarea = React.forwardRef(
|
|
|
7669
7699
|
onPaste,
|
|
7670
7700
|
onScroll: hasHighlights ? (event) => updateScroll(event.currentTarget.scrollTop) : void 0,
|
|
7671
7701
|
placeholder: !restProps.disabled ? placeholder : void 0,
|
|
7702
|
+
spellCheck,
|
|
7672
7703
|
className: [styles_lib_components_Textarea_Textarea_css_cjs.field, className],
|
|
7673
7704
|
...fieldProps,
|
|
7674
7705
|
ref
|