@alto-avios/alto-ui 2.4.0 → 3.1.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/README.md +13 -0
- package/dist/assets/AviosCurrencySymbol.css +1 -0
- package/dist/assets/Badge.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/CardSection.css +1 -1
- package/dist/assets/CreditCardNumberField.css +1 -0
- package/dist/assets/DateField.css +1 -1
- package/dist/assets/DetailsDisclosure.css +1 -0
- package/dist/assets/Dialog.css +1 -0
- package/dist/assets/Fieldset.css +1 -0
- package/dist/assets/FieldsetHeader.css +1 -0
- package/dist/assets/Form.css +1 -0
- package/dist/assets/Icon.css +1 -0
- package/dist/assets/IconBackdrop.css +1 -0
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Image.css +1 -0
- package/dist/assets/Link.css +1 -1
- package/dist/assets/NumberField.css +1 -1
- package/dist/assets/PasswordField.css +1 -0
- package/dist/assets/PhoneNumberField.css +1 -0
- package/dist/assets/Popover.css +1 -0
- package/dist/assets/Section.css +1 -1
- package/dist/assets/SelectNative.css +1 -0
- package/dist/assets/Slider.css +1 -0
- package/dist/assets/Switch.css +1 -0
- package/dist/assets/TextAreaField.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/focusStyles.css +1 -1
- package/dist/assets/foregroundColor.css +1 -0
- package/dist/assets/global.css +1 -1
- package/dist/assets/padding.css +1 -1
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.d.ts +25 -0
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js +80 -0
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js.map +1 -0
- package/dist/components/AviosCurrencySymbol/index.d.ts +1 -0
- package/dist/components/AviosCurrencySymbol/index.js +5 -0
- package/dist/components/Badge/Badge.js +11 -11
- package/dist/components/Box/Box.d.ts +21 -2
- package/dist/components/Box/Box.js +16 -4
- package/dist/components/Box/Box.js.map +1 -1
- package/dist/components/Button/Button.d.ts +128 -36
- package/dist/components/Button/Button.js +129 -66
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/CardSection/CardSection.d.ts +12 -6
- package/dist/components/CardSection/CardSection.js +9 -7
- package/dist/components/CardSection/CardSection.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +3 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/ClearFieldButton/ClearFieldButton.d.ts +4 -6
- package/dist/components/CreditCardNumberField/CreditCardNumberField.d.ts +29 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.js +45 -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 +4 -24
- package/dist/components/DateField/DateField.js +7 -19
- 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/FieldError/FieldError.d.ts +1 -1
- package/dist/components/FieldError/FieldError.js +11 -8
- package/dist/components/FieldError/FieldError.js.map +1 -1
- package/dist/components/FieldHeader/index.d.ts +1 -0
- package/dist/components/Fieldset/Fieldset.d.ts +18 -0
- package/dist/components/Fieldset/Fieldset.js +24 -0
- package/dist/components/Fieldset/Fieldset.js.map +1 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Fieldset/index.js +5 -0
- package/dist/components/Fieldset/index.js.map +1 -0
- package/dist/components/FieldsetHeader/FieldsetHeader.d.ts +7 -0
- package/dist/components/FieldsetHeader/FieldsetHeader.js +21 -0
- package/dist/components/FieldsetHeader/FieldsetHeader.js.map +1 -0
- package/dist/components/FieldsetHeader/index.d.ts +1 -0
- package/dist/components/FieldsetHeader/index.js +5 -0
- package/dist/components/FieldsetHeader/index.js.map +1 -0
- package/dist/components/Form/Form.d.ts +7 -0
- package/dist/components/Form/Form.js +17 -0
- package/dist/components/Form/Form.js.map +1 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Form/index.js +5 -0
- package/dist/components/Form/index.js.map +1 -0
- package/dist/components/Heading/Heading.d.ts +26 -7
- package/dist/components/Heading/Heading.js +12 -5
- package/dist/components/Heading/Heading.js.map +1 -1
- package/dist/components/Icon/Icon.d.ts +30 -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 +13 -4
- package/dist/components/IconButton/IconButton.js +40 -31
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Image/Image.d.ts +24 -0
- package/dist/components/Image/Image.js +135 -0
- package/dist/components/Image/Image.js.map +1 -0
- package/dist/components/Image/index.d.ts +1 -0
- package/dist/components/Image/index.js +5 -0
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Link/Link.d.ts +32 -34
- package/dist/components/Link/Link.js +34 -22
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/NumberField/NumberField.d.ts +4 -34
- package/dist/components/NumberField/NumberField.js +11 -19
- package/dist/components/NumberField/NumberField.js.map +1 -1
- 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 +91 -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 +16 -0
- package/dist/components/Popover/Popover.js +68 -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/Section/Section.d.ts +4 -3
- package/dist/components/Section/Section.js +18 -13
- package/dist/components/Section/Section.js.map +1 -1
- 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/TagGroup/TagGroup.js +1 -1
- package/dist/components/TextAreaField/TextAreaField.d.ts +1 -1
- package/dist/components/TextAreaField/TextAreaField.js +6 -18
- package/dist/components/TextAreaField/TextAreaField.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +4 -31
- package/dist/components/TextField/TextField.js +7 -17
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.js +6 -6
- package/dist/components/ToggleIconButton/ToggleIconButton.d.ts +9 -1
- package/dist/components/ToggleIconButton/ToggleIconButton.js +15 -8
- package/dist/components/ToggleIconButton/ToggleIconButton.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.js +3 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/_base/Field/Field.d.ts +16 -0
- package/dist/components/_base/Field/Field.js +29 -0
- package/dist/components/_base/Field/Field.js.map +1 -0
- package/dist/components/_base/Field/index.d.ts +2 -0
- package/dist/components/_base/Field/index.js +5 -0
- package/dist/components/_base/Field/index.js.map +1 -0
- package/dist/components/index.d.ts +15 -1
- package/dist/components/index.js +41 -14
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +41 -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 +3 -3
- package/dist/utils/flex/flex.js +49 -35
- package/dist/utils/flex/flex.js.map +1 -1
- package/dist/utils/focus/focusStyles.d.ts +1 -1
- package/dist/utils/focus/focusStyles.js +2 -2
- 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/forms/formProps.d.ts +2 -0
- package/dist/utils/forms/formProps.js +2 -0
- package/dist/utils/forms/formProps.js.map +1 -0
- package/dist/utils/padding/padding.d.ts +7 -7
- package/dist/utils/padding/padding.js +98 -98
- 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/stories/iconPropsArgTypes.js +50 -13
- package/dist/utils/stories/iconPropsArgTypes.js.map +1 -1
- package/package.json +39 -19
- package/dist/assets/NewButton.css +0 -1
- package/dist/assets/backgroundColour.css +0 -1
- package/dist/assets/fgColor.css +0 -1
- package/dist/components/NewButton/NewButton.d.ts +0 -87
- package/dist/components/NewButton/NewButton.js +0 -189
- package/dist/components/NewButton/NewButton.js.map +0 -1
- package/dist/components/NewButton/index.d.ts +0 -1
- package/dist/components/NewButton/index.js +0 -5
- 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
- /package/dist/components/{NewButton → AviosCurrencySymbol}/index.js.map +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { Field } from "../_base/Field/Field.js";
|
|
4
|
+
import { TextField, Group, Input } from "react-aria-components";
|
|
5
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
6
|
+
import { c as cva } from "../../index-Bi3v_EjJ.js";
|
|
7
|
+
import { Icon } from "../Icon/Icon.js";
|
|
8
|
+
import '../../assets/PasswordField.css';const passwordField = "_passwordField_esslh_1";
|
|
9
|
+
const passwordField__strength = "_passwordField__strength_esslh_10";
|
|
10
|
+
const passwordStrengthItem$1 = "_passwordStrengthItem_esslh_88";
|
|
11
|
+
const passwordStrengthItemValid = "_passwordStrengthItemValid_esslh_98";
|
|
12
|
+
const passwordStrengthItemNeutral = "_passwordStrengthItemNeutral_esslh_102";
|
|
13
|
+
const passwordStrengthItemInvalid = "_passwordStrengthItemInvalid_esslh_106";
|
|
14
|
+
const styles = {
|
|
15
|
+
passwordField,
|
|
16
|
+
passwordField__strength,
|
|
17
|
+
passwordStrengthItem: passwordStrengthItem$1,
|
|
18
|
+
passwordStrengthItemValid,
|
|
19
|
+
passwordStrengthItemNeutral,
|
|
20
|
+
passwordStrengthItemInvalid
|
|
21
|
+
};
|
|
22
|
+
const PasswordField = ({
|
|
23
|
+
tooltipLabelShowPassword = "Show Password",
|
|
24
|
+
tooltipLabelHidePassword = "Hide Password",
|
|
25
|
+
requirementsLabel = "Password requirements",
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const [internalVisible, setInternalVisible] = useState(props.isVisible || false);
|
|
30
|
+
const [internalValue, setInternalValue] = useState(props == null ? void 0 : props.defaultValue);
|
|
31
|
+
const value = (props == null ? void 0 : props.value) ?? internalValue;
|
|
32
|
+
const isVisibleState = (props == null ? void 0 : props.isVisible) ?? internalVisible;
|
|
33
|
+
const handleChange = React.useCallback((e) => {
|
|
34
|
+
var _a2;
|
|
35
|
+
setInternalValue(e.target.value);
|
|
36
|
+
(_a2 = props == null ? void 0 : props.onChange) == null ? void 0 : _a2.call(props, e.target.value);
|
|
37
|
+
}, [props == null ? void 0 : props.onChange]);
|
|
38
|
+
const tooltipLabel = isVisibleState ? tooltipLabelHidePassword : tooltipLabelShowPassword;
|
|
39
|
+
return /* @__PURE__ */ jsx("div", { className: styles["passwordField"], children: /* @__PURE__ */ jsxs(Field, { as: TextField, className: styles.passwordField, label: "Password", ...props, children: [
|
|
40
|
+
/* @__PURE__ */ jsxs(Group, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Input, { type: isVisibleState ? "text" : "password", value, onChange: handleChange }),
|
|
42
|
+
/* @__PURE__ */ jsx(IconButton, { size: "sm", iconProps: isVisibleState ? {
|
|
43
|
+
iconName: "eye",
|
|
44
|
+
iconPrefix: "fas"
|
|
45
|
+
} : {
|
|
46
|
+
iconName: "eye-slash",
|
|
47
|
+
iconPrefix: "fas"
|
|
48
|
+
}, onClick: () => setInternalVisible(!isVisibleState), isDisabled: props == null ? void 0 : props.isDisabled, styleVariant: "neutral", emphasis: "tertiary", "aria-label": tooltipLabel, tooltipLabel })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsx("ul", { className: styles["passwordField__strength"], "aria-label": requirementsLabel, "aria-live": "polite", children: (_a = props.strengthValidations) == null ? void 0 : _a.map((validation) => /* @__PURE__ */ jsx(PasswordStrengthItem, { status: value ? validation.validation(value) ? "valid" : "invalid" : "neutral", message: validation.message }, `${validation.message}-${value}`)) })
|
|
51
|
+
] }) });
|
|
52
|
+
};
|
|
53
|
+
const passwordStrengthItem = cva(styles.passwordStrengthItem, {
|
|
54
|
+
variants: {
|
|
55
|
+
status: {
|
|
56
|
+
valid: styles.passwordStrengthItemValid,
|
|
57
|
+
neutral: styles.passwordStrengthItemNeutral,
|
|
58
|
+
invalid: styles.passwordStrengthItemInvalid
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
status: "neutral"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
function getIcon(status) {
|
|
66
|
+
switch (status) {
|
|
67
|
+
case "invalid":
|
|
68
|
+
return {
|
|
69
|
+
iconName: "circle-xmark",
|
|
70
|
+
ariaLabel: "Requirement not met: "
|
|
71
|
+
};
|
|
72
|
+
case "valid":
|
|
73
|
+
return {
|
|
74
|
+
iconName: "circle-check",
|
|
75
|
+
ariaLabel: "Requirement met: "
|
|
76
|
+
};
|
|
77
|
+
case "neutral":
|
|
78
|
+
default:
|
|
79
|
+
return {
|
|
80
|
+
iconName: "circle-minus",
|
|
81
|
+
ariaLabel: "Requirement: "
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const PasswordStrengthItem = ({
|
|
86
|
+
status,
|
|
87
|
+
message
|
|
88
|
+
}) => {
|
|
89
|
+
const {
|
|
90
|
+
iconName,
|
|
91
|
+
ariaLabel
|
|
92
|
+
} = getIcon(status);
|
|
93
|
+
return /* @__PURE__ */ jsxs("li", { className: passwordStrengthItem({
|
|
94
|
+
status
|
|
95
|
+
}), "aria-label": `${ariaLabel}${message}`, children: [
|
|
96
|
+
/* @__PURE__ */ jsx(Icon, { iconName, iconPrefix: "fas" }),
|
|
97
|
+
/* @__PURE__ */ jsx("span", { children: message })
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
PasswordField,
|
|
102
|
+
PasswordField as default
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=PasswordField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PasswordField';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { PhoneNumberFieldOption, PhoneNumberValue } from '../../utils/phoneNumber/phoneNumber';
|
|
2
|
+
import { FieldProps } from '../_base/Field';
|
|
3
|
+
export interface PhoneNumberFieldProps extends FieldProps {
|
|
4
|
+
/**
|
|
5
|
+
* Country code of the default phone number
|
|
6
|
+
*/
|
|
7
|
+
defaultCountry?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to show the country select
|
|
10
|
+
*/
|
|
11
|
+
hasCountrySelect?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Limit selectable country codes
|
|
14
|
+
*/
|
|
15
|
+
countryCodes?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Phone number options
|
|
18
|
+
* When undefined will use default options (all)
|
|
19
|
+
*/
|
|
20
|
+
options?: PhoneNumberFieldOption[];
|
|
21
|
+
/**
|
|
22
|
+
* Handle phone number change
|
|
23
|
+
* Returns raw phone number without formatting
|
|
24
|
+
*/
|
|
25
|
+
onChange?: (value: PhoneNumberValue) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Controlled country code
|
|
28
|
+
*/
|
|
29
|
+
countryCode?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Controlled input value
|
|
32
|
+
*/
|
|
33
|
+
value?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Wether to format the phone number according to country pattern
|
|
36
|
+
*/
|
|
37
|
+
isFormatted?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Optional ID for the select element. If not provided, one will be generated.
|
|
40
|
+
*/
|
|
41
|
+
id?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The label for the country select
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
countrySelectLabel?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The placeholder for the phone number input
|
|
49
|
+
*/
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const PhoneNumberField: ({ defaultCountry, hasCountrySelect, options, onChange, countryCode: countryCodeControlled, value: valueControlled, countryCodes, isFormatted, id: providedId, countrySelectLabel, ...props }: PhoneNumberFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export default PhoneNumberField;
|
|
@@ -0,0 +1,91 @@
|
|
|
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_1owea_1";
|
|
8
|
+
const selectHandlerValue = "_selectHandlerValue_1owea_35";
|
|
9
|
+
const selectHandlerIcon = "_selectHandlerIcon_1owea_66";
|
|
10
|
+
const selectWrapper = "_selectWrapper_1owea_78";
|
|
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
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
const inputRef = useRef(null);
|
|
31
|
+
const [countryCode, setCountryCode] = useState(defaultCountry);
|
|
32
|
+
const countryCodeDefinitive = countryCodeControlled ?? countryCode;
|
|
33
|
+
const [value, setValue] = useState("");
|
|
34
|
+
const valueDefinitive = valueControlled ?? value;
|
|
35
|
+
const phoneInfo = options == null ? void 0 : options.find((p) => p.countryCode === countryCodeDefinitive);
|
|
36
|
+
const uniqueId = useId();
|
|
37
|
+
const id = providedId || uniqueId;
|
|
38
|
+
const pattern = hasCountrySelect ? ((phoneInfo == null ? void 0 : phoneInfo.pattern) ?? DEFAULT_PATTERN) + "#" : DEFAULT_PATTERN;
|
|
39
|
+
const [ignorePattern, setIgnorePattern] = useState(false);
|
|
40
|
+
const {
|
|
41
|
+
format,
|
|
42
|
+
...inputProps
|
|
43
|
+
} = usePatternFormat({
|
|
44
|
+
allowEmptyFormatting: true,
|
|
45
|
+
format: ignorePattern || !isFormatted ? DEFAULT_PATTERN : pattern
|
|
46
|
+
});
|
|
47
|
+
const handleFormat = (val) => {
|
|
48
|
+
const formatted = typeof format === "function" ? format(val) : format;
|
|
49
|
+
const formattedOutput = formatted == null ? void 0 : formatted.trim();
|
|
50
|
+
if (formattedOutput && formattedOutput.length > 0 && formattedOutput.length === pattern.length) {
|
|
51
|
+
setIgnorePattern(true);
|
|
52
|
+
}
|
|
53
|
+
return formatted ?? val;
|
|
54
|
+
};
|
|
55
|
+
const handleInputChange = (inputValue) => {
|
|
56
|
+
if (inputValue === valueDefinitive) return;
|
|
57
|
+
onChange == null ? void 0 : onChange(getPhoneNumberValue({
|
|
58
|
+
value: inputValue,
|
|
59
|
+
countryCode: countryCodeDefinitive,
|
|
60
|
+
options
|
|
61
|
+
}));
|
|
62
|
+
setValue(inputValue);
|
|
63
|
+
};
|
|
64
|
+
const handleSelectCountry = (countryCodeValue) => {
|
|
65
|
+
var _a;
|
|
66
|
+
setCountryCode(countryCodeValue);
|
|
67
|
+
onChange == null ? void 0 : onChange(getPhoneNumberValue({
|
|
68
|
+
value: valueDefinitive,
|
|
69
|
+
countryCode: countryCodeValue,
|
|
70
|
+
options
|
|
71
|
+
}));
|
|
72
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
73
|
+
};
|
|
74
|
+
const countryOptions = getCountryOptions(options, countryCodes);
|
|
75
|
+
const defaultValue = countryOptions.find((opt) => opt.value === defaultCountry);
|
|
76
|
+
return /* @__PURE__ */ jsx(Field, { as: TextField, ...props, children: /* @__PURE__ */ jsxs("div", { className: styles.phoneNumberField, children: [
|
|
77
|
+
/* @__PURE__ */ jsx(NumberFormatBase, { type: "tel", format: handleFormat, autoComplete: "tel", customInput: Input, getInputRef: inputRef, "aria-label": (props == null ? void 0 : props.label) || "Phone number", ...inputProps, onValueChange: (e) => handleInputChange(e.value), value: valueDefinitive, placeholder: props == null ? void 0 : props.placeholder }),
|
|
78
|
+
hasCountrySelect && /* @__PURE__ */ jsxs("div", { className: styles.selectWrapper, children: [
|
|
79
|
+
/* @__PURE__ */ jsx("select", { className: styles.selectInput, defaultValue: defaultValue == null ? void 0 : defaultValue.value, value: countryCodeDefinitive, 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)) }),
|
|
80
|
+
/* @__PURE__ */ jsxs("div", { className: styles.selectHandlerValue, "aria-hidden": "true", id: `${id}-country-display`, children: [
|
|
81
|
+
getCountryFlagEmoji(countryCodeDefinitive) + " " + countryCodeDefinitive,
|
|
82
|
+
/* @__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" }) })
|
|
83
|
+
] })
|
|
84
|
+
] })
|
|
85
|
+
] }) });
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
PhoneNumberField,
|
|
89
|
+
PhoneNumberField as default
|
|
90
|
+
};
|
|
91
|
+
//# 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,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { OverlayTriggerState } from 'react-stately';
|
|
3
|
+
export interface PopoverProps {
|
|
4
|
+
/** Content to be rendered inside the popover */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** State object controlling the overlay's open/closed status */
|
|
7
|
+
state: OverlayTriggerState;
|
|
8
|
+
/** Direction of the popover arrow - affects initial placement */
|
|
9
|
+
arrowDirection?: 'top' | 'right' | 'bottom' | 'left';
|
|
10
|
+
/** Reference to the trigger element that opens the popover */
|
|
11
|
+
triggerRef: React.RefObject<HTMLButtonElement>;
|
|
12
|
+
/** Whether to show the directional arrow on the popover */
|
|
13
|
+
hasArrow?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const Popover: ({ children, state, arrowDirection, triggerRef, hasArrow, }: PopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default Popover;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { mergeProps } from "@react-aria/utils";
|
|
6
|
+
import '../../assets/Popover.css';const popoverWrapper = "_popoverWrapper_qrzbw_1";
|
|
7
|
+
const popover = "_popover_qrzbw_1";
|
|
8
|
+
const arrow = "_arrow_qrzbw_16";
|
|
9
|
+
const styles = {
|
|
10
|
+
popoverWrapper,
|
|
11
|
+
popover,
|
|
12
|
+
arrow
|
|
13
|
+
};
|
|
14
|
+
const Popover = ({
|
|
15
|
+
children,
|
|
16
|
+
state,
|
|
17
|
+
arrowDirection = "bottom",
|
|
18
|
+
triggerRef,
|
|
19
|
+
hasArrow = true
|
|
20
|
+
}) => {
|
|
21
|
+
const popoverRef = useRef(null);
|
|
22
|
+
const [optimalPlacement, setOptimalPlacement] = React.useState(arrowDirection);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const updatePlacement = () => {
|
|
25
|
+
if (!popoverRef.current || !triggerRef.current) return;
|
|
26
|
+
const popoverRect = popoverRef.current.getBoundingClientRect();
|
|
27
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
28
|
+
const viewportHeight = window.innerHeight;
|
|
29
|
+
const viewportWidth = window.innerWidth;
|
|
30
|
+
let newPlacement = arrowDirection;
|
|
31
|
+
if (arrowDirection === "bottom" && triggerRect.bottom + popoverRect.height > viewportHeight) {
|
|
32
|
+
newPlacement = "top";
|
|
33
|
+
} else if (arrowDirection === "top" && triggerRect.top - popoverRect.height < 0) {
|
|
34
|
+
newPlacement = "bottom";
|
|
35
|
+
}
|
|
36
|
+
if (arrowDirection === "right" && triggerRect.right + popoverRect.width > viewportWidth) {
|
|
37
|
+
newPlacement = "left";
|
|
38
|
+
} else if (arrowDirection === "left" && triggerRect.left - popoverRect.width < 0) {
|
|
39
|
+
newPlacement = "right";
|
|
40
|
+
}
|
|
41
|
+
setOptimalPlacement(newPlacement);
|
|
42
|
+
};
|
|
43
|
+
updatePlacement();
|
|
44
|
+
window.addEventListener("resize", updatePlacement);
|
|
45
|
+
return () => window.removeEventListener("resize", updatePlacement);
|
|
46
|
+
}, [arrowDirection, popoverRef.current]);
|
|
47
|
+
const {
|
|
48
|
+
popoverProps,
|
|
49
|
+
arrowProps,
|
|
50
|
+
placement
|
|
51
|
+
} = usePopover({
|
|
52
|
+
popoverRef,
|
|
53
|
+
triggerRef,
|
|
54
|
+
offset: 12,
|
|
55
|
+
placement: optimalPlacement,
|
|
56
|
+
shouldFlip: true
|
|
57
|
+
}, state);
|
|
58
|
+
return /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx("div", { className: styles.popoverWrapper, children: /* @__PURE__ */ jsx(FocusScope, { restoreFocus: true, contain: true, children: /* @__PURE__ */ jsxs("div", { ...mergeProps(popoverProps), ref: popoverRef, className: styles.popover, children: [
|
|
59
|
+
/* @__PURE__ */ jsx(DismissButton, { onDismiss: state.close }),
|
|
60
|
+
children,
|
|
61
|
+
hasArrow && /* @__PURE__ */ jsx("div", { ...arrowProps, className: styles.arrow, "data-placement": placement })
|
|
62
|
+
] }) }) }) });
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
Popover,
|
|
66
|
+
Popover as default
|
|
67
|
+
};
|
|
68
|
+
//# 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,7 +1,7 @@
|
|
|
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
|
-
type SectionPaddingValue =
|
|
4
|
+
type SectionPaddingValue = 'default' | PaddingVariants['paddingX'];
|
|
5
5
|
type SectionPadding = {
|
|
6
6
|
paddingX?: SectionPaddingValue;
|
|
7
7
|
paddingY?: SectionPaddingValue;
|
|
@@ -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 {
|
|
@@ -21,7 +22,7 @@ interface ContainerProps {
|
|
|
21
22
|
className?: string;
|
|
22
23
|
containerMaxWidth?: 'full-width' | 'page';
|
|
23
24
|
}
|
|
24
|
-
declare const Container: ({ children, className, containerMaxWidth }: ContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare const Container: ({ children, className, containerMaxWidth, }: ContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
interface SectionComponent extends React.ForwardRefExoticComponent<SectionProps & React.RefAttributes<HTMLElement>> {
|
|
26
27
|
Container: typeof Container;
|
|
27
28
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
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
|
-
import '../../assets/Section.css';const section = "
|
|
7
|
-
const container = "
|
|
8
|
-
const pageWidth = "
|
|
9
|
-
const fullWidth = "
|
|
10
|
-
const paddingTopDefault = "
|
|
11
|
-
const paddingRightDefault = "
|
|
12
|
-
const paddingBottomDefault = "
|
|
13
|
-
const paddingLeftDefault = "
|
|
6
|
+
import '../../assets/Section.css';const section = "_section_1lo00_1";
|
|
7
|
+
const container = "_container_1lo00_8";
|
|
8
|
+
const pageWidth = "_pageWidth_1lo00_16";
|
|
9
|
+
const fullWidth = "_fullWidth_1lo00_20";
|
|
10
|
+
const paddingTopDefault = "_paddingTopDefault_1lo00_34";
|
|
11
|
+
const paddingRightDefault = "_paddingRightDefault_1lo00_38";
|
|
12
|
+
const paddingBottomDefault = "_paddingBottomDefault_1lo00_42";
|
|
13
|
+
const paddingLeftDefault = "_paddingLeftDefault_1lo00_46";
|
|
14
14
|
const styles = {
|
|
15
15
|
section,
|
|
16
16
|
container,
|
|
17
17
|
pageWidth,
|
|
18
18
|
fullWidth,
|
|
19
|
-
"paddingX-default": "_paddingX-
|
|
20
|
-
"paddingY-default": "_paddingY-
|
|
19
|
+
"paddingX-default": "_paddingX-default_1lo00_24",
|
|
20
|
+
"paddingY-default": "_paddingY-default_1lo00_29",
|
|
21
21
|
paddingTopDefault,
|
|
22
22
|
paddingRightDefault,
|
|
23
23
|
paddingBottomDefault,
|
|
@@ -54,15 +54,20 @@ const Section = forwardRef(({
|
|
|
54
54
|
children,
|
|
55
55
|
containerMaxWidth = "page",
|
|
56
56
|
backgroundColour,
|
|
57
|
+
backgroundColor,
|
|
57
58
|
paddingTop,
|
|
58
59
|
paddingBottom,
|
|
59
60
|
paddingLeft,
|
|
60
61
|
paddingRight,
|
|
61
|
-
paddingX
|
|
62
|
+
paddingX,
|
|
62
63
|
paddingY = "default",
|
|
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,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;
|