@televet/kibble-ui 1.1.0 → 1.2.0-beta.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/build/components/Button/button.records.d.ts +2 -0
- package/build/components/Drawer/drawer.records.d.ts +13 -0
- package/build/components/Tooltip/index.d.ts +3 -0
- package/build/components/Tooltip/tooltip.component.d.ts +6 -0
- package/build/components/Tooltip/tooltip.config.d.ts +8 -0
- package/build/components/Tooltip/tooltip.model.d.ts +4 -0
- package/build/components/Tooltip/tooltip.records.d.ts +9 -0
- package/build/components/Typography/Heading/heading.records.d.ts +2 -0
- package/build/components/Typography/Text/text.records.d.ts +2 -0
- package/build/components/index.d.ts +1 -0
- package/build/index.js +60 -0
- package/build/index.js.map +1 -1
- package/build/theme/theme.model.d.ts +33 -0
- package/build/theme/theme.record.d.ts +2 -0
- package/build/theme/theme.types.d.ts +2 -1
- package/build/utils/strings.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TooltipProps as ChakraTooltipProps } from '@chakra-ui/react';
|
|
3
|
+
export interface TooltipProps extends ChakraTooltipProps {
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const Tooltip: ({ children, label, openDelay, ...rest }: TooltipProps) => JSX.Element;
|
package/build/index.js
CHANGED
|
@@ -2741,6 +2741,39 @@ var TextareaConfig = {
|
|
|
2741
2741
|
|
|
2742
2742
|
var camelCaseToLabel = function (s) {
|
|
2743
2743
|
return s.replace(/([A-Z])/g, ' $1').replace(/^\w/, function (c) { return c.toUpperCase(); });
|
|
2744
|
+
};
|
|
2745
|
+
var toTitleCase = function (s) {
|
|
2746
|
+
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i;
|
|
2747
|
+
var alphanumericPattern = /([A-Za-z0-9\u00C0-\u00FF])/;
|
|
2748
|
+
var wordSeparators = /([ :–—-])/;
|
|
2749
|
+
return s
|
|
2750
|
+
.split(wordSeparators)
|
|
2751
|
+
.map(function (current, index, array) {
|
|
2752
|
+
if (
|
|
2753
|
+
/* Check for small words */
|
|
2754
|
+
current.search(smallWords) > -1 &&
|
|
2755
|
+
/* Skip first and last word */
|
|
2756
|
+
index !== 0 &&
|
|
2757
|
+
index !== array.length - 1 &&
|
|
2758
|
+
/* Ignore title end and subtitle start */
|
|
2759
|
+
array[index - 3] !== ':' &&
|
|
2760
|
+
array[index + 1] !== ':' &&
|
|
2761
|
+
/* Ignore small words that start a hyphenated phrase */
|
|
2762
|
+
(array[index + 1] !== '-' || (array[index - 1] === '-' && array[index + 1] === '-'))) {
|
|
2763
|
+
return current.toLowerCase();
|
|
2764
|
+
}
|
|
2765
|
+
/* Ignore intentional capitalization */
|
|
2766
|
+
if (current.substring(1).search(/[A-Z]|\../) > -1) {
|
|
2767
|
+
return current;
|
|
2768
|
+
}
|
|
2769
|
+
/* Ignore URLs */
|
|
2770
|
+
if (array[index + 1] === ':' && array[index + 2] !== '') {
|
|
2771
|
+
return current;
|
|
2772
|
+
}
|
|
2773
|
+
/* Capitalize the first letter */
|
|
2774
|
+
return current.replace(alphanumericPattern, function (match) { return match.toUpperCase(); });
|
|
2775
|
+
})
|
|
2776
|
+
.join('');
|
|
2744
2777
|
};
|
|
2745
2778
|
|
|
2746
2779
|
var Button = React.forwardRef(function (props, ref) {
|
|
@@ -2962,8 +2995,31 @@ var ButtonConfig = {
|
|
|
2962
2995
|
},
|
|
2963
2996
|
};
|
|
2964
2997
|
|
|
2998
|
+
var useAdaptiveColor = function (color) { return react.useColorModeValue(color.light, color.dark); };
|
|
2999
|
+
|
|
3000
|
+
var Tooltip = function (_a) {
|
|
3001
|
+
var children = _a.children, label = _a.label, _b = _a.openDelay, openDelay = _b === void 0 ? 350 : _b, rest = __rest(_a, ["children", "label", "openDelay"]);
|
|
3002
|
+
var components = useTheme().components;
|
|
3003
|
+
var bg = useAdaptiveColor(components.Tooltip.color);
|
|
3004
|
+
var l = toTitleCase(label.toLowerCase());
|
|
3005
|
+
return (React__default["default"].createElement(react.Tooltip, __assign({ hasArrow: true, arrowSize: 10, label: l, bg: bg, openDelay: openDelay }, rest), children));
|
|
3006
|
+
};
|
|
3007
|
+
|
|
3008
|
+
var TooltipGlobalStyle = {
|
|
3009
|
+
'[id^=tooltip]': {
|
|
3010
|
+
padding: '4px 8px 4px 8px !important',
|
|
3011
|
+
borderRadius: '4px !important',
|
|
3012
|
+
},
|
|
3013
|
+
};
|
|
3014
|
+
var TooltipConfig = {
|
|
3015
|
+
color: { light: semanticTokens.background.dark, dark: semanticTokens.background.light },
|
|
3016
|
+
};
|
|
3017
|
+
|
|
2965
3018
|
// @ts-ignore
|
|
2966
3019
|
var theme = react.extendTheme({
|
|
3020
|
+
styles: {
|
|
3021
|
+
global: __assign({}, TooltipGlobalStyle),
|
|
3022
|
+
},
|
|
2967
3023
|
blur: blur,
|
|
2968
3024
|
borders: borders,
|
|
2969
3025
|
colors: colors,
|
|
@@ -2988,6 +3044,7 @@ var theme = react.extendTheme({
|
|
|
2988
3044
|
Textarea: TextareaConfig,
|
|
2989
3045
|
Drawer: DrawerConfig,
|
|
2990
3046
|
Button: ButtonConfig,
|
|
3047
|
+
Tooltip: TooltipConfig,
|
|
2991
3048
|
},
|
|
2992
3049
|
});
|
|
2993
3050
|
|
|
@@ -3009,6 +3066,9 @@ exports.Text = Text;
|
|
|
3009
3066
|
exports.TextConfig = TextConfig;
|
|
3010
3067
|
exports.Textarea = Textarea;
|
|
3011
3068
|
exports.TextareaConfig = TextareaConfig;
|
|
3069
|
+
exports.Tooltip = Tooltip;
|
|
3070
|
+
exports.TooltipConfig = TooltipConfig;
|
|
3071
|
+
exports.TooltipGlobalStyle = TooltipGlobalStyle;
|
|
3012
3072
|
exports.theme = theme;
|
|
3013
3073
|
exports.useTheme = useTheme;
|
|
3014
3074
|
//# sourceMappingURL=index.js.map
|