@hanzogui/checkbox 2.0.0

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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Checkbox.cjs +111 -0
  3. package/dist/cjs/Checkbox.native.js +117 -0
  4. package/dist/cjs/Checkbox.native.js.map +1 -0
  5. package/dist/cjs/CheckboxStyledContext.cjs +33 -0
  6. package/dist/cjs/CheckboxStyledContext.native.js +36 -0
  7. package/dist/cjs/CheckboxStyledContext.native.js.map +1 -0
  8. package/dist/cjs/createCheckbox.cjs +184 -0
  9. package/dist/cjs/createCheckbox.native.js +209 -0
  10. package/dist/cjs/createCheckbox.native.js.map +1 -0
  11. package/dist/cjs/index.cjs +35 -0
  12. package/dist/cjs/index.native.js +38 -0
  13. package/dist/cjs/index.native.js.map +1 -0
  14. package/dist/esm/Checkbox.mjs +87 -0
  15. package/dist/esm/Checkbox.mjs.map +1 -0
  16. package/dist/esm/Checkbox.native.js +90 -0
  17. package/dist/esm/Checkbox.native.js.map +1 -0
  18. package/dist/esm/CheckboxStyledContext.mjs +10 -0
  19. package/dist/esm/CheckboxStyledContext.mjs.map +1 -0
  20. package/dist/esm/CheckboxStyledContext.native.js +10 -0
  21. package/dist/esm/CheckboxStyledContext.native.js.map +1 -0
  22. package/dist/esm/createCheckbox.mjs +148 -0
  23. package/dist/esm/createCheckbox.mjs.map +1 -0
  24. package/dist/esm/createCheckbox.native.js +171 -0
  25. package/dist/esm/createCheckbox.native.js.map +1 -0
  26. package/dist/esm/index.js +11 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/esm/index.mjs +11 -0
  29. package/dist/esm/index.mjs.map +1 -0
  30. package/dist/esm/index.native.js +11 -0
  31. package/dist/esm/index.native.js.map +1 -0
  32. package/dist/jsx/Checkbox.mjs +87 -0
  33. package/dist/jsx/Checkbox.mjs.map +1 -0
  34. package/dist/jsx/Checkbox.native.js +117 -0
  35. package/dist/jsx/Checkbox.native.js.map +1 -0
  36. package/dist/jsx/CheckboxStyledContext.mjs +10 -0
  37. package/dist/jsx/CheckboxStyledContext.mjs.map +1 -0
  38. package/dist/jsx/CheckboxStyledContext.native.js +36 -0
  39. package/dist/jsx/CheckboxStyledContext.native.js.map +1 -0
  40. package/dist/jsx/createCheckbox.mjs +148 -0
  41. package/dist/jsx/createCheckbox.mjs.map +1 -0
  42. package/dist/jsx/createCheckbox.native.js +209 -0
  43. package/dist/jsx/createCheckbox.native.js.map +1 -0
  44. package/dist/jsx/index.js +11 -0
  45. package/dist/jsx/index.js.map +1 -0
  46. package/dist/jsx/index.mjs +11 -0
  47. package/dist/jsx/index.mjs.map +1 -0
  48. package/dist/jsx/index.native.js +38 -0
  49. package/dist/jsx/index.native.js.map +1 -0
  50. package/package.json +63 -0
  51. package/src/Checkbox.tsx +122 -0
  52. package/src/CheckboxStyledContext.tsx +16 -0
  53. package/src/createCheckbox.tsx +280 -0
  54. package/src/index.ts +12 -0
  55. package/types/Checkbox.d.ts +39 -0
  56. package/types/CheckboxStyledContext.d.ts +9 -0
  57. package/types/createCheckbox.d.ts +196 -0
  58. package/types/index.d.ts +324 -0
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: !0
22
+ }), mod);
23
+ var CheckboxStyledContext_exports = {};
24
+ __export(CheckboxStyledContext_exports, {
25
+ CheckboxStyledContext: () => CheckboxStyledContext
26
+ });
27
+ module.exports = __toCommonJS(CheckboxStyledContext_exports);
28
+ var import_gui_core = require("@hanzo/gui-core"),
29
+ CheckboxStyledContext = (0, import_gui_core.createStyledContext)({
30
+ size: "$true",
31
+ scaleIcon: 1,
32
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1",
33
+ active: !1,
34
+ disabled: !1
35
+ });
36
+ //# sourceMappingURL=CheckboxStyledContext.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable"],"sources":["../../src/CheckboxStyledContext.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AAEF,IAAAA,SAAM,GAAAC,MAAA,CAAAC,cAAwB;AAMlC,IACDC,gBAAM,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IACNC,iBAAW,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IACXC,YAAU,GAAAN,MAAY,CAAAO,SAAA,CAAAC,cAAuB;AAAA,IAC7CC,QAAQ,GAAAA,CAAAC,MAAA,EAAAC,GAAA;IACR,SAAAC,IAAU,IAAAD,GAAA,EACXZ,SAAA,CAAAW,MAAA,EAAAE,IAAA;MAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;MAAAE,UAAA;IAAA","ignoreList":[]}
@@ -0,0 +1,148 @@
1
+ import { isIndeterminate, useCheckbox } from "@hanzo/gui-checkbox-headless";
2
+ import { getVariableValue, isWeb, shouldRenderNativePlatform, useProps, useTheme, withStaticProperties } from "@hanzo/gui-core";
3
+ import { getFontSize } from "@hanzo/gui-font-size";
4
+ import { getSize } from "@hanzo/gui-get-token";
5
+ import { useGetThemedIcon } from "@hanzo/gui-helpers";
6
+ import { useControllableState } from "@hanzo/gui-use-controllable-state";
7
+ import React, { useMemo } from "react";
8
+ import { CheckboxFrame, CheckboxIndicatorFrame } from "./Checkbox.mjs";
9
+ import { CheckboxStyledContext } from "./CheckboxStyledContext.mjs";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ const CheckboxContext = React.createContext({
12
+ checked: !1,
13
+ disabled: !1
14
+ }),
15
+ ensureContext = x => {
16
+ x.context || (x.context = CheckboxContext);
17
+ };
18
+ function createCheckbox(createProps) {
19
+ const {
20
+ Frame = CheckboxFrame,
21
+ Indicator = CheckboxIndicatorFrame
22
+ } = createProps;
23
+ ensureContext(Frame), ensureContext(Indicator);
24
+ const FrameComponent = Frame.styleable(function (_props, forwardedRef) {
25
+ const {
26
+ scaleSize = 0.45,
27
+ sizeAdjust = 0,
28
+ scaleIcon,
29
+ checked: checkedProp,
30
+ defaultChecked,
31
+ onCheckedChange,
32
+ native,
33
+ unstyled = !1,
34
+ activeStyle,
35
+ activeTheme,
36
+ ...props
37
+ } = _props,
38
+ propsActive = useProps(props),
39
+ styledContext = React.useContext(CheckboxStyledContext.context);
40
+ let adjustedSize = 0,
41
+ size = 0;
42
+ unstyled || (adjustedSize = getVariableValue(getSize(propsActive.size ?? styledContext?.size ?? "$true", {
43
+ shift: sizeAdjust
44
+ })), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
45
+ const [checked = !1, setChecked] = useControllableState({
46
+ prop: checkedProp,
47
+ defaultProp: defaultChecked,
48
+ onChange: onCheckedChange
49
+ }),
50
+ {
51
+ checkboxProps,
52
+ checkboxRef,
53
+ bubbleInput
54
+ } = useCheckbox(
55
+ // @ts-ignore
56
+ propsActive, [checked, setChecked], forwardedRef);
57
+ if (shouldRenderNativePlatform(native) === "web") return /* @__PURE__ */jsx("input", {
58
+ type: "checkbox",
59
+ defaultChecked: isIndeterminate(checked) ? !1 : checked,
60
+ tabIndex: -1,
61
+ ref: checkboxRef,
62
+ disabled: checkboxProps.disabled,
63
+ style: {
64
+ appearance: "auto",
65
+ accentColor: "var(--color6)",
66
+ ...checkboxProps.style
67
+ }
68
+ });
69
+ const memoizedContext = useMemo(() => ({
70
+ checked,
71
+ disabled: checkboxProps.disabled
72
+ }), [checked, checkboxProps.disabled]),
73
+ isActive = !!checked,
74
+ disabled = checkboxProps.disabled;
75
+ return /* @__PURE__ */jsx(CheckboxContext.Provider, {
76
+ value: memoizedContext,
77
+ children: /* @__PURE__ */jsxs(CheckboxStyledContext.Provider, {
78
+ size: propsActive.size ?? styledContext?.size ?? "$true",
79
+ scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,
80
+ unstyled,
81
+ active: isActive,
82
+ disabled,
83
+ children: [/* @__PURE__ */jsx(Frame, {
84
+ render: "button",
85
+ ref: checkboxRef,
86
+ unstyled,
87
+ theme: activeTheme ?? null,
88
+ ...(isWeb && {
89
+ type: "button"
90
+ }),
91
+ ...(!unstyled && {
92
+ width: size,
93
+ height: size,
94
+ size
95
+ }),
96
+ checked,
97
+ disabled,
98
+ ...checkboxProps,
99
+ ...props,
100
+ ...(isActive && {
101
+ ...(!unstyled && !activeStyle && {
102
+ backgroundColor: "$backgroundActive"
103
+ }),
104
+ ...activeStyle
105
+ }),
106
+ children: propsActive.children
107
+ }), bubbleInput]
108
+ })
109
+ });
110
+ }),
111
+ IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
112
+ const {
113
+ children: childrenProp,
114
+ forceMount,
115
+ disablePassStyles,
116
+ unstyled = !1,
117
+ activeStyle,
118
+ ...indicatorProps
119
+ } = props,
120
+ styledContext = CheckboxStyledContext.useStyledContext(),
121
+ {
122
+ active
123
+ } = styledContext;
124
+ let children = childrenProp;
125
+ if (!unstyled) {
126
+ const iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : getFontSize(styledContext.size)) * styledContext.scaleIcon,
127
+ theme = useTheme(),
128
+ getThemedIcon = useGetThemedIcon({
129
+ size: iconSize,
130
+ color: theme.color
131
+ });
132
+ children = React.Children.toArray(childrenProp).map(child => disablePassStyles || !React.isValidElement(child) ? child : getThemedIcon(child));
133
+ }
134
+ const context = React.useContext(CheckboxContext);
135
+ return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? /* @__PURE__ */jsx(Indicator, {
136
+ pointerEvents: "none",
137
+ ...indicatorProps,
138
+ ...(active && activeStyle),
139
+ ref: forwardedRef,
140
+ children
141
+ }) : null;
142
+ });
143
+ return withStaticProperties(FrameComponent, {
144
+ Indicator: IndicatorComponent
145
+ });
146
+ }
147
+ export { CheckboxContext, createCheckbox };
148
+ //# sourceMappingURL=createCheckbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isIndeterminate","useCheckbox","getVariableValue","isWeb","shouldRenderNativePlatform","useProps","useTheme","withStaticProperties","getFontSize","getSize","useGetThemedIcon","useControllableState","React","useMemo","CheckboxFrame","CheckboxIndicatorFrame","CheckboxStyledContext","jsx","jsxs","CheckboxContext","createContext","checked","disabled","ensureContext","x","context","createCheckbox","createProps","Frame","Indicator","FrameComponent","styleable","_props","forwardedRef","scaleSize","sizeAdjust","scaleIcon","checkedProp","defaultChecked","onCheckedChange","native","unstyled","activeStyle","activeTheme","props","propsActive","styledContext","useContext","adjustedSize","size","shift","Math","round","setChecked","prop","defaultProp","onChange","checkboxProps","checkboxRef","bubbleInput","type","tabIndex","ref","style","appearance","accentColor","memoizedContext","isActive","Provider","value","children","active","render","theme","width","height","backgroundColor","IndicatorComponent","childrenProp","forceMount","disablePassStyles","indicatorProps","useStyledContext","iconSize","getThemedIcon","color","Children","toArray","map","child","isValidElement","pointerEvents"],"sources":["../../src/createCheckbox.tsx"],"sourcesContent":[null],"mappings":"AAIA,SAASA,eAAA,EAAiBC,WAAA,QAAmB;AAE7C,SACEC,gBAAA,EACAC,KAAA,EACAC,0BAAA,EACAC,QAAA,EACAC,QAAA,EACAC,oBAAA,QACK;AAEP,SAASC,WAAA,QAAmB;AAC5B,SAASC,OAAA,QAAe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A,CAAMY;UAAM,CAAC;QAG7Ef,QAAA,GADkB1D,KAAA,CAAM0E,QAAA,CAASC,OAAA,CAAQT,YAAY,EAChCU,GAAA,CAAKC,KAAA,IACpBT,iBAAA,IAAqB,CAACpE,KAAA,CAAM8E,cAAA,CAAeD,KAAK,IAC3CA,KAAA,GAEFL,aAAA,CAAcK,KAAK,CAC3B;MACH;MAEA,MAAMhE,OAAA,GAAUb,KAAA,CAAMmC,UAAA,CAAW5B,eAAe;MAChD,OAAI4D,UAAA,IAAc/E,eAAA,CAAgByB,OAAA,CAAQJ,OAAO,KAAKI,OAAA,CAAQJ,OAAA,KAAY,KAEtE,eAAAJ,GAAA,CAACY,SAAA;QACC8D,aAAA,EAAc;QACb,GAAGV,cAAA;QACH,IAAIV,MAAA,IAAU7B,WAAA;QACfoB,GAAA,EAAK7B,YAAA;QAEJqC;MAAA,CACH,IAGG;IACT,CACF;EAEA,OAAO/D,oBAAA,CAAqBuB,cAAA,EAAgB;IAC1CD,SAAA,EAAWgD;EACb,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,209 @@
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 createCheckbox_exports = {};
35
+ __export(createCheckbox_exports, {
36
+ CheckboxContext: () => CheckboxContext,
37
+ createCheckbox: () => createCheckbox
38
+ });
39
+ module.exports = __toCommonJS(createCheckbox_exports);
40
+ var import_jsx_runtime = require("react/jsx-runtime"),
41
+ import_gui_checkbox_headless = require("@hanzo/gui-checkbox-headless"),
42
+ import_gui_core = require("@hanzo/gui-core"),
43
+ import_gui_focusable = require("@hanzo/gui-focusable"),
44
+ import_gui_font_size = require("@hanzo/gui-font-size"),
45
+ import_gui_get_token = require("@hanzo/gui-get-token"),
46
+ import_gui_helpers = require("@hanzo/gui-helpers"),
47
+ import_gui_use_controllable_state = require("@hanzo/gui-use-controllable-state"),
48
+ import_react = __toESM(require("react"), 1),
49
+ import_Checkbox = require("./Checkbox.native.js"),
50
+ import_CheckboxStyledContext = require("./CheckboxStyledContext.native.js"),
51
+ CheckboxContext = /* @__PURE__ */import_react.default.createContext({
52
+ checked: !1,
53
+ disabled: !1
54
+ }),
55
+ ensureContext = function (x) {
56
+ x.context || (x.context = CheckboxContext);
57
+ };
58
+ function createCheckbox(createProps) {
59
+ var {
60
+ Frame = import_Checkbox.CheckboxFrame,
61
+ Indicator = import_Checkbox.CheckboxIndicatorFrame
62
+ } = createProps;
63
+ ensureContext(Frame), ensureContext(Indicator);
64
+ var FrameComponent = Frame.styleable(function (_props, forwardedRef) {
65
+ var {
66
+ scaleSize = 0.45,
67
+ sizeAdjust = 0,
68
+ scaleIcon,
69
+ checked: checkedProp,
70
+ defaultChecked,
71
+ onCheckedChange,
72
+ native,
73
+ unstyled = !1,
74
+ activeStyle,
75
+ activeTheme,
76
+ ...props
77
+ } = _props,
78
+ propsActive = (0, import_gui_core.useProps)(props),
79
+ styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context),
80
+ adjustedSize = 0,
81
+ size = 0;
82
+ if (!unstyled) {
83
+ var _propsActive_size, _ref;
84
+ adjustedSize = (0, import_gui_core.getVariableValue)((0, import_gui_get_token.getSize)((_ref = (_propsActive_size = propsActive.size) !== null && _propsActive_size !== void 0 ? _propsActive_size : styledContext?.size) !== null && _ref !== void 0 ? _ref : "$true", {
85
+ shift: sizeAdjust
86
+ })), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize;
87
+ }
88
+ var [checked = !1, setChecked] = (0, import_gui_use_controllable_state.useControllableState)({
89
+ prop: checkedProp,
90
+ defaultProp: defaultChecked,
91
+ onChange: onCheckedChange
92
+ }),
93
+ {
94
+ checkboxProps,
95
+ checkboxRef,
96
+ bubbleInput
97
+ } = (0, import_gui_checkbox_headless.useCheckbox)(
98
+ // @ts-ignore
99
+ propsActive, [checked, setChecked], forwardedRef);
100
+ import_react.default.useEffect(function () {
101
+ if (props.id && !props.disabled) return (0, import_gui_focusable.registerFocusable)(props.id, {
102
+ focusAndSelect: function () {
103
+ setChecked?.(function (value) {
104
+ return !value;
105
+ });
106
+ },
107
+ focus: function () {}
108
+ });
109
+ }, [props.id, props.disabled]);
110
+ var renderNative = (0, import_gui_core.shouldRenderNativePlatform)(native);
111
+ if (renderNative === "web") return /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
112
+ type: "checkbox",
113
+ defaultChecked: (0, import_gui_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
114
+ tabIndex: -1,
115
+ ref: checkboxRef,
116
+ disabled: checkboxProps.disabled,
117
+ style: {
118
+ appearance: "auto",
119
+ accentColor: "var(--color6)",
120
+ ...checkboxProps.style
121
+ }
122
+ });
123
+ var memoizedContext = (0, import_react.useMemo)(function () {
124
+ return {
125
+ checked,
126
+ disabled: checkboxProps.disabled
127
+ };
128
+ }, [checked, checkboxProps.disabled]),
129
+ isActive = !!checked,
130
+ disabled = checkboxProps.disabled,
131
+ _propsActive_size1,
132
+ _ref1,
133
+ _ref2;
134
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(CheckboxContext.Provider, {
135
+ value: memoizedContext,
136
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_CheckboxStyledContext.CheckboxStyledContext.Provider, {
137
+ size: (_ref1 = (_propsActive_size1 = propsActive.size) !== null && _propsActive_size1 !== void 0 ? _propsActive_size1 : styledContext?.size) !== null && _ref1 !== void 0 ? _ref1 : "$true",
138
+ scaleIcon: (_ref2 = scaleIcon ?? styledContext?.scaleIcon) !== null && _ref2 !== void 0 ? _ref2 : 1,
139
+ unstyled,
140
+ active: isActive,
141
+ disabled,
142
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(Frame, {
143
+ render: "button",
144
+ ref: checkboxRef,
145
+ unstyled,
146
+ theme: activeTheme ?? null,
147
+ ...(import_gui_core.isWeb && {
148
+ type: "button"
149
+ }),
150
+ ...(!unstyled && {
151
+ width: size,
152
+ height: size,
153
+ size
154
+ }),
155
+ checked,
156
+ disabled,
157
+ ...checkboxProps,
158
+ ...props,
159
+ ...(isActive && {
160
+ ...(!unstyled && !activeStyle && {
161
+ backgroundColor: "$backgroundActive"
162
+ }),
163
+ ...activeStyle
164
+ }),
165
+ children: propsActive.children
166
+ }), bubbleInput]
167
+ })
168
+ });
169
+ }),
170
+ IndicatorComponent = Indicator.styleable(function (props, forwardedRef) {
171
+ var {
172
+ children: childrenProp,
173
+ forceMount,
174
+ disablePassStyles,
175
+ unstyled = !1,
176
+ activeStyle,
177
+ ...indicatorProps
178
+ } = props,
179
+ styledContext = import_CheckboxStyledContext.CheckboxStyledContext.useStyledContext(),
180
+ {
181
+ active
182
+ } = styledContext,
183
+ children = childrenProp;
184
+ if (!unstyled) {
185
+ var iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : (0, import_gui_font_size.getFontSize)(styledContext.size)) * styledContext.scaleIcon,
186
+ theme = (0, import_gui_core.useTheme)(),
187
+ getThemedIcon = (0, import_gui_helpers.useGetThemedIcon)({
188
+ size: iconSize,
189
+ color: theme.color
190
+ }),
191
+ childrens = import_react.default.Children.toArray(childrenProp);
192
+ children = childrens.map(function (child) {
193
+ return disablePassStyles || ! /* @__PURE__ */import_react.default.isValidElement(child) ? child : getThemedIcon(child);
194
+ });
195
+ }
196
+ var context = import_react.default.useContext(CheckboxContext);
197
+ return forceMount || (0, import_gui_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Indicator, {
198
+ pointerEvents: "none",
199
+ ...indicatorProps,
200
+ ...(active && activeStyle),
201
+ ref: forwardedRef,
202
+ children
203
+ }) : null;
204
+ });
205
+ return (0, import_gui_core.withStaticProperties)(FrameComponent, {
206
+ Indicator: IndicatorComponent
207
+ });
208
+ }
209
+ //# sourceMappingURL=createCheckbox.native.js.map
@@ -0,0 +1 @@
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","createCheckbox_exports","CheckboxContext","createCheckbox","module","exports","import_jsx_runtime","require","import_gui_checkbox_headless","import_gui_core","import_gui_focusable","import_gui_font_size","import_gui_get_token","import_gui_helpers","import_gui_use_controllable_state","import_react","import_Checkbox","import_CheckboxStyledContext","default","createContext","checked","disabled","ensureContext","x","context","createProps","Frame","CheckboxFrame","Indicator","CheckboxIndicatorFrame","FrameComponent","styleable","_props","forwardedRef","scaleSize","sizeAdjust","scaleIcon","checkedProp","defaultChecked","onCheckedChange","native","unstyled","activeStyle","activeTheme","props","propsActive","useProps","styledContext","useContext","CheckboxStyledContext","adjustedSize","size","_propsActive_size","_ref","getVariableValue","getSize","shift","Math","round","setChecked","useControllableState","prop","defaultProp","onChange","checkboxProps","checkboxRef","bubbleInput","useCheckbox","useEffect","id","registerFocusable","focusAndSelect","focus","renderNative","shouldRenderNativePlatform","jsx","type","isIndeterminate","tabIndex","ref","style","appearance","accentColor","memoizedContext","useMemo","isActive","_propsActive_size1","_ref1","_ref2","Provider","children","jsxs","active","render","theme","isWeb","width","height","backgroundColor","IndicatorComponent","childrenProp","forceMount","disablePassStyles","indicatorProps","useStyledContext","iconSize","getFontSize","useTheme","getThemedIcon","useGetThemedIcon","color","childrens","Children","toArray","map","child","isValidElement","pointerEvents"],"sources":["../../src/createCheckbox.tsx"],"sourcesContent":[null],"mappings":"AAIA,YAAS;;AAET,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA;AAAA,IACEC,SAAA,GAAAF,MAAA,CAAAG,cAAA;AAAA,IACAC,gBAAA,GAAAJ,MAAA,CAAAK,wBAAA;AAAA,IACAC,iBAAA,GAAAN,MAAA,CAAAO,mBAAA;AAAA,IACAC,YAAA,GAAAR,MAAA,CAAAS,cAAA;EAAAC,YAAA,GAAAV,MAAA,CAAAW,SAAA,CAAAC,cAAA;AAAA,IACAC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;IACA,SAAAC,IAAA,IAAAD,GAAA,EAAAb,SACK,CAAAY,MAAA,EAAAE,IAAA;MAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;MAAAE,UAAA;IAAA;EACP;EAAAC,WAAkC,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;IAClC,IAAAF,IAAS,WAAAA,IAAA,IAAmB,mBAAAA,IAAA,gBAC5B,KAAS,IAAAG,GAAA,IAAAlB,iBAAe,CAAAe,IAAA,GACxB,CAAAX,YAAS,CAAA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s";
4
+ export * from "./Checkbox.mjs";
5
+ export * from "./CheckboxStyledContext.mjs";
6
+ const Checkbox = createCheckbox({
7
+ Frame: CheckboxFrame,
8
+ Indicator: CheckboxIndicatorFrame
9
+ });
10
+ export { Checkbox };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CheckboxFrame","CheckboxIndicatorFrame","createCheckbox","Checkbox","Frame","Indicator"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,EAAeC,sBAAA,QAA8B;AACtD,SAASC,cAAA,QAAsB;AAE/B,cAAc;AACd,cAAc;AACd,cAAc;AAGP,MAAMC,QAAA,GAAWD,cAAA,CAAe;EACrCE,KAAA,EAAOJ,aAAA;EACPK,SAAA,EAAWJ;AACb,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { CheckboxFrame, CheckboxIndicatorFrame } from "./Checkbox.mjs";
2
+ import { createCheckbox } from "./createCheckbox.mjs";
3
+ export * from "./createCheckbox.mjs";
4
+ export * from "./Checkbox.mjs";
5
+ export * from "./CheckboxStyledContext.mjs";
6
+ const Checkbox = createCheckbox({
7
+ Frame: CheckboxFrame,
8
+ Indicator: CheckboxIndicatorFrame
9
+ });
10
+ export { Checkbox };
11
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CheckboxFrame","CheckboxIndicatorFrame","createCheckbox","Checkbox","Frame","Indicator"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,EAAeC,sBAAA,QAA8B;AACtD,SAASC,cAAA,QAAsB;AAE/B,cAAc;AACd,cAAc;AACd,cAAc;AAGP,MAAMC,QAAA,GAAWD,cAAA,CAAe;EACrCE,KAAA,EAAOJ,aAAA;EACPK,SAAA,EAAWJ;AACb,CAAC","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ },
20
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
+ value: !0
23
+ }), mod);
24
+ var index_exports = {};
25
+ __export(index_exports, {
26
+ Checkbox: () => Checkbox
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+ var import_Checkbox = require("./Checkbox.native.js"),
30
+ import_createCheckbox = require("./createCheckbox.native.js");
31
+ __reExport(index_exports, require("./createCheckbox.native.js"), module.exports);
32
+ __reExport(index_exports, require("./Checkbox.native.js"), module.exports);
33
+ __reExport(index_exports, require("./CheckboxStyledContext.native.js"), module.exports);
34
+ var Checkbox = (0, import_createCheckbox.createCheckbox)({
35
+ Frame: import_Checkbox.CheckboxFrame,
36
+ Indicator: import_Checkbox.CheckboxIndicatorFrame
37
+ });
38
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAsB;AAE/B,IAAAC,gBAAc,GAAAF,MAAA,CAAAG,wBAAA;AACd,IAAAC,iBAAc,GAAAJ,MAAA,CAAAK,mBAAA;AACd,IAAAC,YAAc,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAGP,IAAAC,QAAM,GAAAA,CAAAC,MAAW,EAAAC,GAAA,KAAe;IACrC,SAAOC,IAAA,IAAAD,GAAA,EACPZ,SAAW,CAAAW,MAAA,EAAAE,IAAA;MAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;MAAAE,UAAA;IAAA;EACb,CAAC;EAAAC,WAAA,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@hanzogui/checkbox",
3
+ "version": "2.0.0",
4
+ "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
+ "source": "src/index.ts",
6
+ "files": [
7
+ "src",
8
+ "types",
9
+ "dist"
10
+ ],
11
+ "type": "module",
12
+ "sideEffects": [
13
+ "*.css"
14
+ ],
15
+ "main": "dist/cjs",
16
+ "module": "dist/esm",
17
+ "types": "./types/index.d.ts",
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ ".": {
21
+ "types": "./types/index.d.ts",
22
+ "react-native": "./dist/esm/index.native.js",
23
+ "browser": "./dist/esm/index.mjs",
24
+ "module": "./dist/esm/index.mjs",
25
+ "import": "./dist/esm/index.mjs",
26
+ "require": "./dist/cjs/index.cjs",
27
+ "default": "./dist/esm/index.mjs"
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "scripts": {
34
+ "build": "hanzo-gui-build",
35
+ "watch": "hanzo-gui-build --watch",
36
+ "clean": "hanzo-gui-build clean",
37
+ "clean:build": "hanzo-gui-build clean:build"
38
+ },
39
+ "dependencies": {
40
+ "@hanzogui/checkbox-headless": "2.0.0",
41
+ "@hanzogui/compose-refs": "2.0.0-rc.29",
42
+ "@hanzogui/constants": "2.0.0-rc.29",
43
+ "@hanzogui/core": "2.0.0-rc.29",
44
+ "@hanzogui/create-context": "2.0.0-rc.29",
45
+ "@hanzogui/focusable": "2.0.0",
46
+ "@hanzogui/get-token": "2.0.0-rc.29",
47
+ "@hanzogui/helpers": "2.0.0-rc.29",
48
+ "@hanzogui/label": "2.0.0",
49
+ "@hanzogui/stacks": "2.0.0",
50
+ "@hanzogui/use-controllable-state": "2.0.0-rc.29",
51
+ "@hanzogui/font-size": "2.0.0-rc.29",
52
+ "@hanzogui/use-previous": "2.0.0-rc.29"
53
+ },
54
+ "devDependencies": {
55
+ "@hanzogui/build": "2.0.0-rc.29",
56
+ "react": ">=19"
57
+ },
58
+ "peerDependencies": {
59
+ "react": ">=19"
60
+ },
61
+ "module:jsx": "dist/jsx",
62
+ "removeSideEffects": true
63
+ }