kmaterialize 2.3.3-1.0.25 → 2.3.3-1.0.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.
@@ -111,8 +111,8 @@ export class AirDatepickerField extends Component<AirDatepickerFieldOptions> {
111
111
 
112
112
  const dataset = this.el.dataset;
113
113
  const builtInLocale = dataset.dateLang === 'fr-FR'
114
- ? (await import('air-datepicker/locale/fr')).default
115
- : (await import('air-datepicker/locale/en')).default;
114
+ ? (await import('air-datepicker/locale/fr.js')).default
115
+ : (await import('air-datepicker/locale/en.js')).default;
116
116
  const pickerOptions: AirDatepickerOptions = {
117
117
  dateFormat: dataset.dateFormat || 'yyyy-MM-dd',
118
118
  autoClose: dataset.dateAutoClose !== 'false',
@@ -4,6 +4,15 @@
4
4
  max-width: 100%;
5
5
  > .btn, > .btn-split > .btn { position: relative; }
6
6
  .btn > img { width: var(--button-icon); height: var(--button-icon); object-fit: contain; }
7
+ // Image-only buttons fill the control and follow its round or square shape.
8
+ .btn.btn-icon[part="button"] > img {
9
+ display: block;
10
+ width: 100%;
11
+ height: 100%;
12
+ flex-shrink: 0;
13
+ object-fit: cover;
14
+ border-radius: inherit;
15
+ }
7
16
  .btn > i { color: inherit; flex-shrink: 0; }
8
17
  slot { display: contents; }
9
18
  &[size="small"] .btn { --button-height: 30px; }
@@ -9,6 +9,14 @@ const boolean = () => ({ type: 'boolean' as const, default: false, reflect: true
9
9
  const escape = (value: unknown) => String(value).replace(/[&<>"']/g, char => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[char]!);
10
10
  const sizes = { small: 'xs', normal: 'sm', large: 'md', 'extra-large': 'lg' };
11
11
 
12
+ // Palette names from sass/_colors.scss take precedence over CSS named colors.
13
+ const paletteColors = new Set([
14
+ 'materialize-red', 'red', 'pink', 'purple', 'deep-purple', 'indigo',
15
+ 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime',
16
+ 'yellow', 'amber', 'orange', 'deep-orange', 'brown', 'blue-grey',
17
+ 'grey', 'gold', 'black', 'white', 'transparent',
18
+ ]);
19
+
12
20
  /** RegularBtn's attribute API, backed by the renamed Crazycomponent2 runtime. */
13
21
  export default class CrazyButton extends Kmcomponent {
14
22
  static properties: KmcomponentProperties = {
@@ -123,7 +131,8 @@ export default class CrazyButton extends Kmcomponent {
123
131
  button.removeEventListener('click', click);
124
132
  });
125
133
  const trigger = this.querySelector<HTMLElement>('.dropdown-trigger');
126
- const menu = document.getElementById(String(a['menu-target']));
134
+ const menuTarget = String(a['menu-target'] ?? '');
135
+ const menu = trigger && menuTarget ? document.getElementById(menuTarget) : null;
127
136
  if (trigger && menu && !a.disabled) {
128
137
  const parent = menu.parentNode;
129
138
  const next = menu.nextSibling;
@@ -146,8 +155,9 @@ export default class CrazyButton extends Kmcomponent {
146
155
  private restoreFocus = false;
147
156
 
148
157
  private applyColor(element: HTMLElement, color: string, foreground: boolean): void {
149
- if (!color.trim() || this.getProperty('disabled')) return;
150
- if (CSS.supports('color', color)) {
158
+ color = color.trim();
159
+ if (!color || this.getProperty('disabled')) return;
160
+ if (!paletteColors.has(color) && CSS.supports('color', color)) {
151
161
  element.style.setProperty(foreground ? 'color' : 'background-color', color);
152
162
  if (foreground) element.style.borderColor = color;
153
163
  } else {
@@ -105,6 +105,12 @@ export class Popup {
105
105
  return result as PopupResult<Awaited<T>>;
106
106
  }
107
107
 
108
+ /** Confirm the current dialog, including its validation and preConfirm flow. */
109
+ static async clickConfirm(): Promise<void> {
110
+ const swal = await Popup._load();
111
+ swal.clickConfirm();
112
+ }
113
+
108
114
  /** Close the current SweetAlert2 dialog, resolving its pending result. */
109
115
  static async close(): Promise<void> {
110
116
  const swal = await Popup._load();
@@ -118,6 +118,23 @@ describe('Popup', function () {
118
118
  expect((await result).value).toBe('Preview ready');
119
119
  });
120
120
 
121
+ it('confirms programmatically through validation and preConfirm', async function () {
122
+ const { el, result } = await open({
123
+ input: 'text',
124
+ inputValidator: value => value.trim() ? undefined : 'Enter a name.',
125
+ preConfirm: value => value.toUpperCase()
126
+ });
127
+ await M.Popup.clickConfirm();
128
+ await new Promise(resolve => setTimeout(resolve, 20));
129
+ expect(el.querySelector('.swal2-validation-message').textContent).toBe('Enter a name.');
130
+ expect(el.isConnected).toBeTrue();
131
+ el.querySelector('.swal2-input').value = 'Studio';
132
+ await M.Popup.clickConfirm();
133
+ const response = await result;
134
+ expect(response.isConfirmed).toBeTrue();
135
+ expect(response.value).toBe('STUDIO');
136
+ });
137
+
121
138
  it('closes a dialog programmatically and resolves its pending result', async function () {
122
139
  const { el, result } = await open();
123
140
  await M.Popup.close();
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v2.3.3-1.0.25 (https://materializeweb.com)
2
+ * Materialize v2.3.3-1.0.26 (https://materializeweb.com)
3
3
  * Copyright 2014-2026 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v2.3.3-1.0.25 (https://materializeweb.com)
2
+ * Materialize v2.3.3-1.0.26 (https://materializeweb.com)
3
3
  * Copyright 2014-2026 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE)
5
5
  */
@@ -21792,6 +21792,17 @@ div.suffix.suffix-tomselect {
21792
21792
  -o-object-fit: contain;
21793
21793
  object-fit: contain;
21794
21794
  }
21795
+ :is(crazy-button, regular-btn) .btn.btn-icon[part=button] > img {
21796
+ display: block;
21797
+ width: 100%;
21798
+ height: 100%;
21799
+ -webkit-flex-shrink: 0;
21800
+ -ms-flex-negative: 0;
21801
+ flex-shrink: 0;
21802
+ -o-object-fit: cover;
21803
+ object-fit: cover;
21804
+ border-radius: inherit;
21805
+ }
21795
21806
  :is(crazy-button, regular-btn) .btn > i {
21796
21807
  color: inherit;
21797
21808
  -webkit-flex-shrink: 0;