@bspk/ui 1.1.21 → 1.1.22
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/Avatar.d.ts +18 -2
- package/dist/Avatar.js +18 -2
- package/dist/Avatar.js.map +1 -1
- package/dist/AvatarGroup.d.ts +14 -0
- package/dist/AvatarGroup.js +14 -0
- package/dist/AvatarGroup.js.map +1 -1
- package/dist/Badge.d.ts +23 -2
- package/dist/Badge.js +12 -3
- package/dist/Badge.js.map +1 -1
- package/dist/BannerAlert.d.ts +17 -0
- package/dist/BannerAlert.js +17 -0
- package/dist/BannerAlert.js.map +1 -1
- package/dist/Button.d.ts +16 -0
- package/dist/Button.js +16 -0
- package/dist/Button.js.map +1 -1
- package/dist/Card.d.ts +12 -0
- package/dist/Card.js +12 -0
- package/dist/Card.js.map +1 -1
- package/dist/Checkbox.d.ts +21 -0
- package/dist/Checkbox.js +21 -0
- package/dist/Checkbox.js.map +1 -1
- package/dist/CheckboxGroup.d.ts +30 -0
- package/dist/CheckboxGroup.js +23 -0
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/CheckboxOption.d.ts +23 -1
- package/dist/CheckboxOption.js +25 -2
- package/dist/CheckboxOption.js.map +1 -1
- package/dist/Chip.d.ts +11 -0
- package/dist/Chip.js +11 -0
- package/dist/Chip.js.map +1 -1
- package/dist/Dialog.d.ts +19 -0
- package/dist/Dialog.js +19 -0
- package/dist/Dialog.js.map +1 -1
- package/dist/Divider.d.ts +13 -0
- package/dist/Divider.js +13 -0
- package/dist/Divider.js.map +1 -1
- package/dist/Dropdown.d.ts +30 -0
- package/dist/Dropdown.js +30 -0
- package/dist/Dropdown.js.map +1 -1
- package/dist/DropdownField.d.ts +22 -0
- package/dist/DropdownField.js +22 -0
- package/dist/DropdownField.js.map +1 -1
- package/dist/EmptyState.d.ts +11 -0
- package/dist/EmptyState.js +11 -0
- package/dist/EmptyState.js.map +1 -1
- package/dist/Fab.d.ts +8 -0
- package/dist/Fab.js +8 -0
- package/dist/Fab.js.map +1 -1
- package/dist/FormField.d.ts +25 -0
- package/dist/FormField.js +25 -0
- package/dist/FormField.js.map +1 -1
- package/dist/Img.d.ts +7 -0
- package/dist/Img.js +7 -0
- package/dist/Img.js.map +1 -1
- package/dist/InlineAlert.d.ts +7 -0
- package/dist/InlineAlert.js +7 -0
- package/dist/InlineAlert.js.map +1 -1
- package/dist/Layout.d.ts +7 -0
- package/dist/Layout.js +7 -0
- package/dist/Layout.js.map +1 -1
- package/dist/Link.d.ts +7 -0
- package/dist/Link.js +7 -0
- package/dist/Link.js.map +1 -1
- package/dist/ListItem.d.ts +15 -0
- package/dist/ListItem.js +15 -0
- package/dist/ListItem.js.map +1 -1
- package/dist/Menu.d.ts +28 -0
- package/dist/Menu.js +29 -1
- package/dist/Menu.js.map +1 -1
- package/dist/MenuButton.d.ts +7 -0
- package/dist/MenuButton.js +7 -0
- package/dist/MenuButton.js.map +1 -1
- package/dist/Modal.d.ts +23 -1
- package/dist/Modal.js +23 -1
- package/dist/Modal.js.map +1 -1
- package/dist/NumberField.d.ts +19 -0
- package/dist/NumberField.js +19 -0
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberInput.d.ts +16 -0
- package/dist/NumberInput.js +16 -0
- package/dist/NumberInput.js.map +1 -1
- package/dist/Popover.d.ts +29 -2
- package/dist/Popover.js +30 -3
- package/dist/Popover.js.map +1 -1
- package/dist/ProgressBar.d.ts +8 -0
- package/dist/ProgressBar.js +9 -1
- package/dist/ProgressBar.js.map +1 -1
- package/dist/ProgressCircle.d.ts +8 -0
- package/dist/ProgressCircle.js +8 -0
- package/dist/ProgressCircle.js.map +1 -1
- package/dist/ProgressionStepper.d.ts +12 -0
- package/dist/ProgressionStepper.js +12 -0
- package/dist/ProgressionStepper.js.map +1 -1
- package/dist/RadioGroup.d.ts +38 -6
- package/dist/RadioGroup.js +34 -5
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioOption.d.ts +3 -1
- package/dist/RadioOption.js +5 -2
- package/dist/RadioOption.js.map +1 -1
- package/dist/SearchBar.d.ts +34 -0
- package/dist/SearchBar.js +34 -0
- package/dist/SearchBar.js.map +1 -1
- package/dist/SegmentedControl.d.ts +35 -8
- package/dist/SegmentedControl.js +24 -2
- package/dist/SegmentedControl.js.map +1 -1
- package/dist/Skeleton.d.ts +3 -1
- package/dist/Skeleton.js +3 -1
- package/dist/Skeleton.js.map +1 -1
- package/dist/Switch.d.ts +18 -1
- package/dist/Switch.js +18 -1
- package/dist/Switch.js.map +1 -1
- package/dist/SwitchOption.d.ts +4 -2
- package/dist/SwitchOption.js +5 -2
- package/dist/SwitchOption.js.map +1 -1
- package/dist/TabGroup.d.ts +26 -5
- package/dist/TabGroup.js +20 -0
- package/dist/TabGroup.js.map +1 -1
- package/dist/Tag.d.ts +13 -1
- package/dist/Tag.js +13 -1
- package/dist/Tag.js.map +1 -1
- package/dist/TextField.d.ts +21 -2
- package/dist/TextField.js +22 -2
- package/dist/TextField.js.map +1 -1
- package/dist/TextInput.d.ts +22 -3
- package/dist/TextInput.js +20 -2
- package/dist/TextInput.js.map +1 -1
- package/dist/Textarea.d.ts +23 -4
- package/dist/Textarea.js +27 -7
- package/dist/Textarea.js.map +1 -1
- package/dist/TextareaField.d.ts +21 -1
- package/dist/TextareaField.js +24 -2
- package/dist/TextareaField.js.map +1 -1
- package/dist/ToggleOption.d.ts +8 -5
- package/dist/ToggleOption.js +3 -3
- package/dist/ToggleOption.js.map +1 -1
- package/dist/Tooltip.d.ts +15 -3
- package/dist/Tooltip.js +20 -3
- package/dist/Tooltip.js.map +1 -1
- package/dist/Txt.d.ts +9 -1
- package/dist/Txt.js +9 -1
- package/dist/Txt.js.map +1 -1
- package/dist/badge.css +1 -1
- package/dist/demo/examples.js +3 -0
- package/dist/demo/examples.js.map +1 -1
- package/dist/progress-bar.css +1 -1
- package/dist/radio-group.css +1 -0
- package/dist/textarea.css +1 -1
- package/dist/toggle-option.css +1 -1
- package/meta.ts +8 -6
- package/package.json +1 -1
- package/src/Avatar.tsx +18 -2
- package/src/AvatarGroup.tsx +14 -0
- package/src/Badge.tsx +30 -4
- package/src/BannerAlert.tsx +17 -0
- package/src/Button.tsx +16 -0
- package/src/Card.tsx +12 -0
- package/src/Checkbox.tsx +21 -0
- package/src/CheckboxGroup.tsx +30 -0
- package/src/CheckboxOption.tsx +29 -4
- package/src/Chip.tsx +11 -0
- package/src/Dialog.tsx +19 -0
- package/src/Divider.tsx +13 -0
- package/src/Dropdown.tsx +30 -0
- package/src/DropdownField.tsx +22 -0
- package/src/EmptyState.tsx +11 -0
- package/src/Fab.tsx +8 -0
- package/src/FormField.tsx +25 -0
- package/src/Img.tsx +7 -0
- package/src/InlineAlert.tsx +7 -0
- package/src/Layout.tsx +7 -0
- package/src/Link.tsx +7 -0
- package/src/ListItem.tsx +15 -0
- package/src/Menu.tsx +29 -0
- package/src/MenuButton.tsx +7 -0
- package/src/Modal.tsx +23 -1
- package/src/NumberField.tsx +19 -0
- package/src/NumberInput.tsx +16 -0
- package/src/Popover.tsx +53 -5
- package/src/ProgressBar.tsx +8 -0
- package/src/ProgressCircle.tsx +8 -0
- package/src/ProgressionStepper.tsx +12 -0
- package/src/RadioGroup.tsx +68 -25
- package/src/RadioOption.tsx +9 -4
- package/src/SearchBar.tsx +47 -3
- package/src/SegmentedControl.tsx +57 -14
- package/src/Skeleton.tsx +3 -1
- package/src/Switch.tsx +18 -1
- package/src/SwitchOption.tsx +11 -6
- package/src/TabGroup.tsx +30 -6
- package/src/Tag.tsx +13 -1
- package/src/TextField.tsx +37 -6
- package/src/TextInput.tsx +36 -5
- package/src/Textarea.tsx +41 -9
- package/src/TextareaField.tsx +33 -4
- package/src/ToggleOption.tsx +9 -6
- package/src/Tooltip.tsx +29 -5
- package/src/Txt.tsx +14 -2
- package/src/badge.scss +17 -4
- package/src/demo/examples.tsx +3 -0
- package/src/progress-bar.scss +0 -2
- package/src/radio-group.scss +5 -0
- package/src/textarea.scss +4 -0
- package/src/toggle-option.scss +1 -20
- package/dist/SwitchGroup.d.ts +0 -42
- package/dist/SwitchGroup.js +0 -16
- package/dist/SwitchGroup.js.map +0 -1
- package/dist/hooks/useSwitchGroupState.d.ts +0 -37
- package/dist/hooks/useSwitchGroupState.js +0 -57
- package/dist/hooks/useSwitchGroupState.js.map +0 -1
- package/src/SwitchGroup.tsx +0 -72
- package/src/hooks/useSwitchGroupState.ts +0 -75
package/dist/RadioGroup.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ToggleOptionProps } from './ToggleOption';
|
|
2
2
|
import { ElementProps, CommonProps } from './';
|
|
3
|
+
import './radio-group.scss';
|
|
3
4
|
export type RadioGroupOption = Pick<ToggleOptionProps, 'description' | 'label'> & Required<CommonProps<'value'>>;
|
|
4
5
|
export type RadioGroupProps = CommonProps<'name'> & {
|
|
5
6
|
/**
|
|
@@ -25,8 +26,8 @@ export type RadioGroupProps = CommonProps<'name'> & {
|
|
|
25
26
|
*
|
|
26
27
|
* @example
|
|
27
28
|
* [
|
|
28
|
-
* { value: '1', label: 'Option 1'
|
|
29
|
-
* { value: '2', label: 'Option 2' },
|
|
29
|
+
* { value: '1', label: 'Option 1' },
|
|
30
|
+
* { value: '2', label: 'Option 2', description: 'Description here' },
|
|
30
31
|
* { value: '3', label: 'Option 3' },
|
|
31
32
|
* ];
|
|
32
33
|
*
|
|
@@ -35,18 +36,49 @@ export type RadioGroupProps = CommonProps<'name'> & {
|
|
|
35
36
|
*/
|
|
36
37
|
options: RadioGroupOption[];
|
|
37
38
|
/**
|
|
38
|
-
* The
|
|
39
|
+
* The label of the radio group.
|
|
39
40
|
*
|
|
40
|
-
* @
|
|
41
|
+
* @required
|
|
42
|
+
*/
|
|
43
|
+
label: string;
|
|
44
|
+
/**
|
|
45
|
+
* Shows the RadioGroup label. When label isn't showing it is used as the aria-label prop.
|
|
46
|
+
*
|
|
47
|
+
* @default true
|
|
41
48
|
*/
|
|
42
|
-
|
|
49
|
+
showLabel?: boolean;
|
|
43
50
|
};
|
|
44
51
|
/**
|
|
45
52
|
* A group of radios that allows users to choose one or more items from a list or turn an feature on or off.
|
|
46
53
|
*
|
|
54
|
+
* @example
|
|
55
|
+
* import { useState } from 'react';
|
|
56
|
+
* import { RadioGroup } from '@bspk/ui/RadioGroup';
|
|
57
|
+
*
|
|
58
|
+
* export function Example() {
|
|
59
|
+
* const [selectedOption, setSelectedOption] = useState<string>('1');
|
|
60
|
+
*
|
|
61
|
+
* return (
|
|
62
|
+
* <RadioGroup
|
|
63
|
+
* name="Example name"
|
|
64
|
+
* onChange={(nextValue) => setSelectedOption(nextValue)}
|
|
65
|
+
* options={[
|
|
66
|
+
* {
|
|
67
|
+
* value: '1',
|
|
68
|
+
* label: 'Option 1',
|
|
69
|
+
* description: 'Description here',
|
|
70
|
+
* },
|
|
71
|
+
* { value: '2', label: 'Option 2' },
|
|
72
|
+
* { value: '3', label: 'Option 3' },
|
|
73
|
+
* ]}
|
|
74
|
+
* value={selectedOption}
|
|
75
|
+
* />
|
|
76
|
+
* );
|
|
77
|
+
* }
|
|
78
|
+
*
|
|
47
79
|
* @name RadioGroup
|
|
48
80
|
*/
|
|
49
|
-
declare function RadioGroup({ onChange, options, name, value: groupValue,
|
|
81
|
+
declare function RadioGroup({ onChange, options, name, value: groupValue, label: groupLabel, showLabel, ...props }: ElementProps<RadioGroupProps, 'div'>): import("react/jsx-runtime").JSX.Element;
|
|
50
82
|
declare namespace RadioGroup {
|
|
51
83
|
var bspkName: string;
|
|
52
84
|
}
|
package/dist/RadioGroup.js
CHANGED
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
2
3
|
import { Radio } from './Radio';
|
|
3
4
|
import { ToggleOption } from './ToggleOption';
|
|
5
|
+
import { styleAdd } from './utils/styleAdd';
|
|
6
|
+
styleAdd(`[data-bspk=radio-group]{display:flex;flex-direction:column;gap:var(--spacing-sizing-01)}`);;
|
|
4
7
|
/**
|
|
5
8
|
* A group of radios that allows users to choose one or more items from a list or turn an feature on or off.
|
|
6
9
|
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { useState } from 'react';
|
|
12
|
+
* import { RadioGroup } from '@bspk/ui/RadioGroup';
|
|
13
|
+
*
|
|
14
|
+
* export function Example() {
|
|
15
|
+
* const [selectedOption, setSelectedOption] = useState<string>('1');
|
|
16
|
+
*
|
|
17
|
+
* return (
|
|
18
|
+
* <RadioGroup
|
|
19
|
+
* name="Example name"
|
|
20
|
+
* onChange={(nextValue) => setSelectedOption(nextValue)}
|
|
21
|
+
* options={[
|
|
22
|
+
* {
|
|
23
|
+
* value: '1',
|
|
24
|
+
* label: 'Option 1',
|
|
25
|
+
* description: 'Description here',
|
|
26
|
+
* },
|
|
27
|
+
* { value: '2', label: 'Option 2' },
|
|
28
|
+
* { value: '3', label: 'Option 3' },
|
|
29
|
+
* ]}
|
|
30
|
+
* value={selectedOption}
|
|
31
|
+
* />
|
|
32
|
+
* );
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
7
35
|
* @name RadioGroup
|
|
8
36
|
*/
|
|
9
|
-
function RadioGroup({ onChange, options = [], name, value: groupValue,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
37
|
+
function RadioGroup({ onChange, options = [], name, value: groupValue, label: groupLabel, showLabel = true, ...props }) {
|
|
38
|
+
const id = `radio-group-${useId()}`;
|
|
39
|
+
return (_jsxs("div", { ...props, "aria-label": !showLabel ? groupLabel : undefined, "aria-labelledby": showLabel ? `${id}-label` : undefined, "data-bspk": "radio-group", id: id, role: "group", children: [showLabel && _jsx("label", { id: `${id}-label`, children: groupLabel }), _jsx("div", { role: "radiogroup", children: options.map(({ label, description, value }, index) => {
|
|
40
|
+
return (_jsx(ToggleOption, { description: description, label: label, children: _jsx(Radio, { "aria-label": label, checked: groupValue === value, name: name, onChange: (checked) => checked && onChange(value), value: value }) }, `toggle-option-${value || index}`));
|
|
41
|
+
}) })] }));
|
|
13
42
|
}
|
|
14
43
|
RadioGroup.bspkName = 'RadioGroup';
|
|
15
44
|
export { RadioGroup };
|
package/dist/RadioGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../src/RadioGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../src/RadioGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIjE,OAAO,oBAAoB,CAAC;AAmD5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAS,UAAU,CAAC,EAChB,QAAQ,EACR,OAAO,GAAG,EAAE,EACZ,IAAI,EACJ,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,EACjB,SAAS,GAAG,IAAI,EAChB,GAAG,KAAK,EAC2B;IACnC,MAAM,EAAE,GAAG,eAAe,KAAK,EAAE,EAAE,CAAC;IAEpC,OAAO,CACH,kBACQ,KAAK,gBACG,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,qBAC9B,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,eAC5C,aAAa,EACvB,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,OAAO,aAEX,SAAS,IAAI,gBAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,YAAG,UAAU,GAAS,EAC5D,cAAK,IAAI,EAAC,YAAY,YACjB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE;oBAClD,OAAO,CACH,KAAC,YAAY,IAAC,WAAW,EAAE,WAAW,EAA0C,KAAK,EAAE,KAAK,YACxF,KAAC,KAAK,kBACU,KAAK,EACjB,OAAO,EAAE,UAAU,KAAK,KAAK,EAC7B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,EACjD,KAAK,EAAE,KAAK,GACd,IAPuC,iBAAiB,KAAK,IAAI,KAAK,EAAE,CAQ/D,CAClB,CAAC;gBACN,CAAC,CAAC,GACA,IACJ,CACT,CAAC;AACN,CAAC;AAED,UAAU,CAAC,QAAQ,GAAG,YAAY,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/RadioOption.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ export type RadioOptionProps = InvalidPropsLibrary & Pick<RadioProps, 'checked'
|
|
|
13
13
|
/**
|
|
14
14
|
* A control that allows users to choose one or more items from a list or turn an feature on or off.
|
|
15
15
|
*
|
|
16
|
+
* If only a radio button is needed, consider using the `Radio` component directly.
|
|
17
|
+
*
|
|
16
18
|
* @name RadioOption
|
|
17
19
|
*/
|
|
18
|
-
declare function RadioOption({ label, description, ...checkboxProps }: RadioOptionProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function RadioOption({ label: labelProp, description, ...checkboxProps }: RadioOptionProps): "" | import("react/jsx-runtime").JSX.Element | undefined;
|
|
19
21
|
declare namespace RadioOption {
|
|
20
22
|
var bspkName: string;
|
|
21
23
|
}
|
package/dist/RadioOption.js
CHANGED
|
@@ -4,10 +4,13 @@ import { ToggleOption } from './ToggleOption';
|
|
|
4
4
|
/**
|
|
5
5
|
* A control that allows users to choose one or more items from a list or turn an feature on or off.
|
|
6
6
|
*
|
|
7
|
+
* If only a radio button is needed, consider using the `Radio` component directly.
|
|
8
|
+
*
|
|
7
9
|
* @name RadioOption
|
|
8
10
|
*/
|
|
9
|
-
function RadioOption({ label, description, ...checkboxProps }) {
|
|
10
|
-
|
|
11
|
+
function RadioOption({ label: labelProp, description, ...checkboxProps }) {
|
|
12
|
+
const label = labelProp || description;
|
|
13
|
+
return (label && (_jsx(ToggleOption, { "data-bspk": "radio-option", description: description, label: label, children: _jsx(Radio, { ...checkboxProps, "aria-label": label }) })));
|
|
11
14
|
}
|
|
12
15
|
RadioOption.bspkName = 'RadioOption';
|
|
13
16
|
export { RadioOption };
|
package/dist/RadioOption.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioOption.js","sourceRoot":"","sources":["../src/RadioOption.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAc,KAAK,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAejE
|
|
1
|
+
{"version":3,"file":"RadioOption.js","sourceRoot":"","sources":["../src/RadioOption.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAc,KAAK,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAejE;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,aAAa,EAAoB;IACtF,MAAM,KAAK,GAAG,SAAS,IAAI,WAAW,CAAC;IACvC,OAAO,CACH,KAAK,IAAI,CACL,KAAC,YAAY,iBAAW,cAAc,EAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,YACzE,KAAC,KAAK,OAAK,aAAa,gBAAc,KAAK,GAAI,GACpC,CAClB,CACJ,CAAC;AACN,CAAC;AAED,WAAW,CAAC,QAAQ,GAAG,aAAa,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/SearchBar.d.ts
CHANGED
|
@@ -56,6 +56,40 @@ export type SearchBarProps<T extends MenuItem = MenuItem> = Pick<MenuProps<T>, '
|
|
|
56
56
|
/**
|
|
57
57
|
* Component description coming soon.
|
|
58
58
|
*
|
|
59
|
+
* @example
|
|
60
|
+
* import { useState } from 'react';
|
|
61
|
+
* import { SearchBar } from '@bspk/ui/SearchBar';
|
|
62
|
+
*
|
|
63
|
+
* export function Example() {
|
|
64
|
+
* const [searchText, setSearchText] = useState<string>('');
|
|
65
|
+
*
|
|
66
|
+
* const handleItemSelect = (item) =>
|
|
67
|
+
* console.log('Selected item:', item);
|
|
68
|
+
*
|
|
69
|
+
* return (
|
|
70
|
+
* <SearchBar
|
|
71
|
+
* aria-label="Example aria-label"
|
|
72
|
+
* items={[
|
|
73
|
+
* { value: '1', label: 'Apple Pie' },
|
|
74
|
+
* { value: '2', label: 'Banana Split' },
|
|
75
|
+
* { value: '3', label: 'Cherry Tart' },
|
|
76
|
+
* { value: '4', label: 'Dragonfruit Sorbet' },
|
|
77
|
+
* { value: '5', label: 'Elderberry Jam' },
|
|
78
|
+
* { value: '6', label: 'Fig Newton' },
|
|
79
|
+
* { value: '7', label: 'Grape Soda' },
|
|
80
|
+
* { value: '8', label: 'Honeydew Smoothie' },
|
|
81
|
+
* { value: '9', label: 'Ice Cream Sandwich' },
|
|
82
|
+
* { value: '10', label: 'Jackfruit Pudding' },
|
|
83
|
+
* ]}
|
|
84
|
+
* name="Example name"
|
|
85
|
+
* placeholder="Search"
|
|
86
|
+
* value={searchText}
|
|
87
|
+
* onChange={setSearchText}
|
|
88
|
+
* onSelect={handleItemSelect}
|
|
89
|
+
* />
|
|
90
|
+
* );
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
59
93
|
* @name SearchBar
|
|
60
94
|
*/
|
|
61
95
|
declare function SearchBar({ itemCount, items, noResultsMessage, placeholder, 'aria-label': ariaLabel, id: idProp, inputRef, name, size, onSelect, value, onChange, showMenu, }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/SearchBar.js
CHANGED
|
@@ -12,6 +12,40 @@ import { useId } from './hooks/useId';
|
|
|
12
12
|
/**
|
|
13
13
|
* Component description coming soon.
|
|
14
14
|
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { useState } from 'react';
|
|
17
|
+
* import { SearchBar } from '@bspk/ui/SearchBar';
|
|
18
|
+
*
|
|
19
|
+
* export function Example() {
|
|
20
|
+
* const [searchText, setSearchText] = useState<string>('');
|
|
21
|
+
*
|
|
22
|
+
* const handleItemSelect = (item) =>
|
|
23
|
+
* console.log('Selected item:', item);
|
|
24
|
+
*
|
|
25
|
+
* return (
|
|
26
|
+
* <SearchBar
|
|
27
|
+
* aria-label="Example aria-label"
|
|
28
|
+
* items={[
|
|
29
|
+
* { value: '1', label: 'Apple Pie' },
|
|
30
|
+
* { value: '2', label: 'Banana Split' },
|
|
31
|
+
* { value: '3', label: 'Cherry Tart' },
|
|
32
|
+
* { value: '4', label: 'Dragonfruit Sorbet' },
|
|
33
|
+
* { value: '5', label: 'Elderberry Jam' },
|
|
34
|
+
* { value: '6', label: 'Fig Newton' },
|
|
35
|
+
* { value: '7', label: 'Grape Soda' },
|
|
36
|
+
* { value: '8', label: 'Honeydew Smoothie' },
|
|
37
|
+
* { value: '9', label: 'Ice Cream Sandwich' },
|
|
38
|
+
* { value: '10', label: 'Jackfruit Pudding' },
|
|
39
|
+
* ]}
|
|
40
|
+
* name="Example name"
|
|
41
|
+
* placeholder="Search"
|
|
42
|
+
* value={searchText}
|
|
43
|
+
* onChange={setSearchText}
|
|
44
|
+
* onSelect={handleItemSelect}
|
|
45
|
+
* />
|
|
46
|
+
* );
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
15
49
|
* @name SearchBar
|
|
16
50
|
*/
|
|
17
51
|
function SearchBar({ itemCount, items, noResultsMessage, placeholder = 'Search', 'aria-label': ariaLabel, id: idProp, inputRef, name, size = 'medium', onSelect, value, onChange, showMenu = true, }) {
|
package/dist/SearchBar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../src/SearchBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAuB,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAkB,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../src/SearchBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAuB,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAkB,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAkEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAS,SAAS,CAAC,EACf,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,WAAW,GAAG,QAAQ,EACtB,YAAY,EAAE,SAAS,EACv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EAAE,CAAC;oBACnC,CAAC,GACH,GACA,EACL,QAAQ,IAAI,CACT,KAAC,MAAM,cACH,KAAC,IAAI,IACD,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,gBAAgB,EACZ,CAAC,CAAC,KAAK,EAAE,MAAM;wBACf,CAAC,KAAK,EAAE,MAAM,IAAI,CACd,8BACI,KAAC,GAAG,IAAC,EAAE,EAAC,KAAK,EAAC,OAAO,EAAC,YAAY,iCAE5B,EACL,gBAAgB,IAAI,CACjB,KAAC,GAAG,IAAC,EAAE,EAAC,KAAK,EAAC,OAAO,EAAC,WAAW,YAC5B,gBAAgB,GACf,CACT,IACF,CACN,EAEL,QAAQ,EAAE,CAAC,cAAc,EAAE,KAAK,EAAE,EAAE;wBAChC,KAAK,EAAE,cAAc,EAAE,CAAC;wBACxB,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CACpB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC,CAAC,CACvC,CAAC;wBACF,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;wBACjB,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;wBAC5B,SAAS,EAAE,CAAC;oBAChB,CAAC,KACG,SAAS,GACf,GACG,CACZ,IACF,CACN,CAAC;AACN,CAAC;AAED,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -2,18 +2,23 @@ import './segmented-control.scss';
|
|
|
2
2
|
import { ElementProps } from './';
|
|
3
3
|
export type SegmentedControlOption = {
|
|
4
4
|
/**
|
|
5
|
-
* The label of the option. This is the text that will be displayed on the
|
|
5
|
+
* The label of the option. This is the text that will be displayed on the
|
|
6
|
+
* option.
|
|
6
7
|
*
|
|
7
8
|
* @required
|
|
8
9
|
*/
|
|
9
10
|
label: string;
|
|
10
11
|
/**
|
|
11
|
-
* Determines if the element is
|
|
12
|
+
* Determines if the element is
|
|
13
|
+
* [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled).
|
|
12
14
|
*
|
|
13
15
|
* @default false
|
|
14
16
|
*/
|
|
15
17
|
disabled?: boolean;
|
|
16
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The value of the option. If not provided, the label will be used as the
|
|
20
|
+
* value.
|
|
21
|
+
*/
|
|
17
22
|
value?: string;
|
|
18
23
|
/**
|
|
19
24
|
* The the icon to display before the label.
|
|
@@ -30,7 +35,8 @@ export type SegmentedControlOption = {
|
|
|
30
35
|
};
|
|
31
36
|
export type SegmentedControlProps = {
|
|
32
37
|
/**
|
|
33
|
-
* The options to display. Each option has a label and an optional leading
|
|
38
|
+
* The options to display. Each option has a label and an optional leading
|
|
39
|
+
* icon.
|
|
34
40
|
*
|
|
35
41
|
* @example
|
|
36
42
|
* [
|
|
@@ -65,15 +71,16 @@ export type SegmentedControlProps = {
|
|
|
65
71
|
*/
|
|
66
72
|
size?: 'medium' | 'small';
|
|
67
73
|
/**
|
|
68
|
-
* The width of the options. If set to 'fill', the options will fill the
|
|
69
|
-
* the options will be as wide as
|
|
74
|
+
* The width of the options. If set to 'fill', the options will fill the
|
|
75
|
+
* width of the container. If set to 'hug', the options will be as wide as
|
|
76
|
+
* their content.
|
|
70
77
|
*
|
|
71
78
|
* @default hug
|
|
72
79
|
*/
|
|
73
80
|
width?: 'fill' | 'hug';
|
|
74
81
|
/**
|
|
75
|
-
* Determines if the labels of the options should be displayed. If icons are
|
|
76
|
-
* ignored and labels are shown.
|
|
82
|
+
* Determines if the labels of the options should be displayed. If icons are
|
|
83
|
+
* not provided for every option this is ignored and labels are shown.
|
|
77
84
|
*
|
|
78
85
|
* @default true
|
|
79
86
|
*/
|
|
@@ -82,6 +89,26 @@ export type SegmentedControlProps = {
|
|
|
82
89
|
/**
|
|
83
90
|
* Navigation tool that organizes content across different screens and views.
|
|
84
91
|
*
|
|
92
|
+
* @example
|
|
93
|
+
* import { useState } from 'react';
|
|
94
|
+
* import { SegmentedControl } from '@bspk/ui/SegmentedControl';
|
|
95
|
+
*
|
|
96
|
+
* export function Example() {
|
|
97
|
+
* const [selectedOption, setSelectedOption] = useState<string>();
|
|
98
|
+
*
|
|
99
|
+
* return (
|
|
100
|
+
* <SegmentedControl
|
|
101
|
+
* onChange={setSelectedOption}
|
|
102
|
+
* options={[
|
|
103
|
+
* { value: '1', label: 'Option 1' },
|
|
104
|
+
* { value: '2', label: 'Option 2' },
|
|
105
|
+
* { value: '3', label: 'Option 3' },
|
|
106
|
+
* ]}
|
|
107
|
+
* value={selectedOption}
|
|
108
|
+
* />
|
|
109
|
+
* );
|
|
110
|
+
* }
|
|
111
|
+
*
|
|
85
112
|
* @name SegmentedControl
|
|
86
113
|
*/
|
|
87
114
|
declare function SegmentedControl({ onChange, value, size, options: optionsProp, width, showLabels: showLabelsProp, ...containerProps }: ElementProps<SegmentedControlProps, 'div'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/SegmentedControl.js
CHANGED
|
@@ -7,15 +7,37 @@ import { useOptionIconsInvalid } from './hooks/useOptionIconsInvalid';
|
|
|
7
7
|
/**
|
|
8
8
|
* Navigation tool that organizes content across different screens and views.
|
|
9
9
|
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { useState } from 'react';
|
|
12
|
+
* import { SegmentedControl } from '@bspk/ui/SegmentedControl';
|
|
13
|
+
*
|
|
14
|
+
* export function Example() {
|
|
15
|
+
* const [selectedOption, setSelectedOption] = useState<string>();
|
|
16
|
+
*
|
|
17
|
+
* return (
|
|
18
|
+
* <SegmentedControl
|
|
19
|
+
* onChange={setSelectedOption}
|
|
20
|
+
* options={[
|
|
21
|
+
* { value: '1', label: 'Option 1' },
|
|
22
|
+
* { value: '2', label: 'Option 2' },
|
|
23
|
+
* { value: '3', label: 'Option 3' },
|
|
24
|
+
* ]}
|
|
25
|
+
* value={selectedOption}
|
|
26
|
+
* />
|
|
27
|
+
* );
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
10
30
|
* @name SegmentedControl
|
|
11
31
|
*/
|
|
12
32
|
function SegmentedControl({ onChange, value, size = 'medium', options: optionsProp, width = 'hug', showLabels: showLabelsProp = true, ...containerProps }) {
|
|
13
33
|
const options = Array.isArray(optionsProp) ? optionsProp : [];
|
|
14
34
|
useOptionIconsInvalid(options);
|
|
15
|
-
const hideLabels = showLabelsProp === false &&
|
|
35
|
+
const hideLabels = showLabelsProp === false &&
|
|
36
|
+
options.every((item) => item.icon && item.label);
|
|
16
37
|
return (_jsx("div", { ...containerProps, "data-bspk": "segmented-control", "data-size": size, "data-width": width, children: options.map((item, index) => {
|
|
17
38
|
const isActive = item.value === value;
|
|
18
|
-
return (_jsx(Fragment, { children: _jsx(Tooltip, { disabled: !hideLabels, label: item.label, placement: "top", children: _jsx("button", { "aria-label": item.label, "data-first": index === 0 || undefined, "data-last": index === options.length - 1 || undefined, "data-selected": isActive || undefined, disabled: item.disabled || undefined, onClick: () => onChange(item.value || item.label), children: _jsx("span", { "data-outer": true, children: _jsxs("span", { "data-inner": true, children: [(isActive && item.iconActive) ||
|
|
39
|
+
return (_jsx(Fragment, { children: _jsx(Tooltip, { disabled: !hideLabels, label: item.label, placement: "top", children: _jsx("button", { "aria-label": item.label, "data-first": index === 0 || undefined, "data-last": index === options.length - 1 || undefined, "data-selected": isActive || undefined, disabled: item.disabled || undefined, onClick: () => onChange(item.value || item.label), children: _jsx("span", { "data-outer": true, children: _jsxs("span", { "data-inner": true, children: [(isActive && item.iconActive) ||
|
|
40
|
+
item.icon, !hideLabels && item.label] }) }) }) }) }, item.value));
|
|
19
41
|
}) }));
|
|
20
42
|
}
|
|
21
43
|
SegmentedControl.bspkName = 'SegmentedControl';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.js","sourceRoot":"","sources":["../src/SegmentedControl.tsx"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,Q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C,KAAK,EACjB,SAAS,EAAC,KAAK,YAEf,+BACgB,IAAI,CAAC,KAAK,gBACV,KAAK,KAAK,CAAC,IAAI,SAAS,eAEhC,KAAK,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,mBAE9B,QAAQ,IAAI,SAAS,EACpC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,SAAS,EACpC,OAAO,EAAE,GAAG,EAAE,CACV,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,YAGtC,6CACI,+CACK,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC;wCAC1B,IAAI,CAAC,IAAI,EACZ,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,IACvB,GACJ,GACF,GACH,IA1BC,IAAI,CAAC,KAAK,CA2Bd,CACd,CAAC;QACN,CAAC,CAAC,GACA,CACT,CAAC;AACN,CAAC;AAED,gBAAgB,CAAC,QAAQ,GAAG,kBAAkB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/Skeleton.d.ts
CHANGED
|
@@ -40,7 +40,9 @@ export type SkeletonProps = {
|
|
|
40
40
|
* displayed on the screen.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
|
-
*
|
|
43
|
+
* import { Skeleton } from '@bspk/ui/skeleton';
|
|
44
|
+
*
|
|
45
|
+
* function Example(item: { title: string; src: string } | null) {
|
|
44
46
|
* return item ? (
|
|
45
47
|
* <img
|
|
46
48
|
* style={{
|
package/dist/Skeleton.js
CHANGED
|
@@ -14,7 +14,9 @@ styleAdd(`[data-bspk=skeleton]{/*!
|
|
|
14
14
|
* displayed on the screen.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
*
|
|
17
|
+
* import { Skeleton } from '@bspk/ui/skeleton';
|
|
18
|
+
*
|
|
19
|
+
* function Example(item: { title: string; src: string } | null) {
|
|
18
20
|
* return item ? (
|
|
19
21
|
* <img
|
|
20
22
|
* style={{
|
package/dist/Skeleton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../src/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,iBAAiB,CAAC;AAsCzB
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../src/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,iBAAiB,CAAC;AAsCzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAS,QAAQ,CAAC,EACd,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,EACZ,SAAS,EACT,WAAW,EAAE,QAAQ,EACrB,OAAO,GAAG,aAAa,GACX;IACZ,OAAO,CACH,2BACc,UAAU,kBACN,OAAO,EACrB,KAAK,EACD;YACI,UAAU,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM;YAC/D,eAAe,EAAE,SAAS,QAAQ,QAAQ;YAC1C,eAAe,EAAE,cAAc,QAAQ,yBAAyB,QAAQ,SAAS;YACjF,SAAS,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK;SAC7C,YAGrB,OAAO,KAAK,MAAM;YACf,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,mCAAoB,KAAK,CAAI,CAAC,GAC1F,CACT,CAAC;AACN,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/Switch.d.ts
CHANGED
|
@@ -19,7 +19,24 @@ export type SwitchProps = CommonProps<'aria-label' | 'disabled' | 'name' | 'valu
|
|
|
19
19
|
/**
|
|
20
20
|
* A control element that allows users to toggle between two states, typically representing on/off and inherits
|
|
21
21
|
* immediate reaction in each state. This is the base element and if used directly you must wrap it with a label. This
|
|
22
|
-
* will more often be used in the SwitchOption
|
|
22
|
+
* will more often be used in the SwitchOption component.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* import { useState } from 'react';
|
|
26
|
+
* import { Switch } from '@bspk/ui/Switch';
|
|
27
|
+
*
|
|
28
|
+
* export function Example() {
|
|
29
|
+
* const [isChecked, setIsChecked] = useState<boolean>(false);
|
|
30
|
+
*
|
|
31
|
+
* return (
|
|
32
|
+
* <Switch
|
|
33
|
+
* aria-label="Example aria-label"
|
|
34
|
+
* name="Example name"
|
|
35
|
+
* onChange={setIsChecked}
|
|
36
|
+
* checked={isChecked}
|
|
37
|
+
* />
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
23
40
|
*
|
|
24
41
|
* @element
|
|
25
42
|
*
|
package/dist/Switch.js
CHANGED
|
@@ -4,7 +4,24 @@ styleAdd(`[data-bspk=switch]{--track-width: var(--spacing-sizing-09);--toggle-wi
|
|
|
4
4
|
/**
|
|
5
5
|
* A control element that allows users to toggle between two states, typically representing on/off and inherits
|
|
6
6
|
* immediate reaction in each state. This is the base element and if used directly you must wrap it with a label. This
|
|
7
|
-
* will more often be used in the SwitchOption
|
|
7
|
+
* will more often be used in the SwitchOption component.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { useState } from 'react';
|
|
11
|
+
* import { Switch } from '@bspk/ui/Switch';
|
|
12
|
+
*
|
|
13
|
+
* export function Example() {
|
|
14
|
+
* const [isChecked, setIsChecked] = useState<boolean>(false);
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <Switch
|
|
18
|
+
* aria-label="Example aria-label"
|
|
19
|
+
* name="Example name"
|
|
20
|
+
* onChange={setIsChecked}
|
|
21
|
+
* checked={isChecked}
|
|
22
|
+
* />
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
8
25
|
*
|
|
9
26
|
* @element
|
|
10
27
|
*
|
package/dist/Switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../src/Switch.tsx"],"names":[],"mappings":";AAAA,OAAO,eAAe,CAAC;AAqBvB
|
|
1
|
+
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../src/Switch.tsx"],"names":[],"mappings":";AAAA,OAAO,eAAe,CAAC;AAqBvB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAS,MAAM,CAAC,KAAkB;IAC9B,MAAM;IACF,EAAE;IACF,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,GAAG,UAAU,EAChB,GAAG,KAAK,CAAC;IAEV,OAAO,CACH,6BAAgB,QAAQ,aACpB,mBACQ,UAAU,mBACC,QAAQ,IAAI,SAAS,EACpC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,IAAI,SAAS,EAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAClE,IAAI,EAAC,UAAU,GACjB,EACF,qCAAoB,IACjB,CACV,CAAC;AACN,CAAC;AAED,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/SwitchOption.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { SwitchProps } from './Switch';
|
|
2
2
|
import { ToggleOptionProps } from './ToggleOption';
|
|
3
|
-
export type SwitchOptionProps = Omit<SwitchProps, 'aria-label'> & Pick<ToggleOptionProps, 'description' | 'label'
|
|
3
|
+
export type SwitchOptionProps = Omit<SwitchProps, 'aria-label'> & Pick<ToggleOptionProps, 'description' | 'label'>;
|
|
4
4
|
/**
|
|
5
5
|
* A control that allows users to choose one or more items from a list or turn an feature on or off.
|
|
6
6
|
*
|
|
7
|
+
* If only a switch is needed, consider using the `Switch` component directly.
|
|
8
|
+
*
|
|
7
9
|
* @name SwitchOption
|
|
8
10
|
*/
|
|
9
|
-
declare function SwitchOption({ label, description,
|
|
11
|
+
declare function SwitchOption({ label: labelProp, description, ...checkboxProps }: SwitchOptionProps): "" | import("react/jsx-runtime").JSX.Element | undefined;
|
|
10
12
|
declare namespace SwitchOption {
|
|
11
13
|
var bspkName: string;
|
|
12
14
|
}
|
package/dist/SwitchOption.js
CHANGED
|
@@ -4,10 +4,13 @@ import { ToggleOption } from './ToggleOption';
|
|
|
4
4
|
/**
|
|
5
5
|
* A control that allows users to choose one or more items from a list or turn an feature on or off.
|
|
6
6
|
*
|
|
7
|
+
* If only a switch is needed, consider using the `Switch` component directly.
|
|
8
|
+
*
|
|
7
9
|
* @name SwitchOption
|
|
8
10
|
*/
|
|
9
|
-
function SwitchOption({ label, description,
|
|
10
|
-
|
|
11
|
+
function SwitchOption({ label: labelProp, description, ...checkboxProps }) {
|
|
12
|
+
const label = labelProp || description;
|
|
13
|
+
return (label && (_jsx(ToggleOption, { "data-bspk": "switch-option", description: description, label: label, children: _jsx(Switch, { ...checkboxProps, "aria-label": label }) })));
|
|
11
14
|
}
|
|
12
15
|
SwitchOption.bspkName = 'SwitchOption';
|
|
13
16
|
export { SwitchOption };
|
package/dist/SwitchOption.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchOption.js","sourceRoot":"","sources":["../src/SwitchOption.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SwitchOption.js","sourceRoot":"","sources":["../src/SwitchOption.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIjE;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,aAAa,EAAqB;IACxF,MAAM,KAAK,GAAG,SAAS,IAAI,WAAW,CAAC;IAEvC,OAAO,CACH,KAAK,IAAI,CACL,KAAC,YAAY,iBAAW,eAAe,EAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,YAC1E,KAAC,MAAM,OAAK,aAAa,gBAAc,KAAK,GAAI,GACrC,CAClB,CACJ,CAAC;AACN,CAAC;AAED,YAAY,CAAC,QAAQ,GAAG,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/TabGroup.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export type TabGroupOption = {
|
|
|
10
10
|
*/
|
|
11
11
|
label: string;
|
|
12
12
|
/**
|
|
13
|
-
* Determines if the element is
|
|
13
|
+
* Determines if the element is
|
|
14
|
+
* [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled).
|
|
14
15
|
*
|
|
15
16
|
* @default false
|
|
16
17
|
*/
|
|
@@ -73,15 +74,15 @@ export type TabGroupProps = {
|
|
|
73
74
|
*/
|
|
74
75
|
size?: TabGroupSize;
|
|
75
76
|
/**
|
|
76
|
-
* When 'fill' the options will fill the width of the container. When 'hug',
|
|
77
|
-
* content.
|
|
77
|
+
* When 'fill' the options will fill the width of the container. When 'hug',
|
|
78
|
+
* the options will be as wide as their content.
|
|
78
79
|
*
|
|
79
80
|
* @default hug
|
|
80
81
|
*/
|
|
81
82
|
width?: 'fill' | 'hug';
|
|
82
83
|
/**
|
|
83
|
-
* When width is 'hug' this determines if the trailing underline should be
|
|
84
|
-
* property isn't applicable.
|
|
84
|
+
* When width is 'hug' this determines if the trailing underline should be
|
|
85
|
+
* showing. When width is 'fill' this property isn't applicable.
|
|
85
86
|
*
|
|
86
87
|
* @default false
|
|
87
88
|
*/
|
|
@@ -90,6 +91,26 @@ export type TabGroupProps = {
|
|
|
90
91
|
/**
|
|
91
92
|
* Navigation tool that organizes content across different screens and views.
|
|
92
93
|
*
|
|
94
|
+
* @example
|
|
95
|
+
* import { useState } from 'react';
|
|
96
|
+
* import { TabGroup } from '@bspk/ui/TabGroup';
|
|
97
|
+
*
|
|
98
|
+
* export function Example() {
|
|
99
|
+
* const [selectedTab, setSelectedTab] = useState<string>();
|
|
100
|
+
*
|
|
101
|
+
* return (
|
|
102
|
+
* <TabGroup
|
|
103
|
+
* onChange={setSelectedTab}
|
|
104
|
+
* options={[
|
|
105
|
+
* { value: '1', label: 'Option 1' },
|
|
106
|
+
* { value: '2', label: 'Option 2' },
|
|
107
|
+
* { value: '3', label: 'Option 3' },
|
|
108
|
+
* ]}
|
|
109
|
+
* value={selectedTab}
|
|
110
|
+
* />
|
|
111
|
+
* );
|
|
112
|
+
* }
|
|
113
|
+
*
|
|
93
114
|
* @name TabGroup
|
|
94
115
|
*/
|
|
95
116
|
declare function TabGroup({ onChange: onTabChange, value, size, options: optionsProp, width, showTrail, ...containerProps }: ElementProps<TabGroupProps, 'div'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/TabGroup.js
CHANGED
|
@@ -11,6 +11,26 @@ const TAB_BADGE_SIZES = {
|
|
|
11
11
|
/**
|
|
12
12
|
* Navigation tool that organizes content across different screens and views.
|
|
13
13
|
*
|
|
14
|
+
* @example
|
|
15
|
+
* import { useState } from 'react';
|
|
16
|
+
* import { TabGroup } from '@bspk/ui/TabGroup';
|
|
17
|
+
*
|
|
18
|
+
* export function Example() {
|
|
19
|
+
* const [selectedTab, setSelectedTab] = useState<string>();
|
|
20
|
+
*
|
|
21
|
+
* return (
|
|
22
|
+
* <TabGroup
|
|
23
|
+
* onChange={setSelectedTab}
|
|
24
|
+
* options={[
|
|
25
|
+
* { value: '1', label: 'Option 1' },
|
|
26
|
+
* { value: '2', label: 'Option 2' },
|
|
27
|
+
* { value: '3', label: 'Option 3' },
|
|
28
|
+
* ]}
|
|
29
|
+
* value={selectedTab}
|
|
30
|
+
* />
|
|
31
|
+
* );
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
14
34
|
* @name TabGroup
|
|
15
35
|
*/
|
|
16
36
|
function TabGroup({
|
package/dist/TabGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabGroup.js","sourceRoot":"","sources":["../src/TabGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,EAAc,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAMtE,MAAM,eAAe,GAA6C;IAC9D,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"TabGroup.js","sourceRoot":"","sources":["../src/TabGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,EAAc,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAMtE,MAAM,eAAe,GAA6C;IAC9D,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;CACnB,CAAC;AA0FF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAS,QAAQ,CAAC;AACd,EAAE;AACF,QAAQ,EAAE,WAAW,EACrB,KAAK,EACL,IAAI,GAAG,QAAQ,EACf,OAAO,EAAE,WAAW,EACpB,KAAK,GAAG,KAAK,EACb,SAAS,GAAG,KAAK,EACjB,GAAG,cAAc,EACgB;IACjC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CA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