@tamagui/toggle-group 1.135.4 → 1.135.6

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.
@@ -1,98 +1,143 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { composeEventHandlers } from "@tamagui/helpers";
3
- import { ThemeableStack } from "@tamagui/stacks";
4
- import { useControllableState } from "@tamagui/use-controllable-state";
5
- import { createStyledContext, styled } from "@tamagui/web";
6
- import * as React from "react";
7
- var context = createStyledContext({
8
- color: ""
9
- }), NAME = "Toggle", ToggleFrame = styled(ThemeableStack, {
10
- name: NAME,
11
- tag: "button",
12
- context,
13
- variants: {
14
- unstyled: {
15
- false: {
16
- pressTheme: !0,
17
- backgroundColor: "$background",
18
- alignItems: "center",
19
- justifyContent: "center",
20
- display: "flex",
21
- borderColor: "$borderColor",
22
- borderWidth: 1,
23
- margin: -1,
24
- hoverStyle: {
25
- backgroundColor: "$backgroundHover"
26
- },
27
- pressStyle: {
28
- backgroundColor: "$backgroundPress"
29
- },
30
- focusStyle: {
31
- borderColor: "$borderColorFocus"
32
- },
33
- focusVisibleStyle: {
34
- outlineColor: "$outlineColor",
35
- outlineWidth: 2,
36
- outlineStyle: "solid"
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var Toggle_exports = {};
35
+ __export(Toggle_exports, {
36
+ Toggle: () => Toggle,
37
+ ToggleFrame: () => ToggleFrame,
38
+ context: () => context
39
+ });
40
+ module.exports = __toCommonJS(Toggle_exports);
41
+ var import_jsx_runtime = require("react/jsx-runtime"),
42
+ import_helpers = require("@tamagui/helpers"),
43
+ import_stacks = require("@tamagui/stacks"),
44
+ import_use_controllable_state = require("@tamagui/use-controllable-state"),
45
+ import_web = require("@tamagui/web"),
46
+ React = __toESM(require("react"), 1),
47
+ context = (0, import_web.createStyledContext)({
48
+ color: ""
49
+ }),
50
+ NAME = "Toggle",
51
+ ToggleFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
52
+ name: NAME,
53
+ tag: "button",
54
+ context,
55
+ variants: {
56
+ unstyled: {
57
+ false: {
58
+ pressTheme: !0,
59
+ backgroundColor: "$background",
60
+ alignItems: "center",
61
+ justifyContent: "center",
62
+ display: "flex",
63
+ borderColor: "$borderColor",
64
+ borderWidth: 1,
65
+ margin: -1,
66
+ hoverStyle: {
67
+ backgroundColor: "$backgroundHover"
68
+ },
69
+ pressStyle: {
70
+ backgroundColor: "$backgroundPress"
71
+ },
72
+ focusStyle: {
73
+ borderColor: "$borderColorFocus"
74
+ },
75
+ focusVisibleStyle: {
76
+ outlineColor: "$outlineColor",
77
+ outlineWidth: 2,
78
+ outlineStyle: "solid"
79
+ }
37
80
  }
38
- }
39
- },
40
- color: {
41
- "...color": function() {
42
- return {};
43
- }
44
- },
45
- active: {
46
- true: {
47
- zIndex: 1,
48
- hoverStyle: {
49
- backgroundColor: "$background"
81
+ },
82
+ color: {
83
+ "...color": function () {
84
+ return {};
85
+ }
86
+ },
87
+ active: {
88
+ true: {
89
+ zIndex: 1,
90
+ hoverStyle: {
91
+ backgroundColor: "$background"
92
+ },
93
+ focusStyle: {
94
+ borderColor: "$borderColor",
95
+ backgroundColor: "$background"
96
+ }
97
+ }
98
+ },
99
+ orientation: {
100
+ horizontal: {
101
+ flexDirection: "row",
102
+ spaceDirection: "horizontal"
50
103
  },
51
- focusStyle: {
52
- borderColor: "$borderColor",
53
- backgroundColor: "$background"
104
+ vertical: {
105
+ flexDirection: "column",
106
+ spaceDirection: "vertical"
54
107
  }
55
108
  }
56
109
  },
57
- orientation: {
58
- horizontal: {
59
- flexDirection: "row",
60
- spaceDirection: "horizontal"
61
- },
62
- vertical: {
63
- flexDirection: "column",
64
- spaceDirection: "vertical"
65
- }
110
+ defaultVariants: {
111
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
66
112
  }
67
- },
68
- defaultVariants: {
69
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
70
- }
71
- }), Toggle = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
72
- var { pressed: pressedProp, defaultPressed = !1, onPressedChange, ...buttonProps } = props, [pressed = !1, setPressed] = useControllableState({
73
- prop: pressedProp,
74
- onChange: onPressedChange,
75
- defaultProp: defaultPressed
76
- }), _props_onPress;
77
- return /* @__PURE__ */ _jsx(ToggleFrame, {
78
- ...!props.unstyled && {
79
- theme: pressed ? "active" : null,
80
- themeShallow: !0
81
- },
82
- active: props.unstyled ? void 0 : pressed,
83
- "aria-pressed": pressed,
84
- "data-state": pressed ? "on" : "off",
85
- "data-disabled": props.disabled ? "" : void 0,
86
- ...buttonProps,
87
- ref: forwardedRef,
88
- onPress: composeEventHandlers((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {
89
- props.disabled || setPressed(!pressed);
90
- })
113
+ }),
114
+ Toggle = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
115
+ var {
116
+ pressed: pressedProp,
117
+ defaultPressed = !1,
118
+ onPressedChange,
119
+ ...buttonProps
120
+ } = props,
121
+ [pressed = !1, setPressed] = (0, import_use_controllable_state.useControllableState)({
122
+ prop: pressedProp,
123
+ onChange: onPressedChange,
124
+ defaultProp: defaultPressed
125
+ }),
126
+ _props_onPress;
127
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleFrame, {
128
+ ...(!props.unstyled && {
129
+ theme: pressed ? "active" : null,
130
+ themeShallow: !0
131
+ }),
132
+ active: props.unstyled ? void 0 : pressed,
133
+ "aria-pressed": pressed,
134
+ "data-state": pressed ? "on" : "off",
135
+ "data-disabled": props.disabled ? "" : void 0,
136
+ ...buttonProps,
137
+ ref: forwardedRef,
138
+ onPress: (0, import_helpers.composeEventHandlers)((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function () {
139
+ props.disabled || setPressed(!pressed);
140
+ })
141
+ });
91
142
  });
92
- });
93
- export {
94
- Toggle,
95
- ToggleFrame,
96
- context
97
- };
98
- //# sourceMappingURL=Toggle.js.map
143
+ //# sourceMappingURL=Toggle.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Toggle.tsx"],
4
- "mappings": "AAAA,SAAS,OAAO,YAAY;AAC5B,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB,cAAc;AAC5C,YAAY,WAAW;AAChB,IAAI,UAAU,oBAAoB;AAAA,EACrC,OAAO;AACX,CAAC,GAGwG,OAAO,UACrG,cAAc,OAAO,gBAAgB;AAAA,EAC5C,MAAM;AAAA,EACN,KAAK;AAAA,EACL;AAAA,EACA,UAAU;AAAA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C,MAAM,YAAY;AAAA,MAClB,OAAO,UAAU,WAAW;AAAA,MAC5B,cAAc;AAAA,IAClB;AAAA,IACA,QAAS,MAAM,WAAqB,SAAV;AAAA,IAC1B,gBAAgB;AAAA,IAChB,cAAc,UAAU,OAAO;AAAA,IAC/B,iBAAiB,MAAM,WAAW,KAAK;AAAA,IACvC,GAAG;AAAA,IACH,KAAK;AAAA,IACL,SAAS,sBAAsB,iBAAiB,MAAM,aAAa,QAAQ,mBAAmB,SAAS,iBAAiB,QAAW,WAAW;AAC1I,MAAK,MAAM,YACP,WAAW,CAAC,OAAO;AAAA,IAE3B,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
5
- "names": []
6
- }
1
+ {"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","Toggle_exports","Toggle","ToggleFrame","context","module","exports","import_jsx_runtime","require","import_helpers","import_stacks","import_use_controllable_state","import_web","React","createStyledContext","color","NAME","styled","ThemeableStack","tag","variants","unstyled","false","pressTheme","backgroundColor","alignItems","justifyContent","display","borderColor","borderWidth","margin","hoverStyle","pressStyle","focusStyle","focusVisibleStyle","outlineColor","outlineWidth","outlineStyle","...color","active","true","zIndex","orientation","horizontal","flexDirection","spaceDirection","vertical","defaultVariants","process","env","TAMAGUI_HEADLESS","forwardRef","props","forwardedRef","pressed","pressedProp","defaultPressed","onPressedChange","buttonProps","setPressed","useControllableState","prop","onChange","defaultProp","_props_onPress"],"sources":["../../src/Toggle.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,QAAS,GAAAC,MAAA,CAAAC,MAAA;AACT,IAAAC,SAAS,GAAAF,MAAA,CAAAG,cAA4B;AAErC,IAAAC,gBAAS,GAAAJ,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