@box/blueprint-web 12.105.0 → 12.106.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/lib-esm/index.css
CHANGED
|
@@ -9582,23 +9582,32 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
|
|
|
9582
9582
|
text-overflow:ellipsis;
|
|
9583
9583
|
white-space:nowrap;
|
|
9584
9584
|
}
|
|
9585
|
-
.
|
|
9585
|
+
.bp_radio_tiles_module_container--1020c{
|
|
9586
|
+
display:flex;
|
|
9587
|
+
flex-direction:column;
|
|
9588
|
+
}
|
|
9589
|
+
|
|
9590
|
+
.bp_radio_tiles_module_radioTiles--1020c{
|
|
9586
9591
|
display:flex;
|
|
9587
9592
|
gap:var(--space-2);
|
|
9588
9593
|
}
|
|
9589
|
-
.bp_radio_tiles_module_radioTiles--
|
|
9594
|
+
.bp_radio_tiles_module_radioTiles--1020c.bp_radio_tiles_module_hasColumns--1020c{
|
|
9590
9595
|
flex-wrap:wrap;
|
|
9591
9596
|
}
|
|
9592
|
-
.bp_radio_tiles_module_radioTiles--
|
|
9597
|
+
.bp_radio_tiles_module_radioTiles--1020c.bp_radio_tiles_module_hasColumns--1020c > *{
|
|
9593
9598
|
width:100%;
|
|
9594
9599
|
}
|
|
9595
|
-
.bp_radio_tiles_module_radioTiles--
|
|
9600
|
+
.bp_radio_tiles_module_radioTiles--1020c.bp_radio_tiles_module_default--1020c > *{
|
|
9596
9601
|
flex:1 1 calc(100%/var(--columns) - var(--space-2));
|
|
9597
9602
|
width:100%;
|
|
9598
9603
|
}
|
|
9599
|
-
.bp_radio_tiles_module_radioTiles--
|
|
9604
|
+
.bp_radio_tiles_module_radioTiles--1020c.bp_radio_tiles_module_compact--1020c > *{
|
|
9600
9605
|
flex:0 1 calc(100%/var(--columns) - var(--space-2) + var(--space-2)/var(--columns));
|
|
9601
9606
|
}
|
|
9607
|
+
|
|
9608
|
+
.bp_radio_tiles_module_inlineError--1020c{
|
|
9609
|
+
margin-block-start:var(--bp-space-020);
|
|
9610
|
+
}
|
|
9602
9611
|
.bp_search_module_search--19aba[data-modern=false]{
|
|
9603
9612
|
--search-default-padding:var(--space-2);
|
|
9604
9613
|
--search-input-height:var(--size-10);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type RadioTilesProps } from './types';
|
|
2
|
-
export declare const RadioTiles: (<T extends string | null = string>({ children, name, value, variant, columns, disabled, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onChange, }: RadioTilesProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
2
|
+
export declare const RadioTiles: (<T extends string | null = string>({ children, name, value, variant, columns, disabled, className, error, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onChange, }: RadioTilesProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
3
|
Option: <T extends string>({ children, value, label, icon, disabled: disabledProp, className, "aria-label": ariaLabel, }: import("./types").RadioTilesOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { useBlueprintModernization } from '../blueprint-modernization-context/useBlueprintModernization.js';
|
|
5
|
+
import { InlineError } from '../primitives/inline-error/inline-error.js';
|
|
6
|
+
import { useUniqueId } from '../utils/useUniqueId.js';
|
|
5
7
|
import { RadioTilesOption } from './radio-tiles-option.js';
|
|
6
8
|
import { RadioTilesContext } from './radio-tiles.context.js';
|
|
7
9
|
import styles from './radio-tiles.module.js';
|
|
@@ -14,6 +16,7 @@ const RadioTilesRoot = ({
|
|
|
14
16
|
columns,
|
|
15
17
|
disabled,
|
|
16
18
|
className,
|
|
19
|
+
error,
|
|
17
20
|
'aria-label': ariaLabel,
|
|
18
21
|
'aria-labelledby': ariaLabelledBy,
|
|
19
22
|
onChange
|
|
@@ -21,13 +24,15 @@ const RadioTilesRoot = ({
|
|
|
21
24
|
const containerStyles = {
|
|
22
25
|
'--columns': columns
|
|
23
26
|
};
|
|
24
|
-
const
|
|
27
|
+
const radioTilesClassNames = clsx(styles.radioTiles, {
|
|
25
28
|
[styles.hasColumns]: Number(columns) > 0,
|
|
26
29
|
[variant === 'compact' ? styles.compact : styles.default]: true
|
|
27
30
|
}, className);
|
|
28
31
|
const {
|
|
29
32
|
enableModernizedComponents
|
|
30
33
|
} = useBlueprintModernization();
|
|
34
|
+
const hasError = !!error && !disabled;
|
|
35
|
+
const inlineErrorId = useUniqueId('inline-error-');
|
|
31
36
|
const contextValue = useMemo(() => ({
|
|
32
37
|
name,
|
|
33
38
|
selectedValue: value,
|
|
@@ -36,14 +41,23 @@ const RadioTilesRoot = ({
|
|
|
36
41
|
}), [name, value, disabled, onChange]);
|
|
37
42
|
return jsx(RadioTilesContext.Provider, {
|
|
38
43
|
value: contextValue,
|
|
39
|
-
children:
|
|
40
|
-
|
|
41
|
-
"aria-labelledby": ariaLabelledBy,
|
|
42
|
-
className: containerClassNames,
|
|
44
|
+
children: jsxs("div", {
|
|
45
|
+
className: styles.container,
|
|
43
46
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
children: [jsx("div", {
|
|
48
|
+
"aria-describedby": hasError ? inlineErrorId : undefined,
|
|
49
|
+
"aria-invalid": hasError || undefined,
|
|
50
|
+
"aria-label": ariaLabel,
|
|
51
|
+
"aria-labelledby": ariaLabelledBy,
|
|
52
|
+
className: radioTilesClassNames,
|
|
53
|
+
role: "radiogroup",
|
|
54
|
+
style: containerStyles,
|
|
55
|
+
children: children
|
|
56
|
+
}), hasError ? jsx(InlineError, {
|
|
57
|
+
className: styles.inlineError,
|
|
58
|
+
id: inlineErrorId,
|
|
59
|
+
children: error
|
|
60
|
+
}) : null]
|
|
47
61
|
})
|
|
48
62
|
});
|
|
49
63
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"radioTiles":"bp_radio_tiles_module_radioTiles--
|
|
2
|
+
var styles = {"container":"bp_radio_tiles_module_container--1020c","radioTiles":"bp_radio_tiles_module_radioTiles--1020c","hasColumns":"bp_radio_tiles_module_hasColumns--1020c","default":"bp_radio_tiles_module_default--1020c","compact":"bp_radio_tiles_module_compact--1020c","inlineError":"bp_radio_tiles_module_inlineError--1020c"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChangeEvent, type CSSProperties, type ReactElement, type SVGProps } from 'react';
|
|
1
|
+
import { type ChangeEvent, type CSSProperties, type ReactElement, type ReactNode, type SVGProps } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* RadioTilesProps
|
|
4
4
|
*/
|
|
@@ -19,6 +19,7 @@ export type RadioTilesProps<T extends string | null = string | null> = {
|
|
|
19
19
|
variant?: 'default' | 'compact';
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
className?: string;
|
|
22
|
+
error?: ReactNode;
|
|
22
23
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
23
24
|
} & (WithAriaLabel | WithAriaLabelledBy);
|
|
24
25
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.106.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ariakit/react": "0.4.15",
|
|
49
49
|
"@ariakit/react-core": "0.4.15",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.88.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.88.1",
|
|
51
51
|
"@internationalized/date": "^3.7.0",
|
|
52
52
|
"@radix-ui/react-accordion": "1.1.2",
|
|
53
53
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"type-fest": "^3.2.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@box/storybook-utils": "^0.14.
|
|
80
|
+
"@box/storybook-utils": "^0.14.29",
|
|
81
81
|
"@types/react": "^18.0.0",
|
|
82
82
|
"@types/react-dom": "^18.0.0",
|
|
83
83
|
"react": "^18.3.0",
|