@bspk/ui 1.3.4 → 1.3.5
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/CheckboxGroup/CheckboxGroup.d.ts +4 -4
- package/dist/components/CheckboxGroup/CheckboxGroup.js +4 -4
- 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/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.js +3 -3
- 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/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/CheckboxGroup/CheckboxGroup.tsx +4 -4
- package/src/components/CheckboxGroupField/CheckboxGroupField.tsx +3 -2
- package/src/components/CheckboxOption/CheckboxOption.tsx +4 -1
- package/src/components/DatePickerField/DatePickerField.tsx +8 -1
- package/src/components/Fab/Fab.tsx +2 -2
- 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 -20
- 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/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,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.
|
|
@@ -36,6 +37,7 @@ export function CheckboxOption({
|
|
|
36
37
|
description,
|
|
37
38
|
disabled,
|
|
38
39
|
readOnly,
|
|
40
|
+
style,
|
|
39
41
|
...checkboxProps
|
|
40
42
|
}: CheckboxOptionProps) {
|
|
41
43
|
const label = labelProp || description;
|
|
@@ -48,6 +50,7 @@ export function CheckboxOption({
|
|
|
48
50
|
disabled={disabled}
|
|
49
51
|
label={label}
|
|
50
52
|
readOnly={readOnly}
|
|
53
|
+
style={style}
|
|
51
54
|
>
|
|
52
55
|
<Checkbox {...checkboxProps} aria-label={ariaLabel} disabled={disabled} readOnly={readOnly} />
|
|
53
56
|
</ToggleOption>
|
|
@@ -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',
|
|
@@ -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
|
);
|
|
@@ -92,26 +92,24 @@ export function RadioGroup({
|
|
|
92
92
|
id={id}
|
|
93
93
|
role="radiogroup"
|
|
94
94
|
>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
})}
|
|
114
|
-
</div>
|
|
95
|
+
{options.map(({ label, description, value, ...option }, index) => {
|
|
96
|
+
return (
|
|
97
|
+
<RadioOption
|
|
98
|
+
aria-describedby={ariaDescribedByProp || ariaDescribedBy || undefined}
|
|
99
|
+
aria-errormessage={ariaErrorMessageProp || ariaErrorMessage || undefined}
|
|
100
|
+
checked={groupValue === value}
|
|
101
|
+
description={description}
|
|
102
|
+
disabled={disabled || option.disabled}
|
|
103
|
+
invalid={invalid || undefined}
|
|
104
|
+
key={`radio-option-${value || index}`}
|
|
105
|
+
label={label}
|
|
106
|
+
name={name}
|
|
107
|
+
onChange={(checked) => checked && onChange(value)}
|
|
108
|
+
required={required}
|
|
109
|
+
value={value}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
})}
|
|
115
113
|
</div>
|
|
116
114
|
);
|
|
117
115
|
}
|
|
@@ -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>
|
|
@@ -3,7 +3,7 @@ import { SvgKeyboardArrowDown } from '@bspk/icons/KeyboardArrowDown';
|
|
|
3
3
|
import { useMemo, KeyboardEvent, MouseEvent } from 'react';
|
|
4
4
|
import { useFieldInit } from '-/components/Field';
|
|
5
5
|
import { ListItem, ListItemProps } from '-/components/ListItem';
|
|
6
|
-
import { Menu } from '-/components/Menu';
|
|
6
|
+
import { Menu, MenuProps } from '-/components/Menu';
|
|
7
7
|
import { useArrowNavigation } from '-/hooks/useArrowNavigation';
|
|
8
8
|
import { useFloating } from '-/hooks/useFloating';
|
|
9
9
|
import { useOutsideClick } from '-/hooks/useOutsideClick';
|
|
@@ -18,7 +18,7 @@ import { scrollListItemsStyle, ScrollListItemsStyleProps } from '-/utils/scrollL
|
|
|
18
18
|
* Essentially the props of ListItemProps.
|
|
19
19
|
*/
|
|
20
20
|
export type SelectOption = CommonProps<'disabled'> &
|
|
21
|
-
Omit<ListItemProps, 'id' | 'onClick' | '
|
|
21
|
+
Omit<ListItemProps, 'id' | 'onClick' | 'value'> & { value: string };
|
|
22
22
|
|
|
23
23
|
export type SelectItem = SelectOption & { id: string };
|
|
24
24
|
|
|
@@ -52,6 +52,12 @@ export type SelectProps = CommonProps<'size'> &
|
|
|
52
52
|
* @default Select one
|
|
53
53
|
*/
|
|
54
54
|
placeholder?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The width of the menu.
|
|
57
|
+
*
|
|
58
|
+
* If not provided, the menu will match the width of the select control.
|
|
59
|
+
*/
|
|
60
|
+
menuWidth?: MenuProps['width'];
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
/**
|
|
@@ -126,6 +132,7 @@ export function Select({
|
|
|
126
132
|
scrollLimit,
|
|
127
133
|
required = false,
|
|
128
134
|
'aria-label': ariaLabel,
|
|
135
|
+
menuWidth,
|
|
129
136
|
...elementProps
|
|
130
137
|
}: ElementProps<SelectProps, 'button'>) {
|
|
131
138
|
const { id, ariaDescribedBy, ariaErrorMessage, invalid } = useFieldInit({
|
|
@@ -162,7 +169,8 @@ export function Select({
|
|
|
162
169
|
const { elements, floatingStyles } = useFloating({
|
|
163
170
|
hide: !open,
|
|
164
171
|
offsetOptions: 4,
|
|
165
|
-
|
|
172
|
+
//match reference width if menuWidth not provided
|
|
173
|
+
refWidth: !menuWidth,
|
|
166
174
|
});
|
|
167
175
|
|
|
168
176
|
useOutsideClick({
|
|
@@ -266,6 +274,7 @@ export function Select({
|
|
|
266
274
|
...floatingStyles,
|
|
267
275
|
}}
|
|
268
276
|
tabIndex={-1}
|
|
277
|
+
width={menuWidth}
|
|
269
278
|
>
|
|
270
279
|
{items.map((item) => {
|
|
271
280
|
const isActive = activeElementId === item.id;
|
|
@@ -30,6 +30,37 @@ export const presets: Preset<SelectProps>[] = [
|
|
|
30
30
|
options: DEFAULT_OPTIONS,
|
|
31
31
|
name: 'demo-select',
|
|
32
32
|
value: '',
|
|
33
|
+
menuWidth: '',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: 'SubText',
|
|
38
|
+
propState: {
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
value: 'Claude 3.7 Sonnet',
|
|
42
|
+
label: 'Claude 3.7 Sonnet',
|
|
43
|
+
subText: 'bedrock • us.anthropic.claude-3-7-sonnet-20250219-v1:0',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: 'Claude 4 Sonnet',
|
|
47
|
+
label: 'Claude 4 Sonnet',
|
|
48
|
+
subText: 'bedrock • us.anthropic.claude-sonnet-4-20250514-v1:0',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: 'Claude 4.5 Sonnet',
|
|
52
|
+
label: 'Claude 4.5 Sonnet',
|
|
53
|
+
subText: 'bedrock • us.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: 'GPT 4.1',
|
|
57
|
+
label: 'GPT 4.1',
|
|
58
|
+
subText: 'azure • gpt-41',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
name: 'demo-select-long',
|
|
62
|
+
value: '',
|
|
63
|
+
menuWidth: '600px',
|
|
33
64
|
},
|
|
34
65
|
},
|
|
35
66
|
{
|
|
@@ -43,6 +74,7 @@ export const presets: Preset<SelectProps>[] = [
|
|
|
43
74
|
],
|
|
44
75
|
name: 'demo-select-long',
|
|
45
76
|
value: '',
|
|
77
|
+
menuWidth: '',
|
|
46
78
|
},
|
|
47
79
|
},
|
|
48
80
|
{
|
|
@@ -65,6 +97,7 @@ export const presets: Preset<SelectProps>[] = [
|
|
|
65
97
|
],
|
|
66
98
|
name: 'demo-select-tags',
|
|
67
99
|
value: 'a',
|
|
100
|
+
menuWidth: '',
|
|
68
101
|
},
|
|
69
102
|
},
|
|
70
103
|
{
|
|
@@ -82,6 +115,7 @@ export const presets: Preset<SelectProps>[] = [
|
|
|
82
115
|
],
|
|
83
116
|
name: 'demo-select-trailing',
|
|
84
117
|
value: '',
|
|
118
|
+
menuWidth: '',
|
|
85
119
|
},
|
|
86
120
|
},
|
|
87
121
|
{
|
|
@@ -112,6 +146,7 @@ export const presets: Preset<SelectProps>[] = [
|
|
|
112
146
|
],
|
|
113
147
|
name: 'demo-select-avatar',
|
|
114
148
|
value: '',
|
|
149
|
+
menuWidth: '',
|
|
115
150
|
},
|
|
116
151
|
},
|
|
117
152
|
];
|
|
@@ -122,6 +157,6 @@ export const SelectExample: ComponentExample<SelectProps> = {
|
|
|
122
157
|
scrollLimit: 5,
|
|
123
158
|
value: '',
|
|
124
159
|
},
|
|
125
|
-
render: ({ props, Component }) => <Component {...props} />,
|
|
160
|
+
render: ({ props, Component, preset }) => <Component key={preset?.label} {...props} />,
|
|
126
161
|
presets,
|
|
127
162
|
};
|
|
@@ -13,9 +13,22 @@ export type SelectFieldProps = FormFieldControlProps<SelectProps>;
|
|
|
13
13
|
*
|
|
14
14
|
* @generated
|
|
15
15
|
*/
|
|
16
|
-
export function SelectField({
|
|
16
|
+
export function SelectField({
|
|
17
|
+
label,
|
|
18
|
+
helperText,
|
|
19
|
+
labelTrailing,
|
|
20
|
+
errorMessage,
|
|
21
|
+
style,
|
|
22
|
+
...controlProps
|
|
23
|
+
}: SelectFieldProps) {
|
|
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
|
<Select {...controlProps} />
|
|
20
33
|
</FormField>
|
|
21
34
|
);
|
|
@@ -48,7 +48,7 @@ export type SkeletonTextProps = {
|
|
|
48
48
|
* @name SkeletonText
|
|
49
49
|
* @phase UXReview
|
|
50
50
|
*/
|
|
51
|
-
export function SkeletonText({ lines = 3, variant, children = null }: SkeletonTextProps) {
|
|
51
|
+
export function SkeletonText({ lines = 3, variant = 'body-base', children = null }: SkeletonTextProps) {
|
|
52
52
|
return children !== null && children !== undefined && children !== false ? (
|
|
53
53
|
children
|
|
54
54
|
) : (
|
|
@@ -1,45 +1,40 @@
|
|
|
1
1
|
import './textarea.scss';
|
|
2
2
|
import { ChangeEvent, useRef } from 'react';
|
|
3
3
|
import { useFieldInit } from '-/components/Field';
|
|
4
|
-
import { FieldControlProps, SetRef } from '-/types/common';
|
|
4
|
+
import { CommonProps, FieldControlProps, SetRef } from '-/types/common';
|
|
5
5
|
import { cssWithVars } from '-/utils/cwv';
|
|
6
6
|
|
|
7
|
-
export type TextareaProps =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @minimum 3
|
|
39
|
-
* @maximum 10
|
|
40
|
-
*/
|
|
41
|
-
maxRows?: number;
|
|
42
|
-
};
|
|
7
|
+
export type TextareaProps = CommonProps<'size'> &
|
|
8
|
+
FieldControlProps<string, ChangeEvent<HTMLTextAreaElement>> & {
|
|
9
|
+
/** The ref of the field. */
|
|
10
|
+
innerRef?: SetRef<HTMLTextAreaElement>;
|
|
11
|
+
/** The placeholder of the field. */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The maximum number of characters that the field will accept.
|
|
15
|
+
*
|
|
16
|
+
* @minimum 1
|
|
17
|
+
*/
|
|
18
|
+
maxLength?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The minimum number of rows that the textarea will show.
|
|
21
|
+
*
|
|
22
|
+
* @default 3
|
|
23
|
+
* @minimum 3
|
|
24
|
+
* @maximum 10
|
|
25
|
+
*/
|
|
26
|
+
minRows?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The maximum number of rows that the textarea will show.
|
|
29
|
+
*
|
|
30
|
+
* When set the textarea will automatically adjust its height to fit the content up to this limit.
|
|
31
|
+
*
|
|
32
|
+
* @default 10
|
|
33
|
+
* @minimum 3
|
|
34
|
+
* @maximum 10
|
|
35
|
+
*/
|
|
36
|
+
maxRows?: number;
|
|
37
|
+
};
|
|
43
38
|
|
|
44
39
|
/**
|
|
45
40
|
* A component that allows users to input large amounts of text that could span multiple lines.
|
|
@@ -79,7 +74,7 @@ export type TextareaProps = FieldControlProps<string, ChangeEvent<HTMLTextAreaEl
|
|
|
79
74
|
export function Textarea({
|
|
80
75
|
invalid: invalidProp,
|
|
81
76
|
onChange,
|
|
82
|
-
|
|
77
|
+
size = 'medium',
|
|
83
78
|
value = '',
|
|
84
79
|
name,
|
|
85
80
|
innerRef,
|
|
@@ -117,7 +112,7 @@ export function Textarea({
|
|
|
117
112
|
data-disabled={disabled || undefined}
|
|
118
113
|
data-invalid={invalid || undefined}
|
|
119
114
|
data-read-only={readOnly || undefined}
|
|
120
|
-
data-size={
|
|
115
|
+
data-size={size}
|
|
121
116
|
style={cssWithVars({
|
|
122
117
|
'--min-rows': minRows,
|
|
123
118
|
'--max-rows': maxRows,
|
|
@@ -13,9 +13,22 @@ export type TextareaFieldProps = FormFieldControlProps<TextareaProps>;
|
|
|
13
13
|
*
|
|
14
14
|
* @generated
|
|
15
15
|
*/
|
|
16
|
-
export function TextareaField({
|
|
16
|
+
export function TextareaField({
|
|
17
|
+
label,
|
|
18
|
+
helperText,
|
|
19
|
+
labelTrailing,
|
|
20
|
+
errorMessage,
|
|
21
|
+
style,
|
|
22
|
+
...controlProps
|
|
23
|
+
}: TextareaFieldProps) {
|
|
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
|
<Textarea {...controlProps} />
|
|
20
33
|
</FormField>
|
|
21
34
|
);
|