@alto-avios/alto-ui 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Accordion.css +1 -0
- package/dist/assets/AviosBadge.css +1 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/CalloutBanner.css +1 -0
- package/dist/assets/CreditCardNumberField.css +1 -0
- package/dist/assets/DetailsDisclosure.css +1 -0
- package/dist/assets/Dialog.css +1 -0
- package/dist/assets/ErrorSummary.css +1 -0
- package/dist/assets/FieldHeader.css +1 -1
- package/dist/assets/FieldLabel.css +1 -1
- package/dist/assets/FieldsetHeader.css +1 -1
- package/dist/assets/Icon.css +1 -0
- package/dist/assets/IconBackdrop.css +1 -0
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Menu.css +1 -0
- package/dist/assets/PasswordField.css +1 -0
- package/dist/assets/PhoneNumberField.css +1 -0
- package/dist/assets/Popover.css +1 -0
- package/dist/assets/SelectCard.css +1 -0
- package/dist/assets/SelectNative.css +1 -0
- package/dist/assets/Slider.css +1 -0
- package/dist/assets/Switch.css +1 -0
- package/dist/assets/Tag.css +1 -1
- package/dist/assets/ToggleButton.css +1 -1
- package/dist/assets/ToggleIconButton.css +1 -1
- package/dist/assets/backgroundColor.css +1 -0
- package/dist/assets/flex.css +1 -1
- package/dist/assets/foregroundColor.css +1 -0
- package/dist/assets/position.css +1 -0
- package/dist/components/Accordion/Accordion.d.ts +35 -0
- package/dist/components/Accordion/Accordion.js +140 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +5 -0
- package/dist/components/Accordion/index.js.map +1 -0
- package/dist/components/AviosBadge/AviosBadge.d.ts +34 -0
- package/dist/components/AviosBadge/AviosBadge.js +58 -0
- package/dist/components/AviosBadge/AviosBadge.js.map +1 -0
- package/dist/components/AviosBadge/index.d.ts +1 -0
- package/dist/components/AviosBadge/index.js +5 -0
- package/dist/components/AviosBadge/index.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +7 -2
- package/dist/components/Badge/Badge.js +2 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Box/Box.d.ts +9 -5
- package/dist/components/Box/Box.js +10 -1
- package/dist/components/Box/Box.js.map +1 -1
- package/dist/components/Button/Button.js +31 -31
- package/dist/components/CalloutBanner/CalloutBanner.d.ts +21 -0
- package/dist/components/CalloutBanner/CalloutBanner.js +96 -0
- package/dist/components/CalloutBanner/CalloutBanner.js.map +1 -0
- package/dist/components/CalloutBanner/index.d.ts +1 -0
- package/dist/components/CalloutBanner/index.js +5 -0
- package/dist/components/CalloutBanner/index.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.d.ts +29 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.js +46 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.js.map +1 -0
- package/dist/components/CreditCardNumberField/index.d.ts +1 -0
- package/dist/components/CreditCardNumberField/index.js +5 -0
- package/dist/components/CreditCardNumberField/index.js.map +1 -0
- package/dist/components/DateField/DateField.d.ts +22 -3
- package/dist/components/DateField/DateField.js +856 -2
- package/dist/components/DateField/DateField.js.map +1 -1
- package/dist/components/DetailsDisclosure/DetailsDisclosure.d.ts +33 -0
- package/dist/components/DetailsDisclosure/DetailsDisclosure.js +39 -0
- package/dist/components/DetailsDisclosure/DetailsDisclosure.js.map +1 -0
- package/dist/components/DetailsDisclosure/index.d.ts +2 -0
- package/dist/components/DetailsDisclosure/index.js +5 -0
- package/dist/components/DetailsDisclosure/index.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +46 -0
- package/dist/components/Dialog/Dialog.js +117 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/Dialog/index.js +5 -0
- package/dist/components/Dialog/index.js.map +1 -0
- package/dist/components/ErrorSummary/ErrorSummary.d.ts +7 -0
- package/dist/components/ErrorSummary/ErrorSummary.js +44 -0
- package/dist/components/ErrorSummary/ErrorSummary.js.map +1 -0
- package/dist/components/ErrorSummary/index.d.ts +1 -0
- package/dist/components/ErrorSummary/index.js +5 -0
- package/dist/components/ErrorSummary/index.js.map +1 -0
- package/dist/components/FieldError/FieldError.js +1 -1
- package/dist/components/FieldHeader/FieldHeader.js +6 -6
- package/dist/components/FieldLabel/FieldLabel.js +1 -1
- package/dist/components/FieldsetHeader/FieldsetHeader.js +3 -3
- package/dist/components/Heading/Heading.d.ts +25 -6
- package/dist/components/Heading/Heading.js +9 -4
- package/dist/components/Heading/Heading.js.map +1 -1
- package/dist/components/Icon/Icon.d.ts +31 -4
- package/dist/components/Icon/Icon.js +98 -5
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/IconBackdrop/IconBackdrop.d.ts +24 -0
- package/dist/components/IconBackdrop/IconBackdrop.js +34 -0
- package/dist/components/IconBackdrop/IconBackdrop.js.map +1 -0
- package/dist/components/IconBackdrop/index.d.ts +1 -0
- package/dist/components/IconBackdrop/index.js +5 -0
- package/dist/components/IconBackdrop/index.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/IconButton/IconButton.js +28 -28
- package/dist/components/Image/Image.d.ts +3 -2
- package/dist/components/Image/Image.js +7 -2
- package/dist/components/Image/Image.js.map +1 -1
- package/dist/components/Link/Link.d.ts +3 -3
- package/dist/components/Link/Link.js +2 -2
- package/dist/components/Menu/Menu.d.ts +75 -0
- package/dist/components/Menu/Menu.js +356 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/index.js +5 -0
- package/dist/components/Menu/index.js.map +1 -0
- package/dist/components/Paragraph/Paragraph.d.ts +9 -5
- package/dist/components/Paragraph/Paragraph.js +9 -4
- package/dist/components/Paragraph/Paragraph.js.map +1 -1
- package/dist/components/PasswordField/PasswordField.d.ts +30 -0
- package/dist/components/PasswordField/PasswordField.js +104 -0
- package/dist/components/PasswordField/PasswordField.js.map +1 -0
- package/dist/components/PasswordField/index.d.ts +1 -0
- package/dist/components/PasswordField/index.js +5 -0
- package/dist/components/PasswordField/index.js.map +1 -0
- package/dist/components/PhoneNumberField/PhoneNumberField.d.ts +53 -0
- package/dist/components/PhoneNumberField/PhoneNumberField.js +96 -0
- package/dist/components/PhoneNumberField/PhoneNumberField.js.map +1 -0
- package/dist/components/PhoneNumberField/index.d.ts +3 -0
- package/dist/components/PhoneNumberField/index.js +7 -0
- package/dist/components/PhoneNumberField/index.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +48 -0
- package/dist/components/Popover/Popover.js +65 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.js +5 -0
- package/dist/components/Popover/index.js.map +1 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Section/Section.d.ts +2 -1
- package/dist/components/Section/Section.js +7 -2
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/SelectCard/SelectCard.d.ts +51 -0
- package/dist/components/SelectCard/SelectCard.js +85 -0
- package/dist/components/SelectCard/SelectCard.js.map +1 -0
- package/dist/components/SelectCard/index.d.ts +1 -0
- package/dist/components/SelectCard/index.js +5 -0
- package/dist/components/SelectCard/index.js.map +1 -0
- package/dist/components/SelectNative/SelectNative.d.ts +56 -0
- package/dist/components/SelectNative/SelectNative.js +40 -0
- package/dist/components/SelectNative/SelectNative.js.map +1 -0
- package/dist/components/SelectNative/index.d.ts +1 -0
- package/dist/components/SelectNative/index.js +5 -0
- package/dist/components/SelectNative/index.js.map +1 -0
- package/dist/components/Slider/Slider.d.ts +33 -0
- package/dist/components/Slider/Slider.js +113 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +5 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/SubHeading/SubHeading.d.ts +26 -5
- package/dist/components/SubHeading/SubHeading.js +9 -4
- package/dist/components/SubHeading/SubHeading.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +7 -0
- package/dist/components/Switch/Switch.js +18 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.js +5 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Tag/Tag.js +4 -4
- package/dist/components/ToggleButton/ToggleButton.js +6 -6
- package/dist/components/ToggleIconButton/ToggleIconButton.js +6 -6
- package/dist/components/Tooltip/Tooltip.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.js +2 -1
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/_base/Field/Field.d.ts +2 -2
- package/dist/components/_base/Field/Field.js +2 -5
- package/dist/components/_base/Field/Field.js.map +1 -1
- package/dist/components/index.d.ts +16 -0
- package/dist/components/index.js +45 -14
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +45 -14
- package/dist/index.js.map +1 -1
- package/dist/react-number-format.es-DMLgWFZX.js +760 -0
- package/dist/react-number-format.es-DMLgWFZX.js.map +1 -0
- package/dist/utils/backgroundColor/backgroundColor.d.ts +8 -0
- package/dist/utils/backgroundColor/backgroundColor.js +102 -0
- package/dist/utils/backgroundColor/backgroundColor.js.map +1 -0
- package/dist/utils/border/border.d.ts +3 -3
- package/dist/utils/creditCard/creditCard.d.ts +7 -0
- package/dist/utils/creditCard/creditCard.js +25 -0
- package/dist/utils/creditCard/creditCard.js.map +1 -0
- package/dist/utils/flex/flex.d.ts +11 -6
- package/dist/utils/flex/flex.js +390 -46
- package/dist/utils/flex/flex.js.map +1 -1
- package/dist/utils/flex/flex.test.d.ts +1 -0
- package/dist/utils/focus/focusStyles.d.ts +1 -1
- package/dist/utils/foregroundColour/foregroundColor.d.ts +8 -0
- package/dist/utils/foregroundColour/foregroundColor.js +125 -0
- package/dist/utils/foregroundColour/foregroundColor.js.map +1 -0
- package/dist/utils/padding/padding.d.ts +7 -7
- package/dist/utils/phoneNumber/phoneNumber.d.ts +24 -0
- package/dist/utils/phoneNumber/phoneNumber.js +566 -0
- package/dist/utils/phoneNumber/phoneNumber.js.map +1 -0
- package/dist/utils/position/position.d.ts +8 -0
- package/dist/utils/position/position.js +57 -0
- package/dist/utils/position/position.js.map +1 -0
- package/dist/utils/position/position.test.d.ts +1 -0
- package/dist/utils/stories/iconPropsArgTypes.js +49 -13
- package/dist/utils/stories/iconPropsArgTypes.js.map +1 -1
- package/package.json +2 -1
- package/dist/assets/backgroundColour.css +0 -1
- package/dist/assets/fgColor.css +0 -1
- package/dist/utils/backgroundColour/backgroundColour.d.ts +0 -8
- package/dist/utils/backgroundColour/backgroundColour.js +0 -102
- package/dist/utils/backgroundColour/backgroundColour.js.map +0 -1
- package/dist/utils/fgColour/fgColor.d.ts +0 -5
- package/dist/utils/fgColour/fgColor.js +0 -84
- package/dist/utils/fgColour/fgColor.js.map +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useId } from "react";
|
|
3
|
+
import { TextField, Input } from "react-aria-components";
|
|
4
|
+
import { u as usePatternFormat, N as NumberFormatBase } from "../../react-number-format.es-DMLgWFZX.js";
|
|
5
|
+
import { DEFAULT_PATTERN, getCountryOptions, getCountryFlagEmoji, countryPhoneMap, getPhoneNumberValue } from "../../utils/phoneNumber/phoneNumber.js";
|
|
6
|
+
import { Field } from "../_base/Field/Field.js";
|
|
7
|
+
import '../../assets/PhoneNumberField.css';const phoneNumberField = "_phoneNumberField_1udln_1";
|
|
8
|
+
const selectHandlerValue = "_selectHandlerValue_1udln_34";
|
|
9
|
+
const selectHandlerIcon = "_selectHandlerIcon_1udln_65";
|
|
10
|
+
const selectWrapper = "_selectWrapper_1udln_77";
|
|
11
|
+
const styles = {
|
|
12
|
+
phoneNumberField,
|
|
13
|
+
selectHandlerValue,
|
|
14
|
+
selectHandlerIcon,
|
|
15
|
+
selectWrapper
|
|
16
|
+
};
|
|
17
|
+
const PhoneNumberField = ({
|
|
18
|
+
defaultCountry = "GB",
|
|
19
|
+
hasCountrySelect = true,
|
|
20
|
+
options = countryPhoneMap,
|
|
21
|
+
onChange,
|
|
22
|
+
countryCode: countryCodeControlled,
|
|
23
|
+
value: valueControlled,
|
|
24
|
+
countryCodes,
|
|
25
|
+
isFormatted = true,
|
|
26
|
+
id: providedId,
|
|
27
|
+
countrySelectLabel = "Select a country",
|
|
28
|
+
label = "Phone number",
|
|
29
|
+
...props
|
|
30
|
+
}) => {
|
|
31
|
+
const inputRef = useRef(null);
|
|
32
|
+
const [countryCode, setCountryCode] = useState(defaultCountry);
|
|
33
|
+
const countryCodeDefinitive = countryCodeControlled ?? countryCode;
|
|
34
|
+
const [value, setValue] = useState("");
|
|
35
|
+
const valueDefinitive = valueControlled ?? value;
|
|
36
|
+
const phoneInfo = options == null ? void 0 : options.find((p) => p.countryCode === countryCodeDefinitive);
|
|
37
|
+
const uniqueId = useId();
|
|
38
|
+
const id = providedId || uniqueId;
|
|
39
|
+
const pattern = hasCountrySelect ? ((phoneInfo == null ? void 0 : phoneInfo.pattern) ?? DEFAULT_PATTERN) + "#" : DEFAULT_PATTERN;
|
|
40
|
+
const [ignorePattern, setIgnorePattern] = useState(false);
|
|
41
|
+
const {
|
|
42
|
+
format,
|
|
43
|
+
...inputProps
|
|
44
|
+
} = usePatternFormat({
|
|
45
|
+
allowEmptyFormatting: true,
|
|
46
|
+
format: ignorePattern || !isFormatted ? DEFAULT_PATTERN : pattern
|
|
47
|
+
});
|
|
48
|
+
const handleFormat = (val) => {
|
|
49
|
+
const formatted = typeof format === "function" ? format(val) : format;
|
|
50
|
+
const formattedOutput = formatted == null ? void 0 : formatted.trim();
|
|
51
|
+
if (formattedOutput && formattedOutput.length > 0 && formattedOutput.length === pattern.length) {
|
|
52
|
+
setIgnorePattern(true);
|
|
53
|
+
}
|
|
54
|
+
return formatted ?? val;
|
|
55
|
+
};
|
|
56
|
+
const handleInputChange = (inputValue) => {
|
|
57
|
+
if (inputValue === valueDefinitive) return;
|
|
58
|
+
onChange == null ? void 0 : onChange(getPhoneNumberValue({
|
|
59
|
+
value: inputValue,
|
|
60
|
+
countryCode: countryCodeDefinitive,
|
|
61
|
+
options
|
|
62
|
+
}));
|
|
63
|
+
setValue(inputValue);
|
|
64
|
+
};
|
|
65
|
+
const handleSelectCountry = (countryCodeValue) => {
|
|
66
|
+
var _a;
|
|
67
|
+
setCountryCode(countryCodeValue);
|
|
68
|
+
onChange == null ? void 0 : onChange(getPhoneNumberValue({
|
|
69
|
+
value: valueDefinitive,
|
|
70
|
+
countryCode: countryCodeValue,
|
|
71
|
+
options
|
|
72
|
+
}));
|
|
73
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
74
|
+
};
|
|
75
|
+
const countryOptions = getCountryOptions(options, countryCodes);
|
|
76
|
+
const defaultValue = countryOptions.find((opt) => opt.value === defaultCountry);
|
|
77
|
+
return /* @__PURE__ */ jsx(Field, { as: TextField, label, labelFor: id, ...props, children: /* @__PURE__ */ jsxs("div", { className: styles.phoneNumberField, children: [
|
|
78
|
+
hasCountrySelect && /* @__PURE__ */ jsxs("div", { className: styles.selectWrapper, children: [
|
|
79
|
+
/* @__PURE__ */ jsx("select", { className: styles.selectInput, ...countryCodeControlled ? {
|
|
80
|
+
value: countryCodeDefinitive
|
|
81
|
+
} : {
|
|
82
|
+
defaultValue: defaultValue == null ? void 0 : defaultValue.value
|
|
83
|
+
}, onChange: (e) => handleSelectCountry(e.target.value), "aria-label": countrySelectLabel, id: `${id}-country-select`, disabled: props == null ? void 0 : props.isDisabled, "aria-disabled": props == null ? void 0 : props.isDisabled, children: countryOptions.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value)) }),
|
|
84
|
+
/* @__PURE__ */ jsxs("div", { className: styles.selectHandlerValue, "aria-hidden": "true", id: `${id}-country-display`, children: [
|
|
85
|
+
getCountryFlagEmoji(countryCodeDefinitive) + " " + countryCodeDefinitive,
|
|
86
|
+
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "13", height: "16", fill: "none", viewBox: "0 0 13 16", className: styles.selectHandlerIcon, "aria-hidden": "true", role: "presentation", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "m6.926 2.664 3.75 3c.305.281.375.75.117 1.055-.28.328-.75.375-1.054.117L6.457 4.21l-3.28 2.625a.747.747 0 0 1-1.056-.117.75.75 0 0 1 .118-1.055l3.75-3c.257-.21.656-.21.937 0m3.75 8.672-3.75 3a.71.71 0 0 1-.937 0l-3.75-3c-.328-.258-.399-.727-.118-1.055a.77.77 0 0 1 1.055-.117l3.281 2.625 3.282-2.625c.304-.258.797-.187 1.054.117a.77.77 0 0 1-.117 1.055" }) })
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ jsx(NumberFormatBase, { id, type: "tel", format: handleFormat, autoComplete: "tel", customInput: Input, getInputRef: inputRef, ...inputProps, onValueChange: (e) => handleInputChange(e.value), value: valueDefinitive, placeholder: props == null ? void 0 : props.placeholder })
|
|
90
|
+
] }) });
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
PhoneNumberField,
|
|
94
|
+
PhoneNumberField as default
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=PhoneNumberField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhoneNumberField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { OverlayTriggerState } from 'react-stately';
|
|
3
|
+
type PlacementType = 'top' | 'top start' | 'top end' | 'right' | 'right top' | 'right bottom' | 'bottom' | 'bottom start' | 'bottom end' | 'left' | 'left top' | 'left bottom';
|
|
4
|
+
type ArrowDirectionType = 'top' | 'right' | 'bottom' | 'left';
|
|
5
|
+
interface InternalPopoverProps {
|
|
6
|
+
/**
|
|
7
|
+
* @private Internal use only - placement of the popover
|
|
8
|
+
* This prop should only be used by internal components like Menu
|
|
9
|
+
*/
|
|
10
|
+
placement?: PlacementType;
|
|
11
|
+
/**
|
|
12
|
+
* @private Internal use only - whether the popover should flip to fit in the viewport
|
|
13
|
+
* This prop should only be used by internal components like Menu
|
|
14
|
+
*/
|
|
15
|
+
shouldFlip?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @private Internal use only - whether to allow elements outside the popover may be interacted with
|
|
18
|
+
* This prop should only be used by internal components like Menu
|
|
19
|
+
*/
|
|
20
|
+
isNonModal?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @private Internal use only - whether to allow tabbing out of the popover
|
|
23
|
+
* This prop should only be used by internal components like Menu
|
|
24
|
+
*/
|
|
25
|
+
allowTabOut?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @private Internal use only - whether to auto-focus elements within the popover
|
|
28
|
+
* This prop should only be used by internal components like Menu
|
|
29
|
+
*/
|
|
30
|
+
autoFocus?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface PopoverProps {
|
|
33
|
+
/** Content to be rendered inside the popover */
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
/** State object controlling the overlay's open/closed status */
|
|
36
|
+
state: OverlayTriggerState;
|
|
37
|
+
/** Direction of the arrow that points to the trigger element */
|
|
38
|
+
arrowDirection?: ArrowDirectionType;
|
|
39
|
+
/** Reference to the trigger element that opens the popover */
|
|
40
|
+
triggerRef: React.RefObject<HTMLButtonElement> | {
|
|
41
|
+
current: HTMLElement;
|
|
42
|
+
};
|
|
43
|
+
/** Whether to show the directional arrow on the popover */
|
|
44
|
+
hasArrow?: boolean;
|
|
45
|
+
}
|
|
46
|
+
type CombinedPopoverProps = PopoverProps & InternalPopoverProps;
|
|
47
|
+
export declare const Popover: ({ children, state, arrowDirection, triggerRef, hasArrow, placement, shouldFlip, isNonModal, allowTabOut, autoFocus, }: CombinedPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export default Popover;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useRef, useEffect } from "react";
|
|
3
|
+
import { usePopover, Overlay, DismissButton } from "@react-aria/overlays";
|
|
4
|
+
import { FocusScope } from "@react-aria/focus";
|
|
5
|
+
import '../../assets/Popover.css';const popoverWrapper = "_popoverWrapper_qrzbw_1";
|
|
6
|
+
const popover = "_popover_qrzbw_1";
|
|
7
|
+
const arrow = "_arrow_qrzbw_16";
|
|
8
|
+
const styles = {
|
|
9
|
+
popoverWrapper,
|
|
10
|
+
popover,
|
|
11
|
+
arrow
|
|
12
|
+
};
|
|
13
|
+
const arrowDirectionToPlacement = {
|
|
14
|
+
top: "top",
|
|
15
|
+
right: "right",
|
|
16
|
+
bottom: "bottom",
|
|
17
|
+
left: "left"
|
|
18
|
+
};
|
|
19
|
+
const Popover = ({
|
|
20
|
+
children,
|
|
21
|
+
state,
|
|
22
|
+
arrowDirection = "bottom",
|
|
23
|
+
triggerRef,
|
|
24
|
+
hasArrow = true,
|
|
25
|
+
placement,
|
|
26
|
+
shouldFlip = true,
|
|
27
|
+
isNonModal = false,
|
|
28
|
+
allowTabOut = false,
|
|
29
|
+
autoFocus = false
|
|
30
|
+
}) => {
|
|
31
|
+
const popoverRef = useRef(null);
|
|
32
|
+
const initialPlacement = placement || arrowDirectionToPlacement[arrowDirection];
|
|
33
|
+
const [optimalPlacement, setOptimalPlacement] = React.useState(initialPlacement);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const updatePlacement = () => {
|
|
36
|
+
if (!popoverRef.current || !triggerRef.current) return;
|
|
37
|
+
setOptimalPlacement(initialPlacement);
|
|
38
|
+
};
|
|
39
|
+
updatePlacement();
|
|
40
|
+
window.addEventListener("resize", updatePlacement);
|
|
41
|
+
return () => window.removeEventListener("resize", updatePlacement);
|
|
42
|
+
}, [initialPlacement, popoverRef.current]);
|
|
43
|
+
const {
|
|
44
|
+
popoverProps,
|
|
45
|
+
arrowProps,
|
|
46
|
+
placement: finalPlacement
|
|
47
|
+
} = usePopover({
|
|
48
|
+
popoverRef,
|
|
49
|
+
triggerRef,
|
|
50
|
+
offset: 12,
|
|
51
|
+
placement: optimalPlacement,
|
|
52
|
+
shouldFlip,
|
|
53
|
+
isNonModal
|
|
54
|
+
}, state);
|
|
55
|
+
return /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx("div", { className: styles.popoverWrapper, children: /* @__PURE__ */ jsx(FocusScope, { restoreFocus: true, contain: !allowTabOut, autoFocus, children: /* @__PURE__ */ jsxs("div", { ...popoverProps, ref: popoverRef, className: styles.popover, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(DismissButton, { onDismiss: state.close }),
|
|
57
|
+
children,
|
|
58
|
+
hasArrow && /* @__PURE__ */ jsx("div", { ...arrowProps, className: styles.arrow, "data-placement": finalPlacement })
|
|
59
|
+
] }) }) }) });
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
Popover,
|
|
63
|
+
Popover as default
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=Popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Popover';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { BackgroundVariants } from '../../utils/
|
|
2
|
+
import { BackgroundVariants } from '../../utils/backgroundColor/backgroundColor';
|
|
3
3
|
import { PaddingVariants } from '../../utils/padding/padding';
|
|
4
4
|
type SectionPaddingValue = 'default' | PaddingVariants['paddingX'];
|
|
5
5
|
type SectionPadding = {
|
|
@@ -14,6 +14,7 @@ export interface SectionProps extends BackgroundVariants, SectionPadding {
|
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
containerMaxWidth?: 'full-width' | 'page';
|
|
16
16
|
style?: React.CSSProperties;
|
|
17
|
+
backgroundColour?: BackgroundVariants['backgroundColor'];
|
|
17
18
|
className?: string;
|
|
18
19
|
}
|
|
19
20
|
interface ContainerProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { backgroundColorVariants } from "../../utils/
|
|
3
|
+
import { backgroundColorVariants } from "../../utils/backgroundColor/backgroundColor.js";
|
|
4
4
|
import { paddingVariants } from "../../utils/padding/padding.js";
|
|
5
5
|
import { c as cva } from "../../index-Bi3v_EjJ.js";
|
|
6
6
|
import '../../assets/Section.css';const section = "_section_1lo00_1";
|
|
@@ -54,6 +54,7 @@ const Section = forwardRef(({
|
|
|
54
54
|
children,
|
|
55
55
|
containerMaxWidth = "page",
|
|
56
56
|
backgroundColour,
|
|
57
|
+
backgroundColor,
|
|
57
58
|
paddingTop,
|
|
58
59
|
paddingBottom,
|
|
59
60
|
paddingLeft,
|
|
@@ -63,6 +64,10 @@ const Section = forwardRef(({
|
|
|
63
64
|
style,
|
|
64
65
|
className
|
|
65
66
|
}, ref) => {
|
|
67
|
+
if (backgroundColour && !backgroundColor) {
|
|
68
|
+
console.warn("Warning: `backgroundColour` is deprecated and will be removed in a future release. Please use `backgroundColor` instead.");
|
|
69
|
+
}
|
|
70
|
+
const resolvedBackgroundColor = backgroundColor ?? backgroundColour;
|
|
66
71
|
return /* @__PURE__ */ jsx("section", { ref, className: `
|
|
67
72
|
${styles.section}
|
|
68
73
|
${paddingVariants({
|
|
@@ -82,7 +87,7 @@ const Section = forwardRef(({
|
|
|
82
87
|
paddingY: paddingY === "default" ? "default" : void 0
|
|
83
88
|
})}
|
|
84
89
|
${backgroundColorVariants({
|
|
85
|
-
|
|
90
|
+
backgroundColor: resolvedBackgroundColor
|
|
86
91
|
})}
|
|
87
92
|
${className || ""}
|
|
88
93
|
`.trim(), style, children: React.Children.map(children, (child) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Section.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Section.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CheckboxProps } from 'react-aria-components';
|
|
3
|
+
import { RadioProps } from '../Radio';
|
|
4
|
+
type SelectCardContextType = {
|
|
5
|
+
/**
|
|
6
|
+
* The input type of the select card.
|
|
7
|
+
* @default 'checkbox'
|
|
8
|
+
*/
|
|
9
|
+
type?: 'checkbox' | 'radio';
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the title for a11y labelling.
|
|
12
|
+
* @default useId()
|
|
13
|
+
*/
|
|
14
|
+
'aria-labelledby'?: string;
|
|
15
|
+
} & (({
|
|
16
|
+
type?: 'checkbox';
|
|
17
|
+
} & Omit<CheckboxProps, 'children' | 'focusStyle'>) | ({
|
|
18
|
+
type: 'radio';
|
|
19
|
+
} & Omit<RadioProps, 'children' | 'focusStyle'>));
|
|
20
|
+
type SelectCardProps = SelectCardContextType & {
|
|
21
|
+
/**
|
|
22
|
+
* The compounds components of the SelectCard:
|
|
23
|
+
* - SelectCard.Header
|
|
24
|
+
* - SelectCard.StartSlot
|
|
25
|
+
* - SelectCard.EndSlot
|
|
26
|
+
* - SelectCard.Label
|
|
27
|
+
* - SelectCard.Body
|
|
28
|
+
* - SelectCard.Details
|
|
29
|
+
*/
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
};
|
|
32
|
+
declare const SelectCard: {
|
|
33
|
+
({ children, type, ...contextProps }: SelectCardProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
Header: ({ children }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
StartSlot: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
EndSlot: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
Label: ({ title, description }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
Body: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
Details: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
};
|
|
41
|
+
interface HeaderProps {
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
interface SlotProps {
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
}
|
|
47
|
+
interface LabelProps {
|
|
48
|
+
title: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
}
|
|
51
|
+
export default SelectCard;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { createContext, useContext } from "react";
|
|
3
|
+
import { Paragraph } from "../Paragraph/Paragraph.js";
|
|
4
|
+
import { Checkbox, Radio } from "react-aria-components";
|
|
5
|
+
import '../../assets/SelectCard.css';const checkboxSvgWrapper = "_checkboxSvgWrapper_dir9q_104";
|
|
6
|
+
const svg = "_svg_dir9q_118";
|
|
7
|
+
const styles = {
|
|
8
|
+
"select-card": "_select-card_dir9q_1",
|
|
9
|
+
"select-card__header": "_select-card__header_dir9q_30",
|
|
10
|
+
"select-card__start-slot": "_select-card__start-slot_dir9q_38",
|
|
11
|
+
"select-card__label-title": "_select-card__label-title_dir9q_43",
|
|
12
|
+
"select-card__label": "_select-card__label_dir9q_43",
|
|
13
|
+
"select-card__end-slot": "_select-card__end-slot_dir9q_67",
|
|
14
|
+
"select-card__body": "_select-card__body_dir9q_79",
|
|
15
|
+
"select-card__details": "_select-card__details_dir9q_90",
|
|
16
|
+
"select-card__checkbox": "_select-card__checkbox_dir9q_104",
|
|
17
|
+
checkboxSvgWrapper,
|
|
18
|
+
svg,
|
|
19
|
+
"select-card__radio": "_select-card__radio_dir9q_183"
|
|
20
|
+
};
|
|
21
|
+
const SelectCardContext = createContext({});
|
|
22
|
+
const SelectCard = ({
|
|
23
|
+
children,
|
|
24
|
+
type = "checkbox",
|
|
25
|
+
...contextProps
|
|
26
|
+
}) => {
|
|
27
|
+
const labelId = React.useId();
|
|
28
|
+
if (type === "checkbox") {
|
|
29
|
+
return /* @__PURE__ */ jsx(SelectCardContext.Provider, { value: {
|
|
30
|
+
type,
|
|
31
|
+
"aria-labelledby": labelId,
|
|
32
|
+
...contextProps
|
|
33
|
+
}, children: /* @__PURE__ */ jsx(Checkbox, { className: `${styles["select-card"]} ${styles["select-card__checkbox"]}`, ...contextProps, "aria-labelledby": labelId, children }) });
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(SelectCardContext.Provider, { value: {
|
|
36
|
+
"aria-labelledby": labelId,
|
|
37
|
+
...contextProps
|
|
38
|
+
}, children: /* @__PURE__ */ jsx(Radio, { className: `${styles["select-card"]} ${styles["select-card__radio"]}`, ...contextProps, "aria-labelledby": labelId, children }) });
|
|
39
|
+
};
|
|
40
|
+
const Header = ({
|
|
41
|
+
children
|
|
42
|
+
}) => {
|
|
43
|
+
const state = useContext(SelectCardContext);
|
|
44
|
+
if ((state == null ? void 0 : state.type) === "checkbox") {
|
|
45
|
+
return /* @__PURE__ */ jsxs("div", { className: styles["select-card__header"], children: [
|
|
46
|
+
/* @__PURE__ */ jsx("div", { className: `${styles.checkboxSvgWrapper}`, "data-disabled": state == null ? void 0 : state.isDisabled, children: /* @__PURE__ */ jsx("svg", { className: styles.svg, viewBox: "0 0 18 18", "aria-hidden": "true", children: (state == null ? void 0 : state.isIndeterminate) ? /* @__PURE__ */ jsx("rect", { x: 1, y: 7.5, width: 15, height: 3 }) : /* @__PURE__ */ jsx("polyline", { points: "1 9 7 14 15 4" }) }) }),
|
|
47
|
+
children
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ jsx("div", { className: styles["select-card__header"], children });
|
|
51
|
+
};
|
|
52
|
+
const StartSlot = ({
|
|
53
|
+
children
|
|
54
|
+
}) => /* @__PURE__ */ jsx("div", { className: styles["select-card__start-slot"], children });
|
|
55
|
+
const EndSlot = ({
|
|
56
|
+
children
|
|
57
|
+
}) => /* @__PURE__ */ jsx("div", { className: styles["select-card__end-slot"], children });
|
|
58
|
+
const Label = ({
|
|
59
|
+
title,
|
|
60
|
+
description
|
|
61
|
+
}) => {
|
|
62
|
+
const state = useContext(SelectCardContext);
|
|
63
|
+
return /* @__PURE__ */ jsxs("div", { className: styles["select-card__label"], children: [
|
|
64
|
+
/* @__PURE__ */ jsx("div", { className: styles["select-card__label-title"], id: state == null ? void 0 : state["aria-labelledby"], children: title }),
|
|
65
|
+
/* @__PURE__ */ jsx(Paragraph, { size: "sm", foregroundColor: (state == null ? void 0 : state.isDisabled) ? "disabledOnSubtle" : "default", children: description })
|
|
66
|
+
] });
|
|
67
|
+
};
|
|
68
|
+
const Body = ({
|
|
69
|
+
children
|
|
70
|
+
}) => /* @__PURE__ */ jsx("div", { className: styles["select-card__body"], children });
|
|
71
|
+
const Details = ({
|
|
72
|
+
children
|
|
73
|
+
}) => {
|
|
74
|
+
return /* @__PURE__ */ jsx("div", { className: styles["select-card__details"], children });
|
|
75
|
+
};
|
|
76
|
+
SelectCard.Header = Header;
|
|
77
|
+
SelectCard.StartSlot = StartSlot;
|
|
78
|
+
SelectCard.EndSlot = EndSlot;
|
|
79
|
+
SelectCard.Label = Label;
|
|
80
|
+
SelectCard.Body = Body;
|
|
81
|
+
SelectCard.Details = Details;
|
|
82
|
+
export {
|
|
83
|
+
SelectCard as default
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=SelectCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectCard.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SelectCard';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ValidationResult } from 'react-aria-components';
|
|
2
|
+
export interface SelectNativeOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SelectNativeProps {
|
|
7
|
+
/**
|
|
8
|
+
* The label for the SelectNative
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The description for the SelectNative
|
|
13
|
+
*/
|
|
14
|
+
description?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The error message for the SelectNative
|
|
17
|
+
*/
|
|
18
|
+
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
19
|
+
/**
|
|
20
|
+
* Whether the SelectNative is invalid
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
isInvalid?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the SelectNative is disabled
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
isDisabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the SelectNative is required
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
isRequired?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Placeholder text when no option is selected
|
|
36
|
+
*/
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The options for the SelectNative
|
|
40
|
+
*/
|
|
41
|
+
options: SelectNativeOption[];
|
|
42
|
+
/**
|
|
43
|
+
* The default selected value
|
|
44
|
+
*/
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The current value (for controlled components)
|
|
48
|
+
*/
|
|
49
|
+
value?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional ID for the select element. If not provided, one will be generated.
|
|
52
|
+
*/
|
|
53
|
+
id?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare const SelectNative: ({ label, description, errorMessage, isInvalid, isDisabled, isRequired, placeholder, options, defaultValue, value, id: providedId, ...props }: SelectNativeProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export default SelectNative;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextField } from "react-aria-components";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { FieldHeader } from "../FieldHeader/FieldHeader.js";
|
|
5
|
+
import '../../assets/SelectNative.css';const select = "_select_2fygw_1";
|
|
6
|
+
const selectInput = "_selectInput_2fygw_10";
|
|
7
|
+
const styles = {
|
|
8
|
+
select,
|
|
9
|
+
selectInput
|
|
10
|
+
};
|
|
11
|
+
const SelectNative = ({
|
|
12
|
+
label,
|
|
13
|
+
description,
|
|
14
|
+
errorMessage,
|
|
15
|
+
isInvalid = false,
|
|
16
|
+
isDisabled = false,
|
|
17
|
+
isRequired = false,
|
|
18
|
+
placeholder,
|
|
19
|
+
options,
|
|
20
|
+
defaultValue,
|
|
21
|
+
value,
|
|
22
|
+
id: providedId,
|
|
23
|
+
...props
|
|
24
|
+
}) => {
|
|
25
|
+
const uniqueId = useId();
|
|
26
|
+
const id = providedId || `select-${uniqueId}`;
|
|
27
|
+
const showPlaceholder = !defaultValue && !value;
|
|
28
|
+
return /* @__PURE__ */ jsxs(TextField, { className: styles.select, defaultValue, value, isDisabled, isInvalid, ...props, children: [
|
|
29
|
+
label && /* @__PURE__ */ jsx(FieldHeader, { label, description, isInvalid, isRequired, errorMessage, labelFor: id }),
|
|
30
|
+
/* @__PURE__ */ jsxs("select", { id, className: styles.selectInput, defaultValue, value, disabled: isDisabled, required: isRequired, "aria-invalid": isInvalid, children: [
|
|
31
|
+
showPlaceholder && placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: true, hidden: true, children: placeholder }),
|
|
32
|
+
options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
33
|
+
] })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
SelectNative,
|
|
38
|
+
SelectNative as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=SelectNative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectNative.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SelectNative';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type SliderMode = 'numeric' | 'currency' | 'duration' | 'time';
|
|
2
|
+
export interface CurrencyFormatOptions extends Omit<Intl.NumberFormatOptions, 'style'> {
|
|
3
|
+
currency: string;
|
|
4
|
+
locale?: string;
|
|
5
|
+
}
|
|
6
|
+
type FormatOptions = Intl.NumberFormatOptions | ((value: number, maxValue?: number) => string);
|
|
7
|
+
type BaseSliderProps = {
|
|
8
|
+
label?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
isRange?: boolean;
|
|
12
|
+
minValue?: number;
|
|
13
|
+
maxValue?: number;
|
|
14
|
+
step?: number;
|
|
15
|
+
formatOptions?: FormatOptions;
|
|
16
|
+
id?: string;
|
|
17
|
+
showTooltip?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type SingleSliderProps = BaseSliderProps & {
|
|
20
|
+
isRange?: false;
|
|
21
|
+
defaultValue?: number;
|
|
22
|
+
value?: number;
|
|
23
|
+
onChange?: (value: number) => void;
|
|
24
|
+
};
|
|
25
|
+
type RangeSliderProps = BaseSliderProps & {
|
|
26
|
+
isRange: true;
|
|
27
|
+
defaultValue?: [number, number];
|
|
28
|
+
value?: [number, number];
|
|
29
|
+
onChange?: (value: [number, number]) => void;
|
|
30
|
+
};
|
|
31
|
+
export type SliderProps = SingleSliderProps | RangeSliderProps;
|
|
32
|
+
export declare const Slider: ({ label, description, isDisabled, isRange, minValue, maxValue, step, formatOptions, defaultValue, value, id: providedId, onChange, showTooltip, }: SliderProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export default Slider;
|