@baseline-ui/core 0.59.0 → 0.60.1
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/Acknowledgements.md +5840 -12848
- package/dist/index.d.ts +3402 -3277
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/dist/react-aria.d.ts +708 -0
- package/dist/react-stately.d.ts +319 -0
- package/package.json +7 -7
- package/sbom.json +1 -1
- package/dist/index.d.mts +0 -10076
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
type Selection = 'all' | Set<Key>;
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
type Key = string | number;
|
|
29
|
+
|
|
30
|
+
/** A list of supported color formats. */
|
|
31
|
+
type ColorFormat = 'hex' | 'hexa' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hsb' | 'hsba';
|
|
32
|
+
type ColorSpace = 'rgb' | 'hsl' | 'hsb';
|
|
33
|
+
/** A list of color channels. */
|
|
34
|
+
type ColorChannel = 'hue' | 'saturation' | 'brightness' | 'lightness' | 'red' | 'green' | 'blue' | 'alpha';
|
|
35
|
+
type ColorAxes = {
|
|
36
|
+
xChannel: ColorChannel;
|
|
37
|
+
yChannel: ColorChannel;
|
|
38
|
+
zChannel: ColorChannel;
|
|
39
|
+
};
|
|
40
|
+
interface ColorChannelRange {
|
|
41
|
+
/** The minimum value of the color channel. */
|
|
42
|
+
minValue: number;
|
|
43
|
+
/** The maximum value of the color channel. */
|
|
44
|
+
maxValue: number;
|
|
45
|
+
/** The step value of the color channel, used when incrementing and decrementing. */
|
|
46
|
+
step: number;
|
|
47
|
+
/** The page step value of the color channel, used when incrementing and decrementing. */
|
|
48
|
+
pageSize: number;
|
|
49
|
+
}
|
|
50
|
+
/** Represents a color value. */
|
|
51
|
+
interface Color {
|
|
52
|
+
/** Converts the color to the given color format, and returns a new Color object. */
|
|
53
|
+
toFormat(format: ColorFormat): Color;
|
|
54
|
+
/** Converts the color to a string in the given format. */
|
|
55
|
+
toString(format?: ColorFormat | 'css'): string;
|
|
56
|
+
/** Returns a duplicate of the color value. */
|
|
57
|
+
clone(): Color;
|
|
58
|
+
/** Converts the color to hex, and returns an integer representation. */
|
|
59
|
+
toHexInt(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the numeric value for a given channel.
|
|
62
|
+
* Throws an error if the channel is unsupported in the current color format.
|
|
63
|
+
*/
|
|
64
|
+
getChannelValue(channel: ColorChannel): number;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the numeric value for a given channel, and returns a new Color object.
|
|
67
|
+
* Throws an error if the channel is unsupported in the current color format.
|
|
68
|
+
*/
|
|
69
|
+
withChannelValue(channel: ColorChannel, value: number): Color;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the minimum, maximum, and step values for a given channel.
|
|
72
|
+
*/
|
|
73
|
+
getChannelRange(channel: ColorChannel): ColorChannelRange;
|
|
74
|
+
/**
|
|
75
|
+
* Returns a localized color channel name for a given channel and locale,
|
|
76
|
+
* for use in visual or accessibility labels.
|
|
77
|
+
*/
|
|
78
|
+
getChannelName(channel: ColorChannel, locale: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the number formatting options for the given channel.
|
|
81
|
+
*/
|
|
82
|
+
getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
|
|
83
|
+
/**
|
|
84
|
+
* Formats the numeric value for a given channel for display according to the provided locale.
|
|
85
|
+
*/
|
|
86
|
+
formatChannelValue(channel: ColorChannel, locale: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the color space, 'rgb', 'hsb' or 'hsl', for the current color.
|
|
89
|
+
*/
|
|
90
|
+
getColorSpace(): ColorSpace;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the color space axes, xChannel, yChannel, zChannel.
|
|
93
|
+
*/
|
|
94
|
+
getColorSpaceAxes(xyChannels: {
|
|
95
|
+
xChannel?: ColorChannel;
|
|
96
|
+
yChannel?: ColorChannel;
|
|
97
|
+
}): ColorAxes;
|
|
98
|
+
/**
|
|
99
|
+
* Returns an array of the color channels within the current color space space.
|
|
100
|
+
*/
|
|
101
|
+
getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
|
|
102
|
+
/**
|
|
103
|
+
* Returns a localized name for the color, for use in visual or accessibility labels.
|
|
104
|
+
*/
|
|
105
|
+
getColorName(locale: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* Returns a localized name for the hue, for use in visual or accessibility labels.
|
|
108
|
+
*/
|
|
109
|
+
getHueName(locale: string): string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface ListOptions<T> {
|
|
113
|
+
/** Initial items in the list. */
|
|
114
|
+
initialItems?: T[];
|
|
115
|
+
/** The keys for the initially selected items. */
|
|
116
|
+
initialSelectedKeys?: 'all' | Iterable<Key>;
|
|
117
|
+
/** The initial text to filter the list by. */
|
|
118
|
+
initialFilterText?: string;
|
|
119
|
+
/** A function that returns a unique key for an item object. */
|
|
120
|
+
getKey?: (item: T) => Key;
|
|
121
|
+
/** A function that returns whether a item matches the current filter text. */
|
|
122
|
+
filter?: (item: T, filterText: string) => boolean;
|
|
123
|
+
}
|
|
124
|
+
interface ListData<T> {
|
|
125
|
+
/** The items in the list. */
|
|
126
|
+
items: T[];
|
|
127
|
+
/** The keys of the currently selected items in the list. */
|
|
128
|
+
selectedKeys: Selection;
|
|
129
|
+
/** Sets the selected keys. */
|
|
130
|
+
setSelectedKeys(keys: Selection): void;
|
|
131
|
+
/** Adds the given keys to the current selected keys. */
|
|
132
|
+
addKeysToSelection(keys: Selection): void;
|
|
133
|
+
/** Removes the given keys from the current selected keys. */
|
|
134
|
+
removeKeysFromSelection(keys: Selection): void;
|
|
135
|
+
/** The current filter text. */
|
|
136
|
+
filterText: string;
|
|
137
|
+
/** Sets the filter text. */
|
|
138
|
+
setFilterText(filterText: string): void;
|
|
139
|
+
/**
|
|
140
|
+
* Gets an item from the list by key.
|
|
141
|
+
* @param key - The key of the item to retrieve.
|
|
142
|
+
*/
|
|
143
|
+
getItem(key: Key): T | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Inserts items into the list at the given index.
|
|
146
|
+
* @param index - The index to insert into.
|
|
147
|
+
* @param values - The values to insert.
|
|
148
|
+
*/
|
|
149
|
+
insert(index: number, ...values: T[]): void;
|
|
150
|
+
/**
|
|
151
|
+
* Inserts items into the list before the item at the given key.
|
|
152
|
+
* @param key - The key of the item to insert before.
|
|
153
|
+
* @param values - The values to insert.
|
|
154
|
+
*/
|
|
155
|
+
insertBefore(key: Key, ...values: T[]): void;
|
|
156
|
+
/**
|
|
157
|
+
* Inserts items into the list after the item at the given key.
|
|
158
|
+
* @param key - The key of the item to insert after.
|
|
159
|
+
* @param values - The values to insert.
|
|
160
|
+
*/
|
|
161
|
+
insertAfter(key: Key, ...values: T[]): void;
|
|
162
|
+
/**
|
|
163
|
+
* Appends items to the list.
|
|
164
|
+
* @param values - The values to insert.
|
|
165
|
+
*/
|
|
166
|
+
append(...values: T[]): void;
|
|
167
|
+
/**
|
|
168
|
+
* Prepends items to the list.
|
|
169
|
+
* @param value - The value to insert.
|
|
170
|
+
*/
|
|
171
|
+
prepend(...values: T[]): void;
|
|
172
|
+
/**
|
|
173
|
+
* Removes items from the list by their keys.
|
|
174
|
+
* @param keys - The keys of the item to remove.
|
|
175
|
+
*/
|
|
176
|
+
remove(...keys: Key[]): void;
|
|
177
|
+
/**
|
|
178
|
+
* Removes all items from the list that are currently
|
|
179
|
+
* in the set of selected items.
|
|
180
|
+
*/
|
|
181
|
+
removeSelectedItems(): void;
|
|
182
|
+
/**
|
|
183
|
+
* Moves an item within the list.
|
|
184
|
+
* @param key - The key of the item to move.
|
|
185
|
+
* @param toIndex - The index to move the item to.
|
|
186
|
+
*/
|
|
187
|
+
move(key: Key, toIndex: number): void;
|
|
188
|
+
/**
|
|
189
|
+
* Moves one or more items before a given key.
|
|
190
|
+
* @param key - The key of the item to move the items before.
|
|
191
|
+
* @param keys - The keys of the items to move.
|
|
192
|
+
*/
|
|
193
|
+
moveBefore(key: Key, keys: Iterable<Key>): void;
|
|
194
|
+
/**
|
|
195
|
+
* Moves one or more items after a given key.
|
|
196
|
+
* @param key - The key of the item to move the items after.
|
|
197
|
+
* @param keys - The keys of the items to move.
|
|
198
|
+
*/
|
|
199
|
+
moveAfter(key: Key, keys: Iterable<Key>): void;
|
|
200
|
+
/**
|
|
201
|
+
* Updates an item in the list.
|
|
202
|
+
* @param key - The key of the item to update.
|
|
203
|
+
* @param newValue - The new value for the item, or a function that returns the new value based on the previous value.
|
|
204
|
+
*/
|
|
205
|
+
update(key: Key, newValue: T | ((prev: T) => T)): void;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Manages state for an immutable list data structure, and provides convenience methods to
|
|
209
|
+
* update the data over time.
|
|
210
|
+
*/
|
|
211
|
+
declare function useListData<T>(options: ListOptions<T>): ListData<T>;
|
|
212
|
+
|
|
213
|
+
interface TreeOptions<T extends object> {
|
|
214
|
+
/** Initial root items in the tree. */
|
|
215
|
+
initialItems?: T[];
|
|
216
|
+
/** The keys for the initially selected items. */
|
|
217
|
+
initialSelectedKeys?: Iterable<Key>;
|
|
218
|
+
/** A function that returns a unique key for an item object. */
|
|
219
|
+
getKey?: (item: T) => Key;
|
|
220
|
+
/** A function that returns the children for an item object. */
|
|
221
|
+
getChildren?: (item: T) => T[];
|
|
222
|
+
}
|
|
223
|
+
interface TreeNode<T extends object> {
|
|
224
|
+
/** A unique key for the tree node. */
|
|
225
|
+
key: Key;
|
|
226
|
+
/** The key of the parent node. */
|
|
227
|
+
parentKey?: Key | null;
|
|
228
|
+
/** The value object for the tree node. */
|
|
229
|
+
value: T;
|
|
230
|
+
/** Children of the tree node. */
|
|
231
|
+
children: TreeNode<T>[] | null;
|
|
232
|
+
}
|
|
233
|
+
interface TreeData<T extends object> {
|
|
234
|
+
/** The root nodes in the tree. */
|
|
235
|
+
items: TreeNode<T>[];
|
|
236
|
+
/** The keys of the currently selected items in the tree. */
|
|
237
|
+
selectedKeys: Set<Key>;
|
|
238
|
+
/** Sets the selected keys. */
|
|
239
|
+
setSelectedKeys(keys: Set<Key>): void;
|
|
240
|
+
/**
|
|
241
|
+
* Gets a node from the tree by key.
|
|
242
|
+
* @param key - The key of the item to retrieve.
|
|
243
|
+
*/
|
|
244
|
+
getItem(key: Key): TreeNode<T> | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Inserts an item into a parent node as a child.
|
|
247
|
+
* @param parentKey - The key of the parent item to insert into. `null` for the root.
|
|
248
|
+
* @param index - The index within the parent to insert into.
|
|
249
|
+
* @param value - The value to insert.
|
|
250
|
+
*/
|
|
251
|
+
insert(parentKey: Key | null, index: number, ...values: T[]): void;
|
|
252
|
+
/**
|
|
253
|
+
* Inserts items into the list before the item at the given key.
|
|
254
|
+
* @param key - The key of the item to insert before.
|
|
255
|
+
* @param values - The values to insert.
|
|
256
|
+
*/
|
|
257
|
+
insertBefore(key: Key, ...values: T[]): void;
|
|
258
|
+
/**
|
|
259
|
+
* Inserts items into the list after the item at the given key.
|
|
260
|
+
* @param key - The key of the item to insert after.
|
|
261
|
+
* @param values - The values to insert.
|
|
262
|
+
*/
|
|
263
|
+
insertAfter(key: Key, ...values: T[]): void;
|
|
264
|
+
/**
|
|
265
|
+
* Appends an item into a parent node as a child.
|
|
266
|
+
* @param parentKey - The key of the parent item to insert into. `null` for the root.
|
|
267
|
+
* @param value - The value to insert.
|
|
268
|
+
*/
|
|
269
|
+
append(parentKey: Key | null, ...values: T[]): void;
|
|
270
|
+
/**
|
|
271
|
+
* Prepends an item into a parent node as a child.
|
|
272
|
+
* @param parentKey - The key of the parent item to insert into. `null` for the root.
|
|
273
|
+
* @param value - The value to insert.
|
|
274
|
+
*/
|
|
275
|
+
prepend(parentKey: Key | null, ...value: T[]): void;
|
|
276
|
+
/**
|
|
277
|
+
* Removes an item from the tree by its key.
|
|
278
|
+
* @param key - The key of the item to remove.
|
|
279
|
+
*/
|
|
280
|
+
remove(...keys: Key[]): void;
|
|
281
|
+
/**
|
|
282
|
+
* Removes all items from the tree that are currently
|
|
283
|
+
* in the set of selected items.
|
|
284
|
+
*/
|
|
285
|
+
removeSelectedItems(): void;
|
|
286
|
+
/**
|
|
287
|
+
* Moves an item within the tree.
|
|
288
|
+
* @param key - The key of the item to move.
|
|
289
|
+
* @param toParentKey - The key of the new parent to insert into. `null` for the root.
|
|
290
|
+
* @param index - The index within the new parent to insert at.
|
|
291
|
+
*/
|
|
292
|
+
move(key: Key, toParentKey: Key | null, index: number): void;
|
|
293
|
+
/**
|
|
294
|
+
* Moves one or more items before a given key.
|
|
295
|
+
* @param key - The key of the item to move the items before.
|
|
296
|
+
* @param keys - The keys of the items to move.
|
|
297
|
+
*/
|
|
298
|
+
moveBefore(key: Key, keys: Iterable<Key>): void;
|
|
299
|
+
/**
|
|
300
|
+
* Moves one or more items after a given key.
|
|
301
|
+
* @param key - The key of the item to move the items after.
|
|
302
|
+
* @param keys - The keys of the items to move.
|
|
303
|
+
*/
|
|
304
|
+
moveAfter(key: Key, keys: Iterable<Key>): void;
|
|
305
|
+
/**
|
|
306
|
+
* Updates an item in the tree.
|
|
307
|
+
* @param key - The key of the item to update.
|
|
308
|
+
* @param newValue - The new value for the item.
|
|
309
|
+
*/
|
|
310
|
+
update(key: Key, newValue: T): void;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Manages state for an immutable tree data structure, and provides convenience methods to
|
|
314
|
+
* update the data over time.
|
|
315
|
+
*/
|
|
316
|
+
declare function useTreeData<T extends object>(options: TreeOptions<T>): TreeData<T>;
|
|
317
|
+
|
|
318
|
+
export { useListData, useTreeData };
|
|
319
|
+
export type { Color, ListData, TreeData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baseline-ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.1",
|
|
4
4
|
"description": "Baseline UI is a set of accessible components and tools for building accessible, customizable, production-ready user interfaces",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"slate-hyperscript": "^0.100.0",
|
|
37
37
|
"tailwind-merge": "^3.5.0",
|
|
38
38
|
"use-sync-external-store": "1.6.0",
|
|
39
|
-
"@baseline-ui/css": "0.
|
|
40
|
-
"@baseline-ui/icons": "0.
|
|
41
|
-
"@baseline-ui/tokens": "0.
|
|
39
|
+
"@baseline-ui/css": "0.60.1",
|
|
40
|
+
"@baseline-ui/icons": "0.60.1",
|
|
41
|
+
"@baseline-ui/tokens": "0.60.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^18.0.0",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"@types/dompurify": "3.2.0",
|
|
50
50
|
"@types/markdown-it": "^14.1.2",
|
|
51
51
|
"@vanilla-extract/recipes": "0.5.7",
|
|
52
|
-
"@baseline-ui/translations": "0.
|
|
52
|
+
"@baseline-ui/translations": "0.60.1"
|
|
53
53
|
},
|
|
54
54
|
"license": "SEE LICENSE IN https://pspdfkit.com/legal/License.pdf",
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
-
"build": "tsup src/index.ts --format cjs,esm --clean --
|
|
60
|
-
"build:dts": "
|
|
59
|
+
"build": "tsup src/index.ts --format cjs,esm --clean --minify --treeshake --no-dts && pnpm run build:dts",
|
|
60
|
+
"build:dts": "rollup -c rollup.config.js",
|
|
61
61
|
"build:docs": "typedoc --useCodeBlocks --enumMembersFormat table --hidePageTitle --parametersFormat table --propertiesFormat table --hidePageHeader --indexFormat table --typeDeclarationFormat table --hideBreadcrumbs --outputFileStrategy modules",
|
|
62
62
|
"acknowledgements": "pnpm-licenses generate-disclaimer --prod --output-file=Acknowledgements.md"
|
|
63
63
|
}
|