@box/blueprint-web 8.3.0 → 8.4.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 +97 -15
- package/lib-esm/index.d.ts +1 -0
- package/lib-esm/index.js +2 -0
- package/lib-esm/radio-group/radio-group.module.js +1 -1
- package/lib-esm/radio-tiles/index.d.ts +3 -0
- package/lib-esm/radio-tiles/radio-tiles-option.d.ts +2 -0
- package/lib-esm/radio-tiles/radio-tiles-option.js +82 -0
- package/lib-esm/radio-tiles/radio-tiles-option.module.js +4 -0
- package/lib-esm/radio-tiles/radio-tiles.context.d.ts +9 -0
- package/lib-esm/radio-tiles/radio-tiles.context.js +12 -0
- package/lib-esm/radio-tiles/radio-tiles.d.ts +4 -0
- package/lib-esm/radio-tiles/radio-tiles.js +48 -0
- package/lib-esm/radio-tiles/radio-tiles.module.js +4 -0
- package/lib-esm/radio-tiles/types.d.ts +48 -0
- package/package.json +2 -2
package/lib-esm/index.css
CHANGED
|
@@ -5033,7 +5033,7 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
5033
5033
|
opacity:.5;
|
|
5034
5034
|
}
|
|
5035
5035
|
|
|
5036
|
-
.bp_radio_group_module_root--
|
|
5036
|
+
.bp_radio_group_module_root--c72b9{
|
|
5037
5037
|
display:flex;
|
|
5038
5038
|
flex-direction:column;
|
|
5039
5039
|
font-family:Lato, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
@@ -5046,31 +5046,31 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
5046
5046
|
text-transform:none;
|
|
5047
5047
|
}
|
|
5048
5048
|
|
|
5049
|
-
.bp_radio_group_module_horizontal--
|
|
5049
|
+
.bp_radio_group_module_horizontal--c72b9{
|
|
5050
5050
|
flex-direction:row;
|
|
5051
5051
|
gap:1.625rem;
|
|
5052
5052
|
}
|
|
5053
5053
|
|
|
5054
|
-
.bp_radio_group_module_radioOption--
|
|
5054
|
+
.bp_radio_group_module_radioOption--c72b9{
|
|
5055
5055
|
display:flex;
|
|
5056
5056
|
flex-direction:column;
|
|
5057
5057
|
}
|
|
5058
|
-
.bp_radio_group_module_radioOption--
|
|
5058
|
+
.bp_radio_group_module_radioOption--c72b9 .bp_radio_group_module_label--c72b9{
|
|
5059
5059
|
align-items:flex-start;
|
|
5060
5060
|
cursor:pointer;
|
|
5061
5061
|
display:inline-flex;
|
|
5062
5062
|
gap:var(--size-3);
|
|
5063
5063
|
line-height:var(--body-default-line-height);
|
|
5064
5064
|
}
|
|
5065
|
-
.bp_radio_group_module_radioOption--
|
|
5065
|
+
.bp_radio_group_module_radioOption--c72b9 .bp_radio_group_module_description--c72b9{
|
|
5066
5066
|
padding-left:calc(var(--size-4) + var(--size-3));
|
|
5067
5067
|
}
|
|
5068
|
-
.bp_radio_group_module_radioOption--
|
|
5068
|
+
.bp_radio_group_module_radioOption--c72b9.bp_radio_group_module_disabled--c72b9 .bp_radio_group_module_label--c72b9,[role=radiogroup][data-disabled] .bp_radio_group_module_radioOption--c72b9 .bp_radio_group_module_label--c72b9{
|
|
5069
5069
|
color:var(--text-text-on-light-secondary);
|
|
5070
5070
|
cursor:default;
|
|
5071
5071
|
}
|
|
5072
5072
|
|
|
5073
|
-
.bp_radio_group_module_radioButton--
|
|
5073
|
+
.bp_radio_group_module_radioButton--c72b9{
|
|
5074
5074
|
all:unset;
|
|
5075
5075
|
align-items:center;
|
|
5076
5076
|
background-color:var(--surface-radio-surface);
|
|
@@ -5084,36 +5084,118 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
5084
5084
|
margin:calc((var(--body-default-line-height) - var(--size-4))/2) 0 0 0;
|
|
5085
5085
|
width:var(--size-4);
|
|
5086
5086
|
}
|
|
5087
|
-
.bp_radio_group_module_radioButton--
|
|
5087
|
+
.bp_radio_group_module_radioButton--c72b9 .bp_radio_group_module_indicator--c72b9{
|
|
5088
5088
|
background-color:var(--surface-radio-surface-selected);
|
|
5089
5089
|
border-radius:50%;
|
|
5090
5090
|
height:var(--size-2);
|
|
5091
5091
|
transition:transform .1s;
|
|
5092
5092
|
width:var(--size-2);
|
|
5093
5093
|
}
|
|
5094
|
-
.bp_radio_group_module_radioButton--
|
|
5094
|
+
.bp_radio_group_module_radioButton--c72b9:focus-visible{
|
|
5095
5095
|
box-shadow:0 0 0 var(--border-1, 1px) var(--background-background), 0 0 0 var(--border-3) #2486fc;
|
|
5096
5096
|
}
|
|
5097
|
-
.bp_radio_group_module_radioButton--
|
|
5097
|
+
.bp_radio_group_module_radioButton--c72b9[data-disabled]{
|
|
5098
5098
|
opacity:60%;
|
|
5099
5099
|
}
|
|
5100
|
-
.bp_radio_group_module_radioButton--
|
|
5100
|
+
.bp_radio_group_module_radioButton--c72b9[data-state=unchecked]{
|
|
5101
5101
|
background-color:var(--surface-radio-surface);
|
|
5102
5102
|
border:var(--border-2) solid var(--border-radio-border);
|
|
5103
5103
|
}
|
|
5104
|
-
.bp_radio_group_module_radioButton--
|
|
5104
|
+
.bp_radio_group_module_radioButton--c72b9[data-state=unchecked] .bp_radio_group_module_indicator--c72b9{
|
|
5105
5105
|
transform:scale(0);
|
|
5106
5106
|
}
|
|
5107
|
-
.bp_radio_group_module_radioButton--
|
|
5107
|
+
.bp_radio_group_module_radioButton--c72b9:not([data-disabled]):focus-visible,.bp_radio_group_module_radioButton--c72b9:not([data-disabled]):hover{
|
|
5108
5108
|
border:var(--border-2) solid var(--border-radio-border-hover);
|
|
5109
5109
|
}
|
|
5110
|
-
.bp_radio_group_module_radioButton--
|
|
5110
|
+
.bp_radio_group_module_radioButton--c72b9:not([data-disabled]):focus-visible[data-state=checked],.bp_radio_group_module_radioButton--c72b9:not([data-disabled]):hover[data-state=checked]{
|
|
5111
5111
|
border:var(--border-2) solid var(--border-radio-border-selected-hover);
|
|
5112
5112
|
}
|
|
5113
|
-
.bp_radio_group_module_radioButton--
|
|
5113
|
+
.bp_radio_group_module_radioButton--c72b9:not([data-disabled]):focus-visible[data-state=checked] .bp_radio_group_module_indicator--c72b9,.bp_radio_group_module_radioButton--c72b9:not([data-disabled]):hover[data-state=checked] .bp_radio_group_module_indicator--c72b9{
|
|
5114
5114
|
background-color:var(--surface-radio-surface-selected-hover);
|
|
5115
5115
|
}
|
|
5116
5116
|
|
|
5117
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b{
|
|
5118
|
+
background-color:var(--surface-radiotile-surface);
|
|
5119
|
+
border:var(--border-1) solid var(--border-radiotile-border);
|
|
5120
|
+
border-radius:var(--radius-3);
|
|
5121
|
+
box-sizing:border-box;
|
|
5122
|
+
cursor:pointer;
|
|
5123
|
+
display:inline-flex;
|
|
5124
|
+
max-width:100%;
|
|
5125
|
+
min-height:var(--size-10);
|
|
5126
|
+
overflow:hidden;
|
|
5127
|
+
pointer-events:auto;
|
|
5128
|
+
position:relative;
|
|
5129
|
+
transition:background-color var(--animation-duration-2), border var(--animation-duration-2);
|
|
5130
|
+
-webkit-user-select:none;
|
|
5131
|
+
user-select:none;
|
|
5132
|
+
}
|
|
5133
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b .bp_radio_tiles_option_module_icon--db24b{
|
|
5134
|
+
display:inline-flex;
|
|
5135
|
+
}
|
|
5136
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b .bp_radio_tiles_option_module_icon--db24b > svg > path{
|
|
5137
|
+
fill:var(--icon-icon-on-light-secondary);
|
|
5138
|
+
}
|
|
5139
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b.bp_radio_tiles_option_module_disabled--db24b{
|
|
5140
|
+
opacity:.6;
|
|
5141
|
+
}
|
|
5142
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b:has(:focus-visible){
|
|
5143
|
+
outline:2px solid var(--border-input-border-focus);
|
|
5144
|
+
outline-offset:var(--border-2);
|
|
5145
|
+
}
|
|
5146
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b.bp_radio_tiles_option_module_checked--db24b{
|
|
5147
|
+
background-color:var(--surface-radiotile-surface-selected);
|
|
5148
|
+
border-color:#0000;
|
|
5149
|
+
box-shadow:0 0 0 2px var(--border-radiotile-border-selected);
|
|
5150
|
+
}
|
|
5151
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b.bp_radio_tiles_option_module_checked--db24b:focus-within{
|
|
5152
|
+
outline-offset:var(--border-3);
|
|
5153
|
+
}
|
|
5154
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b.bp_radio_tiles_option_module_checked--db24b .bp_radio_tiles_option_module_icon--db24b > svg > path{
|
|
5155
|
+
fill:var(--icon-icon-blue);
|
|
5156
|
+
}
|
|
5157
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b:hover:not(.bp_radio_tiles_option_module_disabled--db24b, .bp_radio_tiles_option_module_checked--db24b){
|
|
5158
|
+
background-color:var(--surface-radiotile-surface-hover);
|
|
5159
|
+
border:var(--border-1) solid var(--border-radiotile-border-hover);
|
|
5160
|
+
}
|
|
5161
|
+
.bp_radio_tiles_option_module_radioTileOption--db24b > label{
|
|
5162
|
+
align-items:center;
|
|
5163
|
+
box-sizing:border-box;
|
|
5164
|
+
cursor:inherit;
|
|
5165
|
+
display:flex;
|
|
5166
|
+
flex-direction:column;
|
|
5167
|
+
gap:var(--space-2);
|
|
5168
|
+
justify-content:center;
|
|
5169
|
+
padding:var(--space-2);
|
|
5170
|
+
width:100%;
|
|
5171
|
+
}
|
|
5172
|
+
|
|
5173
|
+
.bp_radio_tiles_option_module_radioTileLabel--db24b{
|
|
5174
|
+
max-width:100%;
|
|
5175
|
+
overflow:hidden;
|
|
5176
|
+
text-align:center;
|
|
5177
|
+
text-overflow:ellipsis;
|
|
5178
|
+
white-space:nowrap;
|
|
5179
|
+
}
|
|
5180
|
+
|
|
5181
|
+
.bp_radio_tiles_module_radioTiles--94f93{
|
|
5182
|
+
display:flex;
|
|
5183
|
+
gap:var(--space-2);
|
|
5184
|
+
}
|
|
5185
|
+
.bp_radio_tiles_module_radioTiles--94f93.bp_radio_tiles_module_hasColumns--94f93{
|
|
5186
|
+
flex-wrap:wrap;
|
|
5187
|
+
}
|
|
5188
|
+
.bp_radio_tiles_module_radioTiles--94f93.bp_radio_tiles_module_hasColumns--94f93 > *{
|
|
5189
|
+
width:100%;
|
|
5190
|
+
}
|
|
5191
|
+
.bp_radio_tiles_module_radioTiles--94f93.bp_radio_tiles_module_default--94f93 > *{
|
|
5192
|
+
flex:1 1 calc(100%/var(--columns) - var(--space-2));
|
|
5193
|
+
width:100%;
|
|
5194
|
+
}
|
|
5195
|
+
.bp_radio_tiles_module_radioTiles--94f93.bp_radio_tiles_module_compact--94f93 > *{
|
|
5196
|
+
flex:0 1 calc(100%/var(--columns) - var(--space-2) + var(--space-2)/var(--columns));
|
|
5197
|
+
}
|
|
5198
|
+
|
|
5117
5199
|
.bp_search_module_search--b65f4{
|
|
5118
5200
|
font-family:Lato, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
5119
5201
|
font-size:.875rem;
|
package/lib-esm/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export * from './primitives/select-menu-grid';
|
|
|
46
46
|
export * from './primitives/supplementary-fonts';
|
|
47
47
|
export * from './primitives/tabs';
|
|
48
48
|
export * from './radio-group';
|
|
49
|
+
export * from './radio-tiles';
|
|
49
50
|
export * from './search-input';
|
|
50
51
|
export * from './select';
|
|
51
52
|
export * from './side-panel';
|
package/lib-esm/index.js
CHANGED
|
@@ -61,6 +61,8 @@ export { useSupplementaryFonts } from './primitives/supplementary-fonts/useSuppl
|
|
|
61
61
|
export { getSupplementaryFontFacesConfig } from './primitives/supplementary-fonts/get-supplementary-font-faces-config.js';
|
|
62
62
|
export { Tabs } from './primitives/tabs/index.js';
|
|
63
63
|
export { Radio } from './radio-group/index.js';
|
|
64
|
+
export { RadioTiles } from './radio-tiles/radio-tiles.js';
|
|
65
|
+
export { RadioTilesOption } from './radio-tiles/radio-tiles-option.js';
|
|
64
66
|
export { SearchInput } from './search-input/index.js';
|
|
65
67
|
export { SELECT_EMPTY_VALUE, Select } from './select/select.js';
|
|
66
68
|
export { SidePanel } from './side-panel/side-panel.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"root":"bp_radio_group_module_root--
|
|
2
|
+
var styles = {"root":"bp_radio_group_module_root--c72b9","horizontal":"bp_radio_group_module_horizontal--c72b9","radioOption":"bp_radio_group_module_radioOption--c72b9","label":"bp_radio_group_module_label--c72b9","description":"bp_radio_group_module_description--c72b9","disabled":"bp_radio_group_module_disabled--c72b9","radioButton":"bp_radio_group_module_radioButton--c72b9","indicator":"bp_radio_group_module_indicator--c72b9"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type RadioTilesOptionProps } from './types';
|
|
2
|
+
export declare const RadioTilesOption: <T extends string>({ children, value, label, icon, disabled: disabledProp, className, "aria-label": ariaLabel, }: RadioTilesOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useRef } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Text } from '../text/text.js';
|
|
5
|
+
import { useRadioTilesContext } from './radio-tiles.context.js';
|
|
6
|
+
import styles from './radio-tiles-option.module.js';
|
|
7
|
+
import { useFullTextTooltip } from '../utils/useFullTextTooltip.js';
|
|
8
|
+
import { VisuallyHidden } from '../visually-hidden/visually-hidden.js';
|
|
9
|
+
|
|
10
|
+
const RadioTilesOption = function RadioTilesOption({
|
|
11
|
+
children,
|
|
12
|
+
value,
|
|
13
|
+
label,
|
|
14
|
+
icon,
|
|
15
|
+
disabled: disabledProp,
|
|
16
|
+
className,
|
|
17
|
+
'aria-label': ariaLabel
|
|
18
|
+
}) {
|
|
19
|
+
const {
|
|
20
|
+
name,
|
|
21
|
+
selectedValue,
|
|
22
|
+
disabled,
|
|
23
|
+
onChange
|
|
24
|
+
} = useRadioTilesContext();
|
|
25
|
+
const labelRef = useRef(null);
|
|
26
|
+
const {
|
|
27
|
+
Wrapper: Tooltip,
|
|
28
|
+
wrapperProps
|
|
29
|
+
} = useFullTextTooltip({
|
|
30
|
+
ref: labelRef,
|
|
31
|
+
textValue: label
|
|
32
|
+
});
|
|
33
|
+
const isSelected = selectedValue === value;
|
|
34
|
+
const isDisabled = disabled || disabledProp;
|
|
35
|
+
const handleChange = event => {
|
|
36
|
+
if (isDisabled) {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
onChange(event);
|
|
41
|
+
};
|
|
42
|
+
const radioTileClassNames = clsx(styles.radioTileOption, {
|
|
43
|
+
[styles.checked]: isSelected,
|
|
44
|
+
[styles.disabled]: isDisabled
|
|
45
|
+
}, className);
|
|
46
|
+
return (
|
|
47
|
+
// @ts-expect-error Fix this type error - DSYS-1597
|
|
48
|
+
jsx(Tooltip, {
|
|
49
|
+
...wrapperProps,
|
|
50
|
+
children: jsx("div", {
|
|
51
|
+
className: radioTileClassNames,
|
|
52
|
+
children: jsxs("label", {
|
|
53
|
+
children: [jsx(VisuallyHidden, {
|
|
54
|
+
children: jsx("input", {
|
|
55
|
+
checked: isSelected,
|
|
56
|
+
disabled: isDisabled,
|
|
57
|
+
name: name,
|
|
58
|
+
onChange: handleChange,
|
|
59
|
+
type: "radio",
|
|
60
|
+
value: value
|
|
61
|
+
})
|
|
62
|
+
}), icon && jsx("div", {
|
|
63
|
+
className: styles.icon,
|
|
64
|
+
children: /*#__PURE__*/React__default.cloneElement(icon, {
|
|
65
|
+
'aria-label': label || ariaLabel
|
|
66
|
+
})
|
|
67
|
+
}), children && /*#__PURE__*/React__default.cloneElement(children, {
|
|
68
|
+
'aria-label': label || ariaLabel
|
|
69
|
+
}), label && jsx(Text, {
|
|
70
|
+
ref: labelRef,
|
|
71
|
+
as: "p",
|
|
72
|
+
className: styles.radioTileLabel,
|
|
73
|
+
variant: "bodyDefault",
|
|
74
|
+
children: label
|
|
75
|
+
})]
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { RadioTilesOption };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '../index.css';
|
|
2
|
+
var styles = {"radioTileOption":"bp_radio_tiles_option_module_radioTileOption--db24b","icon":"bp_radio_tiles_option_module_icon--db24b","disabled":"bp_radio_tiles_option_module_disabled--db24b","checked":"bp_radio_tiles_option_module_checked--db24b","radioTileLabel":"bp_radio_tiles_option_module_radioTileLabel--db24b"};
|
|
3
|
+
|
|
4
|
+
export { styles as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ChangeEvent } from 'react';
|
|
2
|
+
export interface RadioTilesContextValue {
|
|
3
|
+
name?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
selectedValue: string | undefined | null;
|
|
6
|
+
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const RadioTilesContext: import("react").Context<RadioTilesContextValue | null>;
|
|
9
|
+
export declare const useRadioTilesContext: () => RadioTilesContextValue;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const RadioTilesContext = /*#__PURE__*/createContext(null);
|
|
4
|
+
const useRadioTilesContext = () => {
|
|
5
|
+
const context = useContext(RadioTilesContext);
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error('useRadioTilesContext cannot be used outside the RadioTilesContext.Provider');
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { RadioTilesContext, useRadioTilesContext };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RadioTilesProps } from './types';
|
|
2
|
+
export declare const RadioTiles: (<T extends string | null = string>({ children, name, value, variant, columns, disabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onChange, }: RadioTilesProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
|
+
Option: <T_1 extends string>({ children, value, label, icon, disabled: disabledProp, className, "aria-label": ariaLabel, }: import("./types").RadioTilesOptionProps<T_1>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { RadioTilesOption } from './radio-tiles-option.js';
|
|
5
|
+
import { RadioTilesContext } from './radio-tiles.context.js';
|
|
6
|
+
import styles from './radio-tiles.module.js';
|
|
7
|
+
|
|
8
|
+
const RadioTilesRoot = ({
|
|
9
|
+
children,
|
|
10
|
+
name,
|
|
11
|
+
value,
|
|
12
|
+
variant = 'default',
|
|
13
|
+
columns,
|
|
14
|
+
disabled,
|
|
15
|
+
'aria-label': ariaLabel,
|
|
16
|
+
'aria-labelledby': ariaLabelledBy,
|
|
17
|
+
onChange
|
|
18
|
+
}) => {
|
|
19
|
+
const containerStyles = {
|
|
20
|
+
'--columns': columns
|
|
21
|
+
};
|
|
22
|
+
const containerClassNames = clsx(styles.radioTiles, {
|
|
23
|
+
[styles.hasColumns]: Number(columns) > 0,
|
|
24
|
+
[variant === 'compact' ? styles.compact : styles.default]: true
|
|
25
|
+
});
|
|
26
|
+
const contextValue = useMemo(() => ({
|
|
27
|
+
name,
|
|
28
|
+
selectedValue: value,
|
|
29
|
+
disabled,
|
|
30
|
+
onChange
|
|
31
|
+
}), [name, value, disabled, onChange]);
|
|
32
|
+
return jsx(RadioTilesContext.Provider, {
|
|
33
|
+
value: contextValue,
|
|
34
|
+
children: jsx("div", {
|
|
35
|
+
"aria-label": ariaLabel,
|
|
36
|
+
"aria-labelledby": ariaLabelledBy,
|
|
37
|
+
className: containerClassNames,
|
|
38
|
+
role: "radiogroup",
|
|
39
|
+
style: containerStyles,
|
|
40
|
+
children: children
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const RadioTiles = Object.assign(RadioTilesRoot, {
|
|
45
|
+
Option: RadioTilesOption
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { RadioTiles };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '../index.css';
|
|
2
|
+
var styles = {"radioTiles":"bp_radio_tiles_module_radioTiles--94f93","hasColumns":"bp_radio_tiles_module_hasColumns--94f93","default":"bp_radio_tiles_module_default--94f93","compact":"bp_radio_tiles_module_compact--94f93"};
|
|
3
|
+
|
|
4
|
+
export { styles as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ChangeEvent, type CSSProperties, type ReactElement, type SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* RadioTilesProps
|
|
4
|
+
*/
|
|
5
|
+
interface WithAriaLabel {
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
'aria-labelledby'?: never;
|
|
8
|
+
}
|
|
9
|
+
interface WithAriaLabelledBy {
|
|
10
|
+
'aria-label'?: never;
|
|
11
|
+
'aria-labelledby': string;
|
|
12
|
+
}
|
|
13
|
+
export type RadioTilesProps<T extends string | null = string | null> = {
|
|
14
|
+
children: ReactElement<RadioTilesOptionProps<NonNullable<T>>>[];
|
|
15
|
+
name?: string;
|
|
16
|
+
value?: T;
|
|
17
|
+
gap?: string;
|
|
18
|
+
columns?: number;
|
|
19
|
+
variant?: 'default' | 'compact';
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
22
|
+
} & (WithAriaLabel | WithAriaLabelledBy);
|
|
23
|
+
/**
|
|
24
|
+
* RadioTilesOptionProps
|
|
25
|
+
*/
|
|
26
|
+
interface WithIcon {
|
|
27
|
+
icon?: ReactElement<SVGProps<SVGSVGElement>>;
|
|
28
|
+
children?: never;
|
|
29
|
+
}
|
|
30
|
+
interface WithoutIcon {
|
|
31
|
+
icon?: never;
|
|
32
|
+
children: ReactElement;
|
|
33
|
+
}
|
|
34
|
+
interface WithLabel {
|
|
35
|
+
label: string;
|
|
36
|
+
'aria-label'?: never;
|
|
37
|
+
}
|
|
38
|
+
interface WithoutLabel {
|
|
39
|
+
label?: never;
|
|
40
|
+
'aria-label': string;
|
|
41
|
+
}
|
|
42
|
+
export type RadioTilesOptionProps<T extends string = string> = {
|
|
43
|
+
value: T;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
className?: string;
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
} & (WithIcon | WithoutIcon) & (WithLabel | WithoutLabel);
|
|
48
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react-stately": "^3.31.1",
|
|
64
64
|
"tsx": "^4.16.5"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "057276bec06cb3038669d8e87106aaa2bd86c718",
|
|
67
67
|
"module": "lib-esm/index.js",
|
|
68
68
|
"main": "lib-esm/index.js",
|
|
69
69
|
"exports": {
|