tamagui 1.123.10 → 1.123.11
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 +48 -101
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +48 -101
- package/dist/test.native.js.map +2 -2
- package/package.json +54 -54
package/dist/test.native.js
CHANGED
|
@@ -7727,7 +7727,7 @@ var require_themeable_native = __commonJS({
|
|
|
7727
7727
|
module2.exports = __toCommonJS2(themeable_exports);
|
|
7728
7728
|
var import_jsx_runtime6 = require("react/jsx-runtime"), import_react3 = __toESM2(require("react")), import_Theme = require_Theme_native();
|
|
7729
7729
|
function themeable3(Component, staticConfig) {
|
|
7730
|
-
var
|
|
7730
|
+
var optimize = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, withThemeComponent = function(props, ref) {
|
|
7731
7731
|
var { themeInverse, theme, componentName, themeReset, ...rest } = props, overriddenContextProps, context = staticConfig == null ? void 0 : staticConfig.context;
|
|
7732
7732
|
if (context) for (var key in context.props) {
|
|
7733
7733
|
var val = props[key];
|
|
@@ -7740,10 +7740,8 @@ var require_themeable_native = __commonJS({
|
|
|
7740
7740
|
...rest,
|
|
7741
7741
|
"data-disable-theme": !0
|
|
7742
7742
|
})
|
|
7743
|
-
), filteredProps =
|
|
7744
|
-
|
|
7745
|
-
};
|
|
7746
|
-
"debug" in props && (filteredProps.debug = props.debug), "theme" in props && (filteredProps.name = props.theme), "themeInverse" in props && (filteredProps.inverse = props.themeInverse), "themeReset" in props && (filteredProps.reset = themeReset);
|
|
7743
|
+
), filteredProps = null, compName = componentName || (staticConfig == null ? void 0 : staticConfig.componentName);
|
|
7744
|
+
if (compName && (filteredProps || (filteredProps = {}), filteredProps.componentName = compName), "debug" in props && (filteredProps || (filteredProps = {}), filteredProps.debug = props.debug), "theme" in props && (filteredProps || (filteredProps = {}), filteredProps.name = props.theme), "themeInverse" in props && (filteredProps || (filteredProps = {}), filteredProps.inverse = props.themeInverse), "themeReset" in props && (filteredProps || (filteredProps = {}), filteredProps.reset = themeReset), optimize && !filteredProps) return element;
|
|
7747
7745
|
var contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Theme.Theme, {
|
|
7748
7746
|
"disable-child-theme": !0,
|
|
7749
7747
|
...filteredProps,
|
|
@@ -7758,8 +7756,8 @@ var require_themeable_native = __commonJS({
|
|
|
7758
7756
|
});
|
|
7759
7757
|
}
|
|
7760
7758
|
return contents;
|
|
7761
|
-
}
|
|
7762
|
-
return withTheme.displayName = `Themed(${(Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Anonymous"})`, withTheme;
|
|
7759
|
+
}, withTheme = withThemeComponent;
|
|
7760
|
+
return withTheme.displayName = `Themed(${(Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Anonymous"})`, optimize ? withTheme : /* @__PURE__ */ import_react3.default.forwardRef(withTheme);
|
|
7763
7761
|
}
|
|
7764
7762
|
}
|
|
7765
7763
|
});
|
|
@@ -8533,7 +8531,7 @@ var require_createComponent_native = __commonJS({
|
|
|
8533
8531
|
}
|
|
8534
8532
|
function styleable(Component2, options) {
|
|
8535
8533
|
var _Component_render, isForwardedRefAlready = ((_Component_render = Component2.render) === null || _Component_render === void 0 ? void 0 : _Component_render.length) === 2, out = isForwardedRefAlready ? Component2 : /* @__PURE__ */ import_react3.default.forwardRef(Component2), extendedConfig = extendStyledConfig(options == null ? void 0 : options.staticConfig);
|
|
8536
|
-
return out = options != null && options.disableTheme ? out : (0, import_themeable.themeable)(out, extendedConfig), process.env.TAMAGUI_MEMOIZE_STYLEABLE && (out = /* @__PURE__ */ import_react3.default.memo(out)), out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
8534
|
+
return out = options != null && options.disableTheme ? out : (0, import_themeable.themeable)(out, extendedConfig, !0), process.env.TAMAGUI_MEMOIZE_STYLEABLE && (out = /* @__PURE__ */ import_react3.default.memo(out)), out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
8537
8535
|
}
|
|
8538
8536
|
return res.extractable = extractable, res.styleable = styleable, res;
|
|
8539
8537
|
}
|
|
@@ -28657,80 +28655,20 @@ var require_useSwitch_native = __commonJS({
|
|
|
28657
28655
|
});
|
|
28658
28656
|
module2.exports = __toCommonJS2(useSwitch_exports);
|
|
28659
28657
|
var import_jsx_runtime6 = require("react/jsx-runtime"), import_compose_refs = require_index_native12(), import_constants4 = require_index_native6(), import_helpers = require_index_native7(), import_label = require_index_native46(), import_use_previous = require_index_native47(), React4 = __toESM2(require("react"));
|
|
28660
|
-
function getState(checked) {
|
|
28661
|
-
return checked ? "checked" : "unchecked";
|
|
28662
|
-
}
|
|
28663
|
-
var BubbleInput = function(props) {
|
|
28664
|
-
var { control, checked, bubbles = !0, ...inputProps } = props, ref = React4.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
28665
|
-
return React4.useEffect(function() {
|
|
28666
|
-
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
28667
|
-
if (prevChecked !== checked && setChecked) {
|
|
28668
|
-
var event = new Event("click", {
|
|
28669
|
-
bubbles
|
|
28670
|
-
});
|
|
28671
|
-
setChecked.call(input, checked), input.dispatchEvent(event);
|
|
28672
|
-
}
|
|
28673
|
-
}, [
|
|
28674
|
-
prevChecked,
|
|
28675
|
-
checked,
|
|
28676
|
-
bubbles
|
|
28677
|
-
]), // @ts-ignore
|
|
28678
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", {
|
|
28679
|
-
type: "checkbox",
|
|
28680
|
-
"aria-hidden": !0,
|
|
28681
|
-
defaultChecked: checked,
|
|
28682
|
-
...inputProps,
|
|
28683
|
-
tabIndex: -1,
|
|
28684
|
-
ref,
|
|
28685
|
-
style: {
|
|
28686
|
-
...props.style,
|
|
28687
|
-
position: "absolute",
|
|
28688
|
-
pointerEvents: "none",
|
|
28689
|
-
opacity: 0,
|
|
28690
|
-
margin: 0
|
|
28691
|
-
}
|
|
28692
|
-
});
|
|
28693
|
-
};
|
|
28694
28658
|
function useSwitch(props, param, ref) {
|
|
28695
|
-
var [checked, setChecked] = param
|
|
28659
|
+
var [checked, setChecked] = param;
|
|
28696
28660
|
return {
|
|
28697
28661
|
switchProps: {
|
|
28698
|
-
|
|
28699
|
-
"aria-checked": checked,
|
|
28700
|
-
...import_constants4.isWeb ? {
|
|
28701
|
-
tabIndex: disabled ? void 0 : 0,
|
|
28702
|
-
"data-state": getState(checked),
|
|
28703
|
-
"data-disabled": disabled ? "" : void 0,
|
|
28704
|
-
disabled
|
|
28705
|
-
} : {},
|
|
28706
|
-
...props,
|
|
28707
|
-
"aria-labelledby": ariaLabelledBy,
|
|
28708
|
-
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, function(event) {
|
|
28662
|
+
onPress() {
|
|
28709
28663
|
setChecked(function(prevChecked) {
|
|
28710
28664
|
return !prevChecked;
|
|
28711
|
-
})
|
|
28712
|
-
})
|
|
28713
|
-
},
|
|
28714
|
-
switchRef: composedRefs,
|
|
28715
|
-
/**
|
|
28716
|
-
* insert as a sibling of your switch (should not be inside the switch)
|
|
28717
|
-
*/
|
|
28718
|
-
bubbleInput: import_constants4.isWeb && isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BubbleInput, {
|
|
28719
|
-
control: button,
|
|
28720
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
28721
|
-
name,
|
|
28722
|
-
value,
|
|
28723
|
-
checked,
|
|
28724
|
-
required,
|
|
28725
|
-
disabled,
|
|
28726
|
-
// We transform because the input is absolutely positioned but we have
|
|
28727
|
-
// rendered it **after** the button. This pulls it back to sit on top
|
|
28728
|
-
// of the button.
|
|
28729
|
-
style: {
|
|
28730
|
-
transform: "translateX(-100%)"
|
|
28665
|
+
});
|
|
28731
28666
|
}
|
|
28732
|
-
}
|
|
28667
|
+
},
|
|
28668
|
+
switchRef: ref,
|
|
28669
|
+
bubbleInput: null
|
|
28733
28670
|
};
|
|
28671
|
+
var disabled, name, value, required, hasConsumerStoppedPropagationRef, button, setButton, composedRefs, isFormControl, labelId, ariaLabelledBy;
|
|
28734
28672
|
}
|
|
28735
28673
|
}
|
|
28736
28674
|
});
|
|
@@ -29018,7 +28956,6 @@ var require_createSwitch_native = __commonJS({
|
|
|
29018
28956
|
},
|
|
29019
28957
|
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
29020
28958
|
x,
|
|
29021
|
-
// TODO: remove ViewProps cast
|
|
29022
28959
|
onLayout: (0, import_core12.composeEventHandlers)(props.onLayout, function(e) {
|
|
29023
28960
|
return setThumbWidth(e.nativeEvent.layout.width);
|
|
29024
28961
|
}),
|
|
@@ -29033,17 +28970,9 @@ var require_createSwitch_native = __commonJS({
|
|
|
29033
28970
|
defaultProp: defaultChecked || !1,
|
|
29034
28971
|
onChange: onCheckedChange,
|
|
29035
28972
|
transition: !0
|
|
29036
|
-
}), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), [frameWidth, setFrameWidth] = React4.useState(0),
|
|
29037
|
-
noNormalize: !0,
|
|
29038
|
-
noExpand: !0,
|
|
29039
|
-
resolveValues: "none",
|
|
29040
|
-
forComponent: Frame
|
|
29041
|
-
}), _styledContext_size, _ref, _styledContext_unstyled, _ref1, { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
|
|
28973
|
+
}), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), [frameWidth, setFrameWidth] = React4.useState(0), { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
|
|
29042
28974
|
// @ts-ignore
|
|
29043
|
-
|
|
29044
|
-
size: (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true",
|
|
29045
|
-
unstyled: (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1
|
|
29046
|
-
}, propsActive),
|
|
28975
|
+
props,
|
|
29047
28976
|
[
|
|
29048
28977
|
checked,
|
|
29049
28978
|
setChecked
|
|
@@ -29053,8 +28982,8 @@ var require_createSwitch_native = __commonJS({
|
|
|
29053
28982
|
React4.useEffect(function() {
|
|
29054
28983
|
if (props.id && !props.disabled) return (0, import_focusable2.registerFocusable)(props.id, {
|
|
29055
28984
|
focusAndSelect: function() {
|
|
29056
|
-
setChecked == null || setChecked(function(
|
|
29057
|
-
return !
|
|
28985
|
+
setChecked == null || setChecked(function(value2) {
|
|
28986
|
+
return !value2;
|
|
29058
28987
|
});
|
|
29059
28988
|
},
|
|
29060
28989
|
focus: function() {
|
|
@@ -29065,16 +28994,28 @@ var require_createSwitch_native = __commonJS({
|
|
|
29065
28994
|
props.disabled
|
|
29066
28995
|
]);
|
|
29067
28996
|
var renderNative = (0, import_core12.shouldRenderNativePlatform)(native);
|
|
29068
|
-
|
|
28997
|
+
if (renderNative === "android" || renderNative === "ios") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.Switch, {
|
|
29069
28998
|
value: checked,
|
|
29070
28999
|
onValueChange: setChecked,
|
|
29071
29000
|
...nativeProps
|
|
29072
|
-
})
|
|
29073
|
-
|
|
29001
|
+
});
|
|
29002
|
+
var disabled = props.disabled, value = React4.useMemo(function() {
|
|
29003
|
+
return {
|
|
29074
29004
|
checked,
|
|
29075
|
-
disabled
|
|
29005
|
+
disabled,
|
|
29076
29006
|
frameWidth
|
|
29077
|
-
}
|
|
29007
|
+
};
|
|
29008
|
+
}, [
|
|
29009
|
+
checked,
|
|
29010
|
+
disabled,
|
|
29011
|
+
frameWidth
|
|
29012
|
+
]), handleLayout = React4.useCallback(function(e) {
|
|
29013
|
+
setFrameWidth(e.nativeEvent.layout.width);
|
|
29014
|
+
}, [
|
|
29015
|
+
setFrameWidth
|
|
29016
|
+
]), _styledContext_unstyled, _ref, unstyled = (_ref = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref !== void 0 ? _ref : !1, _styledContext_size, _ref1;
|
|
29017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SwitchContext.Provider, {
|
|
29018
|
+
value,
|
|
29078
29019
|
children: [
|
|
29079
29020
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Frame, {
|
|
29080
29021
|
ref: switchRef,
|
|
@@ -29082,6 +29023,11 @@ var require_createSwitch_native = __commonJS({
|
|
|
29082
29023
|
...import_core12.isWeb && {
|
|
29083
29024
|
type: "button"
|
|
29084
29025
|
},
|
|
29026
|
+
...!unstyled && {
|
|
29027
|
+
size: (_ref1 = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref1 !== void 0 ? _ref1 : "$true"
|
|
29028
|
+
},
|
|
29029
|
+
unstyled,
|
|
29030
|
+
...props,
|
|
29085
29031
|
...switchProps,
|
|
29086
29032
|
...!disableActiveTheme && !props.unstyled && {
|
|
29087
29033
|
theme: checked ? "active" : null,
|
|
@@ -29089,14 +29035,11 @@ var require_createSwitch_native = __commonJS({
|
|
|
29089
29035
|
},
|
|
29090
29036
|
// expected variants
|
|
29091
29037
|
checked,
|
|
29092
|
-
disabled
|
|
29093
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
setFrameWidth(e.nativeEvent.layout.width);
|
|
29098
|
-
},
|
|
29099
|
-
children: switchProps.children
|
|
29038
|
+
disabled,
|
|
29039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, {
|
|
29040
|
+
style: measureContainerStyle,
|
|
29041
|
+
onLayout: handleLayout,
|
|
29042
|
+
children: props.children
|
|
29100
29043
|
})
|
|
29101
29044
|
}),
|
|
29102
29045
|
bubbleInput
|
|
@@ -29109,6 +29052,10 @@ var require_createSwitch_native = __commonJS({
|
|
|
29109
29052
|
Thumb: SwitchThumbComponent
|
|
29110
29053
|
});
|
|
29111
29054
|
}
|
|
29055
|
+
var measureContainerStyle = {
|
|
29056
|
+
alignSelf: "stretch",
|
|
29057
|
+
flex: 1
|
|
29058
|
+
};
|
|
29112
29059
|
}
|
|
29113
29060
|
});
|
|
29114
29061
|
|