@box/blueprint-web 6.17.0 → 6.18.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/lib-esm/index.css +16 -13
- package/lib-esm/primitives/icon-button/icon-button.module.js +1 -1
- package/lib-esm/primitives/select-menu-grid/index.d.ts +1 -1
- package/lib-esm/primitives/select-menu-grid/select-menu-grid-option.js +19 -17
- package/lib-esm/primitives/select-menu-grid/select-menu-grid.d.ts +5 -1
- package/lib-esm/primitives/select-menu-grid/select-menu-grid.js +12 -9
- package/lib-esm/primitives/select-menu-grid/types.d.ts +4 -3
- package/lib-esm/util-components/focus-trap/focus-trap.d.ts +0 -1
- package/lib-esm/utils/testStories.utils.d.ts +0 -1
- package/package.json +2 -2
package/lib-esm/index.css
CHANGED
|
@@ -791,7 +791,7 @@
|
|
|
791
791
|
top:0;
|
|
792
792
|
}
|
|
793
793
|
|
|
794
|
-
.icon_button_module_iconButton--
|
|
794
|
+
.icon_button_module_iconButton--5ec37{
|
|
795
795
|
align-items:center;
|
|
796
796
|
background:var(--surface-cta-surface-icon);
|
|
797
797
|
border:0;
|
|
@@ -802,44 +802,47 @@
|
|
|
802
802
|
justify-content:center;
|
|
803
803
|
padding:0;
|
|
804
804
|
}
|
|
805
|
-
.icon_button_module_iconButton--
|
|
805
|
+
.icon_button_module_iconButton--5ec37 .icon_button_module_iconColor--5ec37 *{
|
|
806
806
|
fill:var(--icon-cta-icon);
|
|
807
807
|
}
|
|
808
|
-
.icon_button_module_iconButton--
|
|
808
|
+
.icon_button_module_iconButton--5ec37[aria-disabled=true]{
|
|
809
809
|
background:var(--surface-cta-surface-icon-disabled);
|
|
810
810
|
opacity:.3;
|
|
811
811
|
}
|
|
812
|
-
.icon_button_module_iconButton--
|
|
812
|
+
.icon_button_module_iconButton--5ec37[aria-disabled=true] .icon_button_module_iconColor--5ec37 *{
|
|
813
813
|
fill:var(--gray-50);
|
|
814
814
|
}
|
|
815
|
-
.icon_button_module_iconButton--
|
|
815
|
+
.icon_button_module_iconButton--5ec37:focus-visible{
|
|
816
|
+
outline:none;
|
|
817
|
+
}
|
|
818
|
+
.icon_button_module_iconButton--5ec37[data-focus-visible]{
|
|
816
819
|
background:var(--surface-cta-surface-icon-hover);
|
|
817
820
|
outline:var(--border-2) solid var(--outline-focus-on-light);
|
|
818
821
|
}
|
|
819
|
-
.icon_button_module_iconButton--
|
|
822
|
+
.icon_button_module_iconButton--5ec37[data-focus-visible] .icon_button_module_iconColor--5ec37 *{
|
|
820
823
|
fill:var(--icon-cta-icon-hover);
|
|
821
824
|
}
|
|
822
|
-
.icon_button_module_iconButton--
|
|
825
|
+
.icon_button_module_iconButton--5ec37:hover{
|
|
823
826
|
background:var(--surface-cta-surface-icon-hover);
|
|
824
827
|
}
|
|
825
|
-
.icon_button_module_iconButton--
|
|
828
|
+
.icon_button_module_iconButton--5ec37:hover .icon_button_module_iconColor--5ec37 *{
|
|
826
829
|
fill:var(--icon-cta-icon-hover);
|
|
827
830
|
}
|
|
828
|
-
.icon_button_module_iconButton--
|
|
831
|
+
.icon_button_module_iconButton--5ec37:active,.icon_button_module_iconButton--5ec37[data-active]{
|
|
829
832
|
background:var(--surface-cta-surface-icon-pressed);
|
|
830
833
|
}
|
|
831
|
-
.icon_button_module_iconButton--
|
|
834
|
+
.icon_button_module_iconButton--5ec37:active .icon_button_module_iconColor--5ec37 *,.icon_button_module_iconButton--5ec37[data-active] .icon_button_module_iconColor--5ec37 *{
|
|
832
835
|
fill:var(--icon-cta-icon-pressed);
|
|
833
836
|
}
|
|
834
|
-
.icon_button_module_iconButton--
|
|
837
|
+
.icon_button_module_iconButton--5ec37.icon_button_module_large--5ec37{
|
|
835
838
|
height:var(--size-10);
|
|
836
839
|
width:var(--size-10);
|
|
837
840
|
}
|
|
838
|
-
.icon_button_module_iconButton--
|
|
841
|
+
.icon_button_module_iconButton--5ec37.icon_button_module_small--5ec37{
|
|
839
842
|
height:var(--size-8);
|
|
840
843
|
width:var(--size-8);
|
|
841
844
|
}
|
|
842
|
-
.icon_button_module_iconButton--
|
|
845
|
+
.icon_button_module_iconButton--5ec37.icon_button_module_x-small--5ec37{
|
|
843
846
|
height:var(--size-6);
|
|
844
847
|
width:var(--size-6);
|
|
845
848
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"iconButton":"icon_button_module_iconButton--
|
|
2
|
+
var styles = {"iconButton":"icon_button_module_iconButton--5ec37","iconColor":"icon_button_module_iconColor--5ec37","large":"icon_button_module_large--5ec37","small":"icon_button_module_small--5ec37","x-small":"icon_button_module_x-small--5ec37"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SelectMenuGrid } from './select-menu-grid';
|
|
2
2
|
import { SelectMenuGridColorCircle, SelectMenuGridOption, SelectMenuGridSquare } from './select-menu-grid-option';
|
|
3
|
+
export { type SelectMenuGridProps, type SelectMenuOptionProps } from './types';
|
|
3
4
|
type SelectMenuOption = typeof SelectMenuGridOption & {
|
|
4
5
|
Square: typeof SelectMenuGridSquare;
|
|
5
6
|
ColorCircle: typeof SelectMenuGridColorCircle;
|
|
@@ -9,4 +10,3 @@ type SelectMenuType = {
|
|
|
9
10
|
Grid: typeof SelectMenuGrid;
|
|
10
11
|
};
|
|
11
12
|
export declare const SelectMenu: SelectMenuType;
|
|
12
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { Button } from '@ariakit/react';
|
|
2
|
+
import { CompositeItem, Button } from '@ariakit/react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import Color from 'color';
|
|
5
5
|
import { forwardRef } from 'react';
|
|
@@ -33,22 +33,24 @@ const SelectMenuGridOption = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
33
33
|
const isButtonActive = !disabled && !loading && active;
|
|
34
34
|
const shouldShowTooltip = !isButtonDisabled;
|
|
35
35
|
// TODO: [DSYS-764] use IconButton instead of AriakitButton
|
|
36
|
-
const button =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
const button = jsx(CompositeItem, {
|
|
37
|
+
render: jsxs(Button, {
|
|
38
|
+
...restProps,
|
|
39
|
+
ref: forwardedRef,
|
|
40
|
+
"aria-label": loading ? loadingAriaLabel : ariaLabel,
|
|
41
|
+
className: clsx(styles.optionButton, className, {
|
|
42
|
+
[styles.loading]: loading,
|
|
43
|
+
[styles.active]: isButtonActive
|
|
44
|
+
}),
|
|
45
|
+
disabled: isButtonDisabled,
|
|
46
|
+
children: [variant === 'colorCircle' && jsx(ColorSwatch, {
|
|
47
|
+
color: color || '',
|
|
48
|
+
loading: !!loading
|
|
49
|
+
}), variant === 'square' && jsx(Icon, {
|
|
50
|
+
loading: !!loading,
|
|
51
|
+
children: children
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
52
54
|
});
|
|
53
55
|
return jsxs("div", {
|
|
54
56
|
className: styles.buttonWrapper,
|
|
@@ -2,4 +2,8 @@
|
|
|
2
2
|
export declare const SelectMenuGrid: import("react").ForwardRefExoticComponent<Omit<{
|
|
3
3
|
children: import("react").ReactNode;
|
|
4
4
|
columns: number;
|
|
5
|
-
} & import("react").
|
|
5
|
+
} & import("@ariakit/react").CompositeOptions<"div"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, keyof import("@ariakit/react").CompositeOptions<T>> & {
|
|
8
|
+
[index: `data-${string}`]: unknown;
|
|
9
|
+
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { CompositeProvider, Composite, CompositeRow } from '@ariakit/react';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import chunk from 'lodash/chunk';
|
|
4
5
|
import { forwardRef, Children } from 'react';
|
|
5
6
|
import styles from './select-menu-grid.module.js';
|
|
6
7
|
|
|
7
|
-
const Row = props => jsx(
|
|
8
|
+
const Row = props => jsx(CompositeRow, {
|
|
8
9
|
...props,
|
|
9
10
|
className: styles.row,
|
|
10
11
|
role: "row"
|
|
@@ -17,14 +18,16 @@ const SelectMenuGrid = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
17
18
|
...rest
|
|
18
19
|
} = props;
|
|
19
20
|
const childrenByColumns = chunk(Children.toArray(children), columns);
|
|
20
|
-
return jsx(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
children: row
|
|
27
|
-
|
|
21
|
+
return jsx(CompositeProvider, {
|
|
22
|
+
children: jsx(Composite, {
|
|
23
|
+
...rest,
|
|
24
|
+
ref: forwardedRef,
|
|
25
|
+
className: clsx(styles.grid, className),
|
|
26
|
+
role: "grid",
|
|
27
|
+
children: childrenByColumns.map((row, i) => jsx(Row, {
|
|
28
|
+
children: row
|
|
29
|
+
}, row[0]?.key || i))
|
|
30
|
+
})
|
|
28
31
|
});
|
|
29
32
|
});
|
|
30
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type ButtonProps as AriakitButtonProps } from '@ariakit/react';
|
|
2
|
+
import { type ButtonProps as AriakitButtonProps, type CompositeProps, type CompositeRowProps } from '@ariakit/react';
|
|
3
3
|
import { type RequireAllOrNone, type SetOptional } from 'type-fest';
|
|
4
4
|
type Loading = {
|
|
5
5
|
/** Loading state of the grid option. Ghost section is displaying as a placeholder. When this is true `loadingAriaLabel` must also be provided. */
|
|
@@ -23,13 +23,14 @@ export type SelectMenuGridColorCircleProps = CommonOptionProps & {
|
|
|
23
23
|
/** The color of the swatch */
|
|
24
24
|
color: string;
|
|
25
25
|
};
|
|
26
|
-
export type
|
|
26
|
+
export type SelectMenuOptionProps = SetOptional<SelectMenuGridSquareProps, keyof SelectMenuGridSquareProps> & SetOptional<SelectMenuGridColorCircleProps, keyof SelectMenuGridColorCircleProps> & {
|
|
27
27
|
variant: 'square' | 'colorCircle';
|
|
28
28
|
};
|
|
29
|
+
export type SelectMenuGridRowProps = CompositeRowProps;
|
|
29
30
|
export type SelectMenuGridProps = {
|
|
30
31
|
/** The grid options to render */
|
|
31
32
|
children: React.ReactNode;
|
|
32
33
|
/** The number of columns to slice the grid options into */
|
|
33
34
|
columns: number;
|
|
34
|
-
} &
|
|
35
|
+
} & CompositeProps;
|
|
35
36
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.18.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@box/storybook-utils": "^0.0.3"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "712a73b1a539afe140ea0623caf6f168a4fe2099",
|
|
61
61
|
"module": "lib-esm/index.js",
|
|
62
62
|
"main": "lib-esm/index.js",
|
|
63
63
|
"exports": {
|