@tamagui/list-item 1.0.1-beta.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Button.js +249 -0
- package/dist/cjs/Button.js.map +7 -0
- package/dist/cjs/ListItem.js +182 -0
- package/dist/cjs/ListItem.js.map +7 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/useCurrentColor.js +41 -0
- package/dist/cjs/useCurrentColor.js.map +7 -0
- package/dist/cjs/useGetThemedIcon.js +45 -0
- package/dist/cjs/useGetThemedIcon.js.map +7 -0
- package/dist/cjs/wrapStringChildrenInText.js +111 -0
- package/dist/cjs/wrapStringChildrenInText.js.map +7 -0
- package/dist/esm/Button.js +190 -0
- package/dist/esm/Button.js.map +7 -0
- package/dist/esm/ListItem.js +121 -0
- package/dist/esm/ListItem.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/useCurrentColor.js +19 -0
- package/dist/esm/useCurrentColor.js.map +7 -0
- package/dist/esm/useGetThemedIcon.js +20 -0
- package/dist/esm/useGetThemedIcon.js.map +7 -0
- package/dist/esm/wrapStringChildrenInText.js +53 -0
- package/dist/esm/wrapStringChildrenInText.js.map +7 -0
- package/dist/jsx/Button.js +177 -0
- package/dist/jsx/ListItem.js +121 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/useCurrentColor.js +18 -0
- package/dist/jsx/useGetThemedIcon.js +19 -0
- package/dist/jsx/wrapStringChildrenInText.js +47 -0
- package/package.json +36 -0
- package/types/Button.d.ts +127 -0
- package/types/Button.d.ts.map +1 -0
- package/types/ListItem.d.ts +187 -0
- package/types/ListItem.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
- package/types/useCurrentColor.d.ts +5 -0
- package/types/useCurrentColor.d.ts.map +1 -0
- package/types/useGetThemedIcon.d.ts +6 -0
- package/types/useGetThemedIcon.d.ts.map +1 -0
- package/types/wrapStringChildrenInText.d.ts +8 -0
- package/types/wrapStringChildrenInText.d.ts.map +1 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
50
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
51
|
+
var Button_exports = {};
|
|
52
|
+
__export(Button_exports, {
|
|
53
|
+
Button: () => Button,
|
|
54
|
+
ButtonText: () => ButtonText
|
|
55
|
+
});
|
|
56
|
+
module.exports = __toCommonJS(Button_exports);
|
|
57
|
+
var import_core = require("@tamagui/core");
|
|
58
|
+
var import_font_size = require("@tamagui/font-size");
|
|
59
|
+
var import_stacks = require("@tamagui/stacks");
|
|
60
|
+
var import_text = require("@tamagui/text");
|
|
61
|
+
var import_react = __toESM(require("react"));
|
|
62
|
+
import_react.default["createElement"];
|
|
63
|
+
const ButtonFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
64
|
+
name: "Button",
|
|
65
|
+
tag: "button",
|
|
66
|
+
hoverable: true,
|
|
67
|
+
pressable: true,
|
|
68
|
+
backgrounded: true,
|
|
69
|
+
borderWidth: 1,
|
|
70
|
+
borderColor: "transparent",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
alignItems: "center",
|
|
73
|
+
flexWrap: "nowrap",
|
|
74
|
+
flexDirection: "row",
|
|
75
|
+
cursor: "pointer",
|
|
76
|
+
pressStyle: {
|
|
77
|
+
borderColor: "transparent"
|
|
78
|
+
},
|
|
79
|
+
hoverStyle: {
|
|
80
|
+
borderColor: "transparent"
|
|
81
|
+
},
|
|
82
|
+
focusStyle: {
|
|
83
|
+
borderColor: "$borderColorFocus"
|
|
84
|
+
},
|
|
85
|
+
variants: {
|
|
86
|
+
size: {
|
|
87
|
+
"...size": import_core.getButtonSize
|
|
88
|
+
},
|
|
89
|
+
active: {
|
|
90
|
+
true: {
|
|
91
|
+
hoverStyle: {
|
|
92
|
+
backgroundColor: "$background"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
disabled: {
|
|
97
|
+
true: {
|
|
98
|
+
opacity: 0.5,
|
|
99
|
+
pointerEvents: "none"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
defaultVariants: {
|
|
104
|
+
size: "$4"
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const ButtonText = (0, import_core.styled)(import_text.SizableText, {
|
|
108
|
+
color: "$color",
|
|
109
|
+
selectable: false,
|
|
110
|
+
flexGrow: 1,
|
|
111
|
+
flexShrink: 1,
|
|
112
|
+
ellipse: true
|
|
113
|
+
});
|
|
114
|
+
const ButtonComponent = (0, import_react.forwardRef)((props, ref) => {
|
|
115
|
+
const _a = props, {
|
|
116
|
+
children,
|
|
117
|
+
icon,
|
|
118
|
+
iconAfter,
|
|
119
|
+
noTextWrap,
|
|
120
|
+
theme: themeName,
|
|
121
|
+
space,
|
|
122
|
+
spaceFlex,
|
|
123
|
+
scaleIcon = 1,
|
|
124
|
+
scaleSpace = 0.5,
|
|
125
|
+
color: colorProp,
|
|
126
|
+
fontWeight,
|
|
127
|
+
letterSpacing,
|
|
128
|
+
fontSize,
|
|
129
|
+
fontFamily,
|
|
130
|
+
textAlign,
|
|
131
|
+
textProps
|
|
132
|
+
} = _a, rest = __objRest(_a, [
|
|
133
|
+
"children",
|
|
134
|
+
"icon",
|
|
135
|
+
"iconAfter",
|
|
136
|
+
"noTextWrap",
|
|
137
|
+
"theme",
|
|
138
|
+
"space",
|
|
139
|
+
"spaceFlex",
|
|
140
|
+
"scaleIcon",
|
|
141
|
+
"scaleSpace",
|
|
142
|
+
"color",
|
|
143
|
+
"fontWeight",
|
|
144
|
+
"letterSpacing",
|
|
145
|
+
"fontSize",
|
|
146
|
+
"fontFamily",
|
|
147
|
+
"textAlign",
|
|
148
|
+
"textProps"
|
|
149
|
+
]);
|
|
150
|
+
const isInsideButton = (0, import_react.useContext)(import_core.ButtonInsideButtonContext);
|
|
151
|
+
const theme = (0, import_core.useTheme)();
|
|
152
|
+
const size = props.size || "$4";
|
|
153
|
+
let color;
|
|
154
|
+
if (theme && colorProp && colorProp in theme) {
|
|
155
|
+
color = theme[colorProp];
|
|
156
|
+
} else if (colorProp) {
|
|
157
|
+
color = colorProp;
|
|
158
|
+
} else {
|
|
159
|
+
color = theme == null ? void 0 : theme.color;
|
|
160
|
+
}
|
|
161
|
+
color = color == null ? void 0 : color.toString();
|
|
162
|
+
const iconSize = (0, import_font_size.getFontSize)(size) * scaleIcon;
|
|
163
|
+
const addTheme = /* @__PURE__ */ __name((el) => {
|
|
164
|
+
if ((0, import_react.isValidElement)(el)) {
|
|
165
|
+
return el;
|
|
166
|
+
}
|
|
167
|
+
if (el) {
|
|
168
|
+
return import_react.default.createElement(el, {
|
|
169
|
+
color,
|
|
170
|
+
size: iconSize
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return el;
|
|
174
|
+
}, "addTheme");
|
|
175
|
+
const themedIcon = icon ? addTheme(icon) : null;
|
|
176
|
+
const themedIconAfter = iconAfter ? addTheme(iconAfter) : null;
|
|
177
|
+
let contents = children;
|
|
178
|
+
if (!noTextWrap && children) {
|
|
179
|
+
let concatStringChildren = function() {
|
|
180
|
+
if (!lastIsString)
|
|
181
|
+
return;
|
|
182
|
+
const index = nextChildren.length - 1;
|
|
183
|
+
const childrenStrings = nextChildren[index];
|
|
184
|
+
nextChildren[index] = /* @__PURE__ */ import_react.default.createElement(ButtonText, __spreadValues(__spreadValues(__spreadValues({
|
|
185
|
+
key: index
|
|
186
|
+
}, {
|
|
187
|
+
fontWeight,
|
|
188
|
+
letterSpacing,
|
|
189
|
+
fontSize,
|
|
190
|
+
fontFamily,
|
|
191
|
+
textAlign,
|
|
192
|
+
size
|
|
193
|
+
}), colorProp && {
|
|
194
|
+
color: colorProp
|
|
195
|
+
}), textProps), childrenStrings);
|
|
196
|
+
};
|
|
197
|
+
__name(concatStringChildren, "concatStringChildren");
|
|
198
|
+
let allChildren = import_react.default.Children.toArray(children);
|
|
199
|
+
let nextChildren = [];
|
|
200
|
+
let lastIsString = false;
|
|
201
|
+
for (const child of allChildren) {
|
|
202
|
+
const last = nextChildren[nextChildren.length - 1];
|
|
203
|
+
const isString = typeof child === "string";
|
|
204
|
+
if (isString) {
|
|
205
|
+
if (lastIsString) {
|
|
206
|
+
last.push(child);
|
|
207
|
+
} else {
|
|
208
|
+
nextChildren.push([child]);
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
concatStringChildren();
|
|
212
|
+
nextChildren.push(child);
|
|
213
|
+
}
|
|
214
|
+
lastIsString = isString;
|
|
215
|
+
}
|
|
216
|
+
concatStringChildren();
|
|
217
|
+
contents = nextChildren;
|
|
218
|
+
}
|
|
219
|
+
return /* @__PURE__ */ import_react.default.createElement(import_core.ButtonInsideButtonContext.Provider, {
|
|
220
|
+
value: true
|
|
221
|
+
}, /* @__PURE__ */ import_react.default.createElement(ButtonFrame, __spreadValues(__spreadProps(__spreadValues({
|
|
222
|
+
fontFamily
|
|
223
|
+
}, isInsideButton && {
|
|
224
|
+
tag: "span"
|
|
225
|
+
}), {
|
|
226
|
+
ref
|
|
227
|
+
}), rest), themedIcon || themedIconAfter ? (0, import_core.spacedChildren)({
|
|
228
|
+
space: (0, import_core.getVariableValue)(iconSize) * scaleSpace,
|
|
229
|
+
spaceFlex,
|
|
230
|
+
direction: props.flexDirection || "row",
|
|
231
|
+
children: [themedIcon, contents, themedIconAfter]
|
|
232
|
+
}) : contents));
|
|
233
|
+
});
|
|
234
|
+
const Button = ButtonFrame.extractable((0, import_core.themeable)(ButtonComponent), {
|
|
235
|
+
inlineProps: /* @__PURE__ */ new Set([
|
|
236
|
+
"color",
|
|
237
|
+
"fontWeight",
|
|
238
|
+
"fontSize",
|
|
239
|
+
"fontFamily",
|
|
240
|
+
"letterSpacing",
|
|
241
|
+
"textAlign"
|
|
242
|
+
])
|
|
243
|
+
});
|
|
244
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
245
|
+
0 && (module.exports = {
|
|
246
|
+
Button,
|
|
247
|
+
ButtonText
|
|
248
|
+
});
|
|
249
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n ButtonInsideButtonContext,\n GetProps,\n ReactComponentWithRef,\n ThemeableProps,\n getButtonSize,\n getVariableValue,\n spacedChildren,\n styled,\n themeable,\n useTheme,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, SizableTextProps } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef, isValidElement, useContext } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // dont wrap inner contents in a text element\n noTextWrap?: boolean\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n\n // pass text properties:\n color?: SizableTextProps['color']\n fontWeight?: SizableTextProps['fontWeight']\n fontSize?: SizableTextProps['fontSize']\n fontFamily?: SizableTextProps['fontFamily']\n letterSpacing?: SizableTextProps['letterSpacing']\n textAlign?: SizableTextProps['textAlign']\n\n // all the other text controls\n textProps?: Partial<SizableTextProps>\n }\n\nconst ButtonFrame = styled(ThemeableStack, {\n name: 'Button',\n tag: 'button',\n hoverable: true,\n pressable: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSize,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nconst ButtonComponent = forwardRef((props: ButtonProps, ref) => {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 0.5,\n\n // text props\n color: colorProp,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n ...rest\n } = props as ButtonProps\n\n const isInsideButton = useContext(ButtonInsideButtonContext)\n const theme = useTheme()\n const size = props.size || '$4'\n\n // get color from prop or theme\n let color: any\n // @ts-expect-error\n if (theme && colorProp && colorProp in theme) {\n // @ts-expect-error\n color = theme[colorProp]\n } else if (colorProp) {\n color = colorProp\n } else {\n color = theme?.color\n }\n color = color?.toString()\n\n const iconSize = getFontSize(size) * scaleIcon\n\n const addTheme = (el: any) => {\n if (isValidElement(el)) {\n return el\n }\n if (el) {\n return React.createElement(el, {\n color,\n size: iconSize,\n })\n }\n return el\n }\n const themedIcon = icon ? addTheme(icon) : null\n const themedIconAfter = iconAfter ? addTheme(iconAfter) : null\n\n let contents = children\n\n if (!noTextWrap && children) {\n // in the case of using variables, like so:\n // <Button>Hello, {name}</Button>\n // it gives us props.children as ['Hello, ', 'name']\n // but we don't want to wrap multiple SizableText around each part\n // so we group them\n let allChildren = React.Children.toArray(children)\n let nextChildren: any[] = []\n let lastIsString = false\n\n function concatStringChildren() {\n if (!lastIsString) return\n const index = nextChildren.length - 1\n const childrenStrings = nextChildren[index]\n nextChildren[index] = (\n <ButtonText\n key={index}\n {...{\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n size,\n }}\n {...(colorProp && {\n color: colorProp,\n })}\n {...textProps}\n >\n {childrenStrings}\n </ButtonText>\n )\n }\n\n for (const child of allChildren) {\n const last = nextChildren[nextChildren.length - 1]\n const isString = typeof child === 'string'\n if (isString) {\n if (lastIsString) {\n last.push(child)\n } else {\n nextChildren.push([child])\n }\n } else {\n concatStringChildren()\n nextChildren.push(child)\n }\n lastIsString = isString\n }\n concatStringChildren()\n\n contents = nextChildren\n }\n\n return (\n // careful not to desctructure and re-order props, order is important\n <ButtonInsideButtonContext.Provider value={true}>\n <ButtonFrame\n fontFamily={fontFamily}\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n {...(isInsideButton && {\n tag: 'span',\n })}\n ref={ref as any}\n {...rest}\n >\n {themedIcon || themedIconAfter\n ? spacedChildren({\n // a bit arbitrary but scaling to font size is necessary so long as button does\n space: getVariableValue(iconSize) * scaleSpace,\n spaceFlex,\n direction: props.flexDirection || 'row',\n children: [themedIcon, contents, themedIconAfter],\n })\n : contents}\n </ButtonFrame>\n </ButtonInsideButtonContext.Provider>\n )\n})\n\nexport const Button: ReactComponentWithRef<ButtonProps, HTMLButtonElement | View> =\n ButtonFrame.extractable(themeable(ButtonComponent as any) as any, {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract button anyway)\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAWO;AACP,uBAA4B;AAC5B,oBAA+B;AAC/B,kBAA8C;AAC9C,mBAAiF;AAIjF,qBAAM;AAiCN,MAAM,cAAc,wBAAO,8BAAgB;AAAA,EACzC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,WAAW;AAAA,EACX,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EAGf,QAAQ;AAAA,EAER,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF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BAAiB;AAAA,IAClC,UAAU,CAAC,YAAY,UAAU,eAAe;AAAA,EAClD,CAAC,IACD,QACN,CACF;AAEJ,CAAC;AAEM,MAAM,SACX,YAAY,YAAY,2BAAU,eAAsB,GAAU;AAAA,EAChE,aAAa,oBAAI,IAAI;AAAA,IAEnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
var __export = (target, all) => {
|
|
34
|
+
for (var name in all)
|
|
35
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
36
|
+
};
|
|
37
|
+
var __copyProps = (to, from, except, desc) => {
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (let key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
41
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
42
|
+
}
|
|
43
|
+
return to;
|
|
44
|
+
};
|
|
45
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
46
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
47
|
+
var ListItem_exports = {};
|
|
48
|
+
__export(ListItem_exports, {
|
|
49
|
+
ListItem: () => ListItem,
|
|
50
|
+
ListItemSubtitle: () => ListItemSubtitle,
|
|
51
|
+
ListItemText: () => ListItemText
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(ListItem_exports);
|
|
54
|
+
var import_core = require("@tamagui/core");
|
|
55
|
+
var import_font_size = require("@tamagui/font-size");
|
|
56
|
+
var import_helpers_tamagui = require("@tamagui/helpers-tamagui");
|
|
57
|
+
var import_stacks = require("@tamagui/stacks");
|
|
58
|
+
var import_text = require("@tamagui/text");
|
|
59
|
+
var import_react = __toESM(require("react"));
|
|
60
|
+
import_react.default["createElement"];
|
|
61
|
+
const ListItemFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
62
|
+
name: "ListItem",
|
|
63
|
+
tag: "li",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
flexWrap: "nowrap",
|
|
66
|
+
width: "100%",
|
|
67
|
+
maxWidth: "100%",
|
|
68
|
+
overflow: "hidden",
|
|
69
|
+
flexDirection: "row",
|
|
70
|
+
variants: {
|
|
71
|
+
size: {
|
|
72
|
+
"...size": (val, { tokens }) => {
|
|
73
|
+
return {
|
|
74
|
+
paddingVertical: (0, import_core.getSize)(val, -1),
|
|
75
|
+
paddingHorizontal: tokens.size[val]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
active: {
|
|
80
|
+
true: {
|
|
81
|
+
hoverStyle: {
|
|
82
|
+
backgroundColor: "$background"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
disabled: {
|
|
87
|
+
true: {
|
|
88
|
+
opacity: 0.5,
|
|
89
|
+
pointerEvents: "none"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
defaultVariants: {
|
|
94
|
+
size: "$4"
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const ListItemText = (0, import_core.styled)(import_text.SizableText, {
|
|
98
|
+
color: "$color",
|
|
99
|
+
selectable: false,
|
|
100
|
+
flexGrow: 1,
|
|
101
|
+
flexShrink: 1,
|
|
102
|
+
ellipse: true
|
|
103
|
+
});
|
|
104
|
+
const ListItemSubtitle = (0, import_core.styled)(ListItemText, {
|
|
105
|
+
color: "$colorPress"
|
|
106
|
+
});
|
|
107
|
+
const ListItemComponent = (0, import_react.forwardRef)((props, ref) => {
|
|
108
|
+
const _a = props, {
|
|
109
|
+
children,
|
|
110
|
+
icon,
|
|
111
|
+
iconAfter,
|
|
112
|
+
noTextWrap,
|
|
113
|
+
theme: themeName,
|
|
114
|
+
space,
|
|
115
|
+
spaceFlex,
|
|
116
|
+
scaleIcon = 1,
|
|
117
|
+
scaleSpace = 1,
|
|
118
|
+
subTitle,
|
|
119
|
+
color,
|
|
120
|
+
fontWeight,
|
|
121
|
+
letterSpacing,
|
|
122
|
+
fontSize,
|
|
123
|
+
fontFamily,
|
|
124
|
+
textAlign,
|
|
125
|
+
textProps
|
|
126
|
+
} = _a, rest = __objRest(_a, [
|
|
127
|
+
"children",
|
|
128
|
+
"icon",
|
|
129
|
+
"iconAfter",
|
|
130
|
+
"noTextWrap",
|
|
131
|
+
"theme",
|
|
132
|
+
"space",
|
|
133
|
+
"spaceFlex",
|
|
134
|
+
"scaleIcon",
|
|
135
|
+
"scaleSpace",
|
|
136
|
+
"subTitle",
|
|
137
|
+
"color",
|
|
138
|
+
"fontWeight",
|
|
139
|
+
"letterSpacing",
|
|
140
|
+
"fontSize",
|
|
141
|
+
"fontFamily",
|
|
142
|
+
"textAlign",
|
|
143
|
+
"textProps"
|
|
144
|
+
]);
|
|
145
|
+
const size = props.size || "$4";
|
|
146
|
+
const subtitleSizeToken = (0, import_core.getSize)(size, -2);
|
|
147
|
+
const subtitleSize = `$${subtitleSizeToken.key}`;
|
|
148
|
+
const iconSize = (0, import_font_size.getFontSize)(size) * scaleIcon;
|
|
149
|
+
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color });
|
|
150
|
+
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
151
|
+
const spaceSize = (0, import_core.getVariableValue)(iconSize) * scaleSpace;
|
|
152
|
+
const contents = (0, import_helpers_tamagui.wrapStringChildrenInText)(ListItemText, props);
|
|
153
|
+
return /* @__PURE__ */ import_react.default.createElement(ListItemFrame, __spreadValues({
|
|
154
|
+
fontFamily,
|
|
155
|
+
ref
|
|
156
|
+
}, rest), themedIcon || themedIconAfter ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, themedIcon ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, themedIcon, /* @__PURE__ */ import_react.default.createElement(import_core.Spacer, {
|
|
157
|
+
size: spaceSize
|
|
158
|
+
})) : null, /* @__PURE__ */ import_react.default.createElement(import_stacks.YStack, null, contents, subTitle ? typeof subTitle === "string" ? /* @__PURE__ */ import_react.default.createElement(ListItemSubtitle, {
|
|
159
|
+
opacity: 0.65,
|
|
160
|
+
size: subtitleSize
|
|
161
|
+
}, subTitle) : subTitle : null), themedIconAfter ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_core.Spacer, {
|
|
162
|
+
flex: true,
|
|
163
|
+
size: spaceSize
|
|
164
|
+
}), themedIconAfter) : null) : contents);
|
|
165
|
+
});
|
|
166
|
+
const ListItem = ListItemFrame.extractable((0, import_core.themeable)(ListItemComponent), {
|
|
167
|
+
inlineProps: /* @__PURE__ */ new Set([
|
|
168
|
+
"color",
|
|
169
|
+
"fontWeight",
|
|
170
|
+
"fontSize",
|
|
171
|
+
"fontFamily",
|
|
172
|
+
"letterSpacing",
|
|
173
|
+
"textAlign"
|
|
174
|
+
])
|
|
175
|
+
});
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
ListItem,
|
|
179
|
+
ListItemSubtitle,
|
|
180
|
+
ListItemText
|
|
181
|
+
});
|
|
182
|
+
//# sourceMappingURL=ListItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ListItem.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n ReactComponentWithRef,\n Spacer,\n ThemeableProps,\n getSize,\n getVariableValue,\n styled,\n themeable,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport {\n TextParentStyles,\n useGetThemedIcon,\n wrapStringChildrenInText,\n} from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n\n // subtitle\n subTitle?: React.ReactNode\n }\n\nconst ListItemFrame = styled(ThemeableStack, {\n name: 'ListItem',\n tag: 'li',\n alignItems: 'center',\n flexWrap: 'nowrap',\n width: '100%',\n maxWidth: '100%',\n overflow: 'hidden',\n flexDirection: 'row',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n paddingVertical: getSize(val, -1),\n paddingHorizontal: tokens.size[val],\n }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n color: '$colorPress',\n})\n\nconst ListItemComponent = forwardRef((props: ListItemProps, ref) => {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 1,\n subTitle,\n\n // text props\n color,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n ...rest\n } = props as ListItemProps\n\n const size = props.size || '$4'\n const subtitleSizeToken = getSize(size, -2)\n const subtitleSize = `$${subtitleSizeToken.key}` as FontSizeTokens\n const iconSize = getFontSize(size) * scaleIcon\n const getThemedIcon = useGetThemedIcon({ size: iconSize, color })\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)\n const spaceSize = getVariableValue(iconSize) * scaleSpace\n const contents = wrapStringChildrenInText(ListItemText, props)\n\n return (\n <ListItemFrame fontFamily={fontFamily} ref={ref as any} {...rest}>\n {themedIcon || themedIconAfter ? (\n <>\n {themedIcon ? (\n <>\n {themedIcon}\n <Spacer size={spaceSize} />\n </>\n ) : null}\n <YStack>\n {contents}\n {subTitle ? (\n typeof subTitle === 'string' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <ListItemSubtitle opacity={0.65} size={subtitleSize}>\n {subTitle}\n </ListItemSubtitle>\n ) : (\n subTitle\n )\n ) : null}\n </YStack>\n {themedIconAfter ? (\n <>\n <Spacer flex size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ) : (\n contents\n )}\n </ListItemFrame>\n )\n})\n\nexport const ListItem: ReactComponentWithRef<ListItemProps, HTMLLIElement | View> =\n ListItemFrame.extractable(themeable(ListItemComponent as any) as any, {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract listItem anyway)\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAUO;AACP,uBAA4B;AAC5B,6BAIO;AACP,oBAAuC;AACvC,kBAA4B;AAC5B,mBAAqD;AAIrD,qBAAM;AAwBN,MAAM,gBAAgB,wBAAO,8BAAgB;AAAA,EAC3C,MAAM;AAAA,EACN,KAAK;AAAA,EAC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ACA;AAAA;AAIF,QAAM,OAAO,MAAM,QAAQ;AAC3B,QAAM,oBAAoB,yBAAQ,MAAM,EAAE;AAC1C,QAAM,eAAe,IAAI,kBAAkB;AAC3C,QAAM,WAAW,kCAAY,IAAI,IAAI;AACrC,QAAM,gBAAgB,6CAAiB,EAAE,MAAM,UAAU,MAAM,CAAC;AAChE,QAAM,CAAC,YAAY,mBAAmB,CAAC,MAAM,SAAS,EAAE,IAAI,aAAa;AACzE,QAAM,YAAY,kCAAiB,QAAQ,IAAI;AAC/C,QAAM,WAAW,qDAAyB,cAAc,KAAK;AAE7D,SACE,mDAAC;AAAA,IAAc;AAAA,IAAwB;AAAA,KAAqB,OACzD,cAAc,kBACb,wFACG,aACC,wFACG,YACD,mDAAC;AAAA,IAAO,MAAM;AAAA,GAAW,CAC3B,IACE,MACJ,mDAAC,4BACE,UACA,WACC,OAAO,aAAa,WAGlB,mDAAC;AAAA,IAAiB,SAAS;AAAA,IAAM,MAAM;AAAA,KACpC,QACH,IAEA,WAEA,IACN,GACC,kBACC,wFACE,mDAAC;AAAA,IAAO,MAAI;AAAA,IAAC,MAAM;AAAA,GAAW,GAC7B,eACH,IACE,IACN,IAEA,QAEJ;AAEJ,CAAC;AAEM,MAAM,WACX,cAAc,YAAY,2BAAU,iBAAwB,GAAU;AAAA,EACpE,aAAa,oBAAI,IAAI;AAAA,IAEnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./ListItem"), module.exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useCurrentColor_exports = {};
|
|
20
|
+
__export(useCurrentColor_exports, {
|
|
21
|
+
useCurrentColor: () => useCurrentColor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useCurrentColor_exports);
|
|
24
|
+
var import_core = require("@tamagui/core");
|
|
25
|
+
const useCurrentColor = /* @__PURE__ */ __name((colorProp) => {
|
|
26
|
+
const theme = (0, import_core.useTheme)();
|
|
27
|
+
let color;
|
|
28
|
+
if (theme && colorProp && colorProp in theme) {
|
|
29
|
+
color = theme[colorProp];
|
|
30
|
+
} else if (colorProp) {
|
|
31
|
+
color = colorProp;
|
|
32
|
+
} else {
|
|
33
|
+
color = theme == null ? void 0 : theme.color;
|
|
34
|
+
}
|
|
35
|
+
return (color == null ? void 0 : color.toString()) || "";
|
|
36
|
+
}, "useCurrentColor");
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
useCurrentColor
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=useCurrentColor.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useCurrentColor.tsx"],
|
|
4
|
+
"sourcesContent": ["import { ColorTokens, ThemeValueFallback, useTheme } from '@tamagui/core'\nimport { TextStyle } from 'react-native'\n\nexport const useCurrentColor = (colorProp: ColorProp) => {\n const theme = useTheme()\n // get color from prop or theme\n let color: any\n // @ts-expect-error\n if (theme && colorProp && colorProp in theme) {\n // @ts-expect-error\n color = theme[colorProp]\n } else if (colorProp) {\n color = colorProp\n } else {\n color = theme?.color\n }\n return color?.toString() || ('' as string)\n}\n\nexport type ColorProp = ThemeValueFallback | ColorTokens | TextStyle['color'] | undefined\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0D;AAGnD,MAAM,kBAAkB,wBAAC,cAAyB;AACvD,QAAM,QAAQ,0BAAS;AAEvB,MAAI;AAEJ,MAAI,SAAS,aAAa,aAAa,OAAO;AAE5C,YAAQ,MAAM;AAAA,EAChB,WAAW,WAAW;AACpB,YAAQ;AAAA,EACV,OAAO;AACL,YAAQ,+BAAO;AAAA,EACjB;AACA,SAAO,gCAAO,eAAe;AAC/B,GAd+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var useGetThemedIcon_exports = {};
|
|
23
|
+
__export(useGetThemedIcon_exports, {
|
|
24
|
+
useGetThemedIcon: () => useGetThemedIcon
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(useGetThemedIcon_exports);
|
|
27
|
+
var import_react = __toESM(require("react"));
|
|
28
|
+
var import_useCurrentColor = require("./useCurrentColor");
|
|
29
|
+
const useGetThemedIcon = /* @__PURE__ */ __name((props) => {
|
|
30
|
+
const color = (0, import_useCurrentColor.useCurrentColor)(props.color);
|
|
31
|
+
return (el) => {
|
|
32
|
+
if ((0, import_react.isValidElement)(el)) {
|
|
33
|
+
return el;
|
|
34
|
+
}
|
|
35
|
+
if (el) {
|
|
36
|
+
return import_react.default.createElement(el, props);
|
|
37
|
+
}
|
|
38
|
+
return el;
|
|
39
|
+
};
|
|
40
|
+
}, "useGetThemedIcon");
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
useGetThemedIcon
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=useGetThemedIcon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useGetThemedIcon.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { isValidElement } from 'react'\n\nimport { ColorProp, useCurrentColor } from './useCurrentColor'\n\nexport const useGetThemedIcon = (props: { color: ColorProp; size: number }) => {\n const color = useCurrentColor(props.color)\n return (el: any) => {\n if (isValidElement(el)) {\n return el\n }\n if (el) {\n return React.createElement(el, props)\n }\n return el\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsC;AAEtC,6BAA2C;AAEpC,MAAM,mBAAmB,wBAAC,UAA8C;AAC7E,QAAM,QAAQ,4CAAgB,MAAM,KAAK;AACzC,SAAO,CAAC,OAAY;AAClB,QAAI,iCAAe,EAAE,GAAG;AACtB,aAAO;AAAA,IACT;AACA,QAAI,IAAI;AACN,aAAO,qBAAM,cAAc,IAAI,KAAK;AAAA,IACtC;AACA,WAAO;AAAA,EACT;AACF,GAXgC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|