@helpdice/ui 1.8.4 → 2.0.5
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/CurrencyInput/components/CurrencyInput.d.ts +4 -0
- package/dist/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
- package/dist/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
- package/dist/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
- package/dist/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
- package/dist/CurrencyInput/components/utils/formatValue.d.ts +49 -0
- package/dist/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
- package/dist/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
- package/dist/CurrencyInput/components/utils/index.d.ts +8 -0
- package/dist/CurrencyInput/components/utils/isNumber.d.ts +1 -0
- package/dist/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
- package/dist/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
- package/dist/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
- package/dist/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
- package/dist/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
- package/dist/CurrencyInput/index.d.ts +5 -0
- package/dist/CurrencyInput/index.js +3 -2122
- package/dist/ITooltip/index.d.ts +13 -0
- package/dist/Loadable/index.js +29 -3
- package/dist/PhoneInput/index.js +21 -2140
- package/dist/Placeholder/index.js +5 -2124
- package/dist/auto-complete/index.js +73 -12092
- package/dist/avatar/index.js +15 -2134
- package/dist/badge/index.js +8 -2127
- package/dist/breadcrumbs/index.js +19 -2138
- package/dist/button/index.js +36 -2229
- package/dist/button-dropdown/index.js +28 -2147
- package/dist/button-group/index.js +9 -2128
- package/dist/capacity/index.js +10 -2129
- package/dist/card/index.js +46 -2165
- package/dist/carousal/index.js +644 -12666
- package/dist/checkbox/index.js +10 -2129
- package/dist/code/index.js +14 -2133
- package/dist/collapse/index.js +16 -2135
- package/dist/description/index.js +9 -2128
- package/dist/display/index.js +11 -2130
- package/dist/divider/index.js +12 -2131
- package/dist/dot/index.js +6 -2125
- package/dist/drawer/index.js +21 -2139
- package/dist/fieldset/index.js +22 -2141
- package/dist/grid/index.js +8 -2127
- package/dist/image/index.js +31 -2150
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2065 -23539
- package/dist/input/index.js +42 -2158
- package/dist/keyboard/index.js +11 -2130
- package/dist/link/index.js +11 -2130
- package/dist/list/index.js +25 -2143
- package/dist/list/list-item.d.ts +1 -0
- package/dist/loading/index.js +14 -2133
- package/dist/menu/index.js +2 -10245
- package/dist/modal/index.js +59 -2177
- package/dist/note/index.js +10 -2129
- package/dist/page/index.js +6 -2125
- package/dist/pagination/index.js +11 -2130
- package/dist/popover/index.js +23 -2141
- package/dist/progress/index.js +10 -2129
- package/dist/radio/index.js +17 -2136
- package/dist/rating/index.js +7 -2126
- package/dist/row/index.js +5 -2124
- package/dist/select/index.js +54 -2173
- package/dist/slider/index.js +21 -2140
- package/dist/snippet/index.js +12 -2131
- package/dist/spacer/index.js +2 -2121
- package/dist/spinner/index.js +5 -2124
- package/dist/table/index.js +910 -12918
- package/dist/tabs/index.js +16 -2135
- package/dist/tag/index.js +5 -2124
- package/dist/text/index.js +5 -2124
- package/dist/textarea/index.js +10 -2129
- package/dist/toggle/index.js +14 -2133
- package/dist/tooltip/index.js +17 -2135
- package/dist/tree/index.js +39 -2158
- package/dist/use-input/index.js +2 -2122
- package/dist/use-modal/index.js +2 -2122
- package/dist/use-scale/index.js +2 -2121
- package/dist/use-tabs/index.js +2 -2122
- package/dist/user/index.js +31 -2150
- package/esm/CurrencyInput/components/CurrencyInput.d.ts +4 -0
- package/esm/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
- package/esm/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
- package/esm/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
- package/esm/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
- package/esm/CurrencyInput/components/utils/formatValue.d.ts +49 -0
- package/esm/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
- package/esm/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
- package/esm/CurrencyInput/components/utils/index.d.ts +8 -0
- package/esm/CurrencyInput/components/utils/isNumber.d.ts +1 -0
- package/esm/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
- package/esm/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
- package/esm/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
- package/esm/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
- package/esm/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
- package/esm/CurrencyInput/index.d.ts +5 -0
- package/esm/ITooltip/index.d.ts +13 -0
- package/esm/ITooltip/index.js +97 -0
- package/esm/Loadable/loader.js +13 -0
- package/esm/button/button.compact.js +13 -86
- package/esm/index.d.ts +4 -0
- package/esm/index.js +4 -1
- package/esm/input/input.js +13 -10
- package/esm/link/link.js +3 -3
- package/esm/list/list-item.d.ts +1 -0
- package/esm/list/list-item.js +4 -2
- package/esm/login-with/LoginSocialAmazon/index.js +1 -1
- package/esm/login-with/LoginSocialApple/index.js +1 -1
- package/esm/login-with/LoginSocialFacebook/index.js +1 -1
- package/esm/login-with/LoginSocialGoogle/index.js +1 -1
- package/esm/table/table-body.js +14 -4
- package/esm/table/table-cell.js +1 -1
- package/esm/table/table-head.js +13 -13
- package/esm/table/table.js +8 -8
- package/package.json +5 -5
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
3
|
+
/**
|
|
4
|
+
* Value in different formats
|
|
5
|
+
*
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
export type CurrencyInputOnChangeValues = {
|
|
9
|
+
/**
|
|
10
|
+
* Value as float or null if empty
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* "1.99" > 1.99
|
|
14
|
+
* "" > null
|
|
15
|
+
*/
|
|
16
|
+
float: number | null;
|
|
17
|
+
/**
|
|
18
|
+
* Value after applying formatting
|
|
19
|
+
*
|
|
20
|
+
* Example: "1000000" > "1,000,0000"
|
|
21
|
+
*/
|
|
22
|
+
formatted: string;
|
|
23
|
+
/**
|
|
24
|
+
* Non formatted value as string
|
|
25
|
+
*/
|
|
26
|
+
value: string;
|
|
27
|
+
};
|
|
28
|
+
export type IntlConfig = {
|
|
29
|
+
locale: string;
|
|
30
|
+
currency?: string;
|
|
31
|
+
};
|
|
32
|
+
export type CurrencyInputProps = Overwrite<React.ComponentPropsWithRef<'input'>, {
|
|
33
|
+
/**
|
|
34
|
+
* Allow decimals
|
|
35
|
+
*
|
|
36
|
+
* Default = true
|
|
37
|
+
*/
|
|
38
|
+
allowDecimals?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Allow user to enter negative value
|
|
41
|
+
*
|
|
42
|
+
* Default = true
|
|
43
|
+
*/
|
|
44
|
+
allowNegativeValue?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Component id
|
|
47
|
+
*/
|
|
48
|
+
id?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum characters the user can enter
|
|
51
|
+
*/
|
|
52
|
+
maxLength?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Class names
|
|
55
|
+
*/
|
|
56
|
+
className?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Custom component
|
|
59
|
+
*
|
|
60
|
+
* Default = <input/>
|
|
61
|
+
*/
|
|
62
|
+
customInput?: ElementType;
|
|
63
|
+
/**
|
|
64
|
+
* Limit length of decimals allowed
|
|
65
|
+
*
|
|
66
|
+
* Default = 2
|
|
67
|
+
*/
|
|
68
|
+
decimalsLimit?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Specify decimal scale for padding/trimming
|
|
71
|
+
*
|
|
72
|
+
* Example:
|
|
73
|
+
* 1.5 -> 1.50
|
|
74
|
+
* 1.234 -> 1.23
|
|
75
|
+
*/
|
|
76
|
+
decimalScale?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Default value if not passing in value via props
|
|
79
|
+
*/
|
|
80
|
+
defaultValue?: number | string;
|
|
81
|
+
/**
|
|
82
|
+
* Disabled
|
|
83
|
+
*
|
|
84
|
+
* Default = false
|
|
85
|
+
*/
|
|
86
|
+
disabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Value will always have the specified length of decimals
|
|
89
|
+
*
|
|
90
|
+
* Example:
|
|
91
|
+
* 123 -> 1.23
|
|
92
|
+
*
|
|
93
|
+
* Note: This formatting only happens onBlur
|
|
94
|
+
*/
|
|
95
|
+
fixedDecimalLength?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Handle change in value
|
|
98
|
+
*/
|
|
99
|
+
onValueChange?: (value: string | undefined, name?: string, values?: CurrencyInputOnChangeValues) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Placeholder if there is no value
|
|
102
|
+
*/
|
|
103
|
+
placeholder?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Include a prefix eg. £
|
|
106
|
+
*/
|
|
107
|
+
prefix?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Include a suffix eg. €
|
|
110
|
+
*/
|
|
111
|
+
suffix?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Incremental value change on arrow down and arrow up key press
|
|
114
|
+
*/
|
|
115
|
+
step?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Separator between integer part and fractional part of value.
|
|
118
|
+
*
|
|
119
|
+
* This cannot be a number
|
|
120
|
+
*/
|
|
121
|
+
decimalSeparator?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Separator between thousand, million and billion
|
|
124
|
+
*
|
|
125
|
+
* This cannot be a number
|
|
126
|
+
*/
|
|
127
|
+
groupSeparator?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Disable auto adding separator between values eg. 1000 -> 1,000
|
|
130
|
+
*
|
|
131
|
+
* Default = false
|
|
132
|
+
*/
|
|
133
|
+
disableGroupSeparators?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Disable abbreviations (m, k, b)
|
|
136
|
+
*
|
|
137
|
+
* Default = false
|
|
138
|
+
*/
|
|
139
|
+
disableAbbreviations?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* International locale config, examples:
|
|
142
|
+
* { locale: 'ja-JP', currency: 'JPY' }
|
|
143
|
+
* { locale: 'en-IN', currency: 'INR' }
|
|
144
|
+
*
|
|
145
|
+
* Any prefix, groupSeparator or decimalSeparator options passed in
|
|
146
|
+
* will override Intl Locale config
|
|
147
|
+
*/
|
|
148
|
+
intlConfig?: IntlConfig;
|
|
149
|
+
/**
|
|
150
|
+
* Transform the raw value form the input before parsing
|
|
151
|
+
*/
|
|
152
|
+
transformRawValue?: (rawValue: string) => string;
|
|
153
|
+
/**
|
|
154
|
+
* When set to false, the formatValueOnBlur flag disables the application of the __onValueChange__ function
|
|
155
|
+
* specifically on blur events. If disabled or set to false, the onValueChange will not trigger on blur.
|
|
156
|
+
* Default = true
|
|
157
|
+
*/
|
|
158
|
+
formatValueOnBlur?: boolean;
|
|
159
|
+
}>;
|
|
160
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CurrencyInputProps } from '../CurrencyInputProps';
|
|
2
|
+
export type CleanValueOptions = Pick<CurrencyInputProps, 'decimalSeparator' | 'groupSeparator' | 'allowDecimals' | 'decimalsLimit' | 'allowNegativeValue' | 'disableAbbreviations' | 'prefix' | 'transformRawValue'> & {
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Remove prefix, separators and extra decimals from value
|
|
7
|
+
*/
|
|
8
|
+
export declare const cleanValue: ({ value, groupSeparator, decimalSeparator, allowDecimals, decimalsLimit, allowNegativeValue, disableAbbreviations, prefix, transformRawValue }: CleanValueOptions) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fixedDecimalValue: (value: string, decimalSeparator: string, fixedDecimalLength?: number) => string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { IntlConfig } from '../CurrencyInputProps';
|
|
2
|
+
export type FormatValueOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Value to format
|
|
5
|
+
*/
|
|
6
|
+
value: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Decimal separator
|
|
9
|
+
*
|
|
10
|
+
* Default = '.'
|
|
11
|
+
*/
|
|
12
|
+
decimalSeparator?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Group separator
|
|
15
|
+
*
|
|
16
|
+
* Default = ','
|
|
17
|
+
*/
|
|
18
|
+
groupSeparator?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Turn off separators
|
|
21
|
+
*
|
|
22
|
+
* This will override Group separators
|
|
23
|
+
*
|
|
24
|
+
* Default = false
|
|
25
|
+
*/
|
|
26
|
+
disableGroupSeparators?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Intl locale currency config
|
|
29
|
+
*/
|
|
30
|
+
intlConfig?: IntlConfig;
|
|
31
|
+
/**
|
|
32
|
+
* Specify decimal scale for padding/trimming
|
|
33
|
+
*
|
|
34
|
+
* Eg. 1.5 -> 1.50 or 1.234 -> 1.23
|
|
35
|
+
*/
|
|
36
|
+
decimalScale?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Prefix
|
|
39
|
+
*/
|
|
40
|
+
prefix?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Suffix
|
|
43
|
+
*/
|
|
44
|
+
suffix?: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Format value with decimal separator, group separator and prefix
|
|
48
|
+
*/
|
|
49
|
+
export declare const formatValue: (options: FormatValueOptions) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IntlConfig } from '../CurrencyInputProps';
|
|
2
|
+
type LocaleConfig = {
|
|
3
|
+
currencySymbol: string;
|
|
4
|
+
groupSeparator: string;
|
|
5
|
+
decimalSeparator: string;
|
|
6
|
+
prefix: string;
|
|
7
|
+
suffix: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Get locale config from input or default
|
|
11
|
+
*/
|
|
12
|
+
export declare const getLocaleConfig: (intlConfig?: IntlConfig) => LocaleConfig;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './cleanValue';
|
|
2
|
+
export * from './fixedDecimalValue';
|
|
3
|
+
export * from './formatValue';
|
|
4
|
+
export * from './getLocaleConfig';
|
|
5
|
+
export * from './getSuffix';
|
|
6
|
+
export * from './isNumber';
|
|
7
|
+
export * from './padTrimValue';
|
|
8
|
+
export * from './repositionCursor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isNumber: (input: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const padTrimValue: (value: string, decimalSeparator?: string, decimalScale?: number) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abbreviate number eg. 1000 = 1k
|
|
3
|
+
*
|
|
4
|
+
* Source: https://stackoverflow.com/a/9345181
|
|
5
|
+
*/
|
|
6
|
+
export declare const abbrValue: (value: number, decimalSeparator?: string, _decimalPlaces?: number) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Parse a value with abbreviation e.g 1k = 1000
|
|
9
|
+
*/
|
|
10
|
+
export declare const parseAbbrValue: (value: string, decimalSeparator?: string) => number | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type RepositionCursorProps = {
|
|
2
|
+
selectionStart?: number | null;
|
|
3
|
+
value: string;
|
|
4
|
+
lastKeyStroke: string | null;
|
|
5
|
+
stateValue?: string;
|
|
6
|
+
groupSeparator?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Based on the last key stroke and the cursor position, update the value
|
|
10
|
+
* and reposition the cursor to the right place
|
|
11
|
+
*/
|
|
12
|
+
export declare const repositionCursor: ({ selectionStart, value, lastKeyStroke, stateValue, groupSeparator }: RepositionCursorProps) => {
|
|
13
|
+
modifiedValue: string;
|
|
14
|
+
cursorPosition: number | null | undefined;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import CurrencyInput from './components/CurrencyInput';
|
|
2
|
+
export type { CurrencyInputProps, CurrencyInputOnChangeValues } from './components/CurrencyInputProps';
|
|
3
|
+
export { formatValue } from './components/utils/formatValue';
|
|
4
|
+
export { cleanValue } from './components/utils/cleanValue';
|
|
5
|
+
export default CurrencyInput;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react-dom';
|
|
3
|
+
type AnimationVariant = 'fade' | 'scale' | 'slide';
|
|
4
|
+
export type NotetipProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
text: React.ReactNode;
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
delay?: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
animation?: AnimationVariant;
|
|
11
|
+
};
|
|
12
|
+
declare const Tooltip: React.FC<NotetipProps>;
|
|
13
|
+
export default Tooltip;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
3
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { useFloating, offset, flip, shift, arrow } from '@floating-ui/react-dom';
|
|
5
|
+
import { useTheme } from '@helpdice/theme';
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
7
|
+
var Tooltip = function Tooltip(_ref) {
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
text = _ref.text,
|
|
10
|
+
_ref$placement = _ref.placement,
|
|
11
|
+
placement = _ref$placement === void 0 ? 'top' : _ref$placement,
|
|
12
|
+
_ref$delay = _ref.delay,
|
|
13
|
+
delay = _ref$delay === void 0 ? 0 : _ref$delay,
|
|
14
|
+
_ref$duration = _ref.duration,
|
|
15
|
+
duration = _ref$duration === void 0 ? 200 : _ref$duration,
|
|
16
|
+
_ref$animation = _ref.animation,
|
|
17
|
+
animation = _ref$animation === void 0 ? 'fade' : _ref$animation;
|
|
18
|
+
var theme = useTheme();
|
|
19
|
+
var _useState = useState(false),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
open = _useState2[0],
|
|
22
|
+
setOpen = _useState2[1];
|
|
23
|
+
var _useState3 = useState(false),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
show = _useState4[0],
|
|
26
|
+
setShow = _useState4[1];
|
|
27
|
+
var arrowRef = useRef(null);
|
|
28
|
+
var _useFloating = useFloating({
|
|
29
|
+
placement: placement,
|
|
30
|
+
middleware: [offset(8), flip(), shift({
|
|
31
|
+
padding: 5
|
|
32
|
+
}), arrow({
|
|
33
|
+
element: arrowRef
|
|
34
|
+
})]
|
|
35
|
+
}),
|
|
36
|
+
x = _useFloating.x,
|
|
37
|
+
y = _useFloating.y,
|
|
38
|
+
refs = _useFloating.refs,
|
|
39
|
+
strategy = _useFloating.strategy;
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var timer;
|
|
42
|
+
if (open) {
|
|
43
|
+
timer = setTimeout(function () {
|
|
44
|
+
return setShow(true);
|
|
45
|
+
}, delay);
|
|
46
|
+
} else {
|
|
47
|
+
setShow(false);
|
|
48
|
+
}
|
|
49
|
+
return function () {
|
|
50
|
+
return clearTimeout(timer);
|
|
51
|
+
};
|
|
52
|
+
}, [open, delay]);
|
|
53
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
54
|
+
return setOpen(true);
|
|
55
|
+
};
|
|
56
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
57
|
+
return setOpen(false);
|
|
58
|
+
};
|
|
59
|
+
var handleTouchStart = function handleTouchStart() {
|
|
60
|
+
setOpen(true);
|
|
61
|
+
setTimeout(function () {
|
|
62
|
+
return setOpen(false);
|
|
63
|
+
}, 2000); // auto-hide
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// const staticSide = {
|
|
67
|
+
// top: 'bottom',
|
|
68
|
+
// right: 'left',
|
|
69
|
+
// bottom: 'top',
|
|
70
|
+
// left: 'right',
|
|
71
|
+
// }[finalPlacement.split('-')[0]];
|
|
72
|
+
|
|
73
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
ref: refs.setReference,
|
|
75
|
+
onMouseEnter: handleMouseEnter,
|
|
76
|
+
onMouseLeave: handleMouseLeave,
|
|
77
|
+
onTouchStart: handleTouchStart,
|
|
78
|
+
className: _JSXStyle.dynamic([["2501444323", [theme.palette.accents_7, duration, duration, duration]]]) + " " + "tooltip-reference"
|
|
79
|
+
}, children), show && x != null && y != null ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
|
|
80
|
+
ref: refs.setFloating,
|
|
81
|
+
style: {
|
|
82
|
+
position: strategy,
|
|
83
|
+
top: y !== null && y !== void 0 ? y : 0,
|
|
84
|
+
left: x !== null && x !== void 0 ? x : 0,
|
|
85
|
+
zIndex: 9999,
|
|
86
|
+
// opacity: show ? 1 : 0,
|
|
87
|
+
// visibility: x == null || y == null ? 'hidden' : 'visible',
|
|
88
|
+
transitionProperty: 'opacity, transform',
|
|
89
|
+
transitionDuration: "".concat(duration, "ms")
|
|
90
|
+
},
|
|
91
|
+
className: _JSXStyle.dynamic([["2501444323", [theme.palette.accents_7, duration, duration, duration]]]) + " " + "tooltip-box ".concat(animation)
|
|
92
|
+
}, text), document.body) : null, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
93
|
+
id: "2501444323",
|
|
94
|
+
dynamic: [theme.palette.accents_7, duration, duration, duration]
|
|
95
|
+
}, ".tooltip-box.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_7, ";color:white;padding:4px 10px;border-radius:4px;font-size:12px;white-space:nowrap;z-index:9999;opacity:0;}.fade.__jsx-style-dynamic-selector{-webkit-animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes fadeIn-__jsx-style-dynamic-selector{from{opacity:0;}to{opacity:1;}}@keyframes fadeIn-__jsx-style-dynamic-selector{from{opacity:0;}to{opacity:1;}}.scale.__jsx-style-dynamic-selector{-webkit-animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}.slide.__jsx-style-dynamic-selector{-webkit-animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}@keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}")));
|
|
96
|
+
};
|
|
97
|
+
export default Tooltip;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import LinearProgress from "../LinearProgress";
|
|
3
|
+
var Loader = function Loader(_ref) {
|
|
4
|
+
var color = _ref.color;
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
className: "jsx-965707762" + " " + "loader-wrapper"
|
|
7
|
+
}, /*#__PURE__*/React.createElement(LinearProgress, {
|
|
8
|
+
color: color
|
|
9
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
10
|
+
id: "965707762"
|
|
11
|
+
}, ".loader-wrapper.jsx-965707762{position:fixed;top:0;left:0;z-index:2001;width:100%;}.loader-wrapper.jsx-965707762 * + *{margin-top:16px;}"));
|
|
12
|
+
};
|
|
13
|
+
export default Loader;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import React, { memo } from 'react';
|
|
2
3
|
import Button from './button';
|
|
3
|
-
|
|
4
|
-
// import { getButtonColors } from './styles';
|
|
5
|
-
|
|
6
|
-
// import useScale from 'components/use-scale';
|
|
7
|
-
|
|
4
|
+
import { useTheme } from '@helpdice/theme';
|
|
8
5
|
var CompactButton = function CompactButton(_ref) {
|
|
9
|
-
var
|
|
10
|
-
_color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
6
|
+
var _color = _ref.color,
|
|
11
7
|
_ref$to = _ref.to,
|
|
12
8
|
to = _ref$to === void 0 ? '/' : _ref$to,
|
|
13
9
|
children = _ref.children,
|
|
@@ -18,24 +14,16 @@ var CompactButton = function CompactButton(_ref) {
|
|
|
18
14
|
type = _ref.type,
|
|
19
15
|
style = _ref.style,
|
|
20
16
|
a = _ref.a,
|
|
21
|
-
target = _ref.target,
|
|
17
|
+
_ref$target = _ref.target,
|
|
18
|
+
target = _ref$target === void 0 ? "_self" : _ref$target,
|
|
22
19
|
onClick = _ref.onClick;
|
|
23
|
-
|
|
24
|
-
// const { SCALES } = useScale();
|
|
25
|
-
// const [paddingLeft, paddingRight] = [
|
|
26
|
-
// auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
27
|
-
// auto ? SCALES.pr(1.15) : SCALES.pr(1.375),
|
|
28
|
-
// ]
|
|
29
|
-
// const { bg, border, color } = useMemo(
|
|
30
|
-
// () => getButtonColors(theme.palette, {
|
|
31
|
-
// color: _color
|
|
32
|
-
// }),
|
|
33
|
-
// [theme.palette],
|
|
34
|
-
// )
|
|
20
|
+
var theme = useTheme();
|
|
35
21
|
if (a) {
|
|
36
22
|
return /*#__PURE__*/React.createElement(Button, {
|
|
37
23
|
icon: icon,
|
|
38
|
-
style: style,
|
|
24
|
+
style: _extends({}, style, {
|
|
25
|
+
backgroundColor: theme.palette.background
|
|
26
|
+
}),
|
|
39
27
|
type: type,
|
|
40
28
|
onClick: function onClick() {
|
|
41
29
|
return window.open(to, target);
|
|
@@ -44,74 +32,13 @@ var CompactButton = function CompactButton(_ref) {
|
|
|
44
32
|
scale: scale,
|
|
45
33
|
px: 0.6,
|
|
46
34
|
iconRight: iconRight
|
|
47
|
-
}, children)
|
|
48
|
-
// <a
|
|
49
|
-
// style={
|
|
50
|
-
// {
|
|
51
|
-
// all: 'unset',
|
|
52
|
-
// boxSizing: 'border-box',
|
|
53
|
-
// display: 'inline-block',
|
|
54
|
-
// lineHeight: 'calc(2.5* 16px)',
|
|
55
|
-
// fontWeight: '400',
|
|
56
|
-
// fontSize: 'calc(0.875* 16px)',
|
|
57
|
-
// textAlign: 'center',
|
|
58
|
-
// whiteSpace: 'nowrap',
|
|
59
|
-
// position: 'relative',
|
|
60
|
-
// overflow: 'hidden',
|
|
61
|
-
// color: color,
|
|
62
|
-
// backgroundColor: bg,
|
|
63
|
-
// border: `1px solid ${border}`,
|
|
64
|
-
// cursor: 'pointer',
|
|
65
|
-
// '--helpdice-ui-button-icon-padding': `${SCALES.pl(0.727)}`,
|
|
66
|
-
// '--helpdice-ui-button-height': `${SCALES.height(2.5)}`,
|
|
67
|
-
// '--helpdice-ui-button-color':`${color}`,
|
|
68
|
-
// '--helpdice-ui-button-bg': `${bg}`,
|
|
69
|
-
// minWidth: `${auto ? 'min-content' : SCALES.width(10.5)}`,
|
|
70
|
-
// width: `${auto ? 'auto' : 'initial'}`,
|
|
71
|
-
// height: `${SCALES.height(2.5)}`,
|
|
72
|
-
// padding:` ${SCALES.pt(0)} ${paddingRight} ${SCALES.pb(0)} ${paddingLeft}`,
|
|
73
|
-
// margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`
|
|
74
|
-
// } as React.CSSProperties
|
|
75
|
-
// }
|
|
76
|
-
// href={to}
|
|
77
|
-
// target={target}
|
|
78
|
-
// >
|
|
79
|
-
// <span
|
|
80
|
-
// style={{
|
|
81
|
-
// position: 'absolute',
|
|
82
|
-
// right: 'auto',
|
|
83
|
-
// left: 'var(--helpdice-ui-button-icon-padding)',
|
|
84
|
-
// top: '50%',
|
|
85
|
-
// transform: 'translateY(-50%)',
|
|
86
|
-
// display: 'flex',
|
|
87
|
-
// justifyContent: 'center',
|
|
88
|
-
// alignItems: 'center',
|
|
89
|
-
// color: 'var(--helpdice-ui-button-color)',
|
|
90
|
-
// zIndex: 1
|
|
91
|
-
// }}
|
|
92
|
-
// >
|
|
93
|
-
// {icon}
|
|
94
|
-
// </span>
|
|
95
|
-
// <div
|
|
96
|
-
// style={{
|
|
97
|
-
// display: 'inline-flex',
|
|
98
|
-
// position: 'relative',
|
|
99
|
-
// zIndex: 1,
|
|
100
|
-
// justifyContent: 'center',
|
|
101
|
-
// alignItems: 'center',
|
|
102
|
-
// textAlign: 'center',
|
|
103
|
-
// lineHeight: 'inherit',
|
|
104
|
-
// paddingLeft: icon ? 'calc(var(--helpdice-ui-button-height) / 2 + var(--helpdice-ui-button-icon-padding)* .5)' : 0
|
|
105
|
-
// }}
|
|
106
|
-
// >
|
|
107
|
-
// {children}
|
|
108
|
-
// </div>
|
|
109
|
-
// </a>
|
|
110
|
-
;
|
|
35
|
+
}, children);
|
|
111
36
|
}
|
|
112
37
|
return /*#__PURE__*/React.createElement(Button, {
|
|
113
38
|
icon: icon,
|
|
114
|
-
style: style,
|
|
39
|
+
style: _extends({}, style, {
|
|
40
|
+
backgroundColor: theme.palette.background
|
|
41
|
+
}),
|
|
115
42
|
type: type,
|
|
116
43
|
onClick: onClick,
|
|
117
44
|
auto: true,
|
package/esm/index.d.ts
CHANGED
|
@@ -94,7 +94,9 @@ export type { HUIThemes, HUserTheme } from './themes';
|
|
|
94
94
|
export { default as Toggle } from './toggle';
|
|
95
95
|
export type { ToggleProps } from './toggle';
|
|
96
96
|
export { default as Tooltip } from './tooltip';
|
|
97
|
+
export { default as Notetip } from './ITooltip';
|
|
97
98
|
export type { TooltipProps } from './tooltip';
|
|
99
|
+
export type { NotetipProps } from './ITooltip';
|
|
98
100
|
export { default as Tree } from './tree';
|
|
99
101
|
export type { TreeProps } from './tree';
|
|
100
102
|
export { useTime, useTimer, useStopwatch } from './timer';
|
|
@@ -124,3 +126,5 @@ export { default as Swipe } from './swipe';
|
|
|
124
126
|
export type { SwipeProps } from './swipe';
|
|
125
127
|
export { Carousel } from './carousal';
|
|
126
128
|
export type { CarouselProps } from './carousal';
|
|
129
|
+
export { default as CurrencyInput } from './CurrencyInput';
|
|
130
|
+
export type { CurrencyInputProps, CurrencyInputOnChangeValues } from './CurrencyInput';
|
package/esm/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export { default as Textarea } from './textarea';
|
|
|
56
56
|
export { default as Themes } from './themes';
|
|
57
57
|
export { default as Toggle } from './toggle';
|
|
58
58
|
export { default as Tooltip } from './tooltip';
|
|
59
|
+
export { default as Notetip } from './ITooltip';
|
|
59
60
|
export { default as Tree } from './tree';
|
|
60
61
|
export { useTime, useTimer, useStopwatch } from './timer';
|
|
61
62
|
export { default as User } from './user';
|
|
@@ -83,4 +84,6 @@ export * from './login-with';
|
|
|
83
84
|
// Swipe
|
|
84
85
|
export { default as Swipe } from './swipe';
|
|
85
86
|
// Carousel
|
|
86
|
-
export { Carousel } from './carousal';
|
|
87
|
+
export { Carousel } from './carousal';
|
|
88
|
+
// Currency Input
|
|
89
|
+
export { default as CurrencyInput } from './CurrencyInput';
|