@xaui/native 0.9.1-alpha.4 → 0.9.1-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/{chunk-ECDWSSHJ.js → chunk-AUDOMZR3.js} +72 -16
- package/dist/{chunk-IYFGO523.cjs → chunk-PSSG6C3Q.cjs} +59 -3
- package/dist/index.cjs +8 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -2
- package/dist/system/index.cjs +8 -2
- package/dist/system/index.d.cts +59 -3
- package/dist/system/index.d.ts +59 -3
- package/dist/system/index.js +9 -3
- package/package.json +1 -1
|
@@ -3,16 +3,69 @@ import {
|
|
|
3
3
|
useXAUITheme
|
|
4
4
|
} from "./chunk-X2K2FX3W.js";
|
|
5
5
|
|
|
6
|
+
// src/system/icon/icon.tsx
|
|
7
|
+
import { cloneElement, isValidElement } from "react";
|
|
8
|
+
import { Image } from "react-native";
|
|
9
|
+
|
|
10
|
+
// src/system/icon/icon-context.ts
|
|
11
|
+
import { createContext, useContext } from "react";
|
|
12
|
+
var IconContext = createContext({});
|
|
13
|
+
IconContext.displayName = "XAUI.Icon.Context";
|
|
14
|
+
function useIconContext() {
|
|
15
|
+
return useContext(IconContext);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/system/icon/icon.tsx
|
|
19
|
+
function Icon({
|
|
20
|
+
as: Component,
|
|
21
|
+
children,
|
|
22
|
+
source,
|
|
23
|
+
size,
|
|
24
|
+
color,
|
|
25
|
+
style
|
|
26
|
+
}) {
|
|
27
|
+
const inherited = useIconContext();
|
|
28
|
+
const theme = useXAUITheme();
|
|
29
|
+
const resolvedSize = size ?? inherited.size ?? theme.fontSizes.md;
|
|
30
|
+
const resolvedColor = color ?? inherited.color ?? theme.colors.foreground;
|
|
31
|
+
if (Component) {
|
|
32
|
+
return /* @__PURE__ */ React.createElement(Component, { size: resolvedSize, color: resolvedColor });
|
|
33
|
+
}
|
|
34
|
+
if (isValidElement(children)) {
|
|
35
|
+
return cloneElement(children, {
|
|
36
|
+
width: resolvedSize,
|
|
37
|
+
height: resolvedSize,
|
|
38
|
+
color: resolvedColor
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (source) {
|
|
42
|
+
return /* @__PURE__ */ React.createElement(
|
|
43
|
+
Image,
|
|
44
|
+
{
|
|
45
|
+
source,
|
|
46
|
+
style: [
|
|
47
|
+
{ width: resolvedSize, height: resolvedSize, tintColor: resolvedColor },
|
|
48
|
+
style
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
throw new Error(
|
|
54
|
+
"XAUI: Icon needs one of `as` (an icon component), a raw SVG element as its child, or `source` (an image). It renders nothing on its own."
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
Icon.displayName = "XAUI.Icon";
|
|
58
|
+
|
|
6
59
|
// src/system/portal/portal.tsx
|
|
7
|
-
import { useContext, useId, useLayoutEffect } from "react";
|
|
60
|
+
import { useContext as useContext2, useId, useLayoutEffect } from "react";
|
|
8
61
|
|
|
9
62
|
// src/system/portal/portal-context.ts
|
|
10
|
-
import { createContext } from "react";
|
|
11
|
-
var PortalContext =
|
|
63
|
+
import { createContext as createContext2 } from "react";
|
|
64
|
+
var PortalContext = createContext2(null);
|
|
12
65
|
|
|
13
66
|
// src/system/portal/portal.tsx
|
|
14
67
|
function Portal({ children }) {
|
|
15
|
-
const context =
|
|
68
|
+
const context = useContext2(PortalContext);
|
|
16
69
|
const key = useId();
|
|
17
70
|
useLayoutEffect(() => {
|
|
18
71
|
context?.addPortal(key, children);
|
|
@@ -52,7 +105,7 @@ function PortalHost({ children }) {
|
|
|
52
105
|
PortalHost.displayName = "XAUI.PortalHost";
|
|
53
106
|
|
|
54
107
|
// src/system/pressable-feedback/pressable-feedback.tsx
|
|
55
|
-
import { forwardRef as forwardRef2, useContext as
|
|
108
|
+
import { forwardRef as forwardRef2, useContext as useContext4, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
56
109
|
import { Pressable } from "react-native";
|
|
57
110
|
import Animated3, {
|
|
58
111
|
useAnimatedStyle as useAnimatedStyle3,
|
|
@@ -61,15 +114,15 @@ import Animated3, {
|
|
|
61
114
|
} from "react-native-reanimated";
|
|
62
115
|
|
|
63
116
|
// src/system/pressable-feedback/pressable-feedback-context.ts
|
|
64
|
-
import { createContext as
|
|
117
|
+
import { createContext as createContext4 } from "react";
|
|
65
118
|
|
|
66
119
|
// src/system/slot/create-slot-context.ts
|
|
67
|
-
import { createContext as
|
|
120
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
68
121
|
function createSlotContext(name) {
|
|
69
|
-
const Context =
|
|
122
|
+
const Context = createContext3(null);
|
|
70
123
|
Context.displayName = `XAUI.${name}.Context`;
|
|
71
124
|
function useSlotContext() {
|
|
72
|
-
const value =
|
|
125
|
+
const value = useContext3(Context);
|
|
73
126
|
if (value === null) {
|
|
74
127
|
const error = new Error(
|
|
75
128
|
`XAUI: use${name} must be called inside <${name}>. A slot reads the values its root resolved, so it can only be rendered as a child of one.`
|
|
@@ -87,7 +140,7 @@ function createSlotContext(name) {
|
|
|
87
140
|
|
|
88
141
|
// src/system/pressable-feedback/pressable-feedback-context.ts
|
|
89
142
|
var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
|
|
90
|
-
var DisableAllContext =
|
|
143
|
+
var DisableAllContext = createContext4(false);
|
|
91
144
|
|
|
92
145
|
// src/system/pressable-feedback/pressable-feedback-highlight.tsx
|
|
93
146
|
import { useEffect } from "react";
|
|
@@ -323,7 +376,7 @@ function RippleWave({
|
|
|
323
376
|
}
|
|
324
377
|
|
|
325
378
|
// src/system/slot/slot.tsx
|
|
326
|
-
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
379
|
+
import { cloneElement as cloneElement2, forwardRef, isValidElement as isValidElement2 } from "react";
|
|
327
380
|
|
|
328
381
|
// src/system/slot/merge-refs.ts
|
|
329
382
|
function mergeRefs(...refs) {
|
|
@@ -381,7 +434,7 @@ function resolveStyle(style, state) {
|
|
|
381
434
|
|
|
382
435
|
// src/system/slot/slot.tsx
|
|
383
436
|
var Slot = forwardRef(function Slot2({ children, ...ours }, ref) {
|
|
384
|
-
if (!
|
|
437
|
+
if (!isValidElement2(children)) {
|
|
385
438
|
throw new Error(
|
|
386
439
|
"XAUI: asChild expects exactly one React element as its child, and merges the component's props into it. Text, a fragment, several children or none give it nothing to merge into \u2014 drop `asChild` to render the component itself."
|
|
387
440
|
);
|
|
@@ -389,7 +442,7 @@ var Slot = forwardRef(function Slot2({ children, ...ours }, ref) {
|
|
|
389
442
|
const child = children;
|
|
390
443
|
const merged = mergeProps(ours, child.props);
|
|
391
444
|
merged.ref = mergeRefs(ref, refOf(child));
|
|
392
|
-
return
|
|
445
|
+
return cloneElement2(child, merged);
|
|
393
446
|
});
|
|
394
447
|
Slot.displayName = "XAUI.Slot";
|
|
395
448
|
function refOf(element) {
|
|
@@ -403,7 +456,7 @@ var AnimatedPressable = Animated3.createAnimatedComponent(Pressable);
|
|
|
403
456
|
var AnimatedSlot = Animated3.createAnimatedComponent(Slot);
|
|
404
457
|
var PressableFeedback = forwardRef2(
|
|
405
458
|
function PressableFeedback2({ animation, feedbackVariant = "scale-highlight", ...rest }, ref) {
|
|
406
|
-
const inheritedDisableAll =
|
|
459
|
+
const inheritedDisableAll = useContext4(DisableAllContext);
|
|
407
460
|
const resolved = resolveAnimation(animation, inheritedDisableAll);
|
|
408
461
|
const Feedback = resolved.none || feedbackVariant === "none" ? StaticFeedback : AnimatedFeedback;
|
|
409
462
|
const body = /* @__PURE__ */ React.createElement(
|
|
@@ -642,7 +695,7 @@ function apply(fns, theme, colors) {
|
|
|
642
695
|
}
|
|
643
696
|
|
|
644
697
|
// src/system/slot/children-to-string.ts
|
|
645
|
-
import { isValidElement as
|
|
698
|
+
import { isValidElement as isValidElement3 } from "react";
|
|
646
699
|
function childrenToString(children) {
|
|
647
700
|
const text = stringify(children);
|
|
648
701
|
return text === null || text === "" ? null : text;
|
|
@@ -651,7 +704,7 @@ function stringify(node) {
|
|
|
651
704
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
652
705
|
if (typeof node === "string") return node;
|
|
653
706
|
if (typeof node === "number") return String(node);
|
|
654
|
-
if (
|
|
707
|
+
if (isValidElement3(node)) return null;
|
|
655
708
|
if (Array.isArray(node)) {
|
|
656
709
|
let text = "";
|
|
657
710
|
for (const child of node) {
|
|
@@ -665,6 +718,9 @@ function stringify(node) {
|
|
|
665
718
|
}
|
|
666
719
|
|
|
667
720
|
export {
|
|
721
|
+
IconContext,
|
|
722
|
+
useIconContext,
|
|
723
|
+
Icon,
|
|
668
724
|
PortalContext,
|
|
669
725
|
Portal,
|
|
670
726
|
PortalHost,
|
|
@@ -3,8 +3,61 @@
|
|
|
3
3
|
|
|
4
4
|
var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
|
|
5
5
|
|
|
6
|
-
// src/system/
|
|
6
|
+
// src/system/icon/icon.tsx
|
|
7
7
|
var _react = require('react');
|
|
8
|
+
var _reactnative = require('react-native');
|
|
9
|
+
|
|
10
|
+
// src/system/icon/icon-context.ts
|
|
11
|
+
|
|
12
|
+
var IconContext = _react.createContext.call(void 0, {});
|
|
13
|
+
IconContext.displayName = "XAUI.Icon.Context";
|
|
14
|
+
function useIconContext() {
|
|
15
|
+
return _react.useContext.call(void 0, IconContext);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/system/icon/icon.tsx
|
|
19
|
+
function Icon({
|
|
20
|
+
as: Component,
|
|
21
|
+
children,
|
|
22
|
+
source,
|
|
23
|
+
size,
|
|
24
|
+
color,
|
|
25
|
+
style
|
|
26
|
+
}) {
|
|
27
|
+
const inherited = useIconContext();
|
|
28
|
+
const theme = _chunk3QBT3Q65cjs.useXAUITheme.call(void 0, );
|
|
29
|
+
const resolvedSize = _nullishCoalesce(_nullishCoalesce(size, () => ( inherited.size)), () => ( theme.fontSizes.md));
|
|
30
|
+
const resolvedColor = _nullishCoalesce(_nullishCoalesce(color, () => ( inherited.color)), () => ( theme.colors.foreground));
|
|
31
|
+
if (Component) {
|
|
32
|
+
return /* @__PURE__ */ React.createElement(Component, { size: resolvedSize, color: resolvedColor });
|
|
33
|
+
}
|
|
34
|
+
if (_react.isValidElement.call(void 0, children)) {
|
|
35
|
+
return _react.cloneElement.call(void 0, children, {
|
|
36
|
+
width: resolvedSize,
|
|
37
|
+
height: resolvedSize,
|
|
38
|
+
color: resolvedColor
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (source) {
|
|
42
|
+
return /* @__PURE__ */ React.createElement(
|
|
43
|
+
_reactnative.Image,
|
|
44
|
+
{
|
|
45
|
+
source,
|
|
46
|
+
style: [
|
|
47
|
+
{ width: resolvedSize, height: resolvedSize, tintColor: resolvedColor },
|
|
48
|
+
style
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
throw new Error(
|
|
54
|
+
"XAUI: Icon needs one of `as` (an icon component), a raw SVG element as its child, or `source` (an image). It renders nothing on its own."
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
Icon.displayName = "XAUI.Icon";
|
|
58
|
+
|
|
59
|
+
// src/system/portal/portal.tsx
|
|
60
|
+
|
|
8
61
|
|
|
9
62
|
// src/system/portal/portal-context.ts
|
|
10
63
|
|
|
@@ -26,7 +79,7 @@ Portal.displayName = "XAUI.Portal";
|
|
|
26
79
|
|
|
27
80
|
// src/system/portal/portal-host.tsx
|
|
28
81
|
|
|
29
|
-
|
|
82
|
+
|
|
30
83
|
var styles = _reactnative.StyleSheet.create({
|
|
31
84
|
container: { flex: 1 }
|
|
32
85
|
});
|
|
@@ -685,4 +738,7 @@ function stringify(node) {
|
|
|
685
738
|
|
|
686
739
|
|
|
687
740
|
|
|
688
|
-
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
exports.IconContext = IconContext; exports.useIconContext = useIconContext; exports.Icon = Icon; exports.PortalContext = PortalContext; exports.Portal = Portal; exports.PortalHost = PortalHost; exports.createSlotContext = createSlotContext; exports.useFeedback = useFeedback; exports.PRESS_SCALE = PRESS_SCALE; exports.PRESS_DURATION = PRESS_DURATION; exports.RELEASE_DURATION = RELEASE_DURATION; exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY; exports.RIPPLE_OPACITY = RIPPLE_OPACITY; exports.RIPPLE_DURATION = RIPPLE_DURATION; exports.RIPPLE_COVERAGE = RIPPLE_COVERAGE; exports.resolveAnimation = resolveAnimation; exports.resolveSlotAnimation = resolveSlotAnimation; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.PressableFeedback = PressableFeedback3; exports.createRecipe = createRecipe; exports.childrenToString = childrenToString;
|
package/dist/index.cjs
CHANGED
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkPSSG6C3Qcjs = require('./chunk-PSSG6C3Q.cjs');
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
|
|
@@ -75,4 +78,7 @@ var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
|
|
|
75
78
|
|
|
76
79
|
|
|
77
80
|
|
|
78
|
-
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
exports.HIGHLIGHT_OPACITY = _chunkPSSG6C3Qcjs.HIGHLIGHT_OPACITY; exports.Icon = _chunkPSSG6C3Qcjs.Icon; exports.IconContext = _chunkPSSG6C3Qcjs.IconContext; exports.PRESS_DURATION = _chunkPSSG6C3Qcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkPSSG6C3Qcjs.PRESS_SCALE; exports.Portal = _chunkPSSG6C3Qcjs.Portal; exports.PortalContext = _chunkPSSG6C3Qcjs.PortalContext; exports.PortalHost = _chunkPSSG6C3Qcjs.PortalHost; exports.PressableFeedback = _chunkPSSG6C3Qcjs.PressableFeedback; exports.RELEASE_DURATION = _chunkPSSG6C3Qcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkPSSG6C3Qcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkPSSG6C3Qcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkPSSG6C3Qcjs.RIPPLE_OPACITY; exports.Slot = _chunkPSSG6C3Qcjs.Slot; exports.ThemeContext = _chunk3QBT3Q65cjs.ThemeContext; exports.XAUIProvider = _chunkAW63PTQ4cjs.XAUIProvider; exports.buildRadius = _chunkAW63PTQ4cjs.buildRadius; exports.buildShadows = _chunkAW63PTQ4cjs.buildShadows; exports.childrenToString = _chunkPSSG6C3Qcjs.childrenToString; exports.createRecipe = _chunkPSSG6C3Qcjs.createRecipe; exports.createSlotContext = _chunkPSSG6C3Qcjs.createSlotContext; exports.createTheme = _chunkAW63PTQ4cjs.createTheme; exports.defaultTheme = _chunkAW63PTQ4cjs.defaultTheme; exports.deriveColors = _chunkAW63PTQ4cjs.deriveColors; exports.deriveTint = _chunk3QBT3Q65cjs.deriveTint; exports.mergeProps = _chunkPSSG6C3Qcjs.mergeProps; exports.mergeRefs = _chunkPSSG6C3Qcjs.mergeRefs; exports.palette = _chunkAW63PTQ4cjs.palette; exports.primitives = _chunkAW63PTQ4cjs.primitives; exports.resolveAnimation = _chunkPSSG6C3Qcjs.resolveAnimation; exports.resolveSlotAnimation = _chunkPSSG6C3Qcjs.resolveSlotAnimation; exports.sourceKeys = _chunkAW63PTQ4cjs.sourceKeys; exports.tokens = _chunkAW63PTQ4cjs.tokens; exports.useColorMode = _chunk3QBT3Q65cjs.useColorMode; exports.useFeedback = _chunkPSSG6C3Qcjs.useFeedback; exports.useIconContext = _chunkPSSG6C3Qcjs.useIconContext; exports.useThemeColor = _chunk3QBT3Q65cjs.useThemeColor; exports.useXAUITheme = _chunk3QBT3Q65cjs.useXAUITheme;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.cjs';
|
|
1
|
+
export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, Icon, IconComponentProps, IconContext, IconContextValue, IconProps, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback, useIconContext } from './system/index.cjs';
|
|
2
2
|
export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.cjs';
|
|
3
3
|
export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.cjs';
|
|
4
4
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.js';
|
|
1
|
+
export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, Icon, IconComponentProps, IconContext, IconContextValue, IconProps, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback, useIconContext } from './system/index.js';
|
|
2
2
|
export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.js';
|
|
3
3
|
export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.js';
|
|
4
4
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HIGHLIGHT_OPACITY,
|
|
3
|
+
Icon,
|
|
4
|
+
IconContext,
|
|
3
5
|
PRESS_DURATION,
|
|
4
6
|
PRESS_SCALE,
|
|
5
7
|
Portal,
|
|
@@ -18,8 +20,9 @@ import {
|
|
|
18
20
|
mergeRefs,
|
|
19
21
|
resolveAnimation,
|
|
20
22
|
resolveSlotAnimation,
|
|
21
|
-
useFeedback
|
|
22
|
-
|
|
23
|
+
useFeedback,
|
|
24
|
+
useIconContext
|
|
25
|
+
} from "./chunk-AUDOMZR3.js";
|
|
23
26
|
import {
|
|
24
27
|
XAUIProvider,
|
|
25
28
|
buildRadius,
|
|
@@ -41,6 +44,8 @@ import {
|
|
|
41
44
|
} from "./chunk-X2K2FX3W.js";
|
|
42
45
|
export {
|
|
43
46
|
HIGHLIGHT_OPACITY,
|
|
47
|
+
Icon,
|
|
48
|
+
IconContext,
|
|
44
49
|
PRESS_DURATION,
|
|
45
50
|
PRESS_SCALE,
|
|
46
51
|
Portal,
|
|
@@ -73,6 +78,7 @@ export {
|
|
|
73
78
|
tokens,
|
|
74
79
|
useColorMode,
|
|
75
80
|
useFeedback,
|
|
81
|
+
useIconContext,
|
|
76
82
|
useThemeColor,
|
|
77
83
|
useXAUITheme
|
|
78
84
|
};
|
package/dist/system/index.cjs
CHANGED
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkPSSG6C3Qcjs = require('../chunk-PSSG6C3Q.cjs');
|
|
23
26
|
require('../chunk-3QBT3Q65.cjs');
|
|
24
27
|
|
|
25
28
|
|
|
@@ -42,4 +45,7 @@ require('../chunk-3QBT3Q65.cjs');
|
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
exports.HIGHLIGHT_OPACITY = _chunkPSSG6C3Qcjs.HIGHLIGHT_OPACITY; exports.Icon = _chunkPSSG6C3Qcjs.Icon; exports.IconContext = _chunkPSSG6C3Qcjs.IconContext; exports.PRESS_DURATION = _chunkPSSG6C3Qcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkPSSG6C3Qcjs.PRESS_SCALE; exports.Portal = _chunkPSSG6C3Qcjs.Portal; exports.PortalContext = _chunkPSSG6C3Qcjs.PortalContext; exports.PortalHost = _chunkPSSG6C3Qcjs.PortalHost; exports.PressableFeedback = _chunkPSSG6C3Qcjs.PressableFeedback; exports.RELEASE_DURATION = _chunkPSSG6C3Qcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkPSSG6C3Qcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkPSSG6C3Qcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkPSSG6C3Qcjs.RIPPLE_OPACITY; exports.Slot = _chunkPSSG6C3Qcjs.Slot; exports.childrenToString = _chunkPSSG6C3Qcjs.childrenToString; exports.createRecipe = _chunkPSSG6C3Qcjs.createRecipe; exports.createSlotContext = _chunkPSSG6C3Qcjs.createSlotContext; exports.mergeProps = _chunkPSSG6C3Qcjs.mergeProps; exports.mergeRefs = _chunkPSSG6C3Qcjs.mergeRefs; exports.resolveAnimation = _chunkPSSG6C3Qcjs.resolveAnimation; exports.resolveSlotAnimation = _chunkPSSG6C3Qcjs.resolveSlotAnimation; exports.useFeedback = _chunkPSSG6C3Qcjs.useFeedback; exports.useIconContext = _chunkPSSG6C3Qcjs.useIconContext;
|
package/dist/system/index.d.cts
CHANGED
|
@@ -1,10 +1,66 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, Provider, Ref, RefCallback } from 'react';
|
|
2
|
+
import { ComponentType, ReactNode, Provider, Ref, RefCallback } from 'react';
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
|
-
import {
|
|
4
|
+
import { ImageSourcePropType, StyleProp, ImageStyle, PressableProps, ViewStyle, TextStyle } from 'react-native';
|
|
5
5
|
import { SharedValue } from 'react-native-reanimated';
|
|
6
6
|
import { g as XAUITheme, X as XAUIColors } from '../theme.type-C9bFJKFm.cjs';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The props Lucide, Ionicons and `react-native-vector-icons` all accept — the shape
|
|
10
|
+
* `as` is handed. It is a convention rather than an interface anyone published, which is
|
|
11
|
+
* exactly why `Icon` exists: without it every call site computes the two values by hand.
|
|
12
|
+
*/
|
|
13
|
+
type IconComponentProps = {
|
|
14
|
+
size?: number;
|
|
15
|
+
color?: string;
|
|
16
|
+
};
|
|
17
|
+
type IconProps = {
|
|
18
|
+
/** An icon component. `size` and `color` are injected into it. */
|
|
19
|
+
as?: ComponentType<IconComponentProps>;
|
|
20
|
+
/** A raw `react-native-svg` element, cloned with the resolved size and colour. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/** An image, tinted with the resolved colour. */
|
|
23
|
+
source?: ImageSourcePropType;
|
|
24
|
+
/** Overrides what the surrounding slot asked for. */
|
|
25
|
+
size?: number;
|
|
26
|
+
/** A raw value (R7), never a token. Overrides the slot's. */
|
|
27
|
+
color?: string;
|
|
28
|
+
style?: StyleProp<ImageStyle>;
|
|
29
|
+
};
|
|
30
|
+
/** What a component root publishes so the icons inside it need no props at all. */
|
|
31
|
+
type IconContextValue = {
|
|
32
|
+
size?: number;
|
|
33
|
+
color?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The gap nobody else closes: an icon is a third-party component, so a slot context does
|
|
38
|
+
* not reach it and every call site ends up computing the colour by hand.
|
|
39
|
+
*
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <Button variant="danger">
|
|
42
|
+
* <Button.Icon as={TrashIcon} /> {/* colour and size inherited, nothing to pass *\/}
|
|
43
|
+
* <Button.Label>Supprimer</Button.Label>
|
|
44
|
+
* </Button>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Three accepted forms — a component through `as`, a raw SVG as children, or an image
|
|
48
|
+
* through `source` — and the resolution is the same for all three: an explicit prop, else
|
|
49
|
+
* what the surrounding slot published, else the theme.
|
|
50
|
+
*/
|
|
51
|
+
declare function Icon({ as: Component, children, source, size, color, style, }: IconProps): react.JSX.Element;
|
|
52
|
+
declare namespace Icon {
|
|
53
|
+
var displayName: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Not a `createSlotContext`: that one throws outside its parent, and an `Icon` has to
|
|
58
|
+
* work on its own as much as inside a `Button`. An empty context is the honest default —
|
|
59
|
+
* nothing inherited, so the theme decides.
|
|
60
|
+
*/
|
|
61
|
+
declare const IconContext: react.Context<IconContextValue>;
|
|
62
|
+
declare function useIconContext(): IconContextValue;
|
|
63
|
+
|
|
8
64
|
type PortalProps = {
|
|
9
65
|
children: ReactNode;
|
|
10
66
|
};
|
|
@@ -392,4 +448,4 @@ type SlotProps = MergeableProps & {
|
|
|
392
448
|
*/
|
|
393
449
|
declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
|
|
394
450
|
|
|
395
|
-
export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback };
|
|
451
|
+
export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, Icon, type IconComponentProps, IconContext, type IconContextValue, type IconProps, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback, useIconContext };
|
package/dist/system/index.d.ts
CHANGED
|
@@ -1,10 +1,66 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, Provider, Ref, RefCallback } from 'react';
|
|
2
|
+
import { ComponentType, ReactNode, Provider, Ref, RefCallback } from 'react';
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
|
-
import {
|
|
4
|
+
import { ImageSourcePropType, StyleProp, ImageStyle, PressableProps, ViewStyle, TextStyle } from 'react-native';
|
|
5
5
|
import { SharedValue } from 'react-native-reanimated';
|
|
6
6
|
import { g as XAUITheme, X as XAUIColors } from '../theme.type-C9bFJKFm.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The props Lucide, Ionicons and `react-native-vector-icons` all accept — the shape
|
|
10
|
+
* `as` is handed. It is a convention rather than an interface anyone published, which is
|
|
11
|
+
* exactly why `Icon` exists: without it every call site computes the two values by hand.
|
|
12
|
+
*/
|
|
13
|
+
type IconComponentProps = {
|
|
14
|
+
size?: number;
|
|
15
|
+
color?: string;
|
|
16
|
+
};
|
|
17
|
+
type IconProps = {
|
|
18
|
+
/** An icon component. `size` and `color` are injected into it. */
|
|
19
|
+
as?: ComponentType<IconComponentProps>;
|
|
20
|
+
/** A raw `react-native-svg` element, cloned with the resolved size and colour. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/** An image, tinted with the resolved colour. */
|
|
23
|
+
source?: ImageSourcePropType;
|
|
24
|
+
/** Overrides what the surrounding slot asked for. */
|
|
25
|
+
size?: number;
|
|
26
|
+
/** A raw value (R7), never a token. Overrides the slot's. */
|
|
27
|
+
color?: string;
|
|
28
|
+
style?: StyleProp<ImageStyle>;
|
|
29
|
+
};
|
|
30
|
+
/** What a component root publishes so the icons inside it need no props at all. */
|
|
31
|
+
type IconContextValue = {
|
|
32
|
+
size?: number;
|
|
33
|
+
color?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The gap nobody else closes: an icon is a third-party component, so a slot context does
|
|
38
|
+
* not reach it and every call site ends up computing the colour by hand.
|
|
39
|
+
*
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <Button variant="danger">
|
|
42
|
+
* <Button.Icon as={TrashIcon} /> {/* colour and size inherited, nothing to pass *\/}
|
|
43
|
+
* <Button.Label>Supprimer</Button.Label>
|
|
44
|
+
* </Button>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Three accepted forms — a component through `as`, a raw SVG as children, or an image
|
|
48
|
+
* through `source` — and the resolution is the same for all three: an explicit prop, else
|
|
49
|
+
* what the surrounding slot published, else the theme.
|
|
50
|
+
*/
|
|
51
|
+
declare function Icon({ as: Component, children, source, size, color, style, }: IconProps): react.JSX.Element;
|
|
52
|
+
declare namespace Icon {
|
|
53
|
+
var displayName: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Not a `createSlotContext`: that one throws outside its parent, and an `Icon` has to
|
|
58
|
+
* work on its own as much as inside a `Button`. An empty context is the honest default —
|
|
59
|
+
* nothing inherited, so the theme decides.
|
|
60
|
+
*/
|
|
61
|
+
declare const IconContext: react.Context<IconContextValue>;
|
|
62
|
+
declare function useIconContext(): IconContextValue;
|
|
63
|
+
|
|
8
64
|
type PortalProps = {
|
|
9
65
|
children: ReactNode;
|
|
10
66
|
};
|
|
@@ -392,4 +448,4 @@ type SlotProps = MergeableProps & {
|
|
|
392
448
|
*/
|
|
393
449
|
declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
|
|
394
450
|
|
|
395
|
-
export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback };
|
|
451
|
+
export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, Icon, type IconComponentProps, IconContext, type IconContextValue, type IconProps, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback, useIconContext };
|
package/dist/system/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HIGHLIGHT_OPACITY,
|
|
3
|
+
Icon,
|
|
4
|
+
IconContext,
|
|
3
5
|
PRESS_DURATION,
|
|
4
6
|
PRESS_SCALE,
|
|
5
7
|
Portal,
|
|
@@ -18,11 +20,14 @@ import {
|
|
|
18
20
|
mergeRefs,
|
|
19
21
|
resolveAnimation,
|
|
20
22
|
resolveSlotAnimation,
|
|
21
|
-
useFeedback
|
|
22
|
-
|
|
23
|
+
useFeedback,
|
|
24
|
+
useIconContext
|
|
25
|
+
} from "../chunk-AUDOMZR3.js";
|
|
23
26
|
import "../chunk-X2K2FX3W.js";
|
|
24
27
|
export {
|
|
25
28
|
HIGHLIGHT_OPACITY,
|
|
29
|
+
Icon,
|
|
30
|
+
IconContext,
|
|
26
31
|
PRESS_DURATION,
|
|
27
32
|
PRESS_SCALE,
|
|
28
33
|
Portal,
|
|
@@ -41,5 +46,6 @@ export {
|
|
|
41
46
|
mergeRefs,
|
|
42
47
|
resolveAnimation,
|
|
43
48
|
resolveSlotAnimation,
|
|
44
|
-
useFeedback
|
|
49
|
+
useFeedback,
|
|
50
|
+
useIconContext
|
|
45
51
|
};
|