@tamagui/checkbox 1.88.16 → 1.88.18

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,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/CheckboxStyledContext.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEzC,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;AAE7B,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
5
5
  "names": []
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/CheckboxStyledContext.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEzC,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;AAE7B,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
5
5
  "names": []
6
6
  }
@@ -33,112 +33,115 @@ const CheckboxContext = import_react.default.createContext({
33
33
  }), ensureContext = (x) => {
34
34
  x.context || (x.context = CheckboxContext);
35
35
  };
36
- function createCheckbox({
37
- Frame = import_Checkbox.CheckboxFrame,
38
- Indicator = import_Checkbox.CheckboxIndicatorFrame
39
- }) {
36
+ function createCheckbox(createProps) {
37
+ const {
38
+ disableActiveTheme,
39
+ Frame = import_Checkbox.CheckboxFrame,
40
+ Indicator = import_Checkbox.CheckboxIndicatorFrame
41
+ } = createProps;
40
42
  ensureContext(Frame), ensureContext(Indicator);
41
- const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
42
- const {
43
- scaleSize = 0.45,
44
- sizeAdjust = 0,
45
- scaleIcon,
46
- checked: checkedProp,
47
- defaultChecked,
48
- onCheckedChange,
49
- native,
50
- unstyled = !1,
51
- ...props
52
- } = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
53
- let adjustedSize = 0, size = 0;
54
- unstyled || (adjustedSize = (0, import_core.getVariableValue)(
55
- (0, import_get_token.getSize)(propsActive.size ?? styledContext?.size ?? "$true", {
56
- shift: sizeAdjust
57
- })
58
- ), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
59
- const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
60
- prop: checkedProp,
61
- defaultProp: defaultChecked,
62
- onChange: onCheckedChange
63
- }), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
64
- // @ts-ignore
65
- propsActive,
66
- [checked, setChecked],
67
- forwardedRef
68
- );
69
- return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
- "input",
71
- {
72
- type: "checkbox",
73
- defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
74
- tabIndex: -1,
75
- ref: checkboxRef,
76
- disabled: checkboxProps.disabled,
77
- style: {
78
- appearance: "auto",
79
- accentColor: "var(--color6)",
80
- ...checkboxProps.style
81
- // TODO: any
82
- }
83
- }
84
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
- CheckboxContext.Provider,
86
- {
87
- value: {
88
- checked,
89
- disabled: checkboxProps.disabled
90
- },
91
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
92
- import_CheckboxStyledContext.CheckboxStyledContext.Provider,
93
- {
94
- size: propsActive.size ?? styledContext?.size ?? "$true",
95
- scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,
96
- children: [
97
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
98
- Frame,
99
- {
100
- ...!unstyled && {
101
- width: size,
102
- height: size
103
- },
104
- tag: "button",
105
- ref: checkboxRef,
106
- ...unstyled === !1 && {
107
- size,
108
- theme: checked ? "active" : null
109
- },
110
- checked,
111
- disabled: checkboxProps.disabled,
112
- ...checkboxProps,
113
- children: propsActive.children
114
- }
115
- ),
116
- bubbleInput
117
- ]
43
+ const FrameComponent = Frame.styleable(
44
+ function(_props, forwardedRef) {
45
+ const {
46
+ scaleSize = 0.45,
47
+ sizeAdjust = 0,
48
+ scaleIcon,
49
+ checked: checkedProp,
50
+ defaultChecked,
51
+ onCheckedChange,
52
+ native,
53
+ unstyled = !1,
54
+ ...props
55
+ } = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
56
+ let adjustedSize = 0, size = 0;
57
+ unstyled || (adjustedSize = (0, import_core.getVariableValue)(
58
+ (0, import_get_token.getSize)(propsActive.size ?? styledContext?.size ?? "$true", {
59
+ shift: sizeAdjust
60
+ })
61
+ ), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
62
+ const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
63
+ prop: checkedProp,
64
+ defaultProp: defaultChecked,
65
+ onChange: onCheckedChange
66
+ }), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
67
+ // @ts-ignore
68
+ propsActive,
69
+ [checked, setChecked],
70
+ forwardedRef
71
+ );
72
+ return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ "input",
74
+ {
75
+ type: "checkbox",
76
+ defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
77
+ tabIndex: -1,
78
+ ref: checkboxRef,
79
+ disabled: checkboxProps.disabled,
80
+ style: {
81
+ appearance: "auto",
82
+ accentColor: "var(--color6)",
83
+ ...checkboxProps.style
84
+ // TODO: any
118
85
  }
119
- )
86
+ }
87
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
+ CheckboxContext.Provider,
89
+ {
90
+ value: {
91
+ checked,
92
+ disabled: checkboxProps.disabled
93
+ },
94
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
95
+ import_CheckboxStyledContext.CheckboxStyledContext.Provider,
96
+ {
97
+ size: propsActive.size ?? styledContext?.size ?? "$true",
98
+ scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,
99
+ children: [
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
+ Frame,
102
+ {
103
+ ...!unstyled && {
104
+ width: size,
105
+ height: size
106
+ },
107
+ tag: "button",
108
+ ref: checkboxRef,
109
+ ...unstyled === !1 && {
110
+ size,
111
+ theme: checked ? "active" : null
112
+ },
113
+ checked,
114
+ disabled: checkboxProps.disabled,
115
+ ...checkboxProps,
116
+ children: propsActive.children
117
+ }
118
+ ),
119
+ bubbleInput
120
+ ]
121
+ }
122
+ )
123
+ }
124
+ );
125
+ }
126
+ ), IndicatorComponent = Indicator.styleable(
127
+ (props, forwardedRef) => {
128
+ const {
129
+ // __scopeCheckbox,
130
+ children: childrenProp,
131
+ forceMount,
132
+ disablePassStyles,
133
+ unstyled = !1,
134
+ ...indicatorProps
135
+ } = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
136
+ let children = childrenProp;
137
+ if (!unstyled) {
138
+ const 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)({ size: iconSize, color: theme.color });
139
+ children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
120
140
  }
121
- );
122
- }), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
123
- const {
124
- // __scopeCheckbox,
125
- children: childrenProp,
126
- forceMount,
127
- disablePassStyles,
128
- unstyled = !1,
129
- ...indicatorProps
130
- } = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
131
- let children = childrenProp;
132
- if (!unstyled) {
133
- const 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)({ size: iconSize, color: theme.color });
134
- children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
141
+ const context = (0, import_react.useContext)(CheckboxContext);
142
+ return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children }) : null;
135
143
  }
136
- const context = (0, import_react.useContext)(CheckboxContext);
137
- return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
138
- // @ts-ignore
139
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
140
- ) : null;
141
- });
144
+ );
142
145
  return (0, import_core.withStaticProperties)(FrameComponent, {
143
146
  Indicator: IndicatorComponent
144
147
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/createCheckbox.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKO,uCACP,cASO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uB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qBAAqB,UAAU;AAAA,IACnC,CAAC,OAAO,iBAAiB;AACvB,YAAM;AAAA;AAAA,QAEJ,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX,GAAG;AAAA,MACL,IAAI,OACE,gBAAgB,aAAAA,QAAM,WAAW,kDAAqB;AAC5D,UAAI,WAAW;AAEf,UAAI,CAAC,UAAU;AACb,cAAM,YACH,OAAO,cAAc,QAAS,WAC3B,cAAc,OAAO,WACrB,8BAAY,cAAc,IAAW,KAAK,cAAc,WACxD,YAAQ,sBAAS,GACjB,oBAAgB,yCAAiB,EAAE,MAAM,UAAU,OAAO,MAAM,MAAM,CAAC;AAG7E,mBADkB,aAAAA,QAAM,SAAS,QAAQ,YAAY,EAChC,IAAI,CAAC,UACpB,qBAAqB,CAAC,aAAAA,QAAM,eAAe,KAAK,IAC3C,QAEF,cAAc,KAAK,CAC3B;AAAA,MACH;AAEA,YAAM,cAAU,yBAAW,eAAe;AAC1C,aAAI,kBAAc,0CAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY,KAEtE,4CAAC,aAAU,eAAc,QAAQ,GAAG,gBAAgB,KAAK,cACtD,UACH,IAGG;AAAA,IACT;AAAA,EACF;AAEA,aAAO,kCAAqB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
5
5
  "names": ["React"]
6
6
  }
@@ -34,112 +34,115 @@ const CheckboxContext = import_react.default.createContext({
34
34
  }), ensureContext = (x) => {
35
35
  x.context || (x.context = CheckboxContext);
36
36
  };
37
- function createCheckbox({
38
- Frame = import_Checkbox.CheckboxFrame,
39
- Indicator = import_Checkbox.CheckboxIndicatorFrame
40
- }) {
37
+ function createCheckbox(createProps) {
38
+ const {
39
+ disableActiveTheme,
40
+ Frame = import_Checkbox.CheckboxFrame,
41
+ Indicator = import_Checkbox.CheckboxIndicatorFrame
42
+ } = createProps;
41
43
  ensureContext(Frame), ensureContext(Indicator);
42
- const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
43
- const {
44
- scaleSize = 0.45,
45
- sizeAdjust = 0,
46
- scaleIcon,
47
- checked: checkedProp,
48
- defaultChecked,
49
- onCheckedChange,
50
- native,
51
- unstyled = !1,
52
- ...props
53
- } = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
54
- let adjustedSize = 0, size = 0;
55
- unstyled || (adjustedSize = (0, import_core.getVariableValue)(
56
- (0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
57
- shift: sizeAdjust
58
- })
59
- ), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
60
- const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
61
- prop: checkedProp,
62
- defaultProp: defaultChecked,
63
- onChange: onCheckedChange
64
- }), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
65
- // @ts-ignore
66
- propsActive,
67
- [checked, setChecked],
68
- forwardedRef
69
- );
70
- return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
- "input",
72
- {
73
- type: "checkbox",
74
- defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
75
- tabIndex: -1,
76
- ref: checkboxRef,
77
- disabled: checkboxProps.disabled,
78
- style: {
79
- appearance: "auto",
80
- accentColor: "var(--color6)",
81
- ...checkboxProps.style
82
- // TODO: any
83
- }
84
- }
85
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
86
- CheckboxContext.Provider,
87
- {
88
- value: {
89
- checked,
90
- disabled: checkboxProps.disabled
91
- },
92
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
93
- import_CheckboxStyledContext.CheckboxStyledContext.Provider,
94
- {
95
- size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
96
- scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
97
- children: [
98
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
- Frame,
100
- {
101
- ...!unstyled && {
102
- width: size,
103
- height: size
104
- },
105
- tag: "button",
106
- ref: checkboxRef,
107
- ...unstyled === !1 && {
108
- size,
109
- theme: checked ? "active" : null
110
- },
111
- checked,
112
- disabled: checkboxProps.disabled,
113
- ...checkboxProps,
114
- children: propsActive.children
115
- }
116
- ),
117
- bubbleInput
118
- ]
44
+ const FrameComponent = Frame.styleable(
45
+ function(_props, forwardedRef) {
46
+ const {
47
+ scaleSize = 0.45,
48
+ sizeAdjust = 0,
49
+ scaleIcon,
50
+ checked: checkedProp,
51
+ defaultChecked,
52
+ onCheckedChange,
53
+ native,
54
+ unstyled = !1,
55
+ ...props
56
+ } = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
57
+ let adjustedSize = 0, size = 0;
58
+ unstyled || (adjustedSize = (0, import_core.getVariableValue)(
59
+ (0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
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
119
86
  }
120
- )
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
+ );
126
+ }
127
+ ), IndicatorComponent = Indicator.styleable(
128
+ (props, forwardedRef) => {
129
+ const {
130
+ // __scopeCheckbox,
131
+ children: childrenProp,
132
+ forceMount,
133
+ disablePassStyles,
134
+ unstyled = !1,
135
+ ...indicatorProps
136
+ } = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
137
+ let children = childrenProp;
138
+ if (!unstyled) {
139
+ const 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)({ size: iconSize, color: theme.color });
140
+ children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
121
141
  }
122
- );
123
- }), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
124
- const {
125
- // __scopeCheckbox,
126
- children: childrenProp,
127
- forceMount,
128
- disablePassStyles,
129
- unstyled = !1,
130
- ...indicatorProps
131
- } = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
132
- let children = childrenProp;
133
- if (!unstyled) {
134
- const 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)({ size: iconSize, color: theme.color });
135
- children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
142
+ const context = (0, import_react.useContext)(CheckboxContext);
143
+ return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children }) : null;
136
144
  }
137
- const context = (0, import_react.useContext)(CheckboxContext);
138
- return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
139
- // @ts-ignore
140
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
141
- ) : null;
142
- });
145
+ );
143
146
  return (0, import_core.withStaticProperties)(FrameComponent, {
144
147
  Indicator: IndicatorComponent
145
148
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/createCheckbox.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKO,uCACP,cASO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAA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6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/CheckboxStyledContext.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEzC,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;AAE7B,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
5
5
  "names": []
6
6
  }