@unoff/ui 1.21.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/LICENSE +21 -0
- package/README.md +880 -0
- package/dist/assets/Accordion.css +1 -0
- package/dist/assets/ActionsItem.css +1 -0
- package/dist/assets/ActionsList.css +1 -0
- package/dist/assets/Avatar.css +1 -0
- package/dist/assets/Bar.css +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/Card.css +1 -0
- package/dist/assets/Chip.css +1 -0
- package/dist/assets/ColorChip.css +1 -0
- package/dist/assets/ColorItem.css +1 -0
- package/dist/assets/Consent.css +1 -0
- package/dist/assets/Dialog.css +1 -0
- package/dist/assets/DraggableItem.css +1 -0
- package/dist/assets/DraggableWindow.css +1 -0
- package/dist/assets/Drawer.css +1 -0
- package/dist/assets/Dropdown.css +1 -0
- package/dist/assets/Dropzone.css +1 -0
- package/dist/assets/FormItem.css +1 -0
- package/dist/assets/Icon.css +1 -0
- package/dist/assets/IconChip.css +1 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/InputsBar.css +1 -0
- package/dist/assets/KeyboardShortcutItem.css +1 -0
- package/dist/assets/Knob.css +1 -0
- package/dist/assets/Layout.css +1 -0
- package/dist/assets/List.css +1 -0
- package/dist/assets/MembersList.css +1 -0
- package/dist/assets/Menu.css +1 -0
- package/dist/assets/Message.css +1 -0
- package/dist/assets/MultipleSlider.css +1 -0
- package/dist/assets/Notification.css +1 -0
- package/dist/assets/Popin.css +1 -0
- package/dist/assets/Section.css +1 -0
- package/dist/assets/SectionTitle.css +1 -0
- package/dist/assets/Select.css +1 -0
- package/dist/assets/SemanticMessage.css +1 -0
- package/dist/assets/SimpleItem.css +1 -0
- package/dist/assets/SimpleSlider.css +1 -0
- package/dist/assets/SortableList.css +1 -0
- package/dist/assets/Tabs.css +1 -0
- package/dist/assets/Text.css +1 -0
- package/dist/assets/Thumbnail.css +1 -0
- package/dist/assets/Tooltip.css +1 -0
- package/dist/assets/styles/icons/icons.css +1 -0
- package/dist/assets/styles/icons/styles/figma.css +1 -0
- package/dist/assets/styles/icons/styles/framer.css +1 -0
- package/dist/assets/styles/icons/styles/penpot.css +1 -0
- package/dist/assets/styles/icons/styles/sketch.css +1 -0
- package/dist/assets/styles/layouts.css +1 -0
- package/dist/assets/styles/texts/styles/figma.css +1 -0
- package/dist/assets/styles/texts/styles/framer.css +1 -0
- package/dist/assets/styles/texts/styles/penpot.css +1 -0
- package/dist/assets/styles/texts/styles/sketch.css +1 -0
- package/dist/assets/styles/texts/texts.css +1 -0
- package/dist/assets/styles/tokens/figma-types.css +1 -0
- package/dist/assets/styles/tokens/framer-types.css +1 -0
- package/dist/assets/styles/tokens/modules/figma-colors.css +1 -0
- package/dist/assets/styles/tokens/modules/figma-types.css +1 -0
- package/dist/assets/styles/tokens/modules/framer-colors.css +1 -0
- package/dist/assets/styles/tokens/modules/framer-types.css +1 -0
- package/dist/assets/styles/tokens/modules/globals.css +1 -0
- package/dist/assets/styles/tokens/modules/penpot-colors.css +1 -0
- package/dist/assets/styles/tokens/modules/penpot-types.css +1 -0
- package/dist/assets/styles/tokens/modules/sketch-colors.css +1 -0
- package/dist/assets/styles/tokens/modules/sketch-types.css +1 -0
- package/dist/assets/styles/tokens/penpot-types.css +1 -0
- package/dist/assets/styles/tokens/sketch-types.css +1 -0
- package/dist/components/actions/accordion/Accordion.d.ts +59 -0
- package/dist/components/actions/accordion/Accordion.d.ts.map +1 -0
- package/dist/components/actions/accordion/Accordion.js +104 -0
- package/dist/components/actions/accordion/Accordion.js.map +1 -0
- package/dist/components/actions/button/Button.d.ts +148 -0
- package/dist/components/actions/button/Button.d.ts.map +1 -0
- package/dist/components/actions/button/Button.figma.d.ts +2 -0
- package/dist/components/actions/button/Button.figma.d.ts.map +1 -0
- package/dist/components/actions/button/Button.figma.js +43 -0
- package/dist/components/actions/button/Button.figma.js.map +1 -0
- package/dist/components/actions/button/Button.js +306 -0
- package/dist/components/actions/button/Button.js.map +1 -0
- package/dist/components/actions/card/Card.d.ts +39 -0
- package/dist/components/actions/card/Card.d.ts.map +1 -0
- package/dist/components/actions/card/Card.js +99 -0
- package/dist/components/actions/card/Card.js.map +1 -0
- package/dist/components/actions/knob/Knob.d.ts +93 -0
- package/dist/components/actions/knob/Knob.d.ts.map +1 -0
- package/dist/components/actions/knob/Knob.js +179 -0
- package/dist/components/actions/knob/Knob.js.map +1 -0
- package/dist/components/actions/menu/Menu.d.ts +104 -0
- package/dist/components/actions/menu/Menu.d.ts.map +1 -0
- package/dist/components/actions/menu/Menu.js +200 -0
- package/dist/components/actions/menu/Menu.js.map +1 -0
- package/dist/components/assets/avatar/Avatar.d.ts +30 -0
- package/dist/components/assets/avatar/Avatar.d.ts.map +1 -0
- package/dist/components/assets/avatar/Avatar.js +54 -0
- package/dist/components/assets/avatar/Avatar.js.map +1 -0
- package/dist/components/assets/icon/Icon.d.ts +28 -0
- package/dist/components/assets/icon/Icon.d.ts.map +1 -0
- package/dist/components/assets/icon/Icon.figma.d.ts +2 -0
- package/dist/components/assets/icon/Icon.figma.d.ts.map +1 -0
- package/dist/components/assets/icon/Icon.figma.js +27 -0
- package/dist/components/assets/icon/Icon.figma.js.map +1 -0
- package/dist/components/assets/icon/Icon.js +35 -0
- package/dist/components/assets/icon/Icon.js.map +1 -0
- package/dist/components/assets/section-title/SectionTitle.d.ts +22 -0
- package/dist/components/assets/section-title/SectionTitle.d.ts.map +1 -0
- package/dist/components/assets/section-title/SectionTitle.js +42 -0
- package/dist/components/assets/section-title/SectionTitle.js.map +1 -0
- package/dist/components/assets/text/Text.d.ts +34 -0
- package/dist/components/assets/text/Text.d.ts.map +1 -0
- package/dist/components/assets/text/Text.js +35 -0
- package/dist/components/assets/text/Text.js.map +1 -0
- package/dist/components/assets/thumbnail/Thumbnail.d.ts +25 -0
- package/dist/components/assets/thumbnail/Thumbnail.d.ts.map +1 -0
- package/dist/components/assets/thumbnail/Thumbnail.js +67 -0
- package/dist/components/assets/thumbnail/Thumbnail.js.map +1 -0
- package/dist/components/dialogs/consent/Consent.d.ts +85 -0
- package/dist/components/dialogs/consent/Consent.d.ts.map +1 -0
- package/dist/components/dialogs/consent/Consent.js +402 -0
- package/dist/components/dialogs/consent/Consent.js.map +1 -0
- package/dist/components/dialogs/dialog/Dialog.d.ts +81 -0
- package/dist/components/dialogs/dialog/Dialog.d.ts.map +1 -0
- package/dist/components/dialogs/dialog/Dialog.js +58 -0
- package/dist/components/dialogs/dialog/Dialog.js.map +1 -0
- package/dist/components/dialogs/message/Message.d.ts +25 -0
- package/dist/components/dialogs/message/Message.d.ts.map +1 -0
- package/dist/components/dialogs/message/Message.js +141 -0
- package/dist/components/dialogs/message/Message.js.map +1 -0
- package/dist/components/dialogs/notification/Notification.d.ts +22 -0
- package/dist/components/dialogs/notification/Notification.d.ts.map +1 -0
- package/dist/components/dialogs/notification/Notification.js +38 -0
- package/dist/components/dialogs/notification/Notification.js.map +1 -0
- package/dist/components/dialogs/semantic-message/SemanticMessage.d.ts +40 -0
- package/dist/components/dialogs/semantic-message/SemanticMessage.d.ts.map +1 -0
- package/dist/components/dialogs/semantic-message/SemanticMessage.js +71 -0
- package/dist/components/dialogs/semantic-message/SemanticMessage.js.map +1 -0
- package/dist/components/inputs/dropdown/Dropdown.d.ts +123 -0
- package/dist/components/inputs/dropdown/Dropdown.d.ts.map +1 -0
- package/dist/components/inputs/dropdown/Dropdown.figma.d.ts +2 -0
- package/dist/components/inputs/dropdown/Dropdown.figma.d.ts.map +1 -0
- package/dist/components/inputs/dropdown/Dropdown.figma.js +28 -0
- package/dist/components/inputs/dropdown/Dropdown.figma.js.map +1 -0
- package/dist/components/inputs/dropdown/Dropdown.js +307 -0
- package/dist/components/inputs/dropdown/Dropdown.js.map +1 -0
- package/dist/components/inputs/dropzone/Dropzone.d.ts +78 -0
- package/dist/components/inputs/dropzone/Dropzone.d.ts.map +1 -0
- package/dist/components/inputs/dropzone/Dropzone.js +222 -0
- package/dist/components/inputs/dropzone/Dropzone.js.map +1 -0
- package/dist/components/inputs/input/Input.d.ts +203 -0
- package/dist/components/inputs/input/Input.d.ts.map +1 -0
- package/dist/components/inputs/input/Input.figma.d.ts +2 -0
- package/dist/components/inputs/input/Input.figma.d.ts.map +1 -0
- package/dist/components/inputs/input/Input.figma.js +35 -0
- package/dist/components/inputs/input/Input.figma.js.map +1 -0
- package/dist/components/inputs/input/Input.js +713 -0
- package/dist/components/inputs/input/Input.js.map +1 -0
- package/dist/components/inputs/inputs-bar/InputsBar.d.ts +18 -0
- package/dist/components/inputs/inputs-bar/InputsBar.d.ts.map +1 -0
- package/dist/components/inputs/inputs-bar/InputsBar.js +15 -0
- package/dist/components/inputs/inputs-bar/InputsBar.js.map +1 -0
- package/dist/components/inputs/multiple-slider/MultipleSlider.d.ts +125 -0
- package/dist/components/inputs/multiple-slider/MultipleSlider.d.ts.map +1 -0
- package/dist/components/inputs/multiple-slider/MultipleSlider.js +417 -0
- package/dist/components/inputs/multiple-slider/MultipleSlider.js.map +1 -0
- package/dist/components/inputs/multiple-slider/actions/addStop.d.ts +8 -0
- package/dist/components/inputs/multiple-slider/actions/addStop.d.ts.map +1 -0
- package/dist/components/inputs/multiple-slider/actions/deleteStop.d.ts +8 -0
- package/dist/components/inputs/multiple-slider/actions/deleteStop.d.ts.map +1 -0
- package/dist/components/inputs/multiple-slider/actions/shiftLeftStop.d.ts +5 -0
- package/dist/components/inputs/multiple-slider/actions/shiftLeftStop.d.ts.map +1 -0
- package/dist/components/inputs/multiple-slider/actions/shiftRightStop.d.ts +5 -0
- package/dist/components/inputs/multiple-slider/actions/shiftRightStop.d.ts.map +1 -0
- package/dist/components/inputs/select/Select.d.ts +112 -0
- package/dist/components/inputs/select/Select.d.ts.map +1 -0
- package/dist/components/inputs/select/Select.js +313 -0
- package/dist/components/inputs/select/Select.js.map +1 -0
- package/dist/components/inputs/simple-slider/SimpleSlider.d.ts +93 -0
- package/dist/components/inputs/simple-slider/SimpleSlider.d.ts.map +1 -0
- package/dist/components/inputs/simple-slider/SimpleSlider.js +166 -0
- package/dist/components/inputs/simple-slider/SimpleSlider.js.map +1 -0
- package/dist/components/lists/actions-item/ActionsItem.d.ts +64 -0
- package/dist/components/lists/actions-item/ActionsItem.d.ts.map +1 -0
- package/dist/components/lists/actions-item/ActionsItem.js +115 -0
- package/dist/components/lists/actions-item/ActionsItem.js.map +1 -0
- package/dist/components/lists/actions-list/ActionsList.d.ts +79 -0
- package/dist/components/lists/actions-list/ActionsList.d.ts.map +1 -0
- package/dist/components/lists/actions-list/ActionsList.js +384 -0
- package/dist/components/lists/actions-list/ActionsList.js.map +1 -0
- package/dist/components/lists/color-item/ColorItem.d.ts +27 -0
- package/dist/components/lists/color-item/ColorItem.d.ts.map +1 -0
- package/dist/components/lists/color-item/ColorItem.js +70 -0
- package/dist/components/lists/color-item/ColorItem.js.map +1 -0
- package/dist/components/lists/draggable-item/DraggableItem.d.ts +110 -0
- package/dist/components/lists/draggable-item/DraggableItem.d.ts.map +1 -0
- package/dist/components/lists/draggable-item/DraggableItem.js +176 -0
- package/dist/components/lists/draggable-item/DraggableItem.js.map +1 -0
- package/dist/components/lists/keyboard-shortcut-item/KeyboardShortcutItem.d.ts +19 -0
- package/dist/components/lists/keyboard-shortcut-item/KeyboardShortcutItem.d.ts.map +1 -0
- package/dist/components/lists/keyboard-shortcut-item/KeyboardShortcutItem.js +75 -0
- package/dist/components/lists/keyboard-shortcut-item/KeyboardShortcutItem.js.map +1 -0
- package/dist/components/lists/members-list/MembersList.d.ts +32 -0
- package/dist/components/lists/members-list/MembersList.d.ts.map +1 -0
- package/dist/components/lists/members-list/MembersList.js +117 -0
- package/dist/components/lists/members-list/MembersList.js.map +1 -0
- package/dist/components/lists/sortable-list/SortableList.d.ts +103 -0
- package/dist/components/lists/sortable-list/SortableList.d.ts.map +1 -0
- package/dist/components/lists/sortable-list/SortableList.js +148 -0
- package/dist/components/lists/sortable-list/SortableList.js.map +1 -0
- package/dist/components/lists/tabs/Tabs.d.ts +48 -0
- package/dist/components/lists/tabs/Tabs.d.ts.map +1 -0
- package/dist/components/lists/tabs/Tabs.figma.d.ts +2 -0
- package/dist/components/lists/tabs/Tabs.figma.d.ts.map +1 -0
- package/dist/components/lists/tabs/Tabs.figma.js +31 -0
- package/dist/components/lists/tabs/Tabs.figma.js.map +1 -0
- package/dist/components/lists/tabs/Tabs.js +165 -0
- package/dist/components/lists/tabs/Tabs.js.map +1 -0
- package/dist/components/slots/bar/Bar.d.ts +65 -0
- package/dist/components/slots/bar/Bar.d.ts.map +1 -0
- package/dist/components/slots/bar/Bar.js +100 -0
- package/dist/components/slots/bar/Bar.js.map +1 -0
- package/dist/components/slots/draggable-window/DraggableWindow.d.ts +25 -0
- package/dist/components/slots/draggable-window/DraggableWindow.d.ts.map +1 -0
- package/dist/components/slots/draggable-window/DraggableWindow.js +100 -0
- package/dist/components/slots/draggable-window/DraggableWindow.js.map +1 -0
- package/dist/components/slots/drawer/Drawer.d.ts +78 -0
- package/dist/components/slots/drawer/Drawer.d.ts.map +1 -0
- package/dist/components/slots/drawer/Drawer.js +148 -0
- package/dist/components/slots/drawer/Drawer.js.map +1 -0
- package/dist/components/slots/form-item/FormItem.d.ts +52 -0
- package/dist/components/slots/form-item/FormItem.d.ts.map +1 -0
- package/dist/components/slots/form-item/FormItem.js +89 -0
- package/dist/components/slots/form-item/FormItem.js.map +1 -0
- package/dist/components/slots/layout/Layout.d.ts +34 -0
- package/dist/components/slots/layout/Layout.d.ts.map +1 -0
- package/dist/components/slots/layout/Layout.js +45 -0
- package/dist/components/slots/layout/Layout.js.map +1 -0
- package/dist/components/slots/list/List.d.ts +49 -0
- package/dist/components/slots/list/List.d.ts.map +1 -0
- package/dist/components/slots/list/List.js +55 -0
- package/dist/components/slots/list/List.js.map +1 -0
- package/dist/components/slots/popin/Popin.d.ts +85 -0
- package/dist/components/slots/popin/Popin.d.ts.map +1 -0
- package/dist/components/slots/popin/Popin.js +182 -0
- package/dist/components/slots/popin/Popin.js.map +1 -0
- package/dist/components/slots/section/Section.d.ts +32 -0
- package/dist/components/slots/section/Section.d.ts.map +1 -0
- package/dist/components/slots/section/Section.js +49 -0
- package/dist/components/slots/section/Section.js.map +1 -0
- package/dist/components/slots/simple-item/SimpleItem.d.ts +45 -0
- package/dist/components/slots/simple-item/SimpleItem.d.ts.map +1 -0
- package/dist/components/slots/simple-item/SimpleItem.js +100 -0
- package/dist/components/slots/simple-item/SimpleItem.js.map +1 -0
- package/dist/components/tags/chip/Chip.d.ts +43 -0
- package/dist/components/tags/chip/Chip.d.ts.map +1 -0
- package/dist/components/tags/chip/Chip.figma.d.ts +2 -0
- package/dist/components/tags/chip/Chip.figma.d.ts.map +1 -0
- package/dist/components/tags/chip/Chip.figma.js +18 -0
- package/dist/components/tags/chip/Chip.figma.js.map +1 -0
- package/dist/components/tags/chip/Chip.js +88 -0
- package/dist/components/tags/chip/Chip.js.map +1 -0
- package/dist/components/tags/color-chip/ColorChip.d.ts +36 -0
- package/dist/components/tags/color-chip/ColorChip.d.ts.map +1 -0
- package/dist/components/tags/color-chip/ColorChip.js +39 -0
- package/dist/components/tags/color-chip/ColorChip.js.map +1 -0
- package/dist/components/tags/icon-chip/IconChip.d.ts +42 -0
- package/dist/components/tags/icon-chip/IconChip.d.ts.map +1 -0
- package/dist/components/tags/icon-chip/IconChip.js +54 -0
- package/dist/components/tags/icon-chip/IconChip.js.map +1 -0
- package/dist/components/tags/tooltip/Tooltip.d.ts +25 -0
- package/dist/components/tags/tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/tags/tooltip/Tooltip.js +72 -0
- package/dist/components/tags/tooltip/Tooltip.js.map +1 -0
- package/dist/do-classnames-DSDFCvzy.js +5 -0
- package/dist/do-classnames-DSDFCvzy.js.map +1 -0
- package/dist/do-map-2nhWP1KI.js +8 -0
- package/dist/do-map-2nhWP1KI.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/dist/index_react-CmuCVQet.js +13799 -0
- package/dist/index_react-CmuCVQet.js.map +1 -0
- package/dist/styles/icons/icons.module.js +115 -0
- package/dist/styles/icons/icons.module.js.map +1 -0
- package/dist/styles/layouts.module.js +37 -0
- package/dist/styles/layouts.module.js.map +1 -0
- package/dist/styles/texts/texts.module.js +23 -0
- package/dist/styles/texts/texts.module.js.map +1 -0
- package/dist/styles/tokens/modules/figma-colors.module.js +9 -0
- package/dist/styles/tokens/modules/figma-colors.module.js.map +1 -0
- package/dist/styles/tokens/modules/figma-types.module.js +9 -0
- package/dist/styles/tokens/modules/figma-types.module.js.map +1 -0
- package/dist/styles/tokens/modules/framer-colors.module.js +9 -0
- package/dist/styles/tokens/modules/framer-colors.module.js.map +1 -0
- package/dist/styles/tokens/modules/framer-types.module.js +9 -0
- package/dist/styles/tokens/modules/framer-types.module.js.map +1 -0
- package/dist/styles/tokens/modules/globals.module.js +9 -0
- package/dist/styles/tokens/modules/globals.module.js.map +1 -0
- package/dist/styles/tokens/modules/penpot-colors.module.js +9 -0
- package/dist/styles/tokens/modules/penpot-colors.module.js.map +1 -0
- package/dist/styles/tokens/modules/penpot-types.module.js +9 -0
- package/dist/styles/tokens/modules/penpot-types.module.js.map +1 -0
- package/dist/styles/tokens/modules/sketch-colors.module.js +9 -0
- package/dist/styles/tokens/modules/sketch-colors.module.js.map +1 -0
- package/dist/styles/tokens/modules/sketch-types.module.js +9 -0
- package/dist/styles/tokens/modules/sketch-types.module.js.map +1 -0
- package/dist/tests/setup.d.ts +2 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/types/consent.types.d.ts +10 -0
- package/dist/types/consent.types.d.ts.map +1 -0
- package/dist/types/consent.types.js +2 -0
- package/dist/types/consent.types.js.map +1 -0
- package/dist/types/icon.types.d.ts +2 -0
- package/dist/types/icon.types.d.ts.map +1 -0
- package/dist/types/icon.types.js +2 -0
- package/dist/types/icon.types.js.map +1 -0
- package/dist/types/list.types.d.ts +14 -0
- package/dist/types/list.types.d.ts.map +1 -0
- package/dist/types/list.types.js +2 -0
- package/dist/types/list.types.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
import '../../../assets/Input.css';
|
|
2
|
+
import { jsxs as h, jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import T from "react";
|
|
4
|
+
import m from "../../tags/tooltip/Tooltip.js";
|
|
5
|
+
import y from "../../tags/icon-chip/IconChip.js";
|
|
6
|
+
import x from "../../tags/chip/Chip.js";
|
|
7
|
+
import { Icon as V } from "../../assets/icon/Icon.js";
|
|
8
|
+
import S from "../../actions/button/Button.js";
|
|
9
|
+
import { t as f } from "../../../do-classnames-DSDFCvzy.js";
|
|
10
|
+
class B extends T.Component {
|
|
11
|
+
inputRef;
|
|
12
|
+
textareaRef;
|
|
13
|
+
static defaultProps = {
|
|
14
|
+
icon: void 0,
|
|
15
|
+
state: "DEFAULT",
|
|
16
|
+
step: "1",
|
|
17
|
+
shouldBlur: !1,
|
|
18
|
+
isClearable: !1,
|
|
19
|
+
isFramed: !0,
|
|
20
|
+
canBeEmpty: !0,
|
|
21
|
+
isBlocked: !1,
|
|
22
|
+
isDisabled: !1,
|
|
23
|
+
isNew: !1,
|
|
24
|
+
isAutoFocus: !1,
|
|
25
|
+
isGrowing: !1,
|
|
26
|
+
isFlex: !1
|
|
27
|
+
};
|
|
28
|
+
constructor(t) {
|
|
29
|
+
super(t), this.state = {
|
|
30
|
+
inputValue: t.value,
|
|
31
|
+
lastValidValue: t.value,
|
|
32
|
+
colorValue: t.value,
|
|
33
|
+
lastValidColorValue: t.value,
|
|
34
|
+
isTooltipVisible: !1
|
|
35
|
+
}, this.inputRef = T.createRef(), this.textareaRef = T.createRef();
|
|
36
|
+
}
|
|
37
|
+
componentDidMount() {
|
|
38
|
+
const { isGrowing: t } = this.props;
|
|
39
|
+
this.textareaRef.current && (this.textareaRef.current.style.height = "auto", t && (this.textareaRef.current.style.height = `${this.textareaRef.current.scrollHeight + 2}px`));
|
|
40
|
+
const { isAutoFocus: i } = this.props;
|
|
41
|
+
i && setTimeout(() => {
|
|
42
|
+
this.inputRef.current ? this.inputRef.current.focus() : this.textareaRef.current && this.textareaRef.current.focus();
|
|
43
|
+
}, 1);
|
|
44
|
+
}
|
|
45
|
+
componentDidUpdate(t) {
|
|
46
|
+
const { value: i, isGrowing: a } = this.props;
|
|
47
|
+
t.value !== i && this.setState({
|
|
48
|
+
inputValue: i,
|
|
49
|
+
colorValue: i
|
|
50
|
+
}), t.type === "CODE" && this.textareaRef.current !== null && (this.textareaRef.current.scrollTop = 0), this.textareaRef.current && (this.textareaRef.current.style.height = "auto", a && (this.textareaRef.current.style.height = `${this.textareaRef.current.scrollHeight + 2}px`));
|
|
51
|
+
}
|
|
52
|
+
// Handlers
|
|
53
|
+
onPickColorValue = (t) => {
|
|
54
|
+
const { onPick: i } = this.props, a = t.target.value;
|
|
55
|
+
this.setState({
|
|
56
|
+
inputValue: a,
|
|
57
|
+
colorValue: a,
|
|
58
|
+
lastValidColorValue: a
|
|
59
|
+
}), i && i(t);
|
|
60
|
+
};
|
|
61
|
+
onChangeColorValue = (t) => {
|
|
62
|
+
const { onChange: i } = this.props;
|
|
63
|
+
this.setState({
|
|
64
|
+
inputValue: t.target.value
|
|
65
|
+
}), i && i(t);
|
|
66
|
+
};
|
|
67
|
+
onChangeNumber = (t) => {
|
|
68
|
+
const { onChange: i } = this.props;
|
|
69
|
+
this.setState({
|
|
70
|
+
inputValue: t.target.value
|
|
71
|
+
}), i && i(t);
|
|
72
|
+
};
|
|
73
|
+
onChangeText = (t) => {
|
|
74
|
+
const { onChange: i } = this.props;
|
|
75
|
+
this.setState({
|
|
76
|
+
inputValue: t.target.value
|
|
77
|
+
}), i && i(t);
|
|
78
|
+
};
|
|
79
|
+
onFocus = (t) => {
|
|
80
|
+
const { value: i, onFocus: a, canBeEmpty: e, type: r } = this.props, s = (r === "TEXT" || r === "LONG_TEXT") && !e && i.trim() === "";
|
|
81
|
+
a && !s && a(t);
|
|
82
|
+
};
|
|
83
|
+
onBlur = (t) => {
|
|
84
|
+
const { shouldBlur: i, onBlur: a, canBeEmpty: e, type: r, min: s, max: l } = this.props, { inputValue: n, lastValidValue: o, lastValidColorValue: d } = this.state;
|
|
85
|
+
if (r === "NUMBER") {
|
|
86
|
+
const c = n.trim() === "";
|
|
87
|
+
let u;
|
|
88
|
+
if (parseFloat(n) < parseFloat(s ?? "0") ? u = s ?? "0" : parseFloat(n) > parseFloat(l ?? "100") ? u = l ?? "100" : c ? (u = o, this.setState({
|
|
89
|
+
inputValue: u
|
|
90
|
+
})) : u = n, this.setState({
|
|
91
|
+
inputValue: u ?? n,
|
|
92
|
+
lastValidValue: u ?? n
|
|
93
|
+
}), u !== o && a || i && a) {
|
|
94
|
+
const g = {
|
|
95
|
+
...t,
|
|
96
|
+
target: {
|
|
97
|
+
...t.target,
|
|
98
|
+
value: u,
|
|
99
|
+
closest: t.target.closest?.bind(t.target),
|
|
100
|
+
getAttribute: t.target.getAttribute?.bind(t.target),
|
|
101
|
+
querySelector: t.target.querySelector?.bind(t.target),
|
|
102
|
+
querySelectorAll: t.target.querySelectorAll?.bind(t.target),
|
|
103
|
+
matches: t.target.matches?.bind(t.target),
|
|
104
|
+
contains: t.target.contains?.bind(t.target),
|
|
105
|
+
classList: t.target.classList,
|
|
106
|
+
dataset: t.target.dataset
|
|
107
|
+
},
|
|
108
|
+
currentTarget: {
|
|
109
|
+
...t.currentTarget,
|
|
110
|
+
value: u,
|
|
111
|
+
closest: t.currentTarget.closest?.bind(t.currentTarget),
|
|
112
|
+
getAttribute: t.currentTarget.getAttribute?.bind(t.currentTarget),
|
|
113
|
+
querySelector: t.currentTarget.querySelector?.bind(t.currentTarget),
|
|
114
|
+
querySelectorAll: t.currentTarget.querySelectorAll?.bind(
|
|
115
|
+
t.currentTarget
|
|
116
|
+
),
|
|
117
|
+
matches: t.currentTarget.matches?.bind(t.currentTarget),
|
|
118
|
+
contains: t.currentTarget.contains?.bind(t.currentTarget),
|
|
119
|
+
classList: t.currentTarget.classList,
|
|
120
|
+
dataset: t.currentTarget.dataset
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
a(
|
|
124
|
+
g
|
|
125
|
+
);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (r === "COLOR") {
|
|
130
|
+
const c = this.transformColorCode(t.target.value);
|
|
131
|
+
if (this.setState({
|
|
132
|
+
inputValue: c,
|
|
133
|
+
colorValue: c,
|
|
134
|
+
lastValidColorValue: c
|
|
135
|
+
}), c !== d && a !== void 0 || i && a !== void 0) {
|
|
136
|
+
const u = {
|
|
137
|
+
...t,
|
|
138
|
+
target: {
|
|
139
|
+
...t.target,
|
|
140
|
+
value: c,
|
|
141
|
+
closest: t.target.closest?.bind(t.target),
|
|
142
|
+
getAttribute: t.target.getAttribute?.bind(t.target),
|
|
143
|
+
querySelector: t.target.querySelector?.bind(t.target),
|
|
144
|
+
querySelectorAll: t.target.querySelectorAll?.bind(t.target),
|
|
145
|
+
matches: t.target.matches?.bind(t.target),
|
|
146
|
+
contains: t.target.contains?.bind(t.target),
|
|
147
|
+
classList: t.target.classList,
|
|
148
|
+
dataset: t.target.dataset
|
|
149
|
+
},
|
|
150
|
+
currentTarget: {
|
|
151
|
+
...t.currentTarget,
|
|
152
|
+
value: c,
|
|
153
|
+
closest: t.currentTarget.closest?.bind(t.currentTarget),
|
|
154
|
+
getAttribute: t.currentTarget.getAttribute?.bind(t.currentTarget),
|
|
155
|
+
querySelector: t.currentTarget.querySelector?.bind(t.currentTarget),
|
|
156
|
+
querySelectorAll: t.currentTarget.querySelectorAll?.bind(
|
|
157
|
+
t.currentTarget
|
|
158
|
+
),
|
|
159
|
+
matches: t.currentTarget.matches?.bind(t.currentTarget),
|
|
160
|
+
contains: t.currentTarget.contains?.bind(t.currentTarget),
|
|
161
|
+
classList: t.currentTarget.classList,
|
|
162
|
+
dataset: t.currentTarget.dataset
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
a(
|
|
166
|
+
u
|
|
167
|
+
);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (r === "TEXT" || r === "LONG_TEXT") {
|
|
172
|
+
const c = n.trim() === "";
|
|
173
|
+
if ((r === "TEXT" || r === "LONG_TEXT") && !e && c) {
|
|
174
|
+
this.setState({
|
|
175
|
+
inputValue: o
|
|
176
|
+
});
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (this.setState({
|
|
180
|
+
lastValidValue: n
|
|
181
|
+
}), n !== o && a || i && a) {
|
|
182
|
+
a(t);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
// Direct Actions
|
|
188
|
+
onValidText = (t) => {
|
|
189
|
+
const { onValid: i } = this.props, a = t.target;
|
|
190
|
+
t.key === "Enter" ? (i !== void 0 && i(t), a.blur()) : t.key === "Escape" && a.blur();
|
|
191
|
+
};
|
|
192
|
+
onValidLongText = (t) => {
|
|
193
|
+
const { onValid: i } = this.props, a = t.target;
|
|
194
|
+
(t.ctrlKey || t.metaKey) && t.key === "Enter" ? (i !== void 0 && i(t), a.blur()) : t.key === "Escape" && a.blur();
|
|
195
|
+
};
|
|
196
|
+
onValidNumber = (t) => {
|
|
197
|
+
const { min: i, max: a, step: e, onShift: r } = this.props, { inputValue: s } = this.state, l = t.target;
|
|
198
|
+
let n = 0;
|
|
199
|
+
if (t.key === "ArrowUp") {
|
|
200
|
+
t.shiftKey && (n = 9);
|
|
201
|
+
const o = parseFloat(s) + n < parseFloat(a ?? "100") ? (parseFloat(s) + n * parseFloat(e === void 0 ? "1" : e)).toString() : a ?? "100";
|
|
202
|
+
this.setState({
|
|
203
|
+
inputValue: o,
|
|
204
|
+
lastValidValue: o
|
|
205
|
+
}), parseFloat(s) + n < parseFloat(a ?? "100") && r?.(t);
|
|
206
|
+
} else if (t.key === "ArrowDown") {
|
|
207
|
+
t.shiftKey && (n = 9);
|
|
208
|
+
const o = parseFloat(s) - n > parseFloat(i ?? "0") ? (parseFloat(s) - n * parseFloat(e === void 0 ? "1" : e)).toString() : i ?? "0";
|
|
209
|
+
this.setState({
|
|
210
|
+
inputValue: o,
|
|
211
|
+
lastValidValue: o
|
|
212
|
+
}), parseFloat(s) - n > parseFloat(i ?? "0") && r?.(t);
|
|
213
|
+
} else (t.key === "Enter" || t.key === "Escape") && (parseFloat(s) < parseFloat(i ?? "0") ? this.setState({
|
|
214
|
+
inputValue: i ?? "0"
|
|
215
|
+
}) : parseFloat(s) > parseFloat(a ?? "100") && this.setState({
|
|
216
|
+
inputValue: a ?? "100"
|
|
217
|
+
}), l.blur());
|
|
218
|
+
};
|
|
219
|
+
onValidColor = (t) => {
|
|
220
|
+
const { onValid: i } = this.props, a = t.target;
|
|
221
|
+
t.key === "Enter" ? (i !== void 0 && i(t), a.blur()) : t.key === "Escape" && a.blur();
|
|
222
|
+
};
|
|
223
|
+
doClear = () => this.setState({ inputValue: "" });
|
|
224
|
+
onGrab = () => {
|
|
225
|
+
this.inputRef.current && this.inputRef.current.focus(), document.addEventListener("mousemove", this.onDrag);
|
|
226
|
+
};
|
|
227
|
+
onDrag = (t) => {
|
|
228
|
+
this.inputRef.current && this.inputRef.current.focus();
|
|
229
|
+
const { min: i, max: a, onSlide: e } = this.props, { inputValue: r } = this.state, s = parseFloat(i ?? "0"), l = parseFloat(a ?? "100"), o = parseFloat(r) + t.movementX;
|
|
230
|
+
if (o >= s && o <= l && (this.setState({
|
|
231
|
+
inputValue: o.toString()
|
|
232
|
+
}), this.inputRef.current)) {
|
|
233
|
+
const d = new Event("input", { bubbles: !0 });
|
|
234
|
+
Object.defineProperty(d, "target", {
|
|
235
|
+
value: this.inputRef.current,
|
|
236
|
+
enumerable: !0
|
|
237
|
+
}), Object.defineProperty(d, "currentTarget", {
|
|
238
|
+
value: this.inputRef.current,
|
|
239
|
+
enumerable: !0
|
|
240
|
+
}), e?.(d);
|
|
241
|
+
}
|
|
242
|
+
document.body.style.setProperty("cursor", "ew-resize", "important"), this.inputRef.current?.style.setProperty("cursor", "ew-resize", "important"), document.addEventListener("mouseup", () => {
|
|
243
|
+
document.removeEventListener("mousemove", this.onDrag), document.body.style.cursor = "", this.inputRef.current && (this.inputRef.current.style.cursor = "");
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
transformColorCode = (t) => {
|
|
247
|
+
const { lastValidColorValue: i } = this.state, e = (t.startsWith("#") ? t.substring(1) : t).toLowerCase().split("").filter((s) => /[0-9a-f]/i.test(s));
|
|
248
|
+
if (e.length === 0) return i;
|
|
249
|
+
if (e.length >= 6) return `#${e.slice(0, 6).join("")}`;
|
|
250
|
+
let r = "";
|
|
251
|
+
switch (e.length) {
|
|
252
|
+
case 1:
|
|
253
|
+
r = e[0].repeat(6);
|
|
254
|
+
break;
|
|
255
|
+
case 2:
|
|
256
|
+
r = `${e.join("")}`.repeat(3);
|
|
257
|
+
break;
|
|
258
|
+
case 3:
|
|
259
|
+
r = `${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`;
|
|
260
|
+
break;
|
|
261
|
+
case 4:
|
|
262
|
+
r = `${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`;
|
|
263
|
+
break;
|
|
264
|
+
case 5:
|
|
265
|
+
r = `${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`;
|
|
266
|
+
break;
|
|
267
|
+
default:
|
|
268
|
+
r = e.slice(0, 6).join("");
|
|
269
|
+
}
|
|
270
|
+
return r.indexOf("#") !== 0 && (r = `#${r}`), r.toLowerCase();
|
|
271
|
+
};
|
|
272
|
+
// Templates
|
|
273
|
+
Status = () => {
|
|
274
|
+
const { warning: t, preview: i, isBlocked: a, isNew: e, onUnblock: r } = this.props;
|
|
275
|
+
if (t || a || e)
|
|
276
|
+
return /* @__PURE__ */ h("div", { className: "input__status", children: [
|
|
277
|
+
t !== void 0 && /* @__PURE__ */ p(
|
|
278
|
+
y,
|
|
279
|
+
{
|
|
280
|
+
iconType: "PICTO",
|
|
281
|
+
iconName: "warning",
|
|
282
|
+
text: t.label,
|
|
283
|
+
pin: t.pin,
|
|
284
|
+
type: t.type
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
(a || e) && /* @__PURE__ */ p(
|
|
288
|
+
x,
|
|
289
|
+
{
|
|
290
|
+
preview: i,
|
|
291
|
+
isSolo: !0,
|
|
292
|
+
action: a ? r : void 0,
|
|
293
|
+
children: e ? "New" : "Pro"
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] });
|
|
297
|
+
};
|
|
298
|
+
Color = () => {
|
|
299
|
+
const { id: t, feature: i, helper: a, isBlocked: e, isDisabled: r, onBlur: s } = this.props, { inputValue: l, colorValue: n, isTooltipVisible: o } = this.state;
|
|
300
|
+
return /* @__PURE__ */ h(
|
|
301
|
+
"div",
|
|
302
|
+
{
|
|
303
|
+
className: f([
|
|
304
|
+
"input",
|
|
305
|
+
"input--color",
|
|
306
|
+
"input--with-color",
|
|
307
|
+
e && "input--blocked"
|
|
308
|
+
]),
|
|
309
|
+
role: "group",
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ h(
|
|
312
|
+
"div",
|
|
313
|
+
{
|
|
314
|
+
className: "input__wrapper",
|
|
315
|
+
onMouseEnter: () => {
|
|
316
|
+
a !== void 0 && this.setState({ isTooltipVisible: !0 });
|
|
317
|
+
},
|
|
318
|
+
onMouseLeave: () => {
|
|
319
|
+
a !== void 0 && this.setState({ isTooltipVisible: !1 });
|
|
320
|
+
},
|
|
321
|
+
children: [
|
|
322
|
+
/* @__PURE__ */ p(
|
|
323
|
+
"input",
|
|
324
|
+
{
|
|
325
|
+
id: t,
|
|
326
|
+
"data-feature": i,
|
|
327
|
+
type: "color",
|
|
328
|
+
className: "input__color",
|
|
329
|
+
value: n,
|
|
330
|
+
disabled: r || e,
|
|
331
|
+
"aria-label": "Color picker",
|
|
332
|
+
"aria-disabled": r || e,
|
|
333
|
+
onChange: r || e ? void 0 : this.onPickColorValue,
|
|
334
|
+
onBlur: r || e ? void 0 : s,
|
|
335
|
+
ref: this.inputRef
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ p(
|
|
339
|
+
"input",
|
|
340
|
+
{
|
|
341
|
+
role: "textbox",
|
|
342
|
+
id: t,
|
|
343
|
+
"data-feature": i,
|
|
344
|
+
type: "text",
|
|
345
|
+
className: "input__field",
|
|
346
|
+
value: l.toUpperCase().replace("#", ""),
|
|
347
|
+
maxLength: 7,
|
|
348
|
+
disabled: r || e,
|
|
349
|
+
"aria-label": "Hex color code",
|
|
350
|
+
"aria-disabled": r || e,
|
|
351
|
+
onChange: r || e ? void 0 : this.onChangeColorValue,
|
|
352
|
+
onFocus: (d) => {
|
|
353
|
+
d.target.select(), this.onFocus(d);
|
|
354
|
+
},
|
|
355
|
+
onKeyDown: r || e ? void 0 : this.onValidColor,
|
|
356
|
+
onBlur: r || e ? void 0 : this.onBlur,
|
|
357
|
+
ref: this.inputRef
|
|
358
|
+
}
|
|
359
|
+
),
|
|
360
|
+
o && a !== void 0 && /* @__PURE__ */ p(
|
|
361
|
+
m,
|
|
362
|
+
{
|
|
363
|
+
pin: a?.pin || "BOTTOM",
|
|
364
|
+
type: a?.type || "SINGLE_LINE",
|
|
365
|
+
children: a?.label
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
this.Status()
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
};
|
|
376
|
+
Number = () => {
|
|
377
|
+
const {
|
|
378
|
+
id: t,
|
|
379
|
+
icon: i,
|
|
380
|
+
unit: a,
|
|
381
|
+
min: e,
|
|
382
|
+
max: r,
|
|
383
|
+
step: s,
|
|
384
|
+
helper: l,
|
|
385
|
+
feature: n,
|
|
386
|
+
isBlocked: o,
|
|
387
|
+
isDisabled: d,
|
|
388
|
+
isFlex: c,
|
|
389
|
+
onSlide: u
|
|
390
|
+
} = this.props, { inputValue: g, isTooltipVisible: v } = this.state;
|
|
391
|
+
return /* @__PURE__ */ h(
|
|
392
|
+
"div",
|
|
393
|
+
{
|
|
394
|
+
className: f([
|
|
395
|
+
"input",
|
|
396
|
+
"input--number",
|
|
397
|
+
i !== void 0 && "input--with-icon",
|
|
398
|
+
c && "input--flex",
|
|
399
|
+
o && "input--blocked"
|
|
400
|
+
]),
|
|
401
|
+
role: "group",
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ h(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
className: "input__wrapper",
|
|
407
|
+
onMouseEnter: () => {
|
|
408
|
+
l !== void 0 && this.setState({ isTooltipVisible: !0 });
|
|
409
|
+
},
|
|
410
|
+
onMouseLeave: () => {
|
|
411
|
+
l !== void 0 && this.setState({ isTooltipVisible: !1 });
|
|
412
|
+
},
|
|
413
|
+
children: [
|
|
414
|
+
i !== void 0 && /* @__PURE__ */ p(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
className: "input__icon",
|
|
418
|
+
style: {
|
|
419
|
+
cursor: typeof u == "function" && !(d || o) ? "ew-resize" : "default"
|
|
420
|
+
},
|
|
421
|
+
onMouseDown: () => {
|
|
422
|
+
typeof u == "function" && !(d || o) && this.onGrab();
|
|
423
|
+
},
|
|
424
|
+
children: /* @__PURE__ */ p(
|
|
425
|
+
V,
|
|
426
|
+
{
|
|
427
|
+
type: i?.type,
|
|
428
|
+
iconName: i?.value,
|
|
429
|
+
iconLetter: i?.value
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ p(
|
|
435
|
+
"input",
|
|
436
|
+
{
|
|
437
|
+
role: "spinbutton",
|
|
438
|
+
id: t,
|
|
439
|
+
"data-feature": n,
|
|
440
|
+
type: "number",
|
|
441
|
+
className: f([
|
|
442
|
+
"input__field",
|
|
443
|
+
c && "input__field--flex",
|
|
444
|
+
a !== void 0 && "input__field--unit"
|
|
445
|
+
]),
|
|
446
|
+
value: g,
|
|
447
|
+
min: e,
|
|
448
|
+
max: r,
|
|
449
|
+
step: s,
|
|
450
|
+
disabled: d || o,
|
|
451
|
+
"aria-label": `Number input${a ? ` in ${a}` : ""}${i ? ` with ${i.value} icon` : ""}`,
|
|
452
|
+
"aria-valuemin": e ? parseFloat(e) : void 0,
|
|
453
|
+
"aria-valuemax": r ? parseFloat(r) : void 0,
|
|
454
|
+
"aria-valuenow": parseFloat(g),
|
|
455
|
+
"aria-disabled": d || o,
|
|
456
|
+
onKeyDown: d || o ? void 0 : this.onValidNumber,
|
|
457
|
+
onChange: d || o ? void 0 : this.onChangeNumber,
|
|
458
|
+
onFocus: (b) => {
|
|
459
|
+
b.target.select(), d || o || this.onFocus(b);
|
|
460
|
+
},
|
|
461
|
+
onBlur: d || o ? void 0 : this.onBlur,
|
|
462
|
+
ref: this.inputRef
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
a !== void 0 && /* @__PURE__ */ p("div", { className: "input__unit", children: /* @__PURE__ */ p(
|
|
466
|
+
V,
|
|
467
|
+
{
|
|
468
|
+
type: "LETTER",
|
|
469
|
+
iconLetter: a
|
|
470
|
+
}
|
|
471
|
+
) }),
|
|
472
|
+
v && l !== void 0 && /* @__PURE__ */ p(
|
|
473
|
+
m,
|
|
474
|
+
{
|
|
475
|
+
pin: l?.pin || "BOTTOM",
|
|
476
|
+
type: l?.type || "SINGLE_LINE",
|
|
477
|
+
children: l?.label
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
]
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
this.Status()
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
);
|
|
487
|
+
};
|
|
488
|
+
Text = () => {
|
|
489
|
+
const {
|
|
490
|
+
id: t,
|
|
491
|
+
icon: i,
|
|
492
|
+
state: a,
|
|
493
|
+
placeholder: e,
|
|
494
|
+
charactersLimit: r,
|
|
495
|
+
helper: s,
|
|
496
|
+
feature: l,
|
|
497
|
+
isClearable: n,
|
|
498
|
+
isFlex: o,
|
|
499
|
+
isFramed: d,
|
|
500
|
+
isBlocked: c,
|
|
501
|
+
isDisabled: u,
|
|
502
|
+
onClear: g
|
|
503
|
+
} = this.props, { inputValue: v, isTooltipVisible: b } = this.state;
|
|
504
|
+
return /* @__PURE__ */ h(
|
|
505
|
+
"div",
|
|
506
|
+
{
|
|
507
|
+
className: f([
|
|
508
|
+
"input",
|
|
509
|
+
"input--short-text",
|
|
510
|
+
i !== void 0 && "input--with-icon",
|
|
511
|
+
o && "input__field--flex",
|
|
512
|
+
c && "input--blocked"
|
|
513
|
+
]),
|
|
514
|
+
role: "group",
|
|
515
|
+
children: [
|
|
516
|
+
/* @__PURE__ */ h(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
className: "input__wrapper",
|
|
520
|
+
onMouseEnter: () => {
|
|
521
|
+
s !== void 0 && this.setState({ isTooltipVisible: !0 });
|
|
522
|
+
},
|
|
523
|
+
onMouseLeave: () => {
|
|
524
|
+
s !== void 0 && this.setState({ isTooltipVisible: !1 });
|
|
525
|
+
},
|
|
526
|
+
children: [
|
|
527
|
+
i !== void 0 && /* @__PURE__ */ p("div", { className: "input__icon", children: /* @__PURE__ */ p(
|
|
528
|
+
V,
|
|
529
|
+
{
|
|
530
|
+
type: i?.type,
|
|
531
|
+
iconName: i?.value,
|
|
532
|
+
iconLetter: i?.value
|
|
533
|
+
}
|
|
534
|
+
) }),
|
|
535
|
+
/* @__PURE__ */ p(
|
|
536
|
+
"input",
|
|
537
|
+
{
|
|
538
|
+
role: "textbox",
|
|
539
|
+
id: t,
|
|
540
|
+
"data-feature": l,
|
|
541
|
+
type: "text",
|
|
542
|
+
className: f([
|
|
543
|
+
"input__field",
|
|
544
|
+
!d && "input__field--no-frame",
|
|
545
|
+
n && v.length > 0 && "input__field--clearable",
|
|
546
|
+
a === "ERROR" && "input__field--error"
|
|
547
|
+
]),
|
|
548
|
+
placeholder: e,
|
|
549
|
+
value: v,
|
|
550
|
+
maxLength: r,
|
|
551
|
+
disabled: u || c,
|
|
552
|
+
"aria-label": e || "Text input",
|
|
553
|
+
"aria-invalid": a === "ERROR",
|
|
554
|
+
"aria-disabled": u || c,
|
|
555
|
+
onKeyDown: u || c ? void 0 : this.onValidText,
|
|
556
|
+
onChange: u || c ? void 0 : this.onChangeText,
|
|
557
|
+
onFocus: u || c ? void 0 : this.onFocus,
|
|
558
|
+
onBlur: u || c ? void 0 : this.onBlur,
|
|
559
|
+
ref: this.inputRef
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
n && v.length > 0 && !(u || c) && /* @__PURE__ */ p("div", { className: "input__clear", children: /* @__PURE__ */ p(
|
|
563
|
+
S,
|
|
564
|
+
{
|
|
565
|
+
type: "icon",
|
|
566
|
+
size: "small",
|
|
567
|
+
icon: "close",
|
|
568
|
+
action: () => {
|
|
569
|
+
this.setState({ inputValue: "" }), g !== void 0 && g("");
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
) }),
|
|
573
|
+
b && s !== void 0 && /* @__PURE__ */ p(
|
|
574
|
+
m,
|
|
575
|
+
{
|
|
576
|
+
pin: s?.pin || "BOTTOM",
|
|
577
|
+
type: s?.type || "SINGLE_LINE",
|
|
578
|
+
children: s?.label
|
|
579
|
+
}
|
|
580
|
+
)
|
|
581
|
+
]
|
|
582
|
+
}
|
|
583
|
+
),
|
|
584
|
+
this.Status()
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
};
|
|
589
|
+
LongText = () => {
|
|
590
|
+
const { id: t, state: i, placeholder: a, helper: e, feature: r, isBlocked: s, isDisabled: l } = this.props, { inputValue: n, isTooltipVisible: o } = this.state;
|
|
591
|
+
return /* @__PURE__ */ h(
|
|
592
|
+
"div",
|
|
593
|
+
{
|
|
594
|
+
className: f([
|
|
595
|
+
"input",
|
|
596
|
+
"input--long-text",
|
|
597
|
+
s && "input--blocked"
|
|
598
|
+
]),
|
|
599
|
+
role: "group",
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ h(
|
|
602
|
+
"div",
|
|
603
|
+
{
|
|
604
|
+
className: "input__wrapper",
|
|
605
|
+
onMouseEnter: () => {
|
|
606
|
+
e !== void 0 && this.setState({ isTooltipVisible: !0 });
|
|
607
|
+
},
|
|
608
|
+
onMouseLeave: () => {
|
|
609
|
+
e !== void 0 && this.setState({ isTooltipVisible: !1 });
|
|
610
|
+
},
|
|
611
|
+
children: [
|
|
612
|
+
/* @__PURE__ */ p(
|
|
613
|
+
"textarea",
|
|
614
|
+
{
|
|
615
|
+
role: "textbox",
|
|
616
|
+
id: t,
|
|
617
|
+
"data-feature": r,
|
|
618
|
+
className: f([
|
|
619
|
+
"textarea",
|
|
620
|
+
"input__field",
|
|
621
|
+
i === "ERROR" && "input__field--error"
|
|
622
|
+
]),
|
|
623
|
+
rows: 1,
|
|
624
|
+
placeholder: a,
|
|
625
|
+
value: n,
|
|
626
|
+
disabled: l || s,
|
|
627
|
+
"aria-label": a || "Long text input",
|
|
628
|
+
"aria-invalid": i === "ERROR",
|
|
629
|
+
"aria-disabled": l || s,
|
|
630
|
+
onKeyDown: l || s ? void 0 : this.onValidLongText,
|
|
631
|
+
onChange: l || s ? void 0 : this.onChangeText,
|
|
632
|
+
onFocus: l || s ? void 0 : this.onFocus,
|
|
633
|
+
onBlur: l || s ? void 0 : this.onBlur,
|
|
634
|
+
ref: this.textareaRef
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
o && e !== void 0 && /* @__PURE__ */ p(
|
|
638
|
+
m,
|
|
639
|
+
{
|
|
640
|
+
pin: e?.pin || "BOTTOM",
|
|
641
|
+
type: e?.type || "SINGLE_LINE",
|
|
642
|
+
children: e?.label
|
|
643
|
+
}
|
|
644
|
+
)
|
|
645
|
+
]
|
|
646
|
+
}
|
|
647
|
+
),
|
|
648
|
+
this.Status()
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
};
|
|
653
|
+
CodeSnippet = () => {
|
|
654
|
+
const { id: t, value: i, helper: a, feature: e, isBlocked: r, isDisabled: s } = this.props;
|
|
655
|
+
return /* @__PURE__ */ h(
|
|
656
|
+
"div",
|
|
657
|
+
{
|
|
658
|
+
className: f([
|
|
659
|
+
"input",
|
|
660
|
+
"input--code",
|
|
661
|
+
r && "input--blocked"
|
|
662
|
+
]),
|
|
663
|
+
role: "group",
|
|
664
|
+
children: [
|
|
665
|
+
/* @__PURE__ */ p(
|
|
666
|
+
"div",
|
|
667
|
+
{
|
|
668
|
+
className: "input__wrapper",
|
|
669
|
+
onMouseEnter: () => {
|
|
670
|
+
a !== void 0 && this.setState({ isTooltipVisible: !0 });
|
|
671
|
+
},
|
|
672
|
+
onMouseLeave: () => {
|
|
673
|
+
a !== void 0 && this.setState({ isTooltipVisible: !1 });
|
|
674
|
+
},
|
|
675
|
+
children: /* @__PURE__ */ p(
|
|
676
|
+
"textarea",
|
|
677
|
+
{
|
|
678
|
+
role: "textbox",
|
|
679
|
+
id: t,
|
|
680
|
+
"data-feature": e,
|
|
681
|
+
className: f([
|
|
682
|
+
"textarea",
|
|
683
|
+
"input__field",
|
|
684
|
+
"textarea--monospace"
|
|
685
|
+
]),
|
|
686
|
+
value: i,
|
|
687
|
+
disabled: s || r,
|
|
688
|
+
"aria-label": "Code snippet",
|
|
689
|
+
"aria-disabled": s || r,
|
|
690
|
+
onChange: s || r ? void 0 : this.onChangeText,
|
|
691
|
+
onFocus: (l) => l.target.select(),
|
|
692
|
+
onBlur: () => window.getSelection()?.removeAllRanges(),
|
|
693
|
+
readOnly: !0,
|
|
694
|
+
ref: this.textareaRef
|
|
695
|
+
}
|
|
696
|
+
)
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
this.Status()
|
|
700
|
+
]
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
};
|
|
704
|
+
// Render
|
|
705
|
+
render() {
|
|
706
|
+
const { type: t } = this.props;
|
|
707
|
+
return t === "NUMBER" ? this.Number() : t === "COLOR" ? this.Color() : t === "LONG_TEXT" ? this.LongText() : t === "CODE" ? this.CodeSnippet() : this.Text();
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
export {
|
|
711
|
+
B as default
|
|
712
|
+
};
|
|
713
|
+
//# sourceMappingURL=Input.js.map
|