@fluentui/react-search 9.0.6 → 9.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -19
- package/lib/components/SearchBox/useSearchBox.js +7 -7
- package/lib/components/SearchBox/useSearchBox.js.map +1 -1
- package/lib-commonjs/components/SearchBox/useSearchBox.js +7 -7
- package/lib-commonjs/components/SearchBox/useSearchBox.js.map +1 -1
- package/package.json +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-search
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 17 Jun 2024 07:31:08 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.8)
|
|
8
|
+
|
|
9
|
+
Mon, 17 Jun 2024 07:31:08 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.7..@fluentui/react-search_v9.0.8)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-input to v9.4.79 ([commit](https://github.com/microsoft/fluentui/commit/9ae683c22f2e65d94422a571ad5d3f97d0a77234) by beachball)
|
|
15
|
+
|
|
16
|
+
## [9.0.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.7)
|
|
17
|
+
|
|
18
|
+
Thu, 06 Jun 2024 15:26:38 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.6..@fluentui/react-search_v9.0.7)
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- chore: ensure only state or defaultState is provided on useControllableState hook invocation ([PR #31461](https://github.com/microsoft/fluentui/pull/31461) by bernardo.sunderhus@gmail.com)
|
|
24
|
+
- Bump @fluentui/react-input to v9.4.78 ([PR #31586](https://github.com/microsoft/fluentui/pull/31586) by beachball)
|
|
25
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.39 ([PR #31586](https://github.com/microsoft/fluentui/pull/31586) by beachball)
|
|
26
|
+
- Bump @fluentui/react-utilities to v9.18.10 ([PR #31586](https://github.com/microsoft/fluentui/pull/31586) by beachball)
|
|
27
|
+
|
|
7
28
|
## [9.0.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.6)
|
|
8
29
|
|
|
9
|
-
Thu, 23 May 2024
|
|
30
|
+
Thu, 23 May 2024 08:02:52 GMT
|
|
10
31
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.5..@fluentui/react-search_v9.0.6)
|
|
11
32
|
|
|
12
33
|
### Patches
|
|
13
34
|
|
|
14
|
-
- Bump @fluentui/react-input to v9.4.77 ([commit](https://github.com/microsoft/fluentui/commit/
|
|
35
|
+
- Bump @fluentui/react-input to v9.4.77 ([commit](https://github.com/microsoft/fluentui/commit/03599d609e8310b08c57d1f871cffbf717d79207) by beachball)
|
|
15
36
|
|
|
16
37
|
## [9.0.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.5)
|
|
17
38
|
|
|
18
|
-
Mon, 20 May 2024 12:45:03 GMT
|
|
39
|
+
Mon, 20 May 2024 12:45:03 GMT
|
|
19
40
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.4..@fluentui/react-search_v9.0.5)
|
|
20
41
|
|
|
21
42
|
### Patches
|
|
@@ -27,17 +48,17 @@ Mon, 20 May 2024 12:45:03 GMT
|
|
|
27
48
|
|
|
28
49
|
## [9.0.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.4)
|
|
29
50
|
|
|
30
|
-
Thu, 16 May 2024 09:25:17 GMT
|
|
51
|
+
Thu, 16 May 2024 09:25:17 GMT
|
|
31
52
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.3..@fluentui/react-search_v9.0.4)
|
|
32
53
|
|
|
33
54
|
### Patches
|
|
34
55
|
|
|
35
|
-
-
|
|
56
|
+
- chore: Upgrade react-icons version to 2.0.239 to pick up provider export map fix. ([PR #31287](https://github.com/microsoft/fluentui/pull/31287) by ololubek@microsoft.com)
|
|
36
57
|
- Bump @fluentui/react-input to v9.4.75 ([PR #31390](https://github.com/microsoft/fluentui/pull/31390) by beachball)
|
|
37
58
|
|
|
38
59
|
## [9.0.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.3)
|
|
39
60
|
|
|
40
|
-
Mon, 06 May 2024 12:55:02 GMT
|
|
61
|
+
Mon, 06 May 2024 12:55:02 GMT
|
|
41
62
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.2..@fluentui/react-search_v9.0.3)
|
|
42
63
|
|
|
43
64
|
### Patches
|
|
@@ -48,17 +69,17 @@ Mon, 06 May 2024 12:55:02 GMT
|
|
|
48
69
|
|
|
49
70
|
## [9.0.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.2)
|
|
50
71
|
|
|
51
|
-
Thu, 02 May 2024 11:36:37 GMT
|
|
72
|
+
Thu, 02 May 2024 11:36:37 GMT
|
|
52
73
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.1..@fluentui/react-search_v9.0.2)
|
|
53
74
|
|
|
54
75
|
### Patches
|
|
55
76
|
|
|
56
|
-
-
|
|
77
|
+
- chore: upgrade @fluentui/react-icons to 2.0.237. ([PR #31139](https://github.com/microsoft/fluentui/pull/31139) by ololubek@microsoft.com)
|
|
57
78
|
- Bump @fluentui/react-input to v9.4.73 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
|
58
79
|
|
|
59
80
|
## [9.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.1)
|
|
60
81
|
|
|
61
|
-
Tue, 23 Apr 2024 08:17:49 GMT
|
|
82
|
+
Tue, 23 Apr 2024 08:17:49 GMT
|
|
62
83
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search_v9.0.0..@fluentui/react-search_v9.0.1)
|
|
63
84
|
|
|
64
85
|
### Patches
|
|
@@ -69,7 +90,7 @@ Tue, 23 Apr 2024 08:17:49 GMT
|
|
|
69
90
|
|
|
70
91
|
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-search_v9.0.0)
|
|
71
92
|
|
|
72
|
-
Wed, 17 Apr 2024 21:53:57 GMT
|
|
93
|
+
Wed, 17 Apr 2024 21:53:57 GMT
|
|
73
94
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.2.0..@fluentui/react-search_v9.0.0)
|
|
74
95
|
|
|
75
96
|
### Minor changes
|
|
@@ -83,7 +104,7 @@ Wed, 17 Apr 2024 21:53:57 GMT
|
|
|
83
104
|
|
|
84
105
|
## [0.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.2.0)
|
|
85
106
|
|
|
86
|
-
Thu, 04 Apr 2024 12:08:08 GMT
|
|
107
|
+
Thu, 04 Apr 2024 12:08:08 GMT
|
|
87
108
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.51..@fluentui/react-search-preview_v0.2.0)
|
|
88
109
|
|
|
89
110
|
### Minor changes
|
|
@@ -92,7 +113,7 @@ Thu, 04 Apr 2024 12:08:08 GMT
|
|
|
92
113
|
|
|
93
114
|
## [0.1.51](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.1.51)
|
|
94
115
|
|
|
95
|
-
Tue, 02 Apr 2024 09:48:01 GMT
|
|
116
|
+
Tue, 02 Apr 2024 09:48:01 GMT
|
|
96
117
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.50..@fluentui/react-search-preview_v0.1.51)
|
|
97
118
|
|
|
98
119
|
### Patches
|
|
@@ -103,7 +124,7 @@ Tue, 02 Apr 2024 09:48:01 GMT
|
|
|
103
124
|
|
|
104
125
|
## [0.1.50](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.1.50)
|
|
105
126
|
|
|
106
|
-
Mon, 25 Mar 2024 11:12:15 GMT
|
|
127
|
+
Mon, 25 Mar 2024 11:12:15 GMT
|
|
107
128
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.49..@fluentui/react-search-preview_v0.1.50)
|
|
108
129
|
|
|
109
130
|
### Patches
|
|
@@ -112,7 +133,7 @@ Mon, 25 Mar 2024 11:12:15 GMT
|
|
|
112
133
|
|
|
113
134
|
## [0.1.49](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.1.49)
|
|
114
135
|
|
|
115
|
-
Mon, 18 Mar 2024 19:50:46 GMT
|
|
136
|
+
Mon, 18 Mar 2024 19:50:46 GMT
|
|
116
137
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.48..@fluentui/react-search-preview_v0.1.49)
|
|
117
138
|
|
|
118
139
|
### Patches
|
|
@@ -124,7 +145,7 @@ Mon, 18 Mar 2024 19:50:46 GMT
|
|
|
124
145
|
|
|
125
146
|
## [0.1.48](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.1.48)
|
|
126
147
|
|
|
127
|
-
Fri, 15 Mar 2024 21:43:49 GMT
|
|
148
|
+
Fri, 15 Mar 2024 21:43:49 GMT
|
|
128
149
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.47..@fluentui/react-search-preview_v0.1.48)
|
|
129
150
|
|
|
130
151
|
### Patches
|
|
@@ -136,7 +157,7 @@ Fri, 15 Mar 2024 21:43:49 GMT
|
|
|
136
157
|
|
|
137
158
|
## [0.1.47](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.1.47)
|
|
138
159
|
|
|
139
|
-
Thu, 07 Mar 2024 19:33:27 GMT
|
|
160
|
+
Thu, 07 Mar 2024 19:33:27 GMT
|
|
140
161
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.46..@fluentui/react-search-preview_v0.1.47)
|
|
141
162
|
|
|
142
163
|
### Patches
|
|
@@ -148,7 +169,7 @@ Thu, 07 Mar 2024 19:33:27 GMT
|
|
|
148
169
|
|
|
149
170
|
## [0.1.46](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.1.46)
|
|
150
171
|
|
|
151
|
-
Wed, 28 Feb 2024 02:34:19 GMT
|
|
172
|
+
Wed, 28 Feb 2024 02:34:19 GMT
|
|
152
173
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.45..@fluentui/react-search-preview_v0.1.46)
|
|
153
174
|
|
|
154
175
|
### Patches
|
|
@@ -159,7 +180,7 @@ Wed, 28 Feb 2024 02:34:19 GMT
|
|
|
159
180
|
|
|
160
181
|
## [0.1.45](https://github.com/microsoft/fluentui/tree/@fluentui/react-search-preview_v0.1.45)
|
|
161
182
|
|
|
162
|
-
Tue, 20 Feb 2024 14:22:24 GMT
|
|
183
|
+
Tue, 20 Feb 2024 14:22:24 GMT
|
|
163
184
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-search-preview_v0.1.44..@fluentui/react-search-preview_v0.1.45)
|
|
164
185
|
|
|
165
186
|
### Patches
|
|
@@ -11,12 +11,12 @@ import { DismissRegular, SearchRegular } from '@fluentui/react-icons';
|
|
|
11
11
|
* @param props - props from this instance of SearchBox
|
|
12
12
|
* @param ref - reference to root HTMLElement of SearchBox
|
|
13
13
|
*/ export const useSearchBox_unstable = (props, ref)=>{
|
|
14
|
-
const { size = 'medium', disabled = false, root, contentBefore, dismiss, contentAfter, ...inputProps } = props;
|
|
14
|
+
const { size = 'medium', disabled = false, root, contentBefore, dismiss, contentAfter, value, defaultValue, ...inputProps } = props;
|
|
15
15
|
const searchBoxRootRef = React.useRef(null);
|
|
16
16
|
const searchBoxRef = React.useRef(null);
|
|
17
|
-
const [
|
|
18
|
-
state:
|
|
19
|
-
defaultState:
|
|
17
|
+
const [internalValue, setInternalValue] = useControllableState({
|
|
18
|
+
state: value,
|
|
19
|
+
defaultState: defaultValue,
|
|
20
20
|
initialState: ''
|
|
21
21
|
});
|
|
22
22
|
// Tracks the focus of the component for the contentAfter and dismiss button
|
|
@@ -36,7 +36,7 @@ import { DismissRegular, SearchRegular } from '@fluentui/react-icons';
|
|
|
36
36
|
(_dismiss_onClick = dismiss.onClick) === null || _dismiss_onClick === void 0 ? void 0 : _dismiss_onClick.call(dismiss, event);
|
|
37
37
|
}
|
|
38
38
|
const newValue = '';
|
|
39
|
-
|
|
39
|
+
setInternalValue(newValue);
|
|
40
40
|
(_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, event, {
|
|
41
41
|
value: newValue
|
|
42
42
|
});
|
|
@@ -45,7 +45,7 @@ import { DismissRegular, SearchRegular } from '@fluentui/react-icons';
|
|
|
45
45
|
type: 'search',
|
|
46
46
|
disabled,
|
|
47
47
|
size,
|
|
48
|
-
value,
|
|
48
|
+
value: internalValue,
|
|
49
49
|
root: slot.always({
|
|
50
50
|
...rootProps,
|
|
51
51
|
ref: useMergedRefs(rootProps === null || rootProps === void 0 ? void 0 : rootProps.ref, searchBoxRootRef),
|
|
@@ -72,7 +72,7 @@ import { DismissRegular, SearchRegular } from '@fluentui/react-icons';
|
|
|
72
72
|
(_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, ev, {
|
|
73
73
|
value: newValue
|
|
74
74
|
});
|
|
75
|
-
|
|
75
|
+
setInternalValue(newValue);
|
|
76
76
|
})
|
|
77
77
|
}, useMergedRefs(searchBoxRef, ref));
|
|
78
78
|
const state = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useSearchBox.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n isResolvedShorthand,\n mergeCallbacks,\n slot,\n useControllableState,\n useEventCallback,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { useInput_unstable } from '@fluentui/react-input';\nimport { DismissRegular, SearchRegular } from '@fluentui/react-icons';\nimport type { ExtractSlotProps } from '@fluentui/react-utilities';\nimport type { SearchBoxSlots, SearchBoxProps, SearchBoxState } from './SearchBox.types';\n\n/**\n * Create the state required to render SearchBox.\n *\n * The returned state can be modified with hooks such as useSearchBoxStyles_unstable,\n * before being passed to renderSearchBox_unstable.\n *\n * @param props - props from this instance of SearchBox\n * @param ref - reference to root HTMLElement of SearchBox\n */\nexport const useSearchBox_unstable = (props: SearchBoxProps, ref: React.Ref<HTMLInputElement>): SearchBoxState => {\n const {
|
|
1
|
+
{"version":3,"sources":["useSearchBox.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n isResolvedShorthand,\n mergeCallbacks,\n slot,\n useControllableState,\n useEventCallback,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { useInput_unstable } from '@fluentui/react-input';\nimport { DismissRegular, SearchRegular } from '@fluentui/react-icons';\nimport type { ExtractSlotProps } from '@fluentui/react-utilities';\nimport type { SearchBoxSlots, SearchBoxProps, SearchBoxState } from './SearchBox.types';\n\n/**\n * Create the state required to render SearchBox.\n *\n * The returned state can be modified with hooks such as useSearchBoxStyles_unstable,\n * before being passed to renderSearchBox_unstable.\n *\n * @param props - props from this instance of SearchBox\n * @param ref - reference to root HTMLElement of SearchBox\n */\nexport const useSearchBox_unstable = (props: SearchBoxProps, ref: React.Ref<HTMLInputElement>): SearchBoxState => {\n const {\n size = 'medium',\n disabled = false,\n root,\n contentBefore,\n dismiss,\n contentAfter,\n value,\n defaultValue,\n ...inputProps\n } = props;\n\n const searchBoxRootRef = React.useRef<HTMLDivElement>(null);\n const searchBoxRef = React.useRef<HTMLInputElement>(null);\n\n const [internalValue, setInternalValue] = useControllableState({\n state: value,\n defaultState: defaultValue,\n initialState: '',\n });\n\n // Tracks the focus of the component for the contentAfter and dismiss button\n const [focused, setFocused] = React.useState(false);\n\n const onFocus = useEventCallback(() => {\n setFocused(true);\n });\n\n const onBlur: React.FocusEventHandler<HTMLSpanElement> = useEventCallback(ev => {\n setFocused(!!searchBoxRootRef.current?.contains(ev.relatedTarget));\n });\n\n const rootProps = slot.resolveShorthand(root);\n\n const handleDismissClick = useEventCallback((event: React.MouseEvent<HTMLSpanElement>) => {\n if (isResolvedShorthand(dismiss)) {\n dismiss.onClick?.(event);\n }\n const newValue = '';\n setInternalValue(newValue);\n props.onChange?.(event, { value: newValue });\n });\n\n const inputState = useInput_unstable(\n {\n type: 'search',\n disabled,\n size,\n value: internalValue,\n root: slot.always<ExtractSlotProps<SearchBoxSlots['root']>>(\n {\n ...rootProps,\n ref: useMergedRefs(rootProps?.ref, searchBoxRootRef),\n onFocus: useEventCallback(mergeCallbacks(rootProps?.onFocus, onFocus)),\n onBlur: useEventCallback(mergeCallbacks(rootProps?.onBlur, onBlur)),\n },\n {\n elementType: 'span',\n },\n ),\n contentBefore: slot.optional(contentBefore, {\n renderByDefault: true,\n defaultProps: {\n children: <SearchRegular />,\n },\n elementType: 'span',\n }),\n contentAfter: slot.optional(contentAfter, {\n renderByDefault: true,\n elementType: 'span',\n }),\n ...inputProps,\n onChange: useEventCallback(ev => {\n const newValue = ev.target.value;\n props.onChange?.(ev, { value: newValue });\n setInternalValue(newValue);\n }),\n },\n useMergedRefs(searchBoxRef, ref),\n );\n\n const state: SearchBoxState = {\n ...inputState,\n components: {\n ...inputState.components,\n dismiss: 'span',\n },\n dismiss: slot.optional(dismiss, {\n defaultProps: {\n children: <DismissRegular />,\n role: 'button',\n 'aria-label': 'clear',\n tabIndex: -1,\n },\n renderByDefault: true,\n elementType: 'span',\n }),\n disabled,\n focused,\n size,\n };\n\n if (state.dismiss) {\n state.dismiss.onClick = handleDismissClick;\n }\n\n return state;\n};\n"],"names":["React","isResolvedShorthand","mergeCallbacks","slot","useControllableState","useEventCallback","useMergedRefs","useInput_unstable","DismissRegular","SearchRegular","useSearchBox_unstable","props","ref","size","disabled","root","contentBefore","dismiss","contentAfter","value","defaultValue","inputProps","searchBoxRootRef","useRef","searchBoxRef","internalValue","setInternalValue","state","defaultState","initialState","focused","setFocused","useState","onFocus","onBlur","ev","current","contains","relatedTarget","rootProps","resolveShorthand","handleDismissClick","event","onClick","newValue","onChange","inputState","type","always","elementType","optional","renderByDefault","defaultProps","children","target","components","role","tabIndex"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,mBAAmB,EACnBC,cAAc,EACdC,IAAI,EACJC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,QACR,4BAA4B;AACnC,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,cAAc,EAAEC,aAAa,QAAQ,wBAAwB;AAItE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EACJC,OAAO,QAAQ,EACfC,WAAW,KAAK,EAChBC,IAAI,EACJC,aAAa,EACbC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,YAAY,EACZ,GAAGC,YACJ,GAAGV;IAEJ,MAAMW,mBAAmBtB,MAAMuB,MAAM,CAAiB;IACtD,MAAMC,eAAexB,MAAMuB,MAAM,CAAmB;IAEpD,MAAM,CAACE,eAAeC,iBAAiB,GAAGtB,qBAAqB;QAC7DuB,OAAOR;QACPS,cAAcR;QACdS,cAAc;IAChB;IAEA,4EAA4E;IAC5E,MAAM,CAACC,SAASC,WAAW,GAAG/B,MAAMgC,QAAQ,CAAC;IAE7C,MAAMC,UAAU5B,iBAAiB;QAC/B0B,WAAW;IACb;IAEA,MAAMG,SAAmD7B,iBAAiB8B,CAAAA;YAC3Db;QAAbS,WAAW,CAAC,GAACT,4BAAAA,iBAAiBc,OAAO,cAAxBd,gDAAAA,0BAA0Be,QAAQ,CAACF,GAAGG,aAAa;IAClE;IAEA,MAAMC,YAAYpC,KAAKqC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A,SAASd,KAAK+C,QAAQ,CAACjC,SAAS;YAC9BmC,cAAc;gBACZC,wBAAU,oBAAC7C;gBACXgD,MAAM;gBACN,cAAc;gBACdC,UAAU,CAAC;YACb;YACAN,iBAAiB;YACjBF,aAAa;QACf;QACAnC;QACAgB;QACAjB;IACF;IAEA,IAAIc,MAAMV,OAAO,EAAE;QACjBU,MAAMV,OAAO,CAAC0B,OAAO,GAAGF;IAC1B;IAEA,OAAOd;AACT,EAAE"}
|
|
@@ -14,12 +14,12 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
14
14
|
const _reactinput = require("@fluentui/react-input");
|
|
15
15
|
const _reacticons = require("@fluentui/react-icons");
|
|
16
16
|
const useSearchBox_unstable = (props, ref)=>{
|
|
17
|
-
const { size = 'medium', disabled = false, root, contentBefore, dismiss, contentAfter, ...inputProps } = props;
|
|
17
|
+
const { size = 'medium', disabled = false, root, contentBefore, dismiss, contentAfter, value, defaultValue, ...inputProps } = props;
|
|
18
18
|
const searchBoxRootRef = _react.useRef(null);
|
|
19
19
|
const searchBoxRef = _react.useRef(null);
|
|
20
|
-
const [
|
|
21
|
-
state:
|
|
22
|
-
defaultState:
|
|
20
|
+
const [internalValue, setInternalValue] = (0, _reactutilities.useControllableState)({
|
|
21
|
+
state: value,
|
|
22
|
+
defaultState: defaultValue,
|
|
23
23
|
initialState: ''
|
|
24
24
|
});
|
|
25
25
|
// Tracks the focus of the component for the contentAfter and dismiss button
|
|
@@ -39,7 +39,7 @@ const useSearchBox_unstable = (props, ref)=>{
|
|
|
39
39
|
(_dismiss_onClick = dismiss.onClick) === null || _dismiss_onClick === void 0 ? void 0 : _dismiss_onClick.call(dismiss, event);
|
|
40
40
|
}
|
|
41
41
|
const newValue = '';
|
|
42
|
-
|
|
42
|
+
setInternalValue(newValue);
|
|
43
43
|
(_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, event, {
|
|
44
44
|
value: newValue
|
|
45
45
|
});
|
|
@@ -48,7 +48,7 @@ const useSearchBox_unstable = (props, ref)=>{
|
|
|
48
48
|
type: 'search',
|
|
49
49
|
disabled,
|
|
50
50
|
size,
|
|
51
|
-
value,
|
|
51
|
+
value: internalValue,
|
|
52
52
|
root: _reactutilities.slot.always({
|
|
53
53
|
...rootProps,
|
|
54
54
|
ref: (0, _reactutilities.useMergedRefs)(rootProps === null || rootProps === void 0 ? void 0 : rootProps.ref, searchBoxRootRef),
|
|
@@ -75,7 +75,7 @@ const useSearchBox_unstable = (props, ref)=>{
|
|
|
75
75
|
(_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, ev, {
|
|
76
76
|
value: newValue
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
setInternalValue(newValue);
|
|
79
79
|
})
|
|
80
80
|
}, (0, _reactutilities.useMergedRefs)(searchBoxRef, ref));
|
|
81
81
|
const state = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useSearchBox.js"],"sourcesContent":["import * as React from 'react';\nimport { isResolvedShorthand, mergeCallbacks, slot, useControllableState, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useInput_unstable } from '@fluentui/react-input';\nimport { DismissRegular, SearchRegular } from '@fluentui/react-icons';\n/**\n * Create the state required to render SearchBox.\n *\n * The returned state can be modified with hooks such as useSearchBoxStyles_unstable,\n * before being passed to renderSearchBox_unstable.\n *\n * @param props - props from this instance of SearchBox\n * @param ref - reference to root HTMLElement of SearchBox\n */ export const useSearchBox_unstable = (props, ref)=>{\n const { size = 'medium', disabled = false, root, contentBefore, dismiss, contentAfter, ...inputProps } = props;\n const searchBoxRootRef = React.useRef(null);\n const searchBoxRef = React.useRef(null);\n const [
|
|
1
|
+
{"version":3,"sources":["useSearchBox.js"],"sourcesContent":["import * as React from 'react';\nimport { isResolvedShorthand, mergeCallbacks, slot, useControllableState, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useInput_unstable } from '@fluentui/react-input';\nimport { DismissRegular, SearchRegular } from '@fluentui/react-icons';\n/**\n * Create the state required to render SearchBox.\n *\n * The returned state can be modified with hooks such as useSearchBoxStyles_unstable,\n * before being passed to renderSearchBox_unstable.\n *\n * @param props - props from this instance of SearchBox\n * @param ref - reference to root HTMLElement of SearchBox\n */ export const useSearchBox_unstable = (props, ref)=>{\n const { size = 'medium', disabled = false, root, contentBefore, dismiss, contentAfter, value, defaultValue, ...inputProps } = props;\n const searchBoxRootRef = React.useRef(null);\n const searchBoxRef = React.useRef(null);\n const [internalValue, setInternalValue] = useControllableState({\n state: value,\n defaultState: defaultValue,\n initialState: ''\n });\n // Tracks the focus of the component for the contentAfter and dismiss button\n const [focused, setFocused] = React.useState(false);\n const onFocus = useEventCallback(()=>{\n setFocused(true);\n });\n const onBlur = useEventCallback((ev)=>{\n var _searchBoxRootRef_current;\n setFocused(!!((_searchBoxRootRef_current = searchBoxRootRef.current) === null || _searchBoxRootRef_current === void 0 ? void 0 : _searchBoxRootRef_current.contains(ev.relatedTarget)));\n });\n const rootProps = slot.resolveShorthand(root);\n const handleDismissClick = useEventCallback((event)=>{\n var _props_onChange;\n if (isResolvedShorthand(dismiss)) {\n var _dismiss_onClick;\n (_dismiss_onClick = dismiss.onClick) === null || _dismiss_onClick === void 0 ? void 0 : _dismiss_onClick.call(dismiss, event);\n }\n const newValue = '';\n setInternalValue(newValue);\n (_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, event, {\n value: newValue\n });\n });\n const inputState = useInput_unstable({\n type: 'search',\n disabled,\n size,\n value: internalValue,\n root: slot.always({\n ...rootProps,\n ref: useMergedRefs(rootProps === null || rootProps === void 0 ? void 0 : rootProps.ref, searchBoxRootRef),\n onFocus: useEventCallback(mergeCallbacks(rootProps === null || rootProps === void 0 ? void 0 : rootProps.onFocus, onFocus)),\n onBlur: useEventCallback(mergeCallbacks(rootProps === null || rootProps === void 0 ? void 0 : rootProps.onBlur, onBlur))\n }, {\n elementType: 'span'\n }),\n contentBefore: slot.optional(contentBefore, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(SearchRegular, null)\n },\n elementType: 'span'\n }),\n contentAfter: slot.optional(contentAfter, {\n renderByDefault: true,\n elementType: 'span'\n }),\n ...inputProps,\n onChange: useEventCallback((ev)=>{\n var _props_onChange;\n const newValue = ev.target.value;\n (_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, ev, {\n value: newValue\n });\n setInternalValue(newValue);\n })\n }, useMergedRefs(searchBoxRef, ref));\n const state = {\n ...inputState,\n components: {\n ...inputState.components,\n dismiss: 'span'\n },\n dismiss: slot.optional(dismiss, {\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(DismissRegular, null),\n role: 'button',\n 'aria-label': 'clear',\n tabIndex: -1\n },\n renderByDefault: true,\n elementType: 'span'\n }),\n disabled,\n focused,\n size\n };\n if (state.dismiss) {\n state.dismiss.onClick = handleDismissClick;\n }\n return state;\n};\n"],"names":["useSearchBox_unstable","props","ref","size","disabled","root","contentBefore","dismiss","contentAfter","value","defaultValue","inputProps","searchBoxRootRef","React","useRef","searchBoxRef","internalValue","setInternalValue","useControllableState","state","defaultState","initialState","focused","setFocused","useState","onFocus","useEventCallback","onBlur","ev","_searchBoxRootRef_current","current","contains","relatedTarget","rootProps","slot","resolveShorthand","handleDismissClick","event","_props_onChange","isResolvedShorthand","_dismiss_onClick","onClick","call","newValue","onChange","inputState","useInput_unstable","type","always","useMergedRefs","mergeCallbacks","elementType","optional","renderByDefault","defaultProps","children","createElement","SearchRegular","target","components","DismissRegular","role","tabIndex"],"mappings":";;;;+BAYiBA;;;eAAAA;;;;iEAZM;gCAC0F;4BAC/E;4BACY;AASnC,MAAMA,wBAAwB,CAACC,OAAOC;IAC7C,MAAM,EAAEC,OAAO,QAAQ,EAAEC,WAAW,KAAK,EAAEC,IAAI,EAAEC,aAAa,EAAEC,OAAO,EAAEC,YAAY,EAAEC,KAAK,EAAEC,YA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gBACdC,UAAU,CAAC;YACf;YACAT,iBAAiB;YACjBF,aAAa;QACjB;QACA/C;QACAkB;QACAnB;IACJ;IACA,IAAIgB,MAAMZ,OAAO,EAAE;QACfY,MAAMZ,OAAO,CAACkC,OAAO,GAAGL;IAC5B;IACA,OAAOjB;AACX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-search",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.8",
|
|
4
4
|
"description": "Search input for Fluent UI v9",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
"just": "just-scripts",
|
|
19
19
|
"lint": "just-scripts lint",
|
|
20
20
|
"test": "jest --passWithNoTests",
|
|
21
|
-
"
|
|
22
|
-
"type-check": "tsc -b tsconfig.json",
|
|
21
|
+
"type-check": "just-scripts type-check",
|
|
23
22
|
"generate-api": "just-scripts generate-api",
|
|
24
|
-
"storybook": "
|
|
23
|
+
"storybook": "yarn --cwd ../stories storybook",
|
|
25
24
|
"start": "yarn storybook"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
@@ -33,10 +32,10 @@
|
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"@fluentui/react-icons": "^2.0.239",
|
|
36
|
-
"@fluentui/react-input": "^9.4.
|
|
37
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
35
|
+
"@fluentui/react-input": "^9.4.79",
|
|
36
|
+
"@fluentui/react-jsx-runtime": "^9.0.39",
|
|
38
37
|
"@fluentui/react-theme": "^9.1.19",
|
|
39
|
-
"@fluentui/react-utilities": "^9.18.
|
|
38
|
+
"@fluentui/react-utilities": "^9.18.10",
|
|
40
39
|
"@griffel/react": "^1.5.22",
|
|
41
40
|
"@swc/helpers": "^0.5.1"
|
|
42
41
|
},
|