one
Version:
One is a React framework for web, iOS, and Android apps.
54 lines (51 loc) • 3.06 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Icon_ios_exports = {};
__export(Icon_ios_exports, { Icon: () => Icon });
module.exports = __toCommonJS(Icon_ios_exports);
var import_react = require("react");
var import_react_native = require("react-native");
var import_Controls = require("../generated/Controls.native.js");
function Icon(param) {
var { icons, colorRole, color } = param;
var _ref, _ref1, _ref2;
var _icons_ios_props_swiftStyle, _icons_ios_props_swiftStyle1, _icons_ios_props_swiftStyle2, _icons_ios_props_swiftStyle3, _icons_ios_props_swiftStyle4;
if (!/* @__PURE__ */ (0, import_react.isValidElement)(icons.ios) || icons.ios.type !== import_Controls.Image) throw new Error("One.UI.Icon icons.ios must be a One.iOS.Image element");
var fallbackSize = (_ref = (_icons_ios_props_swiftStyle = icons.ios.props.swiftStyle) === null || _icons_ios_props_swiftStyle === void 0 ? void 0 : _icons_ios_props_swiftStyle.fontSize) !== null && _ref !== void 0 ? _ref : 24;
var style = [{
width: (_ref1 = (_icons_ios_props_swiftStyle1 = icons.ios.props.swiftStyle) === null || _icons_ios_props_swiftStyle1 === void 0 ? void 0 : _icons_ios_props_swiftStyle1.width) !== null && _ref1 !== void 0 ? _ref1 : fallbackSize,
height: (_ref2 = (_icons_ios_props_swiftStyle2 = icons.ios.props.swiftStyle) === null || _icons_ios_props_swiftStyle2 === void 0 ? void 0 : _icons_ios_props_swiftStyle2.height) !== null && _ref2 !== void 0 ? _ref2 : fallbackSize
}, icons.ios.props.style];
var { width, height } = import_react_native.StyleSheet.flatten(style);
return /* @__PURE__ */ (0, import_react.cloneElement)(icons.ios, {
colorRole: color === void 0 ? colorRole !== null && colorRole !== void 0 ? colorRole : "primary" : void 0,
style,
swiftStyle: {
...icons.ios.props.swiftStyle,
fontSize: fallbackSize,
width: typeof width === "number" ? width : (_icons_ios_props_swiftStyle3 = icons.ios.props.swiftStyle) === null || _icons_ios_props_swiftStyle3 === void 0 ? void 0 : _icons_ios_props_swiftStyle3.width,
height: typeof height === "number" ? height : (_icons_ios_props_swiftStyle4 = icons.ios.props.swiftStyle) === null || _icons_ios_props_swiftStyle4 === void 0 ? void 0 : _icons_ios_props_swiftStyle4.height,
foregroundStyle: color
}
});
}
//# sourceMappingURL=Icon.ios.js.map