@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
@@ -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: [leadingElement && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-element-leading ndl-element", children: leadingElement })), (0, jsx_runtime_1.jsx)("input", Object.assign({ readOnly: isReadOnly, disabled: isDisabled, required: isRequired, value: value, placeholder: placeholder, type: "text", onChange: onChange }, combinedHtmlInputAttributes, restProps, { ref: ref })), trailingElement && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-element-trailing ndl-element", children: 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) && (
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,2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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;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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4DAAoC;AACpC,iCAMe;AAEf,kDAA8E;AAE9E,oFAA8E;AAC9E,4CAAwD;AACxD,oCAIkB;AAClB,wDAAoD;AACpD,0CAAuC;AACvC,wCAAqC;AACrC,8CAA2C;AAoE3C;;;;;;GAMG;AAEI,MAAM,SAAS,GAAG,CAAC,EA0Ba,EAAE,EAAE;QA1BjB,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,WAAW,GAAG,KAAK,EACnB,SAAS,EACT,KAAK,EACL,iBAAiB,GAAG,KAAK,EACzB,SAAS,GAAG,KAAK,EACjB,aAAa,EACb,GAAG,OAEkC,EADlC,SAAS,cAzBY,+VA0BzB,CADa;IAEZ,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,kDAAsB,EAAC;QAC/D,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK,KAAK,SAAS;QACjC,QAAQ;QACR,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE;KACnB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAA,aAAK,GAAE,CAA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CAAC,oBAAoB;4CACtB,CAAC,CAAC,mBAAmB,GAEzB,CACH,CAAC,CAAC,CAAC,CACF,eAAe,CAChB,GACG,CACP,IACG,IACG,IACL,EACP,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,CAClC,uBAAC,mBAAQ,IACP,YAAY,EAAC,MAAM,EACnB,KAAK,EAAC,aAAa,EACnB,SAAS,EAAE,iBAAiB,YAE5B,uBAAC,uBAAU,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,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,OAAq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B,CACzB,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,yCAA2B,CAC5B,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,uCAA0B,CAC3B,CAAC;AACW,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,oCAAuB,CACxB,CAAC;AACW,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,sCAAyB,CAC1B,CAAC;AACW,QAAA,mBAAmB,GAAG,IAAA,0CAAmB,EAAC,mCAAsB,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,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,OAAO,OAAqB;AACrC,mEAAqE;AAA5D,yIAAA,OAAO,OAAkB;AAClC,yFAA0F;AAAjF,8JAAA,OAAO,OAA4B;AAC5C,mEAAqE;AAA5D,yIAAA,OAAO,OAAkB;AAClC,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AACnC,6EAA8E;AAArE,kJAAA,OAAO,OAAsB;AACtC,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,mEAAqE;AAA5D,yIAAA,OAAO,OAAkB;AAClC,uEAAyE;AAAhE,6IAAA,OAAO,OAAoB;AACpC,iEAAmE;AAA1D,uIAAA,OAAO,OAAiB;AACjC,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,uFAAwF;AAA/E,4JAAA,OAAO,OAA2B;AAE3C,6EAAyE;AACzE,sGAA2E;AAC3E,kGAAuE;AACvE,oGAAyE;AACzE,8FAAmE;AACnE,8FAAmE;AACnE,4FAAiE;AACjE,oHAAwF;AACxF,kGAAuE;AACvE,kHAAsF;AACtF,gGAAqE;AACrE,oGAAyE;AACzE,oGAAyE;AACzE,oGAAyE;AACzE,oGAAyE;AACzE,8FAAmE;AACnE,wGAA4E;AAE/D,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,sCAAyB,CAC1B,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,uCAA0B,CAC3B,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,uCAA0B,CAC3B,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,uCAA0B,CAC3B,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,uCAA0B,CAC3B,CAAC;AACW,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,oCAAuB,CACxB,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,+CAAiC,CAClC,CAAC;AACW,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,oCAAuB,CACxB,CAAC;AACW,QAAA,qBAAqB,GAAG,IAAA,0CAAmB,EACtD,qCAAwB,CACzB,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,yCAA2B,CAC5B,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,uCAA0B,CAC3B,CAAC;AACW,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,oCAAuB,CACxB,CAAC;AACW,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,sCAAyB,CAC1B,CAAC;AACW,QAAA,mBAAmB,GAAG,IAAA,0CAAmB,EAAC,mCAAsB,CAAC,CAAC;AAClE,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,wCAA2B,CAC5B,CAAC;AACW,QAAA,6BAA6B,GAAG,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: "Search", leadingElement: (0, jsx_runtime_1.jsx)(icons_1.MagnifyingGlassIconOutline, {}), trailingElement: (0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { onClick: () => setSearchValue(''), description: "clear search", children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) }), placeholder: "Search...", value: searchValue, onChange: (e) => setSearchValue(e.target.value), htmlAttributes: {
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,4CAA8D;AAC9D,kDAGgC;AAChC,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,QAAQ,EACd,cAAc,EAAE,uBAAC,kCAA0B,KAAG,EAC9C,eAAe,EACb,uBAAC,uBAAe,IACd,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,EACjC,WAAW,EAAC,cAAc,YAE1B,uBAAC,wBAAgB,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,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 { 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,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"]}
@@ -21,203 +21,229 @@
21
21
 
22
22
  "use strict";
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.Full = exports.Loading = exports.Sizes = exports.Password = exports.WithIcons = exports.Number = exports.Email = exports.InformationIcon = exports.Error = exports.Readonly = exports.Disabled = exports.Optional = exports.Required = exports.Default = void 0;
24
+ exports.Loading = exports.Clearable = exports.Full = exports.SkeletonLoading = exports.Sizes = exports.Password = exports.WithIcons = exports.Number = exports.Email = exports.InformationIcon = exports.Error = exports.Readonly = exports.Disabled = exports.Optional = exports.Required = exports.Default = void 0;
25
25
  const jsx_runtime_1 = require("react/jsx-runtime");
26
26
  const index_1 = require("../../index");
27
27
  const _1 = require(".");
28
28
  const componentMeta = {
29
- title: 'Components/TextInput',
30
- id: 'components-text-input',
31
29
  component: index_1.TextInput,
32
- tags: ['docsPage'],
33
- parameters: {
34
- controls: { disable: true },
35
- },
36
30
  decorators: [
37
31
  (Story) => ((0, jsx_runtime_1.jsx)("div", { className: "n-flex n-justify-center", children: (0, jsx_runtime_1.jsx)(Story, {}) })),
38
32
  ],
33
+ id: 'components-text-input',
34
+ parameters: {
35
+ controls: { disable: true },
36
+ },
37
+ tags: ['docsPage'],
38
+ title: 'Components/TextInput',
39
39
  };
40
40
  exports.default = componentMeta;
41
41
  exports.Default = {
42
42
  args: {},
43
- render: _1.TextInputDefault,
44
43
  parameters: {
45
44
  docs: {
46
45
  source: {
46
+ code: _1.TextInputDefaultSource,
47
47
  language: 'tsx',
48
48
  type: 'code',
49
- code: _1.TextInputDefaultSource,
50
49
  },
51
50
  },
52
51
  },
52
+ render: _1.TextInputDefault,
53
53
  };
54
54
  exports.Required = {
55
55
  args: {},
56
- render: _1.TextInputRequired,
57
56
  parameters: {
58
57
  docs: {
59
58
  source: {
59
+ code: _1.TextInputRequiredSource,
60
60
  language: 'tsx',
61
61
  type: 'code',
62
- code: _1.TextInputRequiredSource,
63
62
  },
64
63
  },
65
64
  },
65
+ render: _1.TextInputRequired,
66
66
  };
67
67
  exports.Optional = {
68
68
  args: {},
69
- render: _1.TextInputOptional,
70
69
  parameters: {
71
70
  docs: {
72
71
  source: {
72
+ code: _1.TextInputOptionalSource,
73
73
  language: 'tsx',
74
74
  type: 'code',
75
- code: _1.TextInputOptionalSource,
76
75
  },
77
76
  },
78
77
  },
78
+ render: _1.TextInputOptional,
79
79
  };
80
80
  exports.Disabled = {
81
81
  args: {},
82
- render: _1.TextInputDisabled,
83
82
  parameters: {
84
83
  docs: {
85
84
  source: {
85
+ code: _1.TextInputDisabledSource,
86
86
  language: 'tsx',
87
87
  type: 'code',
88
- code: _1.TextInputDisabledSource,
89
88
  },
90
89
  },
91
90
  },
91
+ render: _1.TextInputDisabled,
92
92
  };
93
93
  exports.Readonly = {
94
94
  args: {},
95
- render: _1.TextInputReadonly,
96
95
  parameters: {
97
96
  docs: {
98
97
  source: {
98
+ code: _1.TextInputReadonlySource,
99
99
  language: 'tsx',
100
100
  type: 'code',
101
- code: _1.TextInputReadonlySource,
102
101
  },
103
102
  },
104
103
  },
104
+ render: _1.TextInputReadonly,
105
105
  };
106
106
  exports.Error = {
107
107
  args: {},
108
- render: _1.TextInputError,
109
108
  parameters: {
110
109
  docs: {
111
110
  source: {
111
+ code: _1.TextInputErrorSource,
112
112
  language: 'tsx',
113
113
  type: 'code',
114
- code: _1.TextInputErrorSource,
115
114
  },
116
115
  },
117
116
  },
117
+ render: _1.TextInputError,
118
118
  };
119
119
  exports.InformationIcon = {
120
120
  args: {},
121
- render: _1.TextInputInformationIcon,
122
121
  parameters: {
123
122
  docs: {
124
123
  source: {
124
+ code: _1.TextInputInformationIconSource,
125
125
  language: 'tsx',
126
126
  type: 'code',
127
- code: _1.TextInputInformationIconSource,
128
127
  },
129
128
  },
130
129
  },
130
+ render: _1.TextInputInformationIcon,
131
131
  };
132
132
  exports.Email = {
133
133
  args: {},
134
- render: _1.TextInputEmail,
135
134
  parameters: {
136
135
  docs: {
137
136
  source: {
137
+ code: _1.TextInputEmailSource,
138
138
  language: 'tsx',
139
139
  type: 'code',
140
- code: _1.TextInputEmailSource,
141
140
  },
142
141
  },
143
142
  },
143
+ render: _1.TextInputEmail,
144
144
  };
145
145
  exports.Number = {
146
146
  args: {},
147
- render: _1.TextInputNumber,
148
147
  parameters: {
149
148
  docs: {
150
149
  source: {
150
+ code: _1.TextInputNumberSource,
151
151
  language: 'tsx',
152
152
  type: 'code',
153
- code: _1.TextInputNumberSource,
154
153
  },
155
154
  },
156
155
  },
156
+ render: _1.TextInputNumber,
157
157
  };
158
158
  exports.WithIcons = {
159
159
  args: {},
160
- render: _1.TextInputWithIcons,
161
160
  parameters: {
162
161
  docs: {
163
162
  source: {
163
+ code: _1.TextInputWithIconsSource,
164
164
  language: 'tsx',
165
165
  type: 'code',
166
- code: _1.TextInputWithIconsSource,
167
166
  },
168
167
  },
169
168
  },
169
+ render: _1.TextInputWithIcons,
170
170
  };
171
171
  exports.Password = {
172
172
  args: {},
173
- render: _1.TextInputPassword,
174
173
  parameters: {
175
174
  docs: {
176
175
  source: {
176
+ code: _1.TextInputPasswordSource,
177
177
  language: 'tsx',
178
178
  type: 'code',
179
- code: _1.TextInputPasswordSource,
180
179
  },
181
180
  },
182
181
  },
182
+ render: _1.TextInputPassword,
183
183
  };
184
184
  exports.Sizes = {
185
185
  args: {},
186
- render: _1.TextInputSizes,
187
186
  parameters: {
188
187
  docs: {
189
188
  source: {
189
+ code: _1.TextInputSizesSource,
190
190
  language: 'tsx',
191
191
  type: 'code',
192
- code: _1.TextInputSizesSource,
193
192
  },
194
193
  },
195
194
  },
195
+ render: _1.TextInputSizes,
196
196
  };
197
- exports.Loading = {
197
+ exports.SkeletonLoading = {
198
198
  args: {},
199
- render: _1.TextInputLoading,
200
199
  parameters: {
201
200
  docs: {
202
201
  source: {
202
+ code: _1.TextInputLoadingSource,
203
203
  language: 'tsx',
204
204
  type: 'code',
205
- code: _1.TextInputLoadingSource,
206
205
  },
207
206
  },
208
207
  },
208
+ render: _1.TextInputLoading,
209
209
  };
210
210
  exports.Full = {
211
211
  args: {},
212
+ parameters: {
213
+ docs: {
214
+ source: {
215
+ code: _1.TextInputFullSource,
216
+ language: 'tsx',
217
+ type: 'code',
218
+ },
219
+ },
220
+ },
212
221
  render: _1.TextInputFull,
222
+ };
223
+ exports.Clearable = {
224
+ args: {},
213
225
  parameters: {
214
226
  docs: {
215
227
  source: {
228
+ code: _1.TextInputClearableSource,
229
+ language: 'tsx',
230
+ type: 'code',
231
+ },
232
+ },
233
+ },
234
+ render: _1.TextInputClearable,
235
+ };
236
+ exports.Loading = {
237
+ args: {},
238
+ parameters: {
239
+ docs: {
240
+ source: {
241
+ code: _1.TextInputLoadingSpinnerSource,
216
242
  language: 'tsx',
217
243
  type: 'code',
218
- code: _1.TextInputFullSource,
219
244
  },
220
245
  },
221
246
  },
247
+ render: _1.TextInputLoadingSpinner,
222
248
  };
223
249
  //# sourceMappingURL=text-input.stories.js.map