@algolia/satellite 2.0.0-rc.3 → 2.0.0-rc.5
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/Fields/Field/Field.js +46 -62
- package/dist/cjs/Fields/Form/Form.d.ts +0 -3
- package/dist/cjs/Fields/Form/Form.js +2 -7
- package/dist/cjs/Fields/Form/FormContext.d.ts +0 -3
- package/dist/cjs/Fields/Form/index.d.ts +1 -1
- package/dist/cjs/Fields/Form/stories/Complex.js +4 -0
- package/dist/cjs/Icons/index.d.ts +1 -1
- package/dist/cjs/Icons/index.js +6 -0
- package/dist/cjs/Indicators/Tag/Tag.d.ts +2 -2
- package/dist/esm/Fields/Field/Field.js +46 -62
- package/dist/esm/Fields/Form/Form.d.ts +0 -3
- package/dist/esm/Fields/Form/Form.js +2 -7
- package/dist/esm/Fields/Form/FormContext.d.ts +0 -3
- package/dist/esm/Fields/Form/index.d.ts +1 -1
- package/dist/esm/Fields/Form/stories/Complex.js +4 -0
- package/dist/esm/Icons/index.d.ts +1 -1
- package/dist/esm/Icons/index.js +1 -1
- package/dist/esm/Indicators/Tag/Tag.d.ts +2 -2
- package/dist/satellite.min.css +1 -1
- package/package.json +16 -16
- package/dist/cjs/Fields/Form/stories/InlineFields.js +0 -62
- package/dist/esm/Fields/Form/stories/InlineFields.js +0 -55
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.Field = void 0;
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
11
11
|
var _react = require("react");
|
12
12
|
var _Icons = require("../../Icons");
|
@@ -16,20 +16,13 @@ var _getTextFromReactNode = require("../../utils/getTextFromReactNode");
|
|
16
16
|
var _useForm = require("../Form/useForm");
|
17
17
|
var _FieldContext = require("./FieldContext");
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
19
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10
|
20
|
-
var INLINE_LABEL_SIZE = {
|
21
|
-
small: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["grid-cols-[20%_auto]"]))),
|
22
|
-
medium: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["grid-cols-[35%_auto]"]))),
|
23
|
-
large: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["grid-cols-[50%_auto]"])))
|
24
|
-
};
|
25
|
-
|
19
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
26
20
|
/**
|
27
21
|
* The `Field` component is a helper that wraps inputs to streamline labeling, validation, integration into a form.
|
28
22
|
*
|
29
23
|
* See the [Field documentation page](https://satellite.algolia.com/components/forms/field) for more information.
|
30
24
|
*/
|
31
25
|
var Field = exports.Field = function Field(_ref) {
|
32
|
-
var _form$inline, _form$inlineLabelSize;
|
33
26
|
var className = _ref.className,
|
34
27
|
label = _ref.label,
|
35
28
|
labelForProp = _ref.labelFor,
|
@@ -37,7 +30,8 @@ var Field = exports.Field = function Field(_ref) {
|
|
37
30
|
description = _ref.description,
|
38
31
|
_ref$state = _ref.state,
|
39
32
|
state = _ref$state === void 0 ? _FieldContext.DEFAULT_FIELD_STATE : _ref$state,
|
40
|
-
|
33
|
+
_ref$inline = _ref.inline,
|
34
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
41
35
|
requiredProp = _ref.required,
|
42
36
|
_ref$hideRequiredIndi = _ref.hideRequiredIndicator,
|
43
37
|
hideRequiredIndicator = _ref$hideRequiredIndi === void 0 ? false : _ref$hideRequiredIndi,
|
@@ -67,11 +61,14 @@ var Field = exports.Field = function Field(_ref) {
|
|
67
61
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
68
62
|
elementToFocusContext = _useState4[0],
|
69
63
|
setElementToFocusContext = _useState4[1];
|
64
|
+
if (process.env.NODE_ENV !== "production") {
|
65
|
+
if (typeof requiredProp !== "undefined" && typeof requiredContext !== "undefined" && requiredProp !== requiredContext) {
|
66
|
+
console.warn("The `required` prop is set to different values on both the Field (`required=".concat(requiredProp, "`) and the underlying input component (`required=").concat(requiredContext, "`)."));
|
67
|
+
}
|
68
|
+
}
|
70
69
|
var form = (0, _useForm.useForm)();
|
71
70
|
var addField = form === null || form === void 0 ? void 0 : form.addField;
|
72
71
|
var removeField = form === null || form === void 0 ? void 0 : form.removeField;
|
73
|
-
var inline = (_form$inline = form === null || form === void 0 ? void 0 : form.inline) !== null && _form$inline !== void 0 ? _form$inline : inlineProp;
|
74
|
-
var inlineLabelSize = (_form$inlineLabelSize = form === null || form === void 0 ? void 0 : form.inlineLabelSize) !== null && _form$inlineLabelSize !== void 0 ? _form$inlineLabelSize : "medium";
|
75
72
|
(0, _react.useEffect)(function () {
|
76
73
|
addField === null || addField === void 0 || addField({
|
77
74
|
state: state,
|
@@ -86,14 +83,6 @@ var Field = exports.Field = function Field(_ref) {
|
|
86
83
|
});
|
87
84
|
};
|
88
85
|
}, [addField, removeField, state, labelFor, label]);
|
89
|
-
if (process.env.NODE_ENV !== "production") {
|
90
|
-
if (typeof requiredProp !== "undefined" && typeof requiredContext !== "undefined" && requiredProp !== requiredContext) {
|
91
|
-
console.warn("The `required` prop is set to different values on both the Field (`required=".concat(requiredProp, "`) and the underlying input component (`required=").concat(requiredContext, "`)."));
|
92
|
-
}
|
93
|
-
if ((form === null || form === void 0 ? void 0 : form.inline) === true && inlineProp === false) {
|
94
|
-
console.warn("The `Field` component is being used inside a `Form` with `inline` set to `true`, but the `Field` component has `inline` set to `false`. To fix this, remove the `inline` prop on the `Field` component.");
|
95
|
-
}
|
96
|
-
}
|
97
86
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldContext.FieldContext.Provider, {
|
98
87
|
value: {
|
99
88
|
state: state,
|
@@ -103,52 +92,47 @@ var Field = exports.Field = function Field(_ref) {
|
|
103
92
|
setRequired: setRequiredContext,
|
104
93
|
setElementToFocus: setElementToFocusContext
|
105
94
|
},
|
106
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
95
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
107
96
|
className: className,
|
108
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("
|
109
|
-
className: (0,
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
className: (0, _satellitePrefixer["default"])(
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
children: "*"
|
125
|
-
})]
|
126
|
-
})
|
97
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
98
|
+
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["cursor-pointer flex ", ""])), inline ? "items-center" : "flex-col"),
|
99
|
+
htmlFor: labelFor,
|
100
|
+
onClick: function onClick() {
|
101
|
+
if (!(elementToFocusContext !== null && elementToFocusContext !== void 0 && elementToFocusContext.closest("[aria-disabled=true]")) && !(elementToFocusContext !== null && elementToFocusContext !== void 0 && elementToFocusContext.closest("[disabled=true]"))) {
|
102
|
+
elementToFocusContext === null || elementToFocusContext === void 0 || elementToFocusContext.focus();
|
103
|
+
}
|
104
|
+
},
|
105
|
+
children: [hasLabel && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
106
|
+
id: labelId,
|
107
|
+
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["truncate ", ""])), inline ? "mr-2" : "mb-1"),
|
108
|
+
children: [label, !hideRequiredIndicator && (requiredProp || requiredContext) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
109
|
+
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["text-red-700 ml-0.5 align-top"]))),
|
110
|
+
"aria-hidden": true,
|
111
|
+
children: "*"
|
112
|
+
})]
|
127
113
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
114
|
+
className: (0, _clsx["default"])(inline && (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["ml-auto mt-1"])))),
|
128
115
|
children: children
|
129
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
130
|
-
className: (0, _clsx["default"])(inline && (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["col-start-2"])))),
|
131
|
-
children: state.status === "invalid" && state.errors.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
132
|
-
id: descriptionId,
|
133
|
-
className: (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["mt-2 display-caption flex flex-col gap-0.5"]))),
|
134
|
-
children: state.errors.map(function (error) {
|
135
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
136
|
-
className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["flex items-center text-red-700"]))),
|
137
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Icons.AlertCircleIcon, {
|
138
|
-
className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["mr-1 shrink-0"]))),
|
139
|
-
width: "1rem",
|
140
|
-
height: "1rem",
|
141
|
-
"aria-hidden": true
|
142
|
-
}), error]
|
143
|
-
}, error);
|
144
|
-
})
|
145
|
-
}) : description ? /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
146
|
-
id: descriptionId,
|
147
|
-
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["display-caption text-grey-600 ", ""])), inline ? "mt-1" : "mt-2")),
|
148
|
-
children: description
|
149
|
-
}) : null
|
150
116
|
})]
|
151
|
-
})
|
117
|
+
}), state.status === "invalid" && state.errors.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
118
|
+
id: descriptionId,
|
119
|
+
className: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["mb-1 mt-2 display-caption flex flex-col gap-0.5"]))),
|
120
|
+
children: state.errors.map(function (error) {
|
121
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
122
|
+
className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["flex items-center text-red-700"]))),
|
123
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Icons.AlertCircleIcon, {
|
124
|
+
className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["mr-1 shrink-0"]))),
|
125
|
+
width: "1rem",
|
126
|
+
height: "1rem",
|
127
|
+
"aria-hidden": true
|
128
|
+
}), error]
|
129
|
+
}, error);
|
130
|
+
})
|
131
|
+
}) : description ? /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
132
|
+
id: descriptionId,
|
133
|
+
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["display-caption text-grey-600"]))), inline ? (0, _satellitePrefixer["default"])(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["mt-1"]))) : (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["mt-2"])))),
|
134
|
+
children: description
|
135
|
+
}) : null]
|
152
136
|
})
|
153
137
|
});
|
154
138
|
};
|
@@ -2,10 +2,7 @@ import type { FC, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
2
2
|
import type { ButtonProps } from "../../Actions";
|
3
3
|
import type { AlertProps } from "../../Indicators";
|
4
4
|
import type { FormContextField } from "./FormContext";
|
5
|
-
export declare type FormInlineLabelSize = "small" | "medium" | "large";
|
6
5
|
export interface FormProps extends HTMLAttributes<HTMLFormElement> {
|
7
|
-
inline?: boolean;
|
8
|
-
inlineLabelSize?: FormInlineLabelSize;
|
9
6
|
}
|
10
7
|
export declare type FormLocale = {
|
11
8
|
errorTitle?: (invalidFields: FormContextField[], extraErrors?: string[]) => ReactNode;
|
@@ -22,7 +22,7 @@ var _FormContext = require("./FormContext");
|
|
22
22
|
var _useForm = require("./useForm");
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
24
24
|
var _excluded = ["className", "extraErrors", "locale"],
|
25
|
-
_excluded2 = ["children"
|
25
|
+
_excluded2 = ["children"],
|
26
26
|
_excluded3 = ["children"],
|
27
27
|
_excluded4 = ["children"];
|
28
28
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
@@ -103,9 +103,6 @@ var FormErrorMessage = exports.FormErrorMessage = function FormErrorMessage(_ref
|
|
103
103
|
};
|
104
104
|
var Form = exports.Form = function Form(_ref6) {
|
105
105
|
var children = _ref6.children,
|
106
|
-
inline = _ref6.inline,
|
107
|
-
_ref6$inlineLabelSize = _ref6.inlineLabelSize,
|
108
|
-
inlineLabelSize = _ref6$inlineLabelSize === void 0 ? "medium" : _ref6$inlineLabelSize,
|
109
106
|
props = (0, _objectWithoutProperties2["default"])(_ref6, _excluded2);
|
110
107
|
var _useState = (0, _react.useState)({}),
|
111
108
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
@@ -128,9 +125,7 @@ var Form = exports.Form = function Form(_ref6) {
|
|
128
125
|
value: {
|
129
126
|
fields: fields,
|
130
127
|
addField: addField,
|
131
|
-
removeField: removeField
|
132
|
-
inline: inline,
|
133
|
-
inlineLabelSize: inlineLabelSize
|
128
|
+
removeField: removeField
|
134
129
|
},
|
135
130
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("form", _objectSpread(_objectSpread({
|
136
131
|
noValidate: true
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { FieldState } from "../Field";
|
3
|
-
import type { FormInlineLabelSize } from "./Form";
|
4
3
|
export declare type FormContextField = {
|
5
4
|
state: FieldState;
|
6
5
|
label: string;
|
@@ -10,7 +9,5 @@ export declare type FormContextValue = {
|
|
10
9
|
fields: Record<string, FormContextField>;
|
11
10
|
addField: (field: FormContextField) => void;
|
12
11
|
removeField: (field: FormContextField) => void;
|
13
|
-
inline?: boolean;
|
14
|
-
inlineLabelSize?: FormInlineLabelSize;
|
15
12
|
};
|
16
13
|
export declare const FormContext: import("react").Context<FormContextValue | null>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export type { FormProps as ExperimentalFormProps, FormLocale as ExperimentalFormLocale, FormErrorMessageProps as ExperimentalFormErrorMessageProps,
|
1
|
+
export type { FormProps as ExperimentalFormProps, FormLocale as ExperimentalFormLocale, FormErrorMessageProps as ExperimentalFormErrorMessageProps, } from "./Form";
|
2
2
|
export { Form as ExperimentalForm, FormErrorMessage as ExperimentalFormErrorMessage, FormSubmit as ExperimentalFormSubmit, FormReset as ExperimentalFormReset, } from "./Form";
|
3
3
|
export type { FormContextField as ExperimentalFormContextField, FormContextValue as ExperimentalFormContextValue, } from "./FormContext";
|
4
4
|
export { useForm as useExperimentalForm } from "./useForm";
|
@@ -528,6 +528,7 @@ var RHFComplexComponent = exports.RHFComplexComponent = function RHFComplexCompo
|
|
528
528
|
description: "Please accept the terms",
|
529
529
|
state: getFieldState("acceptTerms"),
|
530
530
|
className: (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
531
|
+
inline: true,
|
531
532
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Checkbox, _objectSpread({
|
532
533
|
id: "acceptTerms",
|
533
534
|
required: true,
|
@@ -546,6 +547,7 @@ var RHFComplexComponent = exports.RHFComplexComponent = function RHFComplexCompo
|
|
546
547
|
description: "Do you want to receive our newsletter?",
|
547
548
|
state: getFieldState("newsletter"),
|
548
549
|
className: (0, _satellitePrefixer["default"])(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
550
|
+
inline: true,
|
549
551
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Switch.Switch, _objectSpread({
|
550
552
|
id: "newsletter",
|
551
553
|
required: true,
|
@@ -896,6 +898,7 @@ var FormikComplexComponent = exports.FormikComplexComponent = function FormikCom
|
|
896
898
|
description: "Please accept the terms",
|
897
899
|
state: getFieldState("acceptTerms"),
|
898
900
|
className: (0, _satellitePrefixer["default"])(_templateObject46 || (_templateObject46 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
901
|
+
inline: true,
|
899
902
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Checkbox, _objectSpread({
|
900
903
|
id: "acceptTerms",
|
901
904
|
required: true,
|
@@ -907,6 +910,7 @@ var FormikComplexComponent = exports.FormikComplexComponent = function FormikCom
|
|
907
910
|
description: "Do you want to receive our newsletter?",
|
908
911
|
state: getFieldState("newsletter"),
|
909
912
|
className: (0, _satellitePrefixer["default"])(_templateObject47 || (_templateObject47 = (0, _taggedTemplateLiteral2["default"])(["w-full"]))),
|
913
|
+
inline: true,
|
910
914
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Switch.Switch, _objectSpread({
|
911
915
|
id: "newsletter",
|
912
916
|
required: true,
|
@@ -17,4 +17,4 @@ export { QueryBreakdownIcon } from "./QueryBreakdownIcon";
|
|
17
17
|
export { BulbIcon } from "./BulbIcon";
|
18
18
|
export { TestingIcon } from "./TestingIcon";
|
19
19
|
export { RocketIcon } from "./RocketIcon";
|
20
|
-
export { ActivityIcon, AirplayIcon, AlertCircleIcon, AlertOctagonIcon, AlertTriangleIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AnchorIcon, ApertureIcon, ArchiveIcon, ArrowDownCircleIcon, ArrowDownIcon, ArrowDownLeftIcon, ArrowDownRightIcon, ArrowLeftCircleIcon, ArrowLeftIcon, ArrowRightCircleIcon, ArrowRightIcon, ArrowUpCircleIcon, ArrowUpIcon, ArrowUpLeftIcon, ArrowUpRightIcon, AtSignIcon, AwardIcon, BanIcon, BarChart2Icon, BarChartIcon, BatteryChargingIcon, BatteryIcon, BellIcon, BellOffIcon, BlocksIcon, BluetoothIcon, BoldIcon, BookIcon, BookmarkIcon, BookOpenIcon, BoxIcon, BriefcaseIcon, CalendarIcon, CameraIcon, CameraOffIcon, CastIcon, CheckCircleIcon, CheckIcon, CheckSquareIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsDownIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpIcon, ChevronUpIcon, ChromeIcon, CircleIcon, ClipboardIcon, ClockIcon, CloudDrizzleIcon, CloudIcon, CloudLightningIcon, CloudOffIcon, CloudRainIcon, CloudSnowIcon, CodeIcon, CodepenIcon, CodesandboxIcon, CoffeeIcon, ColumnsIcon, CommandIcon, CompassIcon, CopyIcon, CornerDownLeftIcon, CornerDownRightIcon, CornerLeftDownIcon, CornerLeftUpIcon, CornerRightDownIcon, CornerRightUpIcon, CornerUpLeftIcon, CornerUpRightIcon, CpuIcon, CreditCardIcon, CropIcon, CrosshairIcon, DatabaseIcon, DeleteIcon, DiscIcon, DivideCircleIcon, DivideIcon, DivideSquareIcon, DollarSignIcon, DownloadCloudIcon, DownloadIcon, DribbbleIcon, DropletIcon, Edit2Icon, Edit3Icon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FastForwardIcon, FeatherIcon, FigmaIcon, FileIcon, FileMinusIcon, FilePlusIcon, FileSearchIcon, FileTextIcon, FilmIcon, FilterIcon, FlagIcon, FlaskConicalIcon, FolderIcon, FolderMinusIcon, FolderPlusIcon, FramerIcon, FrownIcon, GiftIcon, GitBranchIcon, GitCommitIcon, GithubIcon, GitlabIcon, GitMergeIcon, GitPullRequestIcon, GlobeIcon, HardDriveIcon, HashIcon, HeadphonesIcon, HeartIcon, HelpCircleIcon, HexagonIcon, HomeIcon, ImageIcon, ImageOffIcon, InboxIcon, InfoIcon, InstagramIcon, ItalicIcon, KeyIcon, Landmark, LayersIcon, LayoutGridIcon, LayoutIcon, LifeBuoyIcon, Link2Icon, LinkedinIcon, LinkIcon, ListIcon, LoaderIcon, LockIcon, LogInIcon, LogOutIcon, MailIcon, MapIcon, MapPinIcon, Maximize2Icon, MaximizeIcon, MehIcon, MenuIcon, MergeIcon, MessageCircleIcon, MessageSquareIcon, MicIcon, MicOffIcon, Minimize2Icon, MinimizeIcon, MinusCircleIcon, MinusIcon, MinusSquareIcon, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoreVerticalIcon, MousePointerIcon, MoveIcon, MusicIcon, Navigation2Icon, NavigationIcon, OctagonIcon, PackageIcon, PaperclipIcon, PauseCircleIcon, PauseIcon, PenToolIcon, PercentIcon, PhoneCallIcon, PhoneForwardedIcon, PhoneIcon, PhoneIncomingIcon, PhoneMissedIcon, PhoneOffIcon, PhoneOutgoingIcon, PieChartIcon, PlayCircleIcon, PlayIcon, PlusCircleIcon, PlusIcon, PlusSquareIcon, PocketIcon, PowerIcon, PrinterIcon, RadioIcon, RefreshCcwIcon, RefreshCwIcon, RepeatIcon, RewindIcon, RotateCcwIcon, RotateCwIcon, RssIcon, SaveIcon, ScissorsIcon, SearchIcon, SearchXIcon, SendIcon, ServerCogIcon, ServerCrashIcon, ServerIcon, SettingsIcon, Share2Icon, ShareIcon, ShieldIcon, ShieldOffIcon, ShoppingBagIcon, ShoppingCartIcon, ShuffleIcon, SidebarIcon, SkipBackIcon, SkipForwardIcon, SlackIcon, SlidersIcon, SmartphoneIcon, SmileIcon, SpeakerIcon, SquareIcon, StarIcon, StopCircleIcon, SunIcon, SunriseIcon, SunsetIcon, TableIcon, TabletIcon, TagIcon, TargetIcon, TerminalIcon, ThermometerIcon, ThumbsDownIcon, ThumbsUpIcon, ToggleLeftIcon, ToggleRightIcon, Trash2Icon, TrashIcon, TrelloIcon, TrendingDownIcon, TrendingUpIcon, TriangleIcon, TruckIcon, TvIcon, TwitchIcon, TwitterIcon, TypeIcon, UmbrellaIcon, UnderlineIcon, UnlockIcon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, UserMinusIcon, UserPlusIcon, UsersIcon, UserXIcon, VideoIcon, VideoOffIcon, VoicemailIcon, Volume1Icon, Volume2Icon, VolumeIcon, VolumeXIcon, WatchIcon, WifiIcon, WifiOffIcon, WindIcon, WrenchIcon, XCircleIcon, XIcon, XOctagonIcon, XSquareIcon, YoutubeIcon, ZapIcon, ZapOffIcon, ZoomInIcon, ZoomOutIcon, } from "lucide-react";
|
20
|
+
export { ActivityIcon, AirplayIcon, AlertCircleIcon, AlertOctagonIcon, AlertTriangleIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AnchorIcon, ApertureIcon, ArchiveIcon, ArrowDownCircleIcon, ArrowDownIcon, ArrowDownLeftIcon, ArrowDownRightIcon, ArrowLeftCircleIcon, ArrowLeftIcon, ArrowRightCircleIcon, ArrowRightIcon, ArrowUpCircleIcon, ArrowUpIcon, ArrowUpLeftIcon, ArrowUpRightIcon, AtSignIcon, AwardIcon, BanIcon, BarChart2Icon, BarChartIcon, BatteryChargingIcon, BatteryIcon, BellIcon, BellOffIcon, BlocksIcon, BluetoothIcon, BoldIcon, BookIcon, BookmarkIcon, BookOpenIcon, BoxIcon, BriefcaseIcon, CalendarIcon, CameraIcon, CameraOffIcon, CastIcon, CheckCircleIcon, CheckIcon, CheckSquareIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsDownIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpIcon, ChevronUpIcon, ChromeIcon, CircleIcon, ClipboardIcon, ClockIcon, CloudDrizzleIcon, CloudIcon, CloudLightningIcon, CloudOffIcon, CloudRainIcon, CloudSnowIcon, CodeIcon, CodepenIcon, CodesandboxIcon, CoffeeIcon, ColumnsIcon, CommandIcon, CompassIcon, CopyIcon, CornerDownLeftIcon, CornerDownRightIcon, CornerLeftDownIcon, CornerLeftUpIcon, CornerRightDownIcon, CornerRightUpIcon, CornerUpLeftIcon, CornerUpRightIcon, CpuIcon, CreditCardIcon, CropIcon, CrosshairIcon, DatabaseIcon, DeleteIcon, DiscIcon, DivideCircleIcon, DivideIcon, DivideSquareIcon, DollarSignIcon, DownloadCloudIcon, DownloadIcon, DribbbleIcon, DropletIcon, Edit2Icon, Edit3Icon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FastForwardIcon, FeatherIcon, FigmaIcon, FileIcon, FileMinusIcon, FilePlusIcon, FileSearchIcon, FileTextIcon, FilmIcon, FilterIcon, FlagIcon, FlaskConicalIcon, FolderIcon, FolderMinusIcon, FolderPlusIcon, FramerIcon, FrownIcon, GiftIcon, GitBranchIcon, GitCommitIcon, GithubIcon, GitlabIcon, GitMergeIcon, GitPullRequestIcon, GlobeIcon, HardDriveIcon, HashIcon, HeadphonesIcon, HeartIcon, HelpCircleIcon, HexagonIcon, HomeIcon, ImageIcon, ImageOffIcon, InboxIcon, InfoIcon, InstagramIcon, ItalicIcon, KeyIcon, Landmark, LayersIcon, LayoutGridIcon, LayoutIcon, LifeBuoyIcon, Link2Icon, LinkedinIcon, LinkIcon, ListIcon, LoaderIcon, LockIcon, LogInIcon, LogOutIcon, MailIcon, MapIcon, MapPinIcon, Maximize2Icon, MaximizeIcon, MehIcon, MenuIcon, MergeIcon, MessageCircleIcon, MessageSquareIcon, MicIcon, MicOffIcon, Minimize2Icon, MinimizeIcon, MinusCircleIcon, MinusIcon, MinusSquareIcon, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoreVerticalIcon, MousePointerIcon, MoveIcon, MusicIcon, Navigation2Icon, NavigationIcon, OctagonIcon, PackageIcon, PaperclipIcon, PauseCircleIcon, PauseIcon, PenToolIcon, PercentIcon, PhoneCallIcon, PhoneForwardedIcon, PhoneIcon, PhoneIncomingIcon, PhoneMissedIcon, PhoneOffIcon, PhoneOutgoingIcon, PieChartIcon, PlayCircleIcon, PlayIcon, PlusCircleIcon, PlusIcon, PlusSquareIcon, PocketIcon, PowerIcon, PrinterIcon, RadioIcon, RefreshCcwIcon, RefreshCwIcon, RepeatIcon, RewindIcon, RotateCcwIcon, RotateCwIcon, RssIcon, SaveIcon, ScissorsIcon, SearchIcon, SearchXIcon, SendIcon, ServerCogIcon, ServerCrashIcon, ServerIcon, SettingsIcon, Share2Icon, ShareIcon, ShieldIcon, ShieldOffIcon, ShoppingBagIcon, ShoppingCartIcon, ShuffleIcon, SidebarIcon, SkipBackIcon, SkipForwardIcon, SlackIcon, SlidersIcon, SmartphoneIcon, SmileIcon, SparklesIcon, SpeakerIcon, SquareIcon, StarIcon, StopCircleIcon, SunIcon, SunriseIcon, SunsetIcon, TableIcon, TabletIcon, TagIcon, TargetIcon, TerminalIcon, ThermometerIcon, ThumbsDownIcon, ThumbsUpIcon, ToggleLeftIcon, ToggleRightIcon, Trash2Icon, TrashIcon, TrelloIcon, TrendingDownIcon, TrendingUpIcon, TriangleIcon, TruckIcon, TvIcon, TwitchIcon, TwitterIcon, TypeIcon, UmbrellaIcon, UnderlineIcon, UnlockIcon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, UserMinusIcon, UserPlusIcon, UsersIcon, UserXIcon, VideoIcon, VideoOffIcon, VoicemailIcon, Volume1Icon, Volume2Icon, VolumeIcon, VolumeXIcon, WatchIcon, WifiIcon, WifiOffIcon, WindIcon, WrenchIcon, XCircleIcon, XIcon, XOctagonIcon, XSquareIcon, YoutubeIcon, ZapIcon, ZapOffIcon, ZoomInIcon, ZoomOutIcon, } from "lucide-react";
|
package/dist/cjs/Icons/index.js
CHANGED
@@ -1497,6 +1497,12 @@ Object.defineProperty(exports, "SmileIcon", {
|
|
1497
1497
|
return _lucideReact.SmileIcon;
|
1498
1498
|
}
|
1499
1499
|
});
|
1500
|
+
Object.defineProperty(exports, "SparklesIcon", {
|
1501
|
+
enumerable: true,
|
1502
|
+
get: function get() {
|
1503
|
+
return _lucideReact.SparklesIcon;
|
1504
|
+
}
|
1505
|
+
});
|
1500
1506
|
Object.defineProperty(exports, "SpeakerIcon", {
|
1501
1507
|
enumerable: true,
|
1502
1508
|
get: function get() {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { DetailedHTMLProps, HTMLAttributes, MouseEventHandler } from "react";
|
1
|
+
import type { DetailedHTMLProps, HTMLAttributes, MouseEventHandler, ReactNode } from "react";
|
2
2
|
import type { ColorVariant } from "../../types";
|
3
3
|
export declare type TagVariants = ColorVariant | "pink";
|
4
4
|
export declare type TagLocale = {
|
@@ -34,7 +34,7 @@ export interface TagProps extends DetailedHTMLProps<HTMLAttributes<HTMLSpanEleme
|
|
34
34
|
/**
|
35
35
|
* The content of the tag.
|
36
36
|
*/
|
37
|
-
children:
|
37
|
+
children: ReactNode;
|
38
38
|
}
|
39
39
|
/**
|
40
40
|
* The `Tag` component is an interactive and customizable text label with varied color options.
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
3
|
-
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
4
4
|
import cx from "clsx";
|
5
5
|
import { useEffect, useMemo, useState } from "react";
|
6
6
|
import { AlertCircleIcon } from "../../Icons";
|
@@ -10,19 +10,12 @@ import { getTextFromReactNode } from "../../utils/getTextFromReactNode";
|
|
10
10
|
import { useForm } from "../Form/useForm";
|
11
11
|
import { DEFAULT_FIELD_STATE, FieldContext } from "./FieldContext";
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
13
|
-
var INLINE_LABEL_SIZE = {
|
14
|
-
small: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["grid-cols-[20%_auto]"]))),
|
15
|
-
medium: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["grid-cols-[35%_auto]"]))),
|
16
|
-
large: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["grid-cols-[50%_auto]"])))
|
17
|
-
};
|
18
|
-
|
19
13
|
/**
|
20
14
|
* The `Field` component is a helper that wraps inputs to streamline labeling, validation, integration into a form.
|
21
15
|
*
|
22
16
|
* See the [Field documentation page](https://satellite.algolia.com/components/forms/field) for more information.
|
23
17
|
*/
|
24
18
|
export var Field = function Field(_ref) {
|
25
|
-
var _form$inline, _form$inlineLabelSize;
|
26
19
|
var className = _ref.className,
|
27
20
|
label = _ref.label,
|
28
21
|
labelForProp = _ref.labelFor,
|
@@ -30,7 +23,8 @@ export var Field = function Field(_ref) {
|
|
30
23
|
description = _ref.description,
|
31
24
|
_ref$state = _ref.state,
|
32
25
|
state = _ref$state === void 0 ? DEFAULT_FIELD_STATE : _ref$state,
|
33
|
-
|
26
|
+
_ref$inline = _ref.inline,
|
27
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
34
28
|
requiredProp = _ref.required,
|
35
29
|
_ref$hideRequiredIndi = _ref.hideRequiredIndicator,
|
36
30
|
hideRequiredIndicator = _ref$hideRequiredIndi === void 0 ? false : _ref$hideRequiredIndi,
|
@@ -60,11 +54,14 @@ export var Field = function Field(_ref) {
|
|
60
54
|
_useState4 = _slicedToArray(_useState3, 2),
|
61
55
|
elementToFocusContext = _useState4[0],
|
62
56
|
setElementToFocusContext = _useState4[1];
|
57
|
+
if (process.env.NODE_ENV !== "production") {
|
58
|
+
if (typeof requiredProp !== "undefined" && typeof requiredContext !== "undefined" && requiredProp !== requiredContext) {
|
59
|
+
console.warn("The `required` prop is set to different values on both the Field (`required=".concat(requiredProp, "`) and the underlying input component (`required=").concat(requiredContext, "`)."));
|
60
|
+
}
|
61
|
+
}
|
63
62
|
var form = useForm();
|
64
63
|
var addField = form === null || form === void 0 ? void 0 : form.addField;
|
65
64
|
var removeField = form === null || form === void 0 ? void 0 : form.removeField;
|
66
|
-
var inline = (_form$inline = form === null || form === void 0 ? void 0 : form.inline) !== null && _form$inline !== void 0 ? _form$inline : inlineProp;
|
67
|
-
var inlineLabelSize = (_form$inlineLabelSize = form === null || form === void 0 ? void 0 : form.inlineLabelSize) !== null && _form$inlineLabelSize !== void 0 ? _form$inlineLabelSize : "medium";
|
68
65
|
useEffect(function () {
|
69
66
|
addField === null || addField === void 0 || addField({
|
70
67
|
state: state,
|
@@ -79,14 +76,6 @@ export var Field = function Field(_ref) {
|
|
79
76
|
});
|
80
77
|
};
|
81
78
|
}, [addField, removeField, state, labelFor, label]);
|
82
|
-
if (process.env.NODE_ENV !== "production") {
|
83
|
-
if (typeof requiredProp !== "undefined" && typeof requiredContext !== "undefined" && requiredProp !== requiredContext) {
|
84
|
-
console.warn("The `required` prop is set to different values on both the Field (`required=".concat(requiredProp, "`) and the underlying input component (`required=").concat(requiredContext, "`)."));
|
85
|
-
}
|
86
|
-
if ((form === null || form === void 0 ? void 0 : form.inline) === true && inlineProp === false) {
|
87
|
-
console.warn("The `Field` component is being used inside a `Form` with `inline` set to `true`, but the `Field` component has `inline` set to `false`. To fix this, remove the `inline` prop on the `Field` component.");
|
88
|
-
}
|
89
|
-
}
|
90
79
|
return /*#__PURE__*/_jsx(FieldContext.Provider, {
|
91
80
|
value: {
|
92
81
|
state: state,
|
@@ -96,52 +85,47 @@ export var Field = function Field(_ref) {
|
|
96
85
|
setRequired: setRequiredContext,
|
97
86
|
setElementToFocus: setElementToFocusContext
|
98
87
|
},
|
99
|
-
children: /*#__PURE__*/
|
88
|
+
children: /*#__PURE__*/_jsxs("div", {
|
100
89
|
className: className,
|
101
|
-
children: /*#__PURE__*/_jsxs("
|
102
|
-
className:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
className: stl(
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
children: "*"
|
118
|
-
})]
|
119
|
-
})
|
90
|
+
children: [/*#__PURE__*/_jsxs("label", {
|
91
|
+
className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["cursor-pointer flex ", ""])), inline ? "items-center" : "flex-col"),
|
92
|
+
htmlFor: labelFor,
|
93
|
+
onClick: function onClick() {
|
94
|
+
if (!(elementToFocusContext !== null && elementToFocusContext !== void 0 && elementToFocusContext.closest("[aria-disabled=true]")) && !(elementToFocusContext !== null && elementToFocusContext !== void 0 && elementToFocusContext.closest("[disabled=true]"))) {
|
95
|
+
elementToFocusContext === null || elementToFocusContext === void 0 || elementToFocusContext.focus();
|
96
|
+
}
|
97
|
+
},
|
98
|
+
children: [hasLabel && /*#__PURE__*/_jsxs("div", {
|
99
|
+
id: labelId,
|
100
|
+
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["truncate ", ""])), inline ? "mr-2" : "mb-1"),
|
101
|
+
children: [label, !hideRequiredIndicator && (requiredProp || requiredContext) && /*#__PURE__*/_jsx("span", {
|
102
|
+
className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["text-red-700 ml-0.5 align-top"]))),
|
103
|
+
"aria-hidden": true,
|
104
|
+
children: "*"
|
105
|
+
})]
|
120
106
|
}), /*#__PURE__*/_jsx("div", {
|
107
|
+
className: cx(inline && stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["ml-auto mt-1"])))),
|
121
108
|
children: children
|
122
|
-
}), /*#__PURE__*/_jsx("div", {
|
123
|
-
className: cx(inline && stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["col-start-2"])))),
|
124
|
-
children: state.status === "invalid" && state.errors.length > 0 ? /*#__PURE__*/_jsx("ul", {
|
125
|
-
id: descriptionId,
|
126
|
-
className: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["mt-2 display-caption flex flex-col gap-0.5"]))),
|
127
|
-
children: state.errors.map(function (error) {
|
128
|
-
return /*#__PURE__*/_jsxs("li", {
|
129
|
-
className: stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["flex items-center text-red-700"]))),
|
130
|
-
children: [/*#__PURE__*/_jsx(AlertCircleIcon, {
|
131
|
-
className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["mr-1 shrink-0"]))),
|
132
|
-
width: "1rem",
|
133
|
-
height: "1rem",
|
134
|
-
"aria-hidden": true
|
135
|
-
}), error]
|
136
|
-
}, error);
|
137
|
-
})
|
138
|
-
}) : description ? /*#__PURE__*/_jsx("p", {
|
139
|
-
id: descriptionId,
|
140
|
-
className: cx(stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["display-caption text-grey-600 ", ""])), inline ? "mt-1" : "mt-2")),
|
141
|
-
children: description
|
142
|
-
}) : null
|
143
109
|
})]
|
144
|
-
})
|
110
|
+
}), state.status === "invalid" && state.errors.length > 0 ? /*#__PURE__*/_jsx("ul", {
|
111
|
+
id: descriptionId,
|
112
|
+
className: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["mb-1 mt-2 display-caption flex flex-col gap-0.5"]))),
|
113
|
+
children: state.errors.map(function (error) {
|
114
|
+
return /*#__PURE__*/_jsxs("li", {
|
115
|
+
className: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["flex items-center text-red-700"]))),
|
116
|
+
children: [/*#__PURE__*/_jsx(AlertCircleIcon, {
|
117
|
+
className: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["mr-1 shrink-0"]))),
|
118
|
+
width: "1rem",
|
119
|
+
height: "1rem",
|
120
|
+
"aria-hidden": true
|
121
|
+
}), error]
|
122
|
+
}, error);
|
123
|
+
})
|
124
|
+
}) : description ? /*#__PURE__*/_jsx("p", {
|
125
|
+
id: descriptionId,
|
126
|
+
className: cx(stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["display-caption text-grey-600"]))), inline ? stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["mt-1"]))) : stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["mt-2"])))),
|
127
|
+
children: description
|
128
|
+
}) : null]
|
145
129
|
})
|
146
130
|
});
|
147
131
|
};
|
@@ -2,10 +2,7 @@ import type { FC, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
2
2
|
import type { ButtonProps } from "../../Actions";
|
3
3
|
import type { AlertProps } from "../../Indicators";
|
4
4
|
import type { FormContextField } from "./FormContext";
|
5
|
-
export declare type FormInlineLabelSize = "small" | "medium" | "large";
|
6
5
|
export interface FormProps extends HTMLAttributes<HTMLFormElement> {
|
7
|
-
inline?: boolean;
|
8
|
-
inlineLabelSize?: FormInlineLabelSize;
|
9
6
|
}
|
10
7
|
export declare type FormLocale = {
|
11
8
|
errorTitle?: (invalidFields: FormContextField[], extraErrors?: string[]) => ReactNode;
|
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
5
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
6
6
|
var _excluded = ["className", "extraErrors", "locale"],
|
7
|
-
_excluded2 = ["children"
|
7
|
+
_excluded2 = ["children"],
|
8
8
|
_excluded3 = ["children"],
|
9
9
|
_excluded4 = ["children"];
|
10
10
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
@@ -96,9 +96,6 @@ export var FormErrorMessage = function FormErrorMessage(_ref) {
|
|
96
96
|
};
|
97
97
|
export var Form = function Form(_ref6) {
|
98
98
|
var children = _ref6.children,
|
99
|
-
inline = _ref6.inline,
|
100
|
-
_ref6$inlineLabelSize = _ref6.inlineLabelSize,
|
101
|
-
inlineLabelSize = _ref6$inlineLabelSize === void 0 ? "medium" : _ref6$inlineLabelSize,
|
102
99
|
props = _objectWithoutProperties(_ref6, _excluded2);
|
103
100
|
var _useState = useState({}),
|
104
101
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -121,9 +118,7 @@ export var Form = function Form(_ref6) {
|
|
121
118
|
value: {
|
122
119
|
fields: fields,
|
123
120
|
addField: addField,
|
124
|
-
removeField: removeField
|
125
|
-
inline: inline,
|
126
|
-
inlineLabelSize: inlineLabelSize
|
121
|
+
removeField: removeField
|
127
122
|
},
|
128
123
|
children: /*#__PURE__*/_jsx("form", _objectSpread(_objectSpread({
|
129
124
|
noValidate: true
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { FieldState } from "../Field";
|
3
|
-
import type { FormInlineLabelSize } from "./Form";
|
4
3
|
export declare type FormContextField = {
|
5
4
|
state: FieldState;
|
6
5
|
label: string;
|
@@ -10,7 +9,5 @@ export declare type FormContextValue = {
|
|
10
9
|
fields: Record<string, FormContextField>;
|
11
10
|
addField: (field: FormContextField) => void;
|
12
11
|
removeField: (field: FormContextField) => void;
|
13
|
-
inline?: boolean;
|
14
|
-
inlineLabelSize?: FormInlineLabelSize;
|
15
12
|
};
|
16
13
|
export declare const FormContext: import("react").Context<FormContextValue | null>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export type { FormProps as ExperimentalFormProps, FormLocale as ExperimentalFormLocale, FormErrorMessageProps as ExperimentalFormErrorMessageProps,
|
1
|
+
export type { FormProps as ExperimentalFormProps, FormLocale as ExperimentalFormLocale, FormErrorMessageProps as ExperimentalFormErrorMessageProps, } from "./Form";
|
2
2
|
export { Form as ExperimentalForm, FormErrorMessage as ExperimentalFormErrorMessage, FormSubmit as ExperimentalFormSubmit, FormReset as ExperimentalFormReset, } from "./Form";
|
3
3
|
export type { FormContextField as ExperimentalFormContextField, FormContextValue as ExperimentalFormContextValue, } from "./FormContext";
|
4
4
|
export { useForm as useExperimentalForm } from "./useForm";
|
@@ -518,6 +518,7 @@ export var RHFComplexComponent = function RHFComplexComponent() {
|
|
518
518
|
description: "Please accept the terms",
|
519
519
|
state: getFieldState("acceptTerms"),
|
520
520
|
className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["w-full"]))),
|
521
|
+
inline: true,
|
521
522
|
children: /*#__PURE__*/_jsx(Checkbox, _objectSpread({
|
522
523
|
id: "acceptTerms",
|
523
524
|
required: true,
|
@@ -536,6 +537,7 @@ export var RHFComplexComponent = function RHFComplexComponent() {
|
|
536
537
|
description: "Do you want to receive our newsletter?",
|
537
538
|
state: getFieldState("newsletter"),
|
538
539
|
className: stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["w-full"]))),
|
540
|
+
inline: true,
|
539
541
|
children: /*#__PURE__*/_jsx(Switch, _objectSpread({
|
540
542
|
id: "newsletter",
|
541
543
|
required: true,
|
@@ -886,6 +888,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
|
|
886
888
|
description: "Please accept the terms",
|
887
889
|
state: getFieldState("acceptTerms"),
|
888
890
|
className: stl(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["w-full"]))),
|
891
|
+
inline: true,
|
889
892
|
children: /*#__PURE__*/_jsx(Checkbox, _objectSpread({
|
890
893
|
id: "acceptTerms",
|
891
894
|
required: true,
|
@@ -897,6 +900,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
|
|
897
900
|
description: "Do you want to receive our newsletter?",
|
898
901
|
state: getFieldState("newsletter"),
|
899
902
|
className: stl(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["w-full"]))),
|
903
|
+
inline: true,
|
900
904
|
children: /*#__PURE__*/_jsx(Switch, _objectSpread({
|
901
905
|
id: "newsletter",
|
902
906
|
required: true,
|
@@ -17,4 +17,4 @@ export { QueryBreakdownIcon } from "./QueryBreakdownIcon";
|
|
17
17
|
export { BulbIcon } from "./BulbIcon";
|
18
18
|
export { TestingIcon } from "./TestingIcon";
|
19
19
|
export { RocketIcon } from "./RocketIcon";
|
20
|
-
export { ActivityIcon, AirplayIcon, AlertCircleIcon, AlertOctagonIcon, AlertTriangleIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AnchorIcon, ApertureIcon, ArchiveIcon, ArrowDownCircleIcon, ArrowDownIcon, ArrowDownLeftIcon, ArrowDownRightIcon, ArrowLeftCircleIcon, ArrowLeftIcon, ArrowRightCircleIcon, ArrowRightIcon, ArrowUpCircleIcon, ArrowUpIcon, ArrowUpLeftIcon, ArrowUpRightIcon, AtSignIcon, AwardIcon, BanIcon, BarChart2Icon, BarChartIcon, BatteryChargingIcon, BatteryIcon, BellIcon, BellOffIcon, BlocksIcon, BluetoothIcon, BoldIcon, BookIcon, BookmarkIcon, BookOpenIcon, BoxIcon, BriefcaseIcon, CalendarIcon, CameraIcon, CameraOffIcon, CastIcon, CheckCircleIcon, CheckIcon, CheckSquareIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsDownIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpIcon, ChevronUpIcon, ChromeIcon, CircleIcon, ClipboardIcon, ClockIcon, CloudDrizzleIcon, CloudIcon, CloudLightningIcon, CloudOffIcon, CloudRainIcon, CloudSnowIcon, CodeIcon, CodepenIcon, CodesandboxIcon, CoffeeIcon, ColumnsIcon, CommandIcon, CompassIcon, CopyIcon, CornerDownLeftIcon, CornerDownRightIcon, CornerLeftDownIcon, CornerLeftUpIcon, CornerRightDownIcon, CornerRightUpIcon, CornerUpLeftIcon, CornerUpRightIcon, CpuIcon, CreditCardIcon, CropIcon, CrosshairIcon, DatabaseIcon, DeleteIcon, DiscIcon, DivideCircleIcon, DivideIcon, DivideSquareIcon, DollarSignIcon, DownloadCloudIcon, DownloadIcon, DribbbleIcon, DropletIcon, Edit2Icon, Edit3Icon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FastForwardIcon, FeatherIcon, FigmaIcon, FileIcon, FileMinusIcon, FilePlusIcon, FileSearchIcon, FileTextIcon, FilmIcon, FilterIcon, FlagIcon, FlaskConicalIcon, FolderIcon, FolderMinusIcon, FolderPlusIcon, FramerIcon, FrownIcon, GiftIcon, GitBranchIcon, GitCommitIcon, GithubIcon, GitlabIcon, GitMergeIcon, GitPullRequestIcon, GlobeIcon, HardDriveIcon, HashIcon, HeadphonesIcon, HeartIcon, HelpCircleIcon, HexagonIcon, HomeIcon, ImageIcon, ImageOffIcon, InboxIcon, InfoIcon, InstagramIcon, ItalicIcon, KeyIcon, Landmark, LayersIcon, LayoutGridIcon, LayoutIcon, LifeBuoyIcon, Link2Icon, LinkedinIcon, LinkIcon, ListIcon, LoaderIcon, LockIcon, LogInIcon, LogOutIcon, MailIcon, MapIcon, MapPinIcon, Maximize2Icon, MaximizeIcon, MehIcon, MenuIcon, MergeIcon, MessageCircleIcon, MessageSquareIcon, MicIcon, MicOffIcon, Minimize2Icon, MinimizeIcon, MinusCircleIcon, MinusIcon, MinusSquareIcon, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoreVerticalIcon, MousePointerIcon, MoveIcon, MusicIcon, Navigation2Icon, NavigationIcon, OctagonIcon, PackageIcon, PaperclipIcon, PauseCircleIcon, PauseIcon, PenToolIcon, PercentIcon, PhoneCallIcon, PhoneForwardedIcon, PhoneIcon, PhoneIncomingIcon, PhoneMissedIcon, PhoneOffIcon, PhoneOutgoingIcon, PieChartIcon, PlayCircleIcon, PlayIcon, PlusCircleIcon, PlusIcon, PlusSquareIcon, PocketIcon, PowerIcon, PrinterIcon, RadioIcon, RefreshCcwIcon, RefreshCwIcon, RepeatIcon, RewindIcon, RotateCcwIcon, RotateCwIcon, RssIcon, SaveIcon, ScissorsIcon, SearchIcon, SearchXIcon, SendIcon, ServerCogIcon, ServerCrashIcon, ServerIcon, SettingsIcon, Share2Icon, ShareIcon, ShieldIcon, ShieldOffIcon, ShoppingBagIcon, ShoppingCartIcon, ShuffleIcon, SidebarIcon, SkipBackIcon, SkipForwardIcon, SlackIcon, SlidersIcon, SmartphoneIcon, SmileIcon, SpeakerIcon, SquareIcon, StarIcon, StopCircleIcon, SunIcon, SunriseIcon, SunsetIcon, TableIcon, TabletIcon, TagIcon, TargetIcon, TerminalIcon, ThermometerIcon, ThumbsDownIcon, ThumbsUpIcon, ToggleLeftIcon, ToggleRightIcon, Trash2Icon, TrashIcon, TrelloIcon, TrendingDownIcon, TrendingUpIcon, TriangleIcon, TruckIcon, TvIcon, TwitchIcon, TwitterIcon, TypeIcon, UmbrellaIcon, UnderlineIcon, UnlockIcon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, UserMinusIcon, UserPlusIcon, UsersIcon, UserXIcon, VideoIcon, VideoOffIcon, VoicemailIcon, Volume1Icon, Volume2Icon, VolumeIcon, VolumeXIcon, WatchIcon, WifiIcon, WifiOffIcon, WindIcon, WrenchIcon, XCircleIcon, XIcon, XOctagonIcon, XSquareIcon, YoutubeIcon, ZapIcon, ZapOffIcon, ZoomInIcon, ZoomOutIcon, } from "lucide-react";
|
20
|
+
export { ActivityIcon, AirplayIcon, AlertCircleIcon, AlertOctagonIcon, AlertTriangleIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AnchorIcon, ApertureIcon, ArchiveIcon, ArrowDownCircleIcon, ArrowDownIcon, ArrowDownLeftIcon, ArrowDownRightIcon, ArrowLeftCircleIcon, ArrowLeftIcon, ArrowRightCircleIcon, ArrowRightIcon, ArrowUpCircleIcon, ArrowUpIcon, ArrowUpLeftIcon, ArrowUpRightIcon, AtSignIcon, AwardIcon, BanIcon, BarChart2Icon, BarChartIcon, BatteryChargingIcon, BatteryIcon, BellIcon, BellOffIcon, BlocksIcon, BluetoothIcon, BoldIcon, BookIcon, BookmarkIcon, BookOpenIcon, BoxIcon, BriefcaseIcon, CalendarIcon, CameraIcon, CameraOffIcon, CastIcon, CheckCircleIcon, CheckIcon, CheckSquareIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsDownIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpIcon, ChevronUpIcon, ChromeIcon, CircleIcon, ClipboardIcon, ClockIcon, CloudDrizzleIcon, CloudIcon, CloudLightningIcon, CloudOffIcon, CloudRainIcon, CloudSnowIcon, CodeIcon, CodepenIcon, CodesandboxIcon, CoffeeIcon, ColumnsIcon, CommandIcon, CompassIcon, CopyIcon, CornerDownLeftIcon, CornerDownRightIcon, CornerLeftDownIcon, CornerLeftUpIcon, CornerRightDownIcon, CornerRightUpIcon, CornerUpLeftIcon, CornerUpRightIcon, CpuIcon, CreditCardIcon, CropIcon, CrosshairIcon, DatabaseIcon, DeleteIcon, DiscIcon, DivideCircleIcon, DivideIcon, DivideSquareIcon, DollarSignIcon, DownloadCloudIcon, DownloadIcon, DribbbleIcon, DropletIcon, Edit2Icon, Edit3Icon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FastForwardIcon, FeatherIcon, FigmaIcon, FileIcon, FileMinusIcon, FilePlusIcon, FileSearchIcon, FileTextIcon, FilmIcon, FilterIcon, FlagIcon, FlaskConicalIcon, FolderIcon, FolderMinusIcon, FolderPlusIcon, FramerIcon, FrownIcon, GiftIcon, GitBranchIcon, GitCommitIcon, GithubIcon, GitlabIcon, GitMergeIcon, GitPullRequestIcon, GlobeIcon, HardDriveIcon, HashIcon, HeadphonesIcon, HeartIcon, HelpCircleIcon, HexagonIcon, HomeIcon, ImageIcon, ImageOffIcon, InboxIcon, InfoIcon, InstagramIcon, ItalicIcon, KeyIcon, Landmark, LayersIcon, LayoutGridIcon, LayoutIcon, LifeBuoyIcon, Link2Icon, LinkedinIcon, LinkIcon, ListIcon, LoaderIcon, LockIcon, LogInIcon, LogOutIcon, MailIcon, MapIcon, MapPinIcon, Maximize2Icon, MaximizeIcon, MehIcon, MenuIcon, MergeIcon, MessageCircleIcon, MessageSquareIcon, MicIcon, MicOffIcon, Minimize2Icon, MinimizeIcon, MinusCircleIcon, MinusIcon, MinusSquareIcon, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoreVerticalIcon, MousePointerIcon, MoveIcon, MusicIcon, Navigation2Icon, NavigationIcon, OctagonIcon, PackageIcon, PaperclipIcon, PauseCircleIcon, PauseIcon, PenToolIcon, PercentIcon, PhoneCallIcon, PhoneForwardedIcon, PhoneIcon, PhoneIncomingIcon, PhoneMissedIcon, PhoneOffIcon, PhoneOutgoingIcon, PieChartIcon, PlayCircleIcon, PlayIcon, PlusCircleIcon, PlusIcon, PlusSquareIcon, PocketIcon, PowerIcon, PrinterIcon, RadioIcon, RefreshCcwIcon, RefreshCwIcon, RepeatIcon, RewindIcon, RotateCcwIcon, RotateCwIcon, RssIcon, SaveIcon, ScissorsIcon, SearchIcon, SearchXIcon, SendIcon, ServerCogIcon, ServerCrashIcon, ServerIcon, SettingsIcon, Share2Icon, ShareIcon, ShieldIcon, ShieldOffIcon, ShoppingBagIcon, ShoppingCartIcon, ShuffleIcon, SidebarIcon, SkipBackIcon, SkipForwardIcon, SlackIcon, SlidersIcon, SmartphoneIcon, SmileIcon, SparklesIcon, SpeakerIcon, SquareIcon, StarIcon, StopCircleIcon, SunIcon, SunriseIcon, SunsetIcon, TableIcon, TabletIcon, TagIcon, TargetIcon, TerminalIcon, ThermometerIcon, ThumbsDownIcon, ThumbsUpIcon, ToggleLeftIcon, ToggleRightIcon, Trash2Icon, TrashIcon, TrelloIcon, TrendingDownIcon, TrendingUpIcon, TriangleIcon, TruckIcon, TvIcon, TwitchIcon, TwitterIcon, TypeIcon, UmbrellaIcon, UnderlineIcon, UnlockIcon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, UserMinusIcon, UserPlusIcon, UsersIcon, UserXIcon, VideoIcon, VideoOffIcon, VoicemailIcon, Volume1Icon, Volume2Icon, VolumeIcon, VolumeXIcon, WatchIcon, WifiIcon, WifiOffIcon, WindIcon, WrenchIcon, XCircleIcon, XIcon, XOctagonIcon, XSquareIcon, YoutubeIcon, ZapIcon, ZapOffIcon, ZoomInIcon, ZoomOutIcon, } from "lucide-react";
|