@algolia/satellite 1.10.2 → 1.11.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/cjs/Actions/Accordion/Accordion.d.ts +27 -18
- package/dist/cjs/Actions/Button/Button.tailwind.js +27 -42
- package/dist/cjs/Actions/Button/PolymorphicIconButton.d.ts +34 -5
- package/dist/cjs/Actions/Button/types.d.ts +30 -9
- package/dist/cjs/Actions/Button/types.js +2 -0
- package/dist/cjs/Actions/ButtonGroup/ButtonGroup.d.ts +6 -1
- package/dist/cjs/Actions/Switch/Switch.d.ts +21 -1
- package/dist/cjs/Actions/Switch/SwitchOption.d.ts +9 -0
- package/dist/cjs/Actions/Switch/types.d.ts +2 -1
- package/dist/cjs/Actions/Switch/types.js +3 -1
- package/dist/cjs/Actions/ToggleButton/ToggleButton.d.ts +9 -0
- package/dist/cjs/Actions/ToggleButton/ToggleButtonBase.d.ts +33 -2
- package/dist/cjs/Actions/ToggleButton/ToggleButtonBase.js +1 -1
- package/dist/cjs/Actions/ToggleGroup/ToggleGroup.d.ts +18 -6
- package/dist/cjs/Avatars/ApplicationAvatar/ApplicationAvatar.d.ts +10 -3
- package/dist/cjs/Avatars/UserAvatar/UserAvatar.d.ts +13 -5
- package/dist/cjs/Avatars/types.d.ts +23 -1
- package/dist/cjs/Avatars/types.js +3 -1
- package/dist/cjs/Fields/AutoComplete/components/AutoCompleteEmptyState.d.ts +6 -2
- package/dist/cjs/Fields/AutoComplete/types.d.ts +144 -5
- package/dist/cjs/Fields/Checkbox/Checkbox.d.ts +5 -2
- package/dist/cjs/Fields/DateInput/DateInput.d.ts +47 -0
- package/dist/cjs/Fields/DateInput/DateInput.js +169 -0
- package/dist/cjs/Fields/DateInput/index.d.ts +1 -0
- package/dist/cjs/Fields/DateInput/index.js +16 -0
- package/dist/cjs/Fields/DatePicker/DatePicker/DatePicker.d.ts +42 -0
- package/dist/cjs/Fields/DatePicker/DatePicker/DatePicker.js +1 -0
- package/dist/cjs/Fields/DatePicker/DateRangePicker/DateRangePicker.d.ts +36 -0
- package/dist/cjs/Fields/DatePicker/DateRangePicker/DateRangePicker.js +1 -0
- package/dist/cjs/Fields/DatePicker/components/Popover.d.ts +1 -0
- package/dist/cjs/Fields/DatePicker/components/Popover.js +5 -1
- package/dist/cjs/Fields/DatePicker/types.d.ts +21 -0
- package/dist/cjs/Fields/Dropzone/Dropzone.d.ts +85 -6
- package/dist/cjs/Fields/Field/Field.d.ts +32 -9
- package/dist/cjs/Fields/Form/stories/Complex.js +22 -12
- package/dist/cjs/Fields/Input/Input.d.ts +18 -1
- package/dist/cjs/Fields/Input/Input.js +5 -3
- package/dist/cjs/Fields/RadioGroup/RadioButton.d.ts +68 -2
- package/dist/cjs/Fields/RadioGroup/RadioGroup.d.ts +27 -10
- package/dist/cjs/Fields/RadioGroup/RadioGroup.js +20 -77
- package/dist/cjs/Fields/RadioGroup/RadioGroupItem.d.ts +20 -0
- package/dist/cjs/Fields/RadioGroup/RadioGroupItem.js +71 -0
- package/dist/cjs/Fields/RadioGroup/index.d.ts +1 -0
- package/dist/cjs/Fields/RadioGroup/index.js +11 -0
- package/dist/cjs/Fields/RangeSlider/RangeSlider.d.ts +48 -3
- package/dist/cjs/Fields/Select/Select.d.ts +3 -0
- package/dist/cjs/Fields/TextArea/TextArea.d.ts +16 -0
- package/dist/cjs/Fields/Toggle/Toggle.d.ts +51 -3
- package/dist/cjs/Fields/index.d.ts +1 -0
- package/dist/cjs/Fields/index.js +11 -0
- package/dist/cjs/Helpers/ClickAwayContainer/ClickAwayContainer.d.ts +6 -4
- package/dist/cjs/Helpers/HelpUnderline/HelpUnderline.d.ts +9 -1
- package/dist/cjs/Helpers/Medallion/Medallion.d.ts +14 -1
- package/dist/cjs/Helpers/Medallion/Medallion.js +11 -10
- package/dist/cjs/Helpers/Medallion/Medallion.tailwind.js +1 -1
- package/dist/cjs/Helpers/Medallion/types.d.ts +1 -1
- package/dist/cjs/Helpers/Separator/Separator.d.ts +10 -0
- package/dist/cjs/Helpers/TextWrap/TextWrap.d.ts +8 -2
- package/dist/cjs/Helpers/TextWrap/TextWrap.js +1 -1
- package/dist/cjs/Helpers/UserContent/UserContent.d.ts +10 -1
- package/dist/cjs/Icons/index.d.ts +1 -1
- package/dist/cjs/Icons/index.js +6 -0
- package/dist/cjs/Indicators/Badge/Badge.d.ts +6 -2
- package/dist/cjs/Indicators/Tag/Tag.tailwind.js +13 -4
- package/dist/cjs/Navigation/Stepper/Step.js +28 -25
- package/dist/cjs/Overlay/MenuButton/components/CustomTrigger.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/CustomTrigger.js +12 -4
- package/dist/cjs/Overlay/Tooltip/types.d.ts +3 -0
- package/dist/cjs/Satellite/locale.d.ts +2 -1
- package/dist/esm/Actions/Accordion/Accordion.d.ts +27 -18
- package/dist/esm/Actions/Button/Button.tailwind.js +27 -44
- package/dist/esm/Actions/Button/PolymorphicIconButton.d.ts +34 -5
- package/dist/esm/Actions/Button/types.d.ts +30 -9
- package/dist/esm/Actions/Button/types.js +1 -0
- package/dist/esm/Actions/ButtonGroup/ButtonGroup.d.ts +6 -1
- package/dist/esm/Actions/Switch/Switch.d.ts +21 -1
- package/dist/esm/Actions/Switch/SwitchOption.d.ts +9 -0
- package/dist/esm/Actions/Switch/types.d.ts +2 -1
- package/dist/esm/Actions/Switch/types.js +1 -1
- package/dist/esm/Actions/ToggleButton/ToggleButton.d.ts +9 -0
- package/dist/esm/Actions/ToggleButton/ToggleButtonBase.d.ts +33 -2
- package/dist/esm/Actions/ToggleButton/ToggleButtonBase.js +1 -1
- package/dist/esm/Actions/ToggleGroup/ToggleGroup.d.ts +18 -6
- package/dist/esm/Avatars/ApplicationAvatar/ApplicationAvatar.d.ts +10 -3
- package/dist/esm/Avatars/UserAvatar/UserAvatar.d.ts +13 -5
- package/dist/esm/Avatars/types.d.ts +23 -1
- package/dist/esm/Avatars/types.js +1 -1
- package/dist/esm/Fields/AutoComplete/components/AutoCompleteEmptyState.d.ts +6 -2
- package/dist/esm/Fields/AutoComplete/types.d.ts +144 -5
- package/dist/esm/Fields/Checkbox/Checkbox.d.ts +5 -2
- package/dist/esm/Fields/DateInput/DateInput.d.ts +47 -0
- package/dist/esm/Fields/DateInput/DateInput.js +162 -0
- package/dist/esm/Fields/DateInput/index.d.ts +1 -0
- package/dist/esm/Fields/DateInput/index.js +1 -0
- package/dist/esm/Fields/DatePicker/DatePicker/DatePicker.d.ts +42 -0
- package/dist/esm/Fields/DatePicker/DatePicker/DatePicker.js +1 -0
- package/dist/esm/Fields/DatePicker/DateRangePicker/DateRangePicker.d.ts +36 -0
- package/dist/esm/Fields/DatePicker/DateRangePicker/DateRangePicker.js +1 -0
- package/dist/esm/Fields/DatePicker/components/Popover.d.ts +1 -0
- package/dist/esm/Fields/DatePicker/components/Popover.js +5 -1
- package/dist/esm/Fields/DatePicker/types.d.ts +21 -0
- package/dist/esm/Fields/Dropzone/Dropzone.d.ts +85 -6
- package/dist/esm/Fields/Field/Field.d.ts +32 -9
- package/dist/esm/Fields/Form/stories/Complex.js +23 -13
- package/dist/esm/Fields/Input/Input.d.ts +18 -1
- package/dist/esm/Fields/Input/Input.js +5 -3
- package/dist/esm/Fields/RadioGroup/RadioButton.d.ts +68 -2
- package/dist/esm/Fields/RadioGroup/RadioGroup.d.ts +27 -10
- package/dist/esm/Fields/RadioGroup/RadioGroup.js +20 -77
- package/dist/esm/Fields/RadioGroup/RadioGroupItem.d.ts +20 -0
- package/dist/esm/Fields/RadioGroup/RadioGroupItem.js +64 -0
- package/dist/esm/Fields/RadioGroup/index.d.ts +1 -0
- package/dist/esm/Fields/RadioGroup/index.js +2 -1
- package/dist/esm/Fields/RangeSlider/RangeSlider.d.ts +48 -3
- package/dist/esm/Fields/Select/Select.d.ts +3 -0
- package/dist/esm/Fields/TextArea/TextArea.d.ts +16 -0
- package/dist/esm/Fields/Toggle/Toggle.d.ts +51 -3
- package/dist/esm/Fields/index.d.ts +1 -0
- package/dist/esm/Fields/index.js +1 -0
- package/dist/esm/Helpers/ClickAwayContainer/ClickAwayContainer.d.ts +6 -4
- package/dist/esm/Helpers/HelpUnderline/HelpUnderline.d.ts +9 -1
- package/dist/esm/Helpers/Medallion/Medallion.d.ts +14 -1
- package/dist/esm/Helpers/Medallion/Medallion.js +11 -10
- package/dist/esm/Helpers/Medallion/Medallion.tailwind.js +1 -1
- package/dist/esm/Helpers/Medallion/types.d.ts +1 -1
- package/dist/esm/Helpers/Separator/Separator.d.ts +10 -0
- package/dist/esm/Helpers/TextWrap/TextWrap.d.ts +8 -2
- package/dist/esm/Helpers/TextWrap/TextWrap.js +1 -1
- package/dist/esm/Helpers/UserContent/UserContent.d.ts +10 -1
- package/dist/esm/Icons/index.d.ts +1 -1
- package/dist/esm/Icons/index.js +1 -1
- package/dist/esm/Indicators/Badge/Badge.d.ts +6 -2
- package/dist/esm/Indicators/Tag/Tag.tailwind.js +13 -4
- package/dist/esm/Navigation/Stepper/Step.js +28 -25
- package/dist/esm/Overlay/MenuButton/components/CustomTrigger.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/CustomTrigger.js +12 -4
- package/dist/esm/Overlay/Tooltip/types.d.ts +3 -0
- package/dist/esm/Satellite/locale.d.ts +2 -1
- package/dist/satellite.min.css +1 -1
- package/package.json +2 -2
@@ -1,3 +1,69 @@
|
|
1
1
|
import type { HTMLAttributes, InputHTMLAttributes } from "react";
|
2
|
-
export declare type RadioButtonProps = HTMLAttributes<HTMLInputElement> &
|
3
|
-
|
2
|
+
export declare type RadioButtonProps = HTMLAttributes<HTMLInputElement> & {
|
3
|
+
/**
|
4
|
+
* The value of the `RadioButton`.
|
5
|
+
*/
|
6
|
+
value?: InputHTMLAttributes<HTMLInputElement>["value"];
|
7
|
+
/**
|
8
|
+
* The name of the `RadioButton`.
|
9
|
+
*/
|
10
|
+
name?: InputHTMLAttributes<HTMLInputElement>["name"];
|
11
|
+
/**
|
12
|
+
* Whether the `RadioButton` is checked.
|
13
|
+
*/
|
14
|
+
checked?: InputHTMLAttributes<HTMLInputElement>["checked"];
|
15
|
+
/**
|
16
|
+
* The default checked state of the `RadioButton`.
|
17
|
+
*/
|
18
|
+
defaultChecked?: InputHTMLAttributes<HTMLInputElement>["defaultChecked"];
|
19
|
+
/**
|
20
|
+
* Event handler for when the `RadioButton`'s value changes.
|
21
|
+
*/
|
22
|
+
onChange?: InputHTMLAttributes<HTMLInputElement>["onChange"];
|
23
|
+
/**
|
24
|
+
* Whether the `RadioButton` is required.
|
25
|
+
*/
|
26
|
+
required?: InputHTMLAttributes<HTMLInputElement>["required"];
|
27
|
+
/**
|
28
|
+
* Whether the `RadioButton` should automatically receive focus when the page loads.
|
29
|
+
*/
|
30
|
+
autoFocus?: InputHTMLAttributes<HTMLInputElement>["autoFocus"];
|
31
|
+
/**
|
32
|
+
* Whether the `RadioButton` is disabled.
|
33
|
+
*/
|
34
|
+
disabled?: InputHTMLAttributes<HTMLInputElement>["disabled"];
|
35
|
+
};
|
36
|
+
export declare const RadioButton: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLInputElement> & {
|
37
|
+
/**
|
38
|
+
* The value of the `RadioButton`.
|
39
|
+
*/
|
40
|
+
value?: InputHTMLAttributes<HTMLInputElement>["value"];
|
41
|
+
/**
|
42
|
+
* The name of the `RadioButton`.
|
43
|
+
*/
|
44
|
+
name?: InputHTMLAttributes<HTMLInputElement>["name"];
|
45
|
+
/**
|
46
|
+
* Whether the `RadioButton` is checked.
|
47
|
+
*/
|
48
|
+
checked?: InputHTMLAttributes<HTMLInputElement>["checked"];
|
49
|
+
/**
|
50
|
+
* The default checked state of the `RadioButton`.
|
51
|
+
*/
|
52
|
+
defaultChecked?: InputHTMLAttributes<HTMLInputElement>["defaultChecked"];
|
53
|
+
/**
|
54
|
+
* Event handler for when the `RadioButton`'s value changes.
|
55
|
+
*/
|
56
|
+
onChange?: InputHTMLAttributes<HTMLInputElement>["onChange"];
|
57
|
+
/**
|
58
|
+
* Whether the `RadioButton` is required.
|
59
|
+
*/
|
60
|
+
required?: InputHTMLAttributes<HTMLInputElement>["required"];
|
61
|
+
/**
|
62
|
+
* Whether the `RadioButton` should automatically receive focus when the page loads.
|
63
|
+
*/
|
64
|
+
autoFocus?: InputHTMLAttributes<HTMLInputElement>["autoFocus"];
|
65
|
+
/**
|
66
|
+
* Whether the `RadioButton` is disabled.
|
67
|
+
*/
|
68
|
+
disabled?: InputHTMLAttributes<HTMLInputElement>["disabled"];
|
69
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
@@ -1,30 +1,47 @@
|
|
1
|
-
import type { ForwardRefExoticComponent, ReactNode, RefAttributes
|
1
|
+
import type { ForwardRefExoticComponent, ReactNode, RefAttributes } from "react";
|
2
|
+
import { RadioGroupItem } from "./RadioGroupItem";
|
2
3
|
export interface RadioGroupProps {
|
4
|
+
/**
|
5
|
+
* The id of the `RadioGroup`.
|
6
|
+
*/
|
3
7
|
id?: string;
|
4
|
-
/**
|
8
|
+
/**
|
9
|
+
* The class name of the `RadioGroup`.
|
10
|
+
*/
|
5
11
|
className?: string;
|
12
|
+
/**
|
13
|
+
* The name of the `RadioGroup`.
|
14
|
+
*/
|
6
15
|
name?: string;
|
16
|
+
/**
|
17
|
+
* The value of the `RadioGroup`.
|
18
|
+
*/
|
7
19
|
value: string;
|
20
|
+
/**
|
21
|
+
* Whether the `RadioGroup` is disabled.
|
22
|
+
*/
|
8
23
|
disabled?: boolean;
|
24
|
+
/**
|
25
|
+
* Whether the `RadioGroup` is required.
|
26
|
+
*/
|
9
27
|
required?: boolean;
|
10
28
|
/**
|
11
|
-
*
|
29
|
+
* The text position of the `RadioGroupItem`.
|
12
30
|
* @default left
|
13
31
|
*/
|
14
32
|
textPosition?: "left" | "right";
|
33
|
+
/**
|
34
|
+
* Event handler for when the `RadioGroup`'s value changes.
|
35
|
+
*/
|
15
36
|
onChange: (newValue: string) => void;
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
value: string;
|
20
|
-
disabled?: boolean;
|
21
|
-
required?: boolean;
|
37
|
+
/**
|
38
|
+
* The children of the `RadioGroup`.
|
39
|
+
*/
|
22
40
|
children?: ReactNode;
|
23
41
|
}
|
24
42
|
export declare type RadioGroupComponent = ForwardRefExoticComponent<RadioGroupProps & RefAttributes<HTMLFieldSetElement>> & {
|
25
43
|
Item: typeof RadioGroupItem;
|
26
44
|
};
|
27
|
-
export declare const RadioGroupItem: VFC<RadioGroupItemProps>;
|
28
45
|
/**
|
29
46
|
* The `RadioGroup` component presents mutually exclusive options, allowing users to make a single selection from a list.
|
30
47
|
*
|
@@ -1,72 +1,15 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
3
|
-
import
|
4
|
-
var _templateObject, _templateObject2, _templateObject3
|
5
|
-
var _excluded = ["value", "disabled", "required", "children"];
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
6
4
|
import cx from "clsx";
|
7
|
-
import { Children, cloneElement, forwardRef, isValidElement,
|
5
|
+
import { Children, cloneElement, forwardRef, isValidElement, useState } from "react";
|
8
6
|
import { Card } from "../../Layout";
|
9
7
|
import stl from "../../styles/helpers/satellitePrefixer";
|
10
8
|
import { uniqueId } from "../../utils/uniqueId";
|
11
9
|
import { useField } from "../Field";
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import { jsx as _jsx
|
15
|
-
export var RadioGroupItem = function RadioGroupItem(_ref) {
|
16
|
-
var value = _ref.value,
|
17
|
-
disabled = _ref.disabled,
|
18
|
-
required = _ref.required,
|
19
|
-
children = _ref.children,
|
20
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
21
|
-
var _useRadioGroupContext = useRadioGroupContext(),
|
22
|
-
id = _useRadioGroupContext.id,
|
23
|
-
name = _useRadioGroupContext.name,
|
24
|
-
contextDisabled = _useRadioGroupContext.disabled,
|
25
|
-
contextRequired = _useRadioGroupContext.required,
|
26
|
-
_onChange = _useRadioGroupContext.onChange,
|
27
|
-
contextValue = _useRadioGroupContext.value,
|
28
|
-
_useRadioGroupContext2 = _useRadioGroupContext.textPosition,
|
29
|
-
textPosition = _useRadioGroupContext2 === void 0 ? "left" : _useRadioGroupContext2,
|
30
|
-
descriptionId = _useRadioGroupContext.descriptionId,
|
31
|
-
state = _useRadioGroupContext.state,
|
32
|
-
ref = _useRadioGroupContext.ref;
|
33
|
-
var isFirstChild = props.childIndex === 0;
|
34
|
-
var isInvalid = (state === null || state === void 0 ? void 0 : state.status) === "invalid";
|
35
|
-
var checked = value === contextValue;
|
36
|
-
disabled = contextDisabled || disabled;
|
37
|
-
required = contextRequired || required;
|
38
|
-
var labelId = useMemo(
|
39
|
-
// eslint-disable-next-line @algolia/stl/prefer-stl-helper
|
40
|
-
function () {
|
41
|
-
return uniqueId("stl-radio-group-label-");
|
42
|
-
}, []);
|
43
|
-
return /*#__PURE__*/_jsxs("label", {
|
44
|
-
className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex items-center justify-between\n min-h-10 px-4 py-2\n ", "\n ", "\n ", "\n ", ""])), disabled ? "text-grey-300" : "hover:bg-grey-100", disabled ? "cursor-not-allowed" : "cursor-pointer", textPosition === "right" && "flex-row-reverse", isInvalid && "hover:bg-red-50"),
|
45
|
-
children: [/*#__PURE__*/_jsx("span", {
|
46
|
-
id: labelId,
|
47
|
-
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex-1 truncate ", ""])), textPosition === "right" ? "ml-2" : "mr-2"),
|
48
|
-
children: children
|
49
|
-
}), /*#__PURE__*/_jsx(RadioButton, {
|
50
|
-
id: checked || isFirstChild && !contextValue ? id : undefined,
|
51
|
-
className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["shrink-0 self-start mt-1"]))),
|
52
|
-
value: value,
|
53
|
-
checked: checked,
|
54
|
-
name: name,
|
55
|
-
onChange: function onChange() {
|
56
|
-
if (!disabled && !checked) {
|
57
|
-
_onChange(value);
|
58
|
-
}
|
59
|
-
},
|
60
|
-
disabled: disabled,
|
61
|
-
required: required,
|
62
|
-
"aria-invalid": isInvalid,
|
63
|
-
"aria-labelledby": labelId,
|
64
|
-
"aria-describedby": descriptionId,
|
65
|
-
ref: isFirstChild ? ref : undefined
|
66
|
-
})]
|
67
|
-
});
|
68
|
-
};
|
69
|
-
|
10
|
+
import { RadioGroupContext } from "./RadioGroupContext";
|
11
|
+
import { RadioGroupItem } from "./RadioGroupItem";
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
70
13
|
// This function is used to clone the children of the `RadioGroup` component
|
71
14
|
// and pass the `childIndex` prop to the `RadioGroupItem` children.
|
72
15
|
function applyChildIndexRecursively(children) {
|
@@ -92,17 +35,17 @@ function applyChildIndexRecursively(children) {
|
|
92
35
|
*
|
93
36
|
* See the [Radio Group documentation page](https://satellite.algolia.com/components/controls/radio-group) for more information.
|
94
37
|
*/
|
95
|
-
export var RadioGroup = /*#__PURE__*/forwardRef(function (
|
96
|
-
var id =
|
97
|
-
className =
|
98
|
-
name =
|
99
|
-
value =
|
100
|
-
disabled =
|
101
|
-
|
102
|
-
required =
|
103
|
-
textPosition =
|
104
|
-
children =
|
105
|
-
onChange =
|
38
|
+
export var RadioGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
39
|
+
var id = _ref.id,
|
40
|
+
className = _ref.className,
|
41
|
+
name = _ref.name,
|
42
|
+
value = _ref.value,
|
43
|
+
disabled = _ref.disabled,
|
44
|
+
_ref$required = _ref.required,
|
45
|
+
required = _ref$required === void 0 ? false : _ref$required,
|
46
|
+
textPosition = _ref.textPosition,
|
47
|
+
children = _ref.children,
|
48
|
+
onChange = _ref.onChange;
|
106
49
|
var _useState = useState(function () {
|
107
50
|
return uniqueId("RadioGroupName-");
|
108
51
|
}),
|
@@ -131,13 +74,13 @@ export var RadioGroup = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
131
74
|
};
|
132
75
|
return /*#__PURE__*/_jsx(Card, {
|
133
76
|
fullBleed: true,
|
134
|
-
className: cx(className, stl(
|
77
|
+
className: cx(className, stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["border ", ""])), state.status === "invalid" ? "bg-red-100 border-red-700" : "border-transparent")),
|
135
78
|
children: /*#__PURE__*/_jsx(RadioGroupContext.Provider, {
|
136
79
|
value: contextValue,
|
137
80
|
children: /*#__PURE__*/_jsx("fieldset", {
|
138
|
-
className: stl(
|
81
|
+
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["min-w-0"]))),
|
139
82
|
children: /*#__PURE__*/_jsx("div", {
|
140
|
-
className: stl(
|
83
|
+
className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex flex-col py-1"]))),
|
141
84
|
children: applyChildIndexRecursively(children)
|
142
85
|
})
|
143
86
|
})
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { ReactNode, VFC } from "react";
|
2
|
+
export interface RadioGroupItemProps {
|
3
|
+
/**
|
4
|
+
* The value of the `RadioGroupItem`.
|
5
|
+
*/
|
6
|
+
value: string;
|
7
|
+
/**
|
8
|
+
* Whether the `RadioGroupItem` is disabled.
|
9
|
+
*/
|
10
|
+
disabled?: boolean;
|
11
|
+
/**
|
12
|
+
* Whether the `RadioGroupItem` is required.
|
13
|
+
*/
|
14
|
+
required?: boolean;
|
15
|
+
/**
|
16
|
+
* The children of the `RadioGroupItem`.
|
17
|
+
*/
|
18
|
+
children?: ReactNode;
|
19
|
+
}
|
20
|
+
export declare const RadioGroupItem: VFC<RadioGroupItemProps>;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
4
|
+
var _excluded = ["value", "disabled", "required", "children"];
|
5
|
+
import { useMemo } from "react";
|
6
|
+
import stl from "../../styles/helpers/satellitePrefixer";
|
7
|
+
import { uniqueId } from "../../utils/uniqueId";
|
8
|
+
import { RadioButton } from "./RadioButton";
|
9
|
+
import { useRadioGroupContext } from "./RadioGroupContext";
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
+
export var RadioGroupItem = function RadioGroupItem(_ref) {
|
12
|
+
var value = _ref.value,
|
13
|
+
disabled = _ref.disabled,
|
14
|
+
required = _ref.required,
|
15
|
+
children = _ref.children,
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
17
|
+
var _useRadioGroupContext = useRadioGroupContext(),
|
18
|
+
id = _useRadioGroupContext.id,
|
19
|
+
name = _useRadioGroupContext.name,
|
20
|
+
contextDisabled = _useRadioGroupContext.disabled,
|
21
|
+
contextRequired = _useRadioGroupContext.required,
|
22
|
+
_onChange = _useRadioGroupContext.onChange,
|
23
|
+
contextValue = _useRadioGroupContext.value,
|
24
|
+
_useRadioGroupContext2 = _useRadioGroupContext.textPosition,
|
25
|
+
textPosition = _useRadioGroupContext2 === void 0 ? "left" : _useRadioGroupContext2,
|
26
|
+
descriptionId = _useRadioGroupContext.descriptionId,
|
27
|
+
state = _useRadioGroupContext.state,
|
28
|
+
ref = _useRadioGroupContext.ref;
|
29
|
+
var isFirstChild = props.childIndex === 0;
|
30
|
+
var isInvalid = (state === null || state === void 0 ? void 0 : state.status) === "invalid";
|
31
|
+
var checked = value === contextValue;
|
32
|
+
disabled = contextDisabled || disabled;
|
33
|
+
required = contextRequired || required;
|
34
|
+
var labelId = useMemo(
|
35
|
+
// eslint-disable-next-line @algolia/stl/prefer-stl-helper
|
36
|
+
function () {
|
37
|
+
return uniqueId("stl-radio-group-label-");
|
38
|
+
}, []);
|
39
|
+
return /*#__PURE__*/_jsxs("label", {
|
40
|
+
className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex items-center justify-between\n min-h-10 px-4 py-2\n ", "\n ", "\n ", "\n ", ""])), disabled ? "text-grey-300" : "hover:bg-grey-100", disabled ? "cursor-not-allowed" : "cursor-pointer", textPosition === "right" && "flex-row-reverse", isInvalid && "hover:bg-red-50"),
|
41
|
+
children: [/*#__PURE__*/_jsx("span", {
|
42
|
+
id: labelId,
|
43
|
+
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex-1 truncate ", ""])), textPosition === "right" ? "ml-2" : "mr-2"),
|
44
|
+
children: children
|
45
|
+
}), /*#__PURE__*/_jsx(RadioButton, {
|
46
|
+
id: checked || isFirstChild && !contextValue ? id : undefined,
|
47
|
+
className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["shrink-0 self-start mt-1"]))),
|
48
|
+
value: value,
|
49
|
+
checked: checked,
|
50
|
+
name: name,
|
51
|
+
onChange: function onChange() {
|
52
|
+
if (!disabled && !checked) {
|
53
|
+
_onChange(value);
|
54
|
+
}
|
55
|
+
},
|
56
|
+
disabled: disabled,
|
57
|
+
required: required,
|
58
|
+
"aria-invalid": isInvalid,
|
59
|
+
"aria-labelledby": labelId,
|
60
|
+
"aria-describedby": descriptionId,
|
61
|
+
ref: isFirstChild ? ref : undefined
|
62
|
+
})]
|
63
|
+
});
|
64
|
+
};
|
@@ -2,23 +2,65 @@ import type { ForwardedRef } from "react";
|
|
2
2
|
declare type RangeSliderValue = number | [number, number];
|
3
3
|
declare type WidenNumber<T> = T extends number ? number : T;
|
4
4
|
export interface RangeSliderProps<Value extends RangeSliderValue = number> {
|
5
|
+
/**
|
6
|
+
* The value of the `RangeSlider`.
|
7
|
+
*/
|
5
8
|
value?: WidenNumber<Value>;
|
9
|
+
/**
|
10
|
+
* The default value of the `RangeSlider`.
|
11
|
+
*/
|
6
12
|
defaultValue?: WidenNumber<Value>;
|
7
|
-
/**
|
13
|
+
/**
|
14
|
+
* Event handler called when the value changes.
|
15
|
+
*/
|
8
16
|
onChange?: (value: WidenNumber<Value>) => void;
|
9
|
-
/**
|
17
|
+
/**
|
18
|
+
* Event handler called when the value changes at the end of an interaction.
|
19
|
+
*/
|
10
20
|
onCommit?: (value: WidenNumber<Value>) => void;
|
21
|
+
/**
|
22
|
+
* The id of the `RangeSlider`.
|
23
|
+
*/
|
11
24
|
id?: string;
|
25
|
+
/**
|
26
|
+
* The name of the `RangeSlider`.
|
27
|
+
*/
|
12
28
|
name?: string;
|
13
|
-
/**
|
29
|
+
/**
|
30
|
+
* The class name of the `RangeSlider`.
|
31
|
+
*/
|
14
32
|
className?: string;
|
33
|
+
/**
|
34
|
+
* Whether the `RangeSlider` is disabled.
|
35
|
+
*/
|
15
36
|
disabled?: boolean;
|
37
|
+
/**
|
38
|
+
* Whether the `RangeSlider` is required.
|
39
|
+
*/
|
16
40
|
required?: boolean;
|
41
|
+
/**
|
42
|
+
* The minimum value for the range.
|
43
|
+
*/
|
17
44
|
min?: number;
|
45
|
+
/**
|
46
|
+
* The maximum value for the range.
|
47
|
+
*/
|
18
48
|
max?: number;
|
49
|
+
/**
|
50
|
+
* The stepping interval for the range.
|
51
|
+
*/
|
19
52
|
step?: number;
|
53
|
+
/**
|
54
|
+
* The minimum permitted steps between multiple thumbs.
|
55
|
+
*/
|
20
56
|
minStepsBetweenThumbs?: number;
|
57
|
+
/**
|
58
|
+
* The color of the first track of the `RangeSlider`.
|
59
|
+
*/
|
21
60
|
track1Color?: string;
|
61
|
+
/**
|
62
|
+
* The color of the second track of the `RangeSlider`.
|
63
|
+
*/
|
22
64
|
track2Color?: string;
|
23
65
|
}
|
24
66
|
declare const RangeSliderInternal: <Value extends RangeSliderValue = number>({ id, className, value, defaultValue, onChange, onCommit, disabled, required, min, max, track1Color, track2Color, ...otherProps }: RangeSliderProps<Value>, ref: ForwardedRef<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
|
@@ -28,6 +70,9 @@ declare const RangeSliderInternal: <Value extends RangeSliderValue = number>({ i
|
|
28
70
|
* See the [Range Slider documentation page](https://satellite.algolia.com/components/controls/range-slider) for more information.
|
29
71
|
*/
|
30
72
|
export declare const RangeSlider: (<Value extends RangeSliderValue>(props: RangeSliderProps<Value> & {
|
73
|
+
/**
|
74
|
+
* The ref of the `RangeSlider`.
|
75
|
+
*/
|
31
76
|
ref?: ForwardedRef<HTMLSpanElement> | undefined;
|
32
77
|
}) => ReturnType<typeof RangeSliderInternal>) & {
|
33
78
|
displayName?: string | undefined;
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import type { SelectHTMLAttributes } from "react";
|
2
2
|
export declare type SelectVariants = "small" | "medium" | "large";
|
3
3
|
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
4
|
+
/**
|
5
|
+
* The variant of the `Select`.
|
6
|
+
*/
|
4
7
|
variant?: SelectVariants;
|
5
8
|
}
|
6
9
|
/**
|
@@ -1,5 +1,21 @@
|
|
1
1
|
import type { TextareaHTMLAttributes } from "react";
|
2
2
|
export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
3
|
+
/**
|
4
|
+
* Whether the `TextArea` is required.
|
5
|
+
*/
|
6
|
+
required?: boolean;
|
7
|
+
/**
|
8
|
+
* The value of the `TextArea`.
|
9
|
+
*/
|
10
|
+
value?: string;
|
11
|
+
/**
|
12
|
+
* The placeholder of the `TextArea`.
|
13
|
+
*/
|
14
|
+
placeholder?: string;
|
15
|
+
/**
|
16
|
+
* Whether the `TextArea` is disabled.
|
17
|
+
*/
|
18
|
+
disabled?: boolean;
|
3
19
|
}
|
4
20
|
export declare type TextareaStatus = "default" | "validated" | "invalid";
|
5
21
|
/**
|
@@ -1,12 +1,60 @@
|
|
1
|
-
import type { HTMLAttributes, InputHTMLAttributes } from "react";
|
2
|
-
export declare type ToggleProps = Omit<HTMLAttributes<HTMLInputElement>, "children" | "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "
|
1
|
+
import type { ChangeEvent, HTMLAttributes, InputHTMLAttributes } from "react";
|
2
|
+
export declare type ToggleProps = Omit<HTMLAttributes<HTMLInputElement>, "children" | "onChange" | "defaultChecked"> & Pick<InputHTMLAttributes<HTMLInputElement>, "autoFocus"> & {
|
3
|
+
/**
|
4
|
+
* Whether the `Toggle` is decorative.
|
5
|
+
* Decorative toggles are not using an input element.
|
6
|
+
*/
|
3
7
|
decorative?: boolean;
|
8
|
+
/**
|
9
|
+
* The callback function that is triggered when the `Toggle` is clicked.
|
10
|
+
*/
|
11
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
12
|
+
/**
|
13
|
+
* Whether the `Toggle` is required.
|
14
|
+
*/
|
15
|
+
required?: boolean;
|
16
|
+
/**
|
17
|
+
* Whether the `Toggle` is disabled.
|
18
|
+
*/
|
19
|
+
disabled?: boolean;
|
20
|
+
/**
|
21
|
+
* Whether the `Toggle` is default checked.
|
22
|
+
*/
|
23
|
+
defaultChecked?: boolean;
|
24
|
+
/**
|
25
|
+
* Whether the `Toggle` is checked.
|
26
|
+
*/
|
27
|
+
checked?: boolean;
|
4
28
|
};
|
5
29
|
/**
|
6
30
|
* The `Toggle` component is used to view or switch between enabled or disabled states.
|
7
31
|
*
|
8
32
|
* See the [Toggle documentation page](https://satellite.algolia.com/components/controls/toggle) for more information.
|
9
33
|
*/
|
10
|
-
export declare const Toggle: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLInputElement>, "children" | "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "
|
34
|
+
export declare const Toggle: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLInputElement>, "children" | "defaultChecked" | "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "autoFocus"> & {
|
35
|
+
/**
|
36
|
+
* Whether the `Toggle` is decorative.
|
37
|
+
* Decorative toggles are not using an input element.
|
38
|
+
*/
|
11
39
|
decorative?: boolean | undefined;
|
40
|
+
/**
|
41
|
+
* The callback function that is triggered when the `Toggle` is clicked.
|
42
|
+
*/
|
43
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
44
|
+
/**
|
45
|
+
* Whether the `Toggle` is required.
|
46
|
+
*/
|
47
|
+
required?: boolean | undefined;
|
48
|
+
/**
|
49
|
+
* Whether the `Toggle` is disabled.
|
50
|
+
*/
|
51
|
+
disabled?: boolean | undefined;
|
52
|
+
/**
|
53
|
+
* Whether the `Toggle` is default checked.
|
54
|
+
*/
|
55
|
+
defaultChecked?: boolean | undefined;
|
56
|
+
/**
|
57
|
+
* Whether the `Toggle` is checked.
|
58
|
+
*/
|
59
|
+
checked?: boolean | undefined;
|
12
60
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
package/dist/esm/Fields/index.js
CHANGED
@@ -5,13 +5,15 @@ interface ClickAwayContextType {
|
|
5
5
|
}
|
6
6
|
export declare const useClickAwayContext: () => ClickAwayContextType | null;
|
7
7
|
export interface ClickAwayContainerProps {
|
8
|
-
/**
|
8
|
+
/**
|
9
|
+
* The element that should be registered in the ClickAway tree.
|
9
10
|
* To ensure proper tracking, the element should be tracked in a way that triggers a rerender (use callback refs!)
|
10
|
-
|
11
|
+
*/
|
11
12
|
element: HTMLElement | null;
|
12
|
-
/**
|
13
|
+
/**
|
14
|
+
* Will be called if a click away event (mousedown, touchstart, focusin)
|
13
15
|
* happens outside of the subtree tracked by this component instance
|
14
|
-
|
16
|
+
*/
|
15
17
|
onClickAway?(evt: Event): void;
|
16
18
|
children?: ReactNode;
|
17
19
|
}
|
@@ -2,9 +2,17 @@ import type { VFC } from "react";
|
|
2
2
|
import type { TooltipWrapperProps } from "../../Overlay";
|
3
3
|
import type { TooltipWrapperBaseProps } from "../../Overlay/Tooltip/types";
|
4
4
|
export declare type HelpUnderlineProps = {
|
5
|
-
/**
|
5
|
+
/**
|
6
|
+
* The class name of the `HelpUnderline`.
|
7
|
+
*/
|
6
8
|
className?: string;
|
9
|
+
/**
|
10
|
+
* The content of the `Tooltip`.
|
11
|
+
*/
|
7
12
|
tooltipContent: TooltipWrapperProps["content"];
|
13
|
+
/**
|
14
|
+
* The content of the `HelpUnderline`.
|
15
|
+
*/
|
8
16
|
children: string;
|
9
17
|
} & Omit<TooltipWrapperBaseProps, "children">;
|
10
18
|
/**
|
@@ -2,10 +2,23 @@ import type { VFC } from "react";
|
|
2
2
|
import type { IconComponentType } from "../../Icons";
|
3
3
|
import type { MedallionSize, MedallionVariant } from "./types";
|
4
4
|
export interface MedallionProps {
|
5
|
+
/**
|
6
|
+
* The icon of the `Medallion`.
|
7
|
+
*/
|
5
8
|
icon: IconComponentType;
|
9
|
+
/**
|
10
|
+
* The variant of the `Medallion`.
|
11
|
+
* @default accent
|
12
|
+
*/
|
6
13
|
variant?: MedallionVariant;
|
14
|
+
/**
|
15
|
+
* The size of the `Medallion`.
|
16
|
+
* @default default
|
17
|
+
*/
|
7
18
|
size?: MedallionSize;
|
8
|
-
/**
|
19
|
+
/**
|
20
|
+
* The class name of the `Medallion`.
|
21
|
+
*/
|
9
22
|
className?: string;
|
10
23
|
}
|
11
24
|
/**
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
3
3
|
import cx from "clsx";
|
4
4
|
import stl from "../../styles/helpers/satellitePrefixer";
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
6
|
var VARIANT_CLASSNAMES = {
|
7
7
|
grey: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["medallion-grey text-grey-600"]))),
|
8
|
-
pink: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["medallion-pink text-pink-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
pink: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["medallion-pink text-pink-700"]))),
|
9
|
+
purple: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["medallion-purple text-purple-600"]))),
|
10
|
+
accent: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["medallion-accent text-accent-600"]))),
|
11
|
+
blue: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["medallion-blue text-blue-600"]))),
|
12
|
+
green: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["medallion-green text-green-700"]))),
|
13
|
+
orange: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["medallion-orange text-orange-800"]))),
|
14
|
+
red: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["medallion-red text-red-600"]))),
|
14
15
|
// eslint-disable-next-line @algolia/stl/prefer-accent -- here we're definitely refering to the color itself
|
15
|
-
white: stl(
|
16
|
+
white: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["medallion-white text-nebula-500"])))
|
16
17
|
};
|
17
18
|
|
18
19
|
/**
|
@@ -29,9 +30,9 @@ export var Medallion = function Medallion(_ref) {
|
|
29
30
|
className = _ref.className;
|
30
31
|
var medallionClassName = VARIANT_CLASSNAMES[variant];
|
31
32
|
return /*#__PURE__*/_jsx("div", {
|
32
|
-
className: cx(stl(
|
33
|
+
className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["medallion inline-flex items-center justify-center rounded-full ", ""])), size === "large" && "medallion-large"), medallionClassName, className),
|
33
34
|
children: /*#__PURE__*/_jsx(Icon, {
|
34
|
-
className: stl(
|
35
|
+
className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["p-1 ", ""])), size === "large" && "w-10 h-10")
|
35
36
|
})
|
36
37
|
});
|
37
38
|
};
|