@tamagui/label 3.0.0-beta.831.1 → 3.0.0-beta.889.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.
@@ -46,14 +46,20 @@ const [LabelProvider, useLabelContextImpl] = (0, import_create_context.createCon
46
46
  id: void 0,
47
47
  controlRef: { current: null }
48
48
  });
49
- const labelSizeVariant = (val, extras) => {
50
- const fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
49
+ const labelSizeVariant = import_web.styled.dynamic((val, env) => {
50
+ const fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
51
51
  const sizeKey = (0, import_size.resolveSizeToken)(val, "size");
52
52
  return {
53
- ...fontStyle,
54
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
53
+ color: fontStyle?.color,
54
+ fontFamily: fontStyle?.fontFamily,
55
+ fontSize: fontStyle?.fontSize,
56
+ fontStyle: fontStyle?.fontStyle,
57
+ fontWeight: fontStyle?.fontWeight,
58
+ letterSpacing: fontStyle?.letterSpacing,
59
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
60
+ textTransform: fontStyle?.textTransform
55
61
  };
56
- };
62
+ });
57
63
  const LabelFrame = (0, import_web.styled)(import_text.SizableText, {
58
64
  displayName: "Label",
59
65
  render: "label",
@@ -63,10 +69,7 @@ const LabelFrame = (0, import_web.styled)(import_text.SizableText, {
63
69
  alignItems: "center",
64
70
  userSelect: "none",
65
71
  cursor: "default",
66
- variants: { size: {
67
- true: labelSizeVariant,
68
- Size: labelSizeVariant
69
- } }
72
+ variants: { size: labelSizeVariant }
70
73
  });
71
74
  const Label = (0, import_web.createStyledHOC)(LabelFrame, function Label2(props, forwardedRef) {
72
75
  const { htmlFor, id: idProp, ...labelProps } = props;
@@ -48,14 +48,20 @@ var [LabelProvider, useLabelContextImpl] = (0, import_create_context.createConte
48
48
  id: void 0,
49
49
  controlRef: { current: null }
50
50
  });
51
- var labelSizeVariant = function(val, extras) {
52
- var fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
51
+ var labelSizeVariant = import_web.styled.dynamic(function(val, env) {
52
+ var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
53
53
  var sizeKey = (0, import_size.resolveSizeToken)(val, "size");
54
54
  return {
55
- ...fontStyle,
56
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
55
+ color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
56
+ fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
57
+ fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
58
+ fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
59
+ fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
60
+ letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
61
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
62
+ textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform
57
63
  };
58
- };
64
+ });
59
65
  var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
60
66
  displayName: "Label",
61
67
  render: "label",
@@ -65,10 +71,7 @@ var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
65
71
  alignItems: "center",
66
72
  userSelect: "none",
67
73
  cursor: "default",
68
- variants: { size: {
69
- true: labelSizeVariant,
70
- Size: labelSizeVariant
71
- } }
74
+ variants: { size: labelSizeVariant }
72
75
  });
73
76
  var Label = (0, import_web.createStyledHOC)(LabelFrame, function Label2(props, forwardedRef) {
74
77
  var { htmlFor, id: idProp, ...labelProps } = props;
@@ -48,14 +48,20 @@ var [LabelProvider, useLabelContextImpl] = (0, import_create_context.createConte
48
48
  id: void 0,
49
49
  controlRef: { current: null }
50
50
  });
51
- var labelSizeVariant = function(val, extras) {
52
- var fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
51
+ var labelSizeVariant = import_web.styled.dynamic(function(val, env) {
52
+ var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
53
53
  var sizeKey = (0, import_size.resolveSizeToken)(val, "size");
54
54
  return {
55
- ...fontStyle,
56
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
55
+ color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
56
+ fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
57
+ fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
58
+ fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
59
+ fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
60
+ letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
61
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
62
+ textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform
57
63
  };
58
- };
64
+ });
59
65
  var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
60
66
  displayName: "Label",
61
67
  render: "label",
@@ -65,10 +71,7 @@ var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
65
71
  alignItems: "center",
66
72
  userSelect: "none",
67
73
  cursor: "default",
68
- variants: { size: {
69
- true: labelSizeVariant,
70
- Size: labelSizeVariant
71
- } }
74
+ variants: { size: labelSizeVariant }
72
75
  });
73
76
  var Label = (0, import_web.createStyledHOC)(LabelFrame, function Label2(props, forwardedRef) {
74
77
  var { htmlFor, id: idProp, ...labelProps } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.native.js","names":[],"sources":["cjs/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) controlRef.current = element;\n }, [\n element,\n controlRef\n ]);\n return context.id;\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,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,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AAG,CACD,IACA,OACF,CAAC;CACH;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe;EAChE;EACA;EACA,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,YAAY;GAChE;GAEA;GACA,GAAG;GACH,KAAK;GACL,aAAa,SAAS,OAAO;IAC3B,IAAI;IACJ,CAAC,qBAAqB,MAAM,iBAAiB,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,KAAK,OAAO,KAAK;IAClI,IAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS,GAAG;KAC/C,MAAM,eAAe;IACvB;GACF;GACA,SAAS,SAAS,OAAO;IACvB,IAAI;IACJ,CAAC,iBAAiB,MAAM,aAAa,QAAQ,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe,KAAK,OAAO,KAAK;IAClH,IAAI,iBAAiB,OAAO;KAC1B,IAAI,WAAW,CAAC,WAAW,WAAW,MAAM,kBAAkB;KAC9D,IAAI,oBAAoB,WAAW,QAAQ,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,eAAc,CAAE,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"}
1
+ {"version":3,"file":"Label.native.js","names":[],"sources":["cjs/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 = import_web.styled.dynamic(function(val, env) {\n var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);\n var sizeKey = (0, import_size.resolveSizeToken)(val, \"size\");\n return {\n color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,\n fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,\n fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,\n fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,\n fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,\n letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : env.tokens.size[sizeKey],\n textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform\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: labelSizeVariant\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) controlRef.current = element;\n }, [\n element,\n controlRef\n ]);\n return context.id;\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9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ACJ,CAAC,iBAAiB,MAAM,aAAa,QAAQ,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe,KAAK,OAAO,KAAK;IAClH,IAAI,iBAAiB,OAAO;KAC1B,IAAI,WAAW,CAAC,WAAW,WAAW,MAAM,kBAAkB;KAC9D,IAAI,oBAAoB,WAAW,QAAQ,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,eAAc,CAAE,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"}
@@ -14,14 +14,20 @@ const [LabelProvider, useLabelContextImpl] = createContext(NAME, {
14
14
  id: void 0,
15
15
  controlRef: { current: null }
16
16
  });
17
- const labelSizeVariant = (val, extras) => {
18
- const fontStyle = getFontSized(val, extras);
17
+ const labelSizeVariant = styled.dynamic((val, env) => {
18
+ const fontStyle = getFontSized(val, env);
19
19
  const sizeKey = resolveSizeToken(val, "size");
20
20
  return {
21
- ...fontStyle,
22
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
21
+ color: fontStyle?.color,
22
+ fontFamily: fontStyle?.fontFamily,
23
+ fontSize: fontStyle?.fontSize,
24
+ fontStyle: fontStyle?.fontStyle,
25
+ fontWeight: fontStyle?.fontWeight,
26
+ letterSpacing: fontStyle?.letterSpacing,
27
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
28
+ textTransform: fontStyle?.textTransform
23
29
  };
24
- };
30
+ });
25
31
  const LabelFrame = styled(SizableText, {
26
32
  displayName: "Label",
27
33
  render: "label",
@@ -31,10 +37,7 @@ const LabelFrame = styled(SizableText, {
31
37
  alignItems: "center",
32
38
  userSelect: "none",
33
39
  cursor: "default",
34
- variants: { size: {
35
- true: labelSizeVariant,
36
- Size: labelSizeVariant
37
- } }
40
+ variants: { size: labelSizeVariant }
38
41
  });
39
42
  const Label = createStyledHOC(LabelFrame, function Label2(props, forwardedRef) {
40
43
  const { htmlFor, id: idProp, ...labelProps } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","names":[],"sources":["esm/Label.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext } from \"@tamagui/create-context\";\nimport { focusFocusable } from \"@tamagui/focusable\";\nimport { getFontSized } from \"@tamagui/get-font-sized\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { SizableText } from \"@tamagui/text\";\nimport { createStyledHOC, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Label\";\nconst [LabelProvider, useLabelContextImpl] = createContext(NAME, {\n id: void 0,\n controlRef: { current: null }\n});\nconst labelSizeVariant = (val, extras) => {\n const fontStyle = getFontSized(val, extras);\n const sizeKey = resolveSizeToken(val, \"size\");\n return {\n ...fontStyle,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : extras.tokens.size[sizeKey]\n };\n};\nconst LabelFrame = styled(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});\nconst Label = createStyledHOC(LabelFrame, function Label2(props, forwardedRef) {\n const { htmlFor, id: idProp, ...labelProps } = props;\n const controlRef = React.useRef(null);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const backupId = React.useId();\n const id = idProp ?? backupId;\n if (isWeb) {\n useIsomorphicLayoutEffect(() => {\n if (htmlFor) {\n const element = document.getElementById(htmlFor);\n const label = ref.current;\n if (label && element) {\n const getAriaLabel = () => element.getAttribute(\"aria-labelledby\");\n const ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(\" \");\n element.setAttribute(\"aria-labelledby\", ariaLabelledBy);\n controlRef.current = element;\n return () => {\n if (!id) return;\n const ariaLabelledBy2 = 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 }, [id, htmlFor]);\n }\n return /* @__PURE__ */ jsx(LabelProvider, { id, controlRef, children: /* @__PURE__ */ jsx(\n LabelFrame,\n {\n id,\n htmlFor,\n ...labelProps,\n ref: composedRefs,\n onMouseDown: (event) => {\n props.onMouseDown?.(event);\n if (!event.defaultPrevented && event.detail > 1) {\n event.preventDefault();\n }\n },\n onPress: (event) => {\n props.onPress?.(event);\n if (isWeb) {\n if (htmlFor || !controlRef.current || event.defaultPrevented) return;\n const isClickingControl = controlRef.current.contains(\n event.target\n );\n const isUserClick = event.isTrusted === true;\n if (!isClickingControl && isUserClick) {\n controlRef.current.click();\n controlRef.current.focus();\n }\n } else {\n if (props.htmlFor) {\n focusFocusable(props.htmlFor);\n }\n }\n }\n }\n ) });\n});\nconst useLabelContext = (element) => {\n const context = useLabelContextImpl(\"LabelConsumer\");\n const { controlRef } = context;\n React.useEffect(() => {\n if (element) controlRef.current = element;\n }, [element, controlRef]);\n return context.id;\n};\nexport {\n Label,\n LabelFrame,\n useLabelContext\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,MAAM,OAAO;AACb,MAAM,CAAC,eAA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AI,iBAAiB;OAC1B,QAAQ,aAAa,mBAAmB,eAAe;MACzD;KACF;IACF;GACF;EACF,GAAG,CAAC,IAAI,OAAO,CAAC;CAClB;CACA,OAAuB,oBAAI,eAAe;EAAE;EAAI;EAAY,UAA0B,oBACpF,YACA;GACE;GACA;GACA,GAAG;GACH,KAAK;GACL,cAAc,UAAU;IACtB,MAAM,cAAc,KAAK;IACzB,IAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS,GAAG;KAC/C,MAAM,eAAe;IACvB;GACF;GACA,UAAU,UAAU;IAClB,MAAM,UAAU,KAAK;IACrB,IAAI,OAAO;KACT,IAAI,WAAW,CAAC,WAAW,WAAW,MAAM,kBAAkB;KAC9D,MAAM,oBAAoB,WAAW,QAAQ,SAC3C,MAAM,MACR;KACA,MAAM,cAAc,MAAM,cAAc;KACxC,IAAI,CAAC,qBAAqB,aAAa;MACrC,WAAW,QAAQ,MAAM;MACzB,WAAW,QAAQ,MAAM;KAC3B;IACF,OAAO;KACL,IAAI,MAAM,SAAS;MACjB,eAAe,MAAM,OAAO;KAC9B;IACF;GACF;EACF,CACF;CAAE,CAAC;AACL,CAAC;AACD,MAAM,mBAAmB,YAAY;CACnC,MAAM,UAAU,oBAAoB,eAAe;CACnD,MAAM,EAAE,eAAe;CACvB,MAAM,gBAAgB;EACpB,IAAI,SAAS,WAAW,UAAU;CACpC,GAAG,CAAC,SAAS,UAAU,CAAC;CACxB,OAAO,QAAQ;AACjB"}
1
+ {"version":3,"file":"Label.js","names":[],"sources":["esm/Label.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext } from \"@tamagui/create-context\";\nimport { focusFocusable } from \"@tamagui/focusable\";\nimport { getFontSized } from \"@tamagui/get-font-sized\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { SizableText } from \"@tamagui/text\";\nimport { createStyledHOC, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Label\";\nconst [LabelProvider, useLabelContextImpl] = createContext(NAME, {\n id: void 0,\n controlRef: { current: null }\n});\nconst labelSizeVariant = styled.dynamic((val, env) => {\n const fontStyle = getFontSized(val, env);\n const sizeKey = resolveSizeToken(val, \"size\");\n return {\n color: fontStyle?.color,\n fontFamily: fontStyle?.fontFamily,\n fontSize: fontStyle?.fontSize,\n fontStyle: fontStyle?.fontStyle,\n fontWeight: fontStyle?.fontWeight,\n letterSpacing: fontStyle?.letterSpacing,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : env.tokens.size[sizeKey],\n textTransform: fontStyle?.textTransform\n };\n});\nconst LabelFrame = styled(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: labelSizeVariant\n }\n});\nconst Label = createStyledHOC(LabelFrame, function Label2(props, forwardedRef) {\n const { htmlFor, id: idProp, ...labelProps } = props;\n const controlRef = React.useRef(null);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const backupId = React.useId();\n const id = idProp ?? backupId;\n if (isWeb) {\n useIsomorphicLayoutEffect(() => {\n if (htmlFor) {\n const element = document.getElementById(htmlFor);\n const label = ref.current;\n if (label && element) {\n const getAriaLabel = () => element.getAttribute(\"aria-labelledby\");\n const ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(\" \");\n element.setAttribute(\"aria-labelledby\", ariaLabelledBy);\n controlRef.current = element;\n return () => {\n if (!id) return;\n const ariaLabelledBy2 = 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 }, [id, htmlFor]);\n }\n return /* @__PURE__ */ jsx(LabelProvider, { id, controlRef, children: /* @__PURE__ */ jsx(\n LabelFrame,\n {\n id,\n htmlFor,\n ...labelProps,\n ref: composedRefs,\n onMouseDown: (event) => {\n props.onMouseDown?.(event);\n if (!event.defaultPrevented && event.detail > 1) {\n event.preventDefault();\n }\n },\n onPress: (event) => {\n props.onPress?.(event);\n if (isWeb) {\n if (htmlFor || !controlRef.current || event.defaultPrevented) return;\n const isClickingControl = controlRef.current.contains(\n event.target\n );\n const isUserClick = event.isTrusted === true;\n if (!isClickingControl && isUserClick) {\n controlRef.current.click();\n controlRef.current.focus();\n }\n } else {\n if (props.htmlFor) {\n focusFocusable(props.htmlFor);\n }\n }\n }\n }\n ) });\n});\nconst useLabelContext = (element) => {\n const context = useLabelContextImpl(\"LabelConsumer\");\n const { controlRef } = context;\n React.useEffect(() => {\n if (element) controlRef.current = element;\n }, [element, controlRef]);\n return context.id;\n};\nexport {\n Label,\n LabelFrame,\n useLabelContext\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,MAAM,OAAO;AACb,MAAM,CAAC,eAAe,uBAAuB,cAAc,MAAM;CAC/D,IAAI,KAAK;CACT,YAAY,EAAE,SAAS,KAAK;AAC9B,CAAC;AACD,MAAM,mBAAmB,OAAO,SAAS,KAAK,QAAQ;CACpD,MAAM,YAAY,aAAa,KAAK,GAAG;CACvC,MAAM,UAAU,iBAAiB,KAAK,MAAM;CAC5C,OAAO;EACL,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,WAAW,WAAW;EACtB,YAAY,WAAW;EACvB,eAAe,WAAW;EAC1B,YAAY,OAAO,YAAY,WAAW,UAAU,IAAI,OAAO,KAAK;EACpE,eAAe,WAAW;CAC5B;AACF,CAAC;AACD,MAAM,aAAa,OAAO,aAAa;CACrC,aAAa;CACb,QAAQ;CACR,MAAM;CACN,iBAAiB;CACjB,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,UAAU,EACR,MAAM,iB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AAW,QAAQ,SAC3C,MAAM,MACR;KACA,MAAM,cAAc,MAAM,cAAc;KACxC,IAAI,CAAC,qBAAqB,aAAa;MACrC,WAAW,QAAQ,MAAM;MACzB,WAAW,QAAQ,MAAM;KAC3B;IACF,OAAO;KACL,IAAI,MAAM,SAAS;MACjB,eAAe,MAAM,OAAO;KAC9B;IACF;GACF;EACF,CACF;CAAE,CAAC;AACL,CAAC;AACD,MAAM,mBAAmB,YAAY;CACnC,MAAM,UAAU,oBAAoB,eAAe;CACnD,MAAM,EAAE,eAAe;CACvB,MAAM,gBAAgB;EACpB,IAAI,SAAS,WAAW,UAAU;CACpC,GAAG,CAAC,SAAS,UAAU,CAAC;CACxB,OAAO,QAAQ;AACjB"}
@@ -14,14 +14,20 @@ var [LabelProvider, useLabelContextImpl] = createContext(NAME, {
14
14
  id: void 0,
15
15
  controlRef: { current: null }
16
16
  });
17
- var labelSizeVariant = function(val, extras) {
18
- var fontStyle = getFontSized(val, extras);
17
+ var labelSizeVariant = styled.dynamic(function(val, env) {
18
+ var fontStyle = getFontSized(val, env);
19
19
  var sizeKey = resolveSizeToken(val, "size");
20
20
  return {
21
- ...fontStyle,
22
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
21
+ color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
22
+ fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
23
+ fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
24
+ fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
25
+ fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
26
+ letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
27
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
28
+ textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform
23
29
  };
24
- };
30
+ });
25
31
  var LabelFrame = styled(SizableText, {
26
32
  displayName: "Label",
27
33
  render: "label",
@@ -31,10 +37,7 @@ var LabelFrame = styled(SizableText, {
31
37
  alignItems: "center",
32
38
  userSelect: "none",
33
39
  cursor: "default",
34
- variants: { size: {
35
- true: labelSizeVariant,
36
- Size: labelSizeVariant
37
- } }
40
+ variants: { size: labelSizeVariant }
38
41
  });
39
42
  var Label = createStyledHOC(LabelFrame, function Label2(props, forwardedRef) {
40
43
  var { htmlFor, id: idProp, ...labelProps } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.native.js","names":[],"sources":["esm/Label.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext } from \"@tamagui/create-context\";\nimport { focusFocusable } from \"@tamagui/focusable\";\nimport { getFontSized } from \"@tamagui/get-font-sized\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { SizableText } from \"@tamagui/text\";\nimport { createStyledHOC, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nvar NAME = \"Label\";\nvar [LabelProvider, useLabelContextImpl] = createContext(NAME, {\n id: void 0,\n controlRef: {\n current: null\n }\n});\nvar labelSizeVariant = function(val, extras) {\n var fontStyle = getFontSized(val, extras);\n var sizeKey = resolveSizeToken(val, \"size\");\n return {\n ...fontStyle,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : extras.tokens.size[sizeKey]\n };\n};\nvar LabelFrame = styled(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 = 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 = useComposedRefs(forwardedRef, ref);\n var backupId = React.useId();\n var id = idProp !== null && idProp !== void 0 ? idProp : backupId;\n if (isWeb) {\n 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__ */ _jsx(LabelProvider, {\n id,\n controlRef,\n children: /* @__PURE__ */ _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 (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 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) controlRef.current = element;\n }, [\n element,\n controlRef\n ]);\n return context.id;\n};\nexport {\n Label,\n LabelFrame,\n useLabelContext\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,IAAI,OAAO;AACX,IAAI,CAAC,eAAe,uBAAuB,cAAc,MAAM;CAC7D,IAAI,KAAK;CACT,YAAY,EACV,SAAS,KACX;AACF,CAAC;AACD,IAAI,mBAAmB,SAAS,KAAK,QAAQ;CAC3C,IAAI,YAAY,aAAa,KAAK,MAAM;CACxC,IAAI,UAAU,iBAAiB,KAAK,MAAM;CAC1C,OAAO;EACL,GAAG;EACH,YAAY,OAAO,YAAY,WAAW,UAAU,OAAO,OAAO,KAAK;CACzE;AACF;AACA,IAAI,aAAa,OAAO,aAAa;CACnC,aAAa;CACb,QAAQ;CACR,MAAM;CACN,iBAAiB;CACjB,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,UAAU,EACR,MAAM;EACJ,MAAM;EACN,MAAM;CACR,EACF;AACF,CAAC;AACD,IAAI,QAAQ,gBAAgB,YAAY,SAAS,OAAO,OAAO,cAAc;CAC3E,IAAI,EAAE,SAAS,IAAI,QAAQ,GAAG,eAAe;CAC7C,IAAI,aAAa,MAAM,OAAO,IAAI;CAClC,IAAI,MAAM,MAAM,OAAO,IAAI;CAC3B,IAAI,eAAe,gBAAgB,cAAc,GAAG;CACpD,IAAI,WAAW,MAAM,MAAM;CAC3B,IAAI,KAAK,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS;CACzD,IAAI,OAAO;EACT,0BAA0B,WAAW;GACnC,IAAI,SAAS;IACX,IAAI,UAAU,SAAS,eAAe,OAAO;IAC7C,IAAI,QAAQ,IAAI;IAChB,IAAI,SAAS,SAAS;KACpB,IAAI,eAAe,WAAW;MAC5B,OAAO,QAAQ,aAAa,iBAAiB;KAC/C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;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"}
1
+ {"version":3,"file":"Label.native.js","names":[],"sources":["esm/Label.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext } from \"@tamagui/create-context\";\nimport { focusFocusable } from \"@tamagui/focusable\";\nimport { getFontSized } from \"@tamagui/get-font-sized\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { SizableText } from \"@tamagui/text\";\nimport { createStyledHOC, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nvar NAME = \"Label\";\nvar [LabelProvider, useLabelContextImpl] = createContext(NAME, {\n id: void 0,\n controlRef: {\n current: null\n }\n});\nvar labelSizeVariant = styled.dynamic(function(val, env) {\n var fontStyle = getFontSized(val, env);\n var sizeKey = resolveSizeToken(val, \"size\");\n return {\n color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,\n fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,\n fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,\n fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,\n fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,\n letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : env.tokens.size[sizeKey],\n textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform\n };\n});\nvar LabelFrame = styled(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: labelSizeVariant\n }\n});\nvar Label = 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 = useComposedRefs(forwardedRef, ref);\n var backupId = React.useId();\n var id = idProp !== null && idProp !== void 0 ? idProp : backupId;\n if (isWeb) {\n 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__ */ _jsx(LabelProvider, {\n id,\n controlRef,\n children: /* @__PURE__ */ _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 (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 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) controlRef.current = element;\n }, [\n element,\n controlRef\n ]);\n return context.id;\n};\nexport {\n Label,\n LabelFrame,\n useLabelContext\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,IAAI,OAAO;AACX,IAAI,CAAC,eAAe,uBAAuB,cAAc,MAAM;CAC7D,IAAI,KAAK;CACT,YAAY,EACV,SAAS,KACX;AACF,CAAC;AACD,IAAI,mBAAmB,OAAO,QAAQ,SAAS,KAAK,KAAK;CACvD,IAAI,YAAY,aAAa,KAAK,GAAG;CACrC,IAAI,UAAU,iBAAiB,KAAK,MAAM;CAC1C,OAAO;EACL,OAAO,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EACvE,YAAY,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAC5E,UAAU,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAC1E,WAAW,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAC3E,YAAY,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAC5E,eAAe,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAC/E,YAAY,OAAO,YAAY,WAAW,UAAU,IAAI,OAAO,KAAK;EACpE,eAAe,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;CACjF;AACF,CAAC;AACD,IAAI,aAAa,OAAO,aAAa;CACnC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,OAAO;IAC3B,IAAI;IACJ,CAAC,qBAAqB,MAAM,iBAAiB,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,KAAK,OAAO,KAAK;IAClI,IAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS,GAAG;KAC/C,MAAM,eAAe;IACvB;GACF;GACA,SAAS,SAAS,OAAO;IACvB,IAAI;IACJ,CAAC,iBAAiB,MAAM,aAAa,QAAQ,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe,KAAK,OAAO,KAAK;IAClH,IAAI,OAAO;KACT,IAAI,WAAW,CAAC,WAAW,WAAW,MAAM,kBAAkB;KAC9D,IAAI,oBAAoB,WAAW,QAAQ,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,eAAe,MAAM,OAAO;KAC9B;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"}
@@ -14,14 +14,20 @@ const [LabelProvider, useLabelContextImpl] = createContext(NAME, {
14
14
  id: void 0,
15
15
  controlRef: { current: null }
16
16
  });
17
- const labelSizeVariant = (val, extras) => {
18
- const fontStyle = getFontSized(val, extras);
17
+ const labelSizeVariant = styled.dynamic((val, env) => {
18
+ const fontStyle = getFontSized(val, env);
19
19
  const sizeKey = resolveSizeToken(val, "size");
20
20
  return {
21
- ...fontStyle,
22
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
21
+ color: fontStyle?.color,
22
+ fontFamily: fontStyle?.fontFamily,
23
+ fontSize: fontStyle?.fontSize,
24
+ fontStyle: fontStyle?.fontStyle,
25
+ fontWeight: fontStyle?.fontWeight,
26
+ letterSpacing: fontStyle?.letterSpacing,
27
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
28
+ textTransform: fontStyle?.textTransform
23
29
  };
24
- };
30
+ });
25
31
  const LabelFrame = styled(SizableText, {
26
32
  displayName: "Label",
27
33
  render: "label",
@@ -31,10 +37,7 @@ const LabelFrame = styled(SizableText, {
31
37
  alignItems: "center",
32
38
  userSelect: "none",
33
39
  cursor: "default",
34
- variants: { size: {
35
- true: labelSizeVariant,
36
- Size: labelSizeVariant
37
- } }
40
+ variants: { size: labelSizeVariant }
38
41
  });
39
42
  const Label = createStyledHOC(LabelFrame, function Label2(props, forwardedRef) {
40
43
  const { htmlFor, id: idProp, ...labelProps } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","names":[],"sources":["jsx/Label.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext } from \"@tamagui/create-context\";\nimport { focusFocusable } from \"@tamagui/focusable\";\nimport { getFontSized } from \"@tamagui/get-font-sized\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { SizableText } from \"@tamagui/text\";\nimport { createStyledHOC, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Label\";\nconst [LabelProvider, useLabelContextImpl] = createContext(NAME, {\n id: void 0,\n controlRef: { current: null }\n});\nconst labelSizeVariant = (val, extras) => {\n const fontStyle = getFontSized(val, extras);\n const sizeKey = resolveSizeToken(val, \"size\");\n return {\n ...fontStyle,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : extras.tokens.size[sizeKey]\n };\n};\nconst LabelFrame = styled(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});\nconst Label = createStyledHOC(LabelFrame, function Label2(props, forwardedRef) {\n const { htmlFor, id: idProp, ...labelProps } = props;\n const controlRef = React.useRef(null);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const backupId = React.useId();\n const id = idProp ?? backupId;\n if (isWeb) {\n useIsomorphicLayoutEffect(() => {\n if (htmlFor) {\n const element = document.getElementById(htmlFor);\n const label = ref.current;\n if (label && element) {\n const getAriaLabel = () => element.getAttribute(\"aria-labelledby\");\n const ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(\" \");\n element.setAttribute(\"aria-labelledby\", ariaLabelledBy);\n controlRef.current = element;\n return () => {\n if (!id) return;\n const ariaLabelledBy2 = 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 }, [id, htmlFor]);\n }\n return /* @__PURE__ */ jsx(LabelProvider, { id, controlRef, children: /* @__PURE__ */ jsx(\n LabelFrame,\n {\n id,\n htmlFor,\n ...labelProps,\n ref: composedRefs,\n onMouseDown: (event) => {\n props.onMouseDown?.(event);\n if (!event.defaultPrevented && event.detail > 1) {\n event.preventDefault();\n }\n },\n onPress: (event) => {\n props.onPress?.(event);\n if (isWeb) {\n if (htmlFor || !controlRef.current || event.defaultPrevented) return;\n const isClickingControl = controlRef.current.contains(\n event.target\n );\n const isUserClick = event.isTrusted === true;\n if (!isClickingControl && isUserClick) {\n controlRef.current.click();\n controlRef.current.focus();\n }\n } else {\n if (props.htmlFor) {\n focusFocusable(props.htmlFor);\n }\n }\n }\n }\n ) });\n});\nconst useLabelContext = (element) => {\n const context = useLabelContextImpl(\"LabelConsumer\");\n const { controlRef } = context;\n React.useEffect(() => {\n if (element) controlRef.current = element;\n }, [element, controlRef]);\n return context.id;\n};\nexport {\n Label,\n LabelFrame,\n useLabelContext\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,MAAM,OAAO;AACb,MAAM,CAAC,eAAe,uBAAuB,cAAc,MAAM;CAC/D,IAAI,KAAK;CACT,YAAY,EAAE,SAAS,KAAK;AAC9B,CAAC;AACD,MAAM,oBAAoB,KAAK,WAAW;CACxC,MAAM,YAAY,aAAa,KAAK,MAAM;CAC1C,MAAM,UAAU,iBAAiB,KAAK,MAAM;CAC5C,OAAO;EACL,GAAG;EACH,YAAY,OAAO,YAAY,WAAW,UAAU,OAAO,OAAO,KAAK;CACzE;AACF;AACA,MAAM,aAAa,OAAO,aAAa;CACrC,aAAa;CACb,QAAQ;CACR,MAAM;CACN,iBAAiB;CACjB,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,UAAU,EACR,MAAM;EACJ,MAAM;EACN,MAAM;CACR,EACF;AACF,CAAC;AACD,MAAM,QAAQ,gBAAgB,YAAY,SAAS,OAAO,OAAO,cAAc;CAC7E,MAAM,EAAE,SAAS,IAAI,QAAQ,GAAG,eAAe;CAC/C,MAAM,aAAa,MAAM,OAAO,IAAI;CACpC,MAAM,MAAM,MAAM,OAAO,IAAI;CAC7B,MAAM,eAAe,gBAAgB,cAAc,GAAG;CACtD,MAAM,WAAW,MAAM,MAAM;CAC7B,MAAM,KAAK,UAAU;CACrB,IAAI,OAAO;EACT,gCAAgC;GAC9B,IAAI,SAAS;IACX,MAAM,UAAU,SAAS,eAAe,OAAO;IAC/C,MAAM,QAAQ,IAAI;IAClB,IAAI,SAAS,SAAS;KACpB,MAAM,qBAAqB,QAAQ,aAAa,iBAAiB;KACjE,MAAM,iBAAiB,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;KACpE,QAAQ,aAAa,mBAAmB,cAAc;KACtD,WAAW,UAAU;KACrB,aAAa;MACX,IAAI,CAAC,IAAI;MACT,MAAM,kBAAkB,aAAa,CAAC,EAAE,QAAQ,IAAI,EAAE;MACtD,IAAI,oBAAoB,IAAI;OAC1B,QAAQ,gBAAgB,iBAAiB;MAC3C,OAAO,IAAI,iBAAiB;OAC1B,QAAQ,aAAa,mBAAmB,eAAe;MACzD;KACF;IACF;GACF;EACF,GAAG,CAAC,IAAI,OAAO,CAAC;CAClB;CACA,OAAuB,oBAAI,eAAe;EAAE;EAAI;EAAY,UAA0B,oBACpF,YACA;GACE;GACA;GACA,GAAG;GACH,KAAK;GACL,cAAc,UAAU;IACtB,MAAM,cAAc,KAAK;IACzB,IAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS,GAAG;KAC/C,MAAM,eAAe;IACvB;GACF;GACA,UAAU,UAAU;IAClB,MAAM,UAAU,KAAK;IACrB,IAAI,OAAO;KACT,IAAI,WAAW,CAAC,WAAW,WAAW,MAAM,kBAAkB;KAC9D,MAAM,oBAAoB,WAAW,QAAQ,SAC3C,MAAM,MACR;KACA,MAAM,cAAc,MAAM,cAAc;KACxC,IAAI,CAAC,qBAAqB,aAAa;MACrC,WAAW,QAAQ,MAAM;MACzB,WAAW,QAAQ,MAAM;KAC3B;IACF,OAAO;KACL,IAAI,MAAM,SAAS;MACjB,eAAe,MAAM,OAAO;KAC9B;IACF;GACF;EACF,CACF;CAAE,CAAC;AACL,CAAC;AACD,MAAM,mBAAmB,YAAY;CACnC,MAAM,UAAU,oBAAoB,eAAe;CACnD,MAAM,EAAE,eAAe;CACvB,MAAM,gBAAgB;EACpB,IAAI,SAAS,WAAW,UAAU;CACpC,GAAG,CAAC,SAAS,UAAU,CAAC;CACxB,OAAO,QAAQ;AACjB"}
1
+ {"version":3,"file":"Label.js","names":[],"sources":["jsx/Label.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext } from \"@tamagui/create-context\";\nimport { focusFocusable } from \"@tamagui/focusable\";\nimport { getFontSized } from \"@tamagui/get-font-sized\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { SizableText } from \"@tamagui/text\";\nimport { createStyledHOC, styled } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Label\";\nconst [LabelProvider, useLabelContextImpl] = createContext(NAME, {\n id: void 0,\n controlRef: { current: null }\n});\nconst labelSizeVariant = styled.dynamic((val, env) => {\n const fontStyle = getFontSized(val, env);\n const sizeKey = resolveSizeToken(val, \"size\");\n return {\n color: fontStyle?.color,\n fontFamily: fontStyle?.fontFamily,\n fontSize: fontStyle?.fontSize,\n fontStyle: fontStyle?.fontStyle,\n fontWeight: fontStyle?.fontWeight,\n letterSpacing: fontStyle?.letterSpacing,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : env.tokens.size[sizeKey],\n textTransform: fontStyle?.textTransform\n };\n});\nconst LabelFrame = styled(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: labelSizeVariant\n }\n});\nconst Label = createStyledHOC(LabelFrame, function Label2(props, forwardedRef) {\n const { htmlFor, id: idProp, ...labelProps } = props;\n const controlRef = React.useRef(null);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const backupId = React.useId();\n const id = idProp ?? backupId;\n if (isWeb) {\n useIsomorphicLayoutEffect(() => {\n if (htmlFor) {\n const element = document.getElementById(htmlFor);\n const label = ref.current;\n if (label && element) {\n const getAriaLabel = () => element.getAttribute(\"aria-labelledby\");\n const ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(\" \");\n element.setAttribute(\"aria-labelledby\", ariaLabelledBy);\n controlRef.current = element;\n return () => {\n if (!id) return;\n const ariaLabelledBy2 = 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 }, [id, htmlFor]);\n }\n return /* @__PURE__ */ jsx(LabelProvider, { id, controlRef, children: /* @__PURE__ */ jsx(\n LabelFrame,\n {\n id,\n htmlFor,\n ...labelProps,\n ref: composedRefs,\n onMouseDown: (event) => {\n props.onMouseDown?.(event);\n if (!event.defaultPrevented && event.detail > 1) {\n event.preventDefault();\n }\n },\n onPress: (event) => {\n props.onPress?.(event);\n if (isWeb) {\n if (htmlFor || !controlRef.current || event.defaultPrevented) return;\n const isClickingControl = controlRef.current.contains(\n event.target\n );\n const isUserClick = event.isTrusted === true;\n if (!isClickingControl && isUserClick) {\n controlRef.current.click();\n controlRef.current.focus();\n }\n } else {\n if (props.htmlFor) {\n focusFocusable(props.htmlFor);\n }\n }\n }\n }\n ) });\n});\nconst useLabelContext = (element) => {\n const context = useLabelContextImpl(\"LabelConsumer\");\n const { controlRef } = context;\n React.useEffect(() => {\n if (element) controlRef.current = element;\n }, [element, controlRef]);\n return context.id;\n};\nexport {\n Label,\n LabelFrame,\n useLabelContext\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,MAAM,OAAO;AACb,MAAM,CAAC,eAAe,uBAAuB,cAAc,MAAM;CAC/D,IAAI,KAAK;CACT,YAAY,EAAE,SAAS,KAAK;AAC9B,CAAC;AACD,MAAM,mBAAmB,OAAO,SAAS,KAAK,QAAQ;CACpD,MAAM,YAAY,aAAa,KAAK,GAAG;CACvC,MAAM,UAAU,iBAAiB,KAAK,MAAM;CAC5C,OAAO;EACL,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,WAAW,WAAW;EACtB,YAAY,WAAW;EACvB,eAAe,WAAW;EAC1B,YAAY,OAAO,YAAY,WAAW,UAAU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AAI,CAAC,MAAM,oBAAoB,MAAM,SAAS,GAAG;KAC/C,MAAM,eAAe;IACvB;GACF;GACA,UAAU,UAAU;IAClB,MAAM,UAAU,KAAK;IACrB,IAAI,OAAO;KACT,IAAI,WAAW,CAAC,WAAW,WAAW,MAAM,kBAAkB;KAC9D,MAAM,oBAAoB,WAAW,QAAQ,SAC3C,MAAM,MACR;KACA,MAAM,cAAc,MAAM,cAAc;KACxC,IAAI,CAAC,qBAAqB,aAAa;MACrC,WAAW,QAAQ,MAAM;MACzB,WAAW,QAAQ,MAAM;KAC3B;IACF,OAAO;KACL,IAAI,MAAM,SAAS;MACjB,eAAe,MAAM,OAAO;KAC9B;IACF;GACF;EACF,CACF;CAAE,CAAC;AACL,CAAC;AACD,MAAM,mBAAmB,YAAY;CACnC,MAAM,UAAU,oBAAoB,eAAe;CACnD,MAAM,EAAE,eAAe;CACvB,MAAM,gBAAgB;EACpB,IAAI,SAAS,WAAW,UAAU;CACpC,GAAG,CAAC,SAAS,UAAU,CAAC;CACxB,OAAO,QAAQ;AACjB"}
@@ -48,14 +48,20 @@ var [LabelProvider, useLabelContextImpl] = (0, import_create_context.createConte
48
48
  id: void 0,
49
49
  controlRef: { current: null }
50
50
  });
51
- var labelSizeVariant = function(val, extras) {
52
- var fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
51
+ var labelSizeVariant = import_web.styled.dynamic(function(val, env) {
52
+ var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
53
53
  var sizeKey = (0, import_size.resolveSizeToken)(val, "size");
54
54
  return {
55
- ...fontStyle,
56
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
55
+ color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
56
+ fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
57
+ fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
58
+ fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
59
+ fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
60
+ letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
61
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
62
+ textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform
57
63
  };
58
- };
64
+ });
59
65
  var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
60
66
  displayName: "Label",
61
67
  render: "label",
@@ -65,10 +71,7 @@ var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
65
71
  alignItems: "center",
66
72
  userSelect: "none",
67
73
  cursor: "default",
68
- variants: { size: {
69
- true: labelSizeVariant,
70
- Size: labelSizeVariant
71
- } }
74
+ variants: { size: labelSizeVariant }
72
75
  });
73
76
  var Label = (0, import_web.createStyledHOC)(LabelFrame, function Label2(props, forwardedRef) {
74
77
  var { htmlFor, id: idProp, ...labelProps } = props;
@@ -48,14 +48,20 @@ var [LabelProvider, useLabelContextImpl] = (0, import_create_context.createConte
48
48
  id: void 0,
49
49
  controlRef: { current: null }
50
50
  });
51
- var labelSizeVariant = function(val, extras) {
52
- var fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
51
+ var labelSizeVariant = import_web.styled.dynamic(function(val, env) {
52
+ var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
53
53
  var sizeKey = (0, import_size.resolveSizeToken)(val, "size");
54
54
  return {
55
- ...fontStyle,
56
- lineHeight: typeof sizeKey === "number" ? sizeKey : extras.tokens.size[sizeKey]
55
+ color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
56
+ fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
57
+ fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
58
+ fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
59
+ fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
60
+ letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
61
+ lineHeight: typeof sizeKey === "number" ? sizeKey : env.tokens.size[sizeKey],
62
+ textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform
57
63
  };
58
- };
64
+ });
59
65
  var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
60
66
  displayName: "Label",
61
67
  render: "label",
@@ -65,10 +71,7 @@ var LabelFrame = (0, import_web.styled)(import_text.SizableText, {
65
71
  alignItems: "center",
66
72
  userSelect: "none",
67
73
  cursor: "default",
68
- variants: { size: {
69
- true: labelSizeVariant,
70
- Size: labelSizeVariant
71
- } }
74
+ variants: { size: labelSizeVariant }
72
75
  });
73
76
  var Label = (0, import_web.createStyledHOC)(LabelFrame, function Label2(props, forwardedRef) {
74
77
  var { htmlFor, id: idProp, ...labelProps } = props;
@@ -1 +1 @@
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) controlRef.current = element;\n }, [\n element,\n controlRef\n ]);\n return context.id;\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,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,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe;CACtB,aAAa;CACb,kBAAkB;CAClB,uBAAuB;AACzB,CAAC;AACD,OAAO,UAAU,aAAa,aAA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AQ,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe,KAAK,OAAO,KAAK;IAClH,IAAI,iBAAiB,OAAO;KAC1B,IAAI,WAAW,CAAC,WAAW,WAAW,MAAM,kBAAkB;KAC9D,IAAI,oBAAoB,WAAW,QAAQ,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,eAAc,CAAE,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"}
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 = import_web.styled.dynamic(function(val, env) {\n var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);\n var sizeKey = (0, import_size.resolveSizeToken)(val, \"size\");\n return {\n color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,\n fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,\n fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,\n fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,\n fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,\n letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,\n lineHeight: typeof sizeKey === \"number\" ? sizeKey : env.tokens.size[sizeKey],\n textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform\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: labelSizeVariant\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) controlRef.current = element;\n }, [\n element,\n controlRef\n ]);\n return context.id;\n};\n//# sourceMappingURL=Label.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,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,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,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C;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/label",
3
- "version": "3.0.0-beta.831.1",
3
+ "version": "3.0.0-beta.889.1",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -34,17 +34,17 @@
34
34
  "clean:build": "tamagui-build clean:build"
35
35
  },
36
36
  "dependencies": {
37
- "@tamagui/compose-refs": "3.0.0-beta.831.1",
38
- "@tamagui/constants": "3.0.0-beta.831.1",
39
- "@tamagui/create-context": "3.0.0-beta.831.1",
40
- "@tamagui/focusable": "3.0.0-beta.831.1",
41
- "@tamagui/get-font-sized": "3.0.0-beta.831.1",
42
- "@tamagui/size": "3.0.0-beta.831.1",
43
- "@tamagui/text": "3.0.0-beta.831.1",
44
- "@tamagui/web": "3.0.0-beta.831.1"
37
+ "@tamagui/compose-refs": "3.0.0-beta.889.1",
38
+ "@tamagui/constants": "3.0.0-beta.889.1",
39
+ "@tamagui/create-context": "3.0.0-beta.889.1",
40
+ "@tamagui/focusable": "3.0.0-beta.889.1",
41
+ "@tamagui/get-font-sized": "3.0.0-beta.889.1",
42
+ "@tamagui/size": "3.0.0-beta.889.1",
43
+ "@tamagui/text": "3.0.0-beta.889.1",
44
+ "@tamagui/web": "3.0.0-beta.889.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@tamagui/build": "3.0.0-beta.831.1",
47
+ "@tamagui/build": "3.0.0-beta.889.1",
48
48
  "react": "19.2.3",
49
49
  "react-native": "0.86.2"
50
50
  },
package/src/Label.tsx CHANGED
@@ -5,12 +5,7 @@ import { focusFocusable } from '@tamagui/focusable'
5
5
  import { getFontSized } from '@tamagui/get-font-sized'
6
6
  import { resolveSizeToken } from '@tamagui/size'
7
7
  import { SizableText } from '@tamagui/text'
8
- import type {
9
- FontSizeTokens,
10
- GetProps,
11
- SizeTokens,
12
- VariantSpreadExtras,
13
- } from '@tamagui/web'
8
+ import type { FontSizeTokens, GetProps, SizeTokens } from '@tamagui/web'
14
9
  import { createStyledHOC, styled } from '@tamagui/web'
15
10
  import * as React from 'react'
16
11
 
@@ -26,16 +21,22 @@ const [LabelProvider, useLabelContextImpl] = createContext<LabelContextValue>(NA
26
21
  controlRef: { current: null },
27
22
  })
28
23
 
29
- const labelSizeVariant = (val: SizeTokens | true, extras: VariantSpreadExtras<any>) => {
30
- const fontStyle = getFontSized(val as FontSizeTokens, extras as any)
24
+ const labelSizeVariant = styled.dynamic<SizeTokens | true>((val, env) => {
25
+ const fontStyle = getFontSized(val as FontSizeTokens, env)
31
26
  // line-height matches the control height at the same size token, so a Label
32
27
  // sits flush next to the Input/Button it labels
33
28
  const sizeKey = resolveSizeToken(val, 'size')
34
29
  return {
35
- ...fontStyle,
36
- lineHeight: typeof sizeKey === 'number' ? sizeKey : extras.tokens.size[sizeKey],
30
+ color: fontStyle?.color,
31
+ fontFamily: fontStyle?.fontFamily,
32
+ fontSize: fontStyle?.fontSize,
33
+ fontStyle: fontStyle?.fontStyle,
34
+ fontWeight: fontStyle?.fontWeight,
35
+ letterSpacing: fontStyle?.letterSpacing,
36
+ lineHeight: typeof sizeKey === 'number' ? sizeKey : env.tokens.size[sizeKey],
37
+ textTransform: fontStyle?.textTransform,
37
38
  }
38
- }
39
+ })
39
40
 
40
41
  // Unstyled Label frame: structural layout (label element, flex alignment,
41
42
  // selection/cursor resets) + the size mechanism (size-derived font) only. The
@@ -52,10 +53,7 @@ export const LabelFrame = styled(SizableText, {
52
53
  cursor: 'default',
53
54
 
54
55
  variants: {
55
- size: {
56
- true: labelSizeVariant,
57
- Size: labelSizeVariant,
58
- },
56
+ size: labelSizeVariant,
59
57
  } as const,
60
58
  })
61
59
 
package/types/Label.d.ts CHANGED
@@ -1,21 +1,21 @@
1
1
  import type { GetProps } from '@tamagui/web';
2
2
  import * as React from 'react';
3
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> & import("@tamagui/web").WithFlatVariantValues<{
4
- size?: string | number | boolean | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
4
+ size?: string | number | true | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
5
5
  }> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").TextStylePropsBase>> & {
6
6
  ref?: React.Ref<import("@tamagui/web").TamaguiTextElement> | undefined;
7
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;
8
+ size?: string | number | true | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
9
9
  }, import("@tamagui/web").StaticConfigPublic> & Omit<import("@tamagui/web").StaticConfigPublic, "staticConfig"> & {
10
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;
11
+ size?: string | number | true | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
12
12
  }, import("@tamagui/web").StaticConfigPublic];
13
13
  };
14
14
  export type LabelProps = GetProps<typeof LabelFrame> & {
15
15
  htmlFor?: string;
16
16
  };
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;
17
+ export declare const Label: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
18
+ size?: string | number | true | import("@tamagui/web").UnionableNumber | import("@tamagui/web").UnionableString | (string & {}) | undefined;
19
19
  }, import("@tamagui/web").StaticConfigPublic>;
20
20
  export declare const useLabelContext: (element?: HTMLElement | null) => string | undefined;
21
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,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
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../src/Label.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAkB,QAAQ,EAAc,MAAM,cAAc,CAAA;AAExE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAmC9B,eAAO,MAAM,UAAU;;;;;;;;;;CAarB,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"}