@enonic/ui 1.2.1 → 1.4.0
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/README.md +39 -5
- package/dist/enonic-ui.cjs +1 -1
- package/dist/enonic-ui.es.js +126 -119
- package/dist/style.cjs +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/style.css +1 -1
- package/dist/types/components/combobox/combobox.phrases.d.ts +3 -0
- package/dist/types/components/date-picker/date-picker.phrases.d.ts +10 -0
- package/dist/types/components/dialog/dialog.phrases.d.ts +3 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/search-field/search-field.phrases.d.ts +5 -0
- package/dist/types/components/stepper/stepper.phrases.d.ts +4 -0
- package/dist/types/components/tag/index.d.ts +1 -0
- package/dist/types/components/tag/tag.d.ts +42 -0
- package/dist/types/components/time-picker/time-picker.phrases.d.ts +6 -0
- package/dist/types/components/toast/toast.phrases.d.ts +3 -0
- package/dist/types/components/tree-list/tree-list.phrases.d.ts +9 -0
- package/dist/types/i18n/index.d.ts +2 -0
- package/dist/types/i18n/phrases.d.ts +41 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/providers/combobox-provider.d.ts +2 -1
- package/dist/types/providers/i18n-provider.d.ts +26 -0
- package/dist/types/providers/index.d.ts +2 -0
- package/dist/types/providers/tag-provider.d.ts +13 -0
- package/dist/types/providers/tree-list-provider.d.ts +1 -1
- package/dist/types/providers/virtualized-tree-list-provider.d.ts +1 -0
- package/dist/types/types/i18n.d.ts +15 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/utils/phrase.d.ts +7 -0
- package/package.json +24 -15
|
@@ -7,6 +7,7 @@ export * from './date-picker-provider';
|
|
|
7
7
|
export * from './dialog-provider';
|
|
8
8
|
export * from './focus-container-provider';
|
|
9
9
|
export * from './grid-list-provider';
|
|
10
|
+
export * from './i18n-provider';
|
|
10
11
|
export * from './id-provider';
|
|
11
12
|
export * from './listbox-provider';
|
|
12
13
|
export * from './menu-provider';
|
|
@@ -18,6 +19,7 @@ export * from './search-field-provider';
|
|
|
18
19
|
export * from './selector-provider';
|
|
19
20
|
export * from './stepper-provider';
|
|
20
21
|
export * from './tab-provider';
|
|
22
|
+
export * from './tag-provider';
|
|
21
23
|
export * from './time-picker-provider';
|
|
22
24
|
export * from './toast-provider';
|
|
23
25
|
export * from './toggle-group-provider';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export type TagContextValue = {
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type TagProviderProps = {
|
|
6
|
+
value: TagContextValue;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const TagProvider: {
|
|
10
|
+
({ value, children }: TagProviderProps): ReactElement;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const useTag: () => TagContextValue;
|
|
@@ -9,7 +9,7 @@ export type TreeListContextValue = {
|
|
|
9
9
|
selection: ReadonlySet<string>;
|
|
10
10
|
toggleSelection: (id: string) => void;
|
|
11
11
|
selectOnly: (id: string) => void;
|
|
12
|
-
selectRange: (fromId: string, toId: string) => void;
|
|
12
|
+
selectRange: (fromId: string, toId: string, additive?: boolean) => void;
|
|
13
13
|
clearSelection: () => void;
|
|
14
14
|
selectAll: () => void;
|
|
15
15
|
selectionMode: SelectionMode;
|
|
@@ -7,6 +7,7 @@ export type VirtualizedTreeListContextValue = {
|
|
|
7
7
|
setActiveIndex: (index: number | null) => void;
|
|
8
8
|
selection: ReadonlySet<string>;
|
|
9
9
|
toggleSelection: (id: string, index: number) => void;
|
|
10
|
+
rangeSelectFromAnchor: (index: number) => boolean;
|
|
10
11
|
selectionMode: 'single' | 'multiple' | 'none';
|
|
11
12
|
isFocused: boolean;
|
|
12
13
|
keyboardActive: boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type PhraseValue = string | number;
|
|
2
|
+
/** A flat map of phrase key to text with `{0}`-style positional placeholders. */
|
|
3
|
+
export type Phrases = Readonly<Record<string, string>>;
|
|
4
|
+
export type TranslateOptions = {
|
|
5
|
+
/** The library's own English for the key, placeholders already filled. A miss returns it untouched. */
|
|
6
|
+
defaultValue: string;
|
|
7
|
+
/** The raw values, for the application's own template. A hit formats once, with these. */
|
|
8
|
+
values?: readonly PhraseValue[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* What an application hands `I18nProvider` to render the library's labels in its own words.
|
|
12
|
+
* Answers the application's text for `key`, or `defaultValue` when it has none — never an empty
|
|
13
|
+
* string and never the key, since most of these labels are `aria-label`s.
|
|
14
|
+
*/
|
|
15
|
+
export type Translate = (key: string, options: TranslateOptions) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Phrases, PhraseValue } from '../types';
|
|
2
|
+
/** Fills `{0}`-style placeholders by position. One with no value stays as written. */
|
|
3
|
+
export declare const formatPhrase: (template: string, values: readonly PhraseValue[]) => string;
|
|
4
|
+
type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
5
|
+
/** One map from the components' fragments. A key two fragments both declare is an error, not the last spread. */
|
|
6
|
+
export declare const mergePhrases: <const T extends readonly Phrases[]>(fragments: T) => Readonly<UnionToIntersection<T[number]>>;
|
|
7
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Enonic UI Component Library",
|
|
5
5
|
"author": "Enonic",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"class-variance-authority": "~0.7.1",
|
|
60
60
|
"clsx": "~2.1.1",
|
|
61
|
+
"focus-trap-react": "^12.0.3",
|
|
61
62
|
"lucide-react": "^1.16.0",
|
|
62
|
-
"tailwind-merge": "~3.
|
|
63
|
+
"tailwind-merge": "~3.7.0"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
66
|
"@radix-ui/react-slot": "^1.2.0",
|
|
66
|
-
"focus-trap-react": "^12.0.0",
|
|
67
67
|
"preact": ">=10.0.0",
|
|
68
68
|
"react": "^19.0.0",
|
|
69
69
|
"react-dom": "^19.0.0",
|
|
@@ -71,9 +71,6 @@
|
|
|
71
71
|
"tw-animate-css": "^1.4.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
|
-
"focus-trap-react": {
|
|
75
|
-
"optional": true
|
|
76
|
-
},
|
|
77
74
|
"preact": {
|
|
78
75
|
"optional": true
|
|
79
76
|
},
|
|
@@ -93,7 +90,7 @@
|
|
|
93
90
|
"devDependencies": {
|
|
94
91
|
"@preact/preset-vite": "~2.10.6",
|
|
95
92
|
"@radix-ui/react-slot": "^1.3.3",
|
|
96
|
-
"@size-limit/preset-small-lib": "~
|
|
93
|
+
"@size-limit/preset-small-lib": "~14.1.0",
|
|
97
94
|
"@storybook/addon-a11y": "~10.6.0",
|
|
98
95
|
"@storybook/addon-docs": "~10.6.0",
|
|
99
96
|
"@storybook/addon-themes": "~10.6.0",
|
|
@@ -101,25 +98,26 @@
|
|
|
101
98
|
"@storybook/test-runner": "^0.24.4",
|
|
102
99
|
"@tailwindcss/vite": "~4.3.3",
|
|
103
100
|
"@types/node": "~26.4.1",
|
|
104
|
-
"@types/react": "~19.
|
|
105
|
-
"@types/react-dom": "~19.
|
|
101
|
+
"@types/react": "~19.3.0",
|
|
102
|
+
"@types/react-dom": "~19.3.0",
|
|
106
103
|
"@typescript/typescript6": "~6.0.2",
|
|
107
|
-
"focus-trap-react": "^12.0.3",
|
|
108
104
|
"http-server": "^14.1.1",
|
|
109
|
-
"lucide-preact": "~1.
|
|
105
|
+
"lucide-preact": "~1.48.0",
|
|
110
106
|
"playwright": "^1.62.1",
|
|
107
|
+
"publint": "^0.3.24",
|
|
108
|
+
"react-doctor": "0.9.14",
|
|
111
109
|
"react-virtuoso": "^4.18.11",
|
|
112
110
|
"rollup-plugin-visualizer": "~7.1.1",
|
|
113
|
-
"size-limit": "~
|
|
111
|
+
"size-limit": "~14.1.0",
|
|
114
112
|
"storybook": "~10.6.0",
|
|
115
113
|
"tailwindcss": "~4.3.3",
|
|
116
114
|
"terser": "~5.51.2",
|
|
117
115
|
"tw-animate-css": "^1.4.0",
|
|
118
116
|
"typescript": "~7.0.2",
|
|
119
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@^0.
|
|
117
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@^1.0.0",
|
|
120
118
|
"vite-plugin-dts": "~5.1.0",
|
|
121
119
|
"vite-plugin-environment": "~1.1.3",
|
|
122
|
-
"vite-plus": "^0.
|
|
120
|
+
"vite-plus": "^1.0.0",
|
|
123
121
|
"wait-on": "^9.1.0"
|
|
124
122
|
},
|
|
125
123
|
"engines": {
|
|
@@ -129,14 +127,21 @@
|
|
|
129
127
|
"size-limit": [
|
|
130
128
|
{
|
|
131
129
|
"path": "dist/enonic-ui.es.js",
|
|
130
|
+
"ignore": [
|
|
131
|
+
"focus-trap-react"
|
|
132
|
+
],
|
|
132
133
|
"limit": "60 KB"
|
|
133
134
|
},
|
|
134
135
|
{
|
|
135
136
|
"path": "dist/enonic-ui.cjs",
|
|
137
|
+
"ignore": [
|
|
138
|
+
"focus-trap-react"
|
|
139
|
+
],
|
|
136
140
|
"limit": "60 KB"
|
|
137
141
|
},
|
|
138
142
|
{
|
|
139
143
|
"path": "dist/styles/style.css",
|
|
144
|
+
"rolldown": false,
|
|
140
145
|
"limit": "15 KB"
|
|
141
146
|
},
|
|
142
147
|
{
|
|
@@ -144,8 +149,10 @@
|
|
|
144
149
|
"limit": "20 KB"
|
|
145
150
|
},
|
|
146
151
|
{
|
|
152
|
+
"name": "dist/styles/preset.css (unminified)",
|
|
147
153
|
"path": "dist/styles/preset.css",
|
|
148
|
-
"
|
|
154
|
+
"rolldown": false,
|
|
155
|
+
"limit": "2.25 KB"
|
|
149
156
|
}
|
|
150
157
|
],
|
|
151
158
|
"scripts": {
|
|
@@ -164,7 +171,9 @@
|
|
|
164
171
|
"lint:fix": "vp lint --fix",
|
|
165
172
|
"format": "vp fmt",
|
|
166
173
|
"format:check": "vp fmt --check",
|
|
174
|
+
"check:react": "react-doctor --no-telemetry",
|
|
167
175
|
"test": "exit 0",
|
|
176
|
+
"check:package": "node scripts/package-smoke.mjs",
|
|
168
177
|
"test:ci": "exit 0",
|
|
169
178
|
"test:storybook": "test-storybook --includeTags interactions-smoke",
|
|
170
179
|
"release:dry": "pnpm publish --dry-run --no-git-checks",
|