@bspk/ui 1.3.4 → 1.3.6
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/components/Avatar/Avatar.d.ts +3 -3
- package/dist/components/Avatar/Avatar.js +8 -8
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/AvatarExample.js +1 -1
- package/dist/components/Avatar/AvatarExample.js.map +1 -1
- package/dist/components/Avatar/avatar.css +5 -1
- package/dist/components/Avatar/avatar.css.js +5 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +11 -6
- package/dist/components/AvatarGroup/AvatarGroup.js +5 -6
- package/dist/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroupExample.js +36 -9
- package/dist/components/AvatarGroup/AvatarGroupExample.js.map +1 -1
- package/dist/components/AvatarGroup/Overflow.d.ts +11 -0
- package/dist/components/AvatarGroup/Overflow.js +37 -0
- package/dist/components/AvatarGroup/Overflow.js.map +1 -0
- package/dist/components/AvatarGroup/avatar-group.css +27 -13
- package/dist/components/AvatarGroup/avatar-group.css.js +27 -13
- package/dist/components/Badge/BadgeExample.js +1 -1
- package/dist/components/Badge/BadgeExample.js.map +1 -1
- package/dist/components/BadgeDot/BadgeDotExample.js +1 -1
- package/dist/components/BadgeDot/BadgeDotExample.js.map +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +2 -1
- package/dist/components/Card/Card.js +2 -2
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.js +2 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -5
- package/dist/components/CheckboxGroup/CheckboxGroup.js +7 -8
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/components/CheckboxGroupField/CheckboxGroupField.d.ts +1 -1
- package/dist/components/CheckboxGroupField/CheckboxGroupField.js +2 -2
- package/dist/components/CheckboxGroupField/CheckboxGroupField.js.map +1 -1
- package/dist/components/CheckboxOption/CheckboxOption.d.ts +3 -2
- package/dist/components/CheckboxOption/CheckboxOption.js +2 -2
- package/dist/components/CheckboxOption/CheckboxOption.js.map +1 -1
- package/dist/components/DatePickerField/DatePickerField.d.ts +1 -1
- package/dist/components/DatePickerField/DatePickerField.js +2 -2
- package/dist/components/DatePickerField/DatePickerField.js.map +1 -1
- package/dist/components/Fab/Fab.d.ts +2 -2
- package/dist/components/Fab/Fab.js.map +1 -1
- package/dist/components/Field/utils.d.ts +1 -1
- package/dist/components/FormField/FormField.d.ts +3 -2
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/FormField/FormField.js.map +1 -1
- package/dist/components/InputField/InputField.d.ts +1 -1
- package/dist/components/InputField/InputField.js +2 -2
- package/dist/components/InputField/InputField.js.map +1 -1
- package/dist/components/InputNumberField/InputNumberField.d.ts +1 -1
- package/dist/components/InputNumberField/InputNumberField.js +2 -2
- package/dist/components/InputNumberField/InputNumberField.js.map +1 -1
- package/dist/components/InputPhoneField/InputPhoneField.d.ts +1 -1
- package/dist/components/InputPhoneField/InputPhoneField.js +2 -2
- package/dist/components/InputPhoneField/InputPhoneField.js.map +1 -1
- package/dist/components/Layout/Layout.d.ts +2 -2
- package/dist/components/Layout/Layout.js.map +1 -1
- package/dist/components/ListItem/ListItem.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +8 -1
- package/dist/components/Menu/Menu.js +1 -1
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Menu/MenuExample.js +1 -1
- package/dist/components/Menu/MenuExample.js.map +1 -1
- package/dist/components/PasswordField/PasswordField.d.ts +1 -1
- package/dist/components/PasswordField/PasswordField.js +2 -2
- package/dist/components/PasswordField/PasswordField.js.map +1 -1
- package/dist/components/ProgressCircle/progress-circle.css +2 -0
- package/dist/components/ProgressCircle/progress-circle.css.js +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +4 -5
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RadioGroupField/RadioGroupField.d.ts +1 -1
- package/dist/components/RadioGroupField/RadioGroupField.js +2 -2
- package/dist/components/RadioGroupField/RadioGroupField.js.map +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +2 -2
- package/dist/components/SearchBar/SearchBar.js +2 -2
- package/dist/components/SearchBar/SearchBar.js.map +1 -1
- package/dist/components/Select/Select.d.ts +9 -2
- package/dist/components/Select/Select.js +4 -3
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectExample.js +36 -1
- package/dist/components/Select/SelectExample.js.map +1 -1
- package/dist/components/SelectField/SelectField.d.ts +1 -1
- package/dist/components/SelectField/SelectField.js +2 -2
- package/dist/components/SelectField/SelectField.js.map +1 -1
- package/dist/components/SkeletonText/SkeletonText.js +1 -1
- package/dist/components/SkeletonText/SkeletonText.js.map +1 -1
- package/dist/components/Slider/slider.css +1 -0
- package/dist/components/Slider/slider.css.js +1 -0
- package/dist/components/Switch/Switch.d.ts +1 -7
- package/dist/components/Switch/Switch.js +1 -2
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +3 -9
- package/dist/components/Textarea/Textarea.js +2 -2
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/TextareaField/TextareaField.d.ts +1 -1
- package/dist/components/TextareaField/TextareaField.js +2 -2
- package/dist/components/TextareaField/TextareaField.js.map +1 -1
- package/dist/components/TimePicker/TimePicker.js +10 -4
- package/dist/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/components/TimePickerField/TimePickerField.d.ts +1 -1
- package/dist/components/TimePickerField/TimePickerField.js +2 -2
- package/dist/components/TimePickerField/TimePickerField.js.map +1 -1
- package/dist/components/ToggleOption/ToggleOption.d.ts +3 -3
- package/dist/components/ToggleOption/ToggleOption.js +2 -2
- package/dist/components/ToggleOption/ToggleOption.js.map +1 -1
- package/dist/components/Truncated/Truncated.d.ts +2 -2
- package/dist/components/Truncated/Truncated.js.map +1 -1
- package/dist/components/Txt/Txt.d.ts +2 -2
- package/dist/components/Txt/Txt.js.map +1 -1
- package/dist/hooks/useArrowNavigation.d.ts +0 -2
- package/dist/hooks/useArrowNavigation.js +0 -2
- package/dist/hooks/useArrowNavigation.js.map +1 -1
- package/dist/hooks/useCheckboxGroupState.d.ts +7 -10
- package/dist/hooks/useCheckboxGroupState.js +7 -10
- package/dist/hooks/useCheckboxGroupState.js.map +1 -1
- package/dist/hooks/useFloating.js +8 -7
- package/dist/hooks/useFloating.js.map +1 -1
- package/dist/styles/base.css +4 -0
- package/dist/styles/base.css.js +4 -0
- package/dist/types/common.d.ts +12 -1
- package/dist/types/common.js.map +1 -1
- package/meta.ts +4 -4
- package/package.json +1 -3
- package/src/components/Avatar/Avatar.tsx +10 -11
- package/src/components/Avatar/AvatarExample.tsx +1 -1
- package/src/components/Avatar/avatar.scss +6 -1
- package/src/components/AvatarGroup/AvatarGroup.tsx +20 -24
- package/src/components/AvatarGroup/AvatarGroupExample.tsx +35 -9
- package/src/components/AvatarGroup/Overflow.tsx +91 -0
- package/src/components/AvatarGroup/avatar-group.scss +34 -14
- package/src/components/Badge/BadgeExample.tsx +1 -1
- package/src/components/BadgeDot/BadgeDotExample.tsx +1 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Card/Card.tsx +3 -2
- package/src/components/Checkbox/Checkbox.tsx +3 -8
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +5 -10
- package/src/components/CheckboxGroupField/CheckboxGroupField.tsx +3 -2
- package/src/components/CheckboxOption/CheckboxOption.tsx +5 -4
- package/src/components/DatePickerField/DatePickerField.tsx +8 -1
- package/src/components/Fab/Fab.tsx +2 -2
- package/src/components/Field/utils.ts +1 -1
- package/src/components/FormField/FormField.tsx +13 -3
- package/src/components/InputField/InputField.tsx +15 -2
- package/src/components/InputNumberField/InputNumberField.tsx +8 -1
- package/src/components/InputPhoneField/InputPhoneField.tsx +8 -1
- package/src/components/Layout/Layout.tsx +2 -2
- package/src/components/ListItem/ListItem.tsx +1 -1
- package/src/components/Menu/Menu.tsx +9 -1
- package/src/components/Menu/MenuExample.tsx +1 -1
- package/src/components/PasswordField/PasswordField.tsx +15 -2
- package/src/components/ProgressCircle/progress-circle.scss +2 -0
- package/src/components/RadioGroup/RadioGroup.tsx +18 -22
- package/src/components/RadioGroupField/RadioGroupField.tsx +2 -1
- package/src/components/SearchBar/SearchBar.tsx +3 -1
- package/src/components/Select/Select.tsx +12 -3
- package/src/components/Select/SelectExample.tsx +36 -1
- package/src/components/SelectField/SelectField.tsx +15 -2
- package/src/components/SkeletonText/SkeletonText.tsx +1 -1
- package/src/components/Slider/slider.scss +1 -0
- package/src/components/Switch/Switch.tsx +1 -9
- package/src/components/Textarea/Textarea.tsx +34 -39
- package/src/components/TextareaField/TextareaField.tsx +15 -2
- package/src/components/TimePicker/TimePicker.tsx +13 -3
- package/src/components/TimePickerField/TimePickerField.tsx +8 -1
- package/src/components/ToggleOption/ToggleOption.tsx +20 -19
- package/src/components/Truncated/Truncated.tsx +2 -2
- package/src/components/Txt/Txt.tsx +2 -2
- package/src/hooks/useArrowNavigation.ts +0 -2
- package/src/hooks/useCheckboxGroupState.ts +7 -10
- package/src/hooks/useFloating.ts +8 -7
- package/src/styles/base.scss +4 -0
- package/src/types/common.ts +11 -0
- package/dist/components/MenuButton/MenuButton.d.ts +0 -19
- package/dist/components/MenuButton/MenuButton.js +0 -20
- package/dist/components/MenuButton/MenuButton.js.map +0 -1
- package/dist/components/MenuButton/index.d.ts +0 -1
- package/dist/components/MenuButton/index.js +0 -2
- package/dist/components/MenuButton/index.js.map +0 -1
- package/dist/components/MenuButton/menu-button.css +0 -16
- package/dist/components/MenuButton/menu-button.css.js +0 -21
- package/src/components/MenuButton/MenuButton.rtl.test.tsx +0 -15
- package/src/components/MenuButton/MenuButton.tsx +0 -29
- package/src/components/MenuButton/index.tsx +0 -1
- package/src/components/MenuButton/menu-button.scss +0 -16
|
@@ -1,28 +1,48 @@
|
|
|
1
1
|
[data-bspk='avatar-group'] {
|
|
2
|
-
width:
|
|
2
|
+
width: fit-content;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
3
8
|
|
|
4
9
|
[data-wrap] {
|
|
5
|
-
width:
|
|
10
|
+
min-width: fit-content;
|
|
6
11
|
display: flex;
|
|
7
12
|
flex-direction: row;
|
|
8
|
-
align-items:
|
|
9
|
-
justify-content:
|
|
10
|
-
overflow: hidden;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
// data-gap={variant === 'spread' ? (small ? '01' : '02') : undefined}
|
|
18
|
+
|
|
19
|
+
[data-bspk='avatar'] {
|
|
20
|
+
z-index: 1;
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
z-index: 2;
|
|
24
|
+
}
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
&[data-bspk-owner='avatar-overflow'] {
|
|
27
|
+
--avatar-border: solid 1px var(--stroke-neutral-low);
|
|
28
|
+
|
|
29
|
+
background-color: var(--surface-neutral-t1-base);
|
|
30
|
+
}
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
[data-
|
|
22
|
-
|
|
33
|
+
&[data-variant='spread'] {
|
|
34
|
+
--avatar-border: none;
|
|
35
|
+
|
|
36
|
+
[data-bspk='avatar'] + [data-bspk='avatar'] {
|
|
37
|
+
margin-left: var(--spacing-sizing-02);
|
|
38
|
+
}
|
|
23
39
|
}
|
|
24
40
|
|
|
25
|
-
[data-
|
|
26
|
-
|
|
41
|
+
&[data-variant='stacked'] {
|
|
42
|
+
--avatar-border: solid 1px var(--stroke-neutral-low);
|
|
43
|
+
|
|
44
|
+
[data-bspk='avatar'] + [data-bspk='avatar'] {
|
|
45
|
+
margin-left: calc(var(--spacing-sizing-02) * -1);
|
|
46
|
+
}
|
|
27
47
|
}
|
|
28
48
|
}
|
|
@@ -6,7 +6,7 @@ export const BadgeExample: ComponentExample<BadgeProps> = {
|
|
|
6
6
|
render: ({ props, Component }) => {
|
|
7
7
|
return (
|
|
8
8
|
<Component {...props}>
|
|
9
|
-
<Avatar image="/
|
|
9
|
+
<Avatar image="/avatar-01.png" name="Andre Giant" />
|
|
10
10
|
</Component>
|
|
11
11
|
);
|
|
12
12
|
},
|
|
@@ -13,7 +13,7 @@ export const BadgeDotExample: ComponentExample<BadgeDotProps> = {
|
|
|
13
13
|
{props.outline === true ? (
|
|
14
14
|
<Button label="Button" size="large" />
|
|
15
15
|
) : (
|
|
16
|
-
<Avatar image="/
|
|
16
|
+
<Avatar image="/avatar-01.png" name="Andre Giant" />
|
|
17
17
|
)}
|
|
18
18
|
</Component>
|
|
19
19
|
);
|
|
@@ -5,7 +5,7 @@ import { ButtonSize, CommonProps, ElementProps, SetRef } from '-/types/common';
|
|
|
5
5
|
|
|
6
6
|
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
7
7
|
|
|
8
|
-
export type ButtonProps<As extends ElementType =
|
|
8
|
+
export type ButtonProps<As extends ElementType = ElementType> = CommonProps<'disabled' | 'owner'> & {
|
|
9
9
|
/**
|
|
10
10
|
* The label of the button.
|
|
11
11
|
*
|
|
@@ -98,7 +98,7 @@ export type ButtonProps<As extends ElementType = 'button'> = CommonProps<'disabl
|
|
|
98
98
|
* @name Button
|
|
99
99
|
* @phase UXReview
|
|
100
100
|
*/
|
|
101
|
-
export function Button<As extends ElementType =
|
|
101
|
+
export function Button<As extends ElementType = ElementType>(
|
|
102
102
|
props: AriaAttributes & ElementProps<ButtonProps<As>, As>,
|
|
103
103
|
): JSX.Element {
|
|
104
104
|
const {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './card.scss';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import { ElementProps } from '-/types/common';
|
|
3
4
|
|
|
4
5
|
export type CardProps = {
|
|
5
6
|
/**
|
|
@@ -38,9 +39,9 @@ export type CardProps = {
|
|
|
38
39
|
* @name Card
|
|
39
40
|
* @phase UXReview
|
|
40
41
|
*/
|
|
41
|
-
export function Card({ children, variant = 'elevated' }: CardProps) {
|
|
42
|
+
export function Card({ children, variant = 'elevated', ...props }: ElementProps<CardProps, 'div'>) {
|
|
42
43
|
return (
|
|
43
|
-
<div data-bspk="card" data-variant={variant}>
|
|
44
|
+
<div {...props} data-bspk="card" data-variant={variant}>
|
|
44
45
|
{children}
|
|
45
46
|
</div>
|
|
46
47
|
);
|
|
@@ -2,7 +2,7 @@ import './checkbox.scss';
|
|
|
2
2
|
import { ChangeEvent, useEffect, useRef } from 'react';
|
|
3
3
|
import { ElementProps, FieldControlProps } from '-/types/common';
|
|
4
4
|
|
|
5
|
-
export type CheckboxProps = Omit<FieldControlProps, 'onChange' | 'value'> & {
|
|
5
|
+
export type CheckboxProps = Omit<FieldControlProps, 'onChange' | 'readOnly' | 'value'> & {
|
|
6
6
|
/**
|
|
7
7
|
* If the checkbox is partially checked or
|
|
8
8
|
* [indeterminate](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes).
|
|
@@ -64,7 +64,6 @@ export function Checkbox({
|
|
|
64
64
|
indeterminate: indeterminateProp,
|
|
65
65
|
invalid,
|
|
66
66
|
disabled,
|
|
67
|
-
readOnly,
|
|
68
67
|
required,
|
|
69
68
|
...props
|
|
70
69
|
}: ElementProps<CheckboxProps, 'input'>) {
|
|
@@ -79,10 +78,7 @@ export function Checkbox({
|
|
|
79
78
|
}, [indeterminate]);
|
|
80
79
|
|
|
81
80
|
return (
|
|
82
|
-
<span
|
|
83
|
-
//
|
|
84
|
-
data-bspk="checkbox"
|
|
85
|
-
>
|
|
81
|
+
<span data-bspk="checkbox">
|
|
86
82
|
<input
|
|
87
83
|
{...props}
|
|
88
84
|
aria-describedby={props['aria-describedby'] || undefined}
|
|
@@ -90,9 +86,8 @@ export function Checkbox({
|
|
|
90
86
|
aria-invalid={invalid || undefined}
|
|
91
87
|
checked={checked}
|
|
92
88
|
data-indeterminate={indeterminate || undefined}
|
|
93
|
-
disabled={disabled ||
|
|
89
|
+
disabled={disabled || undefined}
|
|
94
90
|
onChange={(event) => props.onChange(!!event.target.checked, event)}
|
|
95
|
-
readOnly={readOnly}
|
|
96
91
|
ref={(node) => {
|
|
97
92
|
if (!node) return;
|
|
98
93
|
inputRef.current = node;
|
|
@@ -41,7 +41,7 @@ export type CheckboxGroupProps = FieldControlProps<string[]> & {
|
|
|
41
41
|
* import { CheckboxGroup } from '@bspk/ui/CheckboxGroup';
|
|
42
42
|
*
|
|
43
43
|
* function Example() {
|
|
44
|
-
* const [
|
|
44
|
+
* const [value, setValue] = React.useState<string[]>([]);
|
|
45
45
|
*
|
|
46
46
|
* return (
|
|
47
47
|
* <CheckboxGroup
|
|
@@ -52,9 +52,9 @@ export type CheckboxGroupProps = FieldControlProps<string[]> & {
|
|
|
52
52
|
* { label: 'Option 2', value: 'option2' },
|
|
53
53
|
* { label: 'Option 3', value: 'option3' },
|
|
54
54
|
* ]}
|
|
55
|
-
*
|
|
56
|
-
* onChange={(
|
|
57
|
-
*
|
|
55
|
+
* value={value}
|
|
56
|
+
* onChange={(nextValue: string[]) => {
|
|
57
|
+
* setValue(nextValue);
|
|
58
58
|
* }}
|
|
59
59
|
* />
|
|
60
60
|
* );
|
|
@@ -71,7 +71,6 @@ export function CheckboxGroup({
|
|
|
71
71
|
selectAll,
|
|
72
72
|
selectAllProps,
|
|
73
73
|
disabled = false,
|
|
74
|
-
readOnly,
|
|
75
74
|
invalid: invalidProp,
|
|
76
75
|
required,
|
|
77
76
|
id: idProp,
|
|
@@ -83,7 +82,6 @@ export function CheckboxGroup({
|
|
|
83
82
|
idProp,
|
|
84
83
|
required,
|
|
85
84
|
disabled,
|
|
86
|
-
readOnly,
|
|
87
85
|
invalidProp,
|
|
88
86
|
});
|
|
89
87
|
|
|
@@ -96,7 +94,7 @@ export function CheckboxGroup({
|
|
|
96
94
|
role="group"
|
|
97
95
|
>
|
|
98
96
|
{selectAll && (
|
|
99
|
-
<ToggleOption label={selectAllProps?.label || ALL_LABEL}
|
|
97
|
+
<ToggleOption label={selectAllProps?.label || ALL_LABEL}>
|
|
100
98
|
<Checkbox
|
|
101
99
|
aria-errormessage={ariaErrorMessageProp || ariaErrorMessage || undefined}
|
|
102
100
|
aria-label={selectAllProps?.label || ALL_LABEL}
|
|
@@ -107,7 +105,6 @@ export function CheckboxGroup({
|
|
|
107
105
|
invalid={invalid || undefined}
|
|
108
106
|
name={name}
|
|
109
107
|
onChange={(checked) => onChange(checked ? options.map((o) => o.value) : [])}
|
|
110
|
-
readOnly={readOnly}
|
|
111
108
|
value="all"
|
|
112
109
|
/>
|
|
113
110
|
</ToggleOption>
|
|
@@ -118,7 +115,6 @@ export function CheckboxGroup({
|
|
|
118
115
|
disabled={disabled || optionDisabled}
|
|
119
116
|
key={optionValue}
|
|
120
117
|
label={label}
|
|
121
|
-
readOnly={readOnly}
|
|
122
118
|
>
|
|
123
119
|
<Checkbox
|
|
124
120
|
aria-errormessage={ariaErrorMessageProp || ariaErrorMessage || undefined}
|
|
@@ -130,7 +126,6 @@ export function CheckboxGroup({
|
|
|
130
126
|
onChange={(checked) => {
|
|
131
127
|
onChange(checked ? [...value, optionValue] : value.filter((v) => v !== optionValue));
|
|
132
128
|
}}
|
|
133
|
-
readOnly={readOnly}
|
|
134
129
|
value={optionValue}
|
|
135
130
|
/>
|
|
136
131
|
</ToggleOption>
|
|
@@ -19,11 +19,12 @@ export function CheckboxGroupField({
|
|
|
19
19
|
helperText,
|
|
20
20
|
labelTrailing,
|
|
21
21
|
errorMessage,
|
|
22
|
+
style,
|
|
22
23
|
...controlProps
|
|
23
24
|
}: CheckboxGroupFieldProps) {
|
|
24
25
|
return (
|
|
25
|
-
<Field as="fieldset">
|
|
26
|
-
<FieldLabel as="legend" labelTrailing={labelTrailing}>
|
|
26
|
+
<Field as="fieldset" style={style}>
|
|
27
|
+
<FieldLabel as="legend" labelTrailing={labelTrailing} style={style}>
|
|
27
28
|
{label}
|
|
28
29
|
</FieldLabel>
|
|
29
30
|
<CheckboxGroup {...controlProps} />
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CheckboxProps, Checkbox } from '-/components/Checkbox';
|
|
2
2
|
import { ToggleOption, ToggleOptionControlProps } from '-/components/ToggleOption';
|
|
3
|
+
import { CommonProps } from '-/types/common';
|
|
3
4
|
|
|
4
|
-
export type CheckboxOptionProps = ToggleOptionControlProps<CheckboxProps>;
|
|
5
|
+
export type CheckboxOptionProps = CommonProps<'style'> & ToggleOptionControlProps<CheckboxProps>;
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A control that allows users to choose one or more items from a list or turn an feature on or off.
|
|
@@ -35,7 +36,7 @@ export function CheckboxOption({
|
|
|
35
36
|
label: labelProp,
|
|
36
37
|
description,
|
|
37
38
|
disabled,
|
|
38
|
-
|
|
39
|
+
style,
|
|
39
40
|
...checkboxProps
|
|
40
41
|
}: CheckboxOptionProps) {
|
|
41
42
|
const label = labelProp || description;
|
|
@@ -47,9 +48,9 @@ export function CheckboxOption({
|
|
|
47
48
|
description={description}
|
|
48
49
|
disabled={disabled}
|
|
49
50
|
label={label}
|
|
50
|
-
|
|
51
|
+
style={style}
|
|
51
52
|
>
|
|
52
|
-
<Checkbox {...checkboxProps} aria-label={ariaLabel} disabled={disabled}
|
|
53
|
+
<Checkbox {...checkboxProps} aria-label={ariaLabel} disabled={disabled} />
|
|
53
54
|
</ToggleOption>
|
|
54
55
|
)
|
|
55
56
|
);
|
|
@@ -18,10 +18,17 @@ export function DatePickerField({
|
|
|
18
18
|
helperText,
|
|
19
19
|
labelTrailing,
|
|
20
20
|
errorMessage,
|
|
21
|
+
style,
|
|
21
22
|
...controlProps
|
|
22
23
|
}: DatePickerFieldProps) {
|
|
23
24
|
return (
|
|
24
|
-
<FormField
|
|
25
|
+
<FormField
|
|
26
|
+
errorMessage={errorMessage}
|
|
27
|
+
helperText={helperText}
|
|
28
|
+
label={label}
|
|
29
|
+
labelTrailing={labelTrailing}
|
|
30
|
+
style={style}
|
|
31
|
+
>
|
|
25
32
|
<DatePicker {...controlProps} />
|
|
26
33
|
</FormField>
|
|
27
34
|
);
|
|
@@ -6,7 +6,7 @@ import { ElementProps } from '-/types/common';
|
|
|
6
6
|
|
|
7
7
|
export type FabVariant = 'neutral' | 'primary' | 'secondary';
|
|
8
8
|
|
|
9
|
-
export type FabProps<As extends ElementType =
|
|
9
|
+
export type FabProps<As extends ElementType = ElementType> = Pick<
|
|
10
10
|
ButtonProps<As>,
|
|
11
11
|
'as' | 'icon' | 'iconOnly' | 'onClick' | 'toolTip'
|
|
12
12
|
> &
|
|
@@ -52,7 +52,7 @@ export type FabProps<As extends ElementType = 'button'> = Pick<
|
|
|
52
52
|
* @name Fab
|
|
53
53
|
* @phase UXReview
|
|
54
54
|
*/
|
|
55
|
-
export function Fab<As extends ElementType =
|
|
55
|
+
export function Fab<As extends ElementType = ElementType>(props: AriaAttributes & ElementProps<FabProps<As>, As>) {
|
|
56
56
|
const {
|
|
57
57
|
size = 'small',
|
|
58
58
|
variant = 'primary',
|
|
@@ -52,7 +52,7 @@ export function useFieldInit({
|
|
|
52
52
|
idProp: string | undefined;
|
|
53
53
|
required: boolean | undefined;
|
|
54
54
|
disabled: boolean | undefined;
|
|
55
|
-
readOnly
|
|
55
|
+
readOnly?: boolean | undefined;
|
|
56
56
|
invalidProp: boolean | undefined;
|
|
57
57
|
}): Pick<FieldContext, 'ariaDescribedBy' | 'ariaErrorMessage'> & { invalid: boolean; id: string } {
|
|
58
58
|
const context = useContext(fieldContext);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ElementType, ReactNode } from 'react';
|
|
2
2
|
import { Field, FieldLabel, FieldDescription, FieldError } from '-/components/Field';
|
|
3
|
+
import { CommonProps } from '-/types/common';
|
|
3
4
|
|
|
4
5
|
export type FormFieldControlProps<P extends Record<string, unknown>> = Omit<FormFieldProps, 'children'> &
|
|
5
6
|
Omit<P, keyof FormFieldProps>;
|
|
6
7
|
|
|
7
|
-
export type FormFieldProps<As extends ElementType = ElementType> = {
|
|
8
|
+
export type FormFieldProps<As extends ElementType = ElementType> = CommonProps<'style'> & {
|
|
8
9
|
/** Displays an error message and marks the field as invalid. */
|
|
9
10
|
errorMessage?: string;
|
|
10
11
|
/**
|
|
@@ -77,12 +78,21 @@ export type FormFieldProps<As extends ElementType = ElementType> = {
|
|
|
77
78
|
* @name FormField
|
|
78
79
|
* @phase Utility
|
|
79
80
|
*/
|
|
80
|
-
export function FormField({
|
|
81
|
+
export function FormField({
|
|
82
|
+
label,
|
|
83
|
+
errorMessage,
|
|
84
|
+
helperText,
|
|
85
|
+
children,
|
|
86
|
+
labelTrailing,
|
|
87
|
+
required,
|
|
88
|
+
as,
|
|
89
|
+
style,
|
|
90
|
+
}: FormFieldProps) {
|
|
81
91
|
const fieldAs = as || 'div';
|
|
82
92
|
|
|
83
93
|
const labelAs = fieldAs === 'fieldset' ? 'legend' : undefined;
|
|
84
94
|
return (
|
|
85
|
-
<Field as={fieldAs}>
|
|
95
|
+
<Field as={fieldAs} style={style}>
|
|
86
96
|
<FieldLabel as={labelAs} labelTrailing={labelTrailing} required={required}>
|
|
87
97
|
{label}
|
|
88
98
|
</FieldLabel>
|
|
@@ -13,9 +13,22 @@ export type InputFieldProps = FormFieldControlProps<InputProps>;
|
|
|
13
13
|
*
|
|
14
14
|
* @generated
|
|
15
15
|
*/
|
|
16
|
-
export function InputField({
|
|
16
|
+
export function InputField({
|
|
17
|
+
label,
|
|
18
|
+
helperText,
|
|
19
|
+
labelTrailing,
|
|
20
|
+
errorMessage,
|
|
21
|
+
style,
|
|
22
|
+
...controlProps
|
|
23
|
+
}: InputFieldProps) {
|
|
17
24
|
return (
|
|
18
|
-
<FormField
|
|
25
|
+
<FormField
|
|
26
|
+
errorMessage={errorMessage}
|
|
27
|
+
helperText={helperText}
|
|
28
|
+
label={label}
|
|
29
|
+
labelTrailing={labelTrailing}
|
|
30
|
+
style={style}
|
|
31
|
+
>
|
|
19
32
|
<Input {...controlProps} />
|
|
20
33
|
</FormField>
|
|
21
34
|
);
|
|
@@ -18,10 +18,17 @@ export function InputNumberField({
|
|
|
18
18
|
helperText,
|
|
19
19
|
labelTrailing,
|
|
20
20
|
errorMessage,
|
|
21
|
+
style,
|
|
21
22
|
...controlProps
|
|
22
23
|
}: InputNumberFieldProps) {
|
|
23
24
|
return (
|
|
24
|
-
<FormField
|
|
25
|
+
<FormField
|
|
26
|
+
errorMessage={errorMessage}
|
|
27
|
+
helperText={helperText}
|
|
28
|
+
label={label}
|
|
29
|
+
labelTrailing={labelTrailing}
|
|
30
|
+
style={style}
|
|
31
|
+
>
|
|
25
32
|
<InputNumber {...controlProps} />
|
|
26
33
|
</FormField>
|
|
27
34
|
);
|
|
@@ -18,10 +18,17 @@ export function InputPhoneField({
|
|
|
18
18
|
helperText,
|
|
19
19
|
labelTrailing,
|
|
20
20
|
errorMessage,
|
|
21
|
+
style,
|
|
21
22
|
...controlProps
|
|
22
23
|
}: InputPhoneFieldProps) {
|
|
23
24
|
return (
|
|
24
|
-
<FormField
|
|
25
|
+
<FormField
|
|
26
|
+
errorMessage={errorMessage}
|
|
27
|
+
helperText={helperText}
|
|
28
|
+
label={label}
|
|
29
|
+
labelTrailing={labelTrailing}
|
|
30
|
+
style={style}
|
|
31
|
+
>
|
|
25
32
|
<InputPhone {...controlProps} />
|
|
26
33
|
</FormField>
|
|
27
34
|
);
|
|
@@ -2,7 +2,7 @@ import { ElementType, ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { ElementProps } from '-/types/common';
|
|
4
4
|
|
|
5
|
-
export type LayoutProps<As extends ElementType =
|
|
5
|
+
export type LayoutProps<As extends ElementType = ElementType> = {
|
|
6
6
|
/**
|
|
7
7
|
* The content of the Layout.
|
|
8
8
|
*
|
|
@@ -51,7 +51,7 @@ export type LayoutProps<As extends ElementType = 'div'> = {
|
|
|
51
51
|
* @name Layout
|
|
52
52
|
* @phase Utility
|
|
53
53
|
*/
|
|
54
|
-
export function Layout<As extends ElementType =
|
|
54
|
+
export function Layout<As extends ElementType = ElementType>({
|
|
55
55
|
children,
|
|
56
56
|
column,
|
|
57
57
|
gap = '16',
|
|
@@ -14,7 +14,7 @@ import { Truncated } from '-/components/Truncated';
|
|
|
14
14
|
import { useId } from '-/hooks/useId';
|
|
15
15
|
import { CommonProps, ElementProps, SetRef } from '-/types/common';
|
|
16
16
|
|
|
17
|
-
export type ListItemProps<As extends ElementType = ElementType> = CommonProps<'active' | 'owner'> &
|
|
17
|
+
export type ListItemProps<As extends ElementType = ElementType> = CommonProps<'active' | 'owner' | 'style'> &
|
|
18
18
|
Pick<AriaAttributes, 'aria-label'> & {
|
|
19
19
|
/**
|
|
20
20
|
* The element type to render as.
|
|
@@ -7,7 +7,7 @@ export function menuItemId(menuId: string, index: number) {
|
|
|
7
7
|
return `menu-${menuId}-item-${index}`;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export type MenuProps<As extends ElementType = ElementType> = CommonProps<'id' | 'owner' | 'role'> & {
|
|
10
|
+
export type MenuProps<As extends ElementType = ElementType> = CommonProps<'id' | 'owner' | 'role' | 'style'> & {
|
|
11
11
|
/** A ref to the inner div element. */
|
|
12
12
|
innerRef?: SetRef<HTMLDivElement>;
|
|
13
13
|
/**
|
|
@@ -29,6 +29,13 @@ export type MenuProps<As extends ElementType = ElementType> = CommonProps<'id' |
|
|
|
29
29
|
* @type ElementType
|
|
30
30
|
*/
|
|
31
31
|
as?: As;
|
|
32
|
+
/**
|
|
33
|
+
* The width of the menu.
|
|
34
|
+
*
|
|
35
|
+
* @type HTMLElement.style.width
|
|
36
|
+
* @exampleType string
|
|
37
|
+
*/
|
|
38
|
+
width?: HTMLElement['style']['width'];
|
|
32
39
|
};
|
|
33
40
|
|
|
34
41
|
/**
|
|
@@ -65,6 +72,7 @@ export function Menu({ as, innerRef, id: idProp, children, owner, label, ...prop
|
|
|
65
72
|
data-bspk-utility="menu"
|
|
66
73
|
id={menuId}
|
|
67
74
|
ref={innerRef}
|
|
75
|
+
style={{ ...props.style, width: props.width }}
|
|
68
76
|
>
|
|
69
77
|
{children}
|
|
70
78
|
</As>
|
|
@@ -22,7 +22,7 @@ export const MenuExample: ComponentExampleFn<MenuProps & { style?: unknown; 'dat
|
|
|
22
22
|
<Component {...props} style={{ padding: 'var(--spacing-sizing-02) var(--spacing-sizing-02)' }}>
|
|
23
23
|
<ListItem
|
|
24
24
|
label="Michael Scott"
|
|
25
|
-
leading={<Avatar image="/
|
|
25
|
+
leading={<Avatar image="/avatar-01.png" name="Michael Scott" />}
|
|
26
26
|
subText="michael.scott@email.com"
|
|
27
27
|
/>
|
|
28
28
|
<Divider inset={2} padding />
|
|
@@ -13,9 +13,22 @@ export type PasswordFieldProps = FormFieldControlProps<PasswordProps>;
|
|
|
13
13
|
*
|
|
14
14
|
* @generated
|
|
15
15
|
*/
|
|
16
|
-
export function PasswordField({
|
|
16
|
+
export function PasswordField({
|
|
17
|
+
label,
|
|
18
|
+
helperText,
|
|
19
|
+
labelTrailing,
|
|
20
|
+
errorMessage,
|
|
21
|
+
style,
|
|
22
|
+
...controlProps
|
|
23
|
+
}: PasswordFieldProps) {
|
|
17
24
|
return (
|
|
18
|
-
<FormField
|
|
25
|
+
<FormField
|
|
26
|
+
errorMessage={errorMessage}
|
|
27
|
+
helperText={helperText}
|
|
28
|
+
label={label}
|
|
29
|
+
labelTrailing={labelTrailing}
|
|
30
|
+
style={style}
|
|
31
|
+
>
|
|
19
32
|
<Password {...controlProps} />
|
|
20
33
|
</FormField>
|
|
21
34
|
);
|
|
@@ -68,7 +68,6 @@ export function RadioGroup({
|
|
|
68
68
|
name,
|
|
69
69
|
value: groupValue,
|
|
70
70
|
disabled = false,
|
|
71
|
-
readOnly,
|
|
72
71
|
invalid: invalidProp,
|
|
73
72
|
required,
|
|
74
73
|
id: idProp,
|
|
@@ -80,7 +79,6 @@ export function RadioGroup({
|
|
|
80
79
|
idProp,
|
|
81
80
|
required,
|
|
82
81
|
disabled,
|
|
83
|
-
readOnly,
|
|
84
82
|
invalidProp,
|
|
85
83
|
});
|
|
86
84
|
|
|
@@ -92,26 +90,24 @@ export function RadioGroup({
|
|
|
92
90
|
id={id}
|
|
93
91
|
role="radiogroup"
|
|
94
92
|
>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
})}
|
|
114
|
-
</div>
|
|
93
|
+
{options.map(({ label, description, value, ...option }, index) => {
|
|
94
|
+
return (
|
|
95
|
+
<RadioOption
|
|
96
|
+
aria-describedby={ariaDescribedByProp || ariaDescribedBy || undefined}
|
|
97
|
+
aria-errormessage={ariaErrorMessageProp || ariaErrorMessage || undefined}
|
|
98
|
+
checked={groupValue === value}
|
|
99
|
+
description={description}
|
|
100
|
+
disabled={disabled || option.disabled}
|
|
101
|
+
invalid={invalid || undefined}
|
|
102
|
+
key={`radio-option-${value || index}`}
|
|
103
|
+
label={label}
|
|
104
|
+
name={name}
|
|
105
|
+
onChange={(checked) => checked && onChange(value)}
|
|
106
|
+
required={required}
|
|
107
|
+
value={value}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
})}
|
|
115
111
|
</div>
|
|
116
112
|
);
|
|
117
113
|
}
|
|
@@ -19,11 +19,12 @@ export function RadioGroupField({
|
|
|
19
19
|
helperText,
|
|
20
20
|
labelTrailing,
|
|
21
21
|
errorMessage,
|
|
22
|
+
style,
|
|
22
23
|
...controlProps
|
|
23
24
|
}: RadioGroupFieldProps) {
|
|
24
25
|
return (
|
|
25
26
|
<Field as="fieldset">
|
|
26
|
-
<FieldLabel as="legend" labelTrailing={labelTrailing}>
|
|
27
|
+
<FieldLabel as="legend" labelTrailing={labelTrailing} style={style}>
|
|
27
28
|
{label}
|
|
28
29
|
</FieldLabel>
|
|
29
30
|
<RadioGroup {...controlProps} />
|
|
@@ -24,7 +24,7 @@ import { useIds } from '-/utils/useIds';
|
|
|
24
24
|
export type SearchBarOption = Pick<ListItemProps, 'label' | 'leading' | 'trailing'>;
|
|
25
25
|
|
|
26
26
|
export type SearchBarProps<O extends SearchBarOption = SearchBarOption> = FieldControlProps<string, O> &
|
|
27
|
-
Pick<InputProps, 'inputRef' | 'size'> &
|
|
27
|
+
Pick<InputProps, 'inputRef' | 'size' | 'trailing'> &
|
|
28
28
|
ScrollListItemsStyleProps & {
|
|
29
29
|
/**
|
|
30
30
|
* The placeholder of the field.
|
|
@@ -110,6 +110,7 @@ export function SearchBar<O extends SearchBarOption>({
|
|
|
110
110
|
onChange,
|
|
111
111
|
disabled = false,
|
|
112
112
|
scrollLimit,
|
|
113
|
+
trailing,
|
|
113
114
|
}: SearchBarProps<O>) {
|
|
114
115
|
const id = useId(idProp);
|
|
115
116
|
const menuId = `${id}-menu`;
|
|
@@ -215,6 +216,7 @@ export function SearchBar<O extends SearchBarOption>({
|
|
|
215
216
|
owner="search-bar"
|
|
216
217
|
placeholder={placeholder}
|
|
217
218
|
size={size}
|
|
219
|
+
trailing={trailing}
|
|
218
220
|
value={value}
|
|
219
221
|
/>
|
|
220
222
|
</div>
|