@ornikar/kitt-universal 2.1.1 → 2.5.0
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/definitions/Button/Button.d.ts +6 -3
- package/dist/definitions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/Button/{ButtonContainer.d.ts → ButtonPressable.d.ts} +3 -3
- package/dist/definitions/Button/{ButtonContainer.d.ts.map → ButtonPressable.d.ts.map} +1 -1
- package/dist/definitions/Emoji/Emoji.d.ts +8 -0
- package/dist/definitions/Emoji/Emoji.d.ts.map +1 -0
- package/dist/definitions/ExternalLink/ExternalLink.d.ts +18 -0
- package/dist/definitions/ExternalLink/ExternalLink.d.ts.map +1 -0
- package/dist/definitions/ExternalLink/ExternalLink.web.d.ts +4 -0
- package/dist/definitions/ExternalLink/ExternalLink.web.d.ts.map +1 -0
- package/dist/definitions/ExternalLink/ExternalLinkOpenLinkBehavior.d.ts +24 -0
- package/dist/definitions/ExternalLink/ExternalLinkOpenLinkBehavior.d.ts.map +1 -0
- package/dist/definitions/Tag/Tag.d.ts +6 -3
- package/dist/definitions/Tag/Tag.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +9 -1
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/primitives/PrimitiveImage.d.ts +13 -0
- package/dist/definitions/primitives/PrimitiveImage.d.ts.map +1 -0
- package/dist/definitions/primitives/PrimitiveImage.web.d.ts +4 -0
- package/dist/definitions/primitives/PrimitiveImage.web.d.ts.map +1 -0
- package/dist/definitions/primitives/PrimitiveLink.d.ts +3 -1
- package/dist/definitions/primitives/PrimitiveLink.d.ts.map +1 -1
- package/dist/definitions/primitives/PrimitiveLink.web.d.ts +1 -1
- package/dist/definitions/primitives/PrimitiveLink.web.d.ts.map +1 -1
- package/dist/definitions/primitives/PrimitivePressable.d.ts +3 -0
- package/dist/definitions/primitives/PrimitivePressable.d.ts.map +1 -1
- package/dist/definitions/primitives/PrimitivePressable.web.d.ts.map +1 -1
- package/dist/definitions/primitives/PrimitiveScrollView.d.ts +1 -0
- package/dist/definitions/primitives/PrimitiveScrollView.d.ts.map +1 -1
- package/dist/definitions/primitives/PrimitiveView.d.ts +3 -0
- package/dist/definitions/primitives/PrimitiveView.d.ts.map +1 -1
- package/dist/definitions/primitives/PrimitiveView.web.d.ts +6 -2
- package/dist/definitions/primitives/PrimitiveView.web.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryDecorator.d.ts +3 -3
- package/dist/definitions/story-components/StoryDecorator.d.ts.map +1 -1
- package/dist/definitions/themes/default.d.ts +30 -3
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/tagLateOceanTheme.d.ts +30 -3
- package/dist/definitions/themes/late-ocean/tagLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/typography/Typography.d.ts +3 -3
- package/dist/definitions/typography/Typography.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyEmoji.d.ts +8 -0
- package/dist/definitions/typography/TypographyEmoji.d.ts.map +1 -0
- package/dist/definitions/typography/TypographyLink.d.ts +7 -4
- package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
- package/dist/definitions/utils/storybook/decorators/SafeAreaProviderDecorator.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +329 -151
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +329 -151
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +279 -96
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +387 -167
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +250 -66
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +5 -2
- package/dist/definitions/Button/useButton.d.ts +0 -6
- package/dist/definitions/Button/useButton.d.ts.map +0 -1
|
@@ -2,11 +2,13 @@ import _extends from '@babel/runtime/helpers/extends';
|
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import { UserIcon, EyeIcon, EyeOffIcon, XIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon } from '@ornikar/kitt-icons';
|
|
4
4
|
export * from '@ornikar/kitt-icons';
|
|
5
|
-
import React, { useRef, useEffect, useContext, createContext, useState, forwardRef, Fragment
|
|
6
|
-
import { View, Animated, Easing, Text as Text$1, Image, Pressable,
|
|
5
|
+
import React, { useRef, useEffect, useContext, createContext, useState, useMemo, forwardRef, Fragment } from 'react';
|
|
6
|
+
import { View, Animated, Easing, Text as Text$1, Image, Pressable, Platform, Linking, TextInput, useWindowDimensions, ActivityIndicator, TouchableOpacity, StyleSheet, ScrollView, Modal as Modal$1 } from 'react-native';
|
|
7
7
|
export { useWindowDimensions as useWindowSize } from 'react-native';
|
|
8
8
|
import styled, { useTheme, css, ThemeProvider } from 'styled-components';
|
|
9
9
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
10
|
+
import { parse } from 'twemoji-parser';
|
|
11
|
+
import { openBrowserAsync } from 'expo-web-browser';
|
|
10
12
|
import { useSafeAreaInsets, SafeAreaProvider } from 'react-native-safe-area-context';
|
|
11
13
|
import Animated$1, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
|
|
12
14
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
@@ -81,7 +83,7 @@ function Icon(_ref5) {
|
|
|
81
83
|
|
|
82
84
|
var PrimitiveText = Text$1;
|
|
83
85
|
|
|
84
|
-
var _excluded$
|
|
86
|
+
var _excluded$a = ["accessibilityRole", "base", "variant", "color"];
|
|
85
87
|
var TypographyTypeContext = /*#__PURE__*/createContext(undefined);
|
|
86
88
|
var TypographyColorContext = /*#__PURE__*/createContext('black');
|
|
87
89
|
function useTypographyColor() {
|
|
@@ -120,7 +122,7 @@ function Typography(_ref3) {
|
|
|
120
122
|
base = _ref3.base,
|
|
121
123
|
variant = _ref3.variant,
|
|
122
124
|
color = _ref3.color,
|
|
123
|
-
otherProps = _objectWithoutProperties(_ref3, _excluded$
|
|
125
|
+
otherProps = _objectWithoutProperties(_ref3, _excluded$a);
|
|
124
126
|
|
|
125
127
|
var typeInContext = useContext(TypographyTypeContext);
|
|
126
128
|
var isHeader = isTypographyHeader(base, typeInContext);
|
|
@@ -199,7 +201,7 @@ Typography.h4 = createHeading(4, 'header4');
|
|
|
199
201
|
|
|
200
202
|
Typography.h5 = createHeading(5, 'header5');
|
|
201
203
|
|
|
202
|
-
var _excluded$
|
|
204
|
+
var _excluded$9 = ["size"];
|
|
203
205
|
|
|
204
206
|
var getFirstCharacter = function (string) {
|
|
205
207
|
return string ? string[0] : '';
|
|
@@ -266,7 +268,7 @@ function AvatarContent(_ref5) {
|
|
|
266
268
|
function Avatar(_ref6) {
|
|
267
269
|
var _ref6$size = _ref6.size,
|
|
268
270
|
size = _ref6$size === void 0 ? 40 : _ref6$size,
|
|
269
|
-
rest = _objectWithoutProperties(_ref6, _excluded$
|
|
271
|
+
rest = _objectWithoutProperties(_ref6, _excluded$9);
|
|
270
272
|
|
|
271
273
|
return /*#__PURE__*/React.createElement(StyledAvatarView, _extends({}, rest, {
|
|
272
274
|
size: size
|
|
@@ -275,52 +277,7 @@ function Avatar(_ref6) {
|
|
|
275
277
|
})));
|
|
276
278
|
}
|
|
277
279
|
|
|
278
|
-
var
|
|
279
|
-
|
|
280
|
-
var ButtonContainer = /*#__PURE__*/styled(PrimitivePressable).withConfig({
|
|
281
|
-
displayName: "ButtonContainer",
|
|
282
|
-
componentId: "kitt-universal__sc-ofbpwm-0"
|
|
283
|
-
})(["min-width:", ";max-width:", ";width:", ";min-height:", ";background-color:", ";padding:", ";flex-direction:row;align-self:flex-start;border-radius:", ";border-color:", ";border-width:", ";"], function (_ref) {
|
|
284
|
-
var theme = _ref.theme;
|
|
285
|
-
return theme.kitt.button.minWidth;
|
|
286
|
-
}, function (_ref2) {
|
|
287
|
-
var theme = _ref2.theme,
|
|
288
|
-
stretch = _ref2.stretch;
|
|
289
|
-
return stretch ? 'auto' : theme.kitt.button.maxWidth;
|
|
290
|
-
}, function (_ref3) {
|
|
291
|
-
var stretch = _ref3.stretch;
|
|
292
|
-
return stretch ? '100%' : 'auto';
|
|
293
|
-
}, function (_ref4) {
|
|
294
|
-
var theme = _ref4.theme;
|
|
295
|
-
return theme.kitt.button.minHeight;
|
|
296
|
-
}, function (_ref5) {
|
|
297
|
-
var theme = _ref5.theme,
|
|
298
|
-
isPressed = _ref5.isPressed,
|
|
299
|
-
disabled = _ref5.disabled,
|
|
300
|
-
type = _ref5.type;
|
|
301
|
-
|
|
302
|
-
if (disabled) {
|
|
303
|
-
return theme.kitt.button[type].disabledBackgroundColor;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return isPressed ? theme.kitt.button[type].pressedBackgroundColor : theme.kitt.button[type].backgroundColor;
|
|
307
|
-
}, function (_ref6) {
|
|
308
|
-
var theme = _ref6.theme;
|
|
309
|
-
return theme.kitt.button.contentPadding["default"];
|
|
310
|
-
}, function (_ref7) {
|
|
311
|
-
var theme = _ref7.theme;
|
|
312
|
-
return theme.kitt.button.borderRadius;
|
|
313
|
-
}, function (_ref8) {
|
|
314
|
-
var theme = _ref8.theme,
|
|
315
|
-
disabled = _ref8.disabled,
|
|
316
|
-
type = _ref8.type;
|
|
317
|
-
return disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent';
|
|
318
|
-
}, function (_ref9) {
|
|
319
|
-
var theme = _ref9.theme;
|
|
320
|
-
return theme.kitt.button.borderWidth;
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
var _excluded$7 = ["color"],
|
|
280
|
+
var _excluded$8 = ["color"],
|
|
324
281
|
_excluded2$2 = ["color"];
|
|
325
282
|
|
|
326
283
|
function TypographyIconInheritColor(props) {
|
|
@@ -333,7 +290,7 @@ function TypographyIconInheritColor(props) {
|
|
|
333
290
|
|
|
334
291
|
function TypographyIconSpecifiedColor(_ref) {
|
|
335
292
|
var color = _ref.color,
|
|
336
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
293
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$8);
|
|
337
294
|
|
|
338
295
|
var theme = /*#__PURE__*/useTheme();
|
|
339
296
|
return /*#__PURE__*/React.createElement(Icon, _extends({}, otherProps, {
|
|
@@ -466,22 +423,50 @@ function ButtonContent(_ref4) {
|
|
|
466
423
|
})) : null);
|
|
467
424
|
}
|
|
468
425
|
|
|
469
|
-
var
|
|
470
|
-
var _useState = useState(false),
|
|
471
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
472
|
-
isPressed = _useState2[0],
|
|
473
|
-
setIsPressed = _useState2[1];
|
|
426
|
+
var PrimitivePressable = Pressable;
|
|
474
427
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
428
|
+
var ButtonPressable = /*#__PURE__*/styled(PrimitivePressable).withConfig({
|
|
429
|
+
displayName: "ButtonPressable",
|
|
430
|
+
componentId: "kitt-universal__sc-7ckel6-0"
|
|
431
|
+
})(["min-width:", ";max-width:", ";width:", ";min-height:", ";background-color:", ";padding:", ";flex-direction:row;align-self:flex-start;border-radius:", ";border-color:", ";border-width:", ";"], function (_ref) {
|
|
432
|
+
var theme = _ref.theme;
|
|
433
|
+
return theme.kitt.button.minWidth;
|
|
434
|
+
}, function (_ref2) {
|
|
435
|
+
var theme = _ref2.theme,
|
|
436
|
+
stretch = _ref2.stretch;
|
|
437
|
+
return stretch ? 'auto' : theme.kitt.button.maxWidth;
|
|
438
|
+
}, function (_ref3) {
|
|
439
|
+
var stretch = _ref3.stretch;
|
|
440
|
+
return stretch ? '100%' : 'auto';
|
|
441
|
+
}, function (_ref4) {
|
|
442
|
+
var theme = _ref4.theme;
|
|
443
|
+
return theme.kitt.button.minHeight;
|
|
444
|
+
}, function (_ref5) {
|
|
445
|
+
var theme = _ref5.theme,
|
|
446
|
+
isPressed = _ref5.isPressed,
|
|
447
|
+
disabled = _ref5.disabled,
|
|
448
|
+
type = _ref5.type;
|
|
449
|
+
|
|
450
|
+
if (disabled) {
|
|
451
|
+
return theme.kitt.button[type].disabledBackgroundColor;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return isPressed ? theme.kitt.button[type].pressedBackgroundColor : theme.kitt.button[type].backgroundColor;
|
|
455
|
+
}, function (_ref6) {
|
|
456
|
+
var theme = _ref6.theme;
|
|
457
|
+
return theme.kitt.button.contentPadding["default"];
|
|
458
|
+
}, function (_ref7) {
|
|
459
|
+
var theme = _ref7.theme;
|
|
460
|
+
return theme.kitt.button.borderRadius;
|
|
461
|
+
}, function (_ref8) {
|
|
462
|
+
var theme = _ref8.theme,
|
|
463
|
+
disabled = _ref8.disabled,
|
|
464
|
+
type = _ref8.type;
|
|
465
|
+
return disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent';
|
|
466
|
+
}, function (_ref9) {
|
|
467
|
+
var theme = _ref9.theme;
|
|
468
|
+
return theme.kitt.button.borderWidth;
|
|
469
|
+
});
|
|
485
470
|
|
|
486
471
|
function Button(_ref) {
|
|
487
472
|
var children = _ref.children,
|
|
@@ -493,29 +478,37 @@ function Button(_ref) {
|
|
|
493
478
|
iconSpin = _ref.iconSpin,
|
|
494
479
|
stretch = _ref.stretch,
|
|
495
480
|
disabled = _ref.disabled,
|
|
496
|
-
|
|
497
|
-
|
|
481
|
+
testID = _ref.testID,
|
|
482
|
+
href = _ref.href,
|
|
483
|
+
hrefAttrs = _ref.hrefAttrs,
|
|
484
|
+
onPress = _ref.onPress;
|
|
498
485
|
|
|
499
|
-
var
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
486
|
+
var _useState = useState(false),
|
|
487
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
488
|
+
isPressed = _useState2[0],
|
|
489
|
+
setIsPressed = _useState2[1];
|
|
503
490
|
|
|
504
491
|
var sharedProps = {
|
|
505
492
|
type: type,
|
|
506
493
|
stretch: stretch,
|
|
507
494
|
disabled: disabled
|
|
508
495
|
};
|
|
509
|
-
return /*#__PURE__*/React.createElement(
|
|
496
|
+
return /*#__PURE__*/React.createElement(ButtonPressable // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
510
497
|
// TODO: When designs are defined, update with the proper onPress styles to mimic TouchableHighlight
|
|
511
498
|
// underlayColor={globalTheme.button[type].pressedBackgroundColor}
|
|
512
499
|
, _extends({}, sharedProps, {
|
|
513
500
|
isPressed: isPressed,
|
|
514
501
|
accessibilityRole: "button",
|
|
515
502
|
testID: testID,
|
|
503
|
+
href: href,
|
|
504
|
+
hrefAttrs: hrefAttrs,
|
|
516
505
|
onPress: onPress,
|
|
517
|
-
onPressIn: handleButtonPressIn
|
|
518
|
-
|
|
506
|
+
onPressIn: function handleButtonPressIn() {
|
|
507
|
+
return setIsPressed(true);
|
|
508
|
+
},
|
|
509
|
+
onPressOut: function handleButtonPressOut() {
|
|
510
|
+
return setIsPressed(false);
|
|
511
|
+
}
|
|
519
512
|
}), /*#__PURE__*/React.createElement(ButtonContent, _extends({}, sharedProps, {
|
|
520
513
|
icon: icon,
|
|
521
514
|
iconPosition: iconPosition,
|
|
@@ -552,6 +545,88 @@ function Card(_ref6) {
|
|
|
552
545
|
}, children);
|
|
553
546
|
}
|
|
554
547
|
|
|
548
|
+
var PrimitiveImage = Image;
|
|
549
|
+
|
|
550
|
+
var StyledEmoji = /*#__PURE__*/styled(PrimitiveImage).withConfig({
|
|
551
|
+
displayName: "Emoji__StyledEmoji",
|
|
552
|
+
componentId: "kitt-universal__sc-ggl6wj-0"
|
|
553
|
+
})(["width:", "px;height:", "px;"], function (_ref) {
|
|
554
|
+
var size = _ref.size;
|
|
555
|
+
return size;
|
|
556
|
+
}, function (_ref2) {
|
|
557
|
+
var size = _ref2.size;
|
|
558
|
+
return size;
|
|
559
|
+
});
|
|
560
|
+
function Emoji(_ref3) {
|
|
561
|
+
var emoji = _ref3.emoji,
|
|
562
|
+
size = _ref3.size,
|
|
563
|
+
style = _ref3.style,
|
|
564
|
+
className = _ref3.className;
|
|
565
|
+
|
|
566
|
+
var _useMemo = useMemo(function () {
|
|
567
|
+
return parse(emoji, {
|
|
568
|
+
// on native plaforms, you can't display svg as Image
|
|
569
|
+
assetType: Platform.OS === 'web' ? 'svg' : 'png'
|
|
570
|
+
});
|
|
571
|
+
}, [emoji]),
|
|
572
|
+
_useMemo2 = _slicedToArray(_useMemo, 1),
|
|
573
|
+
emojiData = _useMemo2[0];
|
|
574
|
+
|
|
575
|
+
if (!emojiData) return null;
|
|
576
|
+
return /*#__PURE__*/React.createElement(StyledEmoji, {
|
|
577
|
+
size: size,
|
|
578
|
+
accessibilityLabel: emojiData.text,
|
|
579
|
+
source: {
|
|
580
|
+
uri: emojiData.url
|
|
581
|
+
},
|
|
582
|
+
style: style,
|
|
583
|
+
className: className
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
var defaultOpenLinkBehavior = {
|
|
588
|
+
"native": 'openInModal',
|
|
589
|
+
web: 'targetBlank'
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
var _excluded$7 = ["as", "href", "openLinkBehavior", "onPress"];
|
|
593
|
+
function ExternalLink(_ref) {
|
|
594
|
+
var Component = _ref.as,
|
|
595
|
+
href = _ref.href,
|
|
596
|
+
_ref$openLinkBehavior = _ref.openLinkBehavior,
|
|
597
|
+
openLinkBehavior = _ref$openLinkBehavior === void 0 ? defaultOpenLinkBehavior : _ref$openLinkBehavior,
|
|
598
|
+
onPress = _ref.onPress,
|
|
599
|
+
rest = _objectWithoutProperties(_ref, _excluded$7);
|
|
600
|
+
|
|
601
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
602
|
+
onPress: function handleOnPress() {
|
|
603
|
+
if (onPress) onPress();
|
|
604
|
+
if (!href) return;
|
|
605
|
+
|
|
606
|
+
switch (openLinkBehavior["native"]) {
|
|
607
|
+
case 'openInModal':
|
|
608
|
+
case undefined:
|
|
609
|
+
Linking.openURL(href)["catch"](function (err) {
|
|
610
|
+
console.error("An error occurred while opening ".concat(href), err);
|
|
611
|
+
});
|
|
612
|
+
break;
|
|
613
|
+
|
|
614
|
+
case 'openBrowserApp':
|
|
615
|
+
openBrowserAsync(href)["catch"](function (err) {
|
|
616
|
+
console.error("An error occurred while opening ".concat(href), err);
|
|
617
|
+
});
|
|
618
|
+
break;
|
|
619
|
+
|
|
620
|
+
default:
|
|
621
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
622
|
+
throw new Error("Invalid ExternalLink native behavior: ".concat(openLinkBehavior["native"]));
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
|
|
555
630
|
var getColorFromState = function (state) {
|
|
556
631
|
switch (state) {
|
|
557
632
|
case 'invalid':
|
|
@@ -2045,26 +2120,63 @@ var StoryGrid = {
|
|
|
2045
2120
|
var Container = /*#__PURE__*/styled(PrimitiveView).withConfig({
|
|
2046
2121
|
displayName: "Tag__Container",
|
|
2047
2122
|
componentId: "kitt-universal__sc-19jmowi-0"
|
|
2048
|
-
})(["background-color:", ";padding:", ";border-radius:", ";align-self:flex-start;"], function (_ref) {
|
|
2123
|
+
})(["background-color:", ";border-width:", ";border-color:", ";padding:", ";border-radius:", ";align-self:flex-start;"], function (_ref) {
|
|
2049
2124
|
var theme = _ref.theme,
|
|
2050
|
-
type = _ref.type
|
|
2051
|
-
|
|
2125
|
+
type = _ref.type,
|
|
2126
|
+
variant = _ref.variant;
|
|
2127
|
+
return theme.kitt.tag[type][variant].backgroundColor;
|
|
2052
2128
|
}, function (_ref2) {
|
|
2053
|
-
var theme = _ref2.theme
|
|
2054
|
-
|
|
2129
|
+
var theme = _ref2.theme,
|
|
2130
|
+
type = _ref2.type,
|
|
2131
|
+
variant = _ref2.variant;
|
|
2132
|
+
return theme.kitt.tag[type][variant].borderWidth;
|
|
2055
2133
|
}, function (_ref3) {
|
|
2056
|
-
var theme = _ref3.theme
|
|
2134
|
+
var theme = _ref3.theme,
|
|
2135
|
+
type = _ref3.type,
|
|
2136
|
+
variant = _ref3.variant;
|
|
2137
|
+
return theme.kitt.tag[type][variant].borderColor;
|
|
2138
|
+
}, function (_ref4) {
|
|
2139
|
+
var theme = _ref4.theme;
|
|
2140
|
+
return theme.kitt.tag.padding;
|
|
2141
|
+
}, function (_ref5) {
|
|
2142
|
+
var theme = _ref5.theme;
|
|
2057
2143
|
return theme.kitt.tag.borderRadius;
|
|
2058
2144
|
});
|
|
2059
|
-
function
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2145
|
+
var getLabelColor = function (type, variant) {
|
|
2146
|
+
switch (type) {
|
|
2147
|
+
case 'danger':
|
|
2148
|
+
{
|
|
2149
|
+
return variant === 'outline' ? 'danger' : 'black';
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
case 'primary':
|
|
2153
|
+
{
|
|
2154
|
+
return 'primary';
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
case 'default':
|
|
2158
|
+
{
|
|
2159
|
+
return 'black';
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
default:
|
|
2163
|
+
{
|
|
2164
|
+
return 'black';
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
function Tag(_ref6) {
|
|
2169
|
+
var label = _ref6.label,
|
|
2170
|
+
_ref6$type = _ref6.type,
|
|
2171
|
+
type = _ref6$type === void 0 ? 'default' : _ref6$type,
|
|
2172
|
+
_ref6$variant = _ref6.variant,
|
|
2173
|
+
variant = _ref6$variant === void 0 ? 'fill' : _ref6$variant;
|
|
2063
2174
|
return /*#__PURE__*/React.createElement(Container, {
|
|
2064
|
-
type: type
|
|
2175
|
+
type: type,
|
|
2176
|
+
variant: variant
|
|
2065
2177
|
}, /*#__PURE__*/React.createElement(Typography.Text, {
|
|
2066
2178
|
base: "body-xsmall",
|
|
2067
|
-
color: type
|
|
2179
|
+
color: getLabelColor(type, variant)
|
|
2068
2180
|
}, label));
|
|
2069
2181
|
}
|
|
2070
2182
|
|
|
@@ -2119,9 +2231,9 @@ var buttonLateOceanTheme = {
|
|
|
2119
2231
|
disabledBorderColor: lateOceanColorPalette.black100
|
|
2120
2232
|
},
|
|
2121
2233
|
secondary: {
|
|
2122
|
-
backgroundColor:
|
|
2234
|
+
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
2123
2235
|
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
2124
|
-
pressedBackgroundColor:
|
|
2236
|
+
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2125
2237
|
disabledBorderColor: lateOceanColorPalette.black100
|
|
2126
2238
|
},
|
|
2127
2239
|
subtle: {
|
|
@@ -2322,13 +2434,40 @@ var tagLateOceanTheme = {
|
|
|
2322
2434
|
borderRadius: '10px',
|
|
2323
2435
|
padding: '2px 12px',
|
|
2324
2436
|
primary: {
|
|
2325
|
-
|
|
2437
|
+
fill: {
|
|
2438
|
+
backgroundColor: lateOceanColorPalette.moonPurpleLight1,
|
|
2439
|
+
borderWidth: '0',
|
|
2440
|
+
borderColor: lateOceanColorPalette.transparent
|
|
2441
|
+
},
|
|
2442
|
+
outline: {
|
|
2443
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2444
|
+
borderWidth: '1px',
|
|
2445
|
+
borderColor: lateOceanColorPalette.lateOcean
|
|
2446
|
+
}
|
|
2326
2447
|
},
|
|
2327
2448
|
"default": {
|
|
2328
|
-
|
|
2449
|
+
fill: {
|
|
2450
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
2451
|
+
borderWidth: '0',
|
|
2452
|
+
borderColor: lateOceanColorPalette.transparent
|
|
2453
|
+
},
|
|
2454
|
+
outline: {
|
|
2455
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2456
|
+
borderWidth: '1px',
|
|
2457
|
+
borderColor: lateOceanColorPalette.black1000
|
|
2458
|
+
}
|
|
2329
2459
|
},
|
|
2330
2460
|
danger: {
|
|
2331
|
-
|
|
2461
|
+
fill: {
|
|
2462
|
+
backgroundColor: lateOceanColorPalette.warmEmbrace,
|
|
2463
|
+
borderWidth: '0',
|
|
2464
|
+
borderColor: lateOceanColorPalette.transparent
|
|
2465
|
+
},
|
|
2466
|
+
outline: {
|
|
2467
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2468
|
+
borderWidth: '1px',
|
|
2469
|
+
borderColor: colorsLateOceanTheme.danger
|
|
2470
|
+
}
|
|
2332
2471
|
}
|
|
2333
2472
|
};
|
|
2334
2473
|
|
|
@@ -2456,7 +2595,47 @@ function Tooltip(_ref) {
|
|
|
2456
2595
|
return /*#__PURE__*/React.createElement(PrimitiveView, null, children);
|
|
2457
2596
|
}
|
|
2458
2597
|
|
|
2459
|
-
var
|
|
2598
|
+
var isBody = function (value) {
|
|
2599
|
+
return ['body-large', 'body-medium', 'body', 'body-small', 'body-xsmall'].includes(value);
|
|
2600
|
+
};
|
|
2601
|
+
|
|
2602
|
+
function getDimensions(base, theme) {
|
|
2603
|
+
if (isBody(base)) {
|
|
2604
|
+
return theme.kitt.typography.types.bodies.configs[base];
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
return theme.kitt.typography.types.headers.configs[base];
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
var StyledTypographyEmoji = /*#__PURE__*/styled(Emoji).withConfig({
|
|
2611
|
+
displayName: "TypographyEmoji__StyledTypographyEmoji",
|
|
2612
|
+
componentId: "kitt-universal__sc-1if5guu-0"
|
|
2613
|
+
})(["align-self:center;", ""], function (_ref) {
|
|
2614
|
+
var size = _ref.size;
|
|
2615
|
+
if (Platform.OS !== 'web') return undefined;
|
|
2616
|
+
/* Style Twemoji: https://github.com/twitter/twemoji#inline-styles */
|
|
2617
|
+
|
|
2618
|
+
return "\n margin: 0 ".concat(size / 20, "px 0 ").concat(size / 10, "px;\n transform: translateY(").concat(size / 10 * 2, "px);\n ");
|
|
2619
|
+
});
|
|
2620
|
+
function TypographyEmoji(_ref2) {
|
|
2621
|
+
var emoji = _ref2.emoji,
|
|
2622
|
+
_ref2$base = _ref2.base,
|
|
2623
|
+
base = _ref2$base === void 0 ? 'body' : _ref2$base;
|
|
2624
|
+
var theme = /*#__PURE__*/useTheme();
|
|
2625
|
+
var dimensions = getDimensions(base, theme);
|
|
2626
|
+
var fontSize = dimensions.baseAndSmall.fontSize;
|
|
2627
|
+
|
|
2628
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
2629
|
+
if (!fontSize.endsWith('px')) throw new Error("Unexpected font-size value: ".concat(fontSize));
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
return /*#__PURE__*/React.createElement(StyledTypographyEmoji, {
|
|
2633
|
+
size: parseInt(fontSize.slice(0, -2), 10),
|
|
2634
|
+
emoji: emoji
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
var _excluded$1 = ["children", "disabled", "noUnderline", "href", "hrefAttrs", "onPress"];
|
|
2460
2639
|
var StyledLink = /*#__PURE__*/styled(PrimitiveLink).withConfig({
|
|
2461
2640
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
2462
2641
|
return !['disabled', 'noUnderline'].includes(prop);
|
|
@@ -2477,6 +2656,8 @@ function TypographyLink(_ref3) {
|
|
|
2477
2656
|
var children = _ref3.children,
|
|
2478
2657
|
disabled = _ref3.disabled,
|
|
2479
2658
|
noUnderline = _ref3.noUnderline,
|
|
2659
|
+
href = _ref3.href,
|
|
2660
|
+
hrefAttrs = _ref3.hrefAttrs,
|
|
2480
2661
|
onPress = _ref3.onPress,
|
|
2481
2662
|
otherProps = _objectWithoutProperties(_ref3, _excluded$1);
|
|
2482
2663
|
|
|
@@ -2485,6 +2666,8 @@ function TypographyLink(_ref3) {
|
|
|
2485
2666
|
}), /*#__PURE__*/React.createElement(StyledLink, {
|
|
2486
2667
|
disabled: disabled,
|
|
2487
2668
|
noUnderline: noUnderline,
|
|
2669
|
+
href: href,
|
|
2670
|
+
hrefAttrs: hrefAttrs,
|
|
2488
2671
|
accessibilityRole: "link",
|
|
2489
2672
|
onPress: disabled ? undefined : onPress
|
|
2490
2673
|
}, children));
|
|
@@ -2593,5 +2776,5 @@ function MatchWindowSize(_ref) {
|
|
|
2593
2776
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
2594
2777
|
}
|
|
2595
2778
|
|
|
2596
|
-
export { Avatar, Button, Card, Flex, FullScreenModal, Icon, IconButton, InputFeedback, InputField, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, Label, LargeLoader, ListItem, Loader, MatchWindowSize, Message, Modal, Notification, PrimitiveLink, PrimitivePressable, PrimitiveScrollView, PrimitiveText, PrimitiveView, Radio, SafeAreaProviderDecorator, DeprecatedSection as Section, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, Tag, TextArea, Tooltip, Typography, TypographyIcon, TypographyLink, createWindowSizeHelper, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor };
|
|
2779
|
+
export { Avatar, Button, Card, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputFeedback, InputField, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, LargeLoader, ListItem, Loader, MatchWindowSize, Message, Modal, Notification, PrimitiveImage, PrimitiveLink, PrimitivePressable, PrimitiveScrollView, PrimitiveText, PrimitiveView, Radio, SafeAreaProviderDecorator, DeprecatedSection as Section, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, Tag, TextArea, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor };
|
|
2597
2780
|
//# sourceMappingURL=index-browser-all.es.js.map
|