@neo4j-ndl/react 5.6.4 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,7 @@ const require_icons_generated_heroIcons_BarsArrowUpIconOutline = require("./gene
34
34
  const require_icons_generated_heroIcons_ChevronDownIconSolid = require("./generated/heroIcons/ChevronDownIconSolid.js");
35
35
  const require_icons_generated_heroIcons_ChevronLeftIconOutline = require("./generated/heroIcons/ChevronLeftIconOutline.js");
36
36
  const require_icons_generated_heroIcons_EllipsisHorizontalIconOutline = require("./generated/heroIcons/EllipsisHorizontalIconOutline.js");
37
+ const require_icons_generated_custom_MagnifyingGlassOutline = require("./generated/custom/MagnifyingGlassOutline.js");
37
38
  const require_icons_generated_custom_AcademicCapOutline = require("./generated/custom/AcademicCapOutline.js");
38
39
  const require_icons_generated_custom_AdjustmentsHorizontalOutline = require("./generated/custom/AdjustmentsHorizontalOutline.js");
39
40
  const require_icons_generated_custom_AdjustmentsVerticalOutline = require("./generated/custom/AdjustmentsVerticalOutline.js");
@@ -408,7 +409,6 @@ const require_icons_generated_custom_LockOpenOutline = require("./generated/cust
408
409
  const require_icons_generated_custom_LogOutOutline = require("./generated/custom/LogOutOutline.js");
409
410
  const require_icons_generated_custom_MagnifyingGlassCircleOutline = require("./generated/custom/MagnifyingGlassCircleOutline.js");
410
411
  const require_icons_generated_custom_MagnifyingGlassMinusOutline = require("./generated/custom/MagnifyingGlassMinusOutline.js");
411
- const require_icons_generated_custom_MagnifyingGlassOutline = require("./generated/custom/MagnifyingGlassOutline.js");
412
412
  const require_icons_generated_custom_MagnifyingGlassPlusOutline = require("./generated/custom/MagnifyingGlassPlusOutline.js");
413
413
  const require_icons_generated_custom_MagnifyingGlassResetOutline = require("./generated/custom/MagnifyingGlassResetOutline.js");
414
414
  const require_icons_generated_custom_MagnifyingGlassReset = require("./generated/custom/MagnifyingGlassReset.js");
package/lib/cjs/index.js CHANGED
@@ -25,6 +25,7 @@ const require_popover_Popover = require("./popover/Popover.js");
25
25
  const require_progress_bar_ProgressBar = require("./progress-bar/ProgressBar.js");
26
26
  const require_dropzone_Dropzone = require("./dropzone/Dropzone.js");
27
27
  const require_text_input_TextInput = require("./text-input/TextInput.js");
28
+ const require_search_field_SearchField = require("./search-field/SearchField.js");
28
29
  const require_text_area_TextArea = require("./text-area/TextArea.js");
29
30
  const require_text_link_TextLink = require("./text-link/TextLink.js");
30
31
  const require_select_Select = require("./select/Select.js");
@@ -37,19 +38,19 @@ const require_side_navigation_SideNavigation = require("./side-navigation/SideNa
37
38
  const require_typography_Typography = require("./typography/Typography.js");
38
39
  const require_drawer_Drawer = require("./drawer/Drawer.js");
39
40
  const require_breadcrumbs_Breadcrumbs = require("./breadcrumbs/Breadcrumbs.js");
40
- const require_hooks_index = require("./hooks/index.js");
41
41
  const require_data_grid_data_grid_context = require("./data-grid/data-grid-context.js");
42
42
  const require_data_grid_helpers_index = require("./data-grid/helpers/index.js");
43
43
  const require_hooks_use_debounce_callback_index = require("./hooks/use-debounce-callback/index.js");
44
+ const require_hooks_index = require("./hooks/index.js");
44
45
  const require_box_Box = require("./box/Box.js");
45
46
  const require_flex_Flex = require("./flex/Flex.js");
46
- const require_avatar_Avatar = require("./avatar/Avatar.js");
47
47
  const require_data_grid_style_rules_evaluate = require("./data-grid/style-rules/evaluate.js");
48
48
  const require_data_grid_style_rules_hooks = require("./data-grid/style-rules/hooks.js");
49
49
  const require_data_grid_data_grid_nav_data_grid_nav = require("./data-grid/data-grid-nav/data-grid-nav.js");
50
50
  const require_data_grid_data_grid_nav_index = require("./data-grid/data-grid-nav/index.js");
51
51
  const require_data_grid_DataGrid = require("./data-grid/DataGrid.js");
52
52
  const require_data_grid_style_rules_guard = require("./data-grid/style-rules/guard.js");
53
+ const require_avatar_Avatar = require("./avatar/Avatar.js");
53
54
  const require_logo_Logo = require("./logo/Logo.js");
54
55
  const require_clipboard_button_ClipboardButton = require("./clipboard-button/ClipboardButton.js");
55
56
  const require_slider_Slider = require("./slider/Slider.js");
@@ -152,6 +153,7 @@ exports.ProgressBar = require_progress_bar_ProgressBar.ProgressBar;
152
153
  exports.Radio = require_radio_Radio.Radio;
153
154
  exports.RadioGroup = require_radio_group_RadioGroup.RadioGroup;
154
155
  exports.ReadOnlyTag = require_read_only_tag_ReadOnlyTag.ReadOnlyTag;
156
+ exports.SearchField = require_search_field_SearchField.SearchField;
155
157
  exports.SegmentedControl = require_segmented_control_SegmentedControl.SegmentedControl;
156
158
  exports.Select = require_select_Select.Select;
157
159
  exports.SelectIconButton = require_select_icon_button_SelectIconButton.SelectIconButton;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"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 { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"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 { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { SearchField } from './search-field';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ const require_hooks_use_debounce_callback_index = require("../hooks/use-debounce-callback/index.js");
7
+ const require_icons_generated_custom_MagnifyingGlassOutline = require("../icons/generated/custom/MagnifyingGlassOutline.js");
8
+ const require_text_input_TextInput = require("../text-input/TextInput.js");
9
+ const require_objectWithoutProperties = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js");
10
+ const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
11
+ let react = require("react");
12
+ let react_jsx_runtime = require("react/jsx-runtime");
13
+ // src/search-field/SearchField.tsx
14
+ /*!
15
+ *
16
+ * Copyright (c) "Neo4j"
17
+ * Neo4j Sweden AB [http://neo4j.com]
18
+ *
19
+ * This file is part of Neo4j.
20
+ *
21
+ * Neo4j is free software: you can redistribute it and/or modify
22
+ * it under the terms of the GNU General Public License as published by
23
+ * the Free Software Foundation, either version 3 of the License, or
24
+ * (at your option) any later version.
25
+ *
26
+ * This program is distributed in the hope that it will be useful,
27
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
+ * GNU General Public License for more details.
30
+ *
31
+ * You should have received a copy of the GNU General Public License
32
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33
+ */
34
+ const _excluded = [
35
+ "debounceDelay",
36
+ "htmlAttributes",
37
+ "label",
38
+ "onChange",
39
+ "onSearch"
40
+ ];
41
+ /**
42
+ * A text input for entering search queries.
43
+ *
44
+ * @remarks
45
+ * SearchField renders a fixed search icon and uses the native `search` input
46
+ * type. `onChange` is called immediately, while `onSearch` is debounced until
47
+ * typing pauses. Pressing Enter or clearing the field calls `onSearch`
48
+ * immediately.
49
+ */
50
+ const SearchField = (_ref) => {
51
+ let { debounceDelay = 500, htmlAttributes, label, onChange, onSearch } = _ref, textInputProps = require_objectWithoutProperties.default(_ref, _excluded);
52
+ const debouncedSearch = require_hooks_use_debounce_callback_index.useDebounceCallback((query) => {
53
+ onSearch === null || onSearch === void 0 || onSearch(query);
54
+ }, debounceDelay);
55
+ const handleChange = (0, react.useCallback)((event) => {
56
+ onChange === null || onChange === void 0 || onChange(event);
57
+ const query = event.target.value;
58
+ if (query === "") {
59
+ debouncedSearch.cancel();
60
+ onSearch === null || onSearch === void 0 || onSearch("");
61
+ return;
62
+ }
63
+ debouncedSearch(query);
64
+ }, [
65
+ debouncedSearch,
66
+ onChange,
67
+ onSearch
68
+ ]);
69
+ const handleKeyDown = (0, react.useCallback)((event) => {
70
+ var _htmlAttributes$onKey;
71
+ htmlAttributes === null || htmlAttributes === void 0 || (_htmlAttributes$onKey = htmlAttributes.onKeyDown) === null || _htmlAttributes$onKey === void 0 || _htmlAttributes$onKey.call(htmlAttributes, event);
72
+ if (event.key === "Enter" && !event.defaultPrevented && !event.nativeEvent.isComposing) {
73
+ if (debouncedSearch.isPending()) debouncedSearch.flush();
74
+ else onSearch === null || onSearch === void 0 || onSearch(event.currentTarget.value);
75
+ }
76
+ }, [
77
+ debouncedSearch,
78
+ htmlAttributes,
79
+ onSearch
80
+ ]);
81
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_input_TextInput.TextInput, require_objectSpread2.default(require_objectSpread2.default({}, textInputProps), {}, {
82
+ htmlAttributes: require_objectSpread2.default(require_objectSpread2.default({}, htmlAttributes), {}, {
83
+ "aria-label": label,
84
+ onKeyDown: handleKeyDown,
85
+ type: "search"
86
+ }),
87
+ isClearable: true,
88
+ leadingElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_custom_MagnifyingGlassOutline.default, {}),
89
+ onChange: handleChange
90
+ }));
91
+ };
92
+ exports.SearchField = SearchField;
93
+
94
+ //# sourceMappingURL=SearchField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchField.js","names":["useDebounceCallback","useCallback","TextInput","MagnifyingGlassOutlineIcon"],"sources":["../../../src/search-field/SearchField.tsx"],"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 ChangeEvent, type ComponentProps, useCallback } from 'react';\n\nimport { useDebounceCallback } from '../hooks/use-debounce-callback';\nimport MagnifyingGlassOutlineIcon from '../icons/generated/custom/MagnifyingGlassOutline';\nimport { TextInput } from '../text-input';\n\ntype SearchFieldTextInputProps = Pick<\n ComponentProps<typeof TextInput>,\n | 'className'\n | 'errorText'\n | 'helpText'\n | 'htmlAttributes'\n | 'isDisabled'\n | 'isFluid'\n | 'isLoading'\n | 'isReadOnly'\n | 'isSkeletonLoading'\n | 'onChange'\n | 'placeholder'\n | 'ref'\n | 'size'\n | 'skeletonProps'\n | 'style'\n | 'value'\n>;\n\nexport type SearchFieldProps = SearchFieldTextInputProps & {\n /**\n * Accessible name for the search field. The label is announced by assistive\n * technologies but is not rendered visually.\n */\n label: string;\n\n /**\n * Called with the search query after typing pauses for `debounceDelay`, and\n * immediately when the user presses Enter or clears the field.\n */\n onSearch?: (query: string) => void;\n\n /**\n * Delay in milliseconds before calling `onSearch` after the query changes.\n * @default 500\n */\n debounceDelay?: number;\n};\n\n/**\n * A text input for entering search queries.\n *\n * @remarks\n * SearchField renders a fixed search icon and uses the native `search` input\n * type. `onChange` is called immediately, while `onSearch` is debounced until\n * typing pauses. Pressing Enter or clearing the field calls `onSearch`\n * immediately.\n */\nexport const SearchField = ({\n debounceDelay = 500,\n htmlAttributes,\n label,\n onChange,\n onSearch,\n ...textInputProps\n}: SearchFieldProps) => {\n const debouncedSearch = useDebounceCallback((query: string) => {\n onSearch?.(query);\n }, debounceDelay);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n\n const query = event.target.value;\n if (query === '') {\n debouncedSearch.cancel();\n onSearch?.('');\n return;\n }\n\n debouncedSearch(query);\n },\n [debouncedSearch, onChange, onSearch],\n );\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n htmlAttributes?.onKeyDown?.(event);\n\n if (\n event.key === 'Enter' &&\n !event.defaultPrevented &&\n !event.nativeEvent.isComposing\n ) {\n if (debouncedSearch.isPending()) {\n debouncedSearch.flush();\n } else {\n onSearch?.(event.currentTarget.value);\n }\n }\n },\n [debouncedSearch, htmlAttributes, onSearch],\n );\n\n return (\n <TextInput\n {...textInputProps}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': label,\n onKeyDown: handleKeyDown,\n type: 'search',\n }}\n isClearable\n leadingElement={<MagnifyingGlassOutlineIcon />}\n onChange={handleChange}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6EE;CACA;CACA;CACA;CACA;;;;;;;;;;;AALF,MAAa,eAAe,SAOJ;CAPI,IAAA,EAC1B,gBAAgB,KAChB,gBACA,OACA,UACA,aAAA,MACG,iBAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,kBAAkBA,0CAAAA,qBAAqB,UAAkB;EAC7D,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,KAAK;CAClB,GAAG,aAAa;CAEhB,MAAM,gBAAA,GAAeC,MAAAA,YAAAA,EAClB,UAAyC;EACxC,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,KAAK;EAEhB,MAAM,QAAQ,MAAM,OAAO;EAC3B,IAAI,UAAU,IAAI;GAChB,gBAAgB,OAAO;GACvB,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,EAAE;GACb;EACF;EAEA,gBAAgB,KAAK;CACvB,GACA;EAAC;EAAiB;EAAU;CAAQ,CACtC;CAEA,MAAM,iBAAA,GAAgBA,MAAAA,YAAAA,EACnB,UAAiD;;EAChD,mBAAA,QAAA,mBAAA,KAAA,MAAA,wBAAA,eAAgB,eAAA,QAAA,0BAAA,KAAA,KAAA,sBAAA,KAAA,gBAAY,KAAK;EAEjC,IACE,MAAM,QAAQ,WACd,CAAC,MAAM,oBACP,CAAC,MAAM,YAAY,aACnB;GACA,IAAI,gBAAgB,UAAU,GAC5B,gBAAgB,MAAM;QAEtB,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,MAAM,cAAc,KAAK;EAExC;CACF,GACA;EAAC;EAAiB;EAAgB;CAAQ,CAC5C;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,WAAAA,sBAAAA,QAAAA,sBAAAA,QAAAA,CAAAA,GACK,cAAA,GAAA,CAAA,GAAA;EACJ,gBAAA,sBAAA,QAAA,sBAAA,QAAA,CAAA,GACK,cAAA,GAAA,CAAA,GAAA;GACH,cAAc;GACd,WAAW;GACX,MAAM;EACR,CAAA;EACA,aAAA;EACA,gBAAgB,iBAAA,GAAA,kBAAA,IAAA,CAACC,sDAAAA,SAAD,CAA6B,CAAA;EAC7C,UAAU;CACX,CAAA,CAAA;AAEL"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ const require_search_field_SearchField = require("./SearchField.js");
7
+ // src/search-field/index.ts
8
+ /*!
9
+ *
10
+ * Copyright (c) "Neo4j"
11
+ * Neo4j Sweden AB [http://neo4j.com]
12
+ *
13
+ * This file is part of Neo4j.
14
+ *
15
+ * Neo4j is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation, either version 3 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ */
28
+ exports.SearchField = require_search_field_SearchField.SearchField;
29
+
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/search-field/index.ts"],"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 * from './SearchField';\n"],"mappings":""}
@@ -82,7 +82,7 @@ const TextInput = (_ref) => {
82
82
  state: value !== null && value !== void 0 ? value : ""
83
83
  });
84
84
  const hintId = (0, react.useId)();
85
- const canClear = isClearable && isDisabled !== true;
85
+ const canClear = isClearable && isDisabled !== true && isReadOnly !== true;
86
86
  const shouldRenderHint = canClear || isLoading;
87
87
  const { field, controlProps } = require__common_form_control_use_form_field.useFormField({
88
88
  errorText,
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","names":["useSemiControlledInput","useId","useFormField","classNames","customLabelAndNoAriaLabelWarningMessage","FormFieldLabel","Skeleton","LoadingSpinner","XMarkIconOutline","FormFieldMessage"],"sources":["../../../src/text-input/TextInput.tsx"],"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 {\n FormFieldLabel,\n FormFieldMessage,\n useFormField,\n} from '../_common/form-control';\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 { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { LoadingSpinner } from '../loading-spinner';\nimport { Skeleton } from '../skeleton';\n\n/**\n * @remarks\n * When `moreInformationText` is provided, a tooltip is rendered next to the label, and the `tooltipProps` prop is used to configure the tooltip. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.\n *\n * @remarks\n * When `isSkeletonLoading` is true, the input is rendered as a loading skeleton and the `skeletonProps` prop is used to configure the skeleton. For more information, see the Skeleton documentation.\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 // TODO: inconsistent naming. The same switch is `hasRequiredIndicator` on\n // Combobox and on the internal form control this maps onto, and `isOptional`\n // on TextArea. The name also needs the disable below, which a name using one\n // of the allowed boolean prefixes would not.\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 // TODO v5: inconsistent naming. Every form control names itself differently:\n // the label is optional here and a design with no room for it reaches for\n // htmlAttributes['aria-label'], TextArea, Select, Checkbox, Radio and Switch\n // expose an `ariaLabel` prop instead, and Combobox requires the label and\n // clips it with `hasVisuallyHiddenLabel`.\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 [currentValue, handleChange] = useSemiControlledInput({\n inputType: 'text',\n isControlled: value !== undefined,\n onChange,\n state: value ?? '',\n });\n const hintId = useId();\n const canClear = isClearable && isDisabled !== true;\n const shouldRenderHint = canClear || isLoading;\n const { field, controlProps } = useFormField({\n errorText,\n // The clear/loading hint describes the input alongside the message.\n extraDescribedByIds: [shouldRenderHint && hintId],\n hasRequiredIndicator: showRequiredOrOptionalLabel,\n helpText,\n isRequired,\n label,\n });\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-text-input-label', {\n 'ndl-fluid': isFluid,\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 const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (canClear && event.key === 'Escape' && Boolean(currentValue)) {\n event.preventDefault();\n event.stopPropagation();\n handleChange?.({\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 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 <FormFieldLabel\n field={field}\n size={size}\n association=\"implicit\"\n moreInformationText={moreInformationText}\n tooltipProps={tooltipProps}\n wrap={(row) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {row}\n </Skeleton>\n )}\n />\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={currentValue}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleChange}\n {...controlProps}\n {...combinedHtmlInputAttributes}\n onKeyDown={handleInputKeyDown}\n {...restProps}\n />\n {shouldRenderHint && (\n <span\n id={hintId}\n className=\"ndl-text-input-hint\"\n aria-hidden={true}\n >\n {isLoading && 'Loading '}\n {canClear && 'Press Escape to clear input.'}\n </span>\n )}\n {canClear && Boolean(currentValue) && (\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 handleChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n }}\n >\n <XMarkIconOutline />\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\n <FormFieldMessage\n field={field}\n size={size}\n wrap={(content) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {content}\n </Skeleton>\n )}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;AAxBF,MAAa,aAAa,SA0BkB;CA1BlB,IAAA,EACxB,OACA,SACA,WACA,UACA,gBACA,iBACA,8BAA8B,OAC9B,qBACA,OAAO,UACP,aACA,OACA,cACA,gBACA,YACA,YACA,YACA,UACA,cAAc,OACd,WACA,OACA,oBAAoB,OACpB,YAAY,OACZ,eACA,QAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,CAAC,cAAc,gBAAgBA,0CAAAA,uBAAuB;EAC1D,WAAW;EACX,cAAc,UAAU,KAAA;EACxB;EACA,OAAO,UAAA,QAAA,UAAA,KAAA,IAAA,QAAS;CAClB,CAAC;CACD,MAAM,UAAA,GAASC,MAAAA,MAAAA,CAAM;CACrB,MAAM,WAAW,eAAe,eAAe;CAC/C,MAAM,mBAAmB,YAAY;CACrC,MAAM,EAAE,OAAO,iBAAiBC,4CAAAA,aAAa;EAC3C;EAEA,qBAAqB,CAAC,oBAAoB,MAAM;EAChD,sBAAsB;EACtB;EACA;EACA;CACF,CAAC;CAED,MAAM,4BAAA,GAA2BC,WAAAA,QAAAA,CAAW,kBAAkB,WAAW;EACvE,gBAAgB;EAChB,iBAAiB;EACjB,gBAAgB,kBAAkB,mBAAmB;EACrD,wBAAwB;EACxB,yBAAyB,mBAAmB;EAC5C,aAAa,SAAS;EACtB,cAAc,SAAS;EACvB,iBAAiB;EACjB,aAAa,SAAS;CACxB,CAAC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UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;UACE,UAAU;UACV,eAAa;UACb,MAAK;UACL,OAAM;UACN,eAAe;WACb,iBAAA,QAAA,iBAAA,KAAA,KAAA,aAAe,EACb,QAAQ,EAAE,OAAO,GAAG,EACtB,CAAwC;UAC1C;UAEA,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACK,mDAAAA,kBAAD,CAAmB,CAAA;SACb,CAAA;QACL,CAAA;OAEJ;;MACJ,mBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;OAAK,WAAU;OACZ,UAAA,aAAa,CAAC,iBACb,iBAAA,GAAA,kBAAA,IAAA,CAACD,uCAAAA,gBAAD;QACE,MAAM,SAAS,UAAU,WAAW;QACpC,WACE,SAAS,UACL,uBACA;OAEP,CAAA,IAED;MAEC,CAAA;KAEJ;;GACG,CAAA,CAAA,CACL;EAEP,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAACE,8CAAAA,kBAAD;GACS;GACD;GACN,OAAO,YACL,iBAAA,GAAA,kBAAA,IAAA,CAACH,0BAAAA,UAAAA,sBAAAA,QAAAA,sBAAAA,QAAAA;IACC,cAAa;IACb,OAAM;GACF,GAAA,aAAA,GAAA,CAAA,GAAA;IACJ,WAAW;IAEV,UAAA;GACO,CAAA,CAAA;EAEb,CAAA,CACE;;AAET"}
1
+ {"version":3,"file":"TextInput.js","names":["useSemiControlledInput","useId","useFormField","classNames","customLabelAndNoAriaLabelWarningMessage","FormFieldLabel","Skeleton","LoadingSpinner","XMarkIconOutline","FormFieldMessage"],"sources":["../../../src/text-input/TextInput.tsx"],"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 {\n FormFieldLabel,\n FormFieldMessage,\n useFormField,\n} from '../_common/form-control';\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 { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { LoadingSpinner } from '../loading-spinner';\nimport { Skeleton } from '../skeleton';\n\n/**\n * @remarks\n * When `moreInformationText` is provided, a tooltip is rendered next to the label, and the `tooltipProps` prop is used to configure the tooltip. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.\n *\n * @remarks\n * When `isSkeletonLoading` is true, the input is rendered as a loading skeleton and the `skeletonProps` prop is used to configure the skeleton. For more information, see the Skeleton documentation.\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 // TODO: inconsistent naming. The same switch is `hasRequiredIndicator` on\n // Combobox and on the internal form control this maps onto, and `isOptional`\n // on TextArea. The name also needs the disable below, which a name using one\n // of the allowed boolean prefixes would not.\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 // TODO v5: inconsistent naming. Every form control names itself differently:\n // the label is optional here and a design with no room for it reaches for\n // htmlAttributes['aria-label'], TextArea, Select, Checkbox, Radio and Switch\n // expose an `ariaLabel` prop instead, and Combobox requires the label and\n // clips it with `hasVisuallyHiddenLabel`.\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 [currentValue, handleChange] = useSemiControlledInput({\n inputType: 'text',\n isControlled: value !== undefined,\n onChange,\n state: value ?? '',\n });\n const hintId = useId();\n const canClear = isClearable && isDisabled !== true && isReadOnly !== true;\n const shouldRenderHint = canClear || isLoading;\n const { field, controlProps } = useFormField({\n errorText,\n // The clear/loading hint describes the input alongside the message.\n extraDescribedByIds: [shouldRenderHint && hintId],\n hasRequiredIndicator: showRequiredOrOptionalLabel,\n helpText,\n isRequired,\n label,\n });\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-text-input-label', {\n 'ndl-fluid': isFluid,\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 const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (canClear && event.key === 'Escape' && Boolean(currentValue)) {\n event.preventDefault();\n event.stopPropagation();\n handleChange?.({\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 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 <FormFieldLabel\n field={field}\n size={size}\n association=\"implicit\"\n moreInformationText={moreInformationText}\n tooltipProps={tooltipProps}\n wrap={(row) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {row}\n </Skeleton>\n )}\n />\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={currentValue}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleChange}\n {...controlProps}\n {...combinedHtmlInputAttributes}\n onKeyDown={handleInputKeyDown}\n {...restProps}\n />\n {shouldRenderHint && (\n <span\n id={hintId}\n className=\"ndl-text-input-hint\"\n aria-hidden={true}\n >\n {isLoading && 'Loading '}\n {canClear && 'Press Escape to clear input.'}\n </span>\n )}\n {canClear && Boolean(currentValue) && (\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 handleChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n }}\n >\n <XMarkIconOutline />\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\n <FormFieldMessage\n field={field}\n size={size}\n wrap={(content) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {content}\n </Skeleton>\n )}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;AAxBF,MAAa,aAAa,SA0BkB;CA1BlB,IAAA,EACxB,OACA,SACA,WACA,UACA,gBACA,iBACA,8BAA8B,OAC9B,qBACA,OAAO,UACP,aACA,OACA,cACA,gBACA,YACA,YACA,YACA,UACA,cAAc,OACd,WACA,OACA,oBAAoB,OACpB,YAAY,OACZ,eACA,QAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,CAAC,cAAc,gBAAgBA,0CAAAA,uBAAuB;EAC1D,WAAW;EACX,cAAc,UAAU,KAAA;EACxB;EACA,OAAO,UAAA,QAAA,UAAA,KAAA,IAAA,QAAS;CAClB,CAAC;CACD,MAAM,UAAA,GAASC,MAAAA,MAAAA,CAAM;CACrB,MAAM,WAAW,eAAe,eAAe,QAAQ,eAAe;CACtE,MAAM,mBAAmB,YAAY;CACrC,MAAM,EAAE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conOutline } from "./generated/heroIcons/BarsArrowUpIconOut
29
29
  import { ChevronDownIconSolid } from "./generated/heroIcons/ChevronDownIconSolid.mjs";
30
30
  import { ChevronLeftIconOutline } from "./generated/heroIcons/ChevronLeftIconOutline.mjs";
31
31
  import { EllipsisHorizontalIconOutline } from "./generated/heroIcons/EllipsisHorizontalIconOutline.mjs";
32
+ import SvgMagnifyingGlassOutline from "./generated/custom/MagnifyingGlassOutline.mjs";
32
33
  import SvgAcademicCapOutline from "./generated/custom/AcademicCapOutline.mjs";
33
34
  import SvgAdjustmentsHorizontalOutline from "./generated/custom/AdjustmentsHorizontalOutline.mjs";
34
35
  import SvgAdjustmentsVerticalOutline from "./generated/custom/AdjustmentsVerticalOutline.mjs";
@@ -403,7 +404,6 @@ import SvgLockOpenOutline from "./generated/custom/LockOpenOutline.mjs";
403
404
  import SvgLogOutOutline from "./generated/custom/LogOutOutline.mjs";
404
405
  import SvgMagnifyingGlassCircleOutline from "./generated/custom/MagnifyingGlassCircleOutline.mjs";
405
406
  import SvgMagnifyingGlassMinusOutline from "./generated/custom/MagnifyingGlassMinusOutline.mjs";
406
- import SvgMagnifyingGlassOutline from "./generated/custom/MagnifyingGlassOutline.mjs";
407
407
  import SvgMagnifyingGlassPlusOutline from "./generated/custom/MagnifyingGlassPlusOutline.mjs";
408
408
  import SvgMagnifyingGlassResetOutline from "./generated/custom/MagnifyingGlassResetOutline.mjs";
409
409
  import SvgMagnifyingGlassReset from "./generated/custom/MagnifyingGlassReset.mjs";
package/lib/esm/index.mjs CHANGED
@@ -20,6 +20,7 @@ import { Popover, placementTranslation, usePopoverContext } from "./popover/Popo
20
20
  import { ProgressBar } from "./progress-bar/ProgressBar.mjs";
21
21
  import { Dropzone } from "./dropzone/Dropzone.mjs";
22
22
  import { TextInput } from "./text-input/TextInput.mjs";
23
+ import { SearchField } from "./search-field/SearchField.mjs";
23
24
  import { TextArea } from "./text-area/TextArea.mjs";
24
25
  import { TextLink } from "./text-link/TextLink.mjs";
25
26
  import { Select } from "./select/Select.mjs";
@@ -32,19 +33,19 @@ import { SideNavigation } from "./side-navigation/SideNavigation.mjs";
32
33
  import { Typography } from "./typography/Typography.mjs";
33
34
  import { Drawer } from "./drawer/Drawer.mjs";
34
35
  import { Breadcrumbs } from "./breadcrumbs/Breadcrumbs.mjs";
35
- import { useCopyToClipboard, useDebounceValue, useEffectDebugger, useEventListener, useInterval, useMediaQuery, useOnClickOutside, usePrevious, useRenderCount, useRenderDebugger, useResizeObserver, useScrollLock, useWindowSize } from "./hooks/index.mjs";
36
36
  import { useDataGridContext } from "./data-grid/data-grid-context.mjs";
37
37
  import { helpers_exports } from "./data-grid/helpers/index.mjs";
38
38
  import { useDebounceCallback } from "./hooks/use-debounce-callback/index.mjs";
39
+ import { useCopyToClipboard, useDebounceValue, useEffectDebugger, useEventListener, useInterval, useMediaQuery, useOnClickOutside, usePrevious, useRenderCount, useRenderDebugger, useResizeObserver, useScrollLock, useWindowSize } from "./hooks/index.mjs";
39
40
  import { Box } from "./box/Box.mjs";
40
41
  import { Flex } from "./flex/Flex.mjs";
41
- import { Avatar } from "./avatar/Avatar.mjs";
42
42
  import { evaluateDataGridStyleRules } from "./data-grid/style-rules/evaluate.mjs";
43
43
  import { useDataGridCellStyle } from "./data-grid/style-rules/hooks.mjs";
44
44
  import { DataGridNav } from "./data-grid/data-grid-nav/data-grid-nav.mjs";
45
45
  import { useTableNav } from "./data-grid/data-grid-nav/index.mjs";
46
46
  import { DataGrid } from "./data-grid/DataGrid.mjs";
47
47
  import { isDataGridStyleRule } from "./data-grid/style-rules/guard.mjs";
48
+ import { Avatar } from "./avatar/Avatar.mjs";
48
49
  import { Logo } from "./logo/Logo.mjs";
49
50
  import { ClipboardButton } from "./clipboard-button/ClipboardButton.mjs";
50
51
  import { Slider } from "./slider/Slider.mjs";
@@ -101,6 +102,6 @@ import { Combobox } from "./combobox/Combobox.mjs";
101
102
  * You should have received a copy of the GNU General Public License
102
103
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
103
104
  */
104
- export { Accordion, AnnouncementBanner, Avatar, Banner, Box, Breadcrumbs, Checkbox, CheckboxGroup, CleanIconButton, ClipboardButton, Code, CodeBlock, ColorPicker, Combobox, ConditionalWrap, DataGrid, DataGridNav, DatePicker, Dialog, DismissibleTag, Divider, Drawer, DropdownButton, Dropzone, Fieldset, FilledButton, Flex, GraphLabel, IconButton, IconButtonArray, InlineEdit, Kbd, LoadingBar, LoadingSpinner, Logo, Menu, NeedleThemeProvider, NeedleTime, OperationalTag, OutlinedButton, Popover, ProgressBar, Radio, RadioGroup, ReadOnlyTag, SegmentedControl, Select, SelectIconButton, SelectableTag, SideNavigation, Skeleton, Slider, Spotlight, SpotlightProvider, SpotlightTarget, SpotlightTour, StatusIndicator, StatusLabel, Switch, Tabs, Tag, TextArea, TextButton, TextInput, TextLink, ThemeContext, TimePicker, TimeZonePicker, Toaster, ToasterControlled, TokensContext, Tooltip, TreeView, Typography, Wizard, helpers_exports as dataGridUtils, evaluateDataGridStyleRules, isDataGridStyleRule, useToken as n, useToken, placementTranslation, toast, useCopyToClipboard, useDataGridCellStyle, useDataGridContext, useDebounceCallback, useDebounceValue, useEffectDebugger, useEventListener, useInterval, useMediaQuery, useNeedleTheme, useOnClickOutside, usePopoverContext, usePrevious, useRenderCount, useRenderDebugger, useResizeObserver, useScrollLock, useSpotlightContext, useTableNav, useWindowSize };
105
+ export { Accordion, AnnouncementBanner, Avatar, Banner, Box, Breadcrumbs, Checkbox, CheckboxGroup, CleanIconButton, ClipboardButton, Code, CodeBlock, ColorPicker, Combobox, ConditionalWrap, DataGrid, DataGridNav, DatePicker, Dialog, DismissibleTag, Divider, Drawer, DropdownButton, Dropzone, Fieldset, FilledButton, Flex, GraphLabel, IconButton, IconButtonArray, InlineEdit, Kbd, LoadingBar, LoadingSpinner, Logo, Menu, NeedleThemeProvider, NeedleTime, OperationalTag, OutlinedButton, Popover, ProgressBar, Radio, RadioGroup, ReadOnlyTag, SearchField, SegmentedControl, Select, SelectIconButton, SelectableTag, SideNavigation, Skeleton, Slider, Spotlight, SpotlightProvider, SpotlightTarget, SpotlightTour, StatusIndicator, StatusLabel, Switch, Tabs, Tag, TextArea, TextButton, TextInput, TextLink, ThemeContext, TimePicker, TimeZonePicker, Toaster, ToasterControlled, TokensContext, Tooltip, TreeView, Typography, Wizard, helpers_exports as dataGridUtils, evaluateDataGridStyleRules, isDataGridStyleRule, useToken as n, useToken, placementTranslation, toast, useCopyToClipboard, useDataGridCellStyle, useDataGridContext, useDebounceCallback, useDebounceValue, useEffectDebugger, useEventListener, useInterval, useMediaQuery, useNeedleTheme, useOnClickOutside, usePopoverContext, usePrevious, useRenderCount, useRenderDebugger, useResizeObserver, useScrollLock, useSpotlightContext, useTableNav, useWindowSize };
105
106
 
106
107
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"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 { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"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 { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { SearchField } from './search-field';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
@@ -0,0 +1,89 @@
1
+ import { useDebounceCallback } from "../hooks/use-debounce-callback/index.mjs";
2
+ import SvgMagnifyingGlassOutline from "../icons/generated/custom/MagnifyingGlassOutline.mjs";
3
+ import { TextInput } from "../text-input/TextInput.mjs";
4
+ import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.mjs";
5
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.mjs";
6
+ import { useCallback } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ // src/search-field/SearchField.tsx
9
+ /*!
10
+ *
11
+ * Copyright (c) "Neo4j"
12
+ * Neo4j Sweden AB [http://neo4j.com]
13
+ *
14
+ * This file is part of Neo4j.
15
+ *
16
+ * Neo4j is free software: you can redistribute it and/or modify
17
+ * it under the terms of the GNU General Public License as published by
18
+ * the Free Software Foundation, either version 3 of the License, or
19
+ * (at your option) any later version.
20
+ *
21
+ * This program is distributed in the hope that it will be useful,
22
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ * GNU General Public License for more details.
25
+ *
26
+ * You should have received a copy of the GNU General Public License
27
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
28
+ */
29
+ const _excluded = [
30
+ "debounceDelay",
31
+ "htmlAttributes",
32
+ "label",
33
+ "onChange",
34
+ "onSearch"
35
+ ];
36
+ /**
37
+ * A text input for entering search queries.
38
+ *
39
+ * @remarks
40
+ * SearchField renders a fixed search icon and uses the native `search` input
41
+ * type. `onChange` is called immediately, while `onSearch` is debounced until
42
+ * typing pauses. Pressing Enter or clearing the field calls `onSearch`
43
+ * immediately.
44
+ */
45
+ const SearchField = (_ref) => {
46
+ let { debounceDelay = 500, htmlAttributes, label, onChange, onSearch } = _ref, textInputProps = _objectWithoutProperties(_ref, _excluded);
47
+ const debouncedSearch = useDebounceCallback((query) => {
48
+ onSearch === null || onSearch === void 0 || onSearch(query);
49
+ }, debounceDelay);
50
+ const handleChange = useCallback((event) => {
51
+ onChange === null || onChange === void 0 || onChange(event);
52
+ const query = event.target.value;
53
+ if (query === "") {
54
+ debouncedSearch.cancel();
55
+ onSearch === null || onSearch === void 0 || onSearch("");
56
+ return;
57
+ }
58
+ debouncedSearch(query);
59
+ }, [
60
+ debouncedSearch,
61
+ onChange,
62
+ onSearch
63
+ ]);
64
+ const handleKeyDown = useCallback((event) => {
65
+ var _htmlAttributes$onKey;
66
+ htmlAttributes === null || htmlAttributes === void 0 || (_htmlAttributes$onKey = htmlAttributes.onKeyDown) === null || _htmlAttributes$onKey === void 0 || _htmlAttributes$onKey.call(htmlAttributes, event);
67
+ if (event.key === "Enter" && !event.defaultPrevented && !event.nativeEvent.isComposing) {
68
+ if (debouncedSearch.isPending()) debouncedSearch.flush();
69
+ else onSearch === null || onSearch === void 0 || onSearch(event.currentTarget.value);
70
+ }
71
+ }, [
72
+ debouncedSearch,
73
+ htmlAttributes,
74
+ onSearch
75
+ ]);
76
+ return /* @__PURE__ */ jsx(TextInput, _objectSpread2(_objectSpread2({}, textInputProps), {}, {
77
+ htmlAttributes: _objectSpread2(_objectSpread2({}, htmlAttributes), {}, {
78
+ "aria-label": label,
79
+ onKeyDown: handleKeyDown,
80
+ type: "search"
81
+ }),
82
+ isClearable: true,
83
+ leadingElement: /* @__PURE__ */ jsx(SvgMagnifyingGlassOutline, {}),
84
+ onChange: handleChange
85
+ }));
86
+ };
87
+ export { SearchField };
88
+
89
+ //# sourceMappingURL=SearchField.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchField.mjs","names":["MagnifyingGlassOutlineIcon"],"sources":["../../../src/search-field/SearchField.tsx"],"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 ChangeEvent, type ComponentProps, useCallback } from 'react';\n\nimport { useDebounceCallback } from '../hooks/use-debounce-callback';\nimport MagnifyingGlassOutlineIcon from '../icons/generated/custom/MagnifyingGlassOutline';\nimport { TextInput } from '../text-input';\n\ntype SearchFieldTextInputProps = Pick<\n ComponentProps<typeof TextInput>,\n | 'className'\n | 'errorText'\n | 'helpText'\n | 'htmlAttributes'\n | 'isDisabled'\n | 'isFluid'\n | 'isLoading'\n | 'isReadOnly'\n | 'isSkeletonLoading'\n | 'onChange'\n | 'placeholder'\n | 'ref'\n | 'size'\n | 'skeletonProps'\n | 'style'\n | 'value'\n>;\n\nexport type SearchFieldProps = SearchFieldTextInputProps & {\n /**\n * Accessible name for the search field. The label is announced by assistive\n * technologies but is not rendered visually.\n */\n label: string;\n\n /**\n * Called with the search query after typing pauses for `debounceDelay`, and\n * immediately when the user presses Enter or clears the field.\n */\n onSearch?: (query: string) => void;\n\n /**\n * Delay in milliseconds before calling `onSearch` after the query changes.\n * @default 500\n */\n debounceDelay?: number;\n};\n\n/**\n * A text input for entering search queries.\n *\n * @remarks\n * SearchField renders a fixed search icon and uses the native `search` input\n * type. `onChange` is called immediately, while `onSearch` is debounced until\n * typing pauses. Pressing Enter or clearing the field calls `onSearch`\n * immediately.\n */\nexport const SearchField = ({\n debounceDelay = 500,\n htmlAttributes,\n label,\n onChange,\n onSearch,\n ...textInputProps\n}: SearchFieldProps) => {\n const debouncedSearch = useDebounceCallback((query: string) => {\n onSearch?.(query);\n }, debounceDelay);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n\n const query = event.target.value;\n if (query === '') {\n debouncedSearch.cancel();\n onSearch?.('');\n return;\n }\n\n debouncedSearch(query);\n },\n [debouncedSearch, onChange, onSearch],\n );\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n htmlAttributes?.onKeyDown?.(event);\n\n if (\n event.key === 'Enter' &&\n !event.defaultPrevented &&\n !event.nativeEvent.isComposing\n ) {\n if (debouncedSearch.isPending()) {\n debouncedSearch.flush();\n } else {\n onSearch?.(event.currentTarget.value);\n }\n }\n },\n [debouncedSearch, htmlAttributes, onSearch],\n );\n\n return (\n <TextInput\n {...textInputProps}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': label,\n onKeyDown: handleKeyDown,\n type: 'search',\n }}\n isCl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B,CAAA;EAC7C,UAAU;CACX,CAAA,CAAA;AAEL"}
@@ -0,0 +1,24 @@
1
+ // src/search-field/index.ts
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
+ export { SearchField } from "./SearchField.mjs";
23
+
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/search-field/index.ts"],"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 * from './SearchField';\n"],"mappings":""}
@@ -75,7 +75,7 @@ const TextInput = (_ref) => {
75
75
  state: value !== null && value !== void 0 ? value : ""
76
76
  });
77
77
  const hintId = useId();
78
- const canClear = isClearable && isDisabled !== true;
78
+ const canClear = isClearable && isDisabled !== true && isReadOnly !== true;
79
79
  const shouldRenderHint = canClear || isLoading;
80
80
  const { field, controlProps } = useFormField({
81
81
  errorText,
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.mjs","names":[],"sources":["../../../src/text-input/TextInput.tsx"],"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 {\n FormFieldLabel,\n FormFieldMessage,\n useFormField,\n} from '../_common/form-control';\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 { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { LoadingSpinner } from '../loading-spinner';\nimport { Skeleton } from '../skeleton';\n\n/**\n * @remarks\n * When `moreInformationText` is provided, a tooltip is rendered next to the label, and the `tooltipProps` prop is used to configure the tooltip. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.\n *\n * @remarks\n * When `isSkeletonLoading` is true, the input is rendered as a loading skeleton and the `skeletonProps` prop is used to configure the skeleton. For more information, see the Skeleton documentation.\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 // TODO: inconsistent naming. The same switch is `hasRequiredIndicator` on\n // Combobox and on the internal form control this maps onto, and `isOptional`\n // on TextArea. The name also needs the disable below, which a name using one\n // of the allowed boolean prefixes would not.\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 // TODO v5: inconsistent naming. Every form control names itself differently:\n // the label is optional here and a design with no room for it reaches for\n // htmlAttributes['aria-label'], TextArea, Select, Checkbox, Radio and Switch\n // expose an `ariaLabel` prop instead, and Combobox requires the label and\n // clips it with `hasVisuallyHiddenLabel`.\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 [currentValue, handleChange] = useSemiControlledInput({\n inputType: 'text',\n isControlled: value !== undefined,\n onChange,\n state: value ?? '',\n });\n const hintId = useId();\n const canClear = isClearable && isDisabled !== true;\n const shouldRenderHint = canClear || isLoading;\n const { field, controlProps } = useFormField({\n errorText,\n // The clear/loading hint describes the input alongside the message.\n extraDescribedByIds: [shouldRenderHint && hintId],\n hasRequiredIndicator: showRequiredOrOptionalLabel,\n helpText,\n isRequired,\n label,\n });\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-text-input-label', {\n 'ndl-fluid': isFluid,\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 const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (canClear && event.key === 'Escape' && Boolean(currentValue)) {\n event.preventDefault();\n event.stopPropagation();\n handleChange?.({\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 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 <FormFieldLabel\n field={field}\n size={size}\n association=\"implicit\"\n moreInformationText={moreInformationText}\n tooltipProps={tooltipProps}\n wrap={(row) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {row}\n </Skeleton>\n )}\n />\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={currentValue}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleChange}\n {...controlProps}\n {...combinedHtmlInputAttributes}\n onKeyDown={handleInputKeyDown}\n {...restProps}\n />\n {shouldRenderHint && (\n <span\n id={hintId}\n className=\"ndl-text-input-hint\"\n aria-hidden={true}\n >\n {isLoading && 'Loading '}\n {canClear && 'Press Escape to clear input.'}\n </span>\n )}\n {canClear && Boolean(currentValue) && (\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 handleChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n }}\n >\n <XMarkIconOutline />\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\n <FormFieldMessage\n field={field}\n size={size}\n wrap={(content) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {content}\n </Skeleton>\n )}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;AAxBF,MAAa,aAAa,SA0BkB;CA1BlB,IAAA,EACxB,OACA,SACA,WACA,UACA,gBACA,iBACA,8BAA8B,OAC9B,qBACA,OAAO,UACP,aACA,OACA,cACA,gBACA,YACA,YACA,YACA,UACA,cAAc,OACd,WACA,OACA,oBAAoB,OAC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KG,aAAa,YACb,YAAY,8BACT;;QAEP,YAAY,QAAQ,YAAY,KAC/B,oBAAC,OAAD;SAAK,WAAU;SACb,UAAA,oBAAC,UAAD;UACE,UAAU;UACV,eAAa;UACb,MAAK;UACL,OAAM;UACN,eAAe;WACb,iBAAA,QAAA,iBAAA,KAAA,KAAA,aAAe,EACb,QAAQ,EAAE,OAAO,GAAG,EACtB,CAAwC;UAC1C;UAEA,UAAA,oBAAC,kBAAD,CAAmB,CAAA;SACb,CAAA;QACL,CAAA;OAEJ;;MACJ,mBACC,oBAAC,OAAD;OAAK,WAAU;OACZ,UAAA,aAAa,CAAC,iBACb,oBAAC,gBAAD;QACE,MAAM,SAAS,UAAU,WAAW;QACpC,WACE,SAAS,UACL,uBACA;OAEP,CAAA,IAED;MAEC,CAAA;KAEJ;;GACG,CAAA,CAAA,CACL;EAEP,CAAA,GAAA,oBAAC,kBAAD;GACS;GACD;GACN,OAAO,YACL,oBAAC,UAAA,eAAA,eAAA;IACC,cAAa;IACb,OAAM;GACF,GAAA,aAAA,GAAA,CAAA,GAAA;IACJ,WAAW;IAEV,UAAA;GACO,CAAA,CAAA;EAEb,CAAA,CACE;;AAET"}
1
+ {"version":3,"file":"TextInput.mjs","names":[],"sources":["../../../src/text-input/TextInput.tsx"],"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 {\n FormFieldLabel,\n FormFieldMessage,\n useFormField,\n} from '../_common/form-control';\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 { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { LoadingSpinner } from '../loading-spinner';\nimport { Skeleton } from '../skeleton';\n\n/**\n * @remarks\n * When `moreInformationText` is provided, a tooltip is rendered next to the label, and the `tooltipProps` prop is used to configure the tooltip. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.\n *\n * @remarks\n * When `isSkeletonLoading` is true, the input is rendered as a loading skeleton and the `skeletonProps` prop is used to configure the skeleton. For more information, see the Skeleton documentation.\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 // TODO: inconsistent naming. The same switch is `hasRequiredIndicator` on\n // Combobox and on the internal form control this maps onto, and `isOptional`\n // on TextArea. The name also needs the disable below, which a name using one\n // of the allowed boolean prefixes would not.\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 // TODO v5: inconsistent naming. Every form control names itself differently:\n // the label is optional here and a design with no room for it reaches for\n // htmlAttributes['aria-label'], TextArea, Select, Checkbox, Radio and Switch\n // expose an `ariaLabel` prop instead, and Combobox requires the label and\n // clips it with `hasVisuallyHiddenLabel`.\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 [currentValue, handleChange] = useSemiControlledInput({\n inputType: 'text',\n isControlled: value !== undefined,\n onChange,\n state: value ?? '',\n });\n const hintId = useId();\n const canClear = isClearable && isDisabled !== true && isReadOnly !== true;\n const shouldRenderHint = canClear || isLoading;\n const { field, controlProps } = useFormField({\n errorText,\n // The clear/loading hint describes the input alongside the message.\n extraDescribedByIds: [shouldRenderHint && hintId],\n hasRequiredIndicator: showRequiredOrOptionalLabel,\n helpText,\n isRequired,\n label,\n });\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-text-input-label', {\n 'ndl-fluid': isFluid,\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 const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (canClear && event.key === 'Escape' && Boolean(currentValue)) {\n event.preventDefault();\n event.stopPropagation();\n handleChange?.({\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 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 <FormFieldLabel\n field={field}\n size={size}\n association=\"implicit\"\n moreInformationText={moreInformationText}\n tooltipProps={tooltipProps}\n wrap={(row) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {row}\n </Skeleton>\n )}\n />\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={currentValue}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleChange}\n {...controlProps}\n {...combinedHtmlInputAttributes}\n onKeyDown={handleInputKeyDown}\n {...restProps}\n />\n {shouldRenderHint && (\n <span\n id={hintId}\n className=\"ndl-text-input-hint\"\n aria-hidden={true}\n >\n {isLoading && 'Loading '}\n {canClear && 'Press Escape to clear input.'}\n </span>\n )}\n {canClear && Boolean(currentValue) && (\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 handleChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n }}\n >\n <XMarkIconOutline />\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\n <FormFieldMessage\n field={field}\n size={size}\n wrap={(content) => (\n <Skeleton\n onBackground=\"weak\"\n shape=\"rectangular\"\n {...skeletonProps}\n isLoading={isSkeletonLoading}\n >\n {content}\n </Skeleton>\n )}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;AAxBF,MAAa,aAAa,SA0BkB;CA1BlB,IAAA,EACxB,OACA,SACA,WACA,UACA,gBACA,iBACA,8BAA8B,OAC9B,qBACA,OAAO,UACP,aACA,OACA,cACA,gBACA,YACA,YACA,YACA,UACA,cAAc,OACd,WACA,OACA,oBAAoB,OACpB,YAAY,OACZ,eACA,QAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,CAAC,cAAc,gBAAgB,uBAAuB;EAC1D,WAAW;EACX,cAAc,UAAU,KAAA;EACxB;EACA,OAAO,UAAA,QAAA,UAAA,KAAA,IAAA,QAAS;CAClB,CAAC;CACD,MAAM,SAAS,MAAM;CACrB,MAAM,WAAW,eAAe,eAAe,QAAQ,eAAe;CACtE,MAAM,mBAAmB,YAAY;CACrC,MAAM,EAAE,OAAO,iBAAiB,aAAa;EAC3C;EAEA,qBAAqB,CAAC,oBAAoB,MAAM;EAChD,sBAAsB;EACtB;EACA;EACA;CACF,CAAC;CAED,MAAM,2BAA2B,WAAW,kBAAkB,WAAW;EACvE,gBAAgB;EAChB,iBAAiB;EACjB,gBAAgB,kBAAkB,mBAAmB;EACrD,wBAAwB;EACxB,yBAAyB,mBAAmB;EAC5C,aAAa,SAAS;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GACS;GACD;GACN,OAAO,YACL,oBAAC,UAAA,eAAA,eAAA;IACC,cAAa;IACb,OAAM;GACF,GAAA,aAAA,GAAA,CAAA,GAAA;IACJ,WAAW;IAEV,UAAA;GACO,CAAA,CAAA;EAEb,CAAA,CACE;;AAET"}
@@ -39,6 +39,7 @@ export { ProgressBar } from './progress-bar';
39
39
  export { Dropzone } from './dropzone';
40
40
  export * from './data-grid';
41
41
  export { TextInput } from './text-input';
42
+ export { SearchField } from './search-field';
42
43
  export { TextArea } from './text-area';
43
44
  export { TextLink } from './text-link';
44
45
  export { Select } from './select';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,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AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import { type ComponentProps } from 'react';
22
+ import { TextInput } from '../text-input';
23
+ type SearchFieldTextInputProps = Pick<ComponentProps<typeof TextInput>, 'className' | 'errorText' | 'helpText' | 'htmlAttributes' | 'isDisabled' | 'isFluid' | 'isLoading' | 'isReadOnly' | 'isSkeletonLoading' | 'onChange' | 'placeholder' | 'ref' | 'size' | 'skeletonProps' | 'style' | 'value'>;
24
+ export type SearchFieldProps = SearchFieldTextInputProps & {
25
+ /**
26
+ * Accessible name for the search field. The label is announced by assistive
27
+ * technologies but is not rendered visually.
28
+ */
29
+ label: string;
30
+ /**
31
+ * Called with the search query after typing pauses for `debounceDelay`, and
32
+ * immediately when the user presses Enter or clears the field.
33
+ */
34
+ onSearch?: (query: string) => void;
35
+ /**
36
+ * Delay in milliseconds before calling `onSearch` after the query changes.
37
+ * @default 500
38
+ */
39
+ debounceDelay?: number;
40
+ };
41
+ /**
42
+ * A text input for entering search queries.
43
+ *
44
+ * @remarks
45
+ * SearchField renders a fixed search icon and uses the native `search` input
46
+ * type. `onChange` is called immediately, while `onSearch` is debounced until
47
+ * typing pauses. Pressing Enter or clearing the field calls `onSearch`
48
+ * immediately.
49
+ */
50
+ export declare const SearchField: ({ debounceDelay, htmlAttributes, label, onChange, onSearch, ...textInputProps }: SearchFieldProps) => import("react/jsx-runtime").JSX.Element;
51
+ export {};
52
+ //# sourceMappingURL=SearchField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchField.d.ts","sourceRoot":"","sources":["../../../src/search-field/SearchField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAoB,KAAK,cAAc,EAAe,MAAM,OAAO,CAAC;AAI3E,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,yBAAyB,GAAG,IAAI,CACnC,cAAc,CAAC,OAAO,SAAS,CAAC,EAC9B,WAAW,GACX,WAAW,GACX,UAAU,GACV,gBAAgB,GAChB,YAAY,GACZ,SAAS,GACT,WAAW,GACX,YAAY,GACZ,mBAAmB,GACnB,UAAU,GACV,aAAa,GACb,KAAK,GACL,MAAM,GACN,eAAe,GACf,OAAO,GACP,OAAO,CACV,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,GAAG;IACzD;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,iFAOzB,gBAAgB,4CAsDlB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /*!
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export * from './SearchField';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/search-field/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "5.6.4",
3
+ "version": "5.7.0",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of Neo4j Design System",
6
6
  "keywords": [
@@ -252,6 +252,11 @@
252
252
  "require": "./lib/cjs/read-only-tag/index.js",
253
253
  "import": "./lib/esm/read-only-tag/index.mjs"
254
254
  },
255
+ "./search-field": {
256
+ "types": "./lib/types/search-field/index.d.ts",
257
+ "require": "./lib/cjs/search-field/index.js",
258
+ "import": "./lib/esm/search-field/index.mjs"
259
+ },
255
260
  "./segmented-control": {
256
261
  "types": "./lib/types/segmented-control/index.d.ts",
257
262
  "require": "./lib/cjs/segmented-control/index.js",
@@ -429,7 +434,7 @@
429
434
  "@tanstack/react-table": "8.21.3",
430
435
  "react": ">=19.0.0",
431
436
  "react-dom": ">=19.0.0",
432
- "@neo4j-ndl/base": "^5.4.2"
437
+ "@neo4j-ndl/base": "^5.4.3"
433
438
  },
434
439
  "dependencies": {
435
440
  "@dnd-kit/core": "6.3.1",
@@ -2,7 +2,7 @@
2
2
  name: ndl-react
3
3
  metadata:
4
4
  package: '@neo4j-ndl/react'
5
- version: '5.6.4'
5
+ version: '5.7.0'
6
6
  description: >-
7
7
  Build and edit UI with the Neo4j Needle React design system
8
8
  (@neo4j-ndl/react). Use when adding, composing, or modifying Needle components
@@ -15,7 +15,7 @@ description: >-
15
15
 
16
16
  # Neo4j Needle (@neo4j-ndl/react)
17
17
 
18
- > 📌 Shipped with `@neo4j-ndl/react` v5.6.4. Once installed into your repo (e.g. via
18
+ > 📌 Shipped with `@neo4j-ndl/react` v5.7.0. Once installed into your repo (e.g. via
19
19
  > `npx skills add`) this folder is detached from the package — the installed
20
20
  > package (TypeScript types in `node_modules/@neo4j-ndl/react`) is the source of
21
21
  > truth.
@@ -184,6 +184,7 @@ Import from `@neo4j-ndl/react`.
184
184
  | `Radio` | [components/radio.md](components/radio.md) | ✅ | 7 |
185
185
  | `RadioGroup` | [components/radio-group.md](components/radio-group.md) | ✅ | 8 |
186
186
  | `ReadOnlyTag` | [components/read-only-tag.md](components/read-only-tag.md) | | 4 |
187
+ | `SearchField` | [components/search-field.md](components/search-field.md) | ✅ | 3 |
187
188
  | `SegmentedControl` | [components/segmented-control.md](components/segmented-control.md) | ✅ | 5 |
188
189
  | `Select` | [components/select.md](components/select.md) | | 14 |
189
190
  | `SelectIconButton` | [components/select-icon-button.md](components/select-icon-button.md) | | 4 |
@@ -0,0 +1,254 @@
1
+ [//]: # (This file is auto-generated by the docs:generate-skills script, do not edit it manually)
2
+
3
+ # SearchField
4
+
5
+ Import: `import { SearchField } from '@neo4j-ndl/react'`
6
+
7
+ ## Props
8
+
9
+ ### SearchField
10
+
11
+ | Prop | Type | Required | Default | Description |
12
+ |------|------|----------|---------|-------------|
13
+ | `debounceDelay` | `number` | | `500` | Delay in milliseconds before calling `onSearch` after the query changes. |
14
+ | `errorText` | `ReactNode` | | | Error message displayed below the input. When provided, it overrides `helpText` and shows an error icon |
15
+ | `helpText` | `ReactNode` | | | Assistive text displayed below the input |
16
+ | `isDisabled` | `boolean` | | | Whether the input is disabled |
17
+ | `isFluid` | `boolean` | | | Whether the input should take the full available width |
18
+ | `isLoading` | `boolean` | | | Whether to show the loading spinner |
19
+ | `isReadOnly` | `boolean` | | | Whether the input is read-only |
20
+ | `isSkeletonLoading` | `boolean` | | | Whether to render skeletons instead of content |
21
+ | `label` | `string` | ✅ | | Accessible name for the search field. The label is announced by assistive technologies but is not rendered visually. |
22
+ | `onChange` | `ChangeEventHandler<HTMLInputElement, HTMLInputElement>` | | | Callback function triggered when the input value changes |
23
+ | `onSearch` | `((query: string) => void)` | | | Called with the search query after typing pauses for `debounceDelay`, and immediately when the user presses Enter or clears the field. |
24
+ | `placeholder` | `string` | | | Placeholder text displayed when the input is empty |
25
+ | `ref` | `Ref<HTMLInputElement>` | | | A ref to apply to the root element. |
26
+ | `size` | `'large' \| 'medium' \| 'small'` | | | Size of the input |
27
+ | `skeletonProps` | `(SkeletonProps & { as?: ElementType<any, keyof IntrinsicElements>; } & BaseProps<ElementType<any, keyof IntrinsicElements>>)` | | | Additional props forwarded to the underlying Skeleton components |
28
+ | `value` | `string \| number \| readonly string[]` | | | The current value of the input |
29
+
30
+ SearchField renders a fixed search icon and uses the native `search` input
31
+ type. `onChange` is called immediately, while `onSearch` is debounced until
32
+ typing pauses. Pressing Enter or clearing the field calls `onSearch`
33
+ immediately.
34
+
35
+ ## Accessibility
36
+
37
+ ## Implementation guidelines
38
+
39
+ ### Name and search landmark
40
+
41
+ The required `label` prop provides the search field's accessible name through `aria-label`; it is not displayed visually. Use a concise label that identifies the search scope or purpose, such as “Search documentation” rather than only “Search,” when context is needed. Do not pass a separate `aria-label` through `htmlAttributes`.
42
+
43
+ SearchField uses the native `search` input type and is exposed with the `searchbox` role.
44
+
45
+ Wrap the field in an element with `role="search"` when it provides page- or site-wide search. If a page has multiple search landmarks, give each landmark a distinct accessible name with `aria-label` or `aria-labelledby`.
46
+
47
+ ### Results and status messages
48
+
49
+ Present results with appropriate page structure, such as a heading followed by a list of links. Keep focus in the search field when results update; do not automatically move focus into the results. This lets keyboard and screen reader users decide when to navigate to them.
50
+
51
+ Announce the completed result count in a persistent, polite live region, for example, “7 results for Neo4j” or “No results for Neo4j.” A `role="status"` region with `aria-atomic="true"` supports WCAG 2.2 SC 4.1.3 Status Messages (Level AA). Mount the empty status region before a search starts, update only its text, and do not place interactive content inside it.
52
+
53
+ For asynchronous searches, set `aria-busy="true"` on the results container while it is updating and remove it when the update completes. Communicate loading, failure, and recovery without clearing existing results prematurely. Avoid having multiple live regions announce the same update.
54
+
55
+ SearchField is not an autocomplete or combobox. If typing opens a selectable suggestions popup, use Combobox or implement the complete combobox keyboard and ARIA pattern rather than adding only `aria-expanded` to SearchField.
56
+
57
+ ### Interaction
58
+
59
+ SearchField is always clearable. Pressing Escape clears a non-empty search field without moving focus. The same action is available with a pointer from the clear button.
60
+
61
+ `onChange` runs immediately so controlled fields can update their visible value as the user types. `onSearch` is debounced while typing, but runs immediately when the field is cleared or the user presses Enter.
62
+
63
+ If a consumer prevents the default Enter key behavior in `htmlAttributes.onKeyDown`, `onSearch` is not called.
64
+
65
+ ## Examples
66
+
67
+ ### Default
68
+
69
+ ```tsx
70
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
71
+
72
+ import { SearchField } from '@neo4j-ndl/react';
73
+
74
+ const Component = () => {
75
+ return <SearchField label="Search" placeholder="Search for something" />;
76
+ };
77
+
78
+ export default Component;
79
+ ```
80
+
81
+ ### Debounced
82
+
83
+ ```tsx
84
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
85
+
86
+ import { SearchField, Typography } from '@neo4j-ndl/react';
87
+ import { useState } from 'react';
88
+
89
+ const Component = () => {
90
+ const [query, setQuery] = useState('');
91
+
92
+ return (
93
+ <div>
94
+ <SearchField
95
+ label="Search"
96
+ placeholder="Search for something"
97
+ onSearch={setQuery}
98
+ />
99
+ <Typography as="p" variant="body-medium">
100
+ Latest query: {query || 'None'}
101
+ </Typography>
102
+ </div>
103
+ );
104
+ };
105
+
106
+ export default Component;
107
+ ```
108
+
109
+ ### Results
110
+
111
+ ```tsx
112
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
113
+
114
+ import { SearchField, Typography } from '@neo4j-ndl/react';
115
+ import { useEffect, useState } from 'react';
116
+
117
+ const documentationPages = [
118
+ {
119
+ description: 'Connect an application and run your first query.',
120
+ href: '#getting-started',
121
+ title: 'Getting started',
122
+ },
123
+ {
124
+ description: 'Learn how nodes, relationships, and properties work.',
125
+ href: '#graph-data-model',
126
+ title: 'Graph data model',
127
+ },
128
+ {
129
+ description: 'Read and write graph data with the Cypher query language.',
130
+ href: '#cypher-manual',
131
+ title: 'Cypher manual',
132
+ },
133
+ {
134
+ description: 'Configure drivers, authentication, and connection pooling.',
135
+ href: '#drivers',
136
+ title: 'Neo4j drivers',
137
+ },
138
+ {
139
+ description: 'Deploy and operate Neo4j in production.',
140
+ href: '#operations',
141
+ title: 'Operations manual',
142
+ },
143
+ ];
144
+
145
+ const Component = () => {
146
+ const [isLoading, setIsLoading] = useState(false);
147
+ const [query, setQuery] = useState<string | null>(null);
148
+ const [resultMessage, setResultMessage] = useState(
149
+ `${documentationPages.length} results`,
150
+ );
151
+ const [results, setResults] = useState(documentationPages);
152
+
153
+ useEffect(() => {
154
+ if (query === null) {
155
+ return;
156
+ }
157
+
158
+ setIsLoading(true);
159
+
160
+ const timeout = window.setTimeout(() => {
161
+ const normalizedQuery = query.trim().toLocaleLowerCase();
162
+ const nextResults = documentationPages.filter(({ description, title }) =>
163
+ `${title} ${description}`.toLocaleLowerCase().includes(normalizedQuery),
164
+ );
165
+ const querySuffix = query ? ` for ${query}` : '';
166
+
167
+ setResults(nextResults);
168
+ setResultMessage(
169
+ nextResults.length === 0
170
+ ? `No results${querySuffix}`
171
+ : `${nextResults.length} ${
172
+ nextResults.length === 1 ? 'result' : 'results'
173
+ }${querySuffix}`,
174
+ );
175
+ setIsLoading(false);
176
+ }, 400);
177
+
178
+ return () => {
179
+ window.clearTimeout(timeout);
180
+ };
181
+ }, [query]);
182
+
183
+ return (
184
+ <main
185
+ style={{
186
+ display: 'grid',
187
+ gap: '24px',
188
+ maxWidth: '640px',
189
+ width: '100%',
190
+ }}
191
+ >
192
+ <div role="search" aria-label="Documentation">
193
+ <SearchField
194
+ label="Search documentation"
195
+ placeholder="Search documentation"
196
+ isLoading={isLoading}
197
+ onSearch={setQuery}
198
+ />
199
+ </div>
200
+
201
+ <section aria-labelledby="search-results-heading">
202
+ <Typography
203
+ as="h2"
204
+ variant="title-3"
205
+ htmlAttributes={{ id: 'search-results-heading' }}
206
+ >
207
+ Documentation
208
+ </Typography>
209
+ <Typography
210
+ as="p"
211
+ variant="body-medium"
212
+ htmlAttributes={{ 'aria-atomic': 'true', role: 'status' }}
213
+ >
214
+ {resultMessage}
215
+ </Typography>
216
+ <div aria-busy={isLoading || undefined}>
217
+ {results.length > 0 ? (
218
+ <ul
219
+ style={{
220
+ display: 'grid',
221
+ gap: '16px',
222
+ listStyle: 'none',
223
+ margin: '16px 0 0',
224
+ padding: 0,
225
+ }}
226
+ >
227
+ {results.map(({ description, href, title }) => (
228
+ <li key={href}>
229
+ <Typography
230
+ as="a"
231
+ variant="body-medium"
232
+ htmlAttributes={{ href }}
233
+ >
234
+ {title}
235
+ </Typography>
236
+ <Typography
237
+ as="p"
238
+ variant="body-small"
239
+ style={{ margin: '4px 0 0' }}
240
+ >
241
+ {description}
242
+ </Typography>
243
+ </li>
244
+ ))}
245
+ </ul>
246
+ ) : null}
247
+ </div>
248
+ </section>
249
+ </main>
250
+ );
251
+ };
252
+
253
+ export default Component;
254
+ ```