braid-design-system 34.6.2 → 34.7.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 +28 -0
- package/dist/lib/components/Actions/Actions.cjs +0 -1
- package/dist/lib/components/Actions/Actions.mjs +1 -1
- package/dist/lib/components/ButtonIcon/ButtonIcon.cjs +16 -2
- package/dist/lib/components/ButtonIcon/ButtonIcon.d.cts +1 -1
- package/dist/lib/components/ButtonIcon/ButtonIcon.d.mts +1 -1
- package/dist/lib/components/ButtonIcon/ButtonIcon.mjs +16 -2
- package/dist/lib/components/Inline/Inline.d.cts +3 -3
- package/dist/lib/components/Inline/Inline.d.mts +3 -3
- package/dist/lib/components/MenuRenderer/MenuRenderer.css.cjs +0 -17
- package/dist/lib/components/MenuRenderer/MenuRenderer.css.mjs +1 -17
- package/dist/lib/components/MonthPicker/MonthPicker.d.cts +1 -1
- package/dist/lib/components/MonthPicker/MonthPicker.d.mts +1 -1
- package/dist/lib/components/Pagination/Pagination.css.cjs +0 -1
- package/dist/lib/components/Pagination/Pagination.css.mjs +0 -1
- package/dist/lib/components/Rating/Rating.cjs +1 -0
- package/dist/lib/components/Rating/Rating.mjs +1 -0
- package/dist/lib/components/Stepper/StepperContext.cjs +30 -20
- package/dist/lib/components/Stepper/StepperContext.mjs +30 -20
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.cjs +0 -2
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.mjs +1 -1
- package/dist/lib/components/private/InlineField/InlineField.css.cjs +0 -1
- package/dist/lib/components/private/InlineField/InlineField.css.mjs +1 -1
- package/dist/lib/components/private/InlineField/StyledInput.d.cts +1 -1
- package/dist/lib/components/private/InlineField/StyledInput.d.mts +1 -1
- package/dist/lib/components/private/Popover/Popover.css.cjs +1 -3
- package/dist/lib/components/private/Popover/Popover.css.mjs +2 -3
- package/dist/lib/components/private/Popover/Popover.d.cts +1 -1
- package/dist/lib/components/private/Popover/Popover.d.mts +1 -1
- package/dist/lib/playroom/snippets/ButtonIcon.cjs +4 -0
- package/dist/lib/playroom/snippets/ButtonIcon.mjs +4 -0
- package/dist/lib/themes/tokenType.d.cts +1 -1
- package/dist/lib/themes/tokenType.d.mts +1 -1
- package/dist/lib/utils/a11y/index.cjs +0 -2
- package/dist/lib/utils/a11y/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# braid-design-system
|
|
2
2
|
|
|
3
|
+
## 34.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **ButtonIcon:** Add `brandAccent` tone ([#2125](https://github.com/seek-oss/braid-design-system/pull/2125))
|
|
8
|
+
|
|
9
|
+
Introduces support for the `brandAccent` tone on `ButtonIcon`.
|
|
10
|
+
|
|
11
|
+
**EXAMPLE USAGE:**
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<ButtonIcon tone="brandAccent" icon={<IconAdd />} label="Add" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **ButtonIcon:** Default accent tones to `solid` when `variant` is omitted ([#2125](https://github.com/seek-oss/braid-design-system/pull/2125))
|
|
18
|
+
|
|
19
|
+
Accent tones (`formAccent`, `brandAccent`) now default to `solid` when `variant` is omitted — existing `formAccent` usage can pass `variant="soft"` to keep the previous look.
|
|
20
|
+
|
|
21
|
+
**EXAMPLE USAGE:**
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<ButtonIcon tone="formAccent" icon={<IconAdd />} label="Add" />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- **Rating:** Expose the star graphic with `role="img"` so the `aria-label` is announced reliably by assistive technologies. ([#2122](https://github.com/seek-oss/braid-design-system/pull/2122))
|
|
30
|
+
|
|
3
31
|
## 34.6.2
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -19,7 +19,11 @@ const buttonIconVariants = [
|
|
|
19
19
|
"transparent",
|
|
20
20
|
"solid"
|
|
21
21
|
];
|
|
22
|
-
const buttonIconTones = [
|
|
22
|
+
const buttonIconTones = [
|
|
23
|
+
"neutral",
|
|
24
|
+
"formAccent",
|
|
25
|
+
"brandAccent"
|
|
26
|
+
];
|
|
23
27
|
const buttonIconSizes = [
|
|
24
28
|
"small",
|
|
25
29
|
"standard",
|
|
@@ -30,7 +34,17 @@ const padding = {
|
|
|
30
34
|
standard: "xsmall",
|
|
31
35
|
large: "xsmall"
|
|
32
36
|
};
|
|
33
|
-
const
|
|
37
|
+
const resolveToneAndVariant = ({ variant: variantProp, tone: toneProp }) => {
|
|
38
|
+
return {
|
|
39
|
+
variant: variantProp ?? (toneProp === "formAccent" || toneProp === "brandAccent" ? "solid" : "soft"),
|
|
40
|
+
tone: toneProp ?? "neutral"
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const ButtonIconContent = (0, react.forwardRef)(({ icon, label, id, size = "standard", tone: toneProp, variant: variantProp, type = "button", bleed, tooltipPlacement, loading, onClick, onMouseDown, onKeyUp, onKeyDown, "aria-haspopup": ariaHasPopUp, "aria-expanded": ariaExpanded, "aria-describedby": ariaDescribedBy, "aria-pressed": ariaPressed, tabIndex, data, ...restProps }, forwardedRef) => {
|
|
44
|
+
const { tone, variant } = resolveToneAndVariant({
|
|
45
|
+
variant: variantProp,
|
|
46
|
+
tone: toneProp
|
|
47
|
+
});
|
|
34
48
|
const { root, content } = require_Button.useButtonStyles({
|
|
35
49
|
variant,
|
|
36
50
|
tone,
|
|
@@ -4,7 +4,7 @@ import { ButtonStyleProps } from "../Button/Button.cjs";
|
|
|
4
4
|
import { AllHTMLAttributes, ReactElement } from "react";
|
|
5
5
|
//#region src/lib/components/ButtonIcon/ButtonIcon.d.ts
|
|
6
6
|
declare const buttonIconVariants: Array<Extract<ButtonStyleProps['variant'], 'soft' | 'transparent' | 'solid'>>;
|
|
7
|
-
declare const buttonIconTones: Array<Extract<ButtonStyleProps['tone'], 'neutral' | 'formAccent'>>;
|
|
7
|
+
declare const buttonIconTones: Array<Extract<ButtonStyleProps['tone'], 'neutral' | 'formAccent' | 'brandAccent'>>;
|
|
8
8
|
declare const buttonIconSizes: readonly ["small", "standard", "large"];
|
|
9
9
|
type ButtonIconSize = (typeof buttonIconSizes)[number];
|
|
10
10
|
type NativeButtonProps = AllHTMLAttributes<HTMLButtonElement>;
|
|
@@ -4,7 +4,7 @@ import { ButtonStyleProps } from "../Button/Button.mjs";
|
|
|
4
4
|
import { AllHTMLAttributes, ReactElement } from "react";
|
|
5
5
|
//#region src/lib/components/ButtonIcon/ButtonIcon.d.ts
|
|
6
6
|
declare const buttonIconVariants: Array<Extract<ButtonStyleProps['variant'], 'soft' | 'transparent' | 'solid'>>;
|
|
7
|
-
declare const buttonIconTones: Array<Extract<ButtonStyleProps['tone'], 'neutral' | 'formAccent'>>;
|
|
7
|
+
declare const buttonIconTones: Array<Extract<ButtonStyleProps['tone'], 'neutral' | 'formAccent' | 'brandAccent'>>;
|
|
8
8
|
declare const buttonIconSizes: readonly ["small", "standard", "large"];
|
|
9
9
|
type ButtonIconSize = (typeof buttonIconSizes)[number];
|
|
10
10
|
type NativeButtonProps = AllHTMLAttributes<HTMLButtonElement>;
|
|
@@ -17,7 +17,11 @@ const buttonIconVariants = [
|
|
|
17
17
|
"transparent",
|
|
18
18
|
"solid"
|
|
19
19
|
];
|
|
20
|
-
const buttonIconTones = [
|
|
20
|
+
const buttonIconTones = [
|
|
21
|
+
"neutral",
|
|
22
|
+
"formAccent",
|
|
23
|
+
"brandAccent"
|
|
24
|
+
];
|
|
21
25
|
const buttonIconSizes = [
|
|
22
26
|
"small",
|
|
23
27
|
"standard",
|
|
@@ -28,7 +32,17 @@ const padding = {
|
|
|
28
32
|
standard: "xsmall",
|
|
29
33
|
large: "xsmall"
|
|
30
34
|
};
|
|
31
|
-
const
|
|
35
|
+
const resolveToneAndVariant = ({ variant: variantProp, tone: toneProp }) => {
|
|
36
|
+
return {
|
|
37
|
+
variant: variantProp ?? (toneProp === "formAccent" || toneProp === "brandAccent" ? "solid" : "soft"),
|
|
38
|
+
tone: toneProp ?? "neutral"
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const ButtonIconContent = forwardRef(({ icon, label, id, size = "standard", tone: toneProp, variant: variantProp, type = "button", bleed, tooltipPlacement, loading, onClick, onMouseDown, onKeyUp, onKeyDown, "aria-haspopup": ariaHasPopUp, "aria-expanded": ariaExpanded, "aria-describedby": ariaDescribedBy, "aria-pressed": ariaPressed, tabIndex, data, ...restProps }, forwardedRef) => {
|
|
42
|
+
const { tone, variant } = resolveToneAndVariant({
|
|
43
|
+
variant: variantProp,
|
|
44
|
+
tone: toneProp
|
|
45
|
+
});
|
|
32
46
|
const { root, content } = useButtonStyles({
|
|
33
47
|
variant,
|
|
34
48
|
tone,
|
|
@@ -4,14 +4,14 @@ import { DataAttributeMap } from "../private/buildDataAttributes.cjs";
|
|
|
4
4
|
import { CollapsibleAlignmentProps } from "../../utils/collapsibleAlignmentProps.cjs";
|
|
5
5
|
import { FC } from "react";
|
|
6
6
|
//#region src/lib/components/Inline/Inline.d.ts
|
|
7
|
-
|
|
7
|
+
type ValidInlineComponent = 'div' | 'span' | 'p' | 'nav' | 'ul' | 'ol' | 'li';
|
|
8
8
|
type InlineProps = CollapsibleAlignmentProps & {
|
|
9
9
|
space: ResponsiveSpace;
|
|
10
|
-
component?:
|
|
10
|
+
component?: ValidInlineComponent;
|
|
11
11
|
data?: DataAttributeMap;
|
|
12
12
|
children: ReactNodeNoStrings;
|
|
13
13
|
noWrap?: boolean;
|
|
14
14
|
};
|
|
15
15
|
declare const Inline: FC<InlineProps>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { Inline, InlineProps
|
|
17
|
+
export { Inline, InlineProps };
|
|
@@ -4,14 +4,14 @@ import { DataAttributeMap } from "../private/buildDataAttributes.mjs";
|
|
|
4
4
|
import { CollapsibleAlignmentProps } from "../../utils/collapsibleAlignmentProps.mjs";
|
|
5
5
|
import { FC } from "react";
|
|
6
6
|
//#region src/lib/components/Inline/Inline.d.ts
|
|
7
|
-
|
|
7
|
+
type ValidInlineComponent = 'div' | 'span' | 'p' | 'nav' | 'ul' | 'ol' | 'li';
|
|
8
8
|
type InlineProps = CollapsibleAlignmentProps & {
|
|
9
9
|
space: ResponsiveSpace;
|
|
10
|
-
component?:
|
|
10
|
+
component?: ValidInlineComponent;
|
|
11
11
|
data?: DataAttributeMap;
|
|
12
12
|
children: ReactNodeNoStrings;
|
|
13
13
|
noWrap?: boolean;
|
|
14
14
|
};
|
|
15
15
|
declare const Inline: FC<InlineProps>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { Inline, InlineProps
|
|
17
|
+
export { Inline, InlineProps };
|
|
@@ -5,22 +5,6 @@ let _vanilla_extract_css_utils = require("@vanilla-extract/css-utils");
|
|
|
5
5
|
//#region src/lib/components/MenuRenderer/MenuRenderer.css.ts
|
|
6
6
|
(0, _vanilla_extract_css_fileScope.setFileScope)("src/lib/components/MenuRenderer/MenuRenderer.css.ts", "braid-design-system");
|
|
7
7
|
const menuYPadding = (0, _vanilla_extract_css.createVar)("menuYPadding");
|
|
8
|
-
(0, _vanilla_extract_css.style)({
|
|
9
|
-
width: "100vw",
|
|
10
|
-
height: "100vh"
|
|
11
|
-
}, "backdrop");
|
|
12
|
-
const triggerVars = {
|
|
13
|
-
top: (0, _vanilla_extract_css.createVar)("triggerVars_top"),
|
|
14
|
-
left: (0, _vanilla_extract_css.createVar)("triggerVars_left"),
|
|
15
|
-
bottom: (0, _vanilla_extract_css.createVar)("triggerVars_bottom"),
|
|
16
|
-
right: (0, _vanilla_extract_css.createVar)("triggerVars_right")
|
|
17
|
-
};
|
|
18
|
-
(0, _vanilla_extract_css.style)({
|
|
19
|
-
top: triggerVars.bottom,
|
|
20
|
-
bottom: triggerVars.top,
|
|
21
|
-
left: triggerVars.left,
|
|
22
|
-
right: triggerVars.right
|
|
23
|
-
}, "menuPosition");
|
|
24
8
|
const widthVar = (0, _vanilla_extract_css.createVar)("widthVar");
|
|
25
9
|
const baseWidth = (0, _vanilla_extract_css.style)({ width: (0, _vanilla_extract_css_utils.calc)(widthVar).divide(4).toString() }, "baseWidth");
|
|
26
10
|
const { small, medium, large } = require_vars_css.vars.contentWidth;
|
|
@@ -34,5 +18,4 @@ const menuHeightLimit = (0, _vanilla_extract_css.style)({ maxHeight: (0, _vanill
|
|
|
34
18
|
//#endregion
|
|
35
19
|
exports.menuHeightLimit = menuHeightLimit;
|
|
36
20
|
exports.menuYPadding = menuYPadding;
|
|
37
|
-
exports.triggerVars = triggerVars;
|
|
38
21
|
exports.width = width;
|
|
@@ -5,22 +5,6 @@ import { calc } from "@vanilla-extract/css-utils";
|
|
|
5
5
|
//#region src/lib/components/MenuRenderer/MenuRenderer.css.ts
|
|
6
6
|
setFileScope("src/lib/components/MenuRenderer/MenuRenderer.css.ts", "braid-design-system");
|
|
7
7
|
const menuYPadding = createVar("menuYPadding");
|
|
8
|
-
style({
|
|
9
|
-
width: "100vw",
|
|
10
|
-
height: "100vh"
|
|
11
|
-
}, "backdrop");
|
|
12
|
-
const triggerVars = {
|
|
13
|
-
top: createVar("triggerVars_top"),
|
|
14
|
-
left: createVar("triggerVars_left"),
|
|
15
|
-
bottom: createVar("triggerVars_bottom"),
|
|
16
|
-
right: createVar("triggerVars_right")
|
|
17
|
-
};
|
|
18
|
-
style({
|
|
19
|
-
top: triggerVars.bottom,
|
|
20
|
-
bottom: triggerVars.top,
|
|
21
|
-
left: triggerVars.left,
|
|
22
|
-
right: triggerVars.right
|
|
23
|
-
}, "menuPosition");
|
|
24
8
|
const widthVar = createVar("widthVar");
|
|
25
9
|
const baseWidth = style({ width: calc(widthVar).divide(4).toString() }, "baseWidth");
|
|
26
10
|
const { small, medium, large } = vars.contentWidth;
|
|
@@ -32,4 +16,4 @@ const width = styleVariants({
|
|
|
32
16
|
const menuHeightLimit = style({ maxHeight: calc(vars.touchableSize).multiply(9.5).add(calc(menuYPadding).multiply(2)).toString() }, "menuHeightLimit");
|
|
33
17
|
endFileScope();
|
|
34
18
|
//#endregion
|
|
35
|
-
export { menuHeightLimit, menuYPadding,
|
|
19
|
+
export { menuHeightLimit, menuYPadding, width };
|
|
@@ -11,7 +11,6 @@ const focusRing = (0, _vanilla_extract_css.style)([{ outlineOffset: 0 }, require
|
|
|
11
11
|
borderRadius
|
|
12
12
|
})], "focusRing");
|
|
13
13
|
const hover = (0, _vanilla_extract_css.style)({}, "hover");
|
|
14
|
-
(0, _vanilla_extract_css.style)(require_colorModeStyle.colorModeStyle({ lightMode: { opacity: .3 } }), "lightModeCurrentKeyline");
|
|
15
14
|
const darkModeCurrentKeyline = (0, _vanilla_extract_css.style)(require_colorModeStyle.colorModeStyle({ darkMode: { opacity: .3 } }), "darkModeCurrentKeyline");
|
|
16
15
|
const current = (0, _vanilla_extract_css.style)({ opacity: .075 }, "current");
|
|
17
16
|
const background = (0, _vanilla_extract_css.style)({ selectors: { [`${hover}:hover &:not(${current})`]: { opacity: .5 } } }, "background");
|
|
@@ -11,7 +11,6 @@ const focusRing = style([{ outlineOffset: 0 }, atoms({
|
|
|
11
11
|
borderRadius
|
|
12
12
|
})], "focusRing");
|
|
13
13
|
const hover = style({}, "hover");
|
|
14
|
-
style(colorModeStyle({ lightMode: { opacity: .3 } }), "lightModeCurrentKeyline");
|
|
15
14
|
const darkModeCurrentKeyline = style(colorModeStyle({ darkMode: { opacity: .3 } }), "darkModeCurrentKeyline");
|
|
16
15
|
const current = style({ opacity: .075 }, "current");
|
|
17
16
|
const background = style({ selectors: { [`${hover}:hover &:not(${current})`]: { opacity: .5 } } }, "background");
|
|
@@ -45,6 +45,7 @@ const Rating = ({ rating, size = "standard", weight, variant = "full", tone = "b
|
|
|
45
45
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
46
46
|
component: "span",
|
|
47
47
|
className: require_Rating_css.inlineFlex,
|
|
48
|
+
role: "img",
|
|
48
49
|
"aria-label": ariaLabel || `${rating.toFixed(1)} out of ${ratingArr.length}`,
|
|
49
50
|
children: variant === "minimal" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingStar, {
|
|
50
51
|
percent: 100,
|
|
@@ -42,6 +42,7 @@ const Rating = ({ rating, size = "standard", weight, variant = "full", tone = "b
|
|
|
42
42
|
children: [/* @__PURE__ */ jsx(Box, {
|
|
43
43
|
component: "span",
|
|
44
44
|
className: inlineFlex,
|
|
45
|
+
role: "img",
|
|
45
46
|
"aria-label": ariaLabel || `${rating.toFixed(1)} out of ${ratingArr.length}`,
|
|
46
47
|
children: variant === "minimal" ? /* @__PURE__ */ jsx(RatingStar, {
|
|
47
48
|
percent: 100,
|
|
@@ -6,6 +6,16 @@ const StepContext = (0, react.createContext)({
|
|
|
6
6
|
stepNumber: 0,
|
|
7
7
|
isLast: false
|
|
8
8
|
});
|
|
9
|
+
const NAV_RIGHT = 0;
|
|
10
|
+
const NAV_DOWN = 1;
|
|
11
|
+
const NAV_LEFT = 2;
|
|
12
|
+
const NAV_UP = 3;
|
|
13
|
+
const NAV_HOME = 4;
|
|
14
|
+
const NAV_END = 5;
|
|
15
|
+
const NAV_TAB = 6;
|
|
16
|
+
const NAV_CLICKED = 7;
|
|
17
|
+
const NAV_FOCUSED = 8;
|
|
18
|
+
const NAV_BLURRED = 9;
|
|
9
19
|
const StepperContext = (0, react.createContext)(null);
|
|
10
20
|
const getNextStep = (moveAmount, current, maxStep) => {
|
|
11
21
|
if (current === null) return moveAmount > 0 ? 1 : maxStep;
|
|
@@ -18,34 +28,34 @@ const StepperContextProvider = ({ children, activeStep, stepCount: stepCountProp
|
|
|
18
28
|
const stepCount = isLinear ? progress : stepCountProp;
|
|
19
29
|
const [stepperState, dispatch] = (0, react.useReducer)((state, action) => {
|
|
20
30
|
switch (action.type) {
|
|
21
|
-
case
|
|
22
|
-
case
|
|
31
|
+
case NAV_UP:
|
|
32
|
+
case NAV_LEFT: return {
|
|
23
33
|
...state,
|
|
24
34
|
focusedStep: getNextStep(-1, state.focusedStep, stepCount)
|
|
25
35
|
};
|
|
26
|
-
case
|
|
27
|
-
case
|
|
36
|
+
case NAV_DOWN:
|
|
37
|
+
case NAV_RIGHT: return {
|
|
28
38
|
...state,
|
|
29
39
|
focusedStep: getNextStep(1, state.focusedStep, stepCount)
|
|
30
40
|
};
|
|
31
|
-
case
|
|
41
|
+
case NAV_HOME: return {
|
|
32
42
|
...state,
|
|
33
43
|
focusedStep: 1
|
|
34
44
|
};
|
|
35
|
-
case
|
|
45
|
+
case NAV_END: return {
|
|
36
46
|
...state,
|
|
37
47
|
focusedStep: stepCount
|
|
38
48
|
};
|
|
39
|
-
case
|
|
40
|
-
case
|
|
49
|
+
case NAV_BLURRED:
|
|
50
|
+
case NAV_TAB: return {
|
|
41
51
|
...state,
|
|
42
52
|
focusedStep: null
|
|
43
53
|
};
|
|
44
|
-
case
|
|
54
|
+
case NAV_CLICKED: return {
|
|
45
55
|
...state,
|
|
46
56
|
focusedStep: action.value
|
|
47
57
|
};
|
|
48
|
-
case
|
|
58
|
+
case NAV_FOCUSED: return {
|
|
49
59
|
...state,
|
|
50
60
|
focusedStep: state.focusedStep === null ? activeStep : state.focusedStep
|
|
51
61
|
};
|
|
@@ -64,27 +74,27 @@ const StepperContextProvider = ({ children, activeStep, stepCount: stepCountProp
|
|
|
64
74
|
const targetKey = require_normalizeKey.normalizeKey(event);
|
|
65
75
|
if (targetKey === "Tab") return;
|
|
66
76
|
const action = {
|
|
67
|
-
ArrowRight: { type:
|
|
68
|
-
ArrowLeft: { type:
|
|
69
|
-
ArrowUp: { type:
|
|
70
|
-
ArrowDown: { type:
|
|
71
|
-
Home: { type:
|
|
72
|
-
End: { type:
|
|
77
|
+
ArrowRight: { type: NAV_RIGHT },
|
|
78
|
+
ArrowLeft: { type: NAV_LEFT },
|
|
79
|
+
ArrowUp: { type: NAV_UP },
|
|
80
|
+
ArrowDown: { type: NAV_DOWN },
|
|
81
|
+
Home: { type: NAV_HOME },
|
|
82
|
+
End: { type: NAV_END }
|
|
73
83
|
};
|
|
74
84
|
if (action[targetKey]) dispatch(action[targetKey]);
|
|
75
85
|
};
|
|
76
86
|
const onKeyDown = (event) => {
|
|
77
87
|
const targetKey = require_normalizeKey.normalizeKey(event);
|
|
78
88
|
if (targetKey === "Tab") {
|
|
79
|
-
dispatch({ type:
|
|
89
|
+
dispatch({ type: NAV_TAB });
|
|
80
90
|
return;
|
|
81
91
|
}
|
|
82
92
|
if (targetKey.indexOf("Arrow") === 0 || ["Home", "End"].includes(targetKey)) event.preventDefault();
|
|
83
93
|
};
|
|
84
|
-
const onFocus = () => dispatch({ type:
|
|
85
|
-
const onBlur = () => dispatch({ type:
|
|
94
|
+
const onFocus = () => dispatch({ type: NAV_FOCUSED });
|
|
95
|
+
const onBlur = () => dispatch({ type: NAV_BLURRED });
|
|
86
96
|
const onClick = (index) => dispatch({
|
|
87
|
-
type:
|
|
97
|
+
type: NAV_CLICKED,
|
|
88
98
|
value: index
|
|
89
99
|
});
|
|
90
100
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepperContext.Provider, {
|
|
@@ -6,6 +6,16 @@ const StepContext = createContext({
|
|
|
6
6
|
stepNumber: 0,
|
|
7
7
|
isLast: false
|
|
8
8
|
});
|
|
9
|
+
const NAV_RIGHT = 0;
|
|
10
|
+
const NAV_DOWN = 1;
|
|
11
|
+
const NAV_LEFT = 2;
|
|
12
|
+
const NAV_UP = 3;
|
|
13
|
+
const NAV_HOME = 4;
|
|
14
|
+
const NAV_END = 5;
|
|
15
|
+
const NAV_TAB = 6;
|
|
16
|
+
const NAV_CLICKED = 7;
|
|
17
|
+
const NAV_FOCUSED = 8;
|
|
18
|
+
const NAV_BLURRED = 9;
|
|
9
19
|
const StepperContext = createContext(null);
|
|
10
20
|
const getNextStep = (moveAmount, current, maxStep) => {
|
|
11
21
|
if (current === null) return moveAmount > 0 ? 1 : maxStep;
|
|
@@ -18,34 +28,34 @@ const StepperContextProvider = ({ children, activeStep, stepCount: stepCountProp
|
|
|
18
28
|
const stepCount = isLinear ? progress : stepCountProp;
|
|
19
29
|
const [stepperState, dispatch] = useReducer((state, action) => {
|
|
20
30
|
switch (action.type) {
|
|
21
|
-
case
|
|
22
|
-
case
|
|
31
|
+
case NAV_UP:
|
|
32
|
+
case NAV_LEFT: return {
|
|
23
33
|
...state,
|
|
24
34
|
focusedStep: getNextStep(-1, state.focusedStep, stepCount)
|
|
25
35
|
};
|
|
26
|
-
case
|
|
27
|
-
case
|
|
36
|
+
case NAV_DOWN:
|
|
37
|
+
case NAV_RIGHT: return {
|
|
28
38
|
...state,
|
|
29
39
|
focusedStep: getNextStep(1, state.focusedStep, stepCount)
|
|
30
40
|
};
|
|
31
|
-
case
|
|
41
|
+
case NAV_HOME: return {
|
|
32
42
|
...state,
|
|
33
43
|
focusedStep: 1
|
|
34
44
|
};
|
|
35
|
-
case
|
|
45
|
+
case NAV_END: return {
|
|
36
46
|
...state,
|
|
37
47
|
focusedStep: stepCount
|
|
38
48
|
};
|
|
39
|
-
case
|
|
40
|
-
case
|
|
49
|
+
case NAV_BLURRED:
|
|
50
|
+
case NAV_TAB: return {
|
|
41
51
|
...state,
|
|
42
52
|
focusedStep: null
|
|
43
53
|
};
|
|
44
|
-
case
|
|
54
|
+
case NAV_CLICKED: return {
|
|
45
55
|
...state,
|
|
46
56
|
focusedStep: action.value
|
|
47
57
|
};
|
|
48
|
-
case
|
|
58
|
+
case NAV_FOCUSED: return {
|
|
49
59
|
...state,
|
|
50
60
|
focusedStep: state.focusedStep === null ? activeStep : state.focusedStep
|
|
51
61
|
};
|
|
@@ -64,27 +74,27 @@ const StepperContextProvider = ({ children, activeStep, stepCount: stepCountProp
|
|
|
64
74
|
const targetKey = normalizeKey(event);
|
|
65
75
|
if (targetKey === "Tab") return;
|
|
66
76
|
const action = {
|
|
67
|
-
ArrowRight: { type:
|
|
68
|
-
ArrowLeft: { type:
|
|
69
|
-
ArrowUp: { type:
|
|
70
|
-
ArrowDown: { type:
|
|
71
|
-
Home: { type:
|
|
72
|
-
End: { type:
|
|
77
|
+
ArrowRight: { type: NAV_RIGHT },
|
|
78
|
+
ArrowLeft: { type: NAV_LEFT },
|
|
79
|
+
ArrowUp: { type: NAV_UP },
|
|
80
|
+
ArrowDown: { type: NAV_DOWN },
|
|
81
|
+
Home: { type: NAV_HOME },
|
|
82
|
+
End: { type: NAV_END }
|
|
73
83
|
};
|
|
74
84
|
if (action[targetKey]) dispatch(action[targetKey]);
|
|
75
85
|
};
|
|
76
86
|
const onKeyDown = (event) => {
|
|
77
87
|
const targetKey = normalizeKey(event);
|
|
78
88
|
if (targetKey === "Tab") {
|
|
79
|
-
dispatch({ type:
|
|
89
|
+
dispatch({ type: NAV_TAB });
|
|
80
90
|
return;
|
|
81
91
|
}
|
|
82
92
|
if (targetKey.indexOf("Arrow") === 0 || ["Home", "End"].includes(targetKey)) event.preventDefault();
|
|
83
93
|
};
|
|
84
|
-
const onFocus = () => dispatch({ type:
|
|
85
|
-
const onBlur = () => dispatch({ type:
|
|
94
|
+
const onFocus = () => dispatch({ type: NAV_FOCUSED });
|
|
95
|
+
const onBlur = () => dispatch({ type: NAV_BLURRED });
|
|
86
96
|
const onClick = (index) => dispatch({
|
|
87
|
-
type:
|
|
97
|
+
type: NAV_CLICKED,
|
|
88
98
|
value: index
|
|
89
99
|
});
|
|
90
100
|
return /* @__PURE__ */ jsx(StepperContext.Provider, {
|
|
@@ -156,5 +156,3 @@ const TooltipRenderer = ({ id, tooltip, placement = "top", children }) => {
|
|
|
156
156
|
//#endregion
|
|
157
157
|
exports.TooltipContent = TooltipContent;
|
|
158
158
|
exports.TooltipRenderer = TooltipRenderer;
|
|
159
|
-
exports.TooltipTextDefaultsProvider = TooltipTextDefaultsProvider;
|
|
160
|
-
exports.offsetSpace = offsetSpace;
|
|
@@ -67,7 +67,6 @@ exports.disabledRadioIndicator = disabledRadioIndicator;
|
|
|
67
67
|
exports.fakeField = fakeField;
|
|
68
68
|
exports.hideBorderOnDarkBackgroundInLightMode = hideBorderOnDarkBackgroundInLightMode;
|
|
69
69
|
exports.hoverOverlay = hoverOverlay;
|
|
70
|
-
exports.indicator = indicator;
|
|
71
70
|
exports.isMixed = isMixed;
|
|
72
71
|
exports.labelOffset = labelOffset;
|
|
73
72
|
exports.radioIndicator = radioIndicator;
|
|
@@ -61,4 +61,4 @@ const radioIndicator = [indicator, style({
|
|
|
61
61
|
}, "radioScale")];
|
|
62
62
|
endFileScope();
|
|
63
63
|
//#endregion
|
|
64
|
-
export { checkboxIndicator, children, disabledRadioIndicator, fakeField, hideBorderOnDarkBackgroundInLightMode, hoverOverlay,
|
|
64
|
+
export { checkboxIndicator, children, disabledRadioIndicator, fakeField, hideBorderOnDarkBackgroundInLightMode, hoverOverlay, isMixed, labelOffset, radioIndicator, realField, selected, sizeVars };
|
|
@@ -10,10 +10,9 @@ const backdrop = (0, _vanilla_extract_css.style)({
|
|
|
10
10
|
}, "backdrop");
|
|
11
11
|
const placementModifier = (0, _vanilla_extract_css.createVar)("placementModifier");
|
|
12
12
|
const invertPlacement = (0, _vanilla_extract_css.style)({ vars: { [placementModifier]: "-1" } }, "invertPlacement");
|
|
13
|
-
const transitionThreshold = "xxsmall";
|
|
14
13
|
const popupAnimation = (0, _vanilla_extract_css.keyframes)({ from: {
|
|
15
14
|
opacity: 0,
|
|
16
|
-
transform: `translateY(${(0, _vanilla_extract_css_utils.calc)(require_vars_css.vars.space[
|
|
15
|
+
transform: `translateY(${(0, _vanilla_extract_css_utils.calc)(require_vars_css.vars.space["xxsmall"]).multiply((0, _vanilla_extract_css.fallbackVar)(placementModifier, "1"))})`
|
|
17
16
|
} }, "popupAnimation");
|
|
18
17
|
const animation = (0, _vanilla_extract_css.style)({
|
|
19
18
|
animationName: popupAnimation,
|
|
@@ -29,4 +28,3 @@ exports.animation = animation;
|
|
|
29
28
|
exports.backdrop = backdrop;
|
|
30
29
|
exports.delayVisibility = delayVisibility;
|
|
31
30
|
exports.invertPlacement = invertPlacement;
|
|
32
|
-
exports.transitionThreshold = transitionThreshold;
|
|
@@ -10,10 +10,9 @@ const backdrop = style({
|
|
|
10
10
|
}, "backdrop");
|
|
11
11
|
const placementModifier = createVar("placementModifier");
|
|
12
12
|
const invertPlacement = style({ vars: { [placementModifier]: "-1" } }, "invertPlacement");
|
|
13
|
-
const transitionThreshold = "xxsmall";
|
|
14
13
|
const popupAnimation = keyframes({ from: {
|
|
15
14
|
opacity: 0,
|
|
16
|
-
transform: `translateY(${calc(vars.space[
|
|
15
|
+
transform: `translateY(${calc(vars.space["xxsmall"]).multiply(fallbackVar(placementModifier, "1"))})`
|
|
17
16
|
} }, "popupAnimation");
|
|
18
17
|
const animation = style({
|
|
19
18
|
animationName: popupAnimation,
|
|
@@ -25,4 +24,4 @@ const animation = style({
|
|
|
25
24
|
const delayVisibility = style({ animationDelay: "250ms" }, "delayVisibility");
|
|
26
25
|
endFileScope();
|
|
27
26
|
//#endregion
|
|
28
|
-
export { animation, backdrop, delayVisibility, invertPlacement
|
|
27
|
+
export { animation, backdrop, delayVisibility, invertPlacement };
|
|
@@ -23,6 +23,10 @@ const snippets = [
|
|
|
23
23
|
{
|
|
24
24
|
description: "Form accent",
|
|
25
25
|
code: "<ButtonIcon tone=\"formAccent\" icon={<IconAdd />} label=\"Add\" />"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
description: "Brand accent",
|
|
29
|
+
code: "<ButtonIcon tone=\"brandAccent\" icon={<IconAdd />} label=\"Add\" />"
|
|
26
30
|
}
|
|
27
31
|
];
|
|
28
32
|
//#endregion
|
|
@@ -23,6 +23,10 @@ const snippets = [
|
|
|
23
23
|
{
|
|
24
24
|
description: "Form accent",
|
|
25
25
|
code: "<ButtonIcon tone=\"formAccent\" icon={<IconAdd />} label=\"Add\" />"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
description: "Brand accent",
|
|
29
|
+
code: "<ButtonIcon tone=\"brandAccent\" icon={<IconAdd />} label=\"Add\" />"
|
|
26
30
|
}
|
|
27
31
|
];
|
|
28
32
|
//#endregion
|
|
@@ -103,8 +103,6 @@ function getAccessibleVariant(color, background) {
|
|
|
103
103
|
return findClosestAccessibleDarkerColor(color, background ?? getLightVariant(color), AA_TEXT_CONTRAST);
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
|
-
exports.contrast = contrast;
|
|
107
|
-
exports.findClosestAccessibleDarkerColor = findClosestAccessibleDarkerColor;
|
|
108
106
|
exports.findClosestAccessibleLighterColor = findClosestAccessibleLighterColor;
|
|
109
107
|
exports.getAccessibleVariant = getAccessibleVariant;
|
|
110
108
|
exports.getLightVariant = getLightVariant;
|
|
@@ -103,4 +103,4 @@ function getAccessibleVariant(color, background) {
|
|
|
103
103
|
return findClosestAccessibleDarkerColor(color, background ?? getLightVariant(color), AA_TEXT_CONTRAST);
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
|
-
export {
|
|
106
|
+
export { findClosestAccessibleLighterColor, getAccessibleVariant, getLightVariant };
|