vanilla-jui 1.5.23 → 1.5.25
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/index.d.ts +39 -36
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/form.ts +3 -4
- package/src/components/menu.ts +2 -3
- package/src/components/modal.ts +2 -4
- package/src/components/pagination.ts +17 -25
- package/src/css/accordion.css +1 -1
- package/src/css/editor.css +692 -1
- package/src/css/form.css +0 -5
- package/src/css/gradient.css +0 -91
- package/src/css/index.css +2 -4
- package/src/css/layout.css +12 -0
- package/src/css/pagination.css +1 -5
- package/src/css/themes/default/editor.css +59 -1
- package/src/css/themes/default/index.css +0 -1
- package/src/css/toc.css +0 -4
- package/src/css/tokens.css +2 -1
- package/src/index.ts +3 -2
- package/src/locales/index.ts +2 -0
- package/src/primitives/theme.ts +1 -4
- package/src/primitives/toast.ts +4 -8
- package/src/utilities/browser.ts +2 -3
- package/src/utilities/locale.ts +6 -0
- package/src/css/content.css +0 -692
- package/src/css/themes/default/content.css +0 -59
package/package.json
CHANGED
package/src/components/form.ts
CHANGED
|
@@ -31,8 +31,7 @@ import {
|
|
|
31
31
|
type ValidatorClassNameConfig,
|
|
32
32
|
} from '../validation/validator.ts';
|
|
33
33
|
import { createLoading } from '../primitives/loading.ts';
|
|
34
|
-
import {
|
|
35
|
-
import locales from '../locales/index.ts';
|
|
34
|
+
import { translate } from '../utilities/locale.ts';
|
|
36
35
|
|
|
37
36
|
type FormValue = string | number | boolean;
|
|
38
37
|
export type FieldOption = FormValue | FormOption;
|
|
@@ -235,8 +234,8 @@ const DEFAULT_CLASS_NAMES: FormClassNames = {
|
|
|
235
234
|
};
|
|
236
235
|
|
|
237
236
|
const DEFAULT_TEXT: FormText = {
|
|
238
|
-
submit:
|
|
239
|
-
reset:
|
|
237
|
+
submit: translate('Submit'),
|
|
238
|
+
reset: translate('Reset'),
|
|
240
239
|
};
|
|
241
240
|
|
|
242
241
|
// Guard against malformed dynamic chains that never terminate.
|
package/src/components/menu.ts
CHANGED
|
@@ -8,13 +8,12 @@ import {
|
|
|
8
8
|
flushSync,
|
|
9
9
|
jsx,
|
|
10
10
|
} from 'vanilla-signal';
|
|
11
|
-
import {
|
|
11
|
+
import { translate } from '../utilities/locale.ts';
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
type FunctionalComponent,
|
|
15
15
|
defineComponent,
|
|
16
16
|
} from '../core/component.ts';
|
|
17
|
-
import locales from '../locales/index.ts';
|
|
18
17
|
import { icon } from '../primitives/icons.ts';
|
|
19
18
|
import { joinClasses } from '../utilities/dom.ts';
|
|
20
19
|
import { createEventManager } from '../utilities/events.ts';
|
|
@@ -121,7 +120,7 @@ const MENU_PROPS_SCHEMA = {
|
|
|
121
120
|
default: [],
|
|
122
121
|
types: ['array', 'function'],
|
|
123
122
|
},
|
|
124
|
-
backText: { default:
|
|
123
|
+
backText: { default: translate('b'), type: 'string' },
|
|
125
124
|
className: {
|
|
126
125
|
default: DEFAULT_CLASS_NAMES,
|
|
127
126
|
type: 'object',
|
package/src/components/modal.ts
CHANGED
|
@@ -6,13 +6,11 @@ import {
|
|
|
6
6
|
jsx,
|
|
7
7
|
untrack,
|
|
8
8
|
} from 'vanilla-signal';
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import { translate } from '../utilities/locale.ts';
|
|
11
10
|
import {
|
|
12
11
|
type FunctionalComponent,
|
|
13
12
|
defineComponent,
|
|
14
13
|
} from '../core/component.ts';
|
|
15
|
-
import locales from '../locales/index.ts';
|
|
16
14
|
import { icon } from '../primitives/icons.ts';
|
|
17
15
|
import { createLoading } from '../primitives/loading.ts';
|
|
18
16
|
import { createPopup } from '../primitives/popup.ts';
|
|
@@ -711,7 +709,7 @@ export function createModal(input: ModalProps = {}): Modal {
|
|
|
711
709
|
props.className.closeBtn
|
|
712
710
|
),
|
|
713
711
|
'data-action': 'close',
|
|
714
|
-
'aria-label':
|
|
712
|
+
'aria-label': translate('Close'),
|
|
715
713
|
disabled: isBusy,
|
|
716
714
|
children: icon('close'),
|
|
717
715
|
})
|
|
@@ -12,13 +12,14 @@ import {
|
|
|
12
12
|
defineComponent,
|
|
13
13
|
} from '../core/component.ts';
|
|
14
14
|
import { icon } from '../primitives/icons.ts';
|
|
15
|
-
import { joinClasses } from '../utilities/dom.ts';
|
|
16
15
|
import { isPlainObject } from '../utilities/object.ts';
|
|
17
16
|
import {
|
|
18
17
|
type ResolveSchema,
|
|
19
18
|
resolveProps,
|
|
20
19
|
validateParam,
|
|
21
20
|
} from '../utilities/types.ts';
|
|
21
|
+
import { translate } from '../utilities/locale.ts';
|
|
22
|
+
import { createLoading } from '../primitives/loading.ts';
|
|
22
23
|
|
|
23
24
|
export interface PaginationPage {
|
|
24
25
|
size: number;
|
|
@@ -34,9 +35,9 @@ export interface PaginationClassNames {
|
|
|
34
35
|
root: string;
|
|
35
36
|
list: string;
|
|
36
37
|
item: string;
|
|
37
|
-
more: string;
|
|
38
38
|
button: string;
|
|
39
|
-
|
|
39
|
+
moreBtn: string;
|
|
40
|
+
currentBtn: string;
|
|
40
41
|
loading: string;
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -102,9 +103,9 @@ const DEFAULT_CLASS_NAMES: PaginationClassNames = {
|
|
|
102
103
|
root: 'j-pagination',
|
|
103
104
|
list: 'pagination',
|
|
104
105
|
item: 'item',
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
button: 'j-button is-default is-icon',
|
|
107
|
+
currentBtn: 'j-button is-ghost is-icon is-active',
|
|
108
|
+
moreBtn: 'j-button is-ghost is-icon',
|
|
108
109
|
loading: 'animate-spin',
|
|
109
110
|
};
|
|
110
111
|
|
|
@@ -362,7 +363,9 @@ export function createPagination(input: PaginationProps = {}): Pagination {
|
|
|
362
363
|
type: 'button',
|
|
363
364
|
'data-page-action': type,
|
|
364
365
|
'aria-label':
|
|
365
|
-
type === 'prev'
|
|
366
|
+
type === 'prev'
|
|
367
|
+
? translate('Go to previous page')
|
|
368
|
+
: translate('Go to next page'),
|
|
366
369
|
'aria-disabled': () => (disabled() ? 'true' : 'false'),
|
|
367
370
|
tabindex: () => (disabled() ? '-1' : null),
|
|
368
371
|
disabled,
|
|
@@ -379,15 +382,13 @@ export function createPagination(input: PaginationProps = {}): Pagination {
|
|
|
379
382
|
const itemView = (itemAccessor: () => PaginationItem): HTMLElement => {
|
|
380
383
|
if (itemAccessor().type === 'more') {
|
|
381
384
|
return jsx('li', {
|
|
382
|
-
className:
|
|
383
|
-
joinClasses(
|
|
384
|
-
props.className.item,
|
|
385
|
-
itemAccessor().type === 'more' ? props.className.more : ''
|
|
386
|
-
),
|
|
385
|
+
className: props.className.item,
|
|
387
386
|
'data-pagination-more': () =>
|
|
388
387
|
itemAccessor().type === 'more' ? itemAccessor().key : null,
|
|
389
388
|
children: jsx('span', {
|
|
390
|
-
className: props.className.
|
|
389
|
+
className: props.className.moreBtn,
|
|
390
|
+
'aria-disabled': true,
|
|
391
|
+
disabled: '',
|
|
391
392
|
children: icon('more'),
|
|
392
393
|
}),
|
|
393
394
|
}) as HTMLElement;
|
|
@@ -397,11 +398,7 @@ export function createPagination(input: PaginationProps = {}): Pagination {
|
|
|
397
398
|
const isCurrentPage = (): boolean => page() === state.page.current;
|
|
398
399
|
|
|
399
400
|
return jsx('li', {
|
|
400
|
-
className:
|
|
401
|
-
joinClasses(
|
|
402
|
-
props.className.item,
|
|
403
|
-
itemAccessor().type === 'more' ? props.className.more : ''
|
|
404
|
-
),
|
|
401
|
+
className: props.className.item,
|
|
405
402
|
'data-pagination-more': () =>
|
|
406
403
|
itemAccessor().type === 'more' ? itemAccessor().key : null,
|
|
407
404
|
'data-pagination-item': () => {
|
|
@@ -410,7 +407,7 @@ export function createPagination(input: PaginationProps = {}): Pagination {
|
|
|
410
407
|
},
|
|
411
408
|
children: jsx('button', {
|
|
412
409
|
className: () =>
|
|
413
|
-
isCurrentPage() ? props.className.
|
|
410
|
+
isCurrentPage() ? props.className.currentBtn : props.className.button,
|
|
414
411
|
type: 'button',
|
|
415
412
|
'data-page': () => String(page()),
|
|
416
413
|
'data-current-page': () => (isCurrentPage() ? String(page()) : null),
|
|
@@ -428,12 +425,7 @@ export function createPagination(input: PaginationProps = {}): Pagination {
|
|
|
428
425
|
if (!isLocked() && !isCurrentPage()) go(current);
|
|
429
426
|
},
|
|
430
427
|
children: () =>
|
|
431
|
-
isLocked() && isCurrentPage()
|
|
432
|
-
? jsx('i', {
|
|
433
|
-
className: props.className.loading,
|
|
434
|
-
children: icon('loader'),
|
|
435
|
-
})
|
|
436
|
-
: String(page()),
|
|
428
|
+
isLocked() && isCurrentPage() ? createLoading() : String(page()),
|
|
437
429
|
}),
|
|
438
430
|
}) as HTMLElement;
|
|
439
431
|
};
|