@dxos/react-ui 0.3.11-main.fbbdc2a → 0.3.11-main.fc97a54
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/lib/browser/index.mjs +34 -22
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +3 -3
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +1 -1
- package/dist/types/src/components/List/List.d.ts.map +1 -0
- package/dist/types/src/components/{Lists → List}/List.stories.d.ts +3 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +108 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +1 -0
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranslationsContext.d.ts +1 -0
- package/dist/types/src/hooks/useTranslationsContext.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +12 -9
- package/src/components/Avatars/Avatar.tsx +2 -1
- package/src/components/Buttons/Button.stories.tsx +2 -2
- package/src/components/Input/Input.stories.tsx +2 -2
- package/src/components/{Lists → List}/List.stories.tsx +50 -2
- package/src/components/Popover/Popover.stories.tsx +2 -1
- package/src/components/ScrollArea/ScrollArea.stories.tsx +1 -1
- package/src/components/Select/Select.stories.tsx +1 -1
- package/src/components/Select/Select.tsx +14 -12
- package/src/components/ThemeProvider/ThemeProvider.tsx +1 -0
- package/src/components/ThemeProvider/TranslationsProvider.tsx +22 -4
- package/src/components/ThemeProvider/index.ts +1 -0
- package/src/components/index.ts +1 -1
- package/src/index.ts +1 -1
- package/src/playground/Surfaces.stories.tsx +9 -9
- package/src/playground/Typography.stories.tsx +1 -1
- package/dist/types/src/components/Lists/List.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/index.d.ts.map +0 -1
- package/dist/types/src/components/{Lists → List}/List.d.ts +0 -0
- package/dist/types/src/components/{Lists → List}/Tree.d.ts +0 -0
- package/dist/types/src/components/{Lists → List}/Tree.stories.d.ts +0 -0
- package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
- package/src/components/{Lists → List}/List.tsx +0 -0
- package/src/components/{Lists → List}/Tree.stories.tsx +0 -0
- package/src/components/{Lists → List}/Tree.tsx +1 -1
- /package/src/components/{Lists → List}/index.ts +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Locale } from 'date-fns/locale';
|
|
1
2
|
import { type Resource } from 'i18next';
|
|
2
3
|
import React, { type ReactNode } from 'react';
|
|
3
4
|
export declare const resources: {
|
|
@@ -12,9 +13,115 @@ export interface TranslationsProviderProps {
|
|
|
12
13
|
fallback?: ReactNode;
|
|
13
14
|
resourceExtensions?: Resource[];
|
|
14
15
|
appNs?: string;
|
|
16
|
+
dtLocale?: Locale;
|
|
15
17
|
}
|
|
16
18
|
export declare const TranslationsContext: React.Context<{
|
|
17
19
|
appNs: string;
|
|
20
|
+
dtLocale: Locale;
|
|
18
21
|
}>;
|
|
19
|
-
export declare const
|
|
22
|
+
export declare const useTranslation: (ns?: string | readonly string[] | string[] | undefined, options?: import("react-i18next").UseTranslationOptions<import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>> | undefined) => {
|
|
23
|
+
dtLocale: Locale;
|
|
24
|
+
0: import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
25
|
+
1: import("i18next").i18n;
|
|
26
|
+
2: boolean;
|
|
27
|
+
length: 3;
|
|
28
|
+
toString: (() => string) & (() => string);
|
|
29
|
+
toLocaleString: (() => string) & (() => string);
|
|
30
|
+
pop(): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>> | undefined;
|
|
31
|
+
push(...items: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]): number;
|
|
32
|
+
concat(...items: ConcatArray<boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>[]): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
33
|
+
concat(...items: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>> | ConcatArray<boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>)[]): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
34
|
+
join(separator?: string | undefined): string;
|
|
35
|
+
reverse(): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
36
|
+
shift(): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>> | undefined;
|
|
37
|
+
slice(start?: number | undefined, end?: number | undefined): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
38
|
+
sort(compareFn?: ((a: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, b: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>) => number) | undefined): import("react-i18next").UseTranslationResponse<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
39
|
+
splice(start: number, deleteCount?: number | undefined): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
40
|
+
splice(start: number, deleteCount: number, ...items: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
41
|
+
unshift(...items: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]): number;
|
|
42
|
+
indexOf(searchElement: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, fromIndex?: number | undefined): number;
|
|
43
|
+
lastIndexOf(searchElement: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, fromIndex?: number | undefined): number;
|
|
44
|
+
every<S extends boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => value is S, thisArg?: any): this is S[];
|
|
45
|
+
every(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => unknown, thisArg?: any): boolean;
|
|
46
|
+
some(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => unknown, thisArg?: any): boolean;
|
|
47
|
+
forEach(callbackfn: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => void, thisArg?: any): void;
|
|
48
|
+
map<U>(callbackfn: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => U, thisArg?: any): U[];
|
|
49
|
+
filter<S_1 extends boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => value is S_1, thisArg?: any): S_1[];
|
|
50
|
+
filter(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => unknown, thisArg?: any): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
51
|
+
reduce(callbackfn: (previousValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentIndex: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
52
|
+
reduce(callbackfn: (previousValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentIndex: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, initialValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
53
|
+
reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentIndex: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => U_1, initialValue: U_1): U_1;
|
|
54
|
+
reduceRight(callbackfn: (previousValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentIndex: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
55
|
+
reduceRight(callbackfn: (previousValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentIndex: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, initialValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
56
|
+
reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, currentIndex: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => U_2, initialValue: U_2): U_2;
|
|
57
|
+
find<S_2 extends boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, obj: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => value is S_2, thisArg?: any): S_2 | undefined;
|
|
58
|
+
find(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, obj: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => unknown, thisArg?: any): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>> | undefined;
|
|
59
|
+
findIndex(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, obj: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => unknown, thisArg?: any): number;
|
|
60
|
+
fill(value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, start?: number | undefined, end?: number | undefined): import("react-i18next").UseTranslationResponse<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
61
|
+
copyWithin(target: number, start: number, end?: number | undefined): import("react-i18next").UseTranslationResponse<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
62
|
+
entries(): IterableIterator<[number, boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>]>;
|
|
63
|
+
keys(): IterableIterator<number>;
|
|
64
|
+
values(): IterableIterator<boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>;
|
|
65
|
+
includes(searchElement: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, fromIndex?: number | undefined): boolean;
|
|
66
|
+
flatMap<U_3, This = undefined>(callback: (this: This, value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
|
|
67
|
+
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
68
|
+
at(index: number): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>> | undefined;
|
|
69
|
+
findLast<S_3 extends boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => value is S_3, thisArg?: any): S_3 | undefined;
|
|
70
|
+
findLast(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => unknown, thisArg?: any): boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>> | undefined;
|
|
71
|
+
findLastIndex(predicate: (value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, index: number, array: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]) => unknown, thisArg?: any): number;
|
|
72
|
+
toReversed(): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
73
|
+
toSorted(compareFn?: ((a: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>, b: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>) => number) | undefined): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
74
|
+
toSpliced(start: number, deleteCount: number, ...items: (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[]): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
75
|
+
toSpliced(start: number, deleteCount?: number | undefined): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
76
|
+
with(index: number, value: boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>): (boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>)[];
|
|
77
|
+
[Symbol.iterator](): IterableIterator<boolean | import("i18next").i18n | import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>>;
|
|
78
|
+
[Symbol.unscopables]: {
|
|
79
|
+
[x: number]: boolean | undefined;
|
|
80
|
+
length?: boolean | undefined;
|
|
81
|
+
toString?: boolean | undefined;
|
|
82
|
+
toLocaleString?: boolean | undefined;
|
|
83
|
+
pop?: boolean | undefined;
|
|
84
|
+
push?: boolean | undefined;
|
|
85
|
+
concat?: boolean | undefined;
|
|
86
|
+
join?: boolean | undefined;
|
|
87
|
+
reverse?: boolean | undefined;
|
|
88
|
+
shift?: boolean | undefined;
|
|
89
|
+
slice?: boolean | undefined;
|
|
90
|
+
sort?: boolean | undefined;
|
|
91
|
+
splice?: boolean | undefined;
|
|
92
|
+
unshift?: boolean | undefined;
|
|
93
|
+
indexOf?: boolean | undefined;
|
|
94
|
+
lastIndexOf?: boolean | undefined;
|
|
95
|
+
every?: boolean | undefined;
|
|
96
|
+
some?: boolean | undefined;
|
|
97
|
+
forEach?: boolean | undefined;
|
|
98
|
+
map?: boolean | undefined;
|
|
99
|
+
filter?: boolean | undefined;
|
|
100
|
+
reduce?: boolean | undefined;
|
|
101
|
+
reduceRight?: boolean | undefined;
|
|
102
|
+
find?: boolean | undefined;
|
|
103
|
+
findIndex?: boolean | undefined;
|
|
104
|
+
fill?: boolean | undefined;
|
|
105
|
+
copyWithin?: boolean | undefined;
|
|
106
|
+
entries?: boolean | undefined;
|
|
107
|
+
keys?: boolean | undefined;
|
|
108
|
+
values?: boolean | undefined;
|
|
109
|
+
includes?: boolean | undefined;
|
|
110
|
+
flatMap?: boolean | undefined;
|
|
111
|
+
flat?: boolean | undefined;
|
|
112
|
+
at?: boolean | undefined;
|
|
113
|
+
findLast?: boolean | undefined;
|
|
114
|
+
findLastIndex?: boolean | undefined;
|
|
115
|
+
toReversed?: boolean | undefined;
|
|
116
|
+
toSorted?: boolean | undefined;
|
|
117
|
+
toSpliced?: boolean | undefined;
|
|
118
|
+
with?: boolean | undefined;
|
|
119
|
+
[Symbol.iterator]?: boolean | undefined;
|
|
120
|
+
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
121
|
+
};
|
|
122
|
+
t: import("react-i18next").TFunction<import("react-i18next").Namespace<string>, import("react-i18next").KeyPrefix<import("react-i18next").Namespace<string>>>;
|
|
123
|
+
i18n: import("i18next").i18n;
|
|
124
|
+
ready: boolean;
|
|
125
|
+
};
|
|
126
|
+
export declare const TranslationsProvider: ({ fallback, resourceExtensions, children, appNs, dtLocale, }: TranslationsProviderProps) => JSX.Element;
|
|
20
127
|
//# sourceMappingURL=TranslationsProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationsProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/ThemeProvider/TranslationsProvider.tsx"],"names":[],"mappings":"AAIA,OAAgB,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"TranslationsProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/ThemeProvider/TranslationsProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAgB,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAA4D,MAAM,OAAO,CAAC;AAOxG,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AAWX,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAGrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,iEAM9B,yBAAyB,gBAuB3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ThemeProvider/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ThemeProvider/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAE1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationsContext.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTranslationsContext.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"useTranslationsContext.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTranslationsContext.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,sBAAsB;;;CAAwC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAElC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.3.11-main.
|
|
3
|
+
"version": "0.3.11-main.fc97a54",
|
|
4
4
|
"description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"src"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
+
"@fluentui/react-tabster": "^9.18.0",
|
|
16
17
|
"@radix-ui/react-alert-dialog": "^1.0.3",
|
|
17
18
|
"@radix-ui/react-avatar": "^1.0.2",
|
|
18
19
|
"@radix-ui/react-checkbox": "^1.0.3",
|
|
@@ -34,31 +35,33 @@
|
|
|
34
35
|
"@radix-ui/react-toolbar": "^1.0.3",
|
|
35
36
|
"@radix-ui/react-tooltip": "^1.0.5",
|
|
36
37
|
"@radix-ui/react-use-controllable-state": "^1.0.0",
|
|
38
|
+
"date-fns": "^3.3.1",
|
|
37
39
|
"i18next": "^21.10.0",
|
|
38
40
|
"jdenticon": "^3.2.0",
|
|
39
|
-
"keyborg": "^2.
|
|
41
|
+
"keyborg": "^2.5.0",
|
|
40
42
|
"react-i18next": "^11.18.6",
|
|
41
|
-
"@dxos/react-hooks": "0.3.11-main.
|
|
42
|
-
"@dxos/react-input": "0.3.11-main.
|
|
43
|
-
"@dxos/react-
|
|
44
|
-
"@dxos/react-
|
|
43
|
+
"@dxos/react-hooks": "0.3.11-main.fc97a54",
|
|
44
|
+
"@dxos/react-input": "0.3.11-main.fc97a54",
|
|
45
|
+
"@dxos/react-ui-types": "0.3.11-main.fc97a54",
|
|
46
|
+
"@dxos/react-list": "0.3.11-main.fc97a54"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@dnd-kit/core": "^6.0.5",
|
|
48
50
|
"@dnd-kit/sortable": "^7.0.1",
|
|
49
51
|
"@dnd-kit/utilities": "^3.2.0",
|
|
50
|
-
"@faker-js/faker": "^8.0.2",
|
|
51
52
|
"@phosphor-icons/react": "^2.0.5",
|
|
52
53
|
"@types/react": "^18.0.21",
|
|
53
54
|
"@types/react-dom": "^18.0.6",
|
|
54
55
|
"react": "^18.2.0",
|
|
55
56
|
"react-dom": "^18.2.0",
|
|
56
|
-
"vite": "^
|
|
57
|
+
"vite": "^5.0.12",
|
|
57
58
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
58
|
-
"@dxos/
|
|
59
|
+
"@dxos/random": "0.3.11-main.fc97a54",
|
|
60
|
+
"@dxos/react-ui-theme": "0.3.11-main.fc97a54"
|
|
59
61
|
},
|
|
60
62
|
"peerDependencies": {
|
|
61
63
|
"@phosphor-icons/react": "^2.0.5",
|
|
64
|
+
"date-fns": "^3.3.1",
|
|
62
65
|
"react": "^18.2.0",
|
|
63
66
|
"react-dom": "^18.2.0"
|
|
64
67
|
},
|
|
@@ -21,7 +21,7 @@ import { useThemeContext } from '../../hooks';
|
|
|
21
21
|
import { type ThemedClassName } from '../../util';
|
|
22
22
|
|
|
23
23
|
type AvatarVariant = 'square' | 'circle';
|
|
24
|
-
type AvatarStatus = 'active' | 'inactive' | 'error' | 'warning';
|
|
24
|
+
type AvatarStatus = 'active' | 'inactive' | 'current' | 'error' | 'warning' | 'internal';
|
|
25
25
|
type AvatarAnimation = 'pulse' | 'none';
|
|
26
26
|
|
|
27
27
|
export type AvatarRootProps = PropsWithChildren<Partial<AvatarContextValue>>;
|
|
@@ -37,6 +37,7 @@ type AvatarContextValue = {
|
|
|
37
37
|
inGroup?: boolean;
|
|
38
38
|
color?: string;
|
|
39
39
|
};
|
|
40
|
+
|
|
40
41
|
const AVATAR_NAME = 'Avatar';
|
|
41
42
|
const [AvatarProvider, useAvatarContext] = createContext<AvatarContextValue>(AVATAR_NAME);
|
|
42
43
|
|
|
@@ -7,7 +7,7 @@ import '@dxosTheme';
|
|
|
7
7
|
import { CaretLeft, CaretRight } from '@phosphor-icons/react';
|
|
8
8
|
import React, { type PropsWithChildren } from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { modalSurface, groupSurface, mx, surfaceElevation } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
12
|
import { Button, ButtonGroup, type ButtonProps } from './Button';
|
|
13
13
|
import { withTheme } from '../../testing';
|
|
@@ -46,7 +46,7 @@ const Container = ({ children }: PropsWithChildren<{}>) => (
|
|
|
46
46
|
role='group'
|
|
47
47
|
className={mx(
|
|
48
48
|
'flex flex-col gap-4 mbe-4 p-4 rounded-lg',
|
|
49
|
-
|
|
49
|
+
modalSurface,
|
|
50
50
|
surfaceElevation({ elevation: 'chrome' }),
|
|
51
51
|
)}
|
|
52
52
|
>
|
|
@@ -6,7 +6,7 @@ import '@dxosTheme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import { baseSurface,
|
|
9
|
+
import { baseSurface, modalSurface, groupSurface, mx, surfaceElevation } from '@dxos/react-ui-theme';
|
|
10
10
|
import { type MessageValence } from '@dxos/react-ui-types';
|
|
11
11
|
|
|
12
12
|
import { Input } from './Input';
|
|
@@ -64,7 +64,7 @@ const StoryInput = (props: StoryInputProps) => {
|
|
|
64
64
|
<div className={mx(groupSurface, 'p-4 rounded-lg', surfaceElevation({ elevation: 'group' }))}>
|
|
65
65
|
<StoryInputContent {...props} />
|
|
66
66
|
</div>
|
|
67
|
-
<div className={mx(
|
|
67
|
+
<div className={mx(modalSurface, 'p-4 rounded-lg', surfaceElevation({ elevation: 'chrome' }))}>
|
|
68
68
|
<StoryInputContent {...props} />
|
|
69
69
|
</div>
|
|
70
70
|
</div>
|
|
@@ -7,10 +7,18 @@ import '@dxosTheme';
|
|
|
7
7
|
import { DndContext, type DragEndEvent, type DragStartEvent } from '@dnd-kit/core';
|
|
8
8
|
import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
9
9
|
import { CSS } from '@dnd-kit/utilities';
|
|
10
|
+
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
10
11
|
import { DotsSixVertical, PushPin } from '@phosphor-icons/react';
|
|
11
12
|
import React, { type FC, type ReactNode, useState } from 'react';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
getSize,
|
|
16
|
+
ghostHover,
|
|
17
|
+
ghostSelected,
|
|
18
|
+
ghostSelectedTrackingInterFromNormal,
|
|
19
|
+
mx,
|
|
20
|
+
surfaceElevation,
|
|
21
|
+
} from '@dxos/react-ui-theme';
|
|
14
22
|
|
|
15
23
|
import { List, ListItem, type ListProps, type ListScopedProps } from './List';
|
|
16
24
|
import { withTheme } from '../../testing';
|
|
@@ -106,6 +114,7 @@ const ManySizesDraggableListItem = ({
|
|
|
106
114
|
</ListItem.Root>
|
|
107
115
|
);
|
|
108
116
|
};
|
|
117
|
+
|
|
109
118
|
export const ManySizesDraggable = {
|
|
110
119
|
render: ({ ...args }) => {
|
|
111
120
|
const [items, setItems] = useState(
|
|
@@ -183,6 +192,45 @@ export const Collapsible = {
|
|
|
183
192
|
},
|
|
184
193
|
args: {
|
|
185
194
|
variant: 'unordered',
|
|
186
|
-
toggleOpenLabel: 'Open/close storybook list item',
|
|
195
|
+
// toggleOpenLabel: 'Open/close storybook list item', // TODO(burdon): ???
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export const SelectableListbox = {
|
|
200
|
+
render: () => {
|
|
201
|
+
const [selectedId, setSelectedId] = useState<string>();
|
|
202
|
+
const domAttributes = useArrowNavigationGroup({ axis: 'vertical' });
|
|
203
|
+
const [items, _setItems] = useState(
|
|
204
|
+
[...Array(12)].map((_, index) => ({
|
|
205
|
+
id: `listItem-${index}`,
|
|
206
|
+
text: `List item ${index + 1}`,
|
|
207
|
+
})),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
const handleKeyUp = (event: any, id: string) => {
|
|
211
|
+
switch (event.key) {
|
|
212
|
+
case ' ':
|
|
213
|
+
case 'Enter': {
|
|
214
|
+
setSelectedId(id);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<List selectable {...domAttributes}>
|
|
221
|
+
{items.map(({ id, text }) => (
|
|
222
|
+
<ListItem.Root
|
|
223
|
+
key={id}
|
|
224
|
+
tabIndex={0}
|
|
225
|
+
selected={selectedId === id}
|
|
226
|
+
classNames={mx('items-center', ghostHover, ghostSelected, ghostSelectedTrackingInterFromNormal)}
|
|
227
|
+
onClick={() => setSelectedId(id)}
|
|
228
|
+
onKeyUp={(event) => handleKeyUp(event, id)}
|
|
229
|
+
>
|
|
230
|
+
<ListItem.Heading classNames='grow'>Lorem ipsum dolor sit amet</ListItem.Heading>
|
|
231
|
+
</ListItem.Root>
|
|
232
|
+
))}
|
|
233
|
+
</List>
|
|
234
|
+
);
|
|
187
235
|
},
|
|
188
236
|
};
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxosTheme';
|
|
6
6
|
|
|
7
|
-
import { faker } from '@faker-js/faker';
|
|
8
7
|
import React, { type PropsWithChildren, type ReactNode } from 'react';
|
|
9
8
|
|
|
9
|
+
import { faker } from '@dxos/random';
|
|
10
|
+
|
|
10
11
|
import { Popover } from './Popover';
|
|
11
12
|
import { withTheme } from '../../testing';
|
|
12
13
|
import { Button } from '../Buttons';
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxosTheme';
|
|
6
6
|
|
|
7
|
-
import { faker } from '@faker-js/faker';
|
|
8
7
|
import React, { type PropsWithChildren } from 'react';
|
|
9
8
|
|
|
9
|
+
import { faker } from '@dxos/random';
|
|
10
10
|
import { groupSurface, surfaceElevation } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
12
|
import { ScrollArea } from './ScrollArea';
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxosTheme';
|
|
6
6
|
|
|
7
|
-
import { faker } from '@faker-js/faker';
|
|
8
7
|
import React, { type FC, type PropsWithChildren, useState } from 'react';
|
|
9
8
|
|
|
9
|
+
import { faker } from '@dxos/random';
|
|
10
10
|
import { type Density } from '@dxos/react-ui-types';
|
|
11
11
|
|
|
12
12
|
import { Select } from './Select';
|
|
@@ -32,18 +32,20 @@ const SelectPortal = SelectPrimitive.Portal;
|
|
|
32
32
|
|
|
33
33
|
type SelectTriggerButtonProps = Omit<ButtonProps, 'children'> & Pick<SelectValueProps, 'placeholder'>;
|
|
34
34
|
|
|
35
|
-
const SelectTriggerButton = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
const SelectTriggerButton = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
36
|
+
({ children, placeholder, ...props }, forwardedRef) => {
|
|
37
|
+
return (
|
|
38
|
+
<SelectPrimitive.Trigger asChild ref={forwardedRef}>
|
|
39
|
+
<Button {...props}>
|
|
40
|
+
<SelectPrimitive.Value placeholder={placeholder}>{children}</SelectPrimitive.Value>
|
|
41
|
+
<SelectPrimitive.Icon className='pis-2'>
|
|
42
|
+
<CaretDown weight='bold' />
|
|
43
|
+
</SelectPrimitive.Icon>
|
|
44
|
+
</Button>
|
|
45
|
+
</SelectPrimitive.Trigger>
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
);
|
|
47
49
|
|
|
48
50
|
type SelectContentProps = ThemedClassName<SelectPrimitive.SelectContentProps>;
|
|
49
51
|
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { enUS as dtLocaleEnUs, type Locale } from 'date-fns/locale';
|
|
5
6
|
import i18Next, { type Resource } from 'i18next';
|
|
6
|
-
import React, { type ReactNode, useEffect, createContext, useState, Suspense } from 'react';
|
|
7
|
-
import { initReactI18next } from 'react-i18next';
|
|
7
|
+
import React, { type ReactNode, useEffect, createContext, useState, Suspense, useContext } from 'react';
|
|
8
|
+
import { initReactI18next, useTranslation as useI18NextTranslation } from 'react-i18next';
|
|
8
9
|
|
|
9
10
|
const initialLng = 'en-US';
|
|
10
11
|
const initialNs = 'dxos-common';
|
|
12
|
+
const initialDtLocale = dtLocaleEnUs;
|
|
11
13
|
|
|
12
14
|
export const resources = {
|
|
13
15
|
[initialLng]: {
|
|
@@ -28,16 +30,32 @@ void i18Next.use(initReactI18next).init({
|
|
|
28
30
|
|
|
29
31
|
export interface TranslationsProviderProps {
|
|
30
32
|
children?: ReactNode;
|
|
33
|
+
// TODO(wittjosiah): Rename to `placeholder` to match ClientProvider?
|
|
34
|
+
// Placeholder => loading, fallback => error.
|
|
31
35
|
fallback?: ReactNode;
|
|
32
36
|
resourceExtensions?: Resource[];
|
|
33
37
|
appNs?: string;
|
|
38
|
+
dtLocale?: Locale;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
export const TranslationsContext = createContext({
|
|
37
42
|
appNs: initialNs,
|
|
43
|
+
dtLocale: initialDtLocale,
|
|
38
44
|
});
|
|
39
45
|
|
|
40
|
-
export const
|
|
46
|
+
export const useTranslation = (...args: Parameters<typeof useI18NextTranslation>) => {
|
|
47
|
+
const result = useI18NextTranslation(...args);
|
|
48
|
+
const { dtLocale } = useContext(TranslationsContext);
|
|
49
|
+
return { ...result, dtLocale };
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const TranslationsProvider = ({
|
|
53
|
+
fallback,
|
|
54
|
+
resourceExtensions,
|
|
55
|
+
children,
|
|
56
|
+
appNs,
|
|
57
|
+
dtLocale,
|
|
58
|
+
}: TranslationsProviderProps) => {
|
|
41
59
|
const [loaded, setLoaded] = useState(false);
|
|
42
60
|
useEffect(() => {
|
|
43
61
|
setLoaded(false);
|
|
@@ -56,7 +74,7 @@ export const TranslationsProvider = ({ fallback, resourceExtensions, children, a
|
|
|
56
74
|
// TODO(thure): This is not ideal, but i18next was causing `Suspense` to not render the fallback even when the child was asking for namespaces yet to be added.
|
|
57
75
|
// TODO(burdon): Fallbacks should only appear after a short delay, and if the displayed then be visible for 500mx to avoid startup flickering.
|
|
58
76
|
return (
|
|
59
|
-
<TranslationsContext.Provider value={{ appNs: appNs ?? initialNs }}>
|
|
77
|
+
<TranslationsContext.Provider value={{ appNs: appNs ?? initialNs, dtLocale: dtLocale ?? initialDtLocale }}>
|
|
60
78
|
<Suspense fallback={fallback}>{loaded ? children : fallback}</Suspense>
|
|
61
79
|
</TranslationsContext.Provider>
|
|
62
80
|
);
|
package/src/components/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,13 +8,13 @@ import React, { type PropsWithChildren } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
baseSurface,
|
|
11
|
-
|
|
11
|
+
modalSurface,
|
|
12
12
|
groupSurface,
|
|
13
13
|
mx,
|
|
14
14
|
surfaceElevation,
|
|
15
15
|
fixedSurface,
|
|
16
16
|
fixedBorder,
|
|
17
|
-
|
|
17
|
+
attentionSurface,
|
|
18
18
|
} from '@dxos/react-ui-theme';
|
|
19
19
|
|
|
20
20
|
import { withTheme } from '../testing';
|
|
@@ -25,14 +25,14 @@ const Surface = ({
|
|
|
25
25
|
}: PropsWithChildren & { level: 'base' | 'group' | 'chrome' | 'fixed' | 'input' }) => {
|
|
26
26
|
const surface =
|
|
27
27
|
level === 'chrome'
|
|
28
|
-
? [
|
|
28
|
+
? [modalSurface, surfaceElevation({ elevation: 'chrome' })]
|
|
29
29
|
: level === 'group'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
? [groupSurface, surfaceElevation({ elevation: 'group' })]
|
|
31
|
+
: level === 'input'
|
|
32
|
+
? [attentionSurface, surfaceElevation({ elevation: 'group' })]
|
|
33
|
+
: level === 'fixed'
|
|
34
|
+
? [fixedSurface, fixedBorder, 'border', surfaceElevation({ elevation: 'chrome' })]
|
|
35
|
+
: [baseSurface];
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<div
|