vanilla-jui 1.5.24 → 1.5.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-jui",
3
- "version": "1.5.24",
3
+ "version": "1.5.26",
4
4
  "private": false,
5
5
  "description": "A lightweight, reactive, and fully customizable vanilla JS UI library.",
6
6
  "keywords": [
@@ -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 { t } from 'vanilla-signal-i18n';
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: t('Submit', locales),
239
- reset: t('Reset', locales),
237
+ submit: translate('Submit'),
238
+ reset: translate('Reset'),
240
239
  };
241
240
 
242
241
  // Guard against malformed dynamic chains that never terminate.
@@ -8,13 +8,12 @@ import {
8
8
  flushSync,
9
9
  jsx,
10
10
  } from 'vanilla-signal';
11
- import { t } from 'vanilla-signal-i18n';
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: t('b', locales), type: 'string' },
123
+ backText: { default: translate('b'), type: 'string' },
125
124
  className: {
126
125
  default: DEFAULT_CLASS_NAMES,
127
126
  type: 'object',
@@ -6,13 +6,11 @@ import {
6
6
  jsx,
7
7
  untrack,
8
8
  } from 'vanilla-signal';
9
- import { t } from 'vanilla-signal-i18n';
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': t('Close', locales),
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
- current: string;
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
- more: 'more',
106
- button: 'j-button is-icon is-ghost',
107
- current: 'j-button is-icon is-active',
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' ? 'Go to previous page' : 'Go to next page',
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.button,
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.current : props.className.button,
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
  };
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  .j-accordion .accordion-header[aria-expanded='false']:hover {
37
- --accordion-bg: var(--ui-surface-hover);
37
+ --accordion-bg: var(--ui-bg-subtle);
38
38
  }
39
39
 
40
40
  .j-accordion[data-direction='horizontal']