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/native.js
CHANGED
|
@@ -8174,7 +8174,7 @@ var require_themeable_native = __commonJS({
|
|
|
8174
8174
|
module2.exports = __toCommonJS2(themeable_exports);
|
|
8175
8175
|
var import_jsx_runtime6 = require("react/jsx-runtime"), import_react3 = __toESM2(require("react")), import_Theme = require_Theme_native();
|
|
8176
8176
|
function themeable3(Component, staticConfig) {
|
|
8177
|
-
var
|
|
8177
|
+
var optimize = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, withThemeComponent = function(props, ref) {
|
|
8178
8178
|
var { themeInverse, theme, componentName, themeReset, ...rest } = props, overriddenContextProps, context = staticConfig == null ? void 0 : staticConfig.context;
|
|
8179
8179
|
if (context) for (var key in context.props) {
|
|
8180
8180
|
var val = props[key];
|
|
@@ -8187,10 +8187,8 @@ var require_themeable_native = __commonJS({
|
|
|
8187
8187
|
...rest,
|
|
8188
8188
|
"data-disable-theme": !0
|
|
8189
8189
|
})
|
|
8190
|
-
), filteredProps =
|
|
8191
|
-
|
|
8192
|
-
};
|
|
8193
|
-
"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);
|
|
8190
|
+
), filteredProps = null, compName = componentName || (staticConfig == null ? void 0 : staticConfig.componentName);
|
|
8191
|
+
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;
|
|
8194
8192
|
var contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Theme.Theme, {
|
|
8195
8193
|
"disable-child-theme": !0,
|
|
8196
8194
|
...filteredProps,
|
|
@@ -8205,8 +8203,8 @@ var require_themeable_native = __commonJS({
|
|
|
8205
8203
|
});
|
|
8206
8204
|
}
|
|
8207
8205
|
return contents;
|
|
8208
|
-
}
|
|
8209
|
-
return withTheme.displayName = `Themed(${(Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Anonymous"})`, withTheme;
|
|
8206
|
+
}, withTheme = withThemeComponent;
|
|
8207
|
+
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);
|
|
8210
8208
|
}
|
|
8211
8209
|
}
|
|
8212
8210
|
});
|
|
@@ -9140,7 +9138,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
9140
9138
|
}
|
|
9141
9139
|
function styleable(Component2, options) {
|
|
9142
9140
|
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);
|
|
9143
|
-
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;
|
|
9141
|
+
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;
|
|
9144
9142
|
}
|
|
9145
9143
|
return res.extractable = extractable, res.styleable = styleable, res;
|
|
9146
9144
|
}
|
|
@@ -29386,80 +29384,20 @@ var require_useSwitch_native = __commonJS({
|
|
|
29386
29384
|
});
|
|
29387
29385
|
module2.exports = __toCommonJS2(useSwitch_exports);
|
|
29388
29386
|
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"));
|
|
29389
|
-
function getState(checked) {
|
|
29390
|
-
return checked ? "checked" : "unchecked";
|
|
29391
|
-
}
|
|
29392
|
-
var BubbleInput = function(props) {
|
|
29393
|
-
var { control, checked, bubbles = !0, ...inputProps } = props, ref = React4.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
29394
|
-
return React4.useEffect(function() {
|
|
29395
|
-
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
29396
|
-
if (prevChecked !== checked && setChecked) {
|
|
29397
|
-
var event = new Event("click", {
|
|
29398
|
-
bubbles
|
|
29399
|
-
});
|
|
29400
|
-
setChecked.call(input, checked), input.dispatchEvent(event);
|
|
29401
|
-
}
|
|
29402
|
-
}, [
|
|
29403
|
-
prevChecked,
|
|
29404
|
-
checked,
|
|
29405
|
-
bubbles
|
|
29406
|
-
]), // @ts-ignore
|
|
29407
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", {
|
|
29408
|
-
type: "checkbox",
|
|
29409
|
-
"aria-hidden": !0,
|
|
29410
|
-
defaultChecked: checked,
|
|
29411
|
-
...inputProps,
|
|
29412
|
-
tabIndex: -1,
|
|
29413
|
-
ref,
|
|
29414
|
-
style: {
|
|
29415
|
-
...props.style,
|
|
29416
|
-
position: "absolute",
|
|
29417
|
-
pointerEvents: "none",
|
|
29418
|
-
opacity: 0,
|
|
29419
|
-
margin: 0
|
|
29420
|
-
}
|
|
29421
|
-
});
|
|
29422
|
-
};
|
|
29423
29387
|
function useSwitch(props, param, ref) {
|
|
29424
|
-
var [checked, setChecked] = param
|
|
29388
|
+
var [checked, setChecked] = param;
|
|
29425
29389
|
return {
|
|
29426
29390
|
switchProps: {
|
|
29427
|
-
|
|
29428
|
-
"aria-checked": checked,
|
|
29429
|
-
...import_constants4.isWeb ? {
|
|
29430
|
-
tabIndex: disabled ? void 0 : 0,
|
|
29431
|
-
"data-state": getState(checked),
|
|
29432
|
-
"data-disabled": disabled ? "" : void 0,
|
|
29433
|
-
disabled
|
|
29434
|
-
} : {},
|
|
29435
|
-
...props,
|
|
29436
|
-
"aria-labelledby": ariaLabelledBy,
|
|
29437
|
-
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, function(event) {
|
|
29391
|
+
onPress() {
|
|
29438
29392
|
setChecked(function(prevChecked) {
|
|
29439
29393
|
return !prevChecked;
|
|
29440
|
-
})
|
|
29441
|
-
})
|
|
29442
|
-
},
|
|
29443
|
-
switchRef: composedRefs,
|
|
29444
|
-
/**
|
|
29445
|
-
* insert as a sibling of your switch (should not be inside the switch)
|
|
29446
|
-
*/
|
|
29447
|
-
bubbleInput: import_constants4.isWeb && isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BubbleInput, {
|
|
29448
|
-
control: button,
|
|
29449
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
29450
|
-
name,
|
|
29451
|
-
value,
|
|
29452
|
-
checked,
|
|
29453
|
-
required,
|
|
29454
|
-
disabled,
|
|
29455
|
-
// We transform because the input is absolutely positioned but we have
|
|
29456
|
-
// rendered it **after** the button. This pulls it back to sit on top
|
|
29457
|
-
// of the button.
|
|
29458
|
-
style: {
|
|
29459
|
-
transform: "translateX(-100%)"
|
|
29394
|
+
});
|
|
29460
29395
|
}
|
|
29461
|
-
}
|
|
29396
|
+
},
|
|
29397
|
+
switchRef: ref,
|
|
29398
|
+
bubbleInput: null
|
|
29462
29399
|
};
|
|
29400
|
+
var disabled, name, value, required, hasConsumerStoppedPropagationRef, button, setButton, composedRefs, isFormControl, labelId, ariaLabelledBy;
|
|
29463
29401
|
}
|
|
29464
29402
|
}
|
|
29465
29403
|
});
|
|
@@ -29747,7 +29685,6 @@ var require_createSwitch_native = __commonJS({
|
|
|
29747
29685
|
},
|
|
29748
29686
|
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
29749
29687
|
x,
|
|
29750
|
-
// TODO: remove ViewProps cast
|
|
29751
29688
|
onLayout: (0, import_core12.composeEventHandlers)(props.onLayout, function(e) {
|
|
29752
29689
|
return setThumbWidth(e.nativeEvent.layout.width);
|
|
29753
29690
|
}),
|
|
@@ -29762,17 +29699,9 @@ var require_createSwitch_native = __commonJS({
|
|
|
29762
29699
|
defaultProp: defaultChecked || !1,
|
|
29763
29700
|
onChange: onCheckedChange,
|
|
29764
29701
|
transition: !0
|
|
29765
|
-
}), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), [frameWidth, setFrameWidth] = React4.useState(0),
|
|
29766
|
-
noNormalize: !0,
|
|
29767
|
-
noExpand: !0,
|
|
29768
|
-
resolveValues: "none",
|
|
29769
|
-
forComponent: Frame
|
|
29770
|
-
}), _styledContext_size, _ref, _styledContext_unstyled, _ref1, { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
|
|
29702
|
+
}), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), [frameWidth, setFrameWidth] = React4.useState(0), { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
|
|
29771
29703
|
// @ts-ignore
|
|
29772
|
-
|
|
29773
|
-
size: (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true",
|
|
29774
|
-
unstyled: (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1
|
|
29775
|
-
}, propsActive),
|
|
29704
|
+
props,
|
|
29776
29705
|
[
|
|
29777
29706
|
checked,
|
|
29778
29707
|
setChecked
|
|
@@ -29782,8 +29711,8 @@ var require_createSwitch_native = __commonJS({
|
|
|
29782
29711
|
React4.useEffect(function() {
|
|
29783
29712
|
if (props.id && !props.disabled) return (0, import_focusable2.registerFocusable)(props.id, {
|
|
29784
29713
|
focusAndSelect: function() {
|
|
29785
|
-
setChecked == null || setChecked(function(
|
|
29786
|
-
return !
|
|
29714
|
+
setChecked == null || setChecked(function(value2) {
|
|
29715
|
+
return !value2;
|
|
29787
29716
|
});
|
|
29788
29717
|
},
|
|
29789
29718
|
focus: function() {
|
|
@@ -29794,16 +29723,28 @@ var require_createSwitch_native = __commonJS({
|
|
|
29794
29723
|
props.disabled
|
|
29795
29724
|
]);
|
|
29796
29725
|
var renderNative = (0, import_core12.shouldRenderNativePlatform)(native);
|
|
29797
|
-
|
|
29726
|
+
if (renderNative === "android" || renderNative === "ios") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.Switch, {
|
|
29798
29727
|
value: checked,
|
|
29799
29728
|
onValueChange: setChecked,
|
|
29800
29729
|
...nativeProps
|
|
29801
|
-
})
|
|
29802
|
-
|
|
29730
|
+
});
|
|
29731
|
+
var disabled = props.disabled, value = React4.useMemo(function() {
|
|
29732
|
+
return {
|
|
29803
29733
|
checked,
|
|
29804
|
-
disabled
|
|
29734
|
+
disabled,
|
|
29805
29735
|
frameWidth
|
|
29806
|
-
}
|
|
29736
|
+
};
|
|
29737
|
+
}, [
|
|
29738
|
+
checked,
|
|
29739
|
+
disabled,
|
|
29740
|
+
frameWidth
|
|
29741
|
+
]), handleLayout = React4.useCallback(function(e) {
|
|
29742
|
+
setFrameWidth(e.nativeEvent.layout.width);
|
|
29743
|
+
}, [
|
|
29744
|
+
setFrameWidth
|
|
29745
|
+
]), _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;
|
|
29746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SwitchContext.Provider, {
|
|
29747
|
+
value,
|
|
29807
29748
|
children: [
|
|
29808
29749
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Frame, {
|
|
29809
29750
|
ref: switchRef,
|
|
@@ -29811,6 +29752,11 @@ var require_createSwitch_native = __commonJS({
|
|
|
29811
29752
|
...import_core12.isWeb && {
|
|
29812
29753
|
type: "button"
|
|
29813
29754
|
},
|
|
29755
|
+
...!unstyled && {
|
|
29756
|
+
size: (_ref1 = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref1 !== void 0 ? _ref1 : "$true"
|
|
29757
|
+
},
|
|
29758
|
+
unstyled,
|
|
29759
|
+
...props,
|
|
29814
29760
|
...switchProps,
|
|
29815
29761
|
...!disableActiveTheme && !props.unstyled && {
|
|
29816
29762
|
theme: checked ? "active" : null,
|
|
@@ -29818,14 +29764,11 @@ var require_createSwitch_native = __commonJS({
|
|
|
29818
29764
|
},
|
|
29819
29765
|
// expected variants
|
|
29820
29766
|
checked,
|
|
29821
|
-
disabled
|
|
29822
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
29823
|
-
|
|
29824
|
-
|
|
29825
|
-
|
|
29826
|
-
setFrameWidth(e.nativeEvent.layout.width);
|
|
29827
|
-
},
|
|
29828
|
-
children: switchProps.children
|
|
29767
|
+
disabled,
|
|
29768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, {
|
|
29769
|
+
style: measureContainerStyle,
|
|
29770
|
+
onLayout: handleLayout,
|
|
29771
|
+
children: props.children
|
|
29829
29772
|
})
|
|
29830
29773
|
}),
|
|
29831
29774
|
bubbleInput
|
|
@@ -29838,6 +29781,10 @@ var require_createSwitch_native = __commonJS({
|
|
|
29838
29781
|
Thumb: SwitchThumbComponent
|
|
29839
29782
|
});
|
|
29840
29783
|
}
|
|
29784
|
+
var measureContainerStyle = {
|
|
29785
|
+
alignSelf: "stretch",
|
|
29786
|
+
flex: 1
|
|
29787
|
+
};
|
|
29841
29788
|
}
|
|
29842
29789
|
});
|
|
29843
29790
|
|