@neo4j-ndl/react 4.3.5 → 4.4.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/lib/cjs/ai/presence/Presence.js +1 -0
- package/lib/cjs/ai/presence/Presence.js.map +1 -1
- package/lib/cjs/banner/Banner.js +1 -1
- package/lib/cjs/banner/Banner.js.map +1 -1
- package/lib/cjs/data-grid/Components.js +1 -1
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-single-selectable.story.js +0 -24
- package/lib/cjs/data-grid/stories/datagrid-single-selectable.story.js.map +1 -1
- package/lib/cjs/date-picker/DatePicker.js.map +1 -1
- package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/cjs/icon-button-base/IconButtonBase.js +5 -3
- package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/cjs/icons/generated/custom/DatabaseCross.js +1 -1
- package/lib/cjs/icons/generated/custom/DatabaseCross.js.map +1 -1
- package/lib/cjs/icons/generated/custom/DatabasePlus.js +1 -1
- package/lib/cjs/icons/generated/custom/DatabasePlus.js.map +1 -1
- package/lib/cjs/icons/generated/custom/GlobePin.js +1 -1
- package/lib/cjs/icons/generated/custom/GlobePin.js.map +1 -1
- package/lib/cjs/icons/generated/custom/PanelBottom.js +1 -1
- package/lib/cjs/icons/generated/custom/PanelBottom.js.map +1 -1
- package/lib/cjs/icons/generated/custom/PanelLeftCollapsed.js +30 -0
- package/lib/cjs/icons/generated/custom/PanelLeftCollapsed.js.map +1 -0
- package/lib/cjs/icons/generated/custom/PanelLeftExpanded.js +30 -0
- package/lib/cjs/icons/generated/custom/PanelLeftExpanded.js.map +1 -0
- package/lib/cjs/icons/generated/custom/PanelRightCollapsed.js +30 -0
- package/lib/cjs/icons/generated/custom/PanelRightCollapsed.js.map +1 -0
- package/lib/cjs/icons/generated/custom/PanelRightExpanded.js +30 -0
- package/lib/cjs/icons/generated/custom/PanelRightExpanded.js.map +1 -0
- package/lib/cjs/icons/generated/custom/ThreePanel.js +1 -1
- package/lib/cjs/icons/generated/custom/ThreePanel.js.map +1 -1
- package/lib/cjs/icons/generated/custom/index.js +9 -1
- package/lib/cjs/icons/generated/custom/index.js.map +1 -1
- package/lib/cjs/icons/wrapIcon.js +1 -1
- package/lib/cjs/icons/wrapIcon.js.map +1 -1
- package/lib/cjs/menu/stories/menu-custom-items.story.js +3 -1
- package/lib/cjs/menu/stories/menu-custom-items.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-default.story.js +3 -1
- package/lib/cjs/menu/stories/menu-default.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-in-dialog.story.js +5 -1
- package/lib/cjs/menu/stories/menu-in-dialog.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-in-popover.story.js +3 -1
- package/lib/cjs/menu/stories/menu-in-popover.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-nested.story.js +3 -1
- package/lib/cjs/menu/stories/menu-nested.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-placements.story.js +3 -1
- package/lib/cjs/menu/stories/menu-placements.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-category.story.js +1 -2
- package/lib/cjs/menu/stories/menu-with-category.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-disabled-item.story.js +1 -2
- package/lib/cjs/menu/stories/menu-with-disabled-item.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-divider.story.js +1 -2
- package/lib/cjs/menu/stories/menu-with-divider.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-icon.story.js +3 -1
- package/lib/cjs/menu/stories/menu-with-icon.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-keyboard-shortcuts.story.js +3 -1
- package/lib/cjs/menu/stories/menu-with-keyboard-shortcuts.story.js.map +1 -1
- package/lib/cjs/select/Select.js +25 -3
- package/lib/cjs/select/Select.js.map +1 -1
- package/lib/cjs/side-navigation/SideNavigation.js +1 -1
- package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
- package/lib/cjs/tabs/Tabs.js +1 -1
- package/lib/cjs/tabs/Tabs.js.map +1 -1
- package/lib/cjs/tabs/stories/tabs-overflow.story.js +1 -1
- package/lib/cjs/tabs/stories/tabs-overflow.story.js.map +1 -1
- package/lib/cjs/text-input/TextInput.js +33 -2
- package/lib/cjs/text-input/TextInput.js.map +1 -1
- package/lib/cjs/text-input/stories/index.js +9 -1
- package/lib/cjs/text-input/stories/index.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-clearable.story.js +30 -0
- package/lib/cjs/text-input/stories/text-input-clearable.story.js.map +1 -0
- package/lib/cjs/text-input/stories/text-input-loading-spinner.story.js +31 -0
- package/lib/cjs/text-input/stories/text-input-loading-spinner.story.js.map +1 -0
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js +1 -3
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input.stories.js +61 -35
- package/lib/cjs/text-input/stories/text-input.stories.js.map +1 -1
- package/lib/cjs/wizard/Wizard.js +1 -1
- package/lib/cjs/wizard/Wizard.js.map +1 -1
- package/lib/esm/ai/presence/Presence.js +1 -0
- package/lib/esm/ai/presence/Presence.js.map +1 -1
- package/lib/esm/banner/Banner.js +1 -1
- package/lib/esm/banner/Banner.js.map +1 -1
- package/lib/esm/data-grid/Components.js +1 -1
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-single-selectable.story.js +0 -24
- package/lib/esm/data-grid/stories/datagrid-single-selectable.story.js.map +1 -1
- package/lib/esm/date-picker/DatePicker.js.map +1 -1
- package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/esm/icon-button-base/IconButtonBase.js +5 -3
- package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/esm/icons/generated/custom/DatabaseCross.js +2 -2
- package/lib/esm/icons/generated/custom/DatabaseCross.js.map +1 -1
- package/lib/esm/icons/generated/custom/DatabasePlus.js +1 -1
- package/lib/esm/icons/generated/custom/DatabasePlus.js.map +1 -1
- package/lib/esm/icons/generated/custom/GlobePin.js +1 -1
- package/lib/esm/icons/generated/custom/GlobePin.js.map +1 -1
- package/lib/esm/icons/generated/custom/PanelBottom.js +1 -1
- package/lib/esm/icons/generated/custom/PanelBottom.js.map +1 -1
- package/lib/esm/icons/generated/custom/PanelLeftCollapsed.js +28 -0
- package/lib/esm/icons/generated/custom/PanelLeftCollapsed.js.map +1 -0
- package/lib/esm/icons/generated/custom/PanelLeftExpanded.js +28 -0
- package/lib/esm/icons/generated/custom/PanelLeftExpanded.js.map +1 -0
- package/lib/esm/icons/generated/custom/PanelRightCollapsed.js +28 -0
- package/lib/esm/icons/generated/custom/PanelRightCollapsed.js.map +1 -0
- package/lib/esm/icons/generated/custom/PanelRightExpanded.js +28 -0
- package/lib/esm/icons/generated/custom/PanelRightExpanded.js.map +1 -0
- package/lib/esm/icons/generated/custom/ThreePanel.js +1 -1
- package/lib/esm/icons/generated/custom/ThreePanel.js.map +1 -1
- package/lib/esm/icons/generated/custom/index.js +4 -0
- package/lib/esm/icons/generated/custom/index.js.map +1 -1
- package/lib/esm/icons/wrapIcon.js +1 -1
- package/lib/esm/icons/wrapIcon.js.map +1 -1
- package/lib/esm/menu/stories/menu-custom-items.story.js +3 -1
- package/lib/esm/menu/stories/menu-custom-items.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-default.story.js +3 -1
- package/lib/esm/menu/stories/menu-default.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-in-dialog.story.js +5 -1
- package/lib/esm/menu/stories/menu-in-dialog.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-in-popover.story.js +3 -1
- package/lib/esm/menu/stories/menu-in-popover.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-nested.story.js +3 -1
- package/lib/esm/menu/stories/menu-nested.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-placements.story.js +3 -1
- package/lib/esm/menu/stories/menu-placements.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-category.story.js +1 -2
- package/lib/esm/menu/stories/menu-with-category.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-disabled-item.story.js +1 -2
- package/lib/esm/menu/stories/menu-with-disabled-item.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-divider.story.js +1 -2
- package/lib/esm/menu/stories/menu-with-divider.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-icon.story.js +3 -1
- package/lib/esm/menu/stories/menu-with-icon.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-keyboard-shortcuts.story.js +3 -1
- package/lib/esm/menu/stories/menu-with-keyboard-shortcuts.story.js.map +1 -1
- package/lib/esm/select/Select.js +26 -4
- package/lib/esm/select/Select.js.map +1 -1
- package/lib/esm/side-navigation/SideNavigation.js +1 -1
- package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
- package/lib/esm/tabs/Tabs.js +1 -1
- package/lib/esm/tabs/Tabs.js.map +1 -1
- package/lib/esm/tabs/stories/tabs-overflow.story.js +1 -1
- package/lib/esm/tabs/stories/tabs-overflow.story.js.map +1 -1
- package/lib/esm/text-input/TextInput.js +35 -4
- package/lib/esm/text-input/TextInput.js.map +1 -1
- package/lib/esm/text-input/stories/index.js +6 -0
- package/lib/esm/text-input/stories/index.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-clearable.story.js +28 -0
- package/lib/esm/text-input/stories/text-input-clearable.story.js.map +1 -0
- package/lib/esm/text-input/stories/text-input-loading-spinner.story.js +29 -0
- package/lib/esm/text-input/stories/text-input-loading-spinner.story.js.map +1 -0
- package/lib/esm/text-input/stories/text-input-with-icons.story.js +3 -5
- package/lib/esm/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input.stories.js +61 -35
- package/lib/esm/text-input/stories/text-input.stories.js.map +1 -1
- package/lib/esm/wizard/Wizard.js +1 -1
- package/lib/esm/wizard/Wizard.js.map +1 -1
- package/lib/types/ai/presence/Presence.d.ts.map +1 -1
- package/lib/types/data-grid/Components.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-single-selectable.story.d.ts.map +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
- package/lib/types/icon-button-base/IconButtonBase.d.ts.map +1 -1
- package/lib/types/icons/generated/custom/DatabaseCross.d.ts.map +1 -1
- package/lib/types/icons/generated/custom/DatabasePlus.d.ts.map +1 -1
- package/lib/types/icons/generated/custom/GlobePin.d.ts.map +1 -1
- package/lib/types/icons/generated/custom/PanelLeftCollapsed.d.ts +29 -0
- package/lib/types/icons/generated/custom/PanelLeftCollapsed.d.ts.map +1 -0
- package/lib/types/icons/generated/custom/PanelLeftExpanded.d.ts +29 -0
- package/lib/types/icons/generated/custom/PanelLeftExpanded.d.ts.map +1 -0
- package/lib/types/icons/generated/custom/PanelRightCollapsed.d.ts +29 -0
- package/lib/types/icons/generated/custom/PanelRightCollapsed.d.ts.map +1 -0
- package/lib/types/icons/generated/custom/PanelRightExpanded.d.ts +29 -0
- package/lib/types/icons/generated/custom/PanelRightExpanded.d.ts.map +1 -0
- package/lib/types/icons/generated/custom/index.d.ts +4 -0
- package/lib/types/icons/generated/custom/index.d.ts.map +1 -1
- package/lib/types/icons/wrapIcon.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-custom-items.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-default.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-in-dialog.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-in-popover.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-nested.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-placements.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-category.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-disabled-item.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-divider.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-icon.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-keyboard-shortcuts.story.d.ts.map +1 -1
- package/lib/types/select/Select.d.ts.map +1 -1
- package/lib/types/side-navigation/SideNavigation.d.ts.map +1 -1
- package/lib/types/tabs/Tabs.d.ts.map +1 -1
- package/lib/types/tabs/stories/tabs-overflow.story.d.ts.map +1 -1
- package/lib/types/text-input/TextInput.d.ts +5 -1
- package/lib/types/text-input/TextInput.d.ts.map +1 -1
- package/lib/types/text-input/stories/index.d.ts +4 -0
- package/lib/types/text-input/stories/index.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-clearable.story.d.ts +24 -0
- package/lib/types/text-input/stories/text-input-clearable.story.d.ts.map +1 -0
- package/lib/types/text-input/stories/text-input-loading-spinner.story.d.ts +24 -0
- package/lib/types/text-input/stories/text-input-loading-spinner.story.d.ts.map +1 -0
- package/lib/types/text-input/stories/text-input-with-icons.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input.stories.d.ts +3 -1
- package/lib/types/text-input/stories/text-input.stories.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-overflow.story.js","sourceRoot":"","sources":["../../../../src/tabs/stories/tabs-overflow.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAoD;AACpD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAS,GAAG,CAAC,CAAC;IAEhD,OAAO,CACL,iCAAK,SAAS,EAAC,QAAQ,aACrB,wBAAC,YAAI,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,cAAc,aAC9D,uBAAC,YAAI,CAAC,GAAG,IAAC,EAAE,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,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,8BAA2B,GAC9C,EAChB,uBAAC,YAAI,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,GAAG,YACpC,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,8BAA2B,GAC9C,EAChB,uBAAC,YAAI,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,GAAG,YACpC,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,8BAA2B,GAC9C,EAChB,uBAAC,YAAI,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,GAAG,YACpC,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,8BAA2B,GAC9C,EAChB,uBAAC,YAAI,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,GAAG,YACpC,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,+BAA4B,GAC/C,IACZ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Tabs, Typography } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [value, setValue] = useState<string>('0');\n\n return (\n <div className=\"n-w-80\">\n <Tabs value={value} onChange={setValue} className=\"n-mb-token-8\">\n <Tabs.Tab id=\"0\">Tab 1</Tabs.Tab>\n <Tabs.Tab id=\"1\">Tab 2</Tabs.Tab>\n <Tabs.Tab id=\"2\">Tab 3</Tabs.Tab>\n <Tabs.Tab id=\"3\">Tab 4</Tabs.Tab>\n <Tabs.Tab id=\"4\">Tab 5</Tabs.Tab>\n <Tabs.Tab id=\"5\">Tab 6</Tabs.Tab>\n <Tabs.Tab id=\"6\">Tab 7</Tabs.Tab>\n <Tabs.Tab id=\"7\">Tab 8</Tabs.Tab>\n <Tabs.Tab id=\"8\">Tab 9</Tabs.Tab>\n <Tabs.Tab id=\"9\">\n Tab 10 is waay too long and will be cut off on smaller screens\n </Tabs.Tab>\n </Tabs>\n <Tabs.TabPanel value={value} tabId=\"0\">\n <Typography variant=\"body-medium\">Tab 1 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"1\">\n <Typography variant=\"body-medium\">Tab 2 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"2\">\n <Typography variant=\"body-medium\">Tab 3 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"3\">\n <Typography variant=\"body-medium\">Tab 4 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"4\">\n <Typography variant=\"body-medium\">Tab 5 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"5\">\n <Typography variant=\"body-medium\">Tab 6 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"6\">\n <Typography variant=\"body-medium\">Tab 7 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"7\">\n <Typography variant=\"body-medium\">Tab 8 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"8\">\n <Typography variant=\"body-medium\">Tab 9 content</Typography>\n </Tabs.TabPanel>\n <Tabs.TabPanel value={value} tabId=\"9\">\n <Typography variant=\"body-medium\">Tab 10 content</Typography>\n </Tabs.TabPanel>\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -39,8 +39,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
39
39
|
const classnames_1 = __importDefault(require("classnames"));
|
|
40
40
|
const react_1 = require("react");
|
|
41
41
|
const messages_1 = require("../_common/messages");
|
|
42
|
+
const use_semi_controlled_input_1 = require("../_common/use-semi-controlled-input");
|
|
42
43
|
const utils_1 = require("../_common/utils");
|
|
43
44
|
const icons_1 = require("../icons");
|
|
45
|
+
const loading_spinner_1 = require("../loading-spinner");
|
|
44
46
|
const skeleton_1 = require("../skeleton");
|
|
45
47
|
const tooltip_1 = require("../tooltip");
|
|
46
48
|
const typography_1 = require("../typography");
|
|
@@ -52,7 +54,14 @@ const typography_1 = require("../typography");
|
|
|
52
54
|
*
|
|
53
55
|
*/
|
|
54
56
|
const TextInput = (_a) => {
|
|
55
|
-
var { label, isFluid, errorText, helpText, leadingElement, trailingElement, showRequiredOrOptionalLabel = false, moreInformationText, size = 'medium', placeholder, value, tooltipProps, htmlAttributes, isDisabled, isReadOnly, isRequired, onChange, className, style, isSkeletonLoading = false, skeletonProps, ref } = _a, restProps = __rest(_a, ["label", "isFluid", "errorText", "helpText", "leadingElement", "trailingElement", "showRequiredOrOptionalLabel", "moreInformationText", "size", "placeholder", "value", "tooltipProps", "htmlAttributes", "isDisabled", "isReadOnly", "isRequired", "onChange", "className", "style", "isSkeletonLoading", "skeletonProps", "ref"]);
|
|
57
|
+
var { label, isFluid, errorText, helpText, leadingElement, trailingElement, showRequiredOrOptionalLabel = false, moreInformationText, size = 'medium', placeholder, value, tooltipProps, htmlAttributes, isDisabled, isReadOnly, isRequired, onChange, isClearable = false, className, style, isSkeletonLoading = false, isLoading = false, skeletonProps, ref } = _a, restProps = __rest(_a, ["label", "isFluid", "errorText", "helpText", "leadingElement", "trailingElement", "showRequiredOrOptionalLabel", "moreInformationText", "size", "placeholder", "value", "tooltipProps", "htmlAttributes", "isDisabled", "isReadOnly", "isRequired", "onChange", "isClearable", "className", "style", "isSkeletonLoading", "isLoading", "skeletonProps", "ref"]);
|
|
58
|
+
const [internalState, internalOnChange] = (0, use_semi_controlled_input_1.useSemiControlledInput)({
|
|
59
|
+
inputType: 'text',
|
|
60
|
+
isControlled: value !== undefined,
|
|
61
|
+
onChange,
|
|
62
|
+
state: value !== null && value !== void 0 ? value : '',
|
|
63
|
+
});
|
|
64
|
+
const hintId = (0, react_1.useId)();
|
|
56
65
|
const containerWrappingClasses = (0, classnames_1.default)(`ndl-text-input`, className, {
|
|
57
66
|
'ndl-disabled': isDisabled,
|
|
58
67
|
'ndl-has-error': errorText,
|
|
@@ -73,6 +82,18 @@ const TextInput = (_a) => {
|
|
|
73
82
|
const ariaLabel = combinedHtmlInputAttributes['aria-label'];
|
|
74
83
|
const isCustomLabel = Boolean(label) && typeof label !== 'string';
|
|
75
84
|
const hasCustomLabelAndNoAriaLabel = isCustomLabel && (ariaLabel === undefined || ariaLabel === '');
|
|
85
|
+
const shouldRenderHint = isClearable || isLoading;
|
|
86
|
+
const handleInputKeyDown = (event) => {
|
|
87
|
+
var _a;
|
|
88
|
+
if (isClearable && event.key === 'Escape' && Boolean(internalState)) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
internalOnChange === null || internalOnChange === void 0 ? void 0 : internalOnChange({
|
|
92
|
+
target: { value: '' },
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
(_a = htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(htmlAttributes, event);
|
|
96
|
+
};
|
|
76
97
|
(0, react_1.useMemo)(() => {
|
|
77
98
|
if (!label && !ariaLabel) {
|
|
78
99
|
(0, utils_1.needleWarningMessage)('A TextInput without a label does not have an aria label, be sure to include an aria label for screen readers. Link: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI');
|
|
@@ -85,7 +106,17 @@ const TextInput = (_a) => {
|
|
|
85
106
|
'ndl-information-icon-large': size === 'large',
|
|
86
107
|
'ndl-information-icon-small': size === 'small' || size === 'medium',
|
|
87
108
|
});
|
|
88
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: containerWrappingClasses, style: style, children: [(0, jsx_runtime_1.jsxs)("label", { className: labelWrappingClasses, children: [!hasEmptyLabelValue && ((0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-label-text-wrapper", children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-label-text", children: label }), Boolean(moreInformationText) && ((0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { type: "simple", children: [(0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { className: informationIconClasses, hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)("div", { tabIndex: 0, role: "button", "aria-label": "Information icon", children: (0, jsx_runtime_1.jsx)(icons_1.InformationCircleIconOutline, {}) }) })), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: moreInformationText }))] }))), showRequiredOrOptionalLabel && ((0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-form-item-optional", children: isRequired === true ? 'Required' : 'Optional' }))] }) }))), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-input-wrapper", children: [
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: containerWrappingClasses, style: style, children: [(0, jsx_runtime_1.jsxs)("label", { className: labelWrappingClasses, children: [!hasEmptyLabelValue && ((0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-label-text-wrapper", children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-label-text", children: label }), Boolean(moreInformationText) && ((0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { type: "simple", children: [(0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { className: informationIconClasses, hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)("div", { tabIndex: 0, role: "button", "aria-label": "Information icon", children: (0, jsx_runtime_1.jsx)(icons_1.InformationCircleIconOutline, {}) }) })), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: moreInformationText }))] }))), showRequiredOrOptionalLabel && ((0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-form-item-optional", children: isRequired === true ? 'Required' : 'Optional' }))] }) }))), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-input-wrapper", children: [(leadingElement || (isLoading && !trailingElement)) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-element-leading ndl-element", children: isLoading ? ((0, jsx_runtime_1.jsx)(loading_spinner_1.LoadingSpinner, { size: size === 'large' ? 'medium' : 'small', className: size === 'large'
|
|
110
|
+
? 'ndl-medium-spinner'
|
|
111
|
+
: 'ndl-small-spinner' })) : (leadingElement) })), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('ndl-input-container', {
|
|
112
|
+
'ndl-clearable': isClearable,
|
|
113
|
+
}), children: [(0, jsx_runtime_1.jsx)("input", Object.assign({ ref: ref, readOnly: isReadOnly, disabled: isDisabled, required: isRequired, value: internalState, placeholder: placeholder, type: "text", onChange: internalOnChange, "aria-describedby": shouldRenderHint ? hintId : undefined }, combinedHtmlInputAttributes, { onKeyDown: handleInputKeyDown }, restProps)), shouldRenderHint && ((0, jsx_runtime_1.jsxs)("span", { id: hintId, className: "ndl-text-input-hint", children: [isLoading && 'Loading ', isClearable && 'Press Escape to clear input.'] })), isClearable && Boolean(internalState) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-element-clear ndl-element", children: (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, "aria-hidden": true, type: "button", title: "Clear input (Esc)", onClick: () => {
|
|
114
|
+
internalOnChange === null || internalOnChange === void 0 ? void 0 : internalOnChange({
|
|
115
|
+
target: { value: '' },
|
|
116
|
+
});
|
|
117
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, { className: "n-size-4" }) }) }))] }), trailingElement && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-element-trailing ndl-element", children: isLoading && !leadingElement ? ((0, jsx_runtime_1.jsx)(loading_spinner_1.LoadingSpinner, { size: size === 'large' ? 'medium' : 'small', className: size === 'large'
|
|
118
|
+
? 'ndl-medium-spinner'
|
|
119
|
+
: 'ndl-small-spinner' })) : (trailingElement) }))] }) }))] }), Boolean(helpText) && !errorText && ((0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { onBackground: "weak", shape: "rectangular", isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: size === 'large' ? 'body-medium' : 'body-small', className: "ndl-form-message", children: helpText }) })), Boolean(errorText) && (
|
|
89
120
|
// TODO v4: We might want to have a min width for the container for the messages to help skeleton loading.
|
|
90
121
|
// Currently the message fills 100% of the width while the rest of the text input has a set width.
|
|
91
122
|
(0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular", width: "fit-content" }, skeletonProps, { isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-form-message", children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-error-icon", children: (0, jsx_runtime_1.jsx)(icons_1.ExclamationCircleIconSolid, {}) }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { className: "ndl-error-text", variant: size === 'large' ? 'body-medium' : 'body-small', children: errorText })] }) })))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4DAAoC;AACpC,iCAKe;AAEf,kDAA8E;AAE9E,4CAAwD;AACxD,oCAGkB;AAClB,0CAAuC;AACvC,wCAAqC;AACrC,8CAA2C;AA8D3C;;;;;;GAMG;AAEI,MAAM,SAAS,GAAG,CAAC,EAwBa,EAAE,EAAE;QAxBjB,EACxB,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,cAAc,EACd,eAAe,EACf,2BAA2B,GAAG,KAAK,EACnC,mBAAmB,EACnB,IAAI,GAAG,QAAQ,EACf,WAAW,EACX,KAAK,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,iBAAiB,GAAG,KAAK,EACzB,aAAa,EACb,GAAG,OAEkC,EADlC,SAAS,cAvBY,mUAwBzB,CADa;IAEZ,MAAM,wBAAwB,GAAG,IAAA,oBAA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kB,aAC/B,gCAAK,SAAS,EAAC,gBAAgB,YAC7B,uBAAC,kCAA0B,KAAG,GAC1B,EACN,uBAAC,uBAAU,IACT,SAAS,EAAC,gBAAgB,EAC1B,OAAO,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,YAEvD,SAAS,GACC,IACT,IACG,CACZ,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAhMW,QAAA,SAAS,aAgMpB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport classNames from 'classnames';\nimport {\n type InputHTMLAttributes,\n type ReactElement,\n type ReactNode,\n useMemo,\n} from 'react';\n\nimport { customLabelAndNoAriaLabelWarningMessage } from '../_common/messages';\nimport { type CommonProps, type TooltipObjectProps } from '../_common/types';\nimport { needleWarningMessage } from '../_common/utils';\nimport {\n ExclamationCircleIconSolid,\n InformationCircleIconOutline,\n} from '../icons';\nimport { Skeleton } from '../skeleton';\nimport { Tooltip } from '../tooltip';\nimport { Typography } from '../typography';\n\ntype TextInputProps = {\n /** Assistive text displayed below the input */\n helpText?: string | ReactNode;\n\n /** Error message displayed below the input. When provided, it overrides `helpText` and shows an error icon */\n errorText?: string | ReactNode;\n\n /** Leading element rendered inside the input */\n leadingElement?: ReactElement;\n\n /** Trailing element rendered inside the input */\n trailingElement?: ReactElement;\n\n /** Size of the input */\n size?: 'small' | 'medium' | 'large';\n\n /** Whether the input is read-only */\n isReadOnly?: boolean;\n\n /**\n * Whether to display the Required/Optional label next to the field label.\n * Shows Required if isRequired is true, otherwise shows Optional.\n * @default false\n */\n showRequiredOrOptionalLabel?: boolean;\n\n /** Whether the input is disabled */\n isDisabled?: boolean;\n\n /** Whether the input is required */\n isRequired?: boolean;\n\n /** The current value of the input */\n value?: React.ComponentPropsWithoutRef<'input'>['value'];\n\n /** Placeholder text displayed when the input is empty */\n placeholder?: React.ComponentPropsWithoutRef<'input'>['placeholder'];\n\n /** Callback function triggered when the input value changes */\n onChange?: React.ComponentPropsWithoutRef<'input'>['onChange'];\n\n /** Whether the input should take the full available width */\n isFluid?: boolean;\n\n /** Text displayed in the information tooltip shown next to the label */\n moreInformationText?: React.ReactNode;\n\n /** The label displayed above the input */\n label?: string | React.ReactNode;\n\n /** Props for the Tooltip component used by the information icon */\n tooltipProps?: TooltipObjectProps;\n\n /** Whether to render skeletons instead of content */\n isSkeletonLoading?: boolean;\n\n /** Additional props forwarded to the underlying Skeleton components */\n skeletonProps?: React.ComponentProps<typeof Skeleton>;\n};\n\n/**\n *\n *\n * TextInput Component\n *\n *\n */\n\nexport const TextInput = ({\n label,\n isFluid,\n errorText,\n helpText,\n leadingElement,\n trailingElement,\n showRequiredOrOptionalLabel = false,\n moreInformationText,\n size = 'medium',\n placeholder,\n value,\n tooltipProps,\n htmlAttributes,\n isDisabled,\n isReadOnly,\n isRequired,\n onChange,\n className,\n style,\n isSkeletonLoading = false,\n skeletonProps,\n ref,\n ...restProps\n}: CommonProps<'input', TextInputProps>) => {\n const containerWrappingClasses = classNames(`ndl-text-input`, className, {\n 'ndl-disabled': isDisabled,\n 'ndl-has-error': errorText,\n 'ndl-has-icon': leadingElement || trailingElement || errorText,\n 'ndl-has-leading-icon': leadingElement,\n 'ndl-has-trailing-icon': trailingElement || errorText,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-read-only': isReadOnly,\n 'ndl-small': size === 'small',\n });\n\n const hasEmptyLabelValue =\n label === undefined || label === null || label === '';\n\n const labelWrappingClasses = classNames('ndl-form-item-label', {\n 'ndl-fluid': isFluid,\n 'ndl-form-item-no-label': hasEmptyLabelValue,\n });\n\n const combinedHtmlInputAttributes: InputHTMLAttributes<HTMLInputElement> = {\n ...htmlAttributes,\n className: classNames('ndl-input', htmlAttributes?.className),\n };\n const ariaLabel = combinedHtmlInputAttributes['aria-label'];\n const isCustomLabel = Boolean(label) && typeof label !== 'string';\n const hasCustomLabelAndNoAriaLabel =\n isCustomLabel && (ariaLabel === undefined || ariaLabel === '');\n\n useMemo(() => {\n if (!label && !ariaLabel) {\n needleWarningMessage(\n 'A TextInput without a label does not have an aria label, be sure to include an aria label for screen readers. Link: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI',\n );\n }\n\n if (hasCustomLabelAndNoAriaLabel) {\n needleWarningMessage(customLabelAndNoAriaLabelWarningMessage);\n }\n }, [label, ariaLabel, hasCustomLabelAndNoAriaLabel]);\n\n const informationIconClasses = classNames({\n 'ndl-information-icon-large': size === 'large',\n 'ndl-information-icon-small': size === 'small' || size === 'medium',\n });\n\n return (\n <div className={containerWrappingClasses} style={style}>\n {/* We enable implicit label wrapping */}\n {/* Source: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI */}\n <label className={labelWrappingClasses}>\n {!hasEmptyLabelValue && (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n <div className=\"ndl-label-text-wrapper\">\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n className=\"ndl-label-text\"\n >\n {label}\n </Typography>\n {Boolean(moreInformationText) && (\n <Tooltip {...tooltipProps?.root} type=\"simple\">\n <Tooltip.Trigger\n {...tooltipProps?.trigger}\n className={informationIconClasses}\n hasButtonWrapper\n >\n <div\n tabIndex={0}\n role=\"button\"\n aria-label=\"Information icon\"\n >\n <InformationCircleIconOutline />\n </div>\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n {moreInformationText}\n </Tooltip.Content>\n </Tooltip>\n )}\n {showRequiredOrOptionalLabel && (\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n className=\"ndl-form-item-optional\"\n >\n {isRequired === true ? 'Required' : 'Optional'}\n </Typography>\n )}\n </div>\n </Skeleton>\n )}\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n <div className=\"ndl-input-wrapper\">\n {leadingElement && (\n <div className=\"ndl-element-leading ndl-element\">\n {leadingElement}\n </div>\n )}\n <input\n readOnly={isReadOnly}\n disabled={isDisabled}\n required={isRequired}\n value={value}\n placeholder={placeholder}\n type=\"text\"\n onChange={onChange}\n {...combinedHtmlInputAttributes}\n {...restProps}\n ref={ref}\n />\n {trailingElement && (\n <div className=\"ndl-element-trailing ndl-element\">\n {trailingElement}\n </div>\n )}\n </div>\n </Skeleton>\n </label>\n {Boolean(helpText) && !errorText && (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n isLoading={isSkeletonLoading}\n >\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-form-message\"\n >\n {helpText}\n </Typography>\n </Skeleton>\n )}\n {Boolean(errorText) && (\n // TODO v4: We might want to have a min width for the container for the messages to help skeleton loading.\n // Currently the message fills 100% of the width while the rest of the text input has a set width.\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n width=\"fit-content\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n <div className=\"ndl-form-message\">\n <div className=\"ndl-error-icon\">\n <ExclamationCircleIconSolid />\n </div>\n <Typography\n className=\"ndl-error-text\"\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n >\n {errorText}\n </Typography>\n </div>\n </Skeleton>\n )}\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],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AAO,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,EACxD,SAAS,EAAC,kBAAkB,YAE3B,QAAQ,GACE,GACJ,CACZ,EACA,OAAO,CAAC,SAAS,CAAC,IAAI;YACrB,0GAA0G;YAC1G,kGAAkG;YAClG,uBAAC,mBAAQ,kBACP,YAAY,EAAC,MAAM,EACnB,KAAK,EAAC,aAAa,EACnB,KAAK,EAAC,aAAa,IACf,aAAa,IACjB,SAAS,EAAE,iBAAiB,YAE5B,iCAAK,SAAS,EAAC,kBAAkB,aAC/B,gCAAK,SAAS,EAAC,gBAAgB,YAC7B,uBAAC,kCAA0B,KAAG,GAC1B,EACN,uBAAC,uBAAU,IACT,SAAS,EAAC,gBAAgB,EAC1B,OAAO,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,YAEvD,SAAS,GACC,IACT,IACG,CACZ,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AA3QW,QAAA,SAAS,aA2QpB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport classNames from 'classnames';\nimport {\n type InputHTMLAttributes,\n type ReactElement,\n type ReactNode,\n useId,\n useMemo,\n} from 'react';\n\nimport { customLabelAndNoAriaLabelWarningMessage } from '../_common/messages';\nimport { type CommonProps, type TooltipObjectProps } from '../_common/types';\nimport { useSemiControlledInput } from '../_common/use-semi-controlled-input';\nimport { needleWarningMessage } from '../_common/utils';\nimport {\n ExclamationCircleIconSolid,\n InformationCircleIconOutline,\n XMarkIconOutline,\n} from '../icons';\nimport { LoadingSpinner } from '../loading-spinner';\nimport { Skeleton } from '../skeleton';\nimport { Tooltip } from '../tooltip';\nimport { Typography } from '../typography';\n\ntype TextInputProps = {\n /** Assistive text displayed below the input */\n helpText?: string | ReactNode;\n\n /** Error message displayed below the input. When provided, it overrides `helpText` and shows an error icon */\n errorText?: string | ReactNode;\n\n /** Leading element rendered inside the input */\n leadingElement?: ReactElement;\n\n /** Trailing element rendered inside the input */\n trailingElement?: ReactElement;\n\n /** Size of the input */\n size?: 'small' | 'medium' | 'large';\n\n /** Whether the input is read-only */\n isReadOnly?: boolean;\n\n /**\n * Whether to display the Required/Optional label next to the field label.\n * Shows Required if isRequired is true, otherwise shows Optional.\n * @default false\n */\n showRequiredOrOptionalLabel?: boolean;\n\n /** Whether the input is disabled */\n isDisabled?: boolean;\n\n /** Whether the input is required */\n isRequired?: boolean;\n\n /** The current value of the input */\n value?: React.ComponentPropsWithoutRef<'input'>['value'];\n\n /** Placeholder text displayed when the input is empty */\n placeholder?: React.ComponentPropsWithoutRef<'input'>['placeholder'];\n\n /** Callback function triggered when the input value changes */\n onChange?: React.ComponentPropsWithoutRef<'input'>['onChange'];\n\n /** Whether the input should take the full available width */\n isFluid?: boolean;\n\n /** Text displayed in the information tooltip shown next to the label */\n moreInformationText?: React.ReactNode;\n\n /** The label displayed above the input */\n label?: string | React.ReactNode;\n\n /** Props for the Tooltip component used by the information icon */\n tooltipProps?: TooltipObjectProps;\n\n /** Whether to render skeletons instead of content */\n isSkeletonLoading?: boolean;\n\n /** Additional props forwarded to the underlying Skeleton components */\n skeletonProps?: React.ComponentProps<typeof Skeleton>;\n\n /** Whether to show the clear button */\n isClearable?: boolean;\n\n /** Whether to show the loading spinner */\n isLoading?: boolean;\n};\n\n/**\n *\n *\n * TextInput Component\n *\n *\n */\n\nexport const TextInput = ({\n label,\n isFluid,\n errorText,\n helpText,\n leadingElement,\n trailingElement,\n showRequiredOrOptionalLabel = false,\n moreInformationText,\n size = 'medium',\n placeholder,\n value,\n tooltipProps,\n htmlAttributes,\n isDisabled,\n isReadOnly,\n isRequired,\n onChange,\n isClearable = false,\n className,\n style,\n isSkeletonLoading = false,\n isLoading = false,\n skeletonProps,\n ref,\n ...restProps\n}: CommonProps<'input', TextInputProps>) => {\n const [internalState, internalOnChange] = useSemiControlledInput({\n inputType: 'text',\n isControlled: value !== undefined,\n onChange,\n state: value ?? '',\n });\n const hintId = useId();\n\n const containerWrappingClasses = classNames(`ndl-text-input`, className, {\n 'ndl-disabled': isDisabled,\n 'ndl-has-error': errorText,\n 'ndl-has-icon': leadingElement || trailingElement || errorText,\n 'ndl-has-leading-icon': leadingElement,\n 'ndl-has-trailing-icon': trailingElement || errorText,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-read-only': isReadOnly,\n 'ndl-small': size === 'small',\n });\n\n const hasEmptyLabelValue =\n label === undefined || label === null || label === '';\n\n const labelWrappingClasses = classNames('ndl-form-item-label', {\n 'ndl-fluid': isFluid,\n 'ndl-form-item-no-label': hasEmptyLabelValue,\n });\n\n const combinedHtmlInputAttributes: InputHTMLAttributes<HTMLInputElement> = {\n ...htmlAttributes,\n className: classNames('ndl-input', htmlAttributes?.className),\n };\n const ariaLabel = combinedHtmlInputAttributes['aria-label'];\n const isCustomLabel = Boolean(label) && typeof label !== 'string';\n const hasCustomLabelAndNoAriaLabel =\n isCustomLabel && (ariaLabel === undefined || ariaLabel === '');\n const shouldRenderHint = isClearable || isLoading;\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (isClearable && event.key === 'Escape' && Boolean(internalState)) {\n event.preventDefault();\n event.stopPropagation();\n internalOnChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n }\n htmlAttributes?.onKeyDown?.(event);\n };\n\n useMemo(() => {\n if (!label && !ariaLabel) {\n needleWarningMessage(\n 'A TextInput without a label does not have an aria label, be sure to include an aria label for screen readers. Link: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI',\n );\n }\n\n if (hasCustomLabelAndNoAriaLabel) {\n needleWarningMessage(customLabelAndNoAriaLabelWarningMessage);\n }\n }, [label, ariaLabel, hasCustomLabelAndNoAriaLabel]);\n\n const informationIconClasses = classNames({\n 'ndl-information-icon-large': size === 'large',\n 'ndl-information-icon-small': size === 'small' || size === 'medium',\n });\n\n return (\n <div className={containerWrappingClasses} style={style}>\n {/* We enable implicit label wrapping */}\n {/* Source: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI */}\n <label className={labelWrappingClasses}>\n {!hasEmptyLabelValue && (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n <div className=\"ndl-label-text-wrapper\">\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n className=\"ndl-label-text\"\n >\n {label}\n </Typography>\n {Boolean(moreInformationText) && (\n <Tooltip {...tooltipProps?.root} type=\"simple\">\n <Tooltip.Trigger\n {...tooltipProps?.trigger}\n className={informationIconClasses}\n hasButtonWrapper\n >\n <div\n tabIndex={0}\n role=\"button\"\n aria-label=\"Information icon\"\n >\n <InformationCircleIconOutline />\n </div>\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n {moreInformationText}\n </Tooltip.Content>\n </Tooltip>\n )}\n {showRequiredOrOptionalLabel && (\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n className=\"ndl-form-item-optional\"\n >\n {isRequired === true ? 'Required' : 'Optional'}\n </Typography>\n )}\n </div>\n </Skeleton>\n )}\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n <div className=\"ndl-input-wrapper\">\n {(leadingElement || (isLoading && !trailingElement)) && (\n <div className=\"ndl-element-leading ndl-element\">\n {isLoading ? (\n <LoadingSpinner\n size={size === 'large' ? 'medium' : 'small'}\n className={\n size === 'large'\n ? 'ndl-medium-spinner'\n : 'ndl-small-spinner'\n }\n />\n ) : (\n leadingElement\n )}\n </div>\n )}\n <div\n className={classNames('ndl-input-container', {\n 'ndl-clearable': isClearable,\n })}\n >\n <input\n ref={ref}\n readOnly={isReadOnly}\n disabled={isDisabled}\n required={isRequired}\n value={internalState}\n placeholder={placeholder}\n type=\"text\"\n onChange={internalOnChange}\n aria-describedby={shouldRenderHint ? hintId : undefined}\n {...combinedHtmlInputAttributes}\n onKeyDown={handleInputKeyDown}\n {...restProps}\n />\n {shouldRenderHint && (\n <span id={hintId} className=\"ndl-text-input-hint\">\n {isLoading && 'Loading '}\n {isClearable && 'Press Escape to clear input.'}\n </span>\n )}\n {isClearable && Boolean(internalState) && (\n <div className=\"ndl-element-clear ndl-element\">\n <button\n tabIndex={-1}\n aria-hidden={true}\n type=\"button\"\n title=\"Clear input (Esc)\"\n onClick={() => {\n internalOnChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n }}\n >\n <XMarkIconOutline className=\"n-size-4\" />\n </button>\n </div>\n )}\n </div>\n {trailingElement && (\n <div className=\"ndl-element-trailing ndl-element\">\n {isLoading && !leadingElement ? (\n <LoadingSpinner\n size={size === 'large' ? 'medium' : 'small'}\n className={\n size === 'large'\n ? 'ndl-medium-spinner'\n : 'ndl-small-spinner'\n }\n />\n ) : (\n trailingElement\n )}\n </div>\n )}\n </div>\n </Skeleton>\n </label>\n {Boolean(helpText) && !errorText && (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n isLoading={isSkeletonLoading}\n >\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-form-message\"\n >\n {helpText}\n </Typography>\n </Skeleton>\n )}\n {Boolean(errorText) && (\n // TODO v4: We might want to have a min width for the container for the messages to help skeleton loading.\n // Currently the message fills 100% of the width while the rest of the text input has a set width.\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n width=\"fit-content\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n <div className=\"ndl-form-message\">\n <div className=\"ndl-error-icon\">\n <ExclamationCircleIconSolid />\n </div>\n <Typography\n className=\"ndl-error-text\"\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n >\n {errorText}\n </Typography>\n </div>\n </Skeleton>\n )}\n </div>\n );\n};\n"]}
|
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.TextInputFullSource = exports.TextInputLoadingSource = exports.TextInputSizesSource = exports.TextInputPasswordSource = exports.TextInputWithIconsSource = exports.TextInputNumberSource = exports.TextInputEmailSource = exports.TextInputInformationIconSource = exports.TextInputErrorSource = exports.TextInputReadonlySource = exports.TextInputDisabledSource = exports.TextInputOptionalSource = exports.TextInputRequiredSource = exports.TextInputDefaultSource = exports.TextInputFull = exports.TextInputLoading = exports.TextInputSizes = exports.TextInputPassword = exports.TextInputWithIcons = exports.TextInputNumber = exports.TextInputEmail = exports.TextInputInformationIcon = exports.TextInputError = exports.TextInputReadonly = exports.TextInputDisabled = exports.TextInputOptional = exports.TextInputRequired = exports.TextInputDefault = void 0;
|
|
26
|
+
exports.TextInputLoadingSpinnerSource = exports.TextInputClearableSource = exports.TextInputFullSource = exports.TextInputLoadingSource = exports.TextInputSizesSource = exports.TextInputPasswordSource = exports.TextInputWithIconsSource = exports.TextInputNumberSource = exports.TextInputEmailSource = exports.TextInputInformationIconSource = exports.TextInputErrorSource = exports.TextInputReadonlySource = exports.TextInputDisabledSource = exports.TextInputOptionalSource = exports.TextInputRequiredSource = exports.TextInputDefaultSource = exports.TextInputLoadingSpinner = exports.TextInputClearable = exports.TextInputFull = exports.TextInputLoading = exports.TextInputSizes = exports.TextInputPassword = exports.TextInputWithIcons = exports.TextInputNumber = exports.TextInputEmail = exports.TextInputInformationIcon = exports.TextInputError = exports.TextInputReadonly = exports.TextInputDisabled = exports.TextInputOptional = exports.TextInputRequired = exports.TextInputDefault = void 0;
|
|
27
27
|
var text_input_default_story_1 = require("./text-input-default.story");
|
|
28
28
|
Object.defineProperty(exports, "TextInputDefault", { enumerable: true, get: function () { return __importDefault(text_input_default_story_1).default; } });
|
|
29
29
|
var text_input_required_story_1 = require("./text-input-required.story");
|
|
@@ -52,7 +52,12 @@ var text_input_loading_story_1 = require("./text-input-loading.story");
|
|
|
52
52
|
Object.defineProperty(exports, "TextInputLoading", { enumerable: true, get: function () { return __importDefault(text_input_loading_story_1).default; } });
|
|
53
53
|
var text_input_full_story_1 = require("./text-input-full.story");
|
|
54
54
|
Object.defineProperty(exports, "TextInputFull", { enumerable: true, get: function () { return __importDefault(text_input_full_story_1).default; } });
|
|
55
|
+
var text_input_clearable_story_1 = require("./text-input-clearable.story");
|
|
56
|
+
Object.defineProperty(exports, "TextInputClearable", { enumerable: true, get: function () { return __importDefault(text_input_clearable_story_1).default; } });
|
|
57
|
+
var text_input_loading_spinner_story_1 = require("./text-input-loading-spinner.story");
|
|
58
|
+
Object.defineProperty(exports, "TextInputLoadingSpinner", { enumerable: true, get: function () { return __importDefault(text_input_loading_spinner_story_1).default; } });
|
|
55
59
|
const export_stories_utils_1 = require("../../_common/export-stories-utils");
|
|
60
|
+
const text_input_clearable_story_raw_1 = __importDefault(require("./text-input-clearable.story?raw"));
|
|
56
61
|
const text_input_default_story_raw_1 = __importDefault(require("./text-input-default.story?raw"));
|
|
57
62
|
const text_input_disabled_story_raw_1 = __importDefault(require("./text-input-disabled.story?raw"));
|
|
58
63
|
const text_input_email_story_raw_1 = __importDefault(require("./text-input-email.story?raw"));
|
|
@@ -60,6 +65,7 @@ const text_input_error_story_raw_1 = __importDefault(require("./text-input-error
|
|
|
60
65
|
const text_input_full_story_raw_1 = __importDefault(require("./text-input-full.story?raw"));
|
|
61
66
|
const text_input_information_icon_story_raw_1 = __importDefault(require("./text-input-information-icon.story?raw"));
|
|
62
67
|
const text_input_loading_story_raw_1 = __importDefault(require("./text-input-loading.story?raw"));
|
|
68
|
+
const text_input_loading_spinner_story_raw_1 = __importDefault(require("./text-input-loading-spinner.story?raw"));
|
|
63
69
|
const text_input_number_story_raw_1 = __importDefault(require("./text-input-number.story?raw"));
|
|
64
70
|
const text_input_optional_story_raw_1 = __importDefault(require("./text-input-optional.story?raw"));
|
|
65
71
|
const text_input_password_story_raw_1 = __importDefault(require("./text-input-password.story?raw"));
|
|
@@ -81,4 +87,6 @@ exports.TextInputPasswordSource = (0, export_stories_utils_1.removeLicenseHeader
|
|
|
81
87
|
exports.TextInputSizesSource = (0, export_stories_utils_1.removeLicenseHeader)(text_input_sizes_story_raw_1.default);
|
|
82
88
|
exports.TextInputLoadingSource = (0, export_stories_utils_1.removeLicenseHeader)(text_input_loading_story_raw_1.default);
|
|
83
89
|
exports.TextInputFullSource = (0, export_stories_utils_1.removeLicenseHeader)(text_input_full_story_raw_1.default);
|
|
90
|
+
exports.TextInputClearableSource = (0, export_stories_utils_1.removeLicenseHeader)(text_input_clearable_story_raw_1.default);
|
|
91
|
+
exports.TextInputLoadingSpinnerSource = (0, export_stories_utils_1.removeLicenseHeader)(text_input_loading_spinner_story_raw_1.default);
|
|
84
92
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/text-input/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,uEAAyE;AAAhE,6IAAA,OAAO,OAAoB;AACpC,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,yEAA2E;AAAlE,+IAAA,OA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G,IAAA,0CAAmB,EAC9D,8CAAgC,CACjC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as TextInputDefault } from './text-input-default.story';\nexport { default as TextInputRequired } from './text-input-required.story';\nexport { default as TextInputOptional } from './text-input-optional.story';\nexport { default as TextInputDisabled } from './text-input-disabled.story';\nexport { default as TextInputReadonly } from './text-input-readonly.story';\nexport { default as TextInputError } from './text-input-error.story';\nexport { default as TextInputInformationIcon } from './text-input-information-icon.story';\nexport { default as TextInputEmail } from './text-input-email.story';\nexport { default as TextInputNumber } from './text-input-number.story';\nexport { default as TextInputWithIcons } from './text-input-with-icons.story';\nexport { default as TextInputPassword } from './text-input-password.story';\nexport { default as TextInputSizes } from './text-input-sizes.story';\nexport { default as TextInputLoading } from './text-input-loading.story';\nexport { default as TextInputFull } from './text-input-full.story';\nexport { default as TextInputClearable } from './text-input-clearable.story';\nexport { default as TextInputLoadingSpinner } from './text-input-loading-spinner.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport TextInputClearableSourceRaw from './text-input-clearable.story?raw';\nimport TextInputDefaultSourceRaw from './text-input-default.story?raw';\nimport TextInputDisabledSourceRaw from './text-input-disabled.story?raw';\nimport TextInputEmailSourceRaw from './text-input-email.story?raw';\nimport TextInputErrorSourceRaw from './text-input-error.story?raw';\nimport TextInputFullSourceRaw from './text-input-full.story?raw';\nimport TextInputInformationIconSourceRaw from './text-input-information-icon.story?raw';\nimport TextInputLoadingSourceRaw from './text-input-loading.story?raw';\nimport TextInputLoadingSpinnerSourceRaw from './text-input-loading-spinner.story?raw';\nimport TextInputNumberSourceRaw from './text-input-number.story?raw';\nimport TextInputOptionalSourceRaw from './text-input-optional.story?raw';\nimport TextInputPasswordSourceRaw from './text-input-password.story?raw';\nimport TextInputReadonlySourceRaw from './text-input-readonly.story?raw';\nimport TextInputRequiredSourceRaw from './text-input-required.story?raw';\nimport TextInputSizesSourceRaw from './text-input-sizes.story?raw';\nimport TextInputWithIconsSourceRaw from './text-input-with-icons.story?raw';\n\nexport const TextInputDefaultSource = removeLicenseHeader(\n TextInputDefaultSourceRaw,\n);\nexport const TextInputRequiredSource = removeLicenseHeader(\n TextInputRequiredSourceRaw,\n);\nexport const TextInputOptionalSource = removeLicenseHeader(\n TextInputOptionalSourceRaw,\n);\nexport const TextInputDisabledSource = removeLicenseHeader(\n TextInputDisabledSourceRaw,\n);\nexport const TextInputReadonlySource = removeLicenseHeader(\n TextInputReadonlySourceRaw,\n);\nexport const TextInputErrorSource = removeLicenseHeader(\n TextInputErrorSourceRaw,\n);\nexport const TextInputInformationIconSource = removeLicenseHeader(\n TextInputInformationIconSourceRaw,\n);\nexport const TextInputEmailSource = removeLicenseHeader(\n TextInputEmailSourceRaw,\n);\nexport const TextInputNumberSource = removeLicenseHeader(\n TextInputNumberSourceRaw,\n);\nexport const TextInputWithIconsSource = removeLicenseHeader(\n TextInputWithIconsSourceRaw,\n);\nexport const TextInputPasswordSource = removeLicenseHeader(\n TextInputPasswordSourceRaw,\n);\nexport const TextInputSizesSource = removeLicenseHeader(\n TextInputSizesSourceRaw,\n);\nexport const TextInputLoadingSource = removeLicenseHeader(\n TextInputLoadingSourceRaw,\n);\nexport const TextInputFullSource = removeLicenseHeader(TextInputFullSourceRaw);\nexport const TextInputClearableSource = removeLicenseHeader(\n TextInputClearableSourceRaw,\n);\nexport const TextInputLoadingSpinnerSource = removeLicenseHeader(\n TextInputLoadingSpinnerSourceRaw,\n);\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) "Neo4j"
|
|
7
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
8
|
+
*
|
|
9
|
+
* This file is part of Neo4j.
|
|
10
|
+
*
|
|
11
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
|
+
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
+
const Component = () => {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "Clearable", isClearable: true, placeholder: "Type something" }));
|
|
28
|
+
};
|
|
29
|
+
exports.default = Component;
|
|
30
|
+
//# sourceMappingURL=text-input-clearable.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-input-clearable.story.js","sourceRoot":"","sources":["../../../../src/text-input/stories/text-input-clearable.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA6C;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,uBAAC,iBAAS,IAAC,KAAK,EAAC,WAAW,EAAC,WAAW,QAAC,WAAW,EAAC,gBAAgB,GAAG,CACzE,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { TextInput } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <TextInput label=\"Clearable\" isClearable placeholder=\"Type something\" />\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) "Neo4j"
|
|
7
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
8
|
+
*
|
|
9
|
+
* This file is part of Neo4j.
|
|
10
|
+
*
|
|
11
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
|
+
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
+
const icons_1 = require("@neo4j-ndl/react/icons");
|
|
27
|
+
const Component = () => {
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-16", children: [(0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "Default loading", isLoading: true, placeholder: "Placeholder" }), (0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "With leading element", isLoading: true, leadingElement: (0, jsx_runtime_1.jsx)(icons_1.CalendarDaysIconOutline, {}), placeholder: "Placeholder" }), (0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "With trailing element", isLoading: true, trailingElement: (0, jsx_runtime_1.jsx)(icons_1.CalendarDaysIconOutline, {}), placeholder: "Placeholder" }), (0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "With leading and trailing element", isLoading: true, leadingElement: (0, jsx_runtime_1.jsx)(icons_1.CalendarDaysIconOutline, {}), trailingElement: (0, jsx_runtime_1.jsx)(icons_1.CalendarDaysIconOutline, {}), placeholder: "Placeholder" })] }));
|
|
29
|
+
};
|
|
30
|
+
exports.default = Component;
|
|
31
|
+
//# sourceMappingURL=text-input-loading-spinner.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-input-loading-spinner.story.js","sourceRoot":"","sources":["../../../../src/text-input/stories/text-input-loading-spinner.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA6C;AAC7C,kDAAiE;AAEjE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,iCAAK,SAAS,EAAC,kCAAkC,aAC/C,uBAAC,iBAAS,IAAC,KAAK,EAAC,iBAAiB,EAAC,SAAS,QAAC,WAAW,EAAC,aAAa,GAAG,EACzE,uBAAC,iBAAS,IACR,KAAK,EAAC,sBAAsB,EAC5B,SAAS,QACT,cAAc,EAAE,uBAAC,+BAAuB,KAAG,EAC3C,WAAW,EAAC,aAAa,GACzB,EACF,uBAAC,iBAAS,IACR,KAAK,EAAC,uBAAuB,EAC7B,SAAS,QACT,eAAe,EAAE,uBAAC,+BAAuB,KAAG,EAC5C,WAAW,EAAC,aAAa,GACzB,EACF,uBAAC,iBAAS,IACR,KAAK,EAAC,mCAAmC,EACzC,SAAS,QACT,cAAc,EAAE,uBAAC,+BAAuB,KAAG,EAC3C,eAAe,EAAE,uBAAC,+BAAuB,KAAG,EAC5C,WAAW,EAAC,aAAa,GACzB,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { TextInput } from '@neo4j-ndl/react';\nimport { CalendarDaysIconOutline } from '@neo4j-ndl/react/icons';\n\nconst Component = () => {\n return (\n <div className=\"n-flex n-flex-col n-gap-token-16\">\n <TextInput label=\"Default loading\" isLoading placeholder=\"Placeholder\" />\n <TextInput\n label=\"With leading element\"\n isLoading\n leadingElement={<CalendarDaysIconOutline />}\n placeholder=\"Placeholder\"\n />\n <TextInput\n label=\"With trailing element\"\n isLoading\n trailingElement={<CalendarDaysIconOutline />}\n placeholder=\"Placeholder\"\n />\n <TextInput\n label=\"With leading and trailing element\"\n isLoading\n leadingElement={<CalendarDaysIconOutline />}\n trailingElement={<CalendarDaysIconOutline />}\n placeholder=\"Placeholder\"\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -27,9 +27,7 @@ const icons_1 = require("@neo4j-ndl/react/icons");
|
|
|
27
27
|
const react_2 = require("react");
|
|
28
28
|
const Component = () => {
|
|
29
29
|
const [searchValue, setSearchValue] = (0, react_2.useState)('');
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "
|
|
31
|
-
type: 'text',
|
|
32
|
-
} }));
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "With icons", leadingElement: (0, jsx_runtime_1.jsx)(icons_1.DatabasePlugIcon, {}), trailingElement: (0, jsx_runtime_1.jsx)(icons_1.DatabasePlusIcon, {}), value: searchValue, onChange: (e) => setSearchValue(e.target.value) }));
|
|
33
31
|
};
|
|
34
32
|
exports.default = Component;
|
|
35
33
|
//# sourceMappingURL=text-input-with-icons.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input-with-icons.story.js","sourceRoot":"","sources":["../../../../src/text-input/stories/text-input-with-icons.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,
|
|
1
|
+
{"version":3,"file":"text-input-with-icons.story.js","sourceRoot":"","sources":["../../../../src/text-input/stories/text-input-with-icons.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA6C;AAC7C,kDAA4E;AAC5E,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAEnD,OAAO,CACL,uBAAC,iBAAS,IACR,KAAK,EAAC,YAAY,EAClB,cAAc,EAAE,uBAAC,wBAAgB,KAAG,EACpC,eAAe,EAAE,uBAAC,wBAAgB,KAAG,EACrC,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAC/C,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { TextInput } from '@neo4j-ndl/react';\nimport { DatabasePlugIcon, DatabasePlusIcon } from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [searchValue, setSearchValue] = useState('');\n\n return (\n <TextInput\n label=\"With icons\"\n leadingElement={<DatabasePlugIcon />}\n trailingElement={<DatabasePlusIcon />}\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n />\n );\n};\n\nexport default Component;\n"]}
|