@plitzi/sdk-elements 0.38.23 → 0.39.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/CHANGELOG.md +180 -1
- package/dist/Element/RootElement.d.ts +1 -1
- package/dist/Element/RootElement.mjs +62 -61
- package/dist/Element/RowAnchor.d.ts +15 -0
- package/dist/Element/RowAnchor.mjs +8 -0
- package/dist/Element/helpers/elementConstants.mjs +12 -0
- package/dist/Element/hocs/withElement.d.ts +1 -1
- package/dist/Element/hocs/withElement.mjs +96 -88
- package/dist/Element/hooks/useEditableContent.d.ts +11 -0
- package/dist/Element/hooks/useEditableContent.mjs +11 -10
- package/dist/Element/hooks/useElement.mjs +1 -1
- package/dist/Element/hooks/useElementDataSource.mjs +11 -10
- package/dist/Element/hooks/useFocusInteractions.d.ts +12 -0
- package/dist/Element/hooks/useFocusInteractions.mjs +9 -0
- package/dist/Element/hooks/useInternalClassName.mjs +22 -21
- package/dist/Element/hooks/useRootElementInteractions.mjs +48 -42
- package/dist/Element/hooks/useScrollInteractions.d.ts +1 -1
- package/dist/Element/hooks/useScrollInteractions.mjs +61 -30
- package/dist/dataSource/PluginSource.d.ts +22 -0
- package/dist/dataSource/PluginSource.mjs +27 -0
- package/dist/dataSource/index.d.ts +2 -0
- package/dist/dataSource/index.mjs +5 -4
- package/dist/elements/advanced/BlockHtml/BlockHtml.d.ts +1 -1
- package/dist/elements/advanced/BlockHtml/index.d.ts +1 -1
- package/dist/elements/advanced/BlockJsx/BlockJsx.d.ts +1 -1
- package/dist/elements/advanced/BlockJsx/index.d.ts +1 -1
- package/dist/elements/advanced/Custom/Custom.d.ts +1 -1
- package/dist/elements/advanced/Custom/index.d.ts +1 -1
- package/dist/elements/advanced/NodeHtml/NodeHtml.d.ts +1 -1
- package/dist/elements/advanced/NodeHtml/declaration.d.ts +3 -3
- package/dist/elements/advanced/NodeHtml/index.d.ts +4 -4
- package/dist/elements/advanced/Reference/Reference.d.ts +2 -2
- package/dist/elements/advanced/Reference/Reference.mjs +1 -1
- package/dist/elements/advanced/Reference/index.d.ts +1 -1
- package/dist/elements/basic/Button/Button.d.ts +7 -2
- package/dist/elements/basic/Button/Button.mjs +27 -25
- package/dist/elements/basic/Button/Settings.mjs +1 -1
- package/dist/elements/basic/Button/declaration.d.ts +8 -1
- package/dist/elements/basic/Button/declaration.mjs +3 -0
- package/dist/elements/basic/Button/index.d.ts +9 -2
- package/dist/elements/basic/Dropdown/Dropdown.d.ts +9 -2
- package/dist/elements/basic/Dropdown/Dropdown.mjs +93 -74
- package/dist/elements/basic/Dropdown/DropdownPopup/DropdownPopup.d.ts +1 -1
- package/dist/elements/basic/Dropdown/DropdownPopup/index.d.ts +1 -1
- package/dist/elements/basic/Dropdown/declaration.d.ts +31 -0
- package/dist/elements/basic/Dropdown/declaration.mjs +38 -6
- package/dist/elements/basic/Dropdown/index.d.ts +33 -2
- package/dist/elements/basic/Dropdown/useDropdown.d.ts +2 -0
- package/dist/elements/basic/Heading/Heading.d.ts +1 -1
- package/dist/elements/basic/Heading/Heading.mjs +3 -2
- package/dist/elements/basic/Heading/declaration.d.ts +2 -0
- package/dist/elements/basic/Heading/declaration.mjs +2 -0
- package/dist/elements/basic/Heading/index.d.ts +3 -1
- package/dist/elements/basic/Link/Link.d.ts +1 -1
- package/dist/elements/basic/Link/Link.mjs +46 -45
- package/dist/elements/basic/Link/declaration.d.ts +1 -0
- package/dist/elements/basic/Link/declaration.mjs +5 -0
- package/dist/elements/basic/Link/index.d.ts +2 -1
- package/dist/elements/basic/Markdown/Markdown.d.ts +1 -1
- package/dist/elements/basic/Markdown/declaration.d.ts +2 -0
- package/dist/elements/basic/Markdown/declaration.mjs +2 -0
- package/dist/elements/basic/Markdown/index.d.ts +3 -1
- package/dist/elements/basic/Paragraph/Paragraph.d.ts +1 -1
- package/dist/elements/basic/Paragraph/Paragraph.mjs +3 -2
- package/dist/elements/basic/Paragraph/Settings.mjs +1 -1
- package/dist/elements/basic/Paragraph/declaration.d.ts +2 -0
- package/dist/elements/basic/Paragraph/declaration.mjs +2 -0
- package/dist/elements/basic/Paragraph/index.d.ts +3 -1
- package/dist/elements/basic/RichText/RichText.d.ts +1 -1
- package/dist/elements/basic/RichText/declaration.d.ts +1 -0
- package/dist/elements/basic/RichText/declaration.mjs +1 -0
- package/dist/elements/basic/RichText/index.d.ts +2 -1
- package/dist/elements/basic/Text/Settings.mjs +1 -1
- package/dist/elements/basic/Text/Text.d.ts +1 -1
- package/dist/elements/basic/Text/Text.mjs +3 -2
- package/dist/elements/basic/Text/declaration.d.ts +2 -0
- package/dist/elements/basic/Text/declaration.mjs +2 -0
- package/dist/elements/basic/Text/index.d.ts +3 -1
- package/dist/elements/basic/ThemeToggle/ThemeToggle.d.ts +2 -2
- package/dist/elements/basic/ThemeToggle/declaration.d.ts +1 -0
- package/dist/elements/basic/ThemeToggle/declaration.mjs +5 -0
- package/dist/elements/basic/ThemeToggle/index.d.ts +2 -1
- package/dist/elements/declarations/index.d.ts +322 -12
- package/dist/elements/declarations/index.mjs +46 -44
- package/dist/elements/form/Form/Form.d.ts +8 -2
- package/dist/elements/form/Form/Form.mjs +102 -79
- package/dist/elements/form/Form/declaration.d.ts +21 -3
- package/dist/elements/form/Form/declaration.mjs +28 -11
- package/dist/elements/form/Form/index.d.ts +17 -2
- package/dist/elements/form/FormControl/FormControl.d.ts +8 -2
- package/dist/elements/form/FormControl/FormControl.mjs +71 -66
- package/dist/elements/form/FormControl/Settings.d.ts +6 -1
- package/dist/elements/form/FormControl/Settings.mjs +130 -98
- package/dist/elements/form/FormControl/declaration.d.ts +7 -0
- package/dist/elements/form/FormControl/declaration.mjs +21 -1
- package/dist/elements/form/FormControl/helpers/useBlurValidation.d.ts +12 -0
- package/dist/elements/form/FormControl/helpers/useBlurValidation.mjs +20 -0
- package/dist/elements/form/FormControl/helpers/validateField.d.ts +8 -0
- package/dist/elements/form/FormControl/helpers/validateField.mjs +8 -2
- package/dist/elements/form/FormControl/hocs/withFieldValue.d.ts +4 -0
- package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +49 -41
- package/dist/elements/form/FormControl/index.d.ts +8 -1
- package/dist/elements/form/FormControl/inputs/Checkbox.mjs +2 -2
- package/dist/elements/form/FormControl/inputs/Input.d.ts +5 -1
- package/dist/elements/form/FormControl/inputs/Input.mjs +42 -38
- package/dist/elements/form/FormControl/inputs/Select.d.ts +5 -1
- package/dist/elements/form/FormControl/inputs/Select.mjs +33 -28
- package/dist/elements/form/FormControl/inputs/Textarea.mjs +27 -26
- package/dist/elements/form/FormControl/inputs/useFocusWhenShown.d.ts +1 -1
- package/dist/elements/index.d.ts +3 -1
- package/dist/elements/index.mjs +32 -30
- package/dist/elements/internal/LayoutContainer/LayoutContainer.d.ts +1 -1
- package/dist/elements/internal/LayoutContainer/LayoutContainer.mjs +30 -30
- package/dist/elements/internal/LayoutContainer/index.d.ts +1 -1
- package/dist/elements/internal/LayoutContainer/mask.d.ts +13 -0
- package/dist/elements/internal/LayoutContainer/mask.mjs +16 -1
- package/dist/elements/internal/Loading/Loading.d.ts +1 -1
- package/dist/elements/internal/Loading/index.d.ts +1 -1
- package/dist/elements/internal/NotFound/NotFound.d.ts +1 -1
- package/dist/elements/internal/NotFound/index.d.ts +1 -1
- package/dist/elements/internal/Page/Page.d.ts +17 -3
- package/dist/elements/internal/Page/Page.mjs +32 -25
- package/dist/elements/internal/Page/PageHead.d.ts +11 -4
- package/dist/elements/internal/Page/PageHead.mjs +41 -19
- package/dist/elements/internal/Page/PageWithheld.d.ts +3 -2
- package/dist/elements/internal/Page/PageWithheld.mjs +41 -18
- package/dist/elements/internal/Page/Settings.d.ts +5 -1
- package/dist/elements/internal/Page/Settings.mjs +160 -121
- package/dist/elements/internal/Page/SharePreview.d.ts +13 -0
- package/dist/elements/internal/Page/SharePreview.mjs +53 -0
- package/dist/elements/internal/Page/declaration.d.ts +9 -1
- package/dist/elements/internal/Page/declaration.mjs +11 -4
- package/dist/elements/internal/Page/index.d.ts +9 -2
- package/dist/elements/media/Chart/Chart.d.ts +33 -0
- package/dist/elements/media/Chart/Chart.mjs +195 -0
- package/dist/elements/media/Chart/Settings.d.ts +6 -0
- package/dist/elements/media/Chart/Settings.mjs +92 -0
- package/dist/elements/media/Chart/chartGeometry.d.ts +37 -0
- package/dist/elements/media/Chart/chartGeometry.mjs +47 -0
- package/dist/elements/media/Chart/declaration.d.ts +144 -0
- package/dist/elements/media/Chart/declaration.mjs +107 -0
- package/dist/elements/media/Chart/index.d.ts +145 -0
- package/dist/elements/media/Chart/index.mjs +6 -0
- package/dist/elements/media/Embed/Embed.d.ts +1 -1
- package/dist/elements/media/Embed/Embed.mjs +25 -21
- package/dist/elements/media/Embed/declaration.d.ts +1 -0
- package/dist/elements/media/Embed/declaration.mjs +1 -0
- package/dist/elements/media/Embed/index.d.ts +2 -1
- package/dist/elements/media/FontAwesome/FontAwesome.d.ts +1 -1
- package/dist/elements/media/FontAwesome/index.d.ts +1 -1
- package/dist/elements/media/Image/Image.d.ts +1 -1
- package/dist/elements/media/Image/Image.mjs +35 -34
- package/dist/elements/media/Image/declaration.d.ts +2 -1
- package/dist/elements/media/Image/declaration.mjs +1 -0
- package/dist/elements/media/Image/index.d.ts +3 -2
- package/dist/elements/media/Svg/Svg.d.ts +1 -1
- package/dist/elements/media/Svg/declaration.d.ts +1 -0
- package/dist/elements/media/Svg/declaration.mjs +1 -0
- package/dist/elements/media/Svg/index.d.ts +2 -1
- package/dist/elements/media/Video/Video.d.ts +1 -1
- package/dist/elements/media/Video/declaration.d.ts +1 -0
- package/dist/elements/media/Video/declaration.mjs +1 -0
- package/dist/elements/media/Video/index.d.ts +2 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +1 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +215 -185
- package/dist/elements/provider/ApiContainer/declaration.d.ts +9 -0
- package/dist/elements/provider/ApiContainer/declaration.mjs +10 -1
- package/dist/elements/provider/ApiContainer/hooks/useInputRefresh.d.ts +4 -4
- package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.d.ts +2 -1
- package/dist/elements/provider/ApiContainer/index.d.ts +10 -1
- package/dist/elements/provider/Channel/Channel.d.ts +1 -1
- package/dist/elements/provider/Channel/declaration.d.ts +9 -0
- package/dist/elements/provider/Channel/declaration.mjs +11 -2
- package/dist/elements/provider/Channel/index.d.ts +10 -1
- package/dist/elements/settings.mjs +42 -40
- package/dist/elements/structure/Carousel/Carousel.d.ts +1 -1
- package/dist/elements/structure/Carousel/Carousel.mjs +147 -130
- package/dist/elements/structure/Carousel/CarouselContext.d.ts +3 -3
- package/dist/elements/structure/Carousel/CarouselTrack/CarouselTrack.d.ts +1 -1
- package/dist/elements/structure/Carousel/CarouselTrack/components/ScrollTrack/ScrollTrack.d.ts +6 -2
- package/dist/elements/structure/Carousel/CarouselTrack/components/ScrollTrack/ScrollTrack.mjs +32 -20
- package/dist/elements/structure/Carousel/CarouselTrack/index.d.ts +1 -1
- package/dist/elements/structure/Carousel/carouselIndex.d.ts +17 -0
- package/dist/elements/structure/Carousel/carouselIndex.mjs +17 -5
- package/dist/elements/structure/Carousel/declaration.d.ts +49 -2
- package/dist/elements/structure/Carousel/declaration.mjs +26 -4
- package/dist/elements/structure/Carousel/index.d.ts +51 -4
- package/dist/elements/structure/Container/Container.d.ts +5 -3
- package/dist/elements/structure/Container/Container.mjs +6 -5
- package/dist/elements/structure/Container/Settings.d.ts +4 -2
- package/dist/elements/structure/Container/Settings.mjs +19 -5
- package/dist/elements/structure/Container/declaration.d.ts +3 -2
- package/dist/elements/structure/Container/declaration.mjs +3 -1
- package/dist/elements/structure/Container/index.d.ts +4 -3
- package/dist/elements/structure/DialogContainer/DialogContainer.d.ts +1 -1
- package/dist/elements/structure/DialogContainer/declaration.d.ts +1 -0
- package/dist/elements/structure/DialogContainer/declaration.mjs +5 -0
- package/dist/elements/structure/DialogContainer/index.d.ts +2 -1
- package/dist/elements/structure/List/List.d.ts +1 -1
- package/dist/elements/structure/List/ListItem/ListItem.d.ts +1 -1
- package/dist/elements/structure/List/ListItem/index.d.ts +1 -1
- package/dist/elements/structure/List/declaration.d.ts +5 -0
- package/dist/elements/structure/List/declaration.mjs +5 -0
- package/dist/elements/structure/List/index.d.ts +7 -2
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.mjs +1 -0
- package/dist/elements/structure/List/modes/ListControlled/ListControlledItem.d.ts +3 -1
- package/dist/elements/structure/List/modes/ListControlled/ListControlledItem.mjs +33 -25
- package/dist/elements/structure/ModalContainer/ModalContainer.d.ts +1 -1
- package/dist/elements/structure/ModalContainer/declaration.d.ts +2 -0
- package/dist/elements/structure/ModalContainer/declaration.mjs +2 -0
- package/dist/elements/structure/ModalContainer/index.d.ts +3 -1
- package/dist/elements/structure/Pagination/Pagination.d.ts +1 -1
- package/dist/elements/structure/Pagination/declaration.d.ts +1 -0
- package/dist/elements/structure/Pagination/declaration.mjs +5 -0
- package/dist/elements/structure/Pagination/index.d.ts +2 -1
- package/dist/elements/structure/TabContainer/TabContainer.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerBody/TabContainerBody.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerBody/index.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerHeader/TabContainerHeader.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerHeader/index.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/declaration.d.ts +6 -0
- package/dist/elements/structure/TabContainer/TabContainerItem/declaration.mjs +6 -0
- package/dist/elements/structure/TabContainer/TabContainerItem/index.d.ts +7 -1
- package/dist/elements/structure/TabContainer/index.d.ts +10 -4
- package/dist/index.d.ts +216 -51
- package/dist/index.mjs +39 -37
- package/package.json +8 -8
- package/dist/elements/provider/ApiContainer/helpers/isEmptyAnswer.d.ts +0 -16
- package/dist/elements/provider/ApiContainer/helpers/isEmptyAnswer.mjs +0 -4
|
@@ -148,6 +148,19 @@ var n = {
|
|
|
148
148
|
}
|
|
149
149
|
}), h = { field: l }, g = e()({
|
|
150
150
|
type: "formControl",
|
|
151
|
+
contentAttributes: [
|
|
152
|
+
"label",
|
|
153
|
+
"placeholder",
|
|
154
|
+
"options",
|
|
155
|
+
"requiredMessage",
|
|
156
|
+
"minLengthMessage",
|
|
157
|
+
"maxLengthMessage",
|
|
158
|
+
"minMessage",
|
|
159
|
+
"maxMessage",
|
|
160
|
+
"formatMessage",
|
|
161
|
+
"patternMessage",
|
|
162
|
+
"matchesMessage"
|
|
163
|
+
],
|
|
151
164
|
attributeValues: { subType: t()([
|
|
152
165
|
"text",
|
|
153
166
|
"number",
|
|
@@ -176,6 +189,7 @@ var n = {
|
|
|
176
189
|
}
|
|
177
190
|
} },
|
|
178
191
|
content: {
|
|
192
|
+
placeholders: ["label"],
|
|
179
193
|
attributes: {
|
|
180
194
|
subType: "text",
|
|
181
195
|
name: "",
|
|
@@ -193,6 +207,11 @@ var n = {
|
|
|
193
207
|
minLengthMessage: "",
|
|
194
208
|
maxLength: 0,
|
|
195
209
|
maxLengthMessage: "",
|
|
210
|
+
min: "",
|
|
211
|
+
minMessage: "",
|
|
212
|
+
max: "",
|
|
213
|
+
maxMessage: "",
|
|
214
|
+
step: "",
|
|
196
215
|
formatMessage: "",
|
|
197
216
|
pattern: "",
|
|
198
217
|
patternMessage: "",
|
|
@@ -202,7 +221,7 @@ var n = {
|
|
|
202
221
|
},
|
|
203
222
|
definition: {
|
|
204
223
|
label: "Form Control",
|
|
205
|
-
description: "A single labelled input (text/select/checkbox/… per its subType) inside a form; captures one field of user input. Optional unless `required: true`, as an HTML field is: a `requiredMessage` alone requires nothing. A select offers its `options`: `[{ label, value }, …]` — the text shown, and what the field takes. A `switch` is a checkbox announced and drawn as an on/off switch (`role=\"switch\"`), for a setting that applies at once; both hold `true`/`false`, and a `defaultValue` of `\"true\"` starts them on. Its slots: `label`, `requiredMark` (the `*` that ends the label of a required field), `input` (the box a typed field or a select is drawn in — a textarea, checkbox or switch is its own box), `field` (the `<input>` or `<select>` inside that box), `icon` (the show/hide button of a password) and `error`. The box is ringed (`2px solid currentColor`) while the field inside has keyboard focus: restyle it with a `focus-within` state on the `input` slot — the box never takes `focus` itself. The thumb of a switch is no element a class reaches: the class on its `input` slot sets `--plitzi-switch-thumb` (off), `--plitzi-switch-thumb-checked` (on, white by default) and `--plitzi-switch-thumb-shadow`.",
|
|
224
|
+
description: "A single labelled input (text/select/checkbox/… per its subType) inside a form; captures one field of user input. Optional unless `required: true`, as an HTML field is: a `requiredMessage` alone requires nothing. A `number` field takes `min` and `max` (each said by its `minMessage`/`maxMessage` when broken) and `step`, written as numbers are — `'2'`; `''` for none. A select offers its `options`: `[{ label, value }, …]` — the text shown, and what the field takes. A `switch` is a checkbox announced and drawn as an on/off switch (`role=\"switch\"`), for a setting that applies at once; both hold `true`/`false`, and a `defaultValue` of `\"true\"` starts them on. Its slots: `label`, `requiredMark` (the `*` that ends the label of a required field), `input` (the box a typed field or a select is drawn in — a textarea, checkbox or switch is its own box), `field` (the `<input>` or `<select>` inside that box), `icon` (the show/hide button of a password) and `error`. The box is ringed (`2px solid currentColor`) while the field inside has keyboard focus: restyle it with a `focus-within` state on the `input` slot — the box never takes `focus` itself. The thumb of a switch is no element a class reaches: the class on its `input` slot sets `--plitzi-switch-thumb` (off), `--plitzi-switch-thumb-checked` (on, white by default) and `--plitzi-switch-thumb-shadow`.",
|
|
206
225
|
styleSelectors: {
|
|
207
226
|
label: "",
|
|
208
227
|
requiredMark: "",
|
|
@@ -237,6 +256,7 @@ var n = {
|
|
|
237
256
|
textarea: m("Form Control Textarea", {
|
|
238
257
|
...r,
|
|
239
258
|
color: "inherit",
|
|
259
|
+
"font-family": "inherit",
|
|
240
260
|
resize: "vertical"
|
|
241
261
|
}),
|
|
242
262
|
select: m("Form Control Select", f, { field: u }),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `run` now — or, when a press is what took the focus away, once that press has landed (its `click` included).
|
|
3
|
+
*
|
|
4
|
+
* A field checked as it loses focus says its error under itself, and what is below it moves down. When the focus left
|
|
5
|
+
* because something below was pressed, it moved between the press and the release, and the click landed on whatever
|
|
6
|
+
* slid under the pointer: a box ticked after a wrong confirmation stayed unticked. Left by the keyboard, nothing is held,
|
|
7
|
+
* and it is checked at once.
|
|
8
|
+
*/
|
|
9
|
+
export declare const afterPress: (run: () => void) => void;
|
|
10
|
+
/** A form control's blur, checking its field — after the press that took the focus, if one did ({@link afterPress}). */
|
|
11
|
+
declare const useBlurValidation: (onValidate?: () => void) => (() => void);
|
|
12
|
+
export default useBlurValidation;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t } from "react";
|
|
2
|
+
//#region src/elements/form/FormControl/helpers/useBlurValidation.ts
|
|
3
|
+
var n = !1, r = !1, i = () => {
|
|
4
|
+
n = !1;
|
|
5
|
+
}, a = () => {
|
|
6
|
+
r || typeof document > "u" || (r = !0, document.addEventListener("pointerdown", () => {
|
|
7
|
+
n = !0;
|
|
8
|
+
}, !0), document.addEventListener("pointerup", i, !0), document.addEventListener("pointercancel", i, !0));
|
|
9
|
+
}, o = (e) => {
|
|
10
|
+
if (!n || typeof document > "u") {
|
|
11
|
+
e();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
let t = () => {
|
|
15
|
+
document.removeEventListener("pointerup", t, !0), document.removeEventListener("pointercancel", t, !0), setTimeout(e, 0);
|
|
16
|
+
};
|
|
17
|
+
document.addEventListener("pointerup", t, !0), document.addEventListener("pointercancel", t, !0);
|
|
18
|
+
}, s = (n) => (t(a, []), e(() => o(() => n?.()), [n]));
|
|
19
|
+
//#endregion
|
|
20
|
+
export { o as afterPress, s as default };
|
|
@@ -12,6 +12,14 @@ export type FieldRules = {
|
|
|
12
12
|
minLengthMessage: string;
|
|
13
13
|
maxLength: number;
|
|
14
14
|
maxLengthMessage: string;
|
|
15
|
+
/**
|
|
16
|
+
* A `number` field's least and greatest value, written as numbers are — `''` for none, since `0` is a bound a field
|
|
17
|
+
* can have (a run's down votes to remove a song could not say they start at 2).
|
|
18
|
+
*/
|
|
19
|
+
min: string;
|
|
20
|
+
minMessage: string;
|
|
21
|
+
max: string;
|
|
22
|
+
maxMessage: string;
|
|
15
23
|
/**
|
|
16
24
|
* The control's `subType`. A type whose value has a shape of its own (see `FORMATS`) is checked against it here,
|
|
17
25
|
* because a form with `noValidate` leaves nobody else to ask for it.
|
|
@@ -15,8 +15,14 @@ var t = "This field is required", n = "This is not in the expected format", r =
|
|
|
15
15
|
let u = c(t), d = Array.from(u).length;
|
|
16
16
|
if (i.minLength > 0 && d < i.minLength) return i.minLengthMessage || `Use at least ${i.minLength} characters`;
|
|
17
17
|
if (i.maxLength > 0 && d > i.maxLength) return i.maxLengthMessage || `Use at most ${i.maxLength} characters`;
|
|
18
|
-
let f =
|
|
19
|
-
|
|
18
|
+
let f = (e) => {
|
|
19
|
+
let t = e.trim() === "" ? NaN : Number(e);
|
|
20
|
+
return Number.isFinite(t) ? t : void 0;
|
|
21
|
+
}, p = i.type === "number" ? Number(u) : NaN, m = f(i.min), h = f(i.max);
|
|
22
|
+
if (Number.isFinite(p) && m !== void 0 && p < m) return i.minMessage || `Use a number from ${String(m)}`;
|
|
23
|
+
if (Number.isFinite(p) && h !== void 0 && p > h) return i.maxMessage || `Use a number up to ${String(h)}`;
|
|
24
|
+
let g = a.get(i.type);
|
|
25
|
+
return g && !g.matches(u) ? i.formatMessage || g.message : i.pattern && !l(u, i.pattern) ? i.patternMessage || n : i.matches && u !== c(e(o, i.matches, "")) ? i.matchesMessage || r : "";
|
|
20
26
|
};
|
|
21
27
|
//#endregion
|
|
22
28
|
export { t as REQUIRED_MESSAGE, o as hasFormat, u as validateField };
|
|
@@ -10,6 +10,10 @@ export type WithFieldValueProps<T> = {
|
|
|
10
10
|
minLengthMessage?: string;
|
|
11
11
|
maxLength?: number;
|
|
12
12
|
maxLengthMessage?: string;
|
|
13
|
+
min?: string;
|
|
14
|
+
minMessage?: string;
|
|
15
|
+
max?: string;
|
|
16
|
+
maxMessage?: string;
|
|
13
17
|
formatMessage?: string;
|
|
14
18
|
pattern?: string;
|
|
15
19
|
patternMessage?: string;
|
|
@@ -8,32 +8,36 @@ import { jsx as l } from "react/jsx-runtime";
|
|
|
8
8
|
//#region src/elements/form/FormControl/hocs/withFieldValue.tsx
|
|
9
9
|
var u = (u) => {
|
|
10
10
|
let d = (o) => {
|
|
11
|
-
let { ref: d, name: f = "", subType: p = "text", defaultValue: m = "", required: h = !0, requiredMessage: g = "", minLength: _ = 0, minLengthMessage: v = "", maxLength: y = 0, maxLengthMessage: b = "",
|
|
12
|
-
!
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
let { ref: d, name: f = "", subType: p = "text", defaultValue: m = "", required: h = !0, requiredMessage: g = "", minLength: _ = 0, minLengthMessage: v = "", maxLength: y = 0, maxLengthMessage: b = "", min: x = "", minMessage: S = "", max: C = "", maxMessage: w = "", formatMessage: T = "", pattern: E = "", patternMessage: D = "", matches: O = "", matchesMessage: k = "", previewError: A = !1 } = o, { settings: { previewMode: j } } = a(), { useStore: M } = c(), [N] = M("runtime.sources.form"), [P, F] = i(m), [I, L] = i(m);
|
|
12
|
+
!N && I !== m && (L(m), F(m));
|
|
13
|
+
let R = N?.values, z = r(() => N ? s(R, f, m) : P, [
|
|
14
|
+
N,
|
|
15
|
+
R,
|
|
16
16
|
f,
|
|
17
17
|
m,
|
|
18
|
-
|
|
19
|
-
]),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
P
|
|
19
|
+
]), B = r(() => !j && A ? "This is an error message" : N?.errors[f] ?? "", [
|
|
20
|
+
j,
|
|
21
|
+
A,
|
|
22
|
+
N?.errors,
|
|
23
23
|
f
|
|
24
|
-
]),
|
|
24
|
+
]), V = r(() => ({
|
|
25
25
|
required: h,
|
|
26
26
|
requiredMessage: g,
|
|
27
27
|
minLength: _,
|
|
28
28
|
minLengthMessage: v,
|
|
29
29
|
maxLength: y,
|
|
30
30
|
maxLengthMessage: b,
|
|
31
|
+
min: x,
|
|
32
|
+
minMessage: S,
|
|
33
|
+
max: C,
|
|
34
|
+
maxMessage: w,
|
|
31
35
|
type: p,
|
|
32
|
-
formatMessage:
|
|
33
|
-
pattern:
|
|
34
|
-
patternMessage:
|
|
35
|
-
matches:
|
|
36
|
-
matchesMessage:
|
|
36
|
+
formatMessage: T,
|
|
37
|
+
pattern: E,
|
|
38
|
+
patternMessage: D,
|
|
39
|
+
matches: O,
|
|
40
|
+
matchesMessage: k
|
|
37
41
|
}), [
|
|
38
42
|
h,
|
|
39
43
|
g,
|
|
@@ -41,53 +45,57 @@ var u = (u) => {
|
|
|
41
45
|
v,
|
|
42
46
|
y,
|
|
43
47
|
b,
|
|
44
|
-
p,
|
|
45
48
|
x,
|
|
46
49
|
S,
|
|
47
50
|
C,
|
|
48
51
|
w,
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
p,
|
|
53
|
+
T,
|
|
54
|
+
E,
|
|
55
|
+
D,
|
|
56
|
+
O,
|
|
57
|
+
k
|
|
58
|
+
]), H = N?.registerValidator, U = N?.unregisterValidator, W = N?.setFieldValue, G = N?.setFieldError;
|
|
51
59
|
n(() => {
|
|
52
|
-
if (f &&
|
|
60
|
+
if (f && H && U) return H(f, (t) => e(s(t, f, m), V, t)), () => U(f);
|
|
53
61
|
}, [
|
|
54
62
|
f,
|
|
55
63
|
m,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
V,
|
|
65
|
+
H,
|
|
66
|
+
U
|
|
59
67
|
]), n(() => {
|
|
60
|
-
|
|
68
|
+
W && m && z && f && W(f, z);
|
|
61
69
|
}, [
|
|
62
70
|
m,
|
|
63
71
|
f,
|
|
64
|
-
|
|
65
|
-
|
|
72
|
+
W,
|
|
73
|
+
z
|
|
66
74
|
]);
|
|
67
|
-
let
|
|
75
|
+
let K = t((e) => {
|
|
68
76
|
let t = e.target.type === "radio" || e.target.type === "checkbox";
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
W ? W(f, t ? e.target.checked : e.target.value) : F(t ? String(e.target.checked) : e.target.value);
|
|
78
|
+
}, [W, f]), q = t(() => G?.(f, e(z, V, R ?? {})), [
|
|
79
|
+
z,
|
|
80
|
+
V,
|
|
81
|
+
R,
|
|
74
82
|
f,
|
|
75
|
-
|
|
83
|
+
G
|
|
76
84
|
]);
|
|
77
85
|
return r(() => /* @__PURE__ */ l(u, {
|
|
78
86
|
...o,
|
|
79
87
|
ref: d,
|
|
80
|
-
value:
|
|
81
|
-
error:
|
|
82
|
-
handleChange:
|
|
83
|
-
handleValidate:
|
|
88
|
+
value: z,
|
|
89
|
+
error: B,
|
|
90
|
+
handleChange: K,
|
|
91
|
+
handleValidate: q
|
|
84
92
|
}), [
|
|
85
93
|
o,
|
|
86
94
|
d,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
B,
|
|
96
|
+
z,
|
|
97
|
+
K,
|
|
98
|
+
q
|
|
91
99
|
]);
|
|
92
100
|
};
|
|
93
101
|
return d.displayName = `withFieldValue(${o(u)})`, d;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const FormControl: {
|
|
2
|
-
(props: import('../../..').WithElementProps<import('./hocs/withFieldValue').WithFieldValueProps<import('./FormControl').FormControlProps>>): import('react').JSX.Element;
|
|
2
|
+
(props: import('../../..').WithElementProps<import('./hocs/withFieldValue').WithFieldValueProps<import('./FormControl').FormControlProps>>): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
3
3
|
displayName: string;
|
|
4
4
|
} & {
|
|
5
5
|
content: {
|
|
@@ -12,6 +12,7 @@ declare const FormControl: {
|
|
|
12
12
|
website: string;
|
|
13
13
|
backgroundColor: string;
|
|
14
14
|
};
|
|
15
|
+
placeholders: readonly ["label"];
|
|
15
16
|
attributes: {
|
|
16
17
|
readonly subType: "text";
|
|
17
18
|
readonly name: "";
|
|
@@ -29,6 +30,11 @@ declare const FormControl: {
|
|
|
29
30
|
readonly minLengthMessage: "";
|
|
30
31
|
readonly maxLength: 0;
|
|
31
32
|
readonly maxLengthMessage: "";
|
|
33
|
+
readonly min: "";
|
|
34
|
+
readonly minMessage: "";
|
|
35
|
+
readonly max: "";
|
|
36
|
+
readonly maxMessage: "";
|
|
37
|
+
readonly step: "";
|
|
32
38
|
readonly formatMessage: "";
|
|
33
39
|
readonly pattern: "";
|
|
34
40
|
readonly patternMessage: "";
|
|
@@ -739,6 +745,7 @@ declare const FormControl: {
|
|
|
739
745
|
settings: Record<string, string | number | boolean>;
|
|
740
746
|
};
|
|
741
747
|
type: "formControl";
|
|
748
|
+
contentAttributes: readonly ["label", "placeholder", "options", "requiredMessage", "minLengthMessage", "maxLengthMessage", "minMessage", "maxMessage", "formatMessage", "patternMessage", "matchesMessage"];
|
|
742
749
|
attributeValues: {
|
|
743
750
|
readonly subType: readonly string[];
|
|
744
751
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "../helpers/useBlurValidation.mjs";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import n from "clsx";
|
|
4
4
|
//#region src/elements/form/FormControl/inputs/Checkbox.tsx
|
|
5
5
|
var r = ({ className: r = "", variant: i = "checkbox", id: a = "", name: o = "", checked: s = !1, required: c = !0, disabled: l = !1, onChange: u, onValidate: d, errorId: f }) => {
|
|
6
|
-
let p = e(
|
|
6
|
+
let p = e(d);
|
|
7
7
|
return /* @__PURE__ */ t("input", {
|
|
8
8
|
className: n(`form-control__${i}-container`, r),
|
|
9
9
|
id: a,
|
|
@@ -16,6 +16,10 @@ export type InputProps = {
|
|
|
16
16
|
required?: boolean;
|
|
17
17
|
/** `0` for none. The one rule the browser enforces itself, and by the kindest means: it stops the typing. */
|
|
18
18
|
maxLength?: number;
|
|
19
|
+
/** A number's least and greatest value and its step, `''` for none: the browser's spinner keeps to them. */
|
|
20
|
+
min?: string;
|
|
21
|
+
max?: string;
|
|
22
|
+
step?: string;
|
|
19
23
|
disabled?: boolean;
|
|
20
24
|
readOnly?: boolean;
|
|
21
25
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -26,5 +30,5 @@ export type InputProps = {
|
|
|
26
30
|
*/
|
|
27
31
|
errorId?: string;
|
|
28
32
|
};
|
|
29
|
-
declare const Input: ({ className, fieldClassName, iconClassName, id, name, placeholder, value, type, autoComplete, autoFocus, required, maxLength, disabled, readOnly, onChange, onValidate, errorId }: InputProps) => import('react').JSX.Element;
|
|
33
|
+
declare const Input: ({ className, fieldClassName, iconClassName, id, name, placeholder, value, type, autoComplete, autoFocus, required, maxLength, min, max, step, disabled, readOnly, onChange, onValidate, errorId }: InputProps) => import('react').JSX.Element;
|
|
30
34
|
export default Input;
|
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import o from "
|
|
1
|
+
import e from "../helpers/useBlurValidation.mjs";
|
|
2
|
+
import t from "./useFocusWhenShown.mjs";
|
|
3
|
+
import { useCallback as n, useRef as r, useState as i } from "react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
import s from "clsx";
|
|
5
6
|
//#region src/elements/form/FormControl/inputs/Input.tsx
|
|
6
|
-
var
|
|
7
|
-
let [
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
let t =
|
|
11
|
-
if (t?.focus(),
|
|
7
|
+
var c = ({ className: c = "", fieldClassName: l, iconClassName: u, id: d = "", name: f = "", placeholder: p = "", value: m = "", type: h = "text", autoComplete: g = !1, autoFocus: _ = !1, required: v = !0, maxLength: y = 0, min: b = "", max: x = "", step: S = "", disabled: C = !1, readOnly: w = !1, onChange: T, onValidate: E, errorId: D }) => {
|
|
8
|
+
let [O, k] = i(!1), A = r(null);
|
|
9
|
+
t(A, _);
|
|
10
|
+
let j = n(() => k((e) => !e), [k]), M = n((e) => {
|
|
11
|
+
let t = A.current;
|
|
12
|
+
if (t?.focus(), h === "color" && t && e.target !== t) try {
|
|
12
13
|
t.showPicker();
|
|
13
14
|
} catch {}
|
|
14
|
-
}, [
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
className:
|
|
17
|
-
onClick:
|
|
18
|
-
children: [/* @__PURE__ */
|
|
19
|
-
ref:
|
|
20
|
-
className:
|
|
21
|
-
id:
|
|
22
|
-
"aria-invalid":
|
|
23
|
-
"aria-describedby":
|
|
24
|
-
name:
|
|
25
|
-
type:
|
|
26
|
-
placeholder:
|
|
27
|
-
value:
|
|
28
|
-
required:
|
|
29
|
-
maxLength:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
}, [A, h]), N = e(E);
|
|
16
|
+
return /* @__PURE__ */ o("div", {
|
|
17
|
+
className: s("form-control__input-container", c),
|
|
18
|
+
onClick: M,
|
|
19
|
+
children: [/* @__PURE__ */ a("input", {
|
|
20
|
+
ref: A,
|
|
21
|
+
className: s("input-container__input", l),
|
|
22
|
+
id: d,
|
|
23
|
+
"aria-invalid": D ? !0 : void 0,
|
|
24
|
+
"aria-describedby": D,
|
|
25
|
+
name: f,
|
|
26
|
+
type: h === "password" && O ? "text" : h,
|
|
27
|
+
placeholder: p,
|
|
28
|
+
value: m,
|
|
29
|
+
required: v,
|
|
30
|
+
maxLength: y > 0 ? y : void 0,
|
|
31
|
+
min: h === "number" && b !== "" ? b : void 0,
|
|
32
|
+
max: h === "number" && x !== "" ? x : void 0,
|
|
33
|
+
step: h === "number" && S !== "" ? S : void 0,
|
|
34
|
+
autoComplete: g ? "on" : "off",
|
|
35
|
+
disabled: C,
|
|
36
|
+
readOnly: w,
|
|
37
|
+
onChange: T,
|
|
38
|
+
onBlur: N
|
|
39
|
+
}), h === "password" && /* @__PURE__ */ a("button", {
|
|
36
40
|
type: "button",
|
|
37
|
-
className:
|
|
38
|
-
"aria-pressed":
|
|
41
|
+
className: s("form-input__icon", u),
|
|
42
|
+
"aria-pressed": O,
|
|
39
43
|
title: "Show password",
|
|
40
|
-
onClick:
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
className:
|
|
44
|
+
onClick: j,
|
|
45
|
+
children: /* @__PURE__ */ a("i", {
|
|
46
|
+
className: O ? "fa-solid fa-eye-slash" : "fa-solid fa-eye",
|
|
43
47
|
"aria-hidden": "true"
|
|
44
48
|
})
|
|
45
49
|
})]
|
|
46
50
|
});
|
|
47
51
|
};
|
|
48
52
|
//#endregion
|
|
49
|
-
export {
|
|
53
|
+
export { c as default };
|
|
@@ -12,6 +12,10 @@ export type SelectProps = {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
/** The `<select>` inside the box — the `field` slot. */
|
|
14
14
|
fieldClassName?: string;
|
|
15
|
+
/** Takes the focus while true: as it becomes true, whether on mount or as the field is shown again. */
|
|
16
|
+
autoFocus?: boolean;
|
|
17
|
+
/** A required select left on its placeholder (the empty value) stops the submit, as any required field does. */
|
|
18
|
+
required?: boolean;
|
|
15
19
|
disabled?: boolean;
|
|
16
20
|
onChange?: (e: ChangeEvent<HTMLSelectElement>) => void;
|
|
17
21
|
onValidate?: () => void;
|
|
@@ -21,5 +25,5 @@ export type SelectProps = {
|
|
|
21
25
|
*/
|
|
22
26
|
errorId?: string;
|
|
23
27
|
};
|
|
24
|
-
declare const Select: ({ id, name, options, placeholder, value, className, fieldClassName, disabled, onChange, onValidate, errorId }: SelectProps) => import('react').JSX.Element;
|
|
28
|
+
declare const Select: ({ id, name, options, placeholder, value, className, fieldClassName, autoFocus, required, disabled, onChange, onValidate, errorId }: SelectProps) => import('react').JSX.Element;
|
|
25
29
|
export default Select;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import e from "../helpers/useBlurValidation.mjs";
|
|
2
|
+
import t from "./useFocusWhenShown.mjs";
|
|
3
|
+
import { useCallback as n, useMemo as r, useRef as i } from "react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
import s from "clsx";
|
|
4
6
|
//#region src/elements/form/FormControl/inputs/Select.tsx
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var c = ({ id: c = "", name: l, options: u = [], placeholder: d = "", value: f = "", className: p = "", fieldClassName: m, autoFocus: h = !1, required: g = !1, disabled: _ = !1, onChange: v, onValidate: y, errorId: b }) => {
|
|
8
|
+
let x = i(null);
|
|
9
|
+
t(x, h);
|
|
10
|
+
let S = n(() => {
|
|
11
|
+
x.current?.click();
|
|
12
|
+
}, [x]), C = n((e) => {
|
|
9
13
|
e.stopPropagation();
|
|
10
|
-
}, []),
|
|
14
|
+
}, []), w = e(y), T = r(() => Array.isArray(u) ? u.map((e) => {
|
|
11
15
|
if (typeof e == "string") return {
|
|
12
16
|
value: e,
|
|
13
17
|
label: e
|
|
@@ -23,26 +27,27 @@ var o = ({ id: o = "", name: s, options: c = [], placeholder: l = "", value: u =
|
|
|
23
27
|
value: e.value,
|
|
24
28
|
label: e.label
|
|
25
29
|
};
|
|
26
|
-
}) : [], [
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
className:
|
|
29
|
-
onClick:
|
|
30
|
-
children: /* @__PURE__ */
|
|
31
|
-
ref:
|
|
32
|
-
id:
|
|
33
|
-
"aria-invalid":
|
|
34
|
-
"aria-describedby":
|
|
35
|
-
name:
|
|
36
|
-
onChange:
|
|
37
|
-
value:
|
|
38
|
-
className:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
}) : [], [u]);
|
|
31
|
+
return /* @__PURE__ */ a("div", {
|
|
32
|
+
className: s("form-control__select-container", p),
|
|
33
|
+
onClick: S,
|
|
34
|
+
children: /* @__PURE__ */ o("select", {
|
|
35
|
+
ref: x,
|
|
36
|
+
id: c,
|
|
37
|
+
"aria-invalid": b ? !0 : void 0,
|
|
38
|
+
"aria-describedby": b,
|
|
39
|
+
name: l,
|
|
40
|
+
onChange: v,
|
|
41
|
+
value: f,
|
|
42
|
+
className: s("select-container__select", m),
|
|
43
|
+
required: g,
|
|
44
|
+
disabled: _,
|
|
45
|
+
onClick: C,
|
|
46
|
+
onBlur: w,
|
|
47
|
+
children: [d && /* @__PURE__ */ a("option", {
|
|
43
48
|
value: "",
|
|
44
|
-
children:
|
|
45
|
-
}),
|
|
49
|
+
children: d
|
|
50
|
+
}), T.map((e, t) => /* @__PURE__ */ a("option", {
|
|
46
51
|
value: e.value,
|
|
47
52
|
children: e.label
|
|
48
53
|
}, t))]
|
|
@@ -50,4 +55,4 @@ var o = ({ id: o = "", name: s, options: c = [], placeholder: l = "", value: u =
|
|
|
50
55
|
});
|
|
51
56
|
};
|
|
52
57
|
//#endregion
|
|
53
|
-
export {
|
|
58
|
+
export { c as default };
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import i from "
|
|
1
|
+
import e from "../helpers/useBlurValidation.mjs";
|
|
2
|
+
import t from "./useFocusWhenShown.mjs";
|
|
3
|
+
import { useCallback as n, useRef as r } from "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
import a from "clsx";
|
|
5
6
|
//#region src/elements/form/FormControl/inputs/Textarea.tsx
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
let
|
|
7
|
+
var o = ({ className: o = "", id: s = "", name: c = "", placeholder: l = "", value: u = "", autoFocus: d = !1, required: f = !1, maxLength: p = 0, disabled: m = !1, readOnly: h = !1, onChange: g, onValidate: _, errorId: v }) => {
|
|
8
|
+
let y = r(null);
|
|
9
|
+
t(y, d);
|
|
10
|
+
let b = n((e) => {
|
|
10
11
|
e.stopPropagation();
|
|
11
|
-
}, []),
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
ref:
|
|
14
|
-
className:
|
|
15
|
-
id:
|
|
16
|
-
"aria-invalid":
|
|
17
|
-
"aria-describedby":
|
|
18
|
-
name:
|
|
19
|
-
placeholder:
|
|
20
|
-
value:
|
|
21
|
-
readOnly:
|
|
22
|
-
required:
|
|
23
|
-
maxLength:
|
|
24
|
-
disabled:
|
|
25
|
-
onChange:
|
|
26
|
-
onBlur:
|
|
27
|
-
onClick:
|
|
12
|
+
}, []), x = e(_);
|
|
13
|
+
return /* @__PURE__ */ i("textarea", {
|
|
14
|
+
ref: y,
|
|
15
|
+
className: a("form-control__textarea-container", o),
|
|
16
|
+
id: s,
|
|
17
|
+
"aria-invalid": v ? !0 : void 0,
|
|
18
|
+
"aria-describedby": v,
|
|
19
|
+
name: c,
|
|
20
|
+
placeholder: l,
|
|
21
|
+
value: u,
|
|
22
|
+
readOnly: h,
|
|
23
|
+
required: f,
|
|
24
|
+
maxLength: p > 0 ? p : void 0,
|
|
25
|
+
disabled: m,
|
|
26
|
+
onChange: g,
|
|
27
|
+
onBlur: x,
|
|
28
|
+
onClick: b
|
|
28
29
|
});
|
|
29
30
|
};
|
|
30
31
|
//#endregion
|
|
31
|
-
export {
|
|
32
|
+
export { o as default };
|
|
@@ -3,5 +3,5 @@ import { RefObject } from 'react';
|
|
|
3
3
|
* A field that takes the focus each time it is shown: as it mounts, and again whenever it — or anything it is in — goes
|
|
4
4
|
* from hidden to shown. The native `autofocus` only acts on insertion, and a panel that hides keeps its field mounted.
|
|
5
5
|
*/
|
|
6
|
-
declare const useFocusWhenShown: (ref: RefObject<HTMLInputElement | HTMLTextAreaElement | null>, shown: boolean) => void;
|
|
6
|
+
declare const useFocusWhenShown: (ref: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null>, shown: boolean) => void;
|
|
7
7
|
export default useFocusWhenShown;
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { default as LayoutContainer } from './internal/LayoutContainer';
|
|
|
18
18
|
import { default as Loading } from './internal/Loading';
|
|
19
19
|
import { default as NotFound } from './internal/NotFound';
|
|
20
20
|
import { default as Page } from './internal/Page';
|
|
21
|
+
import { default as Chart } from './media/Chart';
|
|
21
22
|
import { default as Embed } from './media/Embed';
|
|
22
23
|
import { default as FontAwesome } from './media/FontAwesome';
|
|
23
24
|
import { default as Image } from './media/Image';
|
|
@@ -54,6 +55,7 @@ export * from './internal/Page';
|
|
|
54
55
|
export * from './media/FontAwesome';
|
|
55
56
|
export * from './media/Embed';
|
|
56
57
|
export * from './media/Image';
|
|
58
|
+
export * from './media/Chart';
|
|
57
59
|
export * from './media/Svg';
|
|
58
60
|
export * from './media/Video';
|
|
59
61
|
export * from './provider/ApiContainer';
|
|
@@ -65,4 +67,4 @@ export * from './structure/ModalContainer';
|
|
|
65
67
|
export * from './structure/Pagination';
|
|
66
68
|
export * from './structure/Carousel';
|
|
67
69
|
export * from './structure/TabContainer';
|
|
68
|
-
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Carousel, Heading, Image, Video, Embed, Svg, FontAwesome, Button, Paragraph, RichText, Text, ThemeToggle, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer, Channel };
|
|
70
|
+
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Carousel, Heading, Image, Video, Embed, Chart, Svg, FontAwesome, Button, Paragraph, RichText, Text, ThemeToggle, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer, Channel };
|