@neo4j-ndl/react 4.3.5 → 4.3.6

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.
Files changed (36) hide show
  1. package/lib/cjs/text-input/TextInput.js +33 -2
  2. package/lib/cjs/text-input/TextInput.js.map +1 -1
  3. package/lib/cjs/text-input/stories/index.js +9 -1
  4. package/lib/cjs/text-input/stories/index.js.map +1 -1
  5. package/lib/cjs/text-input/stories/text-input-clearable.story.js +30 -0
  6. package/lib/cjs/text-input/stories/text-input-clearable.story.js.map +1 -0
  7. package/lib/cjs/text-input/stories/text-input-loading-spinner.story.js +31 -0
  8. package/lib/cjs/text-input/stories/text-input-loading-spinner.story.js.map +1 -0
  9. package/lib/cjs/text-input/stories/text-input-with-icons.story.js +1 -3
  10. package/lib/cjs/text-input/stories/text-input-with-icons.story.js.map +1 -1
  11. package/lib/cjs/text-input/stories/text-input.stories.js +61 -35
  12. package/lib/cjs/text-input/stories/text-input.stories.js.map +1 -1
  13. package/lib/esm/text-input/TextInput.js +35 -4
  14. package/lib/esm/text-input/TextInput.js.map +1 -1
  15. package/lib/esm/text-input/stories/index.js +6 -0
  16. package/lib/esm/text-input/stories/index.js.map +1 -1
  17. package/lib/esm/text-input/stories/text-input-clearable.story.js +28 -0
  18. package/lib/esm/text-input/stories/text-input-clearable.story.js.map +1 -0
  19. package/lib/esm/text-input/stories/text-input-loading-spinner.story.js +29 -0
  20. package/lib/esm/text-input/stories/text-input-loading-spinner.story.js.map +1 -0
  21. package/lib/esm/text-input/stories/text-input-with-icons.story.js +3 -5
  22. package/lib/esm/text-input/stories/text-input-with-icons.story.js.map +1 -1
  23. package/lib/esm/text-input/stories/text-input.stories.js +61 -35
  24. package/lib/esm/text-input/stories/text-input.stories.js.map +1 -1
  25. package/lib/types/text-input/TextInput.d.ts +5 -1
  26. package/lib/types/text-input/TextInput.d.ts.map +1 -1
  27. package/lib/types/text-input/stories/index.d.ts +4 -0
  28. package/lib/types/text-input/stories/index.d.ts.map +1 -1
  29. package/lib/types/text-input/stories/text-input-clearable.story.d.ts +24 -0
  30. package/lib/types/text-input/stories/text-input-clearable.story.d.ts.map +1 -0
  31. package/lib/types/text-input/stories/text-input-loading-spinner.story.d.ts +24 -0
  32. package/lib/types/text-input/stories/text-input-loading-spinner.story.d.ts.map +1 -0
  33. package/lib/types/text-input/stories/text-input-with-icons.story.d.ts.map +1 -1
  34. package/lib/types/text-input/stories/text-input.stories.d.ts +3 -1
  35. package/lib/types/text-input/stories/text-input.stories.d.ts.map +1 -1
  36. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"text-input.stories.js","sourceRoot":"","sources":["../../../../src/text-input/stories/text-input.stories.tsx"],"names":[],"mappings":";;;;AAuBA,uCAAwC;AACxC,wBA6BW;AAEX,MAAM,aAAa,GAA2B;IAC5C,KAAK,EAAE,sBAAsB;IAC7B,EAAE,EAAE,uBAAuB;IAC3B,SAAS,EAAE,iBAAS;IACpB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,gCAAK,SAAS,EAAC,yBAAyB,YACtC,uBAAC,KAAK,KAAG,GACL,CACP;KACF;CACF,CAAC;AAEF,kBAAe,aAAa,CAAC;AAGhB,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,mBAAgB;IACxB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,yBAAsB;aAC7B;SACF;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,oBAAiB;IACzB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE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EAAE,EAAE;IACR,MAAM,EAAE,mBAAgB;IACxB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,yBAAsB;aAC7B;SACF;KACF;CACF,CAAC;AAEW,QAAA,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,gBAAa;IACrB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,sBAAmB;aAC1B;SACF;KACF;CACF,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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { TextInput } from '../../index';\nimport {\n TextInputDefault,\n TextInputDefaultSource,\n TextInputDisabled,\n TextInputDisabledSource,\n TextInputEmail,\n TextInputEmailSource,\n TextInputError,\n TextInputErrorSource,\n TextInputFull,\n TextInputFullSource,\n TextInputInformationIcon,\n TextInputInformationIconSource,\n TextInputLoading,\n TextInputLoadingSource,\n TextInputNumber,\n TextInputNumberSource,\n TextInputOptional,\n TextInputOptionalSource,\n TextInputPassword,\n TextInputPasswordSource,\n TextInputReadonly,\n TextInputReadonlySource,\n TextInputRequired,\n TextInputRequiredSource,\n TextInputSizes,\n TextInputSizesSource,\n TextInputWithIcons,\n TextInputWithIconsSource,\n} from '.';\n\nconst componentMeta: Meta<typeof TextInput> = {\n title: 'Components/TextInput',\n id: 'components-text-input',\n component: TextInput,\n tags: ['docsPage'],\n parameters: {\n controls: { disable: true },\n },\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center\">\n <Story />\n </div>\n ),\n ],\n};\n\nexport default componentMeta;\ntype Story = StoryObj<typeof TextInput>;\n\nexport const Default: Story = {\n args: {},\n render: TextInputDefault,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputDefaultSource,\n },\n },\n },\n};\n\nexport const Required: Story = {\n args: {},\n render: TextInputRequired,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputRequiredSource,\n },\n },\n },\n};\n\nexport const Optional: Story = {\n args: {},\n render: TextInputOptional,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputOptionalSource,\n },\n },\n },\n};\n\nexport const Disabled: Story = {\n args: {},\n render: TextInputDisabled,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputDisabledSource,\n },\n },\n },\n};\n\nexport const Readonly: Story = {\n args: {},\n render: TextInputReadonly,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputReadonlySource,\n },\n },\n },\n};\n\nexport const Error: Story = {\n args: {},\n render: TextInputError,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputErrorSource,\n },\n },\n },\n};\n\nexport const InformationIcon: Story = {\n args: {},\n render: TextInputInformationIcon,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputInformationIconSource,\n },\n },\n },\n};\n\nexport const Email: Story = {\n args: {},\n render: TextInputEmail,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputEmailSource,\n },\n },\n },\n};\n\nexport const Number: Story = {\n args: {},\n render: TextInputNumber,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputNumberSource,\n },\n },\n },\n};\n\nexport const WithIcons: Story = {\n args: {},\n render: TextInputWithIcons,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputWithIconsSource,\n },\n },\n },\n};\n\nexport const Password: Story = {\n args: {},\n render: TextInputPassword,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputPasswordSource,\n },\n },\n },\n};\n\nexport const Sizes: Story = {\n args: {},\n render: TextInputSizes,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputSizesSource,\n },\n },\n },\n};\n\nexport const Loading: Story = {\n args: {},\n render: TextInputLoading,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputLoadingSource,\n },\n },\n },\n};\n\nexport const Full: Story = {\n args: {},\n render: TextInputFull,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: TextInputFullSource,\n },\n },\n },\n};\n"]}
1
+ {"version":3,"file":"text-input.stories.js","sourceRoot":"","sources":["../../../../src/text-input/stories/text-input.stories.tsx"],"names":[],"mappings":";;;;AAuBA,uCAAwC;AACxC,wBAiCW;AAEX,MAAM,aAAa,GAA2B;IAC5C,SAAS,EAAE,iBAAS;IACpB,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,gCAAK,SAAS,EAAC,yBAAyB,YACtC,uBAAC,KAAK,KAAG,GACL,CACP;KACF;IACD,EAAE,EAAE,uBAAuB;IAC3B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,kBAAe,aAAa,CAAC;AAGhB,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;Y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o4j.\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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { TextInput } from '../../index';\nimport {\n TextInputClearable,\n TextInputClearableSource,\n TextInputDefault,\n TextInputDefaultSource,\n TextInputDisabled,\n TextInputDisabledSource,\n TextInputEmail,\n TextInputEmailSource,\n TextInputError,\n TextInputErrorSource,\n TextInputFull,\n TextInputFullSource,\n TextInputInformationIcon,\n TextInputInformationIconSource,\n TextInputLoading,\n TextInputLoadingSource,\n TextInputLoadingSpinner,\n TextInputLoadingSpinnerSource,\n TextInputNumber,\n TextInputNumberSource,\n TextInputOptional,\n TextInputOptionalSource,\n TextInputPassword,\n TextInputPasswordSource,\n TextInputReadonly,\n TextInputReadonlySource,\n TextInputRequired,\n TextInputRequiredSource,\n TextInputSizes,\n TextInputSizesSource,\n TextInputWithIcons,\n TextInputWithIconsSource,\n} from '.';\n\nconst componentMeta: Meta<typeof TextInput> = {\n component: TextInput,\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center\">\n <Story />\n </div>\n ),\n ],\n id: 'components-text-input',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/TextInput',\n};\n\nexport default componentMeta;\ntype Story = StoryObj<typeof TextInput>;\n\nexport const Default: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputDefaultSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputDefault,\n};\n\nexport const Required: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputRequiredSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputRequired,\n};\n\nexport const Optional: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputOptionalSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputOptional,\n};\n\nexport const Disabled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputDisabledSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputDisabled,\n};\n\nexport const Readonly: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputReadonlySource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputReadonly,\n};\n\nexport const Error: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputErrorSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputError,\n};\n\nexport const InformationIcon: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputInformationIconSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputInformationIcon,\n};\n\nexport const Email: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputEmailSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputEmail,\n};\n\nexport const Number: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputNumberSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputNumber,\n};\n\nexport const WithIcons: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputWithIconsSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputWithIcons,\n};\n\nexport const Password: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputPasswordSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputPassword,\n};\n\nexport const Sizes: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputSizesSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputSizes,\n};\n\nexport const SkeletonLoading: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputLoadingSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputLoading,\n};\n\nexport const Full: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputFullSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputFull,\n};\n\nexport const Clearable: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputClearableSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputClearable,\n};\n\nexport const Loading: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: TextInputLoadingSpinnerSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: TextInputLoadingSpinner,\n};\n"]}
@@ -31,10 +31,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
31
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
32
  */
33
33
  import classNames from 'classnames';
34
- import { useMemo, } from 'react';
34
+ import { useId, useMemo, } from 'react';
35
35
  import { customLabelAndNoAriaLabelWarningMessage } from '../_common/messages';
36
+ import { useSemiControlledInput } from '../_common/use-semi-controlled-input';
36
37
  import { needleWarningMessage } from '../_common/utils';
37
- import { ExclamationCircleIconSolid, InformationCircleIconOutline, } from '../icons';
38
+ import { ExclamationCircleIconSolid, InformationCircleIconOutline, XMarkIconOutline, } from '../icons';
39
+ import { LoadingSpinner } from '../loading-spinner';
38
40
  import { Skeleton } from '../skeleton';
39
41
  import { Tooltip } from '../tooltip';
40
42
  import { Typography } from '../typography';
@@ -46,7 +48,14 @@ import { Typography } from '../typography';
46
48
  *
47
49
  */
48
50
  export const TextInput = (_a) => {
49
- 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"]);
51
+ 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"]);
52
+ const [internalState, internalOnChange] = useSemiControlledInput({
53
+ inputType: 'text',
54
+ isControlled: value !== undefined,
55
+ onChange,
56
+ state: value !== null && value !== void 0 ? value : '',
57
+ });
58
+ const hintId = useId();
50
59
  const containerWrappingClasses = classNames(`ndl-text-input`, className, {
51
60
  'ndl-disabled': isDisabled,
52
61
  'ndl-has-error': errorText,
@@ -67,6 +76,18 @@ export const TextInput = (_a) => {
67
76
  const ariaLabel = combinedHtmlInputAttributes['aria-label'];
68
77
  const isCustomLabel = Boolean(label) && typeof label !== 'string';
69
78
  const hasCustomLabelAndNoAriaLabel = isCustomLabel && (ariaLabel === undefined || ariaLabel === '');
79
+ const shouldRenderHint = isClearable || isLoading;
80
+ const handleInputKeyDown = (event) => {
81
+ var _a;
82
+ if (isClearable && event.key === 'Escape' && Boolean(internalState)) {
83
+ event.preventDefault();
84
+ event.stopPropagation();
85
+ internalOnChange === null || internalOnChange === void 0 ? void 0 : internalOnChange({
86
+ target: { value: '' },
87
+ });
88
+ }
89
+ (_a = htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(htmlAttributes, event);
90
+ };
70
91
  useMemo(() => {
71
92
  if (!label && !ariaLabel) {
72
93
  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');
@@ -79,7 +100,17 @@ export const TextInput = (_a) => {
79
100
  'ndl-information-icon-large': size === 'large',
80
101
  'ndl-information-icon-small': size === 'small' || size === 'medium',
81
102
  });
82
- return (_jsxs("div", { className: containerWrappingClasses, style: style, children: [_jsxs("label", { className: labelWrappingClasses, children: [!hasEmptyLabelValue && (_jsx(Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: _jsxs("div", { className: "ndl-label-text-wrapper", children: [_jsx(Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-label-text", children: label }), Boolean(moreInformationText) && (_jsxs(Tooltip, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { type: "simple", children: [_jsx(Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { className: informationIconClasses, hasButtonWrapper: true, children: _jsx("div", { tabIndex: 0, role: "button", "aria-label": "Information icon", children: _jsx(InformationCircleIconOutline, {}) }) })), _jsx(Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: moreInformationText }))] }))), showRequiredOrOptionalLabel && (_jsx(Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-form-item-optional", children: isRequired === true ? 'Required' : 'Optional' }))] }) }))), _jsx(Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: _jsxs("div", { className: "ndl-input-wrapper", children: [leadingElement && (_jsx("div", { className: "ndl-element-leading ndl-element", children: leadingElement })), _jsx("input", Object.assign({ readOnly: isReadOnly, disabled: isDisabled, required: isRequired, value: value, placeholder: placeholder, type: "text", onChange: onChange }, combinedHtmlInputAttributes, restProps, { ref: ref })), trailingElement && (_jsx("div", { className: "ndl-element-trailing ndl-element", children: trailingElement }))] }) }))] }), Boolean(helpText) && !errorText && (_jsx(Skeleton, { onBackground: "weak", shape: "rectangular", isLoading: isSkeletonLoading, children: _jsx(Typography, { variant: size === 'large' ? 'body-medium' : 'body-small', className: "ndl-form-message", children: helpText }) })), Boolean(errorText) && (
103
+ return (_jsxs("div", { className: containerWrappingClasses, style: style, children: [_jsxs("label", { className: labelWrappingClasses, children: [!hasEmptyLabelValue && (_jsx(Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: _jsxs("div", { className: "ndl-label-text-wrapper", children: [_jsx(Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-label-text", children: label }), Boolean(moreInformationText) && (_jsxs(Tooltip, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { type: "simple", children: [_jsx(Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { className: informationIconClasses, hasButtonWrapper: true, children: _jsx("div", { tabIndex: 0, role: "button", "aria-label": "Information icon", children: _jsx(InformationCircleIconOutline, {}) }) })), _jsx(Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: moreInformationText }))] }))), showRequiredOrOptionalLabel && (_jsx(Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', className: "ndl-form-item-optional", children: isRequired === true ? 'Required' : 'Optional' }))] }) }))), _jsx(Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular" }, skeletonProps, { isLoading: isSkeletonLoading, children: _jsxs("div", { className: "ndl-input-wrapper", children: [(leadingElement || (isLoading && !trailingElement)) && (_jsx("div", { className: "ndl-element-leading ndl-element", children: isLoading ? (_jsx(LoadingSpinner, { size: size === 'large' ? 'medium' : 'small', className: size === 'large'
104
+ ? 'ndl-medium-spinner'
105
+ : 'ndl-small-spinner' })) : (leadingElement) })), _jsxs("div", { className: classNames('ndl-input-container', {
106
+ 'ndl-clearable': isClearable,
107
+ }), children: [_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 && (_jsxs("span", { id: hintId, className: "ndl-text-input-hint", children: [isLoading && 'Loading ', isClearable && 'Press Escape to clear input.'] })), isClearable && Boolean(internalState) && (_jsx("div", { className: "ndl-element-clear ndl-element", children: _jsx("button", { tabIndex: -1, "aria-hidden": true, type: "button", title: "Clear input (Esc)", onClick: () => {
108
+ internalOnChange === null || internalOnChange === void 0 ? void 0 : internalOnChange({
109
+ target: { value: '' },
110
+ });
111
+ }, children: _jsx(XMarkIconOutline, { className: "n-size-4" }) }) }))] }), trailingElement && (_jsx("div", { className: "ndl-element-trailing ndl-element", children: isLoading && !leadingElement ? (_jsx(LoadingSpinner, { size: size === 'large' ? 'medium' : 'small', className: size === 'large'
112
+ ? 'ndl-medium-spinner'
113
+ : 'ndl-small-spinner' })) : (trailingElement) }))] }) }))] }), Boolean(helpText) && !errorText && (_jsx(Skeleton, { onBackground: "weak", shape: "rectangular", isLoading: isSkeletonLoading, children: _jsx(Typography, { variant: size === 'large' ? 'body-medium' : 'body-small', className: "ndl-form-message", children: helpText }) })), Boolean(errorText) && (
83
114
  // TODO v4: We might want to have a min width for the container for the messages to help skeleton loading.
84
115
  // Currently the message fills 100% of the width while the rest of the text input has a set width.
85
116
  _jsx(Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular", width: "fit-content" }, skeletonProps, { isLoading: isSkeletonLoading, children: _jsxs("div", { className: "ndl-form-message", children: [_jsx("div", { className: "ndl-error-icon", children: _jsx(ExclamationCircleIconSolid, {}) }), _jsx(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,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAIL,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA8D3C;;;;;;GAMG;AAEH,MAAM,CAAC,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,UAAU,CAAC,gBAAgB,EAAE,SAAS,EAAE;QACvE,cAAc,EAAE,UAAU;QAC1B,eAAe,EAAE,SAAS;QAC1B,cAAc,EAAE,cAAc,IAAI,eAAe,IAAI,SAAS;QAC9D,sBAAsB,EAAE,cAAc;Q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G,CACP,CAAC;AACJ,CAAC,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 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"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAIL,KAAK,EACL,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,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AAU,IACT,OAAO,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,KAAC,QAAQ,kBACP,YAAY,EAAC,MAAM,EACnB,KAAK,EAAC,aAAa,EACnB,KAAK,EAAC,aAAa,IACf,aAAa,IACjB,SAAS,EAAE,iBAAiB,YAE5B,eAAK,SAAS,EAAC,kBAAkB,aAC/B,cAAK,SAAS,EAAC,gBAAgB,YAC7B,KAAC,0BAA0B,KAAG,GAC1B,EACN,KAAC,UAAU,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","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"]}
@@ -32,7 +32,10 @@ export { default as TextInputPassword } from './text-input-password.story';
32
32
  export { default as TextInputSizes } from './text-input-sizes.story';
33
33
  export { default as TextInputLoading } from './text-input-loading.story';
34
34
  export { default as TextInputFull } from './text-input-full.story';
35
+ export { default as TextInputClearable } from './text-input-clearable.story';
36
+ export { default as TextInputLoadingSpinner } from './text-input-loading-spinner.story';
35
37
  import { removeLicenseHeader } from '../../_common/export-stories-utils';
38
+ import TextInputClearableSourceRaw from './text-input-clearable.story?raw';
36
39
  import TextInputDefaultSourceRaw from './text-input-default.story?raw';
37
40
  import TextInputDisabledSourceRaw from './text-input-disabled.story?raw';
38
41
  import TextInputEmailSourceRaw from './text-input-email.story?raw';
@@ -40,6 +43,7 @@ import TextInputErrorSourceRaw from './text-input-error.story?raw';
40
43
  import TextInputFullSourceRaw from './text-input-full.story?raw';
41
44
  import TextInputInformationIconSourceRaw from './text-input-information-icon.story?raw';
42
45
  import TextInputLoadingSourceRaw from './text-input-loading.story?raw';
46
+ import TextInputLoadingSpinnerSourceRaw from './text-input-loading-spinner.story?raw';
43
47
  import TextInputNumberSourceRaw from './text-input-number.story?raw';
44
48
  import TextInputOptionalSourceRaw from './text-input-optional.story?raw';
45
49
  import TextInputPasswordSourceRaw from './text-input-password.story?raw';
@@ -61,4 +65,6 @@ export const TextInputPasswordSource = removeLicenseHeader(TextInputPasswordSour
61
65
  export const TextInputSizesSource = removeLicenseHeader(TextInputSizesSourceRaw);
62
66
  export const TextInputLoadingSource = removeLicenseHeader(TextInputLoadingSourceRaw);
63
67
  export const TextInputFullSource = removeLicenseHeader(TextInputFullSourceRaw);
68
+ export const TextInputClearableSource = removeLicenseHeader(TextInputClearableSourceRaw);
69
+ export const TextInputLoadingSpinnerSource = removeLicenseHeader(TextInputLoadingSpinnerSourceRaw);
64
70
  //# 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,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAA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D,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CACvD,yBAAyB,CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,sBAAsB,CAAC,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';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\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 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);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/text-input/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC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AM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CACvD,yBAAyB,CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,6BAA6B,GAAG,mBAAmB,CAC9D,gCAAgC,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,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { TextInput } from '@neo4j-ndl/react';
24
+ const Component = () => {
25
+ return (_jsx(TextInput, { label: "Clearable", isClearable: true, placeholder: "Type something" }));
26
+ };
27
+ export default Component;
28
+ //# 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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,KAAC,SAAS,IAAC,KAAK,EAAC,WAAW,EAAC,WAAW,QAAC,WAAW,EAAC,gBAAgB,GAAG,CACzE,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { TextInput } from '@neo4j-ndl/react';
24
+ import { CalendarDaysIconOutline } from '@neo4j-ndl/react/icons';
25
+ const Component = () => {
26
+ return (_jsxs("div", { className: "n-flex n-flex-col n-gap-token-16", children: [_jsx(TextInput, { label: "Default loading", isLoading: true, placeholder: "Placeholder" }), _jsx(TextInput, { label: "With leading element", isLoading: true, leadingElement: _jsx(CalendarDaysIconOutline, {}), placeholder: "Placeholder" }), _jsx(TextInput, { label: "With trailing element", isLoading: true, trailingElement: _jsx(CalendarDaysIconOutline, {}), placeholder: "Placeholder" }), _jsx(TextInput, { label: "With leading and trailing element", isLoading: true, leadingElement: _jsx(CalendarDaysIconOutline, {}), trailingElement: _jsx(CalendarDaysIconOutline, {}), placeholder: "Placeholder" })] }));
27
+ };
28
+ export default Component;
29
+ //# 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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,eAAK,SAAS,EAAC,kCAAkC,aAC/C,KAAC,SAAS,IAAC,KAAK,EAAC,iBAAiB,EAAC,SAAS,QAAC,WAAW,EAAC,aAAa,GAAG,EACzE,KAAC,SAAS,IACR,KAAK,EAAC,sBAAsB,EAC5B,SAAS,QACT,cAAc,EAAE,KAAC,uBAAuB,KAAG,EAC3C,WAAW,EAAC,aAAa,GACzB,EACF,KAAC,SAAS,IACR,KAAK,EAAC,uBAAuB,EAC7B,SAAS,QACT,eAAe,EAAE,KAAC,uBAAuB,KAAG,EAC5C,WAAW,EAAC,aAAa,GACzB,EACF,KAAC,SAAS,IACR,KAAK,EAAC,mCAAmC,EACzC,SAAS,QACT,cAAc,EAAE,KAAC,uBAAuB,KAAG,EAC3C,eAAe,EAAE,KAAC,uBAAuB,KAAG,EAC5C,WAAW,EAAC,aAAa,GACzB,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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"]}
@@ -20,14 +20,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
- import { CleanIconButton, TextInput } from '@neo4j-ndl/react';
24
- import { MagnifyingGlassIconOutline, XMarkIconOutline, } from '@neo4j-ndl/react/icons';
23
+ import { TextInput } from '@neo4j-ndl/react';
24
+ import { DatabasePlugIcon, DatabasePlusIcon } from '@neo4j-ndl/react/icons';
25
25
  import { useState } from 'react';
26
26
  const Component = () => {
27
27
  const [searchValue, setSearchValue] = useState('');
28
- return (_jsx(TextInput, { label: "Search", leadingElement: _jsx(MagnifyingGlassIconOutline, {}), trailingElement: _jsx(CleanIconButton, { onClick: () => setSearchValue(''), description: "clear search", children: _jsx(XMarkIconOutline, {}) }), placeholder: "Search...", value: searchValue, onChange: (e) => setSearchValue(e.target.value), htmlAttributes: {
29
- type: 'text',
30
- } }));
28
+ return (_jsx(TextInput, { label: "With icons", leadingElement: _jsx(DatabasePlugIcon, {}), trailingElement: _jsx(DatabasePlusIcon, {}), value: searchValue, onChange: (e) => setSearchValue(e.target.value) }));
31
29
  };
32
30
  export default Component;
33
31
  //# 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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,SAAS,IACR,KAAK,EAAC,QAAQ,EACd,cAAc,EAAE,KAAC,0BAA0B,KAAG,EAC9C,eAAe,EACb,KAAC,eAAe,IACd,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,EACjC,WAAW,EAAC,cAAc,YAE1B,KAAC,gBAAgB,KAAG,GACJ,EAEpB,WAAW,EAAC,WAAW,EACvB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC/C,cAAc,EAAE;YACd,IAAI,EAAE,MAAM;SACb,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { CleanIconButton, TextInput } from '@neo4j-ndl/react';\nimport {\n MagnifyingGlassIconOutline,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [searchValue, setSearchValue] = useState('');\n\n return (\n <TextInput\n label=\"Search\"\n leadingElement={<MagnifyingGlassIconOutline />}\n trailingElement={\n <CleanIconButton\n onClick={() => setSearchValue('')}\n description=\"clear search\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n }\n placeholder=\"Search...\"\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n htmlAttributes={{\n type: 'text',\n }}\n />\n );\n};\n\nexport default Component;\n"]}
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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,SAAS,IACR,KAAK,EAAC,YAAY,EAClB,cAAc,EAAE,KAAC,gBAAgB,KAAG,EACpC,eAAe,EAAE,KAAC,gBAAgB,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,eAAe,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"]}