@tamagui/label 2.0.0-rc.4 → 2.0.0-rc.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/label",
3
- "version": "2.0.0-rc.4",
3
+ "version": "2.0.0-rc.40",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -18,15 +18,12 @@
18
18
  "./package.json": "./package.json",
19
19
  ".": {
20
20
  "types": "./types/index.d.ts",
21
- "react-native": {
22
- "module": "./dist/esm/index.native.js",
23
- "import": "./dist/esm/index.native.js",
24
- "require": "./dist/cjs/index.native.js"
25
- },
21
+ "react-native": "./dist/esm/index.native.js",
22
+ "browser": "./dist/esm/index.mjs",
26
23
  "module": "./dist/esm/index.mjs",
27
24
  "import": "./dist/esm/index.mjs",
28
25
  "require": "./dist/cjs/index.cjs",
29
- "default": "./dist/cjs/index.native.js"
26
+ "default": "./dist/esm/index.mjs"
30
27
  }
31
28
  },
32
29
  "publishConfig": {
@@ -39,19 +36,19 @@
39
36
  "clean:build": "tamagui-build clean:build"
40
37
  },
41
38
  "dependencies": {
42
- "@tamagui/compose-refs": "2.0.0-rc.4",
43
- "@tamagui/constants": "2.0.0-rc.4",
44
- "@tamagui/create-context": "2.0.0-rc.4",
45
- "@tamagui/focusable": "2.0.0-rc.4",
46
- "@tamagui/get-button-sized": "2.0.0-rc.4",
47
- "@tamagui/get-font-sized": "2.0.0-rc.4",
48
- "@tamagui/text": "2.0.0-rc.4",
49
- "@tamagui/web": "2.0.0-rc.4"
39
+ "@tamagui/compose-refs": "2.0.0-rc.40",
40
+ "@tamagui/constants": "2.0.0-rc.40",
41
+ "@tamagui/create-context": "2.0.0-rc.40",
42
+ "@tamagui/focusable": "2.0.0-rc.40",
43
+ "@tamagui/get-button-sized": "2.0.0-rc.40",
44
+ "@tamagui/get-font-sized": "2.0.0-rc.40",
45
+ "@tamagui/text": "2.0.0-rc.40",
46
+ "@tamagui/web": "2.0.0-rc.40"
50
47
  },
51
48
  "devDependencies": {
52
- "@tamagui/build": "2.0.0-rc.4",
49
+ "@tamagui/build": "2.0.0-rc.40",
53
50
  "react": ">=19",
54
- "react-native": "0.81.5"
51
+ "react-native": "0.83.2"
55
52
  },
56
53
  "peerDependencies": {
57
54
  "react": ">=19",
package/dist/cjs/Label.js DELETED
@@ -1,107 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var Label_exports = {};
24
- __export(Label_exports, {
25
- Label: () => Label,
26
- LabelFrame: () => LabelFrame,
27
- useLabelContext: () => useLabelContext
28
- });
29
- module.exports = __toCommonJS(Label_exports);
30
- var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_create_context = require("@tamagui/create-context"), import_focusable = require("@tamagui/focusable"), import_get_button_sized = require("@tamagui/get-button-sized"), import_get_font_sized = require("@tamagui/get-font-sized"), import_text = require("@tamagui/text"), import_web = require("@tamagui/web"), React = __toESM(require("react"), 1), import_jsx_runtime = require("react/jsx-runtime");
31
- const NAME = "Label", [LabelProvider, useLabelContextImpl] = (0, import_create_context.createContext)(NAME, {
32
- id: void 0,
33
- controlRef: { current: null }
34
- }), LabelFrame = (0, import_web.styled)(import_text.SizableText, {
35
- name: "Label",
36
- render: "label",
37
- variants: {
38
- unstyled: {
39
- false: {
40
- size: "$true",
41
- color: "$color",
42
- backgroundColor: "transparent",
43
- display: "flex",
44
- alignItems: "center",
45
- userSelect: "none",
46
- cursor: "default",
47
- pressStyle: {
48
- color: "$colorPress"
49
- }
50
- }
51
- },
52
- size: {
53
- "...size": (val, extras) => {
54
- const buttonHeight = (0, import_get_button_sized.getButtonSized)(val, extras)?.height;
55
- return {
56
- ...(0, import_get_font_sized.getFontSized)(val, extras),
57
- lineHeight: buttonHeight ? extras.tokens.size[buttonHeight] : void 0
58
- };
59
- }
60
- }
61
- },
62
- defaultVariants: {
63
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
64
- }
65
- }), Label = LabelFrame.styleable(function(props, forwardedRef) {
66
- const { htmlFor, id: idProp, ...labelProps } = props, controlRef = React.useRef(null), ref = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), backupId = React.useId(), id = idProp ?? backupId;
67
- return import_constants.isWeb && React.useEffect(() => {
68
- if (htmlFor) {
69
- const element = document.getElementById(htmlFor);
70
- if (ref.current && element) {
71
- const getAriaLabel = () => element.getAttribute("aria-labelledby"), ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(" ");
72
- return element.setAttribute("aria-labelledby", ariaLabelledBy), controlRef.current = element, () => {
73
- if (!id) return;
74
- const ariaLabelledBy2 = getAriaLabel()?.replace(id, "");
75
- ariaLabelledBy2 === "" ? element.removeAttribute("aria-labelledby") : ariaLabelledBy2 && element.setAttribute("aria-labelledby", ariaLabelledBy2);
76
- };
77
- }
78
- }
79
- }, [id, htmlFor]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LabelProvider, { id, controlRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
- LabelFrame,
81
- {
82
- id,
83
- htmlFor,
84
- ...labelProps,
85
- ref: composedRefs,
86
- onMouseDown: (event) => {
87
- props.onMouseDown?.(event), !event.defaultPrevented && event.detail > 1 && event.preventDefault();
88
- },
89
- onPress: (event) => {
90
- if (props.onPress?.(event), import_constants.isWeb) {
91
- if (htmlFor || !controlRef.current || event.defaultPrevented) return;
92
- const isClickingControl = controlRef.current.contains(
93
- event.target
94
- ), isUserClick = event.isTrusted === !0;
95
- !isClickingControl && isUserClick && (controlRef.current.click(), controlRef.current.focus());
96
- } else
97
- props.htmlFor && (0, import_focusable.focusFocusable)(props.htmlFor);
98
- }
99
- }
100
- ) });
101
- }), useLabelContext = (element) => {
102
- const context = useLabelContextImpl("LabelConsumer"), { controlRef } = context;
103
- return React.useEffect(() => {
104
- element && (controlRef.current = element);
105
- }, [element, controlRef]), context.id;
106
- };
107
- //# sourceMappingURL=Label.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Label.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,mBAAsB,+BACtB,wBAA8B,oCAC9B,mBAA+B,+BAC/B,0BAA+B,sCAC/B,wBAA6B,oCAC7B,cAA4B,0BAE5B,aAAuB,yBACvB,QAAuB,8BA8FjB;AA5FN,MAAM,OAAO,SAOP,CAAC,eAAe,mBAAmB,QAAI,qCAAiC,MAAM;AAAA,EAClF,IAAI;AAAA,EACJ,YAAY,EAAE,SAAS,KAAK;AAC9B,CAAC,GAEY,iBAAa,mBAAO,yBAAa;AAAA,EAC5C,MAAM;A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ACrB,QAAQ,gBAAgB,iBAAiB,IAChCA,mBACT,QAAQ,aAAa,mBAAmBA,eAAc;AAAA,QAE1D;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,IAAI,OAAO,CAAC,GAIhB,4CAAC,iBAAc,IAAQ,YACrB;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MAEA;AAAA,MACC,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,aAAa,CAAC,UAAU;AACtB,cAAM,cAAc,KAAK,GAErB,CAAC,MAAM,oBAAoB,MAAM,SAAS,KAC5C,MAAM,eAAe;AAAA,MAEzB;AAAA,MACA,SAAS,CAAC,UAAU;AAGlB,YAFA,MAAM,UAAU,KAAK,GAEjB,wBAAO;AACT,cAAI,WAAW,CAAC,WAAW,WAAW,MAAM,iBAAkB;AAC9D,gBAAM,oBAAoB,WAAW,QAAQ;AAAA,YAC3C,MAAM;AAAA,UACR,GAGM,cAAc,MAAM,cAAc;AAMxC,UAAI,CAAC,qBAAqB,gBACxB,WAAW,QAAQ,MAAM,GACzB,WAAW,QAAQ,MAAM;AAAA,QAE7B;AACE,UAAI,MAAM,eACR,iCAAe,MAAM,OAAO;AAAA,MAGlC;AAAA;AAAA,EACF,GACF;AAEJ,CAAC,GAEY,kBAAkB,CAAC,YAAiC;AAC/D,QAAM,UAAU,oBAAoB,eAAe,GAC7C,EAAE,WAAW,IAAI;AAEvB,eAAM,UAAU,MAAM;AACpB,IAAI,YAAS,WAAW,UAAU;AAAA,EACpC,GAAG,CAAC,SAAS,UAAU,CAAC,GAEjB,QAAQ;AACjB;",
5
- "names": ["ariaLabelledBy"]
6
- }
package/dist/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var index_exports = {};
13
- module.exports = __toCommonJS(index_exports);
14
- __reExport(index_exports, require("./Label"), module.exports);
15
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,oBAAd;",
5
- "names": []
6
- }
package/dist/esm/Label.js DELETED
@@ -1,92 +0,0 @@
1
- import { useComposedRefs } from "@tamagui/compose-refs";
2
- import { isWeb } from "@tamagui/constants";
3
- import { createContext } from "@tamagui/create-context";
4
- import { focusFocusable } from "@tamagui/focusable";
5
- import { getButtonSized } from "@tamagui/get-button-sized";
6
- import { getFontSized } from "@tamagui/get-font-sized";
7
- import { SizableText } from "@tamagui/text";
8
- import { styled } from "@tamagui/web";
9
- import * as React from "react";
10
- import { jsx } from "react/jsx-runtime";
11
- const NAME = "Label", [LabelProvider, useLabelContextImpl] = createContext(NAME, {
12
- id: void 0,
13
- controlRef: { current: null }
14
- }), LabelFrame = styled(SizableText, {
15
- name: "Label",
16
- render: "label",
17
- variants: {
18
- unstyled: {
19
- false: {
20
- size: "$true",
21
- color: "$color",
22
- backgroundColor: "transparent",
23
- display: "flex",
24
- alignItems: "center",
25
- userSelect: "none",
26
- cursor: "default",
27
- pressStyle: {
28
- color: "$colorPress"
29
- }
30
- }
31
- },
32
- size: {
33
- "...size": (val, extras) => {
34
- const buttonHeight = getButtonSized(val, extras)?.height;
35
- return {
36
- ...getFontSized(val, extras),
37
- lineHeight: buttonHeight ? extras.tokens.size[buttonHeight] : void 0
38
- };
39
- }
40
- }
41
- },
42
- defaultVariants: {
43
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
44
- }
45
- }), Label = LabelFrame.styleable(function(props, forwardedRef) {
46
- const { htmlFor, id: idProp, ...labelProps } = props, controlRef = React.useRef(null), ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), backupId = React.useId(), id = idProp ?? backupId;
47
- return isWeb && React.useEffect(() => {
48
- if (htmlFor) {
49
- const element = document.getElementById(htmlFor);
50
- if (ref.current && element) {
51
- const getAriaLabel = () => element.getAttribute("aria-labelledby"), ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(" ");
52
- return element.setAttribute("aria-labelledby", ariaLabelledBy), controlRef.current = element, () => {
53
- if (!id) return;
54
- const ariaLabelledBy2 = getAriaLabel()?.replace(id, "");
55
- ariaLabelledBy2 === "" ? element.removeAttribute("aria-labelledby") : ariaLabelledBy2 && element.setAttribute("aria-labelledby", ariaLabelledBy2);
56
- };
57
- }
58
- }
59
- }, [id, htmlFor]), /* @__PURE__ */ jsx(LabelProvider, { id, controlRef, children: /* @__PURE__ */ jsx(
60
- LabelFrame,
61
- {
62
- id,
63
- htmlFor,
64
- ...labelProps,
65
- ref: composedRefs,
66
- onMouseDown: (event) => {
67
- props.onMouseDown?.(event), !event.defaultPrevented && event.detail > 1 && event.preventDefault();
68
- },
69
- onPress: (event) => {
70
- if (props.onPress?.(event), isWeb) {
71
- if (htmlFor || !controlRef.current || event.defaultPrevented) return;
72
- const isClickingControl = controlRef.current.contains(
73
- event.target
74
- ), isUserClick = event.isTrusted === !0;
75
- !isClickingControl && isUserClick && (controlRef.current.click(), controlRef.current.focus());
76
- } else
77
- props.htmlFor && focusFocusable(props.htmlFor);
78
- }
79
- }
80
- ) });
81
- }), useLabelContext = (element) => {
82
- const context = useLabelContextImpl("LabelConsumer"), { controlRef } = context;
83
- return React.useEffect(() => {
84
- element && (controlRef.current = element);
85
- }, [element, controlRef]), context.id;
86
- };
87
- export {
88
- Label,
89
- LabelFrame,
90
- useLabelContext
91
- };
92
- //# sourceMappingURL=Label.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Label.tsx"],
4
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAE5B,SAAS,cAAc;AACvB,YAAY,WAAW;AA8FjB;AA5FN,MAAM,OAAO,SAOP,CAAC,eAAe,mBAAmB,IAAI,cAAiC,MAAM;AAAA,EAClF,IAAI;AAAA,EACJ,YAAY,EAAE,SAAS,KAAK;AAC9B,CAAC,GAEY,aAAa,OAAO,aAAa;AAAA,EAC5C,MAAM;AAAA,EACN,QAAQ;AAAA,EAER,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,QACP,iBAAiB;AAAA,QACjB,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,WAAW;AAE1B,cAAM,eADc,eAAe,KAAK,MAAM,GACZ;AAElC,eAAO;AAAA,UACL,GAFgB,aAAa,KAAuB,MAAa;AAAA,UAGjE,YAAY,eAAe,OAAO,OAAO,KAAK,YAAY,IAAI;AAAA,QAChE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,EAC7C;AACF,CAAC,GAMY,QAAQ,WAAW,UAAU,SAAe,OAAO,cAAc;AAC5E,QAAM,EAAE,SAAS,IAAI,QAAQ,GAAG,WAAW,IAAI,OACzC,aAAa,MAAM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AAe,MAAM,OAAO;AAAA,MAGlC;AAAA;AAAA,EACF,GACF;AAEJ,CAAC,GAEY,kBAAkB,CAAC,YAAiC;AAC/D,QAAM,UAAU,oBAAoB,eAAe,GAC7C,EAAE,WAAW,IAAI;AAEvB,eAAM,UAAU,MAAM;AACpB,IAAI,YAAS,WAAW,UAAU;AAAA,EACpC,GAAG,CAAC,SAAS,UAAU,CAAC,GAEjB,QAAQ;AACjB;",
5
- "names": ["ariaLabelledBy"]
6
- }
package/dist/jsx/Label.js DELETED
@@ -1,92 +0,0 @@
1
- import { useComposedRefs } from "@tamagui/compose-refs";
2
- import { isWeb } from "@tamagui/constants";
3
- import { createContext } from "@tamagui/create-context";
4
- import { focusFocusable } from "@tamagui/focusable";
5
- import { getButtonSized } from "@tamagui/get-button-sized";
6
- import { getFontSized } from "@tamagui/get-font-sized";
7
- import { SizableText } from "@tamagui/text";
8
- import { styled } from "@tamagui/web";
9
- import * as React from "react";
10
- import { jsx } from "react/jsx-runtime";
11
- const NAME = "Label", [LabelProvider, useLabelContextImpl] = createContext(NAME, {
12
- id: void 0,
13
- controlRef: { current: null }
14
- }), LabelFrame = styled(SizableText, {
15
- name: "Label",
16
- render: "label",
17
- variants: {
18
- unstyled: {
19
- false: {
20
- size: "$true",
21
- color: "$color",
22
- backgroundColor: "transparent",
23
- display: "flex",
24
- alignItems: "center",
25
- userSelect: "none",
26
- cursor: "default",
27
- pressStyle: {
28
- color: "$colorPress"
29
- }
30
- }
31
- },
32
- size: {
33
- "...size": (val, extras) => {
34
- const buttonHeight = getButtonSized(val, extras)?.height;
35
- return {
36
- ...getFontSized(val, extras),
37
- lineHeight: buttonHeight ? extras.tokens.size[buttonHeight] : void 0
38
- };
39
- }
40
- }
41
- },
42
- defaultVariants: {
43
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
44
- }
45
- }), Label = LabelFrame.styleable(function(props, forwardedRef) {
46
- const { htmlFor, id: idProp, ...labelProps } = props, controlRef = React.useRef(null), ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), backupId = React.useId(), id = idProp ?? backupId;
47
- return isWeb && React.useEffect(() => {
48
- if (htmlFor) {
49
- const element = document.getElementById(htmlFor);
50
- if (ref.current && element) {
51
- const getAriaLabel = () => element.getAttribute("aria-labelledby"), ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(" ");
52
- return element.setAttribute("aria-labelledby", ariaLabelledBy), controlRef.current = element, () => {
53
- if (!id) return;
54
- const ariaLabelledBy2 = getAriaLabel()?.replace(id, "");
55
- ariaLabelledBy2 === "" ? element.removeAttribute("aria-labelledby") : ariaLabelledBy2 && element.setAttribute("aria-labelledby", ariaLabelledBy2);
56
- };
57
- }
58
- }
59
- }, [id, htmlFor]), /* @__PURE__ */ jsx(LabelProvider, { id, controlRef, children: /* @__PURE__ */ jsx(
60
- LabelFrame,
61
- {
62
- id,
63
- htmlFor,
64
- ...labelProps,
65
- ref: composedRefs,
66
- onMouseDown: (event) => {
67
- props.onMouseDown?.(event), !event.defaultPrevented && event.detail > 1 && event.preventDefault();
68
- },
69
- onPress: (event) => {
70
- if (props.onPress?.(event), isWeb) {
71
- if (htmlFor || !controlRef.current || event.defaultPrevented) return;
72
- const isClickingControl = controlRef.current.contains(
73
- event.target
74
- ), isUserClick = event.isTrusted === !0;
75
- !isClickingControl && isUserClick && (controlRef.current.click(), controlRef.current.focus());
76
- } else
77
- props.htmlFor && focusFocusable(props.htmlFor);
78
- }
79
- }
80
- ) });
81
- }), useLabelContext = (element) => {
82
- const context = useLabelContextImpl("LabelConsumer"), { controlRef } = context;
83
- return React.useEffect(() => {
84
- element && (controlRef.current = element);
85
- }, [element, controlRef]), context.id;
86
- };
87
- export {
88
- Label,
89
- LabelFrame,
90
- useLabelContext
91
- };
92
- //# sourceMappingURL=Label.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Label.tsx"],
4
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SA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