@salt-ds/lab 1.0.0-alpha.14 → 1.0.0-alpha.15
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-cjs/badge/Badge.css.js +1 -1
- package/dist-cjs/badge/Badge.js +7 -23
- package/dist-cjs/badge/Badge.js.map +1 -1
- package/dist-cjs/content-status/ContentStatus.js +0 -2
- package/dist-cjs/content-status/ContentStatus.js.map +1 -1
- package/dist-cjs/content-status/internal/StatusIndicator.js +0 -2
- package/dist-cjs/content-status/internal/StatusIndicator.js.map +1 -1
- package/dist-cjs/drawer/Drawer.css.js +1 -1
- package/dist-cjs/drawer/Drawer.js +39 -45
- package/dist-cjs/drawer/Drawer.js.map +1 -1
- package/dist-cjs/drawer/useDrawer.js +31 -0
- package/dist-cjs/drawer/useDrawer.js.map +1 -0
- package/dist-cjs/form-field-legacy/FormFieldLegacy.css.js +1 -1
- package/dist-cjs/index.js +4 -7
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/list-next/ListItemNext.css.js +1 -1
- package/dist-cjs/list-next/ListItemNext.js +17 -6
- package/dist-cjs/list-next/ListItemNext.js.map +1 -1
- package/dist-cjs/list-next/ListNext.js +21 -10
- package/dist-cjs/list-next/ListNext.js.map +1 -1
- package/dist-cjs/list-next/ListNextContext.js.map +1 -1
- package/dist-cjs/list-next/useList.js +96 -37
- package/dist-cjs/list-next/useList.js.map +1 -1
- package/dist-cjs/nav-item/ExpansionButton.js +1 -1
- package/dist-cjs/nav-item/ExpansionButton.js.map +1 -1
- package/dist-cjs/nav-item/NavItem.css.js +1 -1
- package/dist-cjs/nav-item/NavItem.js +11 -1
- package/dist-cjs/nav-item/NavItem.js.map +1 -1
- package/dist-cjs/progress/CircularProgress/CircularProgress.css.js +1 -1
- package/dist-cjs/progress/CircularProgress/CircularProgress.js +44 -51
- package/dist-cjs/progress/CircularProgress/CircularProgress.js.map +1 -1
- package/dist-cjs/progress/LinearProgress/LinearProgress.css.js +1 -1
- package/dist-cjs/progress/LinearProgress/LinearProgress.js +9 -49
- package/dist-cjs/progress/LinearProgress/LinearProgress.js.map +1 -1
- package/dist-cjs/stepped-tracker/StepLabel/StepLabel.css.js +1 -1
- package/dist-cjs/stepped-tracker/StepLabel/StepLabel.js +5 -13
- package/dist-cjs/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
- package/dist-cjs/stepped-tracker/SteppedTracker.css.js +1 -1
- package/dist-cjs/stepped-tracker/SteppedTracker.js +0 -5
- package/dist-cjs/stepped-tracker/SteppedTracker.js.map +1 -1
- package/dist-cjs/stepped-tracker/SteppedTrackerContext.js +1 -7
- package/dist-cjs/stepped-tracker/SteppedTrackerContext.js.map +1 -1
- package/dist-cjs/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.js +2 -14
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.js.map +1 -1
- package/dist-cjs/switch/Switch.css.js +1 -1
- package/dist-cjs/switch/Switch.js +67 -72
- package/dist-cjs/switch/Switch.js.map +1 -1
- package/dist-cjs/toast-group/ToastGroup.css.js +6 -0
- package/dist-cjs/toast-group/ToastGroup.css.js.map +1 -0
- package/dist-cjs/toast-group/ToastGroup.js +32 -0
- package/dist-cjs/toast-group/ToastGroup.js.map +1 -0
- package/dist-es/badge/Badge.css.js +1 -1
- package/dist-es/badge/Badge.js +9 -25
- package/dist-es/badge/Badge.js.map +1 -1
- package/dist-es/content-status/ContentStatus.js +0 -2
- package/dist-es/content-status/ContentStatus.js.map +1 -1
- package/dist-es/content-status/internal/StatusIndicator.js +0 -2
- package/dist-es/content-status/internal/StatusIndicator.js.map +1 -1
- package/dist-es/drawer/Drawer.css.js +1 -1
- package/dist-es/drawer/Drawer.js +40 -46
- package/dist-es/drawer/Drawer.js.map +1 -1
- package/dist-es/drawer/useDrawer.js +27 -0
- package/dist-es/drawer/useDrawer.js.map +1 -0
- package/dist-es/form-field-legacy/FormFieldLegacy.css.js +1 -1
- package/dist-es/index.js +2 -3
- package/dist-es/index.js.map +1 -1
- package/dist-es/list-next/ListItemNext.css.js +1 -1
- package/dist-es/list-next/ListItemNext.js +17 -6
- package/dist-es/list-next/ListItemNext.js.map +1 -1
- package/dist-es/list-next/ListNext.js +21 -10
- package/dist-es/list-next/ListNext.js.map +1 -1
- package/dist-es/list-next/ListNextContext.js.map +1 -1
- package/dist-es/list-next/useList.js +98 -39
- package/dist-es/list-next/useList.js.map +1 -1
- package/dist-es/nav-item/ExpansionButton.js +2 -2
- package/dist-es/nav-item/ExpansionButton.js.map +1 -1
- package/dist-es/nav-item/NavItem.css.js +1 -1
- package/dist-es/nav-item/NavItem.js +11 -1
- package/dist-es/nav-item/NavItem.js.map +1 -1
- package/dist-es/progress/CircularProgress/CircularProgress.css.js +1 -1
- package/dist-es/progress/CircularProgress/CircularProgress.js +45 -52
- package/dist-es/progress/CircularProgress/CircularProgress.js.map +1 -1
- package/dist-es/progress/LinearProgress/LinearProgress.css.js +1 -1
- package/dist-es/progress/LinearProgress/LinearProgress.js +9 -49
- package/dist-es/progress/LinearProgress/LinearProgress.js.map +1 -1
- package/dist-es/stepped-tracker/StepLabel/StepLabel.css.js +1 -1
- package/dist-es/stepped-tracker/StepLabel/StepLabel.js +7 -15
- package/dist-es/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
- package/dist-es/stepped-tracker/SteppedTracker.css.js +1 -1
- package/dist-es/stepped-tracker/SteppedTracker.js +1 -6
- package/dist-es/stepped-tracker/SteppedTracker.js.map +1 -1
- package/dist-es/stepped-tracker/SteppedTrackerContext.js +1 -7
- package/dist-es/stepped-tracker/SteppedTrackerContext.js.map +1 -1
- package/dist-es/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
- package/dist-es/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
- package/dist-es/stepped-tracker/TrackerStep/TrackerStep.js +3 -15
- package/dist-es/stepped-tracker/TrackerStep/TrackerStep.js.map +1 -1
- package/dist-es/switch/Switch.css.js +1 -1
- package/dist-es/switch/Switch.js +70 -75
- package/dist-es/switch/Switch.js.map +1 -1
- package/dist-es/toast-group/ToastGroup.css.js +4 -0
- package/dist-es/toast-group/ToastGroup.css.js.map +1 -0
- package/dist-es/toast-group/ToastGroup.js +28 -0
- package/dist-es/toast-group/ToastGroup.js.map +1 -0
- package/dist-types/badge/Badge.d.ts +5 -16
- package/dist-types/content-status/internal/StatusIndicator.d.ts +2 -2
- package/dist-types/dialog/internal/DialogContext.d.ts +1 -1
- package/dist-types/drawer/Drawer.d.ts +3 -12
- package/dist-types/drawer/index.d.ts +1 -0
- package/dist-types/drawer/useDrawer.d.ts +27 -0
- package/dist-types/index.d.ts +1 -2
- package/dist-types/list-next/ListItemNext.d.ts +6 -1
- package/dist-types/list-next/ListNext.d.ts +7 -2
- package/dist-types/list-next/ListNextContext.d.ts +4 -2
- package/dist-types/list-next/useList.d.ts +15 -7
- package/dist-types/nav-item/NavItem.d.ts +29 -1
- package/dist-types/progress/CircularProgress/CircularProgress.d.ts +1 -21
- package/dist-types/progress/LinearProgress/LinearProgress.d.ts +1 -26
- package/dist-types/stepped-tracker/StepLabel/StepLabel.d.ts +3 -5
- package/dist-types/stepped-tracker/SteppedTrackerContext.d.ts +1 -4
- package/dist-types/stepped-tracker/TrackerStep/index.d.ts +0 -1
- package/dist-types/switch/Switch.d.ts +43 -6
- package/dist-types/toast-group/ToastGroup.d.ts +5 -0
- package/dist-types/toast-group/index.d.ts +1 -0
- package/package.json +3 -3
- package/dist-cjs/control-label/ControlLabel.css.js +0 -6
- package/dist-cjs/control-label/ControlLabel.css.js.map +0 -1
- package/dist-cjs/control-label/ControlLabel.js +0 -48
- package/dist-cjs/control-label/ControlLabel.js.map +0 -1
- package/dist-cjs/multiline-input/MultilineInput.css.js +0 -6
- package/dist-cjs/multiline-input/MultilineInput.css.js.map +0 -1
- package/dist-cjs/multiline-input/MultilineInput.js +0 -162
- package/dist-cjs/multiline-input/MultilineInput.js.map +0 -1
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js +0 -21
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js.map +0 -1
- package/dist-cjs/stepped-tracker/useDetectTruncatedText.js +0 -71
- package/dist-cjs/stepped-tracker/useDetectTruncatedText.js.map +0 -1
- package/dist-cjs/switch/assets/CheckedIcon.js +0 -34
- package/dist-cjs/switch/assets/CheckedIcon.js.map +0 -1
- package/dist-es/control-label/ControlLabel.css.js +0 -4
- package/dist-es/control-label/ControlLabel.css.js.map +0 -1
- package/dist-es/control-label/ControlLabel.js +0 -43
- package/dist-es/control-label/ControlLabel.js.map +0 -1
- package/dist-es/multiline-input/MultilineInput.css.js +0 -4
- package/dist-es/multiline-input/MultilineInput.css.js.map +0 -1
- package/dist-es/multiline-input/MultilineInput.js +0 -158
- package/dist-es/multiline-input/MultilineInput.js.map +0 -1
- package/dist-es/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js +0 -16
- package/dist-es/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js.map +0 -1
- package/dist-es/stepped-tracker/useDetectTruncatedText.js +0 -69
- package/dist-es/stepped-tracker/useDetectTruncatedText.js.map +0 -1
- package/dist-es/switch/assets/CheckedIcon.js +0 -30
- package/dist-es/switch/assets/CheckedIcon.js.map +0 -1
- package/dist-types/control-label/ControlLabel.d.ts +0 -8
- package/dist-types/control-label/index.d.ts +0 -1
- package/dist-types/multiline-input/MultilineInput.d.ts +0 -40
- package/dist-types/multiline-input/index.d.ts +0 -1
- package/dist-types/stepped-tracker/TrackerStep/TrackerStepTooltipContext.d.ts +0 -7
- package/dist-types/stepped-tracker/useDetectTruncatedText.d.ts +0 -11
- package/dist-types/switch/assets/CheckedIcon.d.ts +0 -4
package/dist-es/switch/Switch.js
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { forwardRef
|
|
4
|
-
import { makePrefixer, useControlled } from '@salt-ds/core';
|
|
5
|
-
import { ControlLabel } from '../control-label/ControlLabel.js';
|
|
6
|
-
import '../form-field-context-legacy/FormFieldLegacyContext.js';
|
|
7
|
-
import { useFormFieldLegacyProps } from '../form-field-context-legacy/useFormFieldLegacyProps.js';
|
|
8
|
-
import { CheckedIcon } from './assets/CheckedIcon.js';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { makePrefixer, useControlled, useFormFieldProps, useDensity } from '@salt-ds/core';
|
|
9
5
|
import { useWindow } from '@salt-ds/window';
|
|
10
6
|
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
11
7
|
import css_248z from './Switch.css.js';
|
|
8
|
+
import { SuccessSmallSolidIcon, SuccessSolidIcon } from '@salt-ds/icons';
|
|
12
9
|
|
|
13
10
|
const withBaseName = makePrefixer("saltSwitch");
|
|
11
|
+
function CheckedIcon(props) {
|
|
12
|
+
const density = useDensity();
|
|
13
|
+
return density === "high" ? /* @__PURE__ */ jsx(SuccessSmallSolidIcon, {
|
|
14
|
+
...props
|
|
15
|
+
}) : /* @__PURE__ */ jsx(SuccessSolidIcon, {
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
14
19
|
const Switch = forwardRef(function Switch2(props, ref) {
|
|
15
|
-
const { a11yProps } = useFormFieldLegacyProps();
|
|
16
20
|
const {
|
|
17
21
|
checked: checkedProp,
|
|
18
22
|
className,
|
|
19
23
|
color,
|
|
20
24
|
defaultChecked,
|
|
21
|
-
disabled,
|
|
25
|
+
disabled: disabledProp,
|
|
26
|
+
inputProps = {},
|
|
22
27
|
label,
|
|
23
|
-
|
|
28
|
+
name,
|
|
24
29
|
onBlur,
|
|
25
30
|
onChange,
|
|
26
31
|
onFocus,
|
|
32
|
+
value,
|
|
27
33
|
...rest
|
|
28
34
|
} = props;
|
|
29
35
|
const targetWindow = useWindow();
|
|
@@ -32,85 +38,74 @@ const Switch = forwardRef(function Switch2(props, ref) {
|
|
|
32
38
|
css: css_248z,
|
|
33
39
|
window: targetWindow
|
|
34
40
|
});
|
|
35
|
-
const
|
|
41
|
+
const {
|
|
42
|
+
"aria-describedby": inputDescribedBy,
|
|
43
|
+
"aria-labelledby": inputLabelledBy,
|
|
44
|
+
className: inputClassName,
|
|
45
|
+
onChange: inputOnChange,
|
|
46
|
+
...restInputProps
|
|
47
|
+
} = inputProps;
|
|
36
48
|
const [checked, setChecked] = useControlled({
|
|
37
49
|
controlled: checkedProp,
|
|
38
50
|
default: Boolean(defaultChecked),
|
|
39
51
|
name: "Switch",
|
|
40
52
|
state: "checked"
|
|
41
53
|
});
|
|
42
|
-
const
|
|
54
|
+
const { a11yProps: formFieldA11yProps, disabled: formFieldDisabled } = useFormFieldProps();
|
|
55
|
+
const disabled = formFieldDisabled != null ? formFieldDisabled : disabledProp;
|
|
43
56
|
const handleChange = (event) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
if (event.nativeEvent.defaultPrevented) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const value2 = event.target.checked;
|
|
61
|
+
setChecked(value2);
|
|
62
|
+
onChange == null ? void 0 : onChange(event);
|
|
63
|
+
inputOnChange == null ? void 0 : inputOnChange(event);
|
|
47
64
|
};
|
|
48
|
-
|
|
49
|
-
(event) => {
|
|
50
|
-
var _a;
|
|
51
|
-
if (!inputRef.current) {
|
|
52
|
-
inputRef.current = event.currentTarget;
|
|
53
|
-
}
|
|
54
|
-
if ((_a = inputRef.current) == null ? void 0 : _a.matches(":focus-visible")) {
|
|
55
|
-
setFocusVisible(true);
|
|
56
|
-
}
|
|
57
|
-
onFocus == null ? void 0 : onFocus(event);
|
|
58
|
-
},
|
|
59
|
-
[onFocus]
|
|
60
|
-
);
|
|
61
|
-
const handleBlur = useCallback(
|
|
62
|
-
(event) => {
|
|
63
|
-
setFocusVisible(false);
|
|
64
|
-
onBlur == null ? void 0 : onBlur(event);
|
|
65
|
-
},
|
|
66
|
-
[onBlur]
|
|
67
|
-
);
|
|
68
|
-
return /* @__PURE__ */ jsx(ControlLabel, {
|
|
69
|
-
...LabelProps,
|
|
65
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
70
66
|
className: clsx(
|
|
71
|
-
withBaseName(
|
|
72
|
-
{
|
|
67
|
+
withBaseName(),
|
|
68
|
+
{
|
|
69
|
+
[withBaseName("disabled")]: disabled,
|
|
70
|
+
[withBaseName("checked")]: checked
|
|
71
|
+
},
|
|
73
72
|
className
|
|
74
73
|
),
|
|
75
|
-
disabled,
|
|
76
|
-
label,
|
|
77
74
|
ref,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
75
|
+
...rest,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx("input", {
|
|
78
|
+
"aria-describedby": clsx(
|
|
79
|
+
formFieldA11yProps == null ? void 0 : formFieldA11yProps["aria-describedby"],
|
|
80
|
+
inputDescribedBy
|
|
81
|
+
),
|
|
82
|
+
"aria-labelledby": clsx(
|
|
83
|
+
formFieldA11yProps == null ? void 0 : formFieldA11yProps["aria-labelledby"],
|
|
84
|
+
inputLabelledBy
|
|
85
|
+
),
|
|
86
|
+
name,
|
|
87
|
+
value,
|
|
88
|
+
checked,
|
|
89
|
+
className: clsx(withBaseName("input"), inputClassName),
|
|
90
|
+
defaultChecked,
|
|
91
|
+
disabled,
|
|
92
|
+
onBlur,
|
|
93
|
+
onChange: handleChange,
|
|
94
|
+
onFocus,
|
|
95
|
+
type: "checkbox",
|
|
96
|
+
...restInputProps
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsx("span", {
|
|
99
|
+
className: withBaseName("track"),
|
|
100
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
101
|
+
className: withBaseName("thumb"),
|
|
102
|
+
children: checked && /* @__PURE__ */ jsx(CheckedIcon, {
|
|
103
|
+
className: withBaseName("icon")
|
|
107
104
|
})
|
|
108
|
-
}),
|
|
109
|
-
/* @__PURE__ */ jsx("span", {
|
|
110
|
-
className: withBaseName("track")
|
|
111
105
|
})
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
}),
|
|
107
|
+
label
|
|
108
|
+
]
|
|
114
109
|
});
|
|
115
110
|
});
|
|
116
111
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../src/switch/Switch.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../src/switch/Switch.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n ChangeEventHandler,\n ComponentPropsWithoutRef,\n FocusEventHandler,\n forwardRef,\n ReactNode,\n} from \"react\";\nimport {\n makePrefixer,\n useControlled,\n useDensity,\n useFormFieldProps,\n} from \"@salt-ds/core\";\n\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport switchCss from \"./Switch.css\";\nimport {\n IconProps,\n SuccessSmallSolidIcon,\n SuccessSolidIcon,\n} from \"@salt-ds/icons\";\n\nexport interface SwitchProps\n extends Omit<\n ComponentPropsWithoutRef<\"label\">,\n \"children\" | \"onFocus\" | \"onBlur\" | \"onChange\"\n > {\n /**\n * If `true`, the checkbox will be checked.\n */\n checked?: boolean;\n /**\n * Whether the checkbox component is checked by default\n * This will be disregarded if checked is already set.\n */\n defaultChecked?: boolean;\n /**\n * If `true`, the checkbox will be disabled.\n */\n disabled?: boolean;\n /**\n * Properties applied to the input element.\n */\n inputProps?: Partial<ComponentPropsWithoutRef<\"input\">>;\n /**\n * The label to be shown next to the checkbox.\n */\n label?: ReactNode;\n /**\n * The name applied to the input.\n */\n name?: string;\n /**\n * Callback when checkbox loses focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Callback when checked state is changed.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Callback when checkbox gains focus.\n */\n onFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * The value of the checkbox.\n */\n value?: string;\n}\n\nconst withBaseName = makePrefixer(\"saltSwitch\");\n\nfunction CheckedIcon(props: IconProps) {\n const density = useDensity();\n return density === \"high\" ? (\n <SuccessSmallSolidIcon {...props} />\n ) : (\n <SuccessSolidIcon {...props} />\n );\n}\n\nexport const Switch = forwardRef<HTMLLabelElement, SwitchProps>(function Switch(\n props,\n ref\n) {\n const {\n checked: checkedProp,\n className,\n color,\n defaultChecked,\n disabled: disabledProp,\n inputProps = {},\n label,\n name,\n onBlur,\n onChange,\n onFocus,\n value,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-switch\",\n css: switchCss,\n window: targetWindow,\n });\n\n const {\n \"aria-describedby\": inputDescribedBy,\n \"aria-labelledby\": inputLabelledBy,\n className: inputClassName,\n onChange: inputOnChange,\n ...restInputProps\n } = inputProps;\n\n const [checked, setChecked] = useControlled({\n controlled: checkedProp,\n default: Boolean(defaultChecked),\n name: \"Switch\",\n state: \"checked\",\n });\n\n const { a11yProps: formFieldA11yProps, disabled: formFieldDisabled } =\n useFormFieldProps();\n\n const disabled = formFieldDisabled ?? disabledProp;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n // Workaround for https://github.com/facebook/react/issues/9023\n if (event.nativeEvent.defaultPrevented) {\n return;\n }\n\n const value = event.target.checked;\n setChecked(value);\n onChange?.(event);\n inputOnChange?.(event);\n };\n\n return (\n <label\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"checked\")]: checked,\n },\n className\n )}\n ref={ref}\n {...rest}\n >\n <input\n aria-describedby={clsx(\n formFieldA11yProps?.[\"aria-describedby\"],\n inputDescribedBy\n )}\n aria-labelledby={clsx(\n formFieldA11yProps?.[\"aria-labelledby\"],\n inputLabelledBy\n )}\n name={name}\n value={value}\n checked={checked}\n className={clsx(withBaseName(\"input\"), inputClassName)}\n defaultChecked={defaultChecked}\n disabled={disabled}\n onBlur={onBlur}\n onChange={handleChange}\n onFocus={onFocus}\n type=\"checkbox\"\n {...restInputProps}\n />\n <span className={withBaseName(\"track\")}>\n <span className={withBaseName(\"thumb\")}>\n {checked && <CheckedIcon className={withBaseName(\"icon\")} />}\n </span>\n </span>\n {label}\n </label>\n );\n});\n"],"names":["Switch","switchCss","value"],"mappings":"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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = ".saltToastGroup {\n width: var(--toastGroup-width);\n max-height: calc(100% - var(--salt-spacing-300) * 2);\n margin: var(--salt-spacing-300) var(--salt-spacing-200) var(--salt-spacing-100) var(--salt-spacing-200);\n overflow: auto;\n display: flex-inline;\n flex-direction: column;\n position: fixed;\n z-index: var(--salt-zIndex-flyover);\n}\n\n.saltToastGroup-bottom-right {\n bottom: 0;\n right: 0;\n justify-content: flex-end;\n}\n\n.saltToastGroup-top-right {\n top: 0;\n right: 0;\n justify-content: flex-start;\n}\n\n.salt-density-high {\n --toastGroup-width: 210px;\n}\n\n.salt-density-medium {\n --toastGroup-width: 260px;\n}\n\n.salt-density-low {\n --toastGroup-width: 310px;\n}\n\n.salt-density-touch {\n --toastGroup-width: 360px;\n}\n";
|
|
2
|
+
|
|
3
|
+
export { css_248z as default };
|
|
4
|
+
//# sourceMappingURL=ToastGroup.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastGroup.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { makePrefixer } from '@salt-ds/core';
|
|
5
|
+
import { useWindow } from '@salt-ds/window';
|
|
6
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
7
|
+
import css_248z from './ToastGroup.css.js';
|
|
8
|
+
|
|
9
|
+
const withBaseName = makePrefixer("saltToastGroup");
|
|
10
|
+
const ToastGroup = forwardRef(
|
|
11
|
+
function ToastGroup2(props, ref) {
|
|
12
|
+
const { children, className, placement = "bottom-right", ...rest } = props;
|
|
13
|
+
const targetWindow = useWindow();
|
|
14
|
+
useComponentCssInjection({
|
|
15
|
+
testId: "salt-toast",
|
|
16
|
+
css: css_248z,
|
|
17
|
+
window: targetWindow
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: clsx(withBaseName(), withBaseName(placement), className),
|
|
21
|
+
...rest,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export { ToastGroup };
|
|
28
|
+
//# sourceMappingURL=ToastGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastGroup.js","sources":["../src/toast-group/ToastGroup.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport toastGroupCss from \"./ToastGroup.css\";\n\nconst withBaseName = makePrefixer(\"saltToastGroup\");\n\nexport interface ToastGroupProps extends ComponentPropsWithoutRef<\"div\"> {\n placement?: \"top-right\" | \"bottom-right\";\n}\n\nexport const ToastGroup = forwardRef<HTMLDivElement, ToastGroupProps>(\n function ToastGroup(props, ref) {\n const { children, className, placement = \"bottom-right\", ...rest } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-toast\",\n css: toastGroupCss,\n window: targetWindow,\n });\n\n return (\n <div\n className={clsx(withBaseName(), withBaseName(placement), className)}\n {...rest}\n >\n {children}\n </div>\n );\n }\n);\n"],"names":["ToastGroup","toastGroupCss"],"mappings":";;;;;;;;AAQA,MAAM,YAAA,GAAe,aAAa,gBAAgB,CAAA,CAAA;AAM3C,MAAM,UAAa,GAAA,UAAA;AAAA,EACxB,SAASA,WAAW,CAAA,KAAA,EAAO,GAAK,EAAA;AAC9B,IAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,SAAY,GAAA,cAAA,EAAA,GAAmB,MAAS,GAAA,KAAA,CAAA;AAErE,IAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,YAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,uBACG,GAAA,CAAA,KAAA,EAAA;AAAA,MACC,WAAW,IAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,SAAS,GAAG,SAAS,CAAA;AAAA,MACjE,GAAG,IAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import { HTMLAttributes,
|
|
2
|
-
/**
|
|
3
|
-
* @example overriding density prop to fit a smaller denser space otherwise handled through context provider
|
|
4
|
-
* <Badge density={'high'} />
|
|
5
|
-
*
|
|
6
|
-
* NOTE: Badge component no longer has AccessibleText prop
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
9
2
|
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
10
3
|
/**
|
|
11
|
-
* The number to display on the badge
|
|
4
|
+
* The number to display on the badge
|
|
12
5
|
*/
|
|
13
|
-
|
|
6
|
+
value: number | string;
|
|
14
7
|
/**
|
|
15
|
-
*
|
|
8
|
+
* If a child is provided the Badge will render top right. By defualt renders inline.
|
|
16
9
|
*/
|
|
17
|
-
children?:
|
|
18
|
-
/**
|
|
19
|
-
* The className(s) of the component.
|
|
20
|
-
*/
|
|
21
|
-
className?: string;
|
|
10
|
+
children?: ReactNode;
|
|
22
11
|
/**
|
|
23
12
|
* The max number to display on the badge.
|
|
24
13
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StatusIndicatorProps as BaseStatusIndicatorProps, SpinnerProps } from "@salt-ds/core";
|
|
2
2
|
import { ReactElement } from "react";
|
|
3
3
|
import { CircularProgressProps } from "../../progress";
|
|
4
|
-
export interface StatusIndicatorProps extends Pick<SpinnerProps, "disableAnnouncer">, Pick<CircularProgressProps, "
|
|
4
|
+
export interface StatusIndicatorProps extends Pick<SpinnerProps, "disableAnnouncer">, Pick<CircularProgressProps, "value"> {
|
|
5
5
|
title?: string;
|
|
6
6
|
message?: string;
|
|
7
7
|
CircularProgressProps?: Partial<CircularProgressProps>;
|
|
@@ -9,4 +9,4 @@ export interface StatusIndicatorProps extends Pick<SpinnerProps, "disableAnnounc
|
|
|
9
9
|
id?: string;
|
|
10
10
|
status?: BaseStatusIndicatorProps["status"] | "loading";
|
|
11
11
|
}
|
|
12
|
-
export declare function StatusIndicator({ status, disableAnnouncer,
|
|
12
|
+
export declare function StatusIndicator({ status, disableAnnouncer, value, title, message, CircularProgressProps: { className: circularProgressClassName, ...restCircularProgressProps }, SpinnerProps: { className: spinnerClassName, ...restSpinnerProps }, id, }: StatusIndicatorProps): ReactElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const DialogContext: import("react").Context<{
|
|
3
|
-
status?: "error" | "
|
|
3
|
+
status?: "error" | "warning" | "success" | "info" | undefined;
|
|
4
4
|
dialogId?: string | undefined;
|
|
5
5
|
setContentElement?: ((node: HTMLDivElement) => void) | undefined;
|
|
6
6
|
}>;
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
import { ScrimProps } from "../scrim";
|
|
3
2
|
export declare const DRAWER_POSITIONS: readonly ["left", "top", "right", "bottom"];
|
|
4
3
|
export declare type DrawerPositions = typeof DRAWER_POSITIONS[number];
|
|
5
4
|
export interface DrawerProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
/**
|
|
7
|
-
* Disable the scrim.
|
|
8
|
-
*/
|
|
9
|
-
disableScrim?: boolean;
|
|
10
5
|
/**
|
|
11
6
|
* Defines the drawer position within the screen.
|
|
12
7
|
*/
|
|
13
8
|
position?: DrawerPositions;
|
|
14
|
-
/**
|
|
15
|
-
* Disable all animations.
|
|
16
|
-
*/
|
|
17
|
-
disableAnimations?: boolean;
|
|
18
9
|
/**
|
|
19
10
|
* Display or hide the component.
|
|
20
11
|
*/
|
|
21
|
-
|
|
12
|
+
open?: boolean;
|
|
22
13
|
/**
|
|
23
|
-
*
|
|
14
|
+
* Callback function triggered when open state changes.
|
|
24
15
|
*/
|
|
25
|
-
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
26
17
|
/**
|
|
27
18
|
* Change background color palette
|
|
28
19
|
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UseFloatingUIProps } from "@salt-ds/core";
|
|
3
|
+
export declare type UseDrawerProps = Partial<Pick<UseFloatingUIProps, "onOpenChange" | "open">>;
|
|
4
|
+
export declare function useDrawer(props: UseDrawerProps): {
|
|
5
|
+
getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
6
|
+
getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
7
|
+
floating: (node: HTMLElement | null) => void;
|
|
8
|
+
context: {
|
|
9
|
+
x: number | null;
|
|
10
|
+
y: number | null;
|
|
11
|
+
placement: import("@floating-ui/react").Placement;
|
|
12
|
+
strategy: import("@floating-ui/react").Strategy;
|
|
13
|
+
middlewareData: import("@floating-ui/react").MiddlewareData;
|
|
14
|
+
update: () => void;
|
|
15
|
+
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
16
|
+
floating: (node: HTMLElement | null) => void;
|
|
17
|
+
isPositioned: boolean;
|
|
18
|
+
open: boolean;
|
|
19
|
+
onOpenChange: (open: boolean) => void;
|
|
20
|
+
events: import("@floating-ui/react").FloatingEvents;
|
|
21
|
+
dataRef: import("react").MutableRefObject<import("@floating-ui/react").ContextData>;
|
|
22
|
+
nodeId: string | undefined;
|
|
23
|
+
floatingId: string;
|
|
24
|
+
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
25
|
+
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
26
|
+
};
|
|
27
|
+
};
|
package/dist-types/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export * from "./combo-box";
|
|
|
13
13
|
export * from "./combo-box-deprecated";
|
|
14
14
|
export * from "./contact-details";
|
|
15
15
|
export * from "./content-status";
|
|
16
|
-
export * from "./control-label";
|
|
17
16
|
export * from "./deck-item";
|
|
18
17
|
export * from "./deck-layout";
|
|
19
18
|
export * from "./dialog";
|
|
@@ -32,7 +31,6 @@ export * from "./list-next";
|
|
|
32
31
|
export * from "./logo";
|
|
33
32
|
export * from "./menu-button";
|
|
34
33
|
export * from "./metric";
|
|
35
|
-
export * from "./multiline-input";
|
|
36
34
|
export * from "./nav-item";
|
|
37
35
|
export * from "./overlay";
|
|
38
36
|
export * from "./pagination";
|
|
@@ -53,6 +51,7 @@ export * from "./stepper-input";
|
|
|
53
51
|
export * from "./switch";
|
|
54
52
|
export * from "./tabs";
|
|
55
53
|
export * from "./tabs-next";
|
|
54
|
+
export * from "./toast-group";
|
|
56
55
|
export * from "./tokenized-input";
|
|
57
56
|
export * from "./toolbar";
|
|
58
57
|
export * from "./tree";
|
|
@@ -4,8 +4,13 @@ export interface ListItemNextProps extends HTMLAttributes<HTMLLIElement> {
|
|
|
4
4
|
* If true, the particular list item in list will be disabled.
|
|
5
5
|
*/
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* List item id.
|
|
9
|
+
*/
|
|
8
10
|
id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* List item value.
|
|
13
|
+
*/
|
|
9
14
|
value: string;
|
|
10
15
|
}
|
|
11
16
|
export declare const ListItemNext: import("react").ForwardRefExoticComponent<ListItemNextProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface ListNextProps extends
|
|
1
|
+
import { ComponentPropsWithoutRef, SyntheticEvent } from "react";
|
|
2
|
+
export interface ListNextProps extends Omit<ComponentPropsWithoutRef<"ul">, "onChange"> {
|
|
3
3
|
/**
|
|
4
4
|
* If true, all items in list will be disabled.
|
|
5
5
|
*/
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
disableFocus?: boolean;
|
|
8
|
+
highlightedItem?: string;
|
|
7
9
|
selected?: string;
|
|
10
|
+
onChange?: (event: SyntheticEvent, data: {
|
|
11
|
+
value: string;
|
|
12
|
+
}) => void;
|
|
8
13
|
defaultSelected?: string;
|
|
9
14
|
}
|
|
10
15
|
export declare const ListNext: import("react").ForwardRefExoticComponent<ListNextProps & import("react").RefAttributes<HTMLUListElement>>;
|
|
@@ -3,8 +3,10 @@ export interface ListNextContextValue {
|
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
id?: string;
|
|
5
5
|
select: (event: SyntheticEvent<HTMLLIElement>) => void;
|
|
6
|
-
isSelected: (
|
|
7
|
-
isFocused: (
|
|
6
|
+
isSelected: (value: string) => boolean;
|
|
7
|
+
isFocused: (value: string) => boolean;
|
|
8
|
+
highlight: (event: SyntheticEvent<HTMLLIElement>) => void;
|
|
9
|
+
isHighlighted: (value: string) => boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare const ListNextContext: import("react").Context<ListNextContextValue | undefined>;
|
|
10
12
|
export declare function useListItem(): ListNextContextValue | undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { KeyboardEvent, RefObject, SyntheticEvent } from "react";
|
|
1
|
+
import { FocusEvent, KeyboardEvent, RefObject, SyntheticEvent } from "react";
|
|
2
2
|
interface UseListProps {
|
|
3
3
|
/**
|
|
4
4
|
* If true, all items in list will be disabled.
|
|
5
5
|
*/
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
highlightedItem?: string;
|
|
7
8
|
selected?: string;
|
|
8
9
|
defaultSelected?: string;
|
|
9
10
|
onChange?: (e: SyntheticEvent, data: {
|
|
@@ -12,18 +13,25 @@ interface UseListProps {
|
|
|
12
13
|
id?: string;
|
|
13
14
|
ref: RefObject<HTMLUListElement>;
|
|
14
15
|
}
|
|
15
|
-
export declare const useList: ({ disabled, selected: selectedProp, defaultSelected, onChange, id, ref, }: UseListProps) => {
|
|
16
|
-
focusHandler: () => void;
|
|
17
|
-
keyDownHandler: (event: KeyboardEvent<
|
|
16
|
+
export declare const useList: ({ disabled, highlightedItem: highLightedItemProp, selected: selectedProp, defaultSelected, onChange, id, ref, }: UseListProps) => {
|
|
17
|
+
focusHandler: (event: FocusEvent<HTMLUListElement>) => void;
|
|
18
|
+
keyDownHandler: (event: KeyboardEvent<HTMLElement>) => void;
|
|
18
19
|
blurHandler: () => void;
|
|
19
|
-
|
|
20
|
+
mouseOverHandler: () => void;
|
|
20
21
|
activeDescendant: string | undefined;
|
|
22
|
+
selectedItem: string | undefined;
|
|
23
|
+
highlightedItem: string | undefined;
|
|
24
|
+
setSelectedItem: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
25
|
+
setHighlightedItem: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
21
26
|
contextValue: {
|
|
22
27
|
disabled: boolean;
|
|
23
28
|
id: string | undefined;
|
|
24
29
|
select: (event: SyntheticEvent<HTMLLIElement>) => void;
|
|
25
|
-
isSelected: (
|
|
26
|
-
isFocused: (
|
|
30
|
+
isSelected: (value: string) => boolean;
|
|
31
|
+
isFocused: (value: string) => boolean;
|
|
32
|
+
highlight: (event: SyntheticEvent<HTMLLIElement>) => void;
|
|
33
|
+
isHighlighted: (value: string) => boolean;
|
|
27
34
|
};
|
|
35
|
+
focusVisibleRef: import("react").Ref<HTMLElement>;
|
|
28
36
|
};
|
|
29
37
|
export {};
|
|
@@ -1,17 +1,45 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, MouseEventHandler } from "react";
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEventHandler, ComponentType, ReactNode } from "react";
|
|
2
|
+
import { IconProps } from "@salt-ds/icons";
|
|
2
3
|
export interface NavItemProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
4
|
/**
|
|
4
5
|
* Whether the nav item is active.
|
|
5
6
|
*/
|
|
6
7
|
active?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the nav item has active children.
|
|
10
|
+
*/
|
|
11
|
+
blurSelected?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the nav item is expanded.
|
|
14
|
+
*/
|
|
7
15
|
expanded?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Level of nesting.
|
|
18
|
+
*/
|
|
8
19
|
level?: number;
|
|
9
20
|
/**
|
|
10
21
|
* The orientation of the nav item.
|
|
11
22
|
*/
|
|
12
23
|
orientation?: "horizontal" | "vertical";
|
|
24
|
+
/**
|
|
25
|
+
* Whether the nav item is a parent with nested children.
|
|
26
|
+
*/
|
|
13
27
|
parent?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Action to be triggered when the nav item is expanded.
|
|
30
|
+
*/
|
|
14
31
|
onExpand?: MouseEventHandler<HTMLButtonElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Href to be passed to the Link element.
|
|
34
|
+
*/
|
|
15
35
|
href?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Icon component to be displayed next to the nav item label.
|
|
38
|
+
*/
|
|
39
|
+
IconComponent?: ComponentType<IconProps> | null;
|
|
40
|
+
/**
|
|
41
|
+
* Badge component to be displayed next to the nav item label.
|
|
42
|
+
*/
|
|
43
|
+
BadgeComponent?: ReactNode;
|
|
16
44
|
}
|
|
17
45
|
export declare const NavItem: import("react").ForwardRefExoticComponent<NavItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes
|
|
2
|
-
import { InfoRendererProps } from "../LinearProgress/LinearProgress";
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
3
2
|
export interface CircularProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
3
|
/**
|
|
5
4
|
* A label for accessibility
|
|
@@ -9,28 +8,15 @@ export interface CircularProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
9
8
|
* The className(s) of the component
|
|
10
9
|
*/
|
|
11
10
|
className?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Disabled flag, true when the component is disabled.
|
|
14
|
-
*/
|
|
15
|
-
disabled?: boolean;
|
|
16
11
|
/**
|
|
17
12
|
* The value of the max progress indicator.
|
|
18
13
|
* Default value is 100.
|
|
19
14
|
*/
|
|
20
15
|
max?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Render props callback to render info panel.
|
|
23
|
-
* @param function({ value, unit, getValueProps })
|
|
24
|
-
*/
|
|
25
|
-
renderInfo?: (props: Pick<InfoRendererProps<any, any>, "value" | "unit" | "getValueProps">) => ReactElement<InfoRendererProps<any, any>>;
|
|
26
16
|
/**
|
|
27
17
|
* If `true`, the info panel will be displayed.
|
|
28
18
|
*/
|
|
29
19
|
showInfo?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Default unit is`%`
|
|
32
|
-
*/
|
|
33
|
-
unit?: string;
|
|
34
20
|
/**
|
|
35
21
|
* The value of the progress indicator.
|
|
36
22
|
* Value between 0 and max.
|
|
@@ -39,11 +25,5 @@ export interface CircularProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
39
25
|
}
|
|
40
26
|
/**
|
|
41
27
|
* Circular progress bar with an optional Info element, showing the current value
|
|
42
|
-
* The default Info element can be rendered by setting `unit` and `value` props.
|
|
43
|
-
* A custom Info element can be rendered using the `renderInfo` callback.
|
|
44
|
-
* The render props callback is of the form
|
|
45
|
-
* @param {string} unit the unit of the progress info
|
|
46
|
-
* @param {number} value the value of the progress info
|
|
47
|
-
* @param {function} getValueProps function callback that returns the value props
|
|
48
28
|
*/
|
|
49
29
|
export declare const CircularProgress: import("react").ForwardRefExoticComponent<CircularProgressProps & import("react").RefAttributes<HTMLDivElement>>;
|