@storybook/react-native-ui-common 10.2.2-alpha.3 → 10.2.2-alpha.5
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/dist/index.d.ts +3 -1
- package/dist/index.js +20 -0
- package/package.json +3 -3
- package/src/util/index.ts +1 -0
- package/src/util/string.ts +20 -0
package/dist/index.d.ts
CHANGED
|
@@ -172,6 +172,8 @@ declare const isStoryHoistable: (storyName: string, componentName: string) => bo
|
|
|
172
172
|
*/
|
|
173
173
|
declare const useStyle: <TStyle extends ViewStyle | TextStyle | ImageStyle, TOutput extends StyleProp<TStyle>>(styleFactory: () => TOutput, deps?: DependencyList) => TOutput;
|
|
174
174
|
|
|
175
|
+
declare function startCase(str: string): string;
|
|
176
|
+
|
|
175
177
|
type ExpandedState = Record<string, boolean>;
|
|
176
178
|
interface ExpandAction {
|
|
177
179
|
ids: string[];
|
|
@@ -195,4 +197,4 @@ declare const useLastViewed: (selection: Selection) => {
|
|
|
195
197
|
declare const useStoreBooleanState: (key: string, defaultValue: boolean) => ReturnType<typeof useState<boolean>>;
|
|
196
198
|
declare const useStoreNumberState: (key: string, defaultValue: number) => [number, (value: number | ((prev: number) => number)) => void];
|
|
197
199
|
|
|
198
|
-
export { Button, ButtonIcon, type ButtonProps, ButtonText, type CombinedDataset, type Dataset, type ExpandAction, type ExpandType, type ExpandedProps, type ExpandedState, type GetSearchItemProps, type Highlight, type HighlightRange, type HighlightRanges, IconButton, type Item, type ItemRef, LayoutProvider, type RefType, type Refs, type SBUI, type SearchChildrenFn, type SearchItem, type SearchResult, type SearchResultProps, type Selection, type Storage, StorageProvider, type StoryRef, createId, cycle, get, getAncestorIds, getDescendantIds, getParent, getParents, getPath, getStateType, intersect, isAncestor, isExpandType, isStoryHoistable, merge, noArrayMerge, prevent, removeNoiseFromName, searchItem, transformStoryIndexToStoriesHash, transformStoryIndexV2toV3, transformStoryIndexV3toV4, transformStoryIndexV4toV5, useExpanded, useLastViewed, useLayout, useStorage, useStoreBooleanState, useStoreNumberState, useStyle };
|
|
200
|
+
export { Button, ButtonIcon, type ButtonProps, ButtonText, type CombinedDataset, type Dataset, type ExpandAction, type ExpandType, type ExpandedProps, type ExpandedState, type GetSearchItemProps, type Highlight, type HighlightRange, type HighlightRanges, IconButton, type Item, type ItemRef, LayoutProvider, type RefType, type Refs, type SBUI, type SearchChildrenFn, type SearchItem, type SearchResult, type SearchResultProps, type Selection, type Storage, StorageProvider, type StoryRef, createId, cycle, get, getAncestorIds, getDescendantIds, getParent, getParents, getPath, getStateType, intersect, isAncestor, isExpandType, isStoryHoistable, merge, noArrayMerge, prevent, removeNoiseFromName, searchItem, startCase, transformStoryIndexToStoriesHash, transformStoryIndexV2toV3, transformStoryIndexV3toV4, transformStoryIndexV4toV5, useExpanded, useLastViewed, useLayout, useStorage, useStoreBooleanState, useStoreNumberState, useStyle };
|
package/dist/index.js
CHANGED
|
@@ -53,6 +53,7 @@ __export(index_exports, {
|
|
|
53
53
|
prevent: () => prevent,
|
|
54
54
|
removeNoiseFromName: () => removeNoiseFromName,
|
|
55
55
|
searchItem: () => searchItem,
|
|
56
|
+
startCase: () => startCase,
|
|
56
57
|
transformStoryIndexToStoriesHash: () => transformStoryIndexToStoriesHash,
|
|
57
58
|
transformStoryIndexV2toV3: () => transformStoryIndexV2toV3,
|
|
58
59
|
transformStoryIndexV3toV4: () => transformStoryIndexV3toV4,
|
|
@@ -584,6 +585,24 @@ var useStyle = (styleFactory, deps) => (
|
|
|
584
585
|
(0, import_react5.useMemo)(styleFactory, deps)
|
|
585
586
|
);
|
|
586
587
|
|
|
588
|
+
// src/util/string.ts
|
|
589
|
+
var CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
590
|
+
function words(str) {
|
|
591
|
+
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
592
|
+
}
|
|
593
|
+
function startCase(str) {
|
|
594
|
+
const words$1 = words(str.trim());
|
|
595
|
+
let result = "";
|
|
596
|
+
for (let i = 0; i < words$1.length; i++) {
|
|
597
|
+
const word = words$1[i];
|
|
598
|
+
if (result) {
|
|
599
|
+
result += " ";
|
|
600
|
+
}
|
|
601
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
602
|
+
}
|
|
603
|
+
return result;
|
|
604
|
+
}
|
|
605
|
+
|
|
587
606
|
// src/hooks/useExpanded.ts
|
|
588
607
|
var import_react6 = require("react");
|
|
589
608
|
var initializeExpanded = ({
|
|
@@ -717,6 +736,7 @@ var useStoreNumberState = (key, defaultValue) => {
|
|
|
717
736
|
prevent,
|
|
718
737
|
removeNoiseFromName,
|
|
719
738
|
searchItem,
|
|
739
|
+
startCase,
|
|
720
740
|
transformStoryIndexToStoriesHash,
|
|
721
741
|
transformStoryIndexV2toV3,
|
|
722
742
|
transformStoryIndexV3toV4,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native-ui-common",
|
|
3
|
-
"version": "10.2.2-alpha.
|
|
3
|
+
"version": "10.2.2-alpha.5",
|
|
4
4
|
"description": "common ui components for react native storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@nozbe/microfuzz": "^1.0.0",
|
|
41
41
|
"@storybook/react": "^10.2.2",
|
|
42
|
-
"@storybook/react-native-theming": "^10.2.2-alpha.
|
|
42
|
+
"@storybook/react-native-theming": "^10.2.2-alpha.5",
|
|
43
43
|
"es-toolkit": "^1.41.0",
|
|
44
44
|
"memoizerific": "^1.11.3",
|
|
45
45
|
"ts-dedent": "^2.2.0"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "51485fba2ef3d8f323905bdbee0ad1828ce45eb4"
|
|
59
59
|
}
|
package/src/util/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// from estookit/string
|
|
2
|
+
const CASE_SPLIT_PATTERN =
|
|
3
|
+
/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
4
|
+
// from estookit/string
|
|
5
|
+
function words(str: string) {
|
|
6
|
+
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
7
|
+
}
|
|
8
|
+
// from estookit/string
|
|
9
|
+
export function startCase(str: string) {
|
|
10
|
+
const words$1 = words(str.trim());
|
|
11
|
+
let result = '';
|
|
12
|
+
for (let i = 0; i < words$1.length; i++) {
|
|
13
|
+
const word = words$1[i];
|
|
14
|
+
if (result) {
|
|
15
|
+
result += ' ';
|
|
16
|
+
}
|
|
17
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|