@adaptabletools/adaptable 24.0.0-canary.6 → 24.0.0-canary.8
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/index.css +36 -173
- package/package.json +1 -1
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +6 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +83 -4
- package/src/AdaptableState/StyledColumns/GradientStyle.d.ts +4 -0
- package/src/Api/Implementation/QuickSearchApiImpl.js +2 -2
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +0 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.js +9 -15
- package/src/Api/Internal/AdaptableInternalApi.js +5 -3
- package/src/Api/Internal/StateInternalApi.js +4 -3
- package/src/Api/UserInterfaceApi.d.ts +0 -4
- package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +9 -0
- package/src/Redux/ActionsReducers/QuickSearchRedux.js +9 -0
- package/src/Redux/Store/AdaptableStore.js +4 -2
- package/src/Utilities/Helpers/UIHelper.d.ts +6 -11
- package/src/Utilities/Helpers/UIHelper.js +6 -33
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +9 -11
- package/src/View/Components/StyleComponent.js +2 -2
- package/src/View/Dashboard/Dashboard.d.ts +1 -1
- package/src/View/Dashboard/Dashboard.js +1 -1
- package/src/View/Filter/ColumnFilter/ColumnFilterNew.js +14 -9
- package/src/View/QuickSearch/QuickSearchInput.js +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.d.ts +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
- package/src/View/QuickSearch/Utilities/useQuickSearchDebounced.d.ts +2 -2
- package/src/View/StyledColumn/RangesComponent.js +8 -11
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +0 -2
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +2 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +0 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +3 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +7 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +4 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +7 -7
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +4 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +3 -3
- package/src/components/ColorField/index.d.ts +13 -0
- package/src/components/ColorField/index.js +26 -0
- package/src/components/aql/QueryBuilder/GroupEditor.js +1 -1
- package/src/components/aql/QueryBuilder/QueryBuilder.d.ts +5 -0
- package/src/components/aql/QueryBuilder/QueryBuilder.js +1 -1
- package/src/components/aql/QueryBuilder/context.d.ts +7 -0
- package/src/components/aql/QueryBuilder/context.js +3 -1
- package/src/env.js +2 -2
- package/src/migration/VersionUpgrade24.d.ts +9 -0
- package/src/migration/VersionUpgrade24.js +27 -0
- package/src/setupDevTools.js +163 -9
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/vendor/components/ColorField/index.d.ts +53 -0
- package/vendor/components/ColorField/index.d.ts.map +1 -0
- package/vendor/components/ColorField/index.js +80 -0
- package/vendor/components/ColorField/index.js.map +1 -0
- package/vendor/components/ColorPicker/colorPickerTab.d.ts +2 -2
- package/vendor/components/ColorPicker/colorPickerTab.d.ts.map +1 -1
- package/vendor/components/ColorPicker/colorPickerTab.js +6 -28
- package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -1
- package/vendor/components/ColorPicker/index.d.ts +76 -9
- package/vendor/components/ColorPicker/index.d.ts.map +1 -1
- package/vendor/components/ColorPicker/index.js +217 -27
- package/vendor/components/ColorPicker/index.js.map +1 -1
- package/vendor/components/ColorPicker/themeColors.d.ts +74 -4
- package/vendor/components/ColorPicker/themeColors.d.ts.map +1 -1
- package/vendor/components/ColorPicker/themeColors.js +206 -18
- package/vendor/components/ColorPicker/themeColors.js.map +1 -1
- package/vendor/components/NumberInput/index.d.ts +51 -0
- package/vendor/components/NumberInput/index.d.ts.map +1 -0
- package/vendor/components/NumberInput/index.js +82 -0
- package/vendor/components/NumberInput/index.js.map +1 -0
- package/vendor/components/index.css +73 -24
- package/vendor/components/index.d.ts +6 -2
- package/vendor/components/index.d.ts.map +1 -1
- package/vendor/components/index.js +3 -1
- package/vendor/components/index.js.map +1 -1
- package/vendor/components/ui/input-group.d.ts.map +1 -1
- package/vendor/components/ui/input-group.js +5 -4
- package/vendor/components/ui/input-group.js.map +1 -1
- package/src/components/ColorPicker/ColorPicker.d.ts +0 -12
- package/src/components/ColorPicker/ColorPicker.js +0 -48
- package/src/components/ColorPicker/OptionalColorPicker.d.ts +0 -12
- package/src/components/ColorPicker/OptionalColorPicker.js +0 -13
- package/src/components/ColorPicker/index.d.ts +0 -2
- package/src/components/ColorPicker/index.js +0 -2
|
@@ -25,28 +25,216 @@ const SEMANTIC_COLORS = [
|
|
|
25
25
|
themeColor('muted', 'Muted'),
|
|
26
26
|
themeColor('muted-foreground', 'Muted text'),
|
|
27
27
|
];
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
28
|
+
export const THEME_COLOR_GROUP = {
|
|
29
|
+
id: 'theme',
|
|
30
|
+
label: 'Theme',
|
|
31
|
+
colors: SEMANTIC_COLORS,
|
|
32
|
+
};
|
|
33
|
+
const LABEL_BY_VALUE = new Map(SEMANTIC_COLORS.map((c) => [c.value, c.label]));
|
|
34
|
+
const PALETTE_VALUE = /^var\(--ab-color-palette-(\d+)\)$/;
|
|
35
|
+
const TOKEN_VALUE = /^var\(--ab-color-([a-z0-9]+(?:-[a-z0-9]+)*)\)$/;
|
|
36
|
+
/** `quick-search-match-foreground` → "Quick search match text". */
|
|
37
|
+
function tokenLabel(token) {
|
|
38
|
+
const words = token.split('-').map((word) => (word === 'foreground' ? 'text' : word));
|
|
39
|
+
const label = words.join(' ');
|
|
40
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
41
|
+
}
|
|
42
|
+
const paletteColor = (index) => themeColor(`palette-${index}`, `Palette ${index}`);
|
|
36
43
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
44
|
+
* One swatch per resolved colour. `keyOf` is the computed hex (or `undefined`
|
|
45
|
+
* when it cannot be resolved, in which case the stored value is the key).
|
|
46
|
+
* The first colour wins, so theme colours stay ahead of a palette colour that
|
|
47
|
+
* paints the same.
|
|
48
|
+
*/
|
|
49
|
+
export function uniqueColorsByKey(colors, keyOf) {
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const unique = [];
|
|
52
|
+
for (const color of colors) {
|
|
53
|
+
const key = keyOf(color) ?? color.value;
|
|
54
|
+
if (seen.has(key)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
seen.add(key);
|
|
58
|
+
unique.push(color);
|
|
59
|
+
}
|
|
60
|
+
return unique;
|
|
61
|
+
}
|
|
62
|
+
/** Below this saturation a colour is a grey and sorts with white and black. */
|
|
63
|
+
const NEUTRAL_SATURATION = 0.12;
|
|
64
|
+
/** Hue 345° (red, just past magenta) starts the wheel so reds stay together. */
|
|
65
|
+
const RED_ORIGIN = 345;
|
|
66
|
+
const HEX_BYTES = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i;
|
|
67
|
+
function hexToHsl(hex) {
|
|
68
|
+
const match = HEX_BYTES.exec(hex);
|
|
69
|
+
if (!match) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
const r = Number.parseInt(match[1], 16) / 255;
|
|
73
|
+
const g = Number.parseInt(match[2], 16) / 255;
|
|
74
|
+
const b = Number.parseInt(match[3], 16) / 255;
|
|
75
|
+
const max = Math.max(r, g, b);
|
|
76
|
+
const min = Math.min(r, g, b);
|
|
77
|
+
const l = (max + min) / 2;
|
|
78
|
+
const d = max - min;
|
|
79
|
+
if (d === 0) {
|
|
80
|
+
return { h: 0, s: 0, l };
|
|
81
|
+
}
|
|
82
|
+
const s = d / (1 - Math.abs(2 * l - 1));
|
|
83
|
+
const h = max === r
|
|
84
|
+
? ((g - b) / d) % 6
|
|
85
|
+
: max === g
|
|
86
|
+
? (b - r) / d + 2
|
|
87
|
+
: (r - g) / d + 4;
|
|
88
|
+
return { h: (h * 60 + 360) % 360, s, l };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Colour-wheel order. Hex order follows the red channel, so it splits blues
|
|
92
|
+
* and reds apart. Here each 30° of hue is a family (reds, then oranges,
|
|
93
|
+
* yellows, greens, cyans, blues, purples), light shades before dark ones.
|
|
94
|
+
* Greys, white and black come after the wheel, light to dark. An unresolvable
|
|
95
|
+
* colour stays at the end, in its original order.
|
|
96
|
+
*/
|
|
97
|
+
export function sortColorsByHex(colors, hexOf) {
|
|
98
|
+
const ranked = colors.map((color, index) => ({
|
|
99
|
+
color,
|
|
100
|
+
index,
|
|
101
|
+
hsl: hexToHsl(hexOf(color) ?? ''),
|
|
102
|
+
}));
|
|
103
|
+
ranked.sort((a, b) => compareColorOrder(a.hsl, b.hsl) || a.index - b.index);
|
|
104
|
+
return ranked.map((item) => item.color);
|
|
105
|
+
}
|
|
106
|
+
function compareColorOrder(a, b) {
|
|
107
|
+
if (!a || !b) {
|
|
108
|
+
return a ? -1 : b ? 1 : 0;
|
|
109
|
+
}
|
|
110
|
+
const aNeutral = a.s < NEUTRAL_SATURATION;
|
|
111
|
+
const bNeutral = b.s < NEUTRAL_SATURATION;
|
|
112
|
+
if (aNeutral !== bNeutral) {
|
|
113
|
+
return aNeutral ? 1 : -1;
|
|
114
|
+
}
|
|
115
|
+
if (!aNeutral) {
|
|
116
|
+
const bucket = (hsl) => Math.floor((((hsl.h + 360 - RED_ORIGIN) % 360) / 360) * 12);
|
|
117
|
+
const byBucket = bucket(a) - bucket(b);
|
|
118
|
+
if (byBucket !== 0) {
|
|
119
|
+
return byBucket;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return b.l - a.l;
|
|
123
|
+
}
|
|
124
|
+
/** Stops the palette probe on a theme that defines palette vars without a gap. */
|
|
125
|
+
const MAX_PALETTE_SIZE = 256;
|
|
126
|
+
export const PALETTE_COUNT_VAR = '--ab-cmp-color-picker__palette-count';
|
|
127
|
+
export const ALLOWED_COLORS_VAR = '--ab-cmp-color-picker__allowed-colors';
|
|
128
|
+
export const TABS_VAR = '--ab-cmp-color-picker__tabs';
|
|
129
|
+
const TAB_BY_NAME = {
|
|
130
|
+
Custom: 'precise',
|
|
131
|
+
Palette: 'colors',
|
|
132
|
+
};
|
|
133
|
+
const DEFAULT_TABS = ['precise', 'colors'];
|
|
134
|
+
const TAB_IDS = new Map([
|
|
135
|
+
['precise', 'precise'],
|
|
136
|
+
['colors', 'colors'],
|
|
137
|
+
['colours', 'colors'],
|
|
138
|
+
]);
|
|
139
|
+
/**
|
|
140
|
+
* The palette colours in effect on `element`: `--ab-color-palette-1` upwards
|
|
141
|
+
* until one is not defined, capped by `--ab-cmp-color-picker__palette-count`
|
|
142
|
+
* when that is a positive integer.
|
|
143
|
+
*/
|
|
144
|
+
export function readPaletteColors(element) {
|
|
145
|
+
const style = getComputedStyle(element);
|
|
146
|
+
const count = Number.parseInt(style.getPropertyValue(PALETTE_COUNT_VAR).trim(), 10);
|
|
147
|
+
return paletteColorsUpTo(style, count > 0 ? Math.min(count, MAX_PALETTE_SIZE) : MAX_PALETTE_SIZE);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Every palette colour in effect on `element`, ignoring
|
|
151
|
+
* `--ab-cmp-color-picker__palette-count`.
|
|
39
152
|
*/
|
|
40
|
-
export function
|
|
41
|
-
|
|
42
|
-
|
|
153
|
+
export function readAllPaletteColors(element) {
|
|
154
|
+
return paletteColorsUpTo(getComputedStyle(element), MAX_PALETTE_SIZE);
|
|
155
|
+
}
|
|
156
|
+
function paletteColorsUpTo(style, max) {
|
|
157
|
+
const colors = [];
|
|
158
|
+
for (let index = 1; index <= max; index++) {
|
|
159
|
+
if (!style.getPropertyValue(`--ab-color-palette-${index}`).trim()) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
colors.push(paletteColor(index));
|
|
163
|
+
}
|
|
164
|
+
return colors;
|
|
165
|
+
}
|
|
166
|
+
/** `--ab-cmp-color-picker__allowed-colors` on `element`; `any` when unset or unrecognised. */
|
|
167
|
+
export function readAllowedColors(element) {
|
|
168
|
+
const value = getComputedStyle(element).getPropertyValue(ALLOWED_COLORS_VAR).trim();
|
|
169
|
+
return value === 'predefined' || value === 'palette' ? value : 'any';
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* `--ab-cmp-color-picker__tabs` on `element`: the tabs to show, in order, the
|
|
173
|
+
* first being the default (e.g. `colors precise`; `colours` is also
|
|
174
|
+
* accepted). Unknown and repeated ids are dropped; `precise colors` when
|
|
175
|
+
* nothing valid is left.
|
|
176
|
+
*/
|
|
177
|
+
export function readTabs(element) {
|
|
178
|
+
return parseTabs(getComputedStyle(element).getPropertyValue(TABS_VAR));
|
|
179
|
+
}
|
|
180
|
+
/** A `--ab-cmp-color-picker__tabs` value as tab ids; see `readTabs`. */
|
|
181
|
+
export function parseTabs(value) {
|
|
182
|
+
const ids = value.trim().toLowerCase().split(/[\s,]+/).map((id) => TAB_IDS.get(id));
|
|
183
|
+
const tabs = [...new Set(ids.filter((id) => id !== undefined))];
|
|
184
|
+
return tabs.length ? tabs : DEFAULT_TABS;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The tabs to show, in the order given. `Custom` is the free picker; `Palette`
|
|
188
|
+
* is the swatches. Unknown and repeated names are dropped. `Custom` then
|
|
189
|
+
* `Palette` when nothing valid is left, including when `tabs` is omitted.
|
|
190
|
+
*/
|
|
191
|
+
export function normalizeColorPickerTabs(tabs) {
|
|
192
|
+
const next = [];
|
|
193
|
+
for (const name of tabs ?? ['Custom', 'Palette']) {
|
|
194
|
+
const tab = TAB_BY_NAME[name];
|
|
195
|
+
if (tab && !next.includes(tab)) {
|
|
196
|
+
next.push(tab);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return next.length ? next : DEFAULT_TABS;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The returned colours that belong to `source`, in the returned order.
|
|
203
|
+
* Anything whose `value` is not in `source` is dropped, and so is a repeat.
|
|
204
|
+
*/
|
|
205
|
+
export function coloursKeptFromSource(returned, source) {
|
|
206
|
+
if (!returned) {
|
|
207
|
+
return [];
|
|
43
208
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
209
|
+
const byValue = new Map(source.map((color) => [color.value, color]));
|
|
210
|
+
const seen = new Set();
|
|
211
|
+
const next = [];
|
|
212
|
+
for (const color of returned) {
|
|
213
|
+
const known = byValue.get(color?.value);
|
|
214
|
+
if (!known || seen.has(known.value)) {
|
|
215
|
+
continue;
|
|
48
216
|
}
|
|
217
|
+
seen.add(known.value);
|
|
218
|
+
next.push(known);
|
|
219
|
+
}
|
|
220
|
+
return next;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The picker's name for a stored colour: the token label for a theme colour
|
|
224
|
+
* (`var(--ab-color-success)` → "Success", `var(--ab-color-palette-3)` →
|
|
225
|
+
* "Palette 3"), a name derived from any other `--ab-color-*` token
|
|
226
|
+
* (`var(--ab-color-badge-foreground)` → "Badge text"), the value itself otherwise.
|
|
227
|
+
*/
|
|
228
|
+
export function describeColor(value) {
|
|
229
|
+
const palette = PALETTE_VALUE.exec(value);
|
|
230
|
+
if (palette) {
|
|
231
|
+
return `Palette ${palette[1]}`;
|
|
232
|
+
}
|
|
233
|
+
const label = LABEL_BY_VALUE.get(value);
|
|
234
|
+
if (label) {
|
|
235
|
+
return label;
|
|
49
236
|
}
|
|
50
|
-
|
|
237
|
+
const token = TOKEN_VALUE.exec(value);
|
|
238
|
+
return token ? tokenLabel(token[1]) : value;
|
|
51
239
|
}
|
|
52
240
|
//# sourceMappingURL=themeColors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeColors.js","sourceRoot":"","sources":["../../src/ColorPicker/themeColors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"themeColors.js","sourceRoot":"","sources":["../../src/ColorPicker/themeColors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuBH,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,KAAa,EAAc,EAAE,CAAC,CAAC;IAChE,KAAK,EAAE,kBAAkB,KAAK,GAAG;IACjC,KAAK;CACN,CAAC,CAAC;AAEH,MAAM,eAAe,GAAiB;IACpC,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC9B,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC;IAChC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC;IAC7B,UAAU,CAAC,aAAa,EAAE,aAAa,CAAC;IACxC,UAAU,CAAC,wBAAwB,EAAE,kBAAkB,CAAC;IACxD,UAAU,CAAC,aAAa,EAAE,aAAa,CAAC;IACxC,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC;IAC1C,UAAU,CAAC,eAAe,EAAE,eAAe,CAAC;IAC5C,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC;IAC1C,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC;IAChC,UAAU,CAAC,oBAAoB,EAAE,cAAc,CAAC;IAChD,UAAU,CAAC,YAAY,EAAE,YAAY,CAAC;IACtC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC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C,CAAC,EAAE,CAAC;IACjC,CAAC;IACD,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type NumberInputProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'value' | 'defaultValue' | 'onChange' | 'type' | 'min' | 'max' | 'step'> & {
|
|
3
|
+
/** Controlled value; `undefined` is empty. Leave out `value` entirely for uncontrolled mode. */
|
|
4
|
+
value?: number | undefined;
|
|
5
|
+
/** Initial value in uncontrolled mode. */
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Called with every valid value: typed (once it parses and is in range),
|
|
9
|
+
* stepped, or clamped on blur. `undefined` when cleared (see `clearable`).
|
|
10
|
+
*/
|
|
11
|
+
onValueChange?: (value: number | undefined) => void;
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
/** Default `1`; Shift + Arrow steps ten times as far. */
|
|
15
|
+
step?: number;
|
|
16
|
+
/** Whether the field can be left empty; default `true`. */
|
|
17
|
+
clearable?: boolean;
|
|
18
|
+
/** Applied to the `InputGroup` wrapper — the input itself takes `inputClassName`. */
|
|
19
|
+
className?: string;
|
|
20
|
+
inputClassName?: string;
|
|
21
|
+
'data-name'?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A numeric input with − / + buttons on either side instead of the browser's
|
|
25
|
+
* spinner arrows. The text can be mid-edit (empty, `-`, `1.`) without
|
|
26
|
+
* reporting; out-of-range numbers are clamped to `min` / `max` on blur.
|
|
27
|
+
* Supports controlled (`value` + `onValueChange`) and uncontrolled
|
|
28
|
+
* (`defaultValue`) modes.
|
|
29
|
+
*/
|
|
30
|
+
export declare const NumberInput: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "value" | "max" | "min" | "step" | "type" | "defaultValue"> & {
|
|
31
|
+
/** Controlled value; `undefined` is empty. Leave out `value` entirely for uncontrolled mode. */
|
|
32
|
+
value?: number | undefined;
|
|
33
|
+
/** Initial value in uncontrolled mode. */
|
|
34
|
+
defaultValue?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Called with every valid value: typed (once it parses and is in range),
|
|
37
|
+
* stepped, or clamped on blur. `undefined` when cleared (see `clearable`).
|
|
38
|
+
*/
|
|
39
|
+
onValueChange?: (value: number | undefined) => void;
|
|
40
|
+
min?: number;
|
|
41
|
+
max?: number;
|
|
42
|
+
/** Default `1`; Shift + Arrow steps ten times as far. */
|
|
43
|
+
step?: number;
|
|
44
|
+
/** Whether the field can be left empty; default `true`. */
|
|
45
|
+
clearable?: boolean;
|
|
46
|
+
/** Applied to the `InputGroup` wrapper — the input itself takes `inputClassName`. */
|
|
47
|
+
className?: string;
|
|
48
|
+
inputClassName?: string;
|
|
49
|
+
'data-name'?: string;
|
|
50
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/NumberInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EACvC,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CACxE,GAAG;IACF,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AASF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;IAnCtB,gGAAgG;YACxF,MAAM,GAAG,SAAS;IAC1B,0CAA0C;mBAC3B,MAAM;IACrB;;;OAGG;oBACa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;UAC7C,MAAM;UACN,MAAM;IACZ,yDAAyD;WAClD,MAAM;IACb,2DAA2D;gBAC/C,OAAO;IACnB,qFAAqF;gBACzE,MAAM;qBACD,MAAM;kBACT,MAAM;0CAqJrB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { MinusIcon, PlusIcon } from 'lucide-react';
|
|
4
|
+
import { cn } from '../lib/utils';
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from '../ui/input-group';
|
|
6
|
+
const decimalsOf = (n) => (String(n).split('.')[1] ?? '').length;
|
|
7
|
+
/** A number at the precision of `step`, so 0.1 + 0.2 shows as 0.3. */
|
|
8
|
+
const roundTo = (n, step) => Number(n.toFixed(decimalsOf(step)));
|
|
9
|
+
const format = (n) => (n === undefined ? '' : String(n));
|
|
10
|
+
/**
|
|
11
|
+
* A numeric input with − / + buttons on either side instead of the browser's
|
|
12
|
+
* spinner arrows. The text can be mid-edit (empty, `-`, `1.`) without
|
|
13
|
+
* reporting; out-of-range numbers are clamped to `min` / `max` on blur.
|
|
14
|
+
* Supports controlled (`value` + `onValueChange`) and uncontrolled
|
|
15
|
+
* (`defaultValue`) modes.
|
|
16
|
+
*/
|
|
17
|
+
export const NumberInput = React.forwardRef(function NumberInput(props, ref) {
|
|
18
|
+
const { value: controlledValue, defaultValue, onValueChange, min = -Infinity, max = Infinity, step = 1, clearable = true, disabled, className, inputClassName, onBlur, onKeyDown, 'data-name': dataName, ...inputProps } = props;
|
|
19
|
+
// `value={undefined}` is a controlled empty field, not uncontrolled mode
|
|
20
|
+
const isControlled = 'value' in props;
|
|
21
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
22
|
+
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
23
|
+
// the text while editing; `null` shows the value
|
|
24
|
+
const [draft, setDraft] = React.useState(null);
|
|
25
|
+
const clamp = (n) => Math.min(max, Math.max(min, n));
|
|
26
|
+
const commit = (next) => {
|
|
27
|
+
if (!isControlled) {
|
|
28
|
+
setUncontrolledValue(next);
|
|
29
|
+
}
|
|
30
|
+
if (next !== value) {
|
|
31
|
+
onValueChange?.(next);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const stepBy = (direction, multiplier = 1) => {
|
|
35
|
+
const start = value ?? (Number.isFinite(min) ? min : 0);
|
|
36
|
+
const next = value === undefined ? start : roundTo(start + direction * step * multiplier, step);
|
|
37
|
+
setDraft(null);
|
|
38
|
+
commit(clamp(next));
|
|
39
|
+
};
|
|
40
|
+
const handleChange = (text) => {
|
|
41
|
+
setDraft(text);
|
|
42
|
+
if (text.trim() === '') {
|
|
43
|
+
if (clearable)
|
|
44
|
+
commit(undefined);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const n = Number(text);
|
|
48
|
+
if (Number.isFinite(n) && n >= min && n <= max) {
|
|
49
|
+
commit(n);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const handleBlur = () => {
|
|
53
|
+
if (draft === null)
|
|
54
|
+
return;
|
|
55
|
+
const n = Number(draft);
|
|
56
|
+
if (draft.trim() === '') {
|
|
57
|
+
commit(clearable ? undefined : value);
|
|
58
|
+
}
|
|
59
|
+
else if (Number.isFinite(n)) {
|
|
60
|
+
commit(clamp(n));
|
|
61
|
+
}
|
|
62
|
+
setDraft(null);
|
|
63
|
+
};
|
|
64
|
+
const canDecrement = !disabled && (value === undefined || value > min);
|
|
65
|
+
const canIncrement = !disabled && (value === undefined || value < max);
|
|
66
|
+
return (_jsxs(InputGroup, { className: cn('twa:w-32', className), "data-disabled": disabled ? true : undefined, "data-name": dataName, children: [_jsx(InputGroupAddon, { children: _jsx(InputGroupButton, { tabIndex: -1, "aria-label": "Decrease", disabled: !canDecrement, onClick: () => stepBy(-1), "data-name": dataName ? `${dataName}-decrement` : undefined, children: _jsx(MinusIcon, {}) }) }), _jsx(InputGroupInput, { ref: ref, type: "text", inputMode: "decimal", role: "spinbutton", autoComplete: "off", "aria-valuenow": value, "aria-valuemin": Number.isFinite(min) ? min : undefined, "aria-valuemax": Number.isFinite(max) ? max : undefined, disabled: disabled, value: draft ?? format(value), onChange: (event) => handleChange(event.target.value), onBlur: (event) => {
|
|
67
|
+
handleBlur();
|
|
68
|
+
onBlur?.(event);
|
|
69
|
+
}, onKeyDown: (event) => {
|
|
70
|
+
onKeyDown?.(event);
|
|
71
|
+
if (event.defaultPrevented)
|
|
72
|
+
return;
|
|
73
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
stepBy(event.key === 'ArrowUp' ? 1 : -1, event.shiftKey ? 10 : 1);
|
|
76
|
+
}
|
|
77
|
+
else if (event.key === 'Enter') {
|
|
78
|
+
handleBlur();
|
|
79
|
+
}
|
|
80
|
+
}, className: cn('twa:px-0 twa:text-center twa:tabular-nums', inputClassName), "data-name": dataName ? `${dataName}-input` : undefined, ...inputProps }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { tabIndex: -1, "aria-label": "Increase", disabled: !canIncrement, onClick: () => stepBy(1), "data-name": dataName ? `${dataName}-increment` : undefined, children: _jsx(PlusIcon, {}) }) })] }));
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/NumberInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AA2B3B,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;AAEzE,sEAAsE;AACtE,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEjF,MAAM,MAAM,GAAG,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM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269
269
|
field-sizing: content;
|
|
270
270
|
}
|
|
271
|
+
.twa\:aspect-auto {
|
|
272
|
+
aspect-ratio: auto;
|
|
273
|
+
}
|
|
271
274
|
.twa\:aspect-square {
|
|
272
275
|
aspect-ratio: 1 / 1;
|
|
273
276
|
}
|
|
@@ -315,10 +318,6 @@
|
|
|
315
318
|
width: calc(var(--ab-base-space) * 16);
|
|
316
319
|
height: calc(var(--ab-base-space) * 16);
|
|
317
320
|
}
|
|
318
|
-
.twa\:size-\[calc\(100\%-2\*var\(--ab-base-space\)\)\] {
|
|
319
|
-
width: calc(100% - 2 * var(--ab-base-space));
|
|
320
|
-
height: calc(100% - 2 * var(--ab-base-space));
|
|
321
|
-
}
|
|
322
321
|
.twa\:size-auto {
|
|
323
322
|
width: auto;
|
|
324
323
|
height: auto;
|
|
@@ -353,6 +352,9 @@
|
|
|
353
352
|
.twa\:h-\[calc\(100\%-1px\)\] {
|
|
354
353
|
height: calc(100% - 1px);
|
|
355
354
|
}
|
|
355
|
+
.twa\:h-\[calc\(100\%-2\*var\(--ab-base-space\)\)\] {
|
|
356
|
+
height: calc(100% - 2 * var(--ab-base-space));
|
|
357
|
+
}
|
|
356
358
|
.twa\:h-\[min\(22rem\,var\(--total-size\)\)\] {
|
|
357
359
|
height: min(22rem, var(--total-size));
|
|
358
360
|
}
|
|
@@ -410,6 +412,12 @@
|
|
|
410
412
|
.twa\:w-1 {
|
|
411
413
|
width: var(--ab-base-space);
|
|
412
414
|
}
|
|
415
|
+
.twa\:w-12 {
|
|
416
|
+
width: calc(var(--ab-base-space) * 12);
|
|
417
|
+
}
|
|
418
|
+
.twa\:w-32 {
|
|
419
|
+
width: calc(var(--ab-base-space) * 32);
|
|
420
|
+
}
|
|
413
421
|
.twa\:w-72 {
|
|
414
422
|
width: calc(var(--ab-base-space) * 72);
|
|
415
423
|
}
|
|
@@ -419,6 +427,9 @@
|
|
|
419
427
|
.twa\:w-\[1rem\] {
|
|
420
428
|
width: 1rem;
|
|
421
429
|
}
|
|
430
|
+
.twa\:w-\[300px\] {
|
|
431
|
+
width: 300px;
|
|
432
|
+
}
|
|
422
433
|
.twa\:w-auto {
|
|
423
434
|
width: auto;
|
|
424
435
|
}
|
|
@@ -434,6 +445,9 @@
|
|
|
434
445
|
.twa\:w-px {
|
|
435
446
|
width: 1px;
|
|
436
447
|
}
|
|
448
|
+
.twa\:max-w-28 {
|
|
449
|
+
max-width: calc(var(--ab-base-space) * 28);
|
|
450
|
+
}
|
|
437
451
|
.twa\:max-w-80 {
|
|
438
452
|
max-width: calc(var(--ab-base-space) * 80);
|
|
439
453
|
}
|
|
@@ -819,6 +833,12 @@
|
|
|
819
833
|
.twa\:px-\(--cell-size\) {
|
|
820
834
|
padding-inline: var(--cell-size);
|
|
821
835
|
}
|
|
836
|
+
.twa\:px-0 {
|
|
837
|
+
padding-inline: 0px;
|
|
838
|
+
}
|
|
839
|
+
.twa\:px-0\.5 {
|
|
840
|
+
padding-inline: calc(var(--ab-base-space) * 0.5);
|
|
841
|
+
}
|
|
822
842
|
.twa\:px-1\.5 {
|
|
823
843
|
padding-inline: calc(var(--ab-base-space) * 1.5);
|
|
824
844
|
}
|
|
@@ -959,6 +979,10 @@
|
|
|
959
979
|
.twa\:text-white {
|
|
960
980
|
color: var(--twa-color-white);
|
|
961
981
|
}
|
|
982
|
+
.twa\:tabular-nums {
|
|
983
|
+
--tw-numeric-spacing: tabular-nums;
|
|
984
|
+
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
|
985
|
+
}
|
|
962
986
|
.twa\:underline-offset-4 {
|
|
963
987
|
text-underline-offset: 4px;
|
|
964
988
|
}
|
|
@@ -2654,26 +2678,26 @@
|
|
|
2654
2678
|
--ab-color-palette-10: #4a5568;
|
|
2655
2679
|
--ab-color-palette-11: #f3e8ff;
|
|
2656
2680
|
--ab-color-palette-12: #553c9a;
|
|
2657
|
-
--ab-color-
|
|
2658
|
-
--ab-color-
|
|
2659
|
-
--ab-color-
|
|
2660
|
-
--ab-color-
|
|
2661
|
-
--ab-color-
|
|
2662
|
-
--ab-color-
|
|
2663
|
-
--ab-color-
|
|
2664
|
-
--ab-color-
|
|
2665
|
-
--ab-color-
|
|
2666
|
-
--ab-color-
|
|
2667
|
-
--ab-color-
|
|
2668
|
-
--ab-color-
|
|
2669
|
-
--ab-color-
|
|
2670
|
-
--ab-color-
|
|
2671
|
-
--ab-color-
|
|
2672
|
-
--ab-color-
|
|
2673
|
-
--ab-color-
|
|
2674
|
-
--ab-color-
|
|
2675
|
-
--ab-color-
|
|
2676
|
-
--ab-color-
|
|
2681
|
+
--ab-color-palette-13: #000000;
|
|
2682
|
+
--ab-color-palette-14: #ffffff;
|
|
2683
|
+
--ab-color-palette-15: #d3d3d3;
|
|
2684
|
+
--ab-color-palette-16: #808080;
|
|
2685
|
+
--ab-color-palette-17: #a52a2a;
|
|
2686
|
+
--ab-color-palette-18: #006400;
|
|
2687
|
+
--ab-color-palette-19: #008000;
|
|
2688
|
+
--ab-color-palette-20: #32cd32;
|
|
2689
|
+
--ab-color-palette-21: #ffff00;
|
|
2690
|
+
--ab-color-palette-22: #ffffe0;
|
|
2691
|
+
--ab-color-palette-23: #00008b;
|
|
2692
|
+
--ab-color-palette-24: #0000ff;
|
|
2693
|
+
--ab-color-palette-25: #87cefa;
|
|
2694
|
+
--ab-color-palette-26: #00ffff;
|
|
2695
|
+
--ab-color-palette-27: #ff00ff;
|
|
2696
|
+
--ab-color-palette-28: #800080;
|
|
2697
|
+
--ab-color-palette-29: #8b0000;
|
|
2698
|
+
--ab-color-palette-30: #ff0000;
|
|
2699
|
+
--ab-color-palette-31: #dc143c;
|
|
2700
|
+
--ab-color-palette-32: #ffa500;
|
|
2677
2701
|
--ab-icon-fill: currentColor;
|
|
2678
2702
|
--ab-custom-scrollbar-size: 8px;
|
|
2679
2703
|
--ab-color-custom-scrollbar-track: var(--ab-color-background);
|
|
@@ -2930,6 +2954,26 @@
|
|
|
2930
2954
|
syntax: "*";
|
|
2931
2955
|
inherits: false;
|
|
2932
2956
|
}
|
|
2957
|
+
@property --tw-ordinal {
|
|
2958
|
+
syntax: "*";
|
|
2959
|
+
inherits: false;
|
|
2960
|
+
}
|
|
2961
|
+
@property --tw-slashed-zero {
|
|
2962
|
+
syntax: "*";
|
|
2963
|
+
inherits: false;
|
|
2964
|
+
}
|
|
2965
|
+
@property --tw-numeric-figure {
|
|
2966
|
+
syntax: "*";
|
|
2967
|
+
inherits: false;
|
|
2968
|
+
}
|
|
2969
|
+
@property --tw-numeric-spacing {
|
|
2970
|
+
syntax: "*";
|
|
2971
|
+
inherits: false;
|
|
2972
|
+
}
|
|
2973
|
+
@property --tw-numeric-fraction {
|
|
2974
|
+
syntax: "*";
|
|
2975
|
+
inherits: false;
|
|
2976
|
+
}
|
|
2933
2977
|
@property --tw-shadow {
|
|
2934
2978
|
syntax: "*";
|
|
2935
2979
|
inherits: false;
|
|
@@ -3159,6 +3203,11 @@
|
|
|
3159
3203
|
--tw-leading: initial;
|
|
3160
3204
|
--tw-font-weight: initial;
|
|
3161
3205
|
--tw-tracking: initial;
|
|
3206
|
+
--tw-ordinal: initial;
|
|
3207
|
+
--tw-slashed-zero: initial;
|
|
3208
|
+
--tw-numeric-figure: initial;
|
|
3209
|
+
--tw-numeric-spacing: initial;
|
|
3210
|
+
--tw-numeric-fraction: initial;
|
|
3162
3211
|
--tw-shadow: 0 0 #0000;
|
|
3163
3212
|
--tw-shadow-color: initial;
|
|
3164
3213
|
--tw-shadow-alpha: 100%;
|
|
@@ -15,12 +15,16 @@ export { Resizable, ResizablePanel, ResizableHandle } from './Resizable';
|
|
|
15
15
|
export type { ResizableProps, ResizablePanelProps, ResizableHandleProps, PanelSizeValue, ResizableSizes, ResizableSizeInput, } from './Resizable';
|
|
16
16
|
export { SearchInput } from './SearchInput';
|
|
17
17
|
export type { SearchInputProps } from './SearchInput';
|
|
18
|
+
export { NumberInput } from './NumberInput';
|
|
19
|
+
export type { NumberInputProps } from './NumberInput';
|
|
18
20
|
export { Tooltip } from './Tooltip';
|
|
19
21
|
export type { TooltipProps } from './Tooltip';
|
|
20
22
|
export { Button } from './Button';
|
|
21
23
|
export type { ButtonProps } from './Button';
|
|
22
|
-
export { ColorPicker, CHECKERBOARD, HEX_COLOR, describeColor,
|
|
23
|
-
export type { ColorPickerProps, ColorPickerTab, ThemeColor, ThemeColorGroup, } from './ColorPicker';
|
|
24
|
+
export { ALLOWED_COLORS_VAR, ColorPicker, CHECKERBOARD, HEX_COLOR, describeColor, coloursKeptFromSource, normalizeColorPickerTabs, PALETTE_COUNT_VAR, parseTabs, readAllowedColors, readAllPaletteColors, readPaletteColors, readTabs, TABS_VAR, THEME_COLOR_GROUP, setColorPickerTab, useColorPickerTab, } from './ColorPicker';
|
|
25
|
+
export type { AllowedColors, ColorPickerColourLists, ColorPickerProps, ColorPickerTab, ColorPickerTabName, ThemeColor, ThemeColorGroup, } from './ColorPicker';
|
|
26
|
+
export { ColorField } from './ColorField';
|
|
27
|
+
export type { ColorFieldProps } from './ColorField';
|
|
24
28
|
export { DropdownButton, NewDropdownButton } from './DropdownButton';
|
|
25
29
|
export type { DropdownButtonItem, DropdownButtonProps, NewDropdownButtonItem, NewDropdownButtonProps, } from './DropdownButton';
|
|
26
30
|
export type { TreeListItem, NewTreeDropdownProps, GridFilterTreeDropdownProps, } from './Tree/TreeDropdown';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;A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Ac,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAI7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -8,11 +8,13 @@ export { SingleCombobox, MultiCombobox, GridFilterCombobox, GRID_FILTER_COMBBOX_
|
|
|
8
8
|
export { SingleSelect, MultiSelect } from './Select';
|
|
9
9
|
export { Resizable, ResizablePanel, ResizableHandle } from './Resizable';
|
|
10
10
|
export { SearchInput } from './SearchInput';
|
|
11
|
+
export { NumberInput } from './NumberInput';
|
|
11
12
|
export { Tooltip } from './Tooltip';
|
|
12
13
|
// Shadows the star export from ./ui/button below (explicit exports win):
|
|
13
14
|
// same Button, plus a `tooltip` prop.
|
|
14
15
|
export { Button } from './Button';
|
|
15
|
-
export { ColorPicker, CHECKERBOARD, HEX_COLOR, describeColor,
|
|
16
|
+
export { ALLOWED_COLORS_VAR, ColorPicker, CHECKERBOARD, HEX_COLOR, describeColor, coloursKeptFromSource, normalizeColorPickerTabs, PALETTE_COUNT_VAR, parseTabs, readAllowedColors, readAllPaletteColors, readPaletteColors, readTabs, TABS_VAR, THEME_COLOR_GROUP, setColorPickerTab, useColorPickerTab, } from './ColorPicker';
|
|
17
|
+
export { ColorField } from './ColorField';
|
|
16
18
|
export { DropdownButton, NewDropdownButton } from './DropdownButton';
|
|
17
19
|
export { toDisplayValueDefault, toDisplayValueFromOptionTree } from './Tree/treeUtils';
|
|
18
20
|
export * from './ui/alert-dialog';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,aAAa,CAA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