vueops-storybook 1.1.1 → 1.1.3
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/index.js +89 -4
- package/package.json +11 -11
package/dist/index.js
CHANGED
@@ -1,8 +1,27 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
require('react');
|
3
|
+
var React = require('react');
|
4
4
|
var reactNative = require('react-native');
|
5
5
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
7
|
+
var n = Object.create(null);
|
8
|
+
if (e) {
|
9
|
+
Object.keys(e).forEach(function (k) {
|
10
|
+
if (k !== 'default') {
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () { return e[k]; }
|
15
|
+
});
|
16
|
+
}
|
17
|
+
});
|
18
|
+
}
|
19
|
+
n.default = e;
|
20
|
+
return Object.freeze(n);
|
21
|
+
}
|
22
|
+
|
23
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
24
|
+
|
6
25
|
const { width, height } = reactNative.Dimensions.get('window');
|
7
26
|
const [shortDimension, longDimension] = width < height ? [width, height] : [height, width];
|
8
27
|
|
@@ -56,7 +75,7 @@ reactNative.StyleSheet.create({
|
|
56
75
|
}
|
57
76
|
});
|
58
77
|
|
59
|
-
reactNative.StyleSheet.create({
|
78
|
+
const storyBookCommonStyle = reactNative.StyleSheet.create({
|
60
79
|
primaryButton: {
|
61
80
|
backgroundColor: AppColors.primaryBlue,
|
62
81
|
padding: scale(10),
|
@@ -85,11 +104,28 @@ reactNative.StyleSheet.create({
|
|
85
104
|
}
|
86
105
|
});
|
87
106
|
|
107
|
+
var _path;
|
108
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
109
|
+
var SvgLeftArrow = function SvgLeftArrow(props) {
|
110
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
111
|
+
xmlns: "http://www.w3.org/2000/svg",
|
112
|
+
width: 16,
|
113
|
+
height: 14,
|
114
|
+
fill: "none"
|
115
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
116
|
+
stroke: "#475467",
|
117
|
+
strokeLinecap: "round",
|
118
|
+
strokeLinejoin: "round",
|
119
|
+
strokeWidth: 1.67,
|
120
|
+
d: "M15 7.25H1m0 0 5.25 5.25M1 7.25 6.25 2"
|
121
|
+
})));
|
122
|
+
};
|
123
|
+
|
88
124
|
const fontFamily = {
|
89
125
|
robotoBold: "Roboto-bold",
|
90
126
|
robotoMedium: "Roboto-Medium"
|
91
127
|
};
|
92
|
-
reactNative.StyleSheet.create({
|
128
|
+
const storyBookCommonFontStyles = reactNative.StyleSheet.create({
|
93
129
|
commonText: {
|
94
130
|
fontWeight: "400",
|
95
131
|
fontSize: scale(14),
|
@@ -115,7 +151,7 @@ reactNative.StyleSheet.create({
|
|
115
151
|
}
|
116
152
|
});
|
117
153
|
|
118
|
-
reactNative.StyleSheet.create({
|
154
|
+
const styles = reactNative.StyleSheet.create({
|
119
155
|
button: {
|
120
156
|
justifyContent: "center",
|
121
157
|
marginHorizontal: "3%",
|
@@ -198,3 +234,52 @@ reactNative.StyleSheet.create({
|
|
198
234
|
|
199
235
|
reactNative.Dimensions.get("window").width;
|
200
236
|
reactNative.Dimensions.get("window").height;
|
237
|
+
|
238
|
+
const ComponentStings = {
|
239
|
+
PRIMARY: "Primary",
|
240
|
+
SECONDARY: "Secondary",
|
241
|
+
TERTIARY: "Tertiary",
|
242
|
+
TRANSPARENT: "Transparent"};
|
243
|
+
|
244
|
+
const Button = ({ title, onPress, variant = ComponentStings.PRIMARY, disabled, loading, leftIcon }) => {
|
245
|
+
const getButtonStyle = () => {
|
246
|
+
switch (variant) {
|
247
|
+
case ComponentStings.PRIMARY:
|
248
|
+
return storyBookCommonStyle.primaryButton;
|
249
|
+
case ComponentStings.SECONDARY:
|
250
|
+
return storyBookCommonStyle.secondaryButton;
|
251
|
+
case ComponentStings.TERTIARY:
|
252
|
+
return storyBookCommonStyle.tertiaryButton;
|
253
|
+
case ComponentStings.TRANSPARENT:
|
254
|
+
return storyBookCommonStyle.transparentButton;
|
255
|
+
default:
|
256
|
+
return storyBookCommonStyle.primaryButton;
|
257
|
+
}
|
258
|
+
};
|
259
|
+
const getTextStyle = () => {
|
260
|
+
switch (variant) {
|
261
|
+
case ComponentStings.PRIMARY:
|
262
|
+
return storyBookCommonFontStyles.primaryText;
|
263
|
+
case ComponentStings.SECONDARY:
|
264
|
+
return storyBookCommonFontStyles.secondaryText;
|
265
|
+
case ComponentStings.TERTIARY:
|
266
|
+
return styles.tertiaryText;
|
267
|
+
case ComponentStings.TRANSPARENT:
|
268
|
+
return styles.transparentText;
|
269
|
+
default:
|
270
|
+
return storyBookCommonFontStyles.primaryText;
|
271
|
+
}
|
272
|
+
};
|
273
|
+
return /* @__PURE__ */ React.createElement(
|
274
|
+
reactNative.TouchableOpacity,
|
275
|
+
{
|
276
|
+
activeOpacity: 0.8,
|
277
|
+
style: [getButtonStyle(), disabled && styles.disabledButton],
|
278
|
+
onPress,
|
279
|
+
disabled: disabled || loading
|
280
|
+
},
|
281
|
+
/* @__PURE__ */ React.createElement(reactNative.View, { style: styles.content }, leftIcon && /* @__PURE__ */ React.createElement(SvgLeftArrow, { right: 10 }), /* @__PURE__ */ React.createElement(reactNative.Text, { style: getTextStyle() }, title))
|
282
|
+
);
|
283
|
+
};
|
284
|
+
|
285
|
+
exports.Button = Button;
|
package/package.json
CHANGED
@@ -41,6 +41,15 @@
|
|
41
41
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
42
42
|
"typescript": "^5.8.3"
|
43
43
|
},
|
44
|
+
"version": "1.1.3",
|
45
|
+
"private": false,
|
46
|
+
"name": "vueops-storybook",
|
47
|
+
"type": "module",
|
48
|
+
"main": "dist/index.js",
|
49
|
+
"types": "dist/index.d.ts",
|
50
|
+
"files": [
|
51
|
+
"dist"
|
52
|
+
],
|
44
53
|
"scripts": {
|
45
54
|
"start": "expo start",
|
46
55
|
"build": "rollup -c",
|
@@ -51,14 +60,5 @@
|
|
51
60
|
"storybook": "cross-env STORYBOOK_ENABLED='true' expo start",
|
52
61
|
"storybook:ios": "cross-env STORYBOOK_ENABLED='true' expo start --ios",
|
53
62
|
"storybook:android": "cross-env STORYBOOK_ENABLED='true' expo start --android"
|
54
|
-
}
|
55
|
-
|
56
|
-
"private": false,
|
57
|
-
"name": "vueops-storybook",
|
58
|
-
"type": "module",
|
59
|
-
"main": "dist/index.js",
|
60
|
-
"types": "dist/index.d.ts",
|
61
|
-
"files": [
|
62
|
-
"dist"
|
63
|
-
]
|
64
|
-
}
|
63
|
+
}
|
64
|
+
}
|