labsense-ui-kit 1.0.18 → 1.0.19
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/Buttons/Button.d.ts +5 -0
- package/dist/index.js +98 -63
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +98 -63
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/Buttons/Button.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface ButtonProps {
|
|
|
22
22
|
iconSize?: number;
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
variant?: buttonVariant;
|
|
25
|
+
loaderProps?: {
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
loaderPosition?: 'right' | 'left';
|
|
28
|
+
loaderColor?: string;
|
|
29
|
+
};
|
|
25
30
|
}
|
|
26
31
|
declare const ButtonComponent: React.FC<ButtonProps>;
|
|
27
32
|
export default ButtonComponent;
|
package/dist/index.js
CHANGED
|
@@ -2140,29 +2140,51 @@ var GlobalFonts = {
|
|
|
2140
2140
|
light: "NotoSans, sans-serif"
|
|
2141
2141
|
};
|
|
2142
2142
|
|
|
2143
|
-
var _templateObject$2, _templateObject2$1;
|
|
2144
|
-
var
|
|
2145
|
-
|
|
2146
|
-
|
|
2143
|
+
var _templateObject$2, _templateObject2$1, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6;
|
|
2144
|
+
var spin = styled.keyframes(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
2145
|
+
var Spinner = styled__default.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n width: ", "px;\n height: ", "px;\n border: ", "px solid #ddd;\n border-top-color: ", ";\n border-radius: 50%;\n animation: ", " 1s linear infinite;\n"])), function (_ref) {
|
|
2146
|
+
var size = _ref.size;
|
|
2147
|
+
return size;
|
|
2147
2148
|
}, function (_ref2) {
|
|
2148
|
-
var
|
|
2149
|
-
return
|
|
2149
|
+
var size = _ref2.size;
|
|
2150
|
+
return size;
|
|
2150
2151
|
}, function (_ref3) {
|
|
2151
|
-
var
|
|
2152
|
-
return
|
|
2152
|
+
var size = _ref3.size;
|
|
2153
|
+
return size / 2;
|
|
2153
2154
|
}, function (_ref4) {
|
|
2154
|
-
var
|
|
2155
|
-
return
|
|
2156
|
-
},
|
|
2157
|
-
|
|
2158
|
-
|
|
2155
|
+
var color = _ref4.color;
|
|
2156
|
+
return color;
|
|
2157
|
+
}, spin);
|
|
2158
|
+
var LoaderWrapper = styled__default.div(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (_ref5) {
|
|
2159
|
+
var loaderPosition = _ref5.loaderPosition;
|
|
2160
|
+
return loaderPosition === 'right' ? '4px' : '0';
|
|
2159
2161
|
}, function (_ref6) {
|
|
2160
|
-
var
|
|
2161
|
-
|
|
2162
|
+
var loaderPosition = _ref6.loaderPosition;
|
|
2163
|
+
return loaderPosition === 'left' ? '4px' : '0';
|
|
2164
|
+
});
|
|
2165
|
+
var Container = styled__default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: ", ";\n gap: ", ";\n"])), function (_ref7) {
|
|
2166
|
+
var iconPosition = _ref7.iconPosition;
|
|
2167
|
+
return iconPosition === 'right' ? 'row-reverse' : 'row';
|
|
2168
|
+
}, function (_ref8) {
|
|
2169
|
+
var gap = _ref8.gap;
|
|
2170
|
+
return gap || '4px';
|
|
2171
|
+
});
|
|
2172
|
+
var StyledButton = styled__default.button(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n pointer-events: ", ";\n cursor: ", ";\n height: max-content;\n min-height: max-content;\n width: max-content;\n box-sizing: border-box;\n border-radius: ", ";\n outline: none;\n transition: all 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n\n padding: ", ";\n\n &:focus {\n outline: none;\n }\n\n\n ", "\n"])), function (_ref9) {
|
|
2173
|
+
var disabled = _ref9.disabled;
|
|
2174
|
+
return disabled ? 'none' : 'auto';
|
|
2175
|
+
}, function (_ref10) {
|
|
2176
|
+
var disabled = _ref10.disabled;
|
|
2177
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
2178
|
+
}, function (_ref11) {
|
|
2179
|
+
var borderRadius = _ref11.borderRadius;
|
|
2180
|
+
return borderRadius || '8px';
|
|
2181
|
+
}, function (_ref12) {
|
|
2182
|
+
var size = _ref12.size,
|
|
2183
|
+
padding = _ref12.padding;
|
|
2162
2184
|
return size === 'small' ? '8px 12.2px' : size === 'medium' ? '10px 19px' : size === 'large' ? '12px 24.5px' : size === 'custom' ? padding : '10px 16px';
|
|
2163
|
-
}, function (
|
|
2164
|
-
var variant =
|
|
2165
|
-
disabled =
|
|
2185
|
+
}, function (_ref13) {
|
|
2186
|
+
var variant = _ref13.variant,
|
|
2187
|
+
disabled = _ref13.disabled;
|
|
2166
2188
|
switch (variant) {
|
|
2167
2189
|
case 'primary':
|
|
2168
2190
|
return "\n background: " + (disabled ? colorVariables.disabled.primary : colorVariables["default"].primary) + ";\n color: " + colorVariables.text.white + ";\n border: " + (disabled ? "1px solid " + colorVariables.disabled.primary : "1px solid " + colorVariables["default"].primary) + ";\n &:hover {\n background: " + colorVariables.hover.primary + ";\n border: 1px solid " + colorVariables.hover.primary + ";\n }\n ";
|
|
@@ -2182,50 +2204,57 @@ var StyledButton = styled__default.button(_templateObject$2 || (_templateObject$
|
|
|
2182
2204
|
return '';
|
|
2183
2205
|
}
|
|
2184
2206
|
});
|
|
2185
|
-
var ButtonText = styled__default.span(
|
|
2186
|
-
var fontFamily =
|
|
2207
|
+
var ButtonText = styled__default.span(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n white-space: nowrap;\n"])), function (_ref14) {
|
|
2208
|
+
var fontFamily = _ref14.fontFamily;
|
|
2187
2209
|
return fontFamily ? fontFamily : GlobalFonts.bold;
|
|
2188
|
-
}, function (
|
|
2189
|
-
var size =
|
|
2190
|
-
fontSize =
|
|
2210
|
+
}, function (_ref15) {
|
|
2211
|
+
var size = _ref15.size,
|
|
2212
|
+
fontSize = _ref15.fontSize;
|
|
2191
2213
|
return size === 'small' ? '14px' : size === 'medium' ? '16px' : size === 'large' ? '18px' : size === 'custom' ? fontSize : '16px';
|
|
2192
|
-
}, function (
|
|
2193
|
-
var fontWeight =
|
|
2194
|
-
size =
|
|
2214
|
+
}, function (_ref16) {
|
|
2215
|
+
var fontWeight = _ref16.fontWeight,
|
|
2216
|
+
size = _ref16.size;
|
|
2195
2217
|
return size === 'custom' && fontWeight || '500';
|
|
2196
|
-
}, function (
|
|
2197
|
-
var size =
|
|
2198
|
-
fontSize =
|
|
2218
|
+
}, function (_ref17) {
|
|
2219
|
+
var size = _ref17.size,
|
|
2220
|
+
fontSize = _ref17.fontSize;
|
|
2199
2221
|
return size === 'small' ? '14px' : size === 'medium' ? '16px' : size === 'large' ? '18px' : size === 'custom' ? fontSize : '16px';
|
|
2200
2222
|
});
|
|
2201
|
-
var ButtonComponent = function ButtonComponent(
|
|
2202
|
-
var onClick =
|
|
2203
|
-
text =
|
|
2204
|
-
size =
|
|
2205
|
-
background =
|
|
2206
|
-
|
|
2207
|
-
color =
|
|
2208
|
-
border =
|
|
2209
|
-
borderRadius =
|
|
2210
|
-
fontWeight =
|
|
2211
|
-
fontSize =
|
|
2212
|
-
fontFamily =
|
|
2213
|
-
padding =
|
|
2214
|
-
icon =
|
|
2215
|
-
gap =
|
|
2216
|
-
|
|
2217
|
-
variant =
|
|
2218
|
-
|
|
2219
|
-
iconPosition =
|
|
2220
|
-
|
|
2221
|
-
iconWeight =
|
|
2222
|
-
iconSize =
|
|
2223
|
-
|
|
2224
|
-
disabled =
|
|
2223
|
+
var ButtonComponent = function ButtonComponent(_ref18) {
|
|
2224
|
+
var onClick = _ref18.onClick,
|
|
2225
|
+
text = _ref18.text,
|
|
2226
|
+
size = _ref18.size,
|
|
2227
|
+
background = _ref18.background,
|
|
2228
|
+
_ref18$color = _ref18.color,
|
|
2229
|
+
color = _ref18$color === void 0 ? colorVariables.text.white : _ref18$color,
|
|
2230
|
+
border = _ref18.border,
|
|
2231
|
+
borderRadius = _ref18.borderRadius,
|
|
2232
|
+
fontWeight = _ref18.fontWeight,
|
|
2233
|
+
fontSize = _ref18.fontSize,
|
|
2234
|
+
fontFamily = _ref18.fontFamily,
|
|
2235
|
+
padding = _ref18.padding,
|
|
2236
|
+
icon = _ref18.icon,
|
|
2237
|
+
gap = _ref18.gap,
|
|
2238
|
+
_ref18$variant = _ref18.variant,
|
|
2239
|
+
variant = _ref18$variant === void 0 ? 'primary' : _ref18$variant,
|
|
2240
|
+
_ref18$iconPosition = _ref18.iconPosition,
|
|
2241
|
+
iconPosition = _ref18$iconPosition === void 0 ? 'right' : _ref18$iconPosition,
|
|
2242
|
+
_ref18$iconWeight = _ref18.iconWeight,
|
|
2243
|
+
iconWeight = _ref18$iconWeight === void 0 ? '2' : _ref18$iconWeight,
|
|
2244
|
+
iconSize = _ref18.iconSize,
|
|
2245
|
+
_ref18$disabled = _ref18.disabled,
|
|
2246
|
+
disabled = _ref18$disabled === void 0 ? false : _ref18$disabled,
|
|
2247
|
+
_ref18$loaderProps = _ref18.loaderProps,
|
|
2248
|
+
loaderProps = _ref18$loaderProps === void 0 ? {
|
|
2249
|
+
loading: false,
|
|
2250
|
+
loaderPosition: 'right',
|
|
2251
|
+
loaderColor: colorVariables.text.white
|
|
2252
|
+
} : _ref18$loaderProps;
|
|
2225
2253
|
var _useState = React.useState(false),
|
|
2226
2254
|
isHovered = _useState[0],
|
|
2227
2255
|
setIsHovered = _useState[1];
|
|
2228
2256
|
var iconPos = iconPosition || 'left';
|
|
2257
|
+
var loaderPos = loaderProps.loaderPosition || 'right';
|
|
2229
2258
|
return React__default.createElement(StyledButton, {
|
|
2230
2259
|
disabled: disabled,
|
|
2231
2260
|
onClick: onClick,
|
|
@@ -2235,15 +2264,16 @@ var ButtonComponent = function ButtonComponent(_ref12) {
|
|
|
2235
2264
|
size: size,
|
|
2236
2265
|
color: color,
|
|
2237
2266
|
padding: padding,
|
|
2238
|
-
gap: gap,
|
|
2239
2267
|
variant: variant,
|
|
2240
|
-
iconPosition: iconPos,
|
|
2241
2268
|
onMouseEnter: function onMouseEnter() {
|
|
2242
2269
|
return setIsHovered(true);
|
|
2243
2270
|
},
|
|
2244
2271
|
onMouseLeave: function onMouseLeave() {
|
|
2245
2272
|
return setIsHovered(false);
|
|
2246
2273
|
}
|
|
2274
|
+
}, React__default.createElement(Container, {
|
|
2275
|
+
iconPosition: iconPos,
|
|
2276
|
+
gap: gap
|
|
2247
2277
|
}, icon && React__default.createElement(Icon, {
|
|
2248
2278
|
icon: icon,
|
|
2249
2279
|
weight: iconWeight,
|
|
@@ -2255,10 +2285,15 @@ var ButtonComponent = function ButtonComponent(_ref12) {
|
|
|
2255
2285
|
fontFamily: fontFamily,
|
|
2256
2286
|
fontSize: fontSize,
|
|
2257
2287
|
fontWeight: fontWeight
|
|
2258
|
-
}, text))
|
|
2288
|
+
}, text)), loaderProps.loading && React__default.createElement(LoaderWrapper, {
|
|
2289
|
+
loaderPosition: loaderPos
|
|
2290
|
+
}, React__default.createElement(Spinner, {
|
|
2291
|
+
size: size === 'small' ? 6 : size === 'medium' ? 8 : 9,
|
|
2292
|
+
color: loaderProps.loaderColor || color
|
|
2293
|
+
})));
|
|
2259
2294
|
};
|
|
2260
2295
|
|
|
2261
|
-
var _templateObject$3, _templateObject2$2, _templateObject3$
|
|
2296
|
+
var _templateObject$3, _templateObject2$2, _templateObject3$2;
|
|
2262
2297
|
var InputContainer = styled__default.div(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n position: relative; \n width: ", ";\n height: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n background: ", ";\n display: flex; \n flex-direction : column;\n justify-content : center; \n"])), function (_ref) {
|
|
2263
2298
|
var width = _ref.width;
|
|
2264
2299
|
return width || "100%";
|
|
@@ -2279,7 +2314,7 @@ var WrittenTextAfterInput = styled__default.p(_templateObject2$2 || (_templateOb
|
|
|
2279
2314
|
var show = _ref6.show;
|
|
2280
2315
|
return show ? "visible" : "hidden";
|
|
2281
2316
|
});
|
|
2282
|
-
var InputBlock = styled__default.input(_templateObject3$
|
|
2317
|
+
var InputBlock = styled__default.input(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n background: ", ";\n color: ", ";\n padding: ", ";\n box-sizing: border-box;\n font-family: NotoSans, sans-serif;\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n text-align: left;\n outline: none;\n\n ::placeholder {\n color: ", ";\n }\n"])), function (_ref7) {
|
|
2283
2318
|
var width = _ref7.width;
|
|
2284
2319
|
return width || "100%";
|
|
2285
2320
|
}, function (_ref8) {
|
|
@@ -2411,8 +2446,8 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
2411
2446
|
})));
|
|
2412
2447
|
};
|
|
2413
2448
|
|
|
2414
|
-
var _templateObject$4, _templateObject2$3, _templateObject3$
|
|
2415
|
-
var spin = styled.keyframes(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n 0% { opacity: 1; }\n 100% { opacity: 0.3; }\n"])));
|
|
2449
|
+
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$1;
|
|
2450
|
+
var spin$1 = styled.keyframes(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n 0% { opacity: 1; }\n 100% { opacity: 0.3; }\n"])));
|
|
2416
2451
|
var getDotPosition = function getDotPosition(index, size) {
|
|
2417
2452
|
var angle = index * 360 / 8;
|
|
2418
2453
|
var radius = size / 2.5;
|
|
@@ -2435,7 +2470,7 @@ var Dot = styled__default.div.attrs(function (_ref3) {
|
|
|
2435
2470
|
transform: getDotPosition(index, size)
|
|
2436
2471
|
}
|
|
2437
2472
|
};
|
|
2438
|
-
})(_templateObject3$
|
|
2473
|
+
})(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: ", "px;\n height: ", "px;\n background-color: ", ";\n border-radius: 50%;\n animation: ", " ", "s linear infinite;\n animation-delay: ", "s;\n"])), function (_ref4) {
|
|
2439
2474
|
var dotSize = _ref4.dotSize;
|
|
2440
2475
|
return dotSize;
|
|
2441
2476
|
}, function (_ref5) {
|
|
@@ -2444,7 +2479,7 @@ var Dot = styled__default.div.attrs(function (_ref3) {
|
|
|
2444
2479
|
}, function (_ref6) {
|
|
2445
2480
|
var color = _ref6.color;
|
|
2446
2481
|
return color;
|
|
2447
|
-
}, spin, function (_ref7) {
|
|
2482
|
+
}, spin$1, function (_ref7) {
|
|
2448
2483
|
var speed = _ref7.speed;
|
|
2449
2484
|
return speed;
|
|
2450
2485
|
}, function (_ref8) {
|
|
@@ -2452,7 +2487,7 @@ var Dot = styled__default.div.attrs(function (_ref3) {
|
|
|
2452
2487
|
speed = _ref8.speed;
|
|
2453
2488
|
return index * speed / 8;
|
|
2454
2489
|
});
|
|
2455
|
-
var SpinnerWrapper = styled__default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: max-content;\n"])));
|
|
2490
|
+
var SpinnerWrapper = styled__default.div(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: max-content;\n"])));
|
|
2456
2491
|
var sizeMap = {
|
|
2457
2492
|
small: {
|
|
2458
2493
|
size: 32
|