@tamagui/checkbox 1.89.26 → 1.89.27-1708112217600
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/cjs/Checkbox.native.js +7 -5
- package/dist/cjs/Checkbox.native.js.map +3 -3
- package/dist/cjs/CheckboxStyledContext.native.js +1 -2
- package/dist/cjs/CheckboxStyledContext.native.js.map +3 -3
- package/dist/cjs/createCheckbox.native.js +189 -107
- package/dist/cjs/createCheckbox.native.js.map +3 -3
- package/dist/cjs/index.native.js +1 -1
- package/dist/cjs/index.native.js.map +3 -3
- package/dist/esm/Checkbox.native.js +7 -4
- package/dist/esm/Checkbox.native.js.map +3 -3
- package/dist/esm/CheckboxStyledContext.native.js +1 -1
- package/dist/esm/CheckboxStyledContext.native.js.map +3 -3
- package/dist/esm/createCheckbox.native.js +189 -114
- package/dist/esm/createCheckbox.native.js.map +3 -3
- package/dist/esm/index.native.js +1 -1
- package/dist/esm/index.native.js.map +3 -3
- package/dist/jsx/Checkbox.native.js +7 -4
- package/dist/jsx/Checkbox.native.js.map +3 -3
- package/dist/jsx/CheckboxStyledContext.native.js +1 -1
- package/dist/jsx/CheckboxStyledContext.native.js.map +3 -3
- package/dist/jsx/createCheckbox.native.js +189 -114
- package/dist/jsx/createCheckbox.native.js.map +3 -3
- package/dist/jsx/index.native.js +1 -1
- package/dist/jsx/index.native.js.map +3 -3
- package/package.json +16 -16
|
@@ -19,8 +19,7 @@ __export(Checkbox_exports, {
|
|
|
19
19
|
CheckboxIndicatorFrame: () => CheckboxIndicatorFrame
|
|
20
20
|
});
|
|
21
21
|
module.exports = __toCommonJS(Checkbox_exports);
|
|
22
|
-
var import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_stacks = require("@tamagui/stacks"), import_CheckboxStyledContext = require("./CheckboxStyledContext")
|
|
23
|
-
const INDICATOR_NAME = "CheckboxIndicator", CheckboxIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
22
|
+
var import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_stacks = require("@tamagui/stacks"), import_CheckboxStyledContext = require("./CheckboxStyledContext"), INDICATOR_NAME = "CheckboxIndicator", CheckboxIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
24
23
|
// use Checkbox for easier themes
|
|
25
24
|
name: INDICATOR_NAME,
|
|
26
25
|
context: import_CheckboxStyledContext.CheckboxStyledContext,
|
|
@@ -77,9 +76,12 @@ const INDICATOR_NAME = "CheckboxIndicator", CheckboxIndicatorFrame = (0, import_
|
|
|
77
76
|
}
|
|
78
77
|
},
|
|
79
78
|
size: {
|
|
80
|
-
"...size": (val,
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
"...size": function(val, param) {
|
|
80
|
+
var tokens = param.tokens, radiusToken = (0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) / 8;
|
|
81
|
+
return {
|
|
82
|
+
borderRadius: radiusToken
|
|
83
|
+
};
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
87
|
defaultVariants: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Checkbox.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox/src/Checkbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;;AAGA,kBAAyC,0BACzC,mBAAwB,+BACxB,gBAA+B,4BAE/B,+BAAsC,oCAKhCA,iBAAiB,qBAEVC,6BAAyBC,oBAAOC,8BAAgB;;EAE3DC,MAAMJ;EACNK,SAASC;EACTC,UAAU;IACRC,UAAU;MACRC,OAAO,CAAC;IACV;EACF;EACAC,iBAAiB;IACfF,UAAUG,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAMMC,gBAAgB,YAETC,oBAAgBb,oBAAOC,8BAAgB;EAClDC,MAAMU;EACNE,KAAK;EAELX,SAASC;EACTC,UAAU;IACRC,UAAU;MACRC,OAAO;QACLQ,MAAM;QACNC,iBAAiB;QACjBC,YAAY;QACZC,gBAAgB;QAChBC,YAAY;QACZC,WAAW;QACXC,aAAa;QACbC,aAAa;QAEbC,YAAY;UACVD,aAAa;QACf;QAEAE,YAAY;UACVF,aAAa;UACbG,cAAc;UACdC,cAAc;UACdC,cAAc;QAChB;MACF;IACF;IAEAC,UAAU;MACRC,MAAM;QACJC,eAAe;QACfC,YAAY;QACZC,QAAQ;QAERT,YAAY;UACVD,aAAa;UACbN,iBAAiB;QACnB;QAEAiB,YAAY;UACVX,aAAa;UACbN,iBAAiB;QACnB;QAEAQ,YAAY;UACVE,cAAc;QAChB;MACF;IACF;IAEAX,MAAM;MACJ,WAAW,SAACmB,KAAAA,OAAAA;YAAOC,SAAAA,MAAAA,QACXC,kBAAcC,kCAAiBC,0BAAQJ,GAAAA,CAAAA,IAAQ;AACrD,eAAO;UACLK,cAAcH;QAChB;MACF;IACF;EACF;EAEA5B,iBAAiB;IACfF,UAAUG,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA;",
|
|
5
|
+
"names": ["INDICATOR_NAME", "CheckboxIndicatorFrame", "styled", "ThemeableStack", "name", "context", "CheckboxStyledContext", "variants", "unstyled", "false", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "CHECKBOX_NAME", "CheckboxFrame", "tag", "size", "backgroundColor", "alignItems", "justifyContent", "pressTheme", "focusable", "borderWidth", "borderColor", "hoverStyle", "focusStyle", "outlineStyle", "outlineWidth", "outlineColor", "disabled", "true", "pointerEvents", "userSelect", "cursor", "pressStyle", "val", "tokens", "radiusToken", "getVariableValue", "getSize", "borderRadius"]
|
|
6
6
|
}
|
|
@@ -18,8 +18,7 @@ __export(CheckboxStyledContext_exports, {
|
|
|
18
18
|
CheckboxStyledContext: () => CheckboxStyledContext
|
|
19
19
|
});
|
|
20
20
|
module.exports = __toCommonJS(CheckboxStyledContext_exports);
|
|
21
|
-
var import_core = require("@tamagui/core")
|
|
22
|
-
const CheckboxStyledContext = (0, import_core.createStyledContext)({
|
|
21
|
+
var import_core = require("@tamagui/core"), CheckboxStyledContext = (0, import_core.createStyledContext)({
|
|
23
22
|
size: "$true",
|
|
24
23
|
scaleIcon: 1
|
|
25
24
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/CheckboxStyledContext.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox/src/CheckboxStyledContext.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AACA;;;;;kBAAoC,0BAEvBA,4BAAwBC,iCAAoB;EACvDC,MAAM;EACNC,WAAW;AACb,CAAA;",
|
|
5
|
+
"names": ["CheckboxStyledContext", "createStyledContext", "size", "scaleIcon"]
|
|
6
6
|
}
|
|
@@ -27,122 +27,204 @@ __export(createCheckbox_exports, {
|
|
|
27
27
|
createCheckbox: () => createCheckbox
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(createCheckbox_exports);
|
|
30
|
-
var import_checkbox_headless = require("@tamagui/checkbox-headless"), import_core = require("@tamagui/core"), import_font_size = require("@tamagui/font-size"), import_get_token = require("@tamagui/get-token"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_react = __toESM(require("react")), import_Checkbox = require("./Checkbox"), import_CheckboxStyledContext = require("./CheckboxStyledContext")
|
|
31
|
-
|
|
30
|
+
var import_checkbox_headless = require("@tamagui/checkbox-headless"), import_core = require("@tamagui/core"), import_font_size = require("@tamagui/font-size"), import_get_token = require("@tamagui/get-token"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_react = __toESM(require("react")), import_Checkbox = require("./Checkbox"), import_CheckboxStyledContext = require("./CheckboxStyledContext");
|
|
31
|
+
function _array_like_to_array(arr, len) {
|
|
32
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
33
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
34
|
+
arr2[i] = arr[i];
|
|
35
|
+
return arr2;
|
|
36
|
+
}
|
|
37
|
+
function _array_with_holes(arr) {
|
|
38
|
+
if (Array.isArray(arr))
|
|
39
|
+
return arr;
|
|
40
|
+
}
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
43
|
+
value,
|
|
44
|
+
enumerable: !0,
|
|
45
|
+
configurable: !0,
|
|
46
|
+
writable: !0
|
|
47
|
+
}) : obj[key] = value, obj;
|
|
48
|
+
}
|
|
49
|
+
function _iterable_to_array_limit(arr, i) {
|
|
50
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
51
|
+
if (_i != null) {
|
|
52
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
53
|
+
try {
|
|
54
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
55
|
+
;
|
|
56
|
+
} catch (err) {
|
|
57
|
+
_d = !0, _e = err;
|
|
58
|
+
} finally {
|
|
59
|
+
try {
|
|
60
|
+
!_n && _i.return != null && _i.return();
|
|
61
|
+
} finally {
|
|
62
|
+
if (_d)
|
|
63
|
+
throw _e;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return _arr;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function _non_iterable_rest() {
|
|
70
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
+
}
|
|
72
|
+
function _object_spread(target) {
|
|
73
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
74
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
75
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
76
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
77
|
+
}))), ownKeys2.forEach(function(key) {
|
|
78
|
+
_define_property(target, key, source[key]);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
function ownKeys(object, enumerableOnly) {
|
|
84
|
+
var keys = Object.keys(object);
|
|
85
|
+
if (Object.getOwnPropertySymbols) {
|
|
86
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
87
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
88
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
89
|
+
})), keys.push.apply(keys, symbols);
|
|
90
|
+
}
|
|
91
|
+
return keys;
|
|
92
|
+
}
|
|
93
|
+
function _object_spread_props(target, source) {
|
|
94
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
95
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
96
|
+
}), target;
|
|
97
|
+
}
|
|
98
|
+
function _object_without_properties(source, excluded) {
|
|
99
|
+
if (source == null)
|
|
100
|
+
return {};
|
|
101
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
102
|
+
if (Object.getOwnPropertySymbols) {
|
|
103
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
104
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
105
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
106
|
+
}
|
|
107
|
+
return target;
|
|
108
|
+
}
|
|
109
|
+
function _object_without_properties_loose(source, excluded) {
|
|
110
|
+
if (source == null)
|
|
111
|
+
return {};
|
|
112
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
113
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
114
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
115
|
+
return target;
|
|
116
|
+
}
|
|
117
|
+
function _sliced_to_array(arr, i) {
|
|
118
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
119
|
+
}
|
|
120
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
121
|
+
if (o) {
|
|
122
|
+
if (typeof o == "string")
|
|
123
|
+
return _array_like_to_array(o, minLen);
|
|
124
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
125
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
126
|
+
return Array.from(n);
|
|
127
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
128
|
+
return _array_like_to_array(o, minLen);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
32
132
|
checked: !1,
|
|
33
133
|
disabled: !1
|
|
34
|
-
}), ensureContext = (x)
|
|
134
|
+
}), ensureContext = function(x) {
|
|
35
135
|
x.context || (x.context = CheckboxContext);
|
|
36
136
|
};
|
|
37
137
|
function createCheckbox(createProps) {
|
|
38
|
-
|
|
39
|
-
disableActiveTheme,
|
|
40
|
-
Frame = import_Checkbox.CheckboxFrame,
|
|
41
|
-
Indicator = import_Checkbox.CheckboxIndicatorFrame
|
|
42
|
-
} = createProps;
|
|
138
|
+
var disableActiveTheme = createProps.disableActiveTheme, _createProps_Frame = createProps.Frame, Frame = _createProps_Frame === void 0 ? import_Checkbox.CheckboxFrame : _createProps_Frame, _createProps_Indicator = createProps.Indicator, Indicator = _createProps_Indicator === void 0 ? import_Checkbox.CheckboxIndicatorFrame : _createProps_Indicator;
|
|
43
139
|
ensureContext(Frame), ensureContext(Indicator);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
shift: sizeAdjust
|
|
61
|
-
})
|
|
62
|
-
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
63
|
-
const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
64
|
-
prop: checkedProp,
|
|
65
|
-
defaultProp: defaultChecked,
|
|
66
|
-
onChange: onCheckedChange
|
|
67
|
-
}), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
propsActive,
|
|
70
|
-
[checked, setChecked],
|
|
71
|
-
forwardedRef
|
|
72
|
-
);
|
|
73
|
-
return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
-
"input",
|
|
75
|
-
{
|
|
76
|
-
type: "checkbox",
|
|
77
|
-
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
|
|
78
|
-
tabIndex: -1,
|
|
79
|
-
ref: checkboxRef,
|
|
80
|
-
disabled: checkboxProps.disabled,
|
|
81
|
-
style: {
|
|
82
|
-
appearance: "auto",
|
|
83
|
-
accentColor: "var(--color6)",
|
|
84
|
-
...checkboxProps.style
|
|
85
|
-
// TODO: any
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
CheckboxContext.Provider,
|
|
90
|
-
{
|
|
91
|
-
value: {
|
|
92
|
-
checked,
|
|
93
|
-
disabled: checkboxProps.disabled
|
|
94
|
-
},
|
|
95
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
96
|
-
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
97
|
-
{
|
|
98
|
-
size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
|
|
99
|
-
scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
|
|
100
|
-
children: [
|
|
101
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
|
-
Frame,
|
|
103
|
-
{
|
|
104
|
-
...!unstyled && {
|
|
105
|
-
width: size,
|
|
106
|
-
height: size
|
|
107
|
-
},
|
|
108
|
-
tag: "button",
|
|
109
|
-
ref: checkboxRef,
|
|
110
|
-
...unstyled === !1 && {
|
|
111
|
-
size,
|
|
112
|
-
theme: checked ? "active" : null
|
|
113
|
-
},
|
|
114
|
-
checked,
|
|
115
|
-
disabled: checkboxProps.disabled,
|
|
116
|
-
...checkboxProps,
|
|
117
|
-
children: propsActive.children
|
|
118
|
-
}
|
|
119
|
-
),
|
|
120
|
-
bubbleInput
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
);
|
|
140
|
+
var FrameComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
141
|
+
var _props_scaleSize = _props.scaleSize, scaleSize = _props_scaleSize === void 0 ? 0.45 : _props_scaleSize, _props_sizeAdjust = _props.sizeAdjust, sizeAdjust = _props_sizeAdjust === void 0 ? 0 : _props_sizeAdjust, scaleIcon = _props.scaleIcon, checkedProp = _props.checked, defaultChecked = _props.defaultChecked, onCheckedChange = _props.onCheckedChange, native = _props.native, _props_unstyled = _props.unstyled, unstyled = _props_unstyled === void 0 ? !1 : _props_unstyled, props = _object_without_properties(_props, [
|
|
142
|
+
"scaleSize",
|
|
143
|
+
"sizeAdjust",
|
|
144
|
+
"scaleIcon",
|
|
145
|
+
"checked",
|
|
146
|
+
"defaultChecked",
|
|
147
|
+
"onCheckedChange",
|
|
148
|
+
"native",
|
|
149
|
+
"unstyled"
|
|
150
|
+
]), propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext), adjustedSize = 0, size = 0;
|
|
151
|
+
if (!unstyled) {
|
|
152
|
+
var _propsActive_size, _ref;
|
|
153
|
+
adjustedSize = (0, import_core.getVariableValue)((0, import_get_token.getSize)((_ref = (_propsActive_size = propsActive.size) !== null && _propsActive_size !== void 0 ? _propsActive_size : styledContext == null ? void 0 : styledContext.size) !== null && _ref !== void 0 ? _ref : "$true", {
|
|
154
|
+
shift: sizeAdjust
|
|
155
|
+
})), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize;
|
|
126
156
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
157
|
+
var _useControllableState = _sliced_to_array((0, import_use_controllable_state.useControllableState)({
|
|
158
|
+
prop: checkedProp,
|
|
159
|
+
defaultProp: defaultChecked,
|
|
160
|
+
onChange: onCheckedChange
|
|
161
|
+
}), 2), tmp = _useControllableState[0], checked = tmp === void 0 ? !1 : tmp, setChecked = _useControllableState[1], _useCheckbox = (0, import_checkbox_headless.useCheckbox)(
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
propsActive,
|
|
164
|
+
[
|
|
165
|
+
checked,
|
|
166
|
+
setChecked
|
|
167
|
+
],
|
|
168
|
+
forwardedRef
|
|
169
|
+
), checkboxProps = _useCheckbox.checkboxProps, checkboxRef = _useCheckbox.checkboxRef, bubbleInput = _useCheckbox.bubbleInput, renderNative = (0, import_core.shouldRenderNativePlatform)(native);
|
|
170
|
+
if (renderNative === "web")
|
|
171
|
+
return /* @__PURE__ */ import_react.default.createElement("input", {
|
|
172
|
+
type: "checkbox",
|
|
173
|
+
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
|
|
174
|
+
tabIndex: -1,
|
|
175
|
+
ref: checkboxRef,
|
|
176
|
+
disabled: checkboxProps.disabled,
|
|
177
|
+
style: _object_spread({
|
|
178
|
+
appearance: "auto",
|
|
179
|
+
accentColor: "var(--color6)"
|
|
180
|
+
}, checkboxProps.style)
|
|
181
|
+
});
|
|
182
|
+
var _propsActive_size1, _ref1, _ref2;
|
|
183
|
+
return /* @__PURE__ */ import_react.default.createElement(CheckboxContext.Provider, {
|
|
184
|
+
value: {
|
|
185
|
+
checked,
|
|
186
|
+
disabled: checkboxProps.disabled
|
|
141
187
|
}
|
|
142
|
-
|
|
143
|
-
|
|
188
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_CheckboxStyledContext.CheckboxStyledContext.Provider, {
|
|
189
|
+
size: (_ref1 = (_propsActive_size1 = propsActive.size) !== null && _propsActive_size1 !== void 0 ? _propsActive_size1 : styledContext == null ? void 0 : styledContext.size) !== null && _ref1 !== void 0 ? _ref1 : "$true",
|
|
190
|
+
scaleIcon: (_ref2 = scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon)) !== null && _ref2 !== void 0 ? _ref2 : 1
|
|
191
|
+
}, /* @__PURE__ */ import_react.default.createElement(Frame, _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({}, !unstyled && {
|
|
192
|
+
width: size,
|
|
193
|
+
height: size
|
|
194
|
+
}), {
|
|
195
|
+
tag: "button",
|
|
196
|
+
ref: checkboxRef
|
|
197
|
+
}), unstyled === !1 && {
|
|
198
|
+
size,
|
|
199
|
+
theme: checked ? "active" : null
|
|
200
|
+
}), {
|
|
201
|
+
// expected variants
|
|
202
|
+
checked,
|
|
203
|
+
disabled: checkboxProps.disabled
|
|
204
|
+
}), checkboxProps), propsActive.children), bubbleInput));
|
|
205
|
+
}), IndicatorComponent = Indicator.styleable(function(props, forwardedRef) {
|
|
206
|
+
var childrenProp = props.children, forceMount = props.forceMount, disablePassStyles = props.disablePassStyles, _props_unstyled = props.unstyled, unstyled = _props_unstyled === void 0 ? !1 : _props_unstyled, indicatorProps = _object_without_properties(props, [
|
|
207
|
+
"children",
|
|
208
|
+
"forceMount",
|
|
209
|
+
"disablePassStyles",
|
|
210
|
+
"unstyled"
|
|
211
|
+
]), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext), children = childrenProp;
|
|
212
|
+
if (!unstyled) {
|
|
213
|
+
var iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : (0, import_font_size.getFontSize)(styledContext.size)) * styledContext.scaleIcon, theme = (0, import_core.useTheme)(), getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
214
|
+
size: iconSize,
|
|
215
|
+
color: theme.color
|
|
216
|
+
}), childrens = import_react.default.Children.toArray(childrenProp);
|
|
217
|
+
children = childrens.map(function(child) {
|
|
218
|
+
return disablePassStyles || !/* @__PURE__ */ import_react.default.isValidElement(child) ? child : getThemedIcon(child);
|
|
219
|
+
});
|
|
144
220
|
}
|
|
145
|
-
|
|
221
|
+
var context = (0, import_react.useContext)(CheckboxContext);
|
|
222
|
+
return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? /* @__PURE__ */ import_react.default.createElement(Indicator, _object_spread_props(_object_spread({
|
|
223
|
+
pointerEvents: "none"
|
|
224
|
+
}, indicatorProps), {
|
|
225
|
+
ref: forwardedRef
|
|
226
|
+
}), children) : null;
|
|
227
|
+
});
|
|
146
228
|
return (0, import_core.withStaticProperties)(FrameComponent, {
|
|
147
229
|
Indicator: IndicatorComponent
|
|
148
230
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["React"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox/src/createCheckbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+BAA6C,uCAE7C,cAMO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uBACtD,+BAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0C/B,IAAMA,kBAAkBC,6BAAAA,QAAMC,cAGlC;EACDC,SAAS;EACTC,UAAU;AACZ,CAAA,GAEMC,gBAAgB,SAACC,GAAAA;AACrB,EAAKA,EAAEC,YACLD,EAAEC,UAAUP;AAEhB;AAEO,SAASQ,eAGdC,aAAuE;AACvE,MACEC,qBAGED,YAHFC,oBAAAA,qBAGED,YAFFE,OAAAA,QAAAA,uBAAAA,SAAQC,gCAAAA,oBAAAA,yBAENH,YADFI,WAAAA,YAAAA,2BAAAA,SAAYC,yCAAAA;AAOdT,gBAAcM,KAAAA,GACdN,cAAcQ,SAAAA;AAEd,MAAME,iBAAiBJ,MAAMK,UAC3B,SAAkBC,QAAQC,cAAY;AACpC,QAAA,mBAUID,OATFE,WAAAA,YAAAA,qBAAAA,SAAY,OAAA,kBAAA,oBASVF,OARFG,YAAAA,aAAAA,sBAAAA,SAAa,IAAA,mBACbC,YAOEJ,OAPFI,WACSC,cAMPL,OANFd,SACAoB,iBAKEN,OALFM,gBACAC,kBAIEP,OAJFO,iBACAC,SAGER,OAHFQ,QAAAA,kBAGER,OAFFS,UAAAA,WAAAA,oBAAAA,SAAW,KAAA,iBACRC,QAAAA,2BACDV,QAAA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Y,UAAUG,IAAI,SAACC,OAAAA;AACxB,eAAIZ,qBAAqB,CAACpE,6BAAAA,QAAMiF,eAAeD,KAAAA,IACtCA,QAEFP,cAAcO,KAAAA;MACvB,CAAA;IACF;AAEA,QAAM1E,cAAUwB,yBAAW/B,eAAAA;AAC3B,WAAIoE,kBAAcf,0CAAgB9C,QAAQJ,OAAO,KAAKI,QAAQJ,YAAY,KAEtE,6BAAAF,QAAA,cAACY,WAAAA,qBAAAA,eAAAA;MAAUsE,eAAc;OAAWb,cAAAA,GAAAA;MAAgBf,KAAKrC;QACtD+C,QAAAA,IAIA;EACT,CAAA;AAGF,aAAOmB,kCAAqBrE,gBAAgB;IAC1CF,WAAWqD;EACb,CAAA;AACF;",
|
|
5
|
+
"names": ["CheckboxContext", "React", "createContext", "checked", "disabled", "ensureContext", "x", "context", "createCheckbox", "createProps", "disableActiveTheme", "Frame", "CheckboxFrame", "Indicator", "CheckboxIndicatorFrame", "FrameComponent", "styleable", "_props", "forwardedRef", "scaleSize", "sizeAdjust", "scaleIcon", "checkedProp", "defaultChecked", "onCheckedChange", "native", "unstyled", "props", "propsActive", "useProps", "styledContext", "useContext", "CheckboxStyledContext", "adjustedSize", "size", "getVariableValue", "getSize", "shift", "Math", "round", "useControllableState", "prop", "defaultProp", "onChange", "setChecked", "useCheckbox", "checkboxProps", "checkboxRef", "bubbleInput", "renderNative", "shouldRenderNativePlatform", "input", "type", "isIndeterminate", "tabIndex", "ref", "style", "appearance", "accentColor", "Provider", "value", "width", "height", "tag", "theme", "children", "IndicatorComponent", "childrenProp", "forceMount", "disablePassStyles", "indicatorProps", "iconSize", "getFontSize", "useTheme", "getThemedIcon", "useGetThemedIcon", "color", "childrens", "Children", "toArray", "map", "child", "isValidElement", "pointerEvents", "withStaticProperties"]
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -22,7 +22,7 @@ var import_Checkbox = require("./Checkbox"), import_createCheckbox = require("./
|
|
|
22
22
|
__reExport(src_exports, require("./createCheckbox"), module.exports);
|
|
23
23
|
__reExport(src_exports, require("./Checkbox"), module.exports);
|
|
24
24
|
__reExport(src_exports, require("./CheckboxStyledContext"), module.exports);
|
|
25
|
-
|
|
25
|
+
var Checkbox = (0, import_createCheckbox.createCheckbox)({
|
|
26
26
|
Frame: import_Checkbox.CheckboxFrame,
|
|
27
27
|
Indicator: import_Checkbox.CheckboxIndicatorFrame
|
|
28
28
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox/src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;sBAAsD,uBACtD,wBAA+B;AAE/B,wBAAc,6BAHd;AAIA,wBAAc,uBAJd;AAKA,wBAAc,oCALd;AAQO,IAAMA,eAAWC,sCAAe;EACrCC,OAAOC;EACPC,WAAWC;AACb,CAAA;",
|
|
5
|
+
"names": ["Checkbox", "createCheckbox", "Frame", "CheckboxFrame", "Indicator", "CheckboxIndicatorFrame"]
|
|
6
6
|
}
|
|
@@ -2,7 +2,7 @@ import { getVariableValue, styled } from "@tamagui/core";
|
|
|
2
2
|
import { getSize } from "@tamagui/get-token";
|
|
3
3
|
import { ThemeableStack } from "@tamagui/stacks";
|
|
4
4
|
import { CheckboxStyledContext } from "./CheckboxStyledContext";
|
|
5
|
-
|
|
5
|
+
var INDICATOR_NAME = "CheckboxIndicator", CheckboxIndicatorFrame = styled(ThemeableStack, {
|
|
6
6
|
// use Checkbox for easier themes
|
|
7
7
|
name: INDICATOR_NAME,
|
|
8
8
|
context: CheckboxStyledContext,
|
|
@@ -59,9 +59,12 @@ const INDICATOR_NAME = "CheckboxIndicator", CheckboxIndicatorFrame = styled(Them
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
size: {
|
|
62
|
-
"...size": (val,
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
"...size": function(val, param) {
|
|
63
|
+
var tokens = param.tokens, radiusToken = getVariableValue(getSize(val)) / 8;
|
|
64
|
+
return {
|
|
65
|
+
borderRadius: radiusToken
|
|
66
|
+
};
|
|
67
|
+
}
|
|
65
68
|
}
|
|
66
69
|
},
|
|
67
70
|
defaultVariants: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Checkbox.tsx"],
|
|
4
|
-
"mappings": "AAGA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox/src/Checkbox.tsx"],
|
|
4
|
+
"mappings": "AAGA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,eAAe;AACxB,SAASC,sBAAsB;AAE/B,SAASC,6BAA6B;AAKtC,IAAMC,iBAAiB,qBAEVC,yBAAyBL,OAAOE,gBAAgB;;EAE3DI,MAAMF;EACNG,SAASJ;EACTK,UAAU;IACRC,UAAU;MACRC,OAAO,CAAC;IACV;EACF;EACAC,iBAAiB;IACfF,UAAUG,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAMMC,gBAAgB,YAETC,gBAAgBhB,OAAOE,gBAAgB;EAClDI,MAAMS;EACNE,KAAK;EAELV,SAASJ;EACTK,UAAU;IACRC,UAAU;MACRC,OAAO;QACLQ,MAAM;QACNC,iBAAiB;QACjBC,YAAY;QACZC,gBAAgB;QAChBC,YAAY;QACZC,WAAW;QACXC,aAAa;QACbC,aAAa;QAEbC,YAAY;UACVD,aAAa;QACf;QAEAE,YAAY;UACVF,aAAa;UACbG,cAAc;UACdC,cAAc;UACdC,cAAc;QAChB;MACF;IACF;IAEAC,UAAU;MACRC,MAAM;QACJC,eAAe;QACfC,YAAY;QACZC,QAAQ;QAERT,YAAY;UACVD,aAAa;UACbN,iBAAiB;QACnB;QAEAiB,YAAY;UACVX,aAAa;UACbN,iBAAiB;QACnB;QAEAQ,YAAY;UACVE,cAAc;QAChB;MACF;IACF;IAEAX,MAAM;MACJ,WAAW,SAACmB,KAAAA,OAAAA;YAAOC,SAAAA,MAAAA,QACXC,cAAcxC,iBAAiBE,QAAQoC,GAAAA,CAAAA,IAAQ;AACrD,eAAO;UACLG,cAAcD;QAChB;MACF;IACF;EACF;EAEA5B,iBAAiB;IACfF,UAAUG,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA;",
|
|
5
|
+
"names": ["getVariableValue", "styled", "getSize", "ThemeableStack", "CheckboxStyledContext", "INDICATOR_NAME", "CheckboxIndicatorFrame", "name", "context", "variants", "unstyled", "false", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "CHECKBOX_NAME", "CheckboxFrame", "tag", "size", "backgroundColor", "alignItems", "justifyContent", "pressTheme", "focusable", "borderWidth", "borderColor", "hoverStyle", "focusStyle", "outlineStyle", "outlineWidth", "outlineColor", "disabled", "true", "pointerEvents", "userSelect", "cursor", "pressStyle", "val", "tokens", "radiusToken", "borderRadius"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/CheckboxStyledContext.tsx"],
|
|
4
|
-
"mappings": "AACA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox/src/CheckboxStyledContext.tsx"],
|
|
4
|
+
"mappings": "AACA,SAASA,2BAA2B;AAE7B,IAAMC,wBAAwBD,oBAAoB;EACvDE,MAAM;EACNC,WAAW;AACb,CAAA;",
|
|
5
|
+
"names": ["createStyledContext", "CheckboxStyledContext", "size", "scaleIcon"]
|
|
6
6
|
}
|