tamagui 1.68.0 → 1.68.2
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/native.js +162 -114
- package/dist/native.js.map +3 -3
- package/dist/test.native.js +158 -114
- package/dist/test.native.js.map +3 -3
- package/package.json +52 -52
package/dist/test.native.js
CHANGED
|
@@ -15679,6 +15679,119 @@ var require_index_native60 = __commonJS({
|
|
|
15679
15679
|
}
|
|
15680
15680
|
});
|
|
15681
15681
|
|
|
15682
|
+
// ../switch/dist/cjs/SwitchContext.native.js
|
|
15683
|
+
var require_SwitchContext_native = __commonJS({
|
|
15684
|
+
"../switch/dist/cjs/SwitchContext.native.js"(exports, module2) {
|
|
15685
|
+
"use strict";
|
|
15686
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
15687
|
+
for (var name in all)
|
|
15688
|
+
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
15689
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
15690
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
15691
|
+
for (let key of __getOwnPropNames2(from))
|
|
15692
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
15693
|
+
return to;
|
|
15694
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), SwitchContext_exports = {};
|
|
15695
|
+
__export2(SwitchContext_exports, {
|
|
15696
|
+
SwitchContext: () => SwitchContext
|
|
15697
|
+
});
|
|
15698
|
+
module2.exports = __toCommonJS2(SwitchContext_exports);
|
|
15699
|
+
var import_core12 = require_index_native10(), SwitchContext = (0, import_core12.createStyledContext)({
|
|
15700
|
+
checked: !1,
|
|
15701
|
+
disabled: !1,
|
|
15702
|
+
size: void 0,
|
|
15703
|
+
frameWidth: 0,
|
|
15704
|
+
unstyled: !1
|
|
15705
|
+
});
|
|
15706
|
+
}
|
|
15707
|
+
});
|
|
15708
|
+
|
|
15709
|
+
// ../switch/dist/cjs/Switch.native.js
|
|
15710
|
+
var require_Switch_native = __commonJS({
|
|
15711
|
+
"../switch/dist/cjs/Switch.native.js"(exports, module2) {
|
|
15712
|
+
"use strict";
|
|
15713
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
15714
|
+
for (var name in all)
|
|
15715
|
+
__defProp2(target, name, { get: all[name], enumerable: !0 });
|
|
15716
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
15717
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
15718
|
+
for (let key of __getOwnPropNames2(from))
|
|
15719
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
15720
|
+
return to;
|
|
15721
|
+
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Switch_exports = {};
|
|
15722
|
+
__export2(Switch_exports, {
|
|
15723
|
+
SwitchFrame: () => SwitchFrame,
|
|
15724
|
+
SwitchThumb: () => SwitchThumb
|
|
15725
|
+
});
|
|
15726
|
+
module2.exports = __toCommonJS2(Switch_exports);
|
|
15727
|
+
var import_core12 = require_index_native10(), import_get_token2 = require_index_native18(), import_stacks3 = require_index_native20(), import_SwitchContext = require_SwitchContext_native(), SwitchThumb = (0, import_core12.styled)(import_stacks3.ThemeableStack, {
|
|
15728
|
+
name: "SwitchThumb",
|
|
15729
|
+
context: import_SwitchContext.SwitchContext,
|
|
15730
|
+
variants: {
|
|
15731
|
+
unstyled: {
|
|
15732
|
+
false: {
|
|
15733
|
+
size: "$true",
|
|
15734
|
+
backgroundColor: "$background",
|
|
15735
|
+
borderRadius: 1e3
|
|
15736
|
+
}
|
|
15737
|
+
},
|
|
15738
|
+
size: {
|
|
15739
|
+
"...size": (val) => {
|
|
15740
|
+
let size = getSwitchHeight(val);
|
|
15741
|
+
return {
|
|
15742
|
+
height: size,
|
|
15743
|
+
width: size
|
|
15744
|
+
};
|
|
15745
|
+
}
|
|
15746
|
+
}
|
|
15747
|
+
},
|
|
15748
|
+
defaultVariants: {
|
|
15749
|
+
unstyled: !1
|
|
15750
|
+
}
|
|
15751
|
+
}), getSwitchHeight = (val) => Math.round((0, import_core12.getVariableValue)((0, import_get_token2.getSize)(val)) * 0.65), getSwitchWidth = (val) => getSwitchHeight(val) * 2, SwitchFrame = (0, import_core12.styled)(import_stacks3.YStack, {
|
|
15752
|
+
name: "Switch",
|
|
15753
|
+
tag: "button",
|
|
15754
|
+
context: import_SwitchContext.SwitchContext,
|
|
15755
|
+
variants: {
|
|
15756
|
+
unstyled: {
|
|
15757
|
+
false: {
|
|
15758
|
+
size: "$true",
|
|
15759
|
+
borderRadius: 1e3,
|
|
15760
|
+
borderWidth: 2,
|
|
15761
|
+
borderColor: "transparent",
|
|
15762
|
+
backgroundColor: "$background",
|
|
15763
|
+
focusStyle: {
|
|
15764
|
+
borderColor: "$borderColorFocus",
|
|
15765
|
+
outlineColor: "$borderColorFocus",
|
|
15766
|
+
outlineStyle: "solid",
|
|
15767
|
+
outlineWidth: 1
|
|
15768
|
+
}
|
|
15769
|
+
}
|
|
15770
|
+
},
|
|
15771
|
+
checked: {
|
|
15772
|
+
true: {}
|
|
15773
|
+
},
|
|
15774
|
+
frameWidth: {
|
|
15775
|
+
":number": () => null
|
|
15776
|
+
},
|
|
15777
|
+
size: {
|
|
15778
|
+
"...size": (val) => {
|
|
15779
|
+
let height = getSwitchHeight(val) + 4, width = getSwitchWidth(val) + 4;
|
|
15780
|
+
return {
|
|
15781
|
+
height,
|
|
15782
|
+
minHeight: height,
|
|
15783
|
+
width
|
|
15784
|
+
};
|
|
15785
|
+
}
|
|
15786
|
+
}
|
|
15787
|
+
},
|
|
15788
|
+
defaultVariants: {
|
|
15789
|
+
unstyled: !1
|
|
15790
|
+
}
|
|
15791
|
+
});
|
|
15792
|
+
}
|
|
15793
|
+
});
|
|
15794
|
+
|
|
15682
15795
|
// ../switch/dist/cjs/createSwitch.native.js
|
|
15683
15796
|
var require_createSwitch_native = __commonJS({
|
|
15684
15797
|
"../switch/dist/cjs/createSwitch.native.js"(exports, module2) {
|
|
@@ -15700,31 +15813,39 @@ var require_createSwitch_native = __commonJS({
|
|
|
15700
15813
|
mod
|
|
15701
15814
|
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createSwitch_exports = {};
|
|
15702
15815
|
__export2(createSwitch_exports, {
|
|
15703
|
-
SwitchContext: () => SwitchContext,
|
|
15704
15816
|
createSwitch: () => createSwitch
|
|
15705
15817
|
});
|
|
15706
15818
|
module2.exports = __toCommonJS2(createSwitch_exports);
|
|
15707
|
-
var import_compose_refs = require_index_native6(), import_core12 = require_index_native10(), import_focusable2 = require_index_native44(), import_get_token2 = require_index_native18(), import_label = require_index_native45(), import_use_controllable_state = require_index_native15(), import_use_previous = require_index_native46(), React2 = __toESM2(require("react")), import_react_native4 = require_fake_react_native(), import_jsx_runtime6 = (
|
|
15819
|
+
var import_compose_refs = require_index_native6(), import_core12 = require_index_native10(), import_focusable2 = require_index_native44(), import_get_token2 = require_index_native18(), import_label = require_index_native45(), import_use_controllable_state = require_index_native15(), import_use_previous = require_index_native46(), React2 = __toESM2(require("react")), import_react_native4 = require_fake_react_native(), import_Switch = require_Switch_native(), import_SwitchContext = require_SwitchContext_native(), import_jsx_runtime6 = (
|
|
15708
15820
|
// @ts-ignore
|
|
15709
15821
|
require("react/jsx-runtime")
|
|
15710
|
-
)
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15822
|
+
);
|
|
15823
|
+
function createSwitch({
|
|
15824
|
+
Frame = import_Switch.SwitchFrame,
|
|
15825
|
+
Thumb = import_Switch.SwitchThumb,
|
|
15826
|
+
acceptsUnstyled
|
|
15827
|
+
}) {
|
|
15828
|
+
Frame.staticConfig.context = import_SwitchContext.SwitchContext, Thumb.staticConfig.context = import_SwitchContext.SwitchContext;
|
|
15829
|
+
let SwitchThumbComponent = Thumb.styleable(function(props, forwardedRef) {
|
|
15830
|
+
let { size: sizeProp, unstyled: unstyledProp, ...thumbProps } = props, context = React2.useContext(import_SwitchContext.SwitchContext), {
|
|
15831
|
+
disabled,
|
|
15832
|
+
checked,
|
|
15833
|
+
unstyled: unstyledContext,
|
|
15834
|
+
frameWidth,
|
|
15835
|
+
size: sizeContext
|
|
15836
|
+
} = context, [thumbWidth, setThumbWidth] = React2.useState(0), initialChecked = React2.useRef(checked).current, distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
|
|
15720
15837
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
15721
15838
|
Thumb,
|
|
15722
15839
|
{
|
|
15723
|
-
|
|
15840
|
+
...(unstyledProp ?? unstyledContext ?? !1) === !1 && {
|
|
15841
|
+
unstyled: !1,
|
|
15842
|
+
size: sizeProp ?? sizeContext ?? "$true",
|
|
15843
|
+
theme: checked ? "active" : null
|
|
15844
|
+
},
|
|
15724
15845
|
"data-state": getState(checked),
|
|
15725
15846
|
"data-disabled": disabled ? "" : void 0,
|
|
15726
15847
|
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
15727
|
-
x
|
|
15848
|
+
x,
|
|
15728
15849
|
...thumbProps,
|
|
15729
15850
|
onLayout: (0, import_core12.composeEventHandlers)(
|
|
15730
15851
|
props.onLayout,
|
|
@@ -15737,8 +15858,8 @@ var require_createSwitch_native = __commonJS({
|
|
|
15737
15858
|
}
|
|
15738
15859
|
);
|
|
15739
15860
|
}), SwitchComponent = Frame.extractable(
|
|
15740
|
-
React2.forwardRef(function(propsIn, forwardedRef) {
|
|
15741
|
-
let styledContext = React2.useContext(SwitchContext), props = (0, import_core12.useProps)(propsIn), {
|
|
15861
|
+
React2.forwardRef(function SwitchFrame2(propsIn, forwardedRef) {
|
|
15862
|
+
let styledContext = React2.useContext(import_SwitchContext.SwitchContext), props = (0, import_core12.useProps)(propsIn), {
|
|
15742
15863
|
labeledBy: ariaLabelledby,
|
|
15743
15864
|
name,
|
|
15744
15865
|
checked: checkedProp,
|
|
@@ -15751,12 +15872,13 @@ var require_createSwitch_native = __commonJS({
|
|
|
15751
15872
|
unstyled = styledContext.unstyled ?? !1,
|
|
15752
15873
|
native: nativeProp,
|
|
15753
15874
|
nativeProps,
|
|
15875
|
+
children,
|
|
15754
15876
|
...switchProps
|
|
15755
15877
|
} = props, leftBorderWidth = (() => {
|
|
15756
15878
|
let _;
|
|
15757
15879
|
for (let key in switchProps)
|
|
15758
15880
|
(key === "borderWidth" || key === "borderLeftWidth") && (_ = switchProps[key]);
|
|
15759
|
-
return acceptsUnstyled && _
|
|
15881
|
+
return Frame === SwitchFrame2 && acceptsUnstyled && _ == null && unstyled === !1 && (_ = 2), typeof _ == "string" && (_ = (0, import_core12.getVariableValue)((0, import_get_token2.getSize)(_))), typeof _ == "number" ? _ : 0;
|
|
15760
15882
|
})(), native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !import_core12.isWeb && nativeProp === !0 || !import_core12.isWeb && native.includes("mobile") || native.includes("android") && import_react_native4.Platform.OS === "android" || native.includes("ios") && import_react_native4.Platform.OS === "ios", [button, setButton] = React2.useState(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (node) => setButton(node)), labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React2.useRef(!1), isFormControl = import_core12.isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React2.useState(0), [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
15761
15883
|
prop: checkedProp,
|
|
15762
15884
|
defaultProp: defaultChecked || !1,
|
|
@@ -15802,12 +15924,13 @@ var require_createSwitch_native = __commonJS({
|
|
|
15802
15924
|
setChecked((prevChecked) => !prevChecked), import_core12.isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
15803
15925
|
}),
|
|
15804
15926
|
onLayout: (0, import_core12.composeEventHandlers)(
|
|
15927
|
+
// @ts-ignore
|
|
15805
15928
|
props.onLayout,
|
|
15806
|
-
(e) =>
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
)
|
|
15929
|
+
(e) => {
|
|
15930
|
+
setFrameWidth(e.nativeEvent.layout.width);
|
|
15931
|
+
}
|
|
15932
|
+
),
|
|
15933
|
+
children: typeof children == "function" ? children(checked) : children
|
|
15811
15934
|
}
|
|
15812
15935
|
),
|
|
15813
15936
|
import_core12.isWeb && isFormControl && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
@@ -15861,15 +15984,15 @@ var require_createSwitch_native = __commonJS({
|
|
|
15861
15984
|
return checked ? "checked" : "unchecked";
|
|
15862
15985
|
}
|
|
15863
15986
|
return (0, import_core12.withStaticProperties)(SwitchComponent, {
|
|
15864
|
-
Thumb:
|
|
15987
|
+
Thumb: SwitchThumbComponent
|
|
15865
15988
|
});
|
|
15866
15989
|
}
|
|
15867
15990
|
}
|
|
15868
15991
|
});
|
|
15869
15992
|
|
|
15870
|
-
// ../switch/dist/cjs/
|
|
15871
|
-
var
|
|
15872
|
-
"../switch/dist/cjs/
|
|
15993
|
+
// ../switch/dist/cjs/index.native.js
|
|
15994
|
+
var require_index_native61 = __commonJS({
|
|
15995
|
+
"../switch/dist/cjs/index.native.js"(exports, module2) {
|
|
15873
15996
|
"use strict";
|
|
15874
15997
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
15875
15998
|
for (var name in all)
|
|
@@ -15879,98 +16002,19 @@ var require_Switch_native = __commonJS({
|
|
|
15879
16002
|
for (let key of __getOwnPropNames2(from))
|
|
15880
16003
|
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
15881
16004
|
return to;
|
|
15882
|
-
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Switch_exports = {};
|
|
15883
|
-
__export2(Switch_exports, {
|
|
15884
|
-
Switch: () => Switch,
|
|
15885
|
-
SwitchFrame: () => SwitchFrame,
|
|
15886
|
-
SwitchThumb: () => SwitchThumb
|
|
15887
|
-
});
|
|
15888
|
-
module2.exports = __toCommonJS2(Switch_exports);
|
|
15889
|
-
var import_core12 = require_index_native10(), import_get_token2 = require_index_native18(), import_stacks3 = require_index_native20(), import_createSwitch = require_createSwitch_native(), SwitchThumb = (0, import_core12.styled)(import_stacks3.ThemeableStack, {
|
|
15890
|
-
name: "SwitchThumb",
|
|
15891
|
-
context: import_createSwitch.SwitchContext,
|
|
15892
|
-
variants: {
|
|
15893
|
-
unstyled: {
|
|
15894
|
-
false: {
|
|
15895
|
-
size: "$true",
|
|
15896
|
-
backgroundColor: "$background",
|
|
15897
|
-
borderRadius: 1e3
|
|
15898
|
-
}
|
|
15899
|
-
},
|
|
15900
|
-
size: {
|
|
15901
|
-
"...size": (val) => {
|
|
15902
|
-
let size = getSwitchHeight(val);
|
|
15903
|
-
return {
|
|
15904
|
-
height: size,
|
|
15905
|
-
width: size
|
|
15906
|
-
};
|
|
15907
|
-
}
|
|
15908
|
-
}
|
|
15909
|
-
},
|
|
15910
|
-
defaultVariants: {
|
|
15911
|
-
unstyled: !1
|
|
15912
|
-
}
|
|
15913
|
-
}), getSwitchHeight = (val) => Math.round((0, import_core12.getVariableValue)((0, import_get_token2.getSize)(val)) * 0.65), getSwitchWidth = (val) => getSwitchHeight(val) * 2, SwitchFrame = (0, import_core12.styled)(import_stacks3.YStack, {
|
|
15914
|
-
name: "Switch",
|
|
15915
|
-
tag: "button",
|
|
15916
|
-
context: import_createSwitch.SwitchContext,
|
|
15917
|
-
variants: {
|
|
15918
|
-
unstyled: {
|
|
15919
|
-
false: {
|
|
15920
|
-
size: "$true",
|
|
15921
|
-
borderRadius: 1e3,
|
|
15922
|
-
borderWidth: 2,
|
|
15923
|
-
borderColor: "transparent",
|
|
15924
|
-
backgroundColor: "$background",
|
|
15925
|
-
focusStyle: {
|
|
15926
|
-
borderColor: "$borderColorFocus",
|
|
15927
|
-
outlineColor: "$borderColorFocus",
|
|
15928
|
-
outlineStyle: "solid",
|
|
15929
|
-
outlineWidth: 1
|
|
15930
|
-
}
|
|
15931
|
-
}
|
|
15932
|
-
},
|
|
15933
|
-
checked: {
|
|
15934
|
-
true: {}
|
|
15935
|
-
},
|
|
15936
|
-
frameWidth: {
|
|
15937
|
-
":number": () => null
|
|
15938
|
-
},
|
|
15939
|
-
size: {
|
|
15940
|
-
"...size": (val) => {
|
|
15941
|
-
let height = getSwitchHeight(val) + 4, width = getSwitchWidth(val) + 4;
|
|
15942
|
-
return {
|
|
15943
|
-
height,
|
|
15944
|
-
minHeight: height,
|
|
15945
|
-
width
|
|
15946
|
-
};
|
|
15947
|
-
}
|
|
15948
|
-
}
|
|
15949
|
-
},
|
|
15950
|
-
defaultVariants: {
|
|
15951
|
-
unstyled: !1
|
|
15952
|
-
}
|
|
15953
|
-
}), Switch = (0, import_createSwitch.createSwitch)({
|
|
15954
|
-
Frame: SwitchFrame,
|
|
15955
|
-
Thumb: SwitchThumb,
|
|
15956
|
-
acceptsUnstyled: !0
|
|
15957
|
-
});
|
|
15958
|
-
}
|
|
15959
|
-
});
|
|
15960
|
-
|
|
15961
|
-
// ../switch/dist/cjs/index.native.js
|
|
15962
|
-
var require_index_native61 = __commonJS({
|
|
15963
|
-
"../switch/dist/cjs/index.native.js"(exports, module2) {
|
|
15964
|
-
"use strict";
|
|
15965
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
|
|
15966
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
15967
|
-
for (let key of __getOwnPropNames2(from))
|
|
15968
|
-
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
15969
|
-
return to;
|
|
15970
16005
|
}, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
|
|
16006
|
+
__export2(src_exports2, {
|
|
16007
|
+
Switch: () => Switch
|
|
16008
|
+
});
|
|
15971
16009
|
module2.exports = __toCommonJS2(src_exports2);
|
|
16010
|
+
var import_createSwitch = require_createSwitch_native(), import_Switch = require_Switch_native();
|
|
15972
16011
|
__reExport2(src_exports2, require_Switch_native(), module2.exports);
|
|
15973
16012
|
__reExport2(src_exports2, require_createSwitch_native(), module2.exports);
|
|
16013
|
+
var Switch = (0, import_createSwitch.createSwitch)({
|
|
16014
|
+
Frame: import_Switch.SwitchFrame,
|
|
16015
|
+
Thumb: import_Switch.SwitchThumb,
|
|
16016
|
+
acceptsUnstyled: !0
|
|
16017
|
+
});
|
|
15974
16018
|
}
|
|
15975
16019
|
});
|
|
15976
16020
|
|