Skip to content

Commit 57ef5ee

Browse files
authored
feat: export hooks from primitives & DS (#1622)
1 parent b2c097b commit 57ef5ee

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

.changeset/smart-buttons-do.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@strapi/design-system': minor
3+
'@strapi/ui-primitives': minor
4+
---
5+
6+
feat: export helpful hooks

packages/primitives/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,23 @@ import { Select } from '@strapi/ui-primitives';
9595
};
9696
```
9797

98+
## Hook Documentation
99+
100+
### useCallbackRef
101+
102+
Converts a callback to a ref to avoid triggering re-renders when passed as a prop or avoid re-executing
103+
effects when passed as a dependency
104+
105+
### useCollator
106+
107+
Provides localized string collation for the current locale. Automatically updates when the locale changes,
108+
and handles caching of the collator for performance.
109+
110+
### useFilter
111+
112+
Provides localized string search functionality that is useful for filtering or matching items
113+
in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.
114+
98115
## Contributing
99116

100117
Please follow our [CONTRIBUTING](https://github.com/strapi/design-system/blob/main/CONTRIBUTING.md) guidelines.

packages/primitives/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ export * from './helpers/events';
1818
* Hooks
1919
* ---------------------------------------------------------------------------------------------*/
2020
export * from './hooks/useCallbackRef';
21+
export * from './hooks/useCollator';
22+
export * from './hooks/useFilter';

packages/strapi-design-system/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,8 @@ export * from './Tooltip';
6767
export * from './Typography';
6868
export * from './VisuallyHidden';
6969
export * from './themes';
70+
71+
export * from './hooks/useComposeRefs';
72+
export * from './hooks/useDateFormatter';
73+
74+
export { useFilter, useCollator, type Filter, useCallbackRef, composeEventHandlers } from '@strapi/ui-primitives';

0 commit comments

Comments
 (0)