@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.
Files changed (113) hide show
  1. package/dist/CurrencyInput/components/CurrencyInput.d.ts +4 -0
  2. package/dist/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
  3. package/dist/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
  4. package/dist/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
  5. package/dist/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
  6. package/dist/CurrencyInput/components/utils/formatValue.d.ts +49 -0
  7. package/dist/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
  8. package/dist/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
  9. package/dist/CurrencyInput/components/utils/index.d.ts +8 -0
  10. package/dist/CurrencyInput/components/utils/isNumber.d.ts +1 -0
  11. package/dist/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
  12. package/dist/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
  13. package/dist/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
  14. package/dist/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
  15. package/dist/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
  16. package/dist/CurrencyInput/index.d.ts +5 -0
  17. package/dist/CurrencyInput/index.js +3 -2122
  18. package/dist/ITooltip/index.d.ts +13 -0
  19. package/dist/Loadable/index.js +29 -3
  20. package/dist/PhoneInput/index.js +21 -2140
  21. package/dist/Placeholder/index.js +5 -2124
  22. package/dist/auto-complete/index.js +73 -12092
  23. package/dist/avatar/index.js +15 -2134
  24. package/dist/badge/index.js +8 -2127
  25. package/dist/breadcrumbs/index.js +19 -2138
  26. package/dist/button/index.js +36 -2229
  27. package/dist/button-dropdown/index.js +28 -2147
  28. package/dist/button-group/index.js +9 -2128
  29. package/dist/capacity/index.js +10 -2129
  30. package/dist/card/index.js +46 -2165
  31. package/dist/carousal/index.js +644 -12666
  32. package/dist/checkbox/index.js +10 -2129
  33. package/dist/code/index.js +14 -2133
  34. package/dist/collapse/index.js +16 -2135
  35. package/dist/description/index.js +9 -2128
  36. package/dist/display/index.js +11 -2130
  37. package/dist/divider/index.js +12 -2131
  38. package/dist/dot/index.js +6 -2125
  39. package/dist/drawer/index.js +21 -2139
  40. package/dist/fieldset/index.js +22 -2141
  41. package/dist/grid/index.js +8 -2127
  42. package/dist/image/index.js +31 -2150
  43. package/dist/index.d.ts +4 -0
  44. package/dist/index.js +2065 -23539
  45. package/dist/input/index.js +42 -2158
  46. package/dist/keyboard/index.js +11 -2130
  47. package/dist/link/index.js +11 -2130
  48. package/dist/list/index.js +25 -2143
  49. package/dist/list/list-item.d.ts +1 -0
  50. package/dist/loading/index.js +14 -2133
  51. package/dist/menu/index.js +2 -10245
  52. package/dist/modal/index.js +59 -2177
  53. package/dist/note/index.js +10 -2129
  54. package/dist/page/index.js +6 -2125
  55. package/dist/pagination/index.js +11 -2130
  56. package/dist/popover/index.js +23 -2141
  57. package/dist/progress/index.js +10 -2129
  58. package/dist/radio/index.js +17 -2136
  59. package/dist/rating/index.js +7 -2126
  60. package/dist/row/index.js +5 -2124
  61. package/dist/select/index.js +54 -2173
  62. package/dist/slider/index.js +21 -2140
  63. package/dist/snippet/index.js +12 -2131
  64. package/dist/spacer/index.js +2 -2121
  65. package/dist/spinner/index.js +5 -2124
  66. package/dist/table/index.js +910 -12918
  67. package/dist/tabs/index.js +16 -2135
  68. package/dist/tag/index.js +5 -2124
  69. package/dist/text/index.js +5 -2124
  70. package/dist/textarea/index.js +10 -2129
  71. package/dist/toggle/index.js +14 -2133
  72. package/dist/tooltip/index.js +17 -2135
  73. package/dist/tree/index.js +39 -2158
  74. package/dist/use-input/index.js +2 -2122
  75. package/dist/use-modal/index.js +2 -2122
  76. package/dist/use-scale/index.js +2 -2121
  77. package/dist/use-tabs/index.js +2 -2122
  78. package/dist/user/index.js +31 -2150
  79. package/esm/CurrencyInput/components/CurrencyInput.d.ts +4 -0
  80. package/esm/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
  81. package/esm/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
  82. package/esm/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
  83. package/esm/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
  84. package/esm/CurrencyInput/components/utils/formatValue.d.ts +49 -0
  85. package/esm/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
  86. package/esm/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
  87. package/esm/CurrencyInput/components/utils/index.d.ts +8 -0
  88. package/esm/CurrencyInput/components/utils/isNumber.d.ts +1 -0
  89. package/esm/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
  90. package/esm/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
  91. package/esm/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
  92. package/esm/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
  93. package/esm/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
  94. package/esm/CurrencyInput/index.d.ts +5 -0
  95. package/esm/ITooltip/index.d.ts +13 -0
  96. package/esm/ITooltip/index.js +97 -0
  97. package/esm/Loadable/loader.js +13 -0
  98. package/esm/button/button.compact.js +13 -86
  99. package/esm/index.d.ts +4 -0
  100. package/esm/index.js +4 -1
  101. package/esm/input/input.js +13 -10
  102. package/esm/link/link.js +3 -3
  103. package/esm/list/list-item.d.ts +1 -0
  104. package/esm/list/list-item.js +4 -2
  105. package/esm/login-with/LoginSocialAmazon/index.js +1 -1
  106. package/esm/login-with/LoginSocialApple/index.js +1 -1
  107. package/esm/login-with/LoginSocialFacebook/index.js +1 -1
  108. package/esm/login-with/LoginSocialGoogle/index.js +1 -1
  109. package/esm/table/table-body.js +14 -4
  110. package/esm/table/table-cell.js +1 -1
  111. package/esm/table/table-head.js +13 -13
  112. package/esm/table/table.js +8 -8
  113. package/package.json +5 -5
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { CurrencyInputProps } from './CurrencyInputProps';
3
+ export declare const InputCurrency: FC<Omit<CurrencyInputProps, 'ref'>>;
4
+ export default InputCurrency;
@@ -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,6 @@
1
+ /**
2
+ * Escape regex char
3
+ *
4
+ * See: https://stackoverflow.com/questions/17885855/use-dynamic-variable-string-as-regex-pattern-in-javascript
5
+ */
6
+ export declare const escapeRegExp: (stringToGoIntoTheRegex: string) => 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,6 @@
1
+ type Options = {
2
+ decimalSeparator?: string;
3
+ groupSeparator?: string;
4
+ };
5
+ export declare const getSuffix: (value: string, { groupSeparator, decimalSeparator }: Options) => string | undefined;
6
+ 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,4 @@
1
+ /**
2
+ * Remove invalid characters
3
+ */
4
+ export declare const removeInvalidChars: (value: string, validChars: ReadonlyArray<string>) => string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Remove group separator from value eg. 1,000 > 1000
3
+ */
4
+ export declare const removeSeparators: (value: string, separator?: string) => string;
@@ -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;