@fluentui/react-utilities 9.0.0-alpha.9 → 9.0.0-beta.4
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.json +1132 -1
- package/CHANGELOG.md +492 -2
- package/dist/react-utilities.d.ts +335 -67
- package/lib/compose/getSlots.d.ts +13 -4
- package/lib/compose/getSlots.js +44 -32
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.d.ts +1 -2
- package/lib/compose/index.js +2 -2
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/nullRender.js +1 -1
- package/lib/compose/nullRender.js.map +1 -1
- package/lib/compose/resolveShorthand.d.ts +12 -0
- package/lib/compose/resolveShorthand.js +31 -0
- package/lib/compose/resolveShorthand.js.map +1 -0
- package/lib/compose/types.d.ts +95 -21
- package/lib/compose/types.js +5 -0
- package/lib/compose/types.js.map +1 -1
- package/lib/hooks/index.d.ts +9 -1
- package/lib/hooks/index.js +9 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useBoolean.d.ts +2 -2
- package/lib/hooks/useBoolean.js +16 -11
- package/lib/hooks/useBoolean.js.map +1 -1
- package/lib/hooks/useConst.js +15 -12
- package/lib/hooks/useConst.js.map +1 -1
- package/lib/hooks/useControllableState.d.ts +21 -0
- package/lib/hooks/useControllableState.js +68 -0
- package/lib/hooks/useControllableState.js.map +1 -0
- package/lib/hooks/useControllableValue.js +47 -50
- package/lib/hooks/useControllableValue.js.map +1 -1
- package/lib/hooks/useEventCallback.d.ts +2 -2
- package/lib/hooks/useEventCallback.js +14 -17
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.d.ts +11 -0
- package/lib/hooks/useFirstMount.js +23 -0
- package/lib/hooks/useFirstMount.js.map +1 -0
- package/lib/hooks/useForceUpdate.d.ts +4 -0
- package/lib/hooks/useForceUpdate.js +9 -0
- package/lib/hooks/useForceUpdate.js.map +1 -0
- package/lib/hooks/useId.d.ts +7 -3
- package/lib/hooks/useId.js +13 -17
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.d.ts +9 -0
- package/lib/hooks/useIsomorphicLayoutEffect.js +13 -4
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +16 -20
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useMount.d.ts +6 -0
- package/lib/hooks/useMount.js +17 -0
- package/lib/hooks/useMount.js.map +1 -0
- package/lib/hooks/useOnClickOutside.d.ts +14 -4
- package/lib/hooks/useOnClickOutside.js +129 -18
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.d.ts +5 -0
- package/lib/hooks/useOnScrollOutside.js +36 -0
- package/lib/hooks/useOnScrollOutside.js.map +1 -0
- package/lib/hooks/usePrevious.d.ts +1 -0
- package/lib/hooks/usePrevious.js +9 -0
- package/lib/hooks/usePrevious.js.map +1 -0
- package/lib/hooks/useTimeout.d.ts +8 -0
- package/lib/hooks/useTimeout.js +29 -0
- package/lib/hooks/useTimeout.js.map +1 -0
- package/lib/hooks/useUnmount.d.ts +6 -0
- package/lib/hooks/useUnmount.js +17 -0
- package/lib/hooks/useUnmount.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.d.ts +33 -0
- package/lib/ssr/SSRContext.js +65 -0
- package/lib/ssr/SSRContext.js.map +1 -0
- package/lib/ssr/canUseDOM.d.ts +4 -0
- package/lib/ssr/canUseDOM.js +8 -0
- package/lib/ssr/canUseDOM.js.map +1 -0
- package/lib/ssr/index.d.ts +2 -0
- package/lib/ssr/index.js +3 -0
- package/lib/ssr/index.js.map +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/utils/applyTriggerPropsToChildren.d.ts +5 -0
- package/lib/utils/applyTriggerPropsToChildren.js +16 -0
- package/lib/utils/applyTriggerPropsToChildren.js.map +1 -0
- package/lib/utils/clamp.d.ts +8 -0
- package/lib/utils/clamp.js +9 -0
- package/lib/utils/clamp.js.map +1 -0
- package/lib/utils/getNativeElementProps.d.ts +22 -0
- package/lib/utils/getNativeElementProps.js +48 -24
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.d.ts +4 -0
- package/lib/utils/getRTLSafeKey.js +21 -0
- package/lib/utils/getRTLSafeKey.js.map +1 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +5 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/omit.d.ts +1 -1
- package/lib/utils/omit.js +9 -7
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/onlyChild.d.ts +5 -0
- package/lib/utils/onlyChild.js +13 -0
- package/lib/utils/onlyChild.js.map +1 -0
- package/lib/utils/properties.js +80 -282
- package/lib/utils/properties.js.map +1 -1
- package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
- package/lib/utils/shouldPreventDefaultOnKeyDown.js +20 -0
- package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
- package/lib-commonjs/compose/getSlots.d.ts +13 -4
- package/lib-commonjs/compose/getSlots.js +57 -35
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.d.ts +1 -2
- package/lib-commonjs/compose/index.js +12 -4
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/nullRender.js +9 -2
- package/lib-commonjs/compose/nullRender.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.d.ts +12 -0
- package/lib-commonjs/compose/resolveShorthand.js +41 -0
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -0
- package/lib-commonjs/compose/types.d.ts +95 -21
- package/lib-commonjs/compose/types.js +8 -1
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/hooks/index.d.ts +9 -1
- package/lib-commonjs/hooks/index.js +31 -4
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useBoolean.d.ts +2 -2
- package/lib-commonjs/hooks/useBoolean.js +27 -14
- package/lib-commonjs/hooks/useBoolean.js.map +1 -1
- package/lib-commonjs/hooks/useConst.js +24 -14
- package/lib-commonjs/hooks/useConst.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.d.ts +21 -0
- package/lib-commonjs/hooks/useControllableState.js +78 -0
- package/lib-commonjs/hooks/useControllableState.js.map +1 -0
- package/lib-commonjs/hooks/useControllableValue.js +58 -53
- package/lib-commonjs/hooks/useControllableValue.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.d.ts +2 -2
- package/lib-commonjs/hooks/useEventCallback.js +26 -20
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.d.ts +11 -0
- package/lib-commonjs/hooks/useFirstMount.js +33 -0
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -0
- package/lib-commonjs/hooks/useForceUpdate.d.ts +4 -0
- package/lib-commonjs/hooks/useForceUpdate.js +19 -0
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -0
- package/lib-commonjs/hooks/useId.d.ts +7 -3
- package/lib-commonjs/hooks/useId.js +25 -21
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +9 -0
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +22 -6
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +25 -22
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useMount.d.ts +6 -0
- package/lib-commonjs/hooks/useMount.js +27 -0
- package/lib-commonjs/hooks/useMount.js.map +1 -0
- package/lib-commonjs/hooks/useOnClickOutside.d.ts +14 -4
- package/lib-commonjs/hooks/useOnClickOutside.js +141 -21
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.d.ts +5 -0
- package/lib-commonjs/hooks/useOnScrollOutside.js +47 -0
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -0
- package/lib-commonjs/hooks/usePrevious.d.ts +1 -0
- package/lib-commonjs/hooks/usePrevious.js +19 -0
- package/lib-commonjs/hooks/usePrevious.js.map +1 -0
- package/lib-commonjs/hooks/useTimeout.d.ts +8 -0
- package/lib-commonjs/hooks/useTimeout.js +40 -0
- package/lib-commonjs/hooks/useTimeout.js.map +1 -0
- package/lib-commonjs/hooks/useUnmount.d.ts +6 -0
- package/lib-commonjs/hooks/useUnmount.js +27 -0
- package/lib-commonjs/hooks/useUnmount.js.map +1 -0
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.js +11 -2
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.d.ts +33 -0
- package/lib-commonjs/ssr/SSRContext.js +80 -0
- package/lib-commonjs/ssr/SSRContext.js.map +1 -0
- package/lib-commonjs/ssr/canUseDOM.d.ts +4 -0
- package/lib-commonjs/ssr/canUseDOM.js +17 -0
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -0
- package/lib-commonjs/ssr/index.d.ts +2 -0
- package/lib-commonjs/ssr/index.js +12 -0
- package/lib-commonjs/ssr/index.js.map +1 -0
- package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +5 -0
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js +27 -0
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -0
- package/lib-commonjs/utils/clamp.d.ts +8 -0
- package/lib-commonjs/utils/clamp.js +18 -0
- package/lib-commonjs/utils/clamp.js.map +1 -0
- package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
- package/lib-commonjs/utils/getNativeElementProps.js +58 -25
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.d.ts +4 -0
- package/lib-commonjs/utils/getRTLSafeKey.js +30 -0
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -0
- package/lib-commonjs/utils/index.d.ts +5 -0
- package/lib-commonjs/utils/index.js +19 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/omit.d.ts +1 -1
- package/lib-commonjs/utils/omit.js +16 -8
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/onlyChild.d.ts +5 -0
- package/lib-commonjs/utils/onlyChild.js +23 -0
- package/lib-commonjs/utils/onlyChild.js.map +1 -0
- package/lib-commonjs/utils/properties.js +84 -280
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +30 -0
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
- package/package.json +11 -9
- package/NOTICE.txt +0 -0
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -7
- package/etc/react-utilities.api.md +0 -207
- package/just.config.ts +0 -3
- package/lib/compose/makeMergeProps.d.ts +0 -15
- package/lib/compose/makeMergeProps.js +0 -96
- package/lib/compose/makeMergeProps.js.map +0 -1
- package/lib/compose/resolveShorthandProps.d.ts +0 -7
- package/lib/compose/resolveShorthandProps.js +0 -27
- package/lib/compose/resolveShorthandProps.js.map +0 -1
- package/lib-amd/compose/getSlots.d.ts +0 -20
- package/lib-amd/compose/getSlots.js +0 -51
- package/lib-amd/compose/getSlots.js.map +0 -1
- package/lib-amd/compose/index.d.ts +0 -5
- package/lib-amd/compose/index.js +0 -9
- package/lib-amd/compose/index.js.map +0 -1
- package/lib-amd/compose/makeMergeProps.d.ts +0 -15
- package/lib-amd/compose/makeMergeProps.js +0 -98
- package/lib-amd/compose/makeMergeProps.js.map +0 -1
- package/lib-amd/compose/nullRender.d.ts +0 -4
- package/lib-amd/compose/nullRender.js +0 -9
- package/lib-amd/compose/nullRender.js.map +0 -1
- package/lib-amd/compose/resolveShorthandProps.d.ts +0 -7
- package/lib-amd/compose/resolveShorthandProps.js +0 -29
- package/lib-amd/compose/resolveShorthandProps.js.map +0 -1
- package/lib-amd/compose/types.d.ts +0 -29
- package/lib-amd/compose/types.js +0 -5
- package/lib-amd/compose/types.js.map +0 -1
- package/lib-amd/hooks/index.d.ts +0 -8
- package/lib-amd/hooks/index.js +0 -13
- package/lib-amd/hooks/index.js.map +0 -1
- package/lib-amd/hooks/useBoolean.d.ts +0 -17
- package/lib-amd/hooks/useBoolean.js +0 -26
- package/lib-amd/hooks/useBoolean.js.map +0 -1
- package/lib-amd/hooks/useConst.d.ts +0 -12
- package/lib-amd/hooks/useConst.js +0 -31
- package/lib-amd/hooks/useConst.js.map +0 -1
- package/lib-amd/hooks/useControllableValue.d.ts +0 -20
- package/lib-amd/hooks/useControllableValue.js +0 -42
- package/lib-amd/hooks/useControllableValue.js.map +0 -1
- package/lib-amd/hooks/useEventCallback.d.ts +0 -13
- package/lib-amd/hooks/useEventCallback.js +0 -33
- package/lib-amd/hooks/useEventCallback.js.map +0 -1
- package/lib-amd/hooks/useId.d.ts +0 -11
- package/lib-amd/hooks/useId.js +0 -35
- package/lib-amd/hooks/useId.js.map +0 -1
- package/lib-amd/hooks/useIsomorphicLayoutEffect.d.ts +0 -2
- package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -9
- package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
- package/lib-amd/hooks/useMergedRefs.d.ts +0 -13
- package/lib-amd/hooks/useMergedRefs.js +0 -33
- package/lib-amd/hooks/useMergedRefs.js.map +0 -1
- package/lib-amd/hooks/useOnClickOutside.d.ts +0 -19
- package/lib-amd/hooks/useOnClickOutside.js +0 -27
- package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
- package/lib-amd/index.d.ts +0 -3
- package/lib-amd/index.js +0 -8
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/utils/getNativeElementProps.d.ts +0 -9
- package/lib-amd/utils/getNativeElementProps.js +0 -40
- package/lib-amd/utils/getNativeElementProps.js.map +0 -1
- package/lib-amd/utils/index.d.ts +0 -3
- package/lib-amd/utils/index.js +0 -8
- package/lib-amd/utils/index.js.map +0 -1
- package/lib-amd/utils/omit.d.ts +0 -14
- package/lib-amd/utils/omit.js +0 -30
- package/lib-amd/utils/omit.js.map +0 -1
- package/lib-amd/utils/properties.d.ts +0 -148
- package/lib-amd/utils/properties.js +0 -416
- package/lib-amd/utils/properties.js.map +0 -1
- package/lib-commonjs/compose/makeMergeProps.d.ts +0 -15
- package/lib-commonjs/compose/makeMergeProps.js +0 -98
- package/lib-commonjs/compose/makeMergeProps.js.map +0 -1
- package/lib-commonjs/compose/resolveShorthandProps.d.ts +0 -7
- package/lib-commonjs/compose/resolveShorthandProps.js +0 -29
- package/lib-commonjs/compose/resolveShorthandProps.js.map +0 -1
- package/src/compose/README.md +0 -279
package/config/tests.js
DELETED
@@ -1,207 +0,0 @@
|
|
1
|
-
## API Report File for "@fluentui/react-utilities"
|
2
|
-
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
4
|
-
|
5
|
-
```ts
|
6
|
-
|
7
|
-
import * as React from 'react';
|
8
|
-
|
9
|
-
// @public
|
10
|
-
export const anchorProperties: Record<string, number>;
|
11
|
-
|
12
|
-
// @public
|
13
|
-
export const audioProperties: Record<string, number>;
|
14
|
-
|
15
|
-
// @public
|
16
|
-
export const baseElementEvents: Record<string, number>;
|
17
|
-
|
18
|
-
// @public
|
19
|
-
export const baseElementProperties: Record<string, number>;
|
20
|
-
|
21
|
-
// @public (undocumented)
|
22
|
-
export interface BaseSlots {
|
23
|
-
// (undocumented)
|
24
|
-
root: React.ElementType;
|
25
|
-
}
|
26
|
-
|
27
|
-
// @public
|
28
|
-
export const buttonProperties: Record<string, number>;
|
29
|
-
|
30
|
-
// @public (undocumented)
|
31
|
-
export type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void;
|
32
|
-
|
33
|
-
// @public
|
34
|
-
export type ClassDictionary = Record<string, string>;
|
35
|
-
|
36
|
-
// @public (undocumented)
|
37
|
-
export const colGroupProperties: Record<string, number>;
|
38
|
-
|
39
|
-
// @public (undocumented)
|
40
|
-
export const colProperties: Record<string, number>;
|
41
|
-
|
42
|
-
// @public (undocumented)
|
43
|
-
export interface ComponentProps {
|
44
|
-
// (undocumented)
|
45
|
-
as?: React.ElementType;
|
46
|
-
// (undocumented)
|
47
|
-
children?: React.ReactNode;
|
48
|
-
// (undocumented)
|
49
|
-
className?: string;
|
50
|
-
}
|
51
|
-
|
52
|
-
// @public
|
53
|
-
export const divProperties: Record<string, number>;
|
54
|
-
|
55
|
-
// @public
|
56
|
-
export const formProperties: Record<string, number>;
|
57
|
-
|
58
|
-
// @public
|
59
|
-
export type GenericDictionary = Record<string, any>;
|
60
|
-
|
61
|
-
// @public
|
62
|
-
export function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
|
63
|
-
|
64
|
-
// @public
|
65
|
-
export function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;
|
66
|
-
|
67
|
-
// @public
|
68
|
-
export const getSlots: (state: Record<string, any>, slotNames?: string[] | undefined) => {
|
69
|
-
slots: Record<string, any>;
|
70
|
-
slotProps: Record<string, any>;
|
71
|
-
};
|
72
|
-
|
73
|
-
// @public
|
74
|
-
export const htmlElementProperties: Record<string, number>;
|
75
|
-
|
76
|
-
// @public
|
77
|
-
export const iframeProperties: Record<string, number>;
|
78
|
-
|
79
|
-
// @public @deprecated (undocumented)
|
80
|
-
export const imageProperties: Record<string, number>;
|
81
|
-
|
82
|
-
// @public
|
83
|
-
export const imgProperties: Record<string, number>;
|
84
|
-
|
85
|
-
// @public
|
86
|
-
export const inputProperties: Record<string, number>;
|
87
|
-
|
88
|
-
// @public
|
89
|
-
export const labelProperties: Record<string, number>;
|
90
|
-
|
91
|
-
// @public
|
92
|
-
export const liProperties: Record<string, number>;
|
93
|
-
|
94
|
-
// @public
|
95
|
-
export const makeMergeProps: <TState = Record<string, any>>(options?: MergePropsOptions) => (target: Record<string, any>, ...propSets: (Record<string, any> | undefined)[]) => TState;
|
96
|
-
|
97
|
-
// @public (undocumented)
|
98
|
-
export type MergePropsOptions = {
|
99
|
-
deepMerge?: string[];
|
100
|
-
};
|
101
|
-
|
102
|
-
// @public
|
103
|
-
export const nullRender: () => null;
|
104
|
-
|
105
|
-
// @public (undocumented)
|
106
|
-
export type ObjectShorthandProps<TProps extends ComponentProps = {}> = TProps & {
|
107
|
-
children?: TProps['children'] | ShorthandRenderFunction<TProps>;
|
108
|
-
};
|
109
|
-
|
110
|
-
// @public
|
111
|
-
export const olProperties: Record<string, number>;
|
112
|
-
|
113
|
-
// @public
|
114
|
-
export function omit<TObj extends Record<string, any>>(obj: TObj, exclusions: (keyof TObj)[]): TObj;
|
115
|
-
|
116
|
-
// @public (undocumented)
|
117
|
-
export const optionProperties: Record<string, number>;
|
118
|
-
|
119
|
-
// @public
|
120
|
-
export type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);
|
121
|
-
|
122
|
-
// @public
|
123
|
-
export const resolveShorthandProps: <TProps>(props: TProps, shorthandPropNames: string[]) => TProps;
|
124
|
-
|
125
|
-
// @public
|
126
|
-
export const selectProperties: Record<string, number>;
|
127
|
-
|
128
|
-
// @public (undocumented)
|
129
|
-
export type ShorthandProps<TProps extends ComponentProps = {}> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | boolean | number | null | undefined | (TProps & ComponentProps & {
|
130
|
-
children?: TProps['children'] | ShorthandRenderFunction<TProps>;
|
131
|
-
});
|
132
|
-
|
133
|
-
// @public (undocumented)
|
134
|
-
export type ShorthandRenderFunction<TProps> = (Component: React.ElementType<TProps>, props: TProps) => React.ReactNode;
|
135
|
-
|
136
|
-
// @public (undocumented)
|
137
|
-
export type SlotProps<TSlots extends BaseSlots, TProps, TRootProps extends React.HTMLAttributes<HTMLElement>> = {
|
138
|
-
[key in keyof Omit<TSlots, 'root'>]: key extends keyof TProps ? TProps[key] : any;
|
139
|
-
} & {
|
140
|
-
root: TRootProps;
|
141
|
-
};
|
142
|
-
|
143
|
-
// @public
|
144
|
-
export const tableProperties: Record<string, number>;
|
145
|
-
|
146
|
-
// @public
|
147
|
-
export const tdProperties: Record<string, number>;
|
148
|
-
|
149
|
-
// @public
|
150
|
-
export const textAreaProperties: Record<string, number>;
|
151
|
-
|
152
|
-
// @public
|
153
|
-
export const thProperties: Record<string, number>;
|
154
|
-
|
155
|
-
// @public
|
156
|
-
export const trProperties: Record<string, number>;
|
157
|
-
|
158
|
-
// @public
|
159
|
-
export function useBoolean(initialState: boolean): [boolean, UseBooleanCallbacks];
|
160
|
-
|
161
|
-
// @public
|
162
|
-
export interface UseBooleanCallbacks {
|
163
|
-
setFalse: () => void;
|
164
|
-
setTrue: () => void;
|
165
|
-
toggle: () => void;
|
166
|
-
}
|
167
|
-
|
168
|
-
// @public
|
169
|
-
export function useConst<T>(initialValue: T | (() => T)): T;
|
170
|
-
|
171
|
-
// Warning: (ae-forgotten-export) The symbol "DefaultValue" needs to be exported by the entry point index.d.ts
|
172
|
-
//
|
173
|
-
// @public
|
174
|
-
export function useControllableValue<TValue, TElement extends HTMLElement>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>): Readonly<[TValue, (update: React.SetStateAction<TValue>) => void]>;
|
175
|
-
|
176
|
-
// @public (undocumented)
|
177
|
-
export function useControllableValue<TValue, TElement extends HTMLElement, TEvent extends React.SyntheticEvent<TElement> | undefined>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>, onChange: ChangeCallback<TElement, TValue, TEvent>): Readonly<[TValue, (update: React.SetStateAction<TValue>, ev?: React.FormEvent<TElement>) => void]>;
|
178
|
-
|
179
|
-
// @public
|
180
|
-
export const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return;
|
181
|
-
|
182
|
-
// @public
|
183
|
-
export function useId(prefix?: string, providedId?: string): string;
|
184
|
-
|
185
|
-
// @public (undocumented)
|
186
|
-
export const useIsomorphicLayoutEffect: typeof React.useEffect;
|
187
|
-
|
188
|
-
// @public
|
189
|
-
export function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T>;
|
190
|
-
|
191
|
-
// @public
|
192
|
-
export const useOnClickOutside: (options: UseOnClickOutsideOptions) => void;
|
193
|
-
|
194
|
-
// @public (undocumented)
|
195
|
-
export type UseOnClickOutsideOptions = {
|
196
|
-
element?: Document;
|
197
|
-
refs: React.MutableRefObject<HTMLElement | undefined | null>[];
|
198
|
-
callback: (ev: MouseEvent | TouchEvent) => void;
|
199
|
-
};
|
200
|
-
|
201
|
-
// @public
|
202
|
-
export const videoProperties: Record<string, number>;
|
203
|
-
|
204
|
-
|
205
|
-
// (No @packageDocumentation comment for this package)
|
206
|
-
|
207
|
-
```
|
package/just.config.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
export declare type MergePropsOptions = {
|
2
|
-
/**
|
3
|
-
* A list of props to deep merge. By default, `style` will
|
4
|
-
* always be deep merged so it's not required to be provided.
|
5
|
-
*/
|
6
|
-
deepMerge?: string[];
|
7
|
-
};
|
8
|
-
/**
|
9
|
-
* Helper which deep clones props, but respectively assigns JSX, object refs, and class names
|
10
|
-
* appropriately.
|
11
|
-
*
|
12
|
-
* @param target - the target object to merge onto.
|
13
|
-
* @param propSets - one or more prop sets to deep merge onto the target.
|
14
|
-
*/
|
15
|
-
export declare const makeMergeProps: <TState = Record<string, any>>(options?: MergePropsOptions) => (target: Record<string, any>, ...propSets: (Record<string, any> | undefined)[]) => TState;
|
@@ -1,96 +0,0 @@
|
|
1
|
-
import { __spreadArrays } from "tslib";
|
2
|
-
import * as React from 'react';
|
3
|
-
/**
|
4
|
-
* Concatination helper, which can merge class names together. Skips over falsey values.
|
5
|
-
*
|
6
|
-
* @public
|
7
|
-
*/
|
8
|
-
function css() {
|
9
|
-
var args = [];
|
10
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
11
|
-
args[_i] = arguments[_i];
|
12
|
-
}
|
13
|
-
var classes = [];
|
14
|
-
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
|
15
|
-
var arg = args_1[_a];
|
16
|
-
if (arg) {
|
17
|
-
if (typeof arg === 'string') {
|
18
|
-
classes.push(arg);
|
19
|
-
}
|
20
|
-
else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {
|
21
|
-
classes.push(arg.toString());
|
22
|
-
}
|
23
|
-
else {
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
25
|
-
for (var key in arg) {
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
27
|
-
if (arg[key]) {
|
28
|
-
classes.push(key);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
return classes.join(' ');
|
35
|
-
}
|
36
|
-
/**
|
37
|
-
* Helper which deep clones props, but respectively assigns JSX, object refs, and class names
|
38
|
-
* appropriately.
|
39
|
-
*
|
40
|
-
* @param target - the target object to merge onto.
|
41
|
-
* @param propSets - one or more prop sets to deep merge onto the target.
|
42
|
-
*/
|
43
|
-
export var makeMergeProps = function (options) {
|
44
|
-
if (options === void 0) { options = {}; }
|
45
|
-
var deepMerge = __spreadArrays((options.deepMerge || []), ['style']);
|
46
|
-
var mergeProps = function (target) {
|
47
|
-
var propSets = [];
|
48
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
49
|
-
propSets[_i - 1] = arguments[_i];
|
50
|
-
}
|
51
|
-
for (var _a = 0, propSets_1 = propSets; _a < propSets_1.length; _a++) {
|
52
|
-
var props = propSets_1[_a];
|
53
|
-
if (props) {
|
54
|
-
for (var _b = 0, _c = Object.keys(props); _b < _c.length; _b++) {
|
55
|
-
var propName = _c[_b];
|
56
|
-
var propValue = props[propName];
|
57
|
-
var propValueType = typeof propValue;
|
58
|
-
if (propValue !== undefined) {
|
59
|
-
if (propValue && propValueType === 'object') {
|
60
|
-
if (Array.isArray(propValue)) {
|
61
|
-
// for arrays, replace.
|
62
|
-
target[propName] = propValue;
|
63
|
-
}
|
64
|
-
else {
|
65
|
-
target[propName] = target[propName] || {};
|
66
|
-
if (typeof target[propName] !== 'object' ||
|
67
|
-
React.isValidElement(propValue) ||
|
68
|
-
(propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||
|
69
|
-
deepMerge.indexOf(propName) === -1) {
|
70
|
-
// if target is not an object, or value is JSX, or a ref object, replace
|
71
|
-
target[propName] = propValue;
|
72
|
-
}
|
73
|
-
else {
|
74
|
-
// else deep merge.
|
75
|
-
mergeProps(target[propName], propValue);
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
else if (propName === 'className') {
|
80
|
-
if (propValue) {
|
81
|
-
// for classnames, append
|
82
|
-
target[propName] = css(target[propName], propValue);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
target[propName] = propValue;
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return target;
|
93
|
-
};
|
94
|
-
return mergeProps;
|
95
|
-
};
|
96
|
-
//# sourceMappingURL=makeMergeProps.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"makeMergeProps.js","sourceRoot":"../src/","sources":["compose/makeMergeProps.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiC/B;;;;GAIG;AACH,SAAS,GAAG;IAAC,cAAmB;SAAnB,UAAmB,EAAnB,qBAAmB,EAAnB,IAAmB;QAAnB,yBAAmB;;IAC9B,IAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAA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AAG,OAAO,SAAS,CAAC;oBAEvC,IAAI,SAAS,KAAK,SAAS,EAAE;wBAC3B,IAAI,SAAS,IAAI,aAAa,KAAK,QAAQ,EAAE;4BAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;gCAC5B,uBAAuB;gCACvB,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;6BAC9B;iCAAM;gCACL,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gCAE1C,IACE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ;oCACpC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC;oCAC/B,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;oCACnF,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAClC;oCACA,yEAAyE;oCACzE,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;iCAC9B;qCAAM;oCACL,mBAAmB;oCACnB,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;iCACzC;6BACF;yBACF;6BAAM,IAAI,QAAQ,KAAK,WAAW,EAAE;4BACnC,IAAI,SAAS,EAAE;gCACb,yBAAyB;gCACzB,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;6BACrD;yBACF;6BAAM;4BACL,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;yBAC9B;qBACF;iBACF;aACF;SACF;QACD,OAAO,MAAgB,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { GenericDictionary } from './types';\n\n// TODO\n// css() function is temporary there, ax() should be used instead, but it's not possible now due possible\n// circular dependencies\n\n/**\n * Dictionary of booleans.\n *\n * @internal\n */\ninterface Dictionary {\n [className: string]: boolean;\n}\n\n/**\n * Serializable object.\n *\n * @internal\n */\ninterface SerializableObject {\n toString?: () => string;\n}\n\n/**\n * css input type.\n *\n * @internal\n */\ntype CssInput = string | SerializableObject | Dictionary | null | undefined | boolean;\n\n/**\n * Concatination helper, which can merge class names together. Skips over falsey values.\n *\n * @public\n */\nfunction css(...args: CssInput[]): string {\n const classes = [];\n\n for (const arg of args) {\n if (arg) {\n if (typeof arg === 'string') {\n classes.push(arg);\n } else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {\n classes.push(arg.toString());\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const key in arg as any) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((arg as any)[key]) {\n classes.push(key);\n }\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n\nexport type MergePropsOptions = {\n /**\n * A list of props to deep merge. By default, `style` will\n * always be deep merged so it's not required to be provided.\n */\n deepMerge?: string[];\n};\n\n/**\n * Helper which deep clones props, but respectively assigns JSX, object refs, and class names\n * appropriately.\n *\n * @param target - the target object to merge onto.\n * @param propSets - one or more prop sets to deep merge onto the target.\n */\nexport const makeMergeProps = <TState = GenericDictionary>(options: MergePropsOptions = {}) => {\n const deepMerge = [...(options.deepMerge || []), 'style'];\n\n const mergeProps = (target: GenericDictionary, ...propSets: (GenericDictionary | undefined)[]): TState => {\n for (const props of propSets) {\n if (props) {\n for (const propName of Object.keys(props)) {\n const propValue = props[propName];\n const propValueType = typeof propValue;\n\n if (propValue !== undefined) {\n if (propValue && propValueType === 'object') {\n if (Array.isArray(propValue)) {\n // for arrays, replace.\n target[propName] = propValue;\n } else {\n target[propName] = target[propName] || {};\n\n if (\n typeof target[propName] !== 'object' ||\n React.isValidElement(propValue) ||\n (propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||\n deepMerge.indexOf(propName) === -1\n ) {\n // if target is not an object, or value is JSX, or a ref object, replace\n target[propName] = propValue;\n } else {\n // else deep merge.\n mergeProps(target[propName], propValue);\n }\n }\n } else if (propName === 'className') {\n if (propValue) {\n // for classnames, append\n target[propName] = css(target[propName], propValue);\n }\n } else {\n target[propName] = propValue;\n }\n }\n }\n }\n }\n return target as TState;\n };\n\n return mergeProps;\n};\n"]}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Ensures that the given slots are represented using object syntax. This ensures that
|
3
|
-
* the object can be merged along with other objects.
|
4
|
-
* @param props - The incoming props
|
5
|
-
* @param shorthandPropNames - An array of prop names to apply simplification to
|
6
|
-
*/
|
7
|
-
export declare const resolveShorthandProps: <TProps>(props: TProps, shorthandPropNames: string[]) => TProps;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
|
-
import * as React from 'react';
|
3
|
-
/**
|
4
|
-
* Ensures that the given slots are represented using object syntax. This ensures that
|
5
|
-
* the object can be merged along with other objects.
|
6
|
-
* @param props - The incoming props
|
7
|
-
* @param shorthandPropNames - An array of prop names to apply simplification to
|
8
|
-
*/
|
9
|
-
export var resolveShorthandProps = function (props, shorthandPropNames) {
|
10
|
-
var newProps = props;
|
11
|
-
if (shorthandPropNames && shorthandPropNames.length) {
|
12
|
-
newProps = __assign({}, props);
|
13
|
-
for (var _i = 0, shorthandPropNames_1 = shorthandPropNames; _i < shorthandPropNames_1.length; _i++) {
|
14
|
-
var propName = shorthandPropNames_1[_i];
|
15
|
-
// TODO find clean way of guaranteeing only shorthand props are typechecked
|
16
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
17
|
-
// @ts-ignore
|
18
|
-
var propValue = props[propName];
|
19
|
-
if (propValue !== undefined && (typeof propValue !== 'object' || React.isValidElement(propValue))) {
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
21
|
-
newProps[propName] = { children: propValue };
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
return newProps;
|
26
|
-
};
|
27
|
-
//# sourceMappingURL=resolveShorthandProps.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"resolveShorthandProps.js","sourceRoot":"../src/","sources":["compose/resolveShorthandProps.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAU,KAAa,EAAE,kBAA4B;IACxF,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,EAAE;QACnD,QAAQ,gBACH,KAAK,CACT,CAAC;QACF,KAAuB,UAAkB,EAAlB,yCAAkB,EAAlB,gCAAkB,EAAlB,IAAkB,EAAE;YAAtC,IAAM,QAAQ,2BAAA;YACjB,2EAA2E;YAC3E,6DAA6D;YAC7D,aAAa;YACb,IAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;YAElC,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,OAAO,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE;gBACjG,8DAA8D;gBAC7D,QAAgB,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;aACvD;SACF;KACF;IAED,OAAO,QAAkB,CAAC;AAC5B,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * Ensures that the given slots are represented using object syntax. This ensures that\n * the object can be merged along with other objects.\n * @param props - The incoming props\n * @param shorthandPropNames - An array of prop names to apply simplification to\n */\nexport const resolveShorthandProps = <TProps,>(props: TProps, shorthandPropNames: string[]) => {\n let newProps = props;\n\n if (shorthandPropNames && shorthandPropNames.length) {\n newProps = {\n ...props,\n };\n for (const propName of shorthandPropNames) {\n // TODO find clean way of guaranteeing only shorthand props are typechecked\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const propValue = props[propName];\n\n if (propValue !== undefined && (typeof propValue !== 'object' || React.isValidElement(propValue))) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (newProps as any)[propName] = { children: propValue };\n }\n }\n }\n\n return newProps as TProps;\n};\n"]}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Given the state and an array of slot names, will break out `slots` and `slotProps`
|
3
|
-
* collections.
|
4
|
-
*
|
5
|
-
* The root is always derived from the `as` prop.
|
6
|
-
*
|
7
|
-
* Slots will render as null if they are rendered as primitives with undefined children.
|
8
|
-
*
|
9
|
-
* The slotProps will always omit the `as` prop within them, and for slots that are string
|
10
|
-
* primitives, the props will be filtered according the the slot type. For example, if the
|
11
|
-
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
|
12
|
-
*
|
13
|
-
* @param state - State including slot definitions
|
14
|
-
* @param slotNames - Name of which props are slots
|
15
|
-
* @returns An object containing the `slots` map and `slotProps` map.
|
16
|
-
*/
|
17
|
-
export declare const getSlots: (state: Record<string, any>, slotNames?: string[] | undefined) => {
|
18
|
-
slots: Record<string, any>;
|
19
|
-
slotProps: Record<string, any>;
|
20
|
-
};
|
@@ -1,51 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react", "../utils/index", "./nullRender"], function (require, exports, React, index_1, nullRender_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
/**
|
5
|
-
* Given the state and an array of slot names, will break out `slots` and `slotProps`
|
6
|
-
* collections.
|
7
|
-
*
|
8
|
-
* The root is always derived from the `as` prop.
|
9
|
-
*
|
10
|
-
* Slots will render as null if they are rendered as primitives with undefined children.
|
11
|
-
*
|
12
|
-
* The slotProps will always omit the `as` prop within them, and for slots that are string
|
13
|
-
* primitives, the props will be filtered according the the slot type. For example, if the
|
14
|
-
* slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
|
15
|
-
*
|
16
|
-
* @param state - State including slot definitions
|
17
|
-
* @param slotNames - Name of which props are slots
|
18
|
-
* @returns An object containing the `slots` map and `slotProps` map.
|
19
|
-
*/
|
20
|
-
exports.getSlots = function (state, slotNames) {
|
21
|
-
var slots = {
|
22
|
-
root: state.as || 'div',
|
23
|
-
};
|
24
|
-
var slotProps = {
|
25
|
-
root: typeof slots.root === 'string' ? index_1.getNativeElementProps(slots.root, state) : index_1.omit(state, ['as']),
|
26
|
-
};
|
27
|
-
if (slotNames) {
|
28
|
-
for (var _i = 0, slotNames_1 = slotNames; _i < slotNames_1.length; _i++) {
|
29
|
-
var name_1 = slotNames_1[_i];
|
30
|
-
var slotDefinition = state[name_1] || {};
|
31
|
-
var _a = slotDefinition.as, slotAs = _a === void 0 ? 'span' : _a, children = slotDefinition.children;
|
32
|
-
var isSlotPrimitive = typeof slotAs === 'string';
|
33
|
-
var isSlotEmpty = isSlotPrimitive && slotDefinition.children === undefined;
|
34
|
-
slots[name_1] = isSlotEmpty ? nullRender_1.nullRender : slotAs;
|
35
|
-
if (typeof children === 'function') {
|
36
|
-
slotProps[name_1] = {
|
37
|
-
children: children(slots[name_1], index_1.omit(slotDefinition, ['as', 'children'])),
|
38
|
-
};
|
39
|
-
slots[name_1] = React.Fragment;
|
40
|
-
}
|
41
|
-
else if (slots[name_1] !== nullRender_1.nullRender) {
|
42
|
-
slotProps[name_1] = isSlotPrimitive
|
43
|
-
? index_1.getNativeElementProps(slotAs, slotDefinition)
|
44
|
-
: index_1.omit(slotDefinition, ['as']);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
48
|
-
return { slots: slots, slotProps: slotProps };
|
49
|
-
};
|
50
|
-
});
|
51
|
-
//# sourceMappingURL=getSlots.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getSlots.js","sourceRoot":"../src/","sources":["compose/getSlots.ts"],"names":[],"mappings":";;;IAMA;;;;;;;;;;;;;;;OAeG;IACU,QAAA,QAAQ,GAAG,UAAC,KAAwB,EAAE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AAE,cAAc,CAAC;wBAC/C,CAAC,CAAC,YAAI,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;iBAClC;aACF;SACF;QAED,OAAO,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAC9B,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { getNativeElementProps, omit } from '../utils/index';\nimport { GenericDictionary } from './types';\nimport { nullRender } from './nullRender';\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is always derived from the `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according the the slot type. For example, if the\n * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.\n *\n * @param state - State including slot definitions\n * @param slotNames - Name of which props are slots\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport const getSlots = (state: GenericDictionary, slotNames?: string[] | undefined) => {\n const slots: GenericDictionary = {\n root: state.as || 'div',\n };\n\n const slotProps: GenericDictionary = {\n root: typeof slots.root === 'string' ? getNativeElementProps(slots.root, state) : omit(state, ['as']),\n };\n\n if (slotNames) {\n for (const name of slotNames) {\n const slotDefinition = state[name] || {};\n const { as: slotAs = 'span', children } = slotDefinition;\n const isSlotPrimitive = typeof slotAs === 'string';\n const isSlotEmpty = isSlotPrimitive && slotDefinition.children === undefined;\n\n slots[name] = isSlotEmpty ? nullRender : slotAs;\n\n if (typeof children === 'function') {\n slotProps[name] = {\n children: children(slots[name], omit(slotDefinition, ['as', 'children'])),\n };\n slots[name] = React.Fragment;\n } else if (slots[name] !== nullRender) {\n slotProps[name] = isSlotPrimitive\n ? getNativeElementProps(slotAs, slotDefinition)\n : omit(slotDefinition, ['as']);\n }\n }\n }\n\n return { slots, slotProps };\n};\n"]}
|
package/lib-amd/compose/index.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./getSlots", "./makeMergeProps", "./nullRender", "./resolveShorthandProps"], function (require, exports, tslib_1, getSlots_1, makeMergeProps_1, nullRender_1, resolveShorthandProps_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
tslib_1.__exportStar(getSlots_1, exports);
|
5
|
-
tslib_1.__exportStar(makeMergeProps_1, exports);
|
6
|
-
tslib_1.__exportStar(nullRender_1, exports);
|
7
|
-
tslib_1.__exportStar(resolveShorthandProps_1, exports);
|
8
|
-
});
|
9
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["compose/index.ts"],"names":[],"mappings":";;;IAAA,0CAA2B;IAC3B,gDAAiC;IACjC,4CAA6B;IAC7B,uDAAwC","sourcesContent":["export * from './getSlots';\nexport * from './makeMergeProps';\nexport * from './nullRender';\nexport * from './resolveShorthandProps';\nexport * from './types';\n"]}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
export declare type MergePropsOptions = {
|
2
|
-
/**
|
3
|
-
* A list of props to deep merge. By default, `style` will
|
4
|
-
* always be deep merged so it's not required to be provided.
|
5
|
-
*/
|
6
|
-
deepMerge?: string[];
|
7
|
-
};
|
8
|
-
/**
|
9
|
-
* Helper which deep clones props, but respectively assigns JSX, object refs, and class names
|
10
|
-
* appropriately.
|
11
|
-
*
|
12
|
-
* @param target - the target object to merge onto.
|
13
|
-
* @param propSets - one or more prop sets to deep merge onto the target.
|
14
|
-
*/
|
15
|
-
export declare const makeMergeProps: <TState = Record<string, any>>(options?: MergePropsOptions) => (target: Record<string, any>, ...propSets: (Record<string, any> | undefined)[]) => TState;
|
@@ -1,98 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "react"], function (require, exports, tslib_1, React) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
/**
|
5
|
-
* Concatination helper, which can merge class names together. Skips over falsey values.
|
6
|
-
*
|
7
|
-
* @public
|
8
|
-
*/
|
9
|
-
function css() {
|
10
|
-
var args = [];
|
11
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
12
|
-
args[_i] = arguments[_i];
|
13
|
-
}
|
14
|
-
var classes = [];
|
15
|
-
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
|
16
|
-
var arg = args_1[_a];
|
17
|
-
if (arg) {
|
18
|
-
if (typeof arg === 'string') {
|
19
|
-
classes.push(arg);
|
20
|
-
}
|
21
|
-
else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {
|
22
|
-
classes.push(arg.toString());
|
23
|
-
}
|
24
|
-
else {
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
26
|
-
for (var key in arg) {
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
28
|
-
if (arg[key]) {
|
29
|
-
classes.push(key);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
return classes.join(' ');
|
36
|
-
}
|
37
|
-
/**
|
38
|
-
* Helper which deep clones props, but respectively assigns JSX, object refs, and class names
|
39
|
-
* appropriately.
|
40
|
-
*
|
41
|
-
* @param target - the target object to merge onto.
|
42
|
-
* @param propSets - one or more prop sets to deep merge onto the target.
|
43
|
-
*/
|
44
|
-
exports.makeMergeProps = function (options) {
|
45
|
-
if (options === void 0) { options = {}; }
|
46
|
-
var deepMerge = tslib_1.__spreadArrays((options.deepMerge || []), ['style']);
|
47
|
-
var mergeProps = function (target) {
|
48
|
-
var propSets = [];
|
49
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
50
|
-
propSets[_i - 1] = arguments[_i];
|
51
|
-
}
|
52
|
-
for (var _a = 0, propSets_1 = propSets; _a < propSets_1.length; _a++) {
|
53
|
-
var props = propSets_1[_a];
|
54
|
-
if (props) {
|
55
|
-
for (var _b = 0, _c = Object.keys(props); _b < _c.length; _b++) {
|
56
|
-
var propName = _c[_b];
|
57
|
-
var propValue = props[propName];
|
58
|
-
var propValueType = typeof propValue;
|
59
|
-
if (propValue !== undefined) {
|
60
|
-
if (propValue && propValueType === 'object') {
|
61
|
-
if (Array.isArray(propValue)) {
|
62
|
-
// for arrays, replace.
|
63
|
-
target[propName] = propValue;
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
target[propName] = target[propName] || {};
|
67
|
-
if (typeof target[propName] !== 'object' ||
|
68
|
-
React.isValidElement(propValue) ||
|
69
|
-
(propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||
|
70
|
-
deepMerge.indexOf(propName) === -1) {
|
71
|
-
// if target is not an object, or value is JSX, or a ref object, replace
|
72
|
-
target[propName] = propValue;
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
// else deep merge.
|
76
|
-
mergeProps(target[propName], propValue);
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
else if (propName === 'className') {
|
81
|
-
if (propValue) {
|
82
|
-
// for classnames, append
|
83
|
-
target[propName] = css(target[propName], propValue);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
else {
|
87
|
-
target[propName] = propValue;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}
|
93
|
-
return target;
|
94
|
-
};
|
95
|
-
return mergeProps;
|
96
|
-
};
|
97
|
-
});
|
98
|
-
//# sourceMappingURL=makeMergeProps.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"makeMergeProps.js","sourceRoot":"../src/","sources":["compose/makeMergeProps.ts"],"names":[],"mappings":";;;IAiCA;;;;OAIG;IACH,SAAS,GAAG;QAAC,cAAmB;aAAnB,UAAmB,EAAnB,qBAAmB,EAAnB,IAAmB;YAAnB,yBAAmB;;QAC9B,IAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAnB,IAAM,GAAG,aAAA;YACZ,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,KAAK,SAAS,EAAE;4BAC3B,IAAI,SAAS,IAAI,aAAa,KAAK,QAAQ,EAAE;gCAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;oCAC5B,uBAAuB;oCACvB,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;iCAC9B;qCAAM;oCACL,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;oCAE1C,IACE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ;wCACpC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC;wCAC/B,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;wCACnF,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAClC;wCACA,yEAAyE;wCACzE,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;qCAC9B;yCAAM;wCACL,mBAAmB;wCACnB,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;qCACzC;iCACF;6BACF;iCAAM,IAAI,QAAQ,KAAK,WAAW,EAAE;gCACnC,IAAI,SAAS,EAAE;oCACb,yBAAyB;oCACzB,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;iCACrD;6BACF;iCAAM;gCACL,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;6BAC9B;yBACF;qBACF;iBACF;aACF;YACD,OAAO,MAAgB,CAAC;QAC1B,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { GenericDictionary } from './types';\n\n// TODO\n// css() function is temporary there, ax() should be used instead, but it's not possible now due possible\n// circular dependencies\n\n/**\n * Dictionary of booleans.\n *\n * @internal\n */\ninterface Dictionary {\n [className: string]: boolean;\n}\n\n/**\n * Serializable object.\n *\n * @internal\n */\ninterface SerializableObject {\n toString?: () => string;\n}\n\n/**\n * css input type.\n *\n * @internal\n */\ntype CssInput = string | SerializableObject | Dictionary | null | undefined | boolean;\n\n/**\n * Concatination helper, which can merge class names together. Skips over falsey values.\n *\n * @public\n */\nfunction css(...args: CssInput[]): string {\n const classes = [];\n\n for (const arg of args) {\n if (arg) {\n if (typeof arg === 'string') {\n classes.push(arg);\n } else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {\n classes.push(arg.toString());\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const key in arg as any) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((arg as any)[key]) {\n classes.push(key);\n }\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n\nexport type MergePropsOptions = {\n /**\n * A list of props to deep merge. By default, `style` will\n * always be deep merged so it's not required to be provided.\n */\n deepMerge?: string[];\n};\n\n/**\n * Helper which deep clones props, but respectively assigns JSX, object refs, and class names\n * appropriately.\n *\n * @param target - the target object to merge onto.\n * @param propSets - one or more prop sets to deep merge onto the target.\n */\nexport const makeMergeProps = <TState = GenericDictionary>(options: MergePropsOptions = {}) => {\n const deepMerge = [...(options.deepMerge || []), 'style'];\n\n const mergeProps = (target: GenericDictionary, ...propSets: (GenericDictionary | undefined)[]): TState => {\n for (const props of propSets) {\n if (props) {\n for (const propName of Object.keys(props)) {\n const propValue = props[propName];\n const propValueType = typeof propValue;\n\n if (propValue !== undefined) {\n if (propValue && propValueType === 'object') {\n if (Array.isArray(propValue)) {\n // for arrays, replace.\n target[propName] = propValue;\n } else {\n target[propName] = target[propName] || {};\n\n if (\n typeof target[propName] !== 'object' ||\n React.isValidElement(propValue) ||\n (propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||\n deepMerge.indexOf(propName) === -1\n ) {\n // if target is not an object, or value is JSX, or a ref object, replace\n target[propName] = propValue;\n } else {\n // else deep merge.\n mergeProps(target[propName], propValue);\n }\n }\n } else if (propName === 'className') {\n if (propValue) {\n // for classnames, append\n target[propName] = css(target[propName], propValue);\n }\n } else {\n target[propName] = propValue;\n }\n }\n }\n }\n }\n return target as TState;\n };\n\n return mergeProps;\n};\n"]}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
/**
|
5
|
-
* Simple constant function for returning null, used to render empty templates in JSX.
|
6
|
-
*/
|
7
|
-
exports.nullRender = function () { return null; };
|
8
|
-
});
|
9
|
-
//# sourceMappingURL=nullRender.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"nullRender.js","sourceRoot":"../src/","sources":["compose/nullRender.tsx"],"names":[],"mappings":";;;IAAA;;OAEG;IACU,QAAA,UAAU,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC","sourcesContent":["/**\n * Simple constant function for returning null, used to render empty templates in JSX.\n */\nexport const nullRender = () => null;\n"]}
|