mithril-materialized 3.17.0 → 3.17.2

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.js CHANGED
@@ -3782,7 +3782,7 @@ const InputField = (type, defaultClass = '') => () => {
3782
3782
  }
3783
3783
  },
3784
3784
  view: ({ attrs }) => {
3785
- var _a, _b, _c, _d, _e, _f;
3785
+ var _a, _b, _c, _d, _e, _f, _g;
3786
3786
  const { className = 'col s12', dataError, dataSuccess, helperText, iconName, id = state.id, placeholder, isMandatory, label, maxLength, newRow, oninput, onchange, onkeydown, onkeypress, onkeyup, style, validate, canClear } = attrs, params = __rest(attrs, ["className", "dataError", "dataSuccess", "helperText", "iconName", "id", "placeholder", "isMandatory", "label", "maxLength", "newRow", "oninput", "onchange", "onkeydown", "onkeypress", "onkeyup", "style", "validate", "canClear"]);
3787
3787
  // const attributes = toAttrs(params);
3788
3788
  const cn = [newRow ? 'clear' : '', defaultClass, className].filter(Boolean).join(' ').trim() || undefined;
@@ -4016,12 +4016,14 @@ const InputField = (type, defaultClass = '') => () => {
4016
4016
  m('button.number-input-control.number-input-control-up[type=button]', {
4017
4017
  'aria-label': `Increase ${label || 'value'}`,
4018
4018
  title: 'Increase value',
4019
+ tabindex: -1,
4019
4020
  onmousedown: (event) => event.preventDefault(),
4020
4021
  onclick: () => stepNumberInput('up'),
4021
4022
  }, m(MaterialIcon, { name: 'chevron', direction: 'up' })),
4022
4023
  m('button.number-input-control.number-input-control-down[type=button]', {
4023
4024
  'aria-label': `Decrease ${label || 'value'}`,
4024
4025
  title: 'Decrease value',
4026
+ tabindex: -1,
4025
4027
  onmousedown: (event) => event.preventDefault(),
4026
4028
  onclick: () => stepNumberInput('down'),
4027
4029
  }, m(MaterialIcon, { name: 'chevron' })),
@@ -4047,7 +4049,7 @@ const InputField = (type, defaultClass = '') => () => {
4047
4049
  initialValue: value !== undefined && value !== '',
4048
4050
  helperText,
4049
4051
  dataError: state.hasInteracted && !state.isValid ? dataError : undefined,
4050
- dataSuccess: state.hasInteracted && state.isValid ? dataSuccess : undefined,
4052
+ dataSuccess: state.hasInteracted && state.isValid && ((_g = state.inputElement) === null || _g === void 0 ? void 0 : _g.value) ? dataSuccess : undefined,
4051
4053
  }),
4052
4054
  maxLength && typeof value === 'string'
4053
4055
  ? m(CharacterCounter, {
@@ -7262,12 +7264,12 @@ const Select = () => {
7262
7264
  opacity: 1,
7263
7265
  };
7264
7266
  };
7265
- const formatSelectionSummary = (attrs, selectedOptions, selectedIds, placeholder) => {
7267
+ const formatSelectionSummary = (attrs, selectedLabels, selectedIds, placeholder) => {
7266
7268
  const mode = attrs.summaryMode || 'labels';
7267
7269
  const selectedCount = selectedIds.length;
7268
7270
  const totalCount = attrs.options.filter((option) => !option.disabled).length;
7269
7271
  if (mode === 'labels') {
7270
- return selectedOptions.length > 0 ? selectedOptions.map((o) => o.label || o.id).join(', ') : placeholder;
7272
+ return selectedLabels.length > 0 ? selectedLabels.join(', ') : placeholder;
7271
7273
  }
7272
7274
  const defaultCountLabel = `${selectedCount}/${totalCount} selected`;
7273
7275
  const formattedCount = attrs.countLabel ? attrs.countLabel(selectedCount, totalCount) : defaultCountLabel;
@@ -7421,7 +7423,8 @@ const Select = () => {
7421
7423
  const shouldInlineLabel = appearance === 'outlined' && !!label;
7422
7424
  const selectedOptionsUnsorted = options.filter((opt) => isSelected(opt.id, selectedIds));
7423
7425
  const selectedOptions = sortOptions(selectedOptionsUnsorted, attrs.sortSelected);
7424
- const triggerValue = formatSelectionSummary(attrs, selectedOptions, selectedIds, placeholder);
7426
+ const selectedLabels = selectedOptions.map((o) => o.label || o.id.toString());
7427
+ const triggerValue = formatSelectionSummary(attrs, selectedLabels, selectedIds, placeholder);
7425
7428
  // Update portal dropdown when inside modal
7426
7429
  if (state.isInsideModal) {
7427
7430
  updatePortalDropdown(attrs, selectedIds, multiple, placeholder);