@box/blueprint-web 18.5.1 → 18.5.3
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/lib-esm/number-field/number-field-control.d.ts +1 -3
- package/dist/lib-esm/number-field/number-field-control.js +0 -4
- package/dist/lib-esm/number-field/number-field.js +0 -2
- package/dist/lib-esm/page/page-context.d.ts +2 -0
- package/dist/lib-esm/page/page-context.js +2 -0
- package/dist/lib-esm/page/page-side-panel.js +19 -3
- package/dist/lib-esm/primitives/chips/filter-chip/filter-trigger-chip.js +8 -1
- package/package.json +3 -3
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef, type ForwardedRef } from 'react';
|
|
2
2
|
import { type NumberFieldProps } from './types';
|
|
3
3
|
type NumberFieldControlProps = {
|
|
4
|
-
ariaValueMax?: number;
|
|
5
|
-
ariaValueMin?: number;
|
|
6
4
|
decrementAriaLabel: string;
|
|
7
5
|
hasError: boolean;
|
|
8
6
|
incrementAriaLabel: string;
|
|
@@ -23,5 +21,5 @@ type NumberFieldControlProps = {
|
|
|
23
21
|
showDecrementTooltip: boolean;
|
|
24
22
|
showIncrementTooltip: boolean;
|
|
25
23
|
};
|
|
26
|
-
export declare const NumberFieldControl: ({
|
|
24
|
+
export declare const NumberFieldControl: ({ decrementAriaLabel, hasError, incrementAriaLabel, inputMaxLength, inputProps, inputRef, isAnimationEnabled, isDecrementDisabled, isDecrementLoading, isIncrementDisabled, isIncrementLoading, labelId, loadingAriaLabel, maxReachedTooltipContent, minReachedTooltipContent, onBlur, onInputChange, showDecrementTooltip, showIncrementTooltip, }: NumberFieldControlProps) => React.ReactElement;
|
|
27
25
|
export {};
|
|
@@ -8,8 +8,6 @@ import { StepperButton } from './stepper-button.js';
|
|
|
8
8
|
import styles from './number-field.module.js';
|
|
9
9
|
|
|
10
10
|
const NumberFieldControl = ({
|
|
11
|
-
ariaValueMax,
|
|
12
|
-
ariaValueMin,
|
|
13
11
|
decrementAriaLabel,
|
|
14
12
|
hasError,
|
|
15
13
|
incrementAriaLabel,
|
|
@@ -72,8 +70,6 @@ const NumberFieldControl = ({
|
|
|
72
70
|
...inputProps,
|
|
73
71
|
...racDomProps,
|
|
74
72
|
ref: racInputRef,
|
|
75
|
-
"aria-valuemax": ariaValueMax,
|
|
76
|
-
"aria-valuemin": ariaValueMin,
|
|
77
73
|
className: styles.input,
|
|
78
74
|
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
79
75
|
invalid: hasError,
|
|
@@ -119,8 +119,6 @@ const NumberField = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
119
119
|
hideLabel: hideLabel,
|
|
120
120
|
id: labelId
|
|
121
121
|
}), jsx(NumberFieldControl, {
|
|
122
|
-
ariaValueMax: max,
|
|
123
|
-
ariaValueMin: min,
|
|
124
122
|
decrementAriaLabel: decrementAriaLabel,
|
|
125
123
|
hasError: hasError,
|
|
126
124
|
incrementAriaLabel: incrementAriaLabel,
|
|
@@ -21,6 +21,7 @@ export interface PageFastContextValuesType extends PagePortalRefs {
|
|
|
21
21
|
mainSectionSidebarVisible: boolean;
|
|
22
22
|
sidePanelExpanded: boolean;
|
|
23
23
|
sidePanelExpandedUserControlled: boolean;
|
|
24
|
+
sidePanelId?: string;
|
|
24
25
|
}
|
|
25
26
|
export declare const PageProvider: ({ children }: {
|
|
26
27
|
children: React.ReactNode;
|
|
@@ -37,6 +38,7 @@ export declare const useMainSectionSidebar: () => {
|
|
|
37
38
|
};
|
|
38
39
|
export declare const useSidePanel: () => {
|
|
39
40
|
sidePanelExpanded: boolean;
|
|
41
|
+
sidePanelId: string | undefined;
|
|
40
42
|
setSidePanelExpanded: (expanded: boolean) => void;
|
|
41
43
|
toggleSidePanelExpanded: () => void;
|
|
42
44
|
};
|
|
@@ -67,6 +67,7 @@ const useMainSectionSidebar = () => {
|
|
|
67
67
|
};
|
|
68
68
|
const useSidePanel = () => {
|
|
69
69
|
const [sidePanelExpanded, setPageStore] = usePageStore(store => store.sidePanelExpanded);
|
|
70
|
+
const [sidePanelId] = usePageStore(store => store.sidePanelId);
|
|
70
71
|
const breakpoint = useBreakpoint();
|
|
71
72
|
const setSidePanelExpanded = expanded => {
|
|
72
73
|
setPageStore({
|
|
@@ -86,6 +87,7 @@ const useSidePanel = () => {
|
|
|
86
87
|
};
|
|
87
88
|
return {
|
|
88
89
|
sidePanelExpanded,
|
|
90
|
+
sidePanelId,
|
|
89
91
|
setSidePanelExpanded,
|
|
90
92
|
toggleSidePanelExpanded
|
|
91
93
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { FocusTrapRegion } from '@ariakit/react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { forwardRef, useEffect } from 'react';
|
|
4
|
+
import { forwardRef, useEffect, useId } from 'react';
|
|
5
5
|
import { useBreakpoint, Breakpoint } from '../utils/useBreakpoint.js';
|
|
6
|
-
import { usePageStore, usePageStoreRef } from './page-context.js';
|
|
6
|
+
import { usePageStore, usePageStoreRef, usePageStoreSetterSafe } from './page-context.js';
|
|
7
7
|
import styles from './page.module.js';
|
|
8
8
|
|
|
9
9
|
const useSidePanelBreakpointSync = () => {
|
|
@@ -36,24 +36,40 @@ const useSidePanelBreakpointSync = () => {
|
|
|
36
36
|
}
|
|
37
37
|
}, [breakpoint, defaultSidePanelExpanded, setPageStore, sidePanelExpandedUserControlled]);
|
|
38
38
|
};
|
|
39
|
+
const useSidePanelId = idProp => {
|
|
40
|
+
const generatedId = useId();
|
|
41
|
+
const id = idProp || `bp-page-side-panel-${generatedId}`;
|
|
42
|
+
const setPageStore = usePageStoreSetterSafe();
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setPageStore?.({
|
|
45
|
+
sidePanelId: id
|
|
46
|
+
});
|
|
47
|
+
return () => setPageStore?.({
|
|
48
|
+
sidePanelId: undefined
|
|
49
|
+
});
|
|
50
|
+
}, [id, setPageStore]);
|
|
51
|
+
return id;
|
|
52
|
+
};
|
|
39
53
|
const PageSidePanel = /*#__PURE__*/forwardRef(({
|
|
40
54
|
className,
|
|
41
55
|
children,
|
|
56
|
+
id: idProp,
|
|
42
57
|
...rest
|
|
43
58
|
}, forwardedRef) => {
|
|
44
59
|
useSidePanelBreakpointSync();
|
|
45
60
|
const [sidePanelExpanded] = usePageStore(store => store.sidePanelExpanded);
|
|
46
61
|
const setRef = usePageStoreRef('pageSidePanelRef', forwardedRef);
|
|
62
|
+
const id = useSidePanelId(idProp);
|
|
47
63
|
const breakpoint = useBreakpoint();
|
|
48
64
|
const isFullScreen = breakpoint < Breakpoint.Large && sidePanelExpanded;
|
|
49
65
|
return jsx(FocusTrapRegion, {
|
|
50
66
|
...rest,
|
|
51
67
|
ref: setRef,
|
|
52
|
-
"aria-expanded": sidePanelExpanded,
|
|
53
68
|
className: clsx(styles.sidePanel, className, {
|
|
54
69
|
[styles.expanded]: sidePanelExpanded
|
|
55
70
|
}),
|
|
56
71
|
enabled: isFullScreen,
|
|
72
|
+
id: id,
|
|
57
73
|
children: children
|
|
58
74
|
});
|
|
59
75
|
});
|
|
@@ -21,9 +21,16 @@ const FilterTriggerChip = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
21
21
|
type
|
|
22
22
|
} = useContext(FilterChipGroupContext);
|
|
23
23
|
const chipClassName = type === 'multiple' ? styles.multiSelectChip : styles.singleSelectChip;
|
|
24
|
-
|
|
24
|
+
// A host can turn the chip into another widget (e.g. an Ariakit Select trigger passes role="combobox"),
|
|
25
|
+
// in which case toggle state attributes are not allowed. The keys must be present to override Radix defaults.
|
|
26
|
+
const isToggleButton = !rest.role || rest.role === 'button';
|
|
27
|
+
const selectionStateAttrs = isToggleButton ? {
|
|
25
28
|
'data-state': selected ? 'on' : 'off',
|
|
26
29
|
'aria-pressed': Boolean(selected)
|
|
30
|
+
} : {
|
|
31
|
+
'data-state': selected ? 'on' : 'off',
|
|
32
|
+
'aria-pressed': undefined,
|
|
33
|
+
'aria-checked': undefined
|
|
27
34
|
};
|
|
28
35
|
return jsx(Chip, {
|
|
29
36
|
...rest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "18.5.
|
|
3
|
+
"version": "18.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@ariakit/react": "0.4.21",
|
|
57
57
|
"@ariakit/react-core": "0.4.21",
|
|
58
|
-
"@box/blueprint-web-assets": "^5.
|
|
58
|
+
"@box/blueprint-web-assets": "^5.13.0",
|
|
59
59
|
"@internationalized/date": "^3.12.0",
|
|
60
60
|
"@radix-ui/react-accordion": "1.1.2",
|
|
61
61
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@box/box-test-client": "^3.2.7",
|
|
87
87
|
"@box/playwright-utils": "^2.8.5",
|
|
88
|
-
"@box/storybook-utils": "^1.4.
|
|
88
|
+
"@box/storybook-utils": "^1.4.19",
|
|
89
89
|
"@figma/code-connect": "1.4.4",
|
|
90
90
|
"@playwright/test": "1.46.1",
|
|
91
91
|
"@types/js-yaml": "^4.0.9",
|