@tamagui/label 2.7.7 → 3.0.0-beta.643.1

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,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,37 +8,30 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var Label_exports = {};
37
31
  __export(Label_exports, {
38
- Label: () => Label,
39
- LabelFrame: () => LabelFrame,
40
- useLabelContext: () => useLabelContext
32
+ Label: () => Label,
33
+ LabelFrame: () => LabelFrame,
34
+ useLabelContext: () => useLabelContext
41
35
  });
42
36
  module.exports = __toCommonJS(Label_exports);
43
37
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -45,133 +39,113 @@ var import_compose_refs = require("@tamagui/compose-refs");
45
39
  var import_constants = require("@tamagui/constants");
46
40
  var import_create_context = require("@tamagui/create-context");
47
41
  var import_focusable = require("@tamagui/focusable");
48
- var import_get_button_sized = require("@tamagui/get-button-sized");
49
42
  var import_get_font_sized = require("@tamagui/get-font-sized");
43
+ var import_size = require("@tamagui/size");
50
44
  var import_text = require("@tamagui/text");
51
45
  var import_web = require("@tamagui/web");
52
46
  var React = __toESM(require("react"), 1);
53
47
  var NAME = "Label";
54
48
  var [LabelProvider, useLabelContextImpl] = (0, import_create_context.createContext)(NAME, {
55
- id: void 0,
56
- controlRef: {
57
- current: null
58
- }
49
+ id: void 0,
50
+ controlRef: { current: null }
59
51
  });
52
+ var labelSizeVariant = function(val, extras) {
53
+ var fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
54
+ var sizeKey = (0, import_size.resolveSizeToken)(val, "size");
55
+ return {
56
+ ...fontStyle,
57
+ lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
58
+ };
59
+ };
60
60
  var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
61
- name: "Label",
62
- render: "label",
63
- variants: {
64
- unstyled: {
65
- false: {
66
- size: "$true",
67
- color: "$color",
68
- backgroundColor: "transparent",
69
- display: "flex",
70
- alignItems: "center",
71
- userSelect: "none",
72
- cursor: "default",
73
- pressStyle: {
74
- color: "$colorPress"
75
- }
76
- }
77
- },
78
- size: {
79
- "...size": function (val, extras) {
80
- var buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras);
81
- var buttonHeight = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.height;
82
- var fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
83
- return {
84
- ...fontStyle,
85
- lineHeight: buttonHeight ? extras.tokens.size[buttonHeight] : void 0
86
- };
87
- }
88
- }
89
- },
90
- defaultVariants: {
91
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
92
- }
61
+ displayName: "Label",
62
+ render: "label",
63
+ size: true,
64
+ backgroundColor: "transparent",
65
+ display: "flex",
66
+ alignItems: "center",
67
+ userSelect: "none",
68
+ cursor: "default",
69
+ variants: { size: {
70
+ true: labelSizeVariant,
71
+ Size: labelSizeVariant
72
+ } }
93
73
  });
94
- var Label = LabelFrame.styleable(function Label2(props, forwardedRef) {
95
- var {
96
- htmlFor,
97
- id: idProp,
98
- ...labelProps
99
- } = props;
100
- var controlRef = React.useRef(null);
101
- var ref = React.useRef(null);
102
- var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
103
- var backupId = React.useId();
104
- var id = idProp !== null && idProp !== void 0 ? idProp : backupId;
105
- if (import_constants.isWeb) {
106
- (0, import_constants.useIsomorphicLayoutEffect)(function () {
107
- if (htmlFor) {
108
- var element = document.getElementById(htmlFor);
109
- var label = ref.current;
110
- if (label && element) {
111
- var getAriaLabel = function () {
112
- return element.getAttribute("aria-labelledby");
113
- };
114
- var ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(" ");
115
- element.setAttribute("aria-labelledby", ariaLabelledBy);
116
- controlRef.current = element;
117
- return function () {
118
- var _getAriaLabel;
119
- if (!id) return;
120
- var ariaLabelledBy2 = (_getAriaLabel = getAriaLabel()) === null || _getAriaLabel === void 0 ? void 0 : _getAriaLabel.replace(id, "");
121
- if (ariaLabelledBy2 === "") {
122
- element.removeAttribute("aria-labelledby");
123
- } else if (ariaLabelledBy2) {
124
- element.setAttribute("aria-labelledby", ariaLabelledBy2);
125
- }
126
- };
127
- }
128
- }
129
- }, [id, htmlFor]);
130
- }
131
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(LabelProvider, {
132
- id,
133
- controlRef,
134
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(LabelFrame, {
135
- id,
136
- // @ts-ignore
137
- htmlFor,
138
- ...labelProps,
139
- ref: composedRefs,
140
- onMouseDown: function (event) {
141
- var _props_onMouseDown;
142
- (_props_onMouseDown = props.onMouseDown) === null || _props_onMouseDown === void 0 ? void 0 : _props_onMouseDown.call(props, event);
143
- if (!event.defaultPrevented && event.detail > 1) {
144
- event.preventDefault();
145
- }
146
- },
147
- onPress: function (event) {
148
- var _props_onPress;
149
- (_props_onPress = props.onPress) === null || _props_onPress === void 0 ? void 0 : _props_onPress.call(props, event);
150
- if (import_constants.isWeb) {
151
- if (htmlFor || !controlRef.current || event.defaultPrevented) return;
152
- var isClickingControl = controlRef.current.contains(event.target);
153
- var isUserClick = event.isTrusted === true;
154
- if (!isClickingControl && isUserClick) {
155
- controlRef.current.click();
156
- controlRef.current.focus();
157
- }
158
- } else {
159
- if (props.htmlFor) {
160
- (0, import_focusable.focusFocusable)(props.htmlFor);
161
- }
162
- }
163
- }
164
- })
165
- });
74
+ var Label = (0, import_web.createStyledHOC)(LabelFrame, function Label2(props, forwardedRef) {
75
+ var { htmlFor, id: idProp, ...labelProps } = props;
76
+ var controlRef = React.useRef(null);
77
+ var ref = React.useRef(null);
78
+ var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
79
+ var backupId = React.useId();
80
+ var id = idProp !== null && idProp !== void 0 ? idProp : backupId;
81
+ if (import_constants.isWeb) {
82
+ (0, import_constants.useIsomorphicLayoutEffect)(function() {
83
+ if (htmlFor) {
84
+ var element = document.getElementById(htmlFor);
85
+ var label = ref.current;
86
+ if (label && element) {
87
+ var getAriaLabel = function() {
88
+ return element.getAttribute("aria-labelledby");
89
+ };
90
+ var ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(" ");
91
+ element.setAttribute("aria-labelledby", ariaLabelledBy);
92
+ controlRef.current = element;
93
+ return function() {
94
+ var _getAriaLabel;
95
+ if (!id) return;
96
+ var ariaLabelledBy2 = (_getAriaLabel = getAriaLabel()) === null || _getAriaLabel === void 0 ? void 0 : _getAriaLabel.replace(id, "");
97
+ if (ariaLabelledBy2 === "") {
98
+ element.removeAttribute("aria-labelledby");
99
+ } else if (ariaLabelledBy2) {
100
+ element.setAttribute("aria-labelledby", ariaLabelledBy2);
101
+ }
102
+ };
103
+ }
104
+ }
105
+ }, [id, htmlFor]);
106
+ }
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LabelProvider, {
108
+ id,
109
+ controlRef,
110
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LabelFrame, {
111
+ id,
112
+ htmlFor,
113
+ ...labelProps,
114
+ ref: composedRefs,
115
+ onMouseDown: function(event) {
116
+ var _props_onMouseDown;
117
+ (_props_onMouseDown = props.onMouseDown) === null || _props_onMouseDown === void 0 ? void 0 : _props_onMouseDown.call(props, event);
118
+ if (!event.defaultPrevented && event.detail > 1) {
119
+ event.preventDefault();
120
+ }
121
+ },
122
+ onPress: function(event) {
123
+ var _props_onPress;
124
+ (_props_onPress = props.onPress) === null || _props_onPress === void 0 ? void 0 : _props_onPress.call(props, event);
125
+ if (import_constants.isWeb) {
126
+ if (htmlFor || !controlRef.current || event.defaultPrevented) return;
127
+ var isClickingControl = controlRef.current.contains(event.target);
128
+ var isUserClick = event.isTrusted === true;
129
+ if (!isClickingControl && isUserClick) {
130
+ controlRef.current.click();
131
+ controlRef.current.focus();
132
+ }
133
+ } else {
134
+ if (props.htmlFor) {
135
+ (0, import_focusable.focusFocusable)(props.htmlFor);
136
+ }
137
+ }
138
+ }
139
+ })
140
+ });
166
141
  });
167
- var useLabelContext = function (element) {
168
- var context = useLabelContextImpl("LabelConsumer");
169
- var {
170
- controlRef
171
- } = context;
172
- React.useEffect(function () {
173
- if (element) controlRef.current = element;
174
- }, [element, controlRef]);
175
- return context.id;
142
+ var useLabelContext = function(element) {
143
+ var context = useLabelContextImpl("LabelConsumer");
144
+ var { controlRef } = context;
145
+ React.useEffect(function() {
146
+ if (element) controlRef.current = element;
147
+ }, [element, controlRef]);
148
+ return context.id;
176
149
  };
150
+
177
151
  //# sourceMappingURL=Label.native.js.map
@@ -1 +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","Label_exports","Label","LabelFrame","useLabelContext","module","exports","import_jsx_runtime","require","import_compose_refs","import_constants","import_create_context","import_focusable","import_get_button_sized","import_get_font_sized","import_text","import_web","React","NAME","LabelProvider","useLabelContextImpl","createContext","id","controlRef","current","styled","SizableText","render","variants","unstyled","false","size","color","backgroundColor","display","alignItems","userSelect","cursor","pressStyle","...size","val","extras","buttonStyle","ariaLabelledBy","buttonHeight","height","fontStyle","getFontSized","lineHeight","tokens","defaultVariants","process","env","TAMAGUI_HEADLESS","styleable","Label2","props","forwardedRef","htmlFor","idProp","labelProps","useRef","ref","composedRefs","useComposedRefs","backupId","useId","isWeb","useIsomorphicLayoutEffect","element","document","getElementById","label","getAriaLabel","getAttribute","filter","Boolean","join","setAttribute","_getAriaLabel","ariaLabelledBy2","replace","removeAttribute"],"sources":["../../src/Label.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,QAAS,GAAAC,MAAO,CAAAC,MAAA;AAChB,IAA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UACA,IAAA/B,cAAW,GAAQ,CACrBrB,EAAA,EACFmD,YAAO,GACL,CAAAE,MAAI,CAAAC,OAAM,EAAAC,IAAS;UACjBR,OAAA,CAAAS,YAAe,kBAAa,EAAAnC,cAAA;UAC9BpB,UAAA,CAAAC,OAAA,GAAA6C,OAAA;UACF;YACF,IAAAU,aAAA;YAAA,KAAAzD,EAAA;YAEJ,IAAA0D,eAAA,IAAAD,aAAA,GAAAN,YAAA,gBAAAM,aAAA,uBAAAA,aAAA,CAAAE,OAAA,CAAA3D,EAAA;YAEH,IAAA0D,eAAA;cAEYX,OAAA,CAAAa,eAAoD;YACzD,OAAU,IAAAF,eAAoB;cAC5BX,OAAW,CAAAS,YAAI,oBAAAE,eAAA;YAEjB;UACA;QACF;MAEJ;IACF,I","ignoreList":[]}
1
+ {"version":3,"file":"Label.native.js","names":[],"sources":["jsx/Label.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Label_exports = {};\n__export(Label_exports, {\n Label: () => Label,\n LabelFrame: () => LabelFrame,\n useLabelContext: () => useLabelContext\n});\nmodule.exports = __toCommonJS(Label_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar import_get_font_sized = require(\"@tamagui/get-font-sized\");\nvar import_size = require(\"@tamagui/size\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar React = __toESM(require(\"react\"), 1);\nvar NAME = \"Label\";\nvar [LabelProvider, useLabelContextImpl] = (0, import_create_context.createContext)(NAME, {\n id: void 0,\n controlRef: {\n current: null\n }\n});\nvar labelSizeVariant = function(val, extras) {\n var fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);\n var sizeKey = (0, import_size.resolveSizeToken)(val, \"size\");\n return {\n ...fontStyle,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : extras.tokens.size[sizeKey]\n };\n};\nvar LabelFrame = (0, import_web.styled)(import_text.SizableText, {\n displayName: \"Label\",\n render: \"label\",\n size: true,\n backgroundColor: \"transparent\",\n display: \"flex\",\n alignItems: \"center\",\n userSelect: \"none\",\n cursor: \"default\",\n variants: {\n size: {\n true: labelSizeVariant,\n Size: labelSizeVariant\n }\n }\n});\nvar Label = (0, import_web.createStyledHOC)(LabelFrame, function Label2(props, forwardedRef) {\n var { htmlFor, id: idProp, ...labelProps } = props;\n var controlRef = React.useRef(null);\n var ref = React.useRef(null);\n var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);\n var backupId = React.useId();\n var id = idProp !== null && idProp !== void 0 ? idProp : backupId;\n if (import_constants.isWeb) {\n (0, import_constants.useIsomorphicLayoutEffect)(function() {\n if (htmlFor) {\n var element = document.getElementById(htmlFor);\n var label = ref.current;\n if (label && element) {\n var getAriaLabel = function() {\n return element.getAttribute(\"aria-labelledby\");\n };\n var ariaLabelledBy = [\n id,\n getAriaLabel()\n ].filter(Boolean).join(\" \");\n element.setAttribute(\"aria-labelledby\", ariaLabelledBy);\n controlRef.current = element;\n return function() {\n var _getAriaLabel;\n if (!id) return;\n var ariaLabelledBy2 = (_getAriaLabel = getAriaLabel()) === null || _getAriaLabel === void 0 ? void 0 : _getAriaLabel.replace(id, \"\");\n if (ariaLabelledBy2 === \"\") {\n element.removeAttribute(\"aria-labelledby\");\n } else if (ariaLabelledBy2) {\n element.setAttribute(\"aria-labelledby\", ariaLabelledBy2);\n }\n };\n }\n }\n }, [\n id,\n htmlFor\n ]);\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LabelProvider, {\n id,\n controlRef,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LabelFrame, {\n id,\n // @ts-ignore\n htmlFor,\n ...labelProps,\n ref: composedRefs,\n onMouseDown: function(event) {\n var _props_onMouseDown;\n (_props_onMouseDown = props.onMouseDown) === null || _props_onMouseDown === void 0 ? void 0 : _props_onMouseDown.call(props, event);\n if (!event.defaultPrevented && event.detail > 1) {\n event.preventDefault();\n }\n },\n onPress: function(event) {\n var _props_onPress;\n (_props_onPress = props.onPress) === null || _props_onPress === void 0 ? void 0 : _props_onPress.call(props, event);\n if (import_constants.isWeb) {\n if (htmlFor || !controlRef.current || event.defaultPrevented) return;\n var isClickingControl = controlRef.current.contains(event.target);\n var isUserClick = event.isTrusted === true;\n if (!isClickingControl && isUserClick) {\n controlRef.current.click();\n controlRef.current.focus();\n }\n } else {\n if (props.htmlFor) {\n (0, import_focusable.focusFocusable)(props.htmlFor);\n }\n }\n }\n })\n });\n});\nvar useLabelContext = function(element) {\n var context = useLabelContextImpl(\"LabelConsumer\");\n var { controlRef } = context;\n React.useEffect(function() {\n if (element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AAQ,SAAS,MAAM,MAAM;KAChE,IAAI,cAAc,MAAM,cAAc;KACtC,IAAI,CAAC,qBAAqB,aAAa;MACrC,WAAW,QAAQ,MAAM;MACzB,WAAW,QAAQ,MAAM;KAC3B;IACF,OAAO;KACL,IAAI,MAAM,SAAS;MACjB,CAAC,GAAG,iBAAiB,gBAAgB,MAAM,OAAO;KACpD;IACF;GACF;EACF,CAAC;CACH,CAAC;AACH,CAAC;AACD,IAAI,kBAAkB,SAAS,SAAS;CACtC,IAAI,UAAU,oBAAoB,eAAe;CACjD,IAAI,EAAE,eAAe;CACrB,MAAM,UAAU,WAAW;EACzB,IAAI,SAAS,WAAW,UAAU;CACpC,GAAG,CACD,SACA,UACF,CAAC;CACD,OAAO,QAAQ;AACjB"}
package/dist/jsx/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./Label.mjs";
2
- //# sourceMappingURL=index.js.map
1
+ export * from "./Label.mjs"
@@ -1,2 +1 @@
1
- export * from "./Label.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ export * from "./Label.mjs"
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ module.exports = __toCommonJS(index_exports);
21
+ __reExport(index_exports, require("./Label.native.js"), module.exports);
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
19
  var index_exports = {};
21
20
  module.exports = __toCommonJS(index_exports);
22
21
  __reExport(index_exports, require("./Label.native.js"), module.exports);
22
+
23
23
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["jsx/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Label\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/label",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.643.1",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -34,19 +34,19 @@
34
34
  "clean:build": "tamagui-build clean:build"
35
35
  },
36
36
  "dependencies": {
37
- "@tamagui/compose-refs": "2.7.7",
38
- "@tamagui/constants": "2.7.7",
39
- "@tamagui/create-context": "2.7.7",
40
- "@tamagui/focusable": "2.7.7",
41
- "@tamagui/get-button-sized": "2.7.7",
42
- "@tamagui/get-font-sized": "2.7.7",
43
- "@tamagui/text": "2.7.7",
44
- "@tamagui/web": "2.7.7"
37
+ "@tamagui/compose-refs": "3.0.0-beta.643.1",
38
+ "@tamagui/constants": "3.0.0-beta.643.1",
39
+ "@tamagui/create-context": "3.0.0-beta.643.1",
40
+ "@tamagui/focusable": "3.0.0-beta.643.1",
41
+ "@tamagui/get-font-sized": "3.0.0-beta.643.1",
42
+ "@tamagui/size": "3.0.0-beta.643.1",
43
+ "@tamagui/text": "3.0.0-beta.643.1",
44
+ "@tamagui/web": "3.0.0-beta.643.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@tamagui/build": "2.7.7",
47
+ "@tamagui/build": "3.0.0-beta.643.1",
48
48
  "react": ">=19",
49
- "react-native": "0.83.2"
49
+ "react-native": "0.86.2"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=19"
package/src/Label.tsx CHANGED
@@ -2,11 +2,16 @@ import { useComposedRefs } from '@tamagui/compose-refs'
2
2
  import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
3
3
  import { createContext } from '@tamagui/create-context'
4
4
  import { focusFocusable } from '@tamagui/focusable'
5
- import { getButtonSized } from '@tamagui/get-button-sized'
6
5
  import { getFontSized } from '@tamagui/get-font-sized'
6
+ import { resolveSizeToken } from '@tamagui/size'
7
7
  import { SizableText } from '@tamagui/text'
8
- import type { FontSizeTokens, GetProps } from '@tamagui/web'
9
- import { styled } from '@tamagui/web'
8
+ import type {
9
+ FontSizeTokens,
10
+ GetProps,
11
+ SizeTokens,
12
+ VariantSpreadExtras,
13
+ } from '@tamagui/web'
14
+ import { createStyledHOC, styled } from '@tamagui/web'
10
15
  import * as React from 'react'
11
16
 
12
17
  const NAME = 'Label'
@@ -21,49 +26,44 @@ const [LabelProvider, useLabelContextImpl] = createContext<LabelContextValue>(NA
21
26
  controlRef: { current: null },
22
27
  })
23
28
 
29
+ const labelSizeVariant = (val: SizeTokens | true, extras: VariantSpreadExtras<any>) => {
30
+ const fontStyle = getFontSized(val as FontSizeTokens, extras as any)
31
+ // line-height matches the control height at the same size token, so a Label
32
+ // sits flush next to the Input/Button it labels
33
+ const sizeKey = resolveSizeToken(val, 'size')
34
+ return {
35
+ ...fontStyle,
36
+ lineHeight: typeof sizeKey === 'number' ? sizeKey : extras.tokens.size[sizeKey],
37
+ }
38
+ }
39
+
40
+ // Unstyled Label frame: structural layout (label element, flex alignment,
41
+ // selection/cursor resets) + the size mechanism (size-derived font) only. The
42
+ // theme text color + the press color feedback live in the tamagui skin
43
+ // (code/ui/tamagui/src/components/Label.tsx).
24
44
  export const LabelFrame = styled(SizableText, {
25
- name: 'Label',
45
+ displayName: 'Label',
26
46
  render: 'label',
47
+ size: true,
48
+ backgroundColor: 'transparent',
49
+ display: 'flex',
50
+ alignItems: 'center',
51
+ userSelect: 'none',
52
+ cursor: 'default',
27
53
 
28
54
  variants: {
29
- unstyled: {
30
- false: {
31
- size: '$true',
32
- color: '$color',
33
- backgroundColor: 'transparent',
34
- display: 'flex',
35
- alignItems: 'center',
36
- userSelect: 'none',
37
- cursor: 'default',
38
- pressStyle: {
39
- color: '$colorPress',
40
- },
41
- },
42
- },
43
-
44
55
  size: {
45
- '...size': (val, extras) => {
46
- const buttonStyle = getButtonSized(val, extras)
47
- const buttonHeight = buttonStyle?.height
48
- const fontStyle = getFontSized(val as FontSizeTokens, extras as any)
49
- return {
50
- ...fontStyle,
51
- lineHeight: buttonHeight ? extras.tokens.size[buttonHeight] : undefined,
52
- }
53
- },
56
+ true: labelSizeVariant,
57
+ Size: labelSizeVariant,
54
58
  },
55
59
  } as const,
56
-
57
- defaultVariants: {
58
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
59
- },
60
60
  })
61
61
 
62
62
  export type LabelProps = GetProps<typeof LabelFrame> & {
63
63
  htmlFor?: string
64
64
  }
65
65
 
66
- export const Label = LabelFrame.styleable(function Label(props, forwardedRef) {
66
+ export const Label = createStyledHOC(LabelFrame, function Label(props, forwardedRef) {
67
67
  const { htmlFor, id: idProp, ...labelProps } = props
68
68
  const controlRef = React.useRef<HTMLElement | null>(null)
69
69
  const ref = React.useRef<any>(null)
package/types/Label.d.ts CHANGED
@@ -1,17 +1,21 @@
1
- import type { FontSizeTokens, GetProps } from '@tamagui/web';
2
- export declare const LabelFrame: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
3
- unstyled?: boolean | undefined;
4
- size?: import("@tamagui/web").SizeTokens | FontSizeTokens | undefined;
5
- }, import("@tamagui/web").StaticConfigPublic>;
1
+ import type { GetProps } from '@tamagui/web';
2
+ import * as React from 'react';
3
+ export declare const LabelFrame: React.FunctionComponent<Omit<import("@tamagui/web").TextNonStyleProps, "size" | keyof import("@tamagui/web").TextStylePropsBase> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").TextStylePropsBase> & {
4
+ size?: string | number | boolean | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
5
+ } & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").TextStylePropsBase>> & {
6
+ ref?: React.Ref<import("@tamagui/web").TamaguiTextElement> | undefined;
7
+ }> & import("@tamagui/web").StaticComponentObject<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
8
+ size?: string | number | boolean | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
9
+ }, import("@tamagui/web").StaticConfigPublic> & Omit<import("@tamagui/web").StaticConfigPublic, "staticConfig"> & {
10
+ __tama: [import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
11
+ size?: string | number | boolean | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
12
+ }, import("@tamagui/web").StaticConfigPublic];
13
+ };
6
14
  export type LabelProps = GetProps<typeof LabelFrame> & {
7
15
  htmlFor?: string;
8
16
  };
9
- export declare const Label: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").GetFinalProps<import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
10
- unstyled?: boolean | undefined;
11
- size?: import("@tamagui/web").SizeTokens | FontSizeTokens | undefined;
12
- }>, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps & void, import("@tamagui/web").TextStylePropsBase, {
13
- unstyled?: boolean | undefined;
14
- size?: import("@tamagui/web").SizeTokens | FontSizeTokens | undefined;
17
+ export declare const Label: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("react-native").Text | (HTMLElement & import("@tamagui/web").TamaguiElementMethods), import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
18
+ size?: string | number | boolean | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
15
19
  }, import("@tamagui/web").StaticConfigPublic>;
16
20
  export declare const useLabelContext: (element?: HTMLElement | null) => string | undefined;
17
21
  //# sourceMappingURL=Label.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../src/Label.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAgB5D,eAAO,MAAM,UAAU;;;6CAoCrB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,GAAG;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,KAAK;;;;;;6CAmFhB,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,WAAW,GAAG,IAAI,uBAS3D,CAAA"}
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../src/Label.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,QAAQ,EAGT,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA6B9B,eAAO,MAAM,UAAU;;;;;;;;;;CAgBrB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,GAAG;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,KAAK;;6CAmFhB,CAAA;AAEF,eAAO,MAAM,eAAe,aAAc,WAAW,GAAG,IAAI,uBAS3D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}