mithril-materialized 3.3.6 → 3.3.7

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.esm.js CHANGED
@@ -5877,20 +5877,13 @@ const Select = () => {
5877
5877
  // Get selected IDs from props or internal state
5878
5878
  let selectedIds;
5879
5879
  if (controlled) {
5880
- selectedIds = attrs.checkedId !== undefined
5881
- ? Array.isArray(attrs.checkedId)
5882
- ? attrs.checkedId
5883
- : [attrs.checkedId]
5884
- : [];
5880
+ selectedIds =
5881
+ attrs.checkedId !== undefined ? (Array.isArray(attrs.checkedId) ? attrs.checkedId : [attrs.checkedId]) : [];
5885
5882
  }
5886
5883
  else if (disabled) {
5887
5884
  // Non-interactive components: prefer defaultCheckedId, fallback to checkedId
5888
5885
  const fallbackId = (_a = attrs.defaultCheckedId) !== null && _a !== void 0 ? _a : attrs.checkedId;
5889
- selectedIds = fallbackId !== undefined
5890
- ? Array.isArray(fallbackId)
5891
- ? fallbackId
5892
- : [fallbackId]
5893
- : [];
5886
+ selectedIds = fallbackId !== undefined ? (Array.isArray(fallbackId) ? fallbackId : [fallbackId]) : [];
5894
5887
  }
5895
5888
  else {
5896
5889
  // Interactive uncontrolled: use internal state
@@ -5954,17 +5947,22 @@ const Select = () => {
5954
5947
  e.stopPropagation();
5955
5948
  toggleOption(option.id, multiple, attrs);
5956
5949
  },
5957
- })), m('span', multiple
5958
- ? m('label', { for: option.id }, m('input', {
5959
- id: option.id,
5960
- type: 'checkbox',
5961
- checked: selectedIds.includes(option.id),
5962
- disabled: option.disabled ? true : undefined,
5963
- onclick: (e) => {
5964
- e.stopPropagation();
5965
- },
5966
- }), m('span', option.label))
5967
- : option.label))),
5950
+ })), [
5951
+ option.img && m('img', { src: option.img, alt: option.label }),
5952
+ m('span', [
5953
+ multiple
5954
+ ? m('label', { for: option.id }, m('input', {
5955
+ id: option.id,
5956
+ type: 'checkbox',
5957
+ checked: selectedIds.includes(option.id),
5958
+ disabled: option.disabled ? true : undefined,
5959
+ onclick: (e) => {
5960
+ e.stopPropagation();
5961
+ },
5962
+ }), m('span', option.label))
5963
+ : m('span', option.label),
5964
+ ].filter(Boolean)),
5965
+ ])),
5968
5966
  // Render grouped options
5969
5967
  Object.entries(options
5970
5968
  .filter((option) => option.group)
@@ -5984,17 +5982,22 @@ const Select = () => {
5984
5982
  e.stopPropagation();
5985
5983
  toggleOption(option.id, multiple, attrs);
5986
5984
  },
5987
- })), m('span', multiple
5988
- ? m('label', { for: option.id }, m('input', {
5989
- id: option.id,
5990
- type: 'checkbox',
5991
- checked: selectedIds.includes(option.id),
5992
- disabled: option.disabled ? true : undefined,
5993
- onclick: (e) => {
5994
- e.stopPropagation();
5995
- },
5996
- }), m('span', option.label))
5997
- : option.label))),
5985
+ })), [
5986
+ option.img && m('img', { src: option.img, alt: option.label }),
5987
+ m('span', [
5988
+ multiple
5989
+ ? m('label', { for: option.id }, m('input', {
5990
+ id: option.id,
5991
+ type: 'checkbox',
5992
+ checked: selectedIds.includes(option.id),
5993
+ disabled: option.disabled ? true : undefined,
5994
+ onclick: (e) => {
5995
+ e.stopPropagation();
5996
+ },
5997
+ }), m('span', option.label))
5998
+ : m('span', option.label),
5999
+ ].filter(Boolean)),
6000
+ ])),
5998
6001
  ])
5999
6002
  .reduce((acc, val) => acc.concat(val), []),
6000
6003
  ]),
package/dist/index.js CHANGED
@@ -5879,20 +5879,13 @@ const Select = () => {
5879
5879
  // Get selected IDs from props or internal state
5880
5880
  let selectedIds;
5881
5881
  if (controlled) {
5882
- selectedIds = attrs.checkedId !== undefined
5883
- ? Array.isArray(attrs.checkedId)
5884
- ? attrs.checkedId
5885
- : [attrs.checkedId]
5886
- : [];
5882
+ selectedIds =
5883
+ attrs.checkedId !== undefined ? (Array.isArray(attrs.checkedId) ? attrs.checkedId : [attrs.checkedId]) : [];
5887
5884
  }
5888
5885
  else if (disabled) {
5889
5886
  // Non-interactive components: prefer defaultCheckedId, fallback to checkedId
5890
5887
  const fallbackId = (_a = attrs.defaultCheckedId) !== null && _a !== void 0 ? _a : attrs.checkedId;
5891
- selectedIds = fallbackId !== undefined
5892
- ? Array.isArray(fallbackId)
5893
- ? fallbackId
5894
- : [fallbackId]
5895
- : [];
5888
+ selectedIds = fallbackId !== undefined ? (Array.isArray(fallbackId) ? fallbackId : [fallbackId]) : [];
5896
5889
  }
5897
5890
  else {
5898
5891
  // Interactive uncontrolled: use internal state
@@ -5956,17 +5949,22 @@ const Select = () => {
5956
5949
  e.stopPropagation();
5957
5950
  toggleOption(option.id, multiple, attrs);
5958
5951
  },
5959
- })), m('span', multiple
5960
- ? m('label', { for: option.id }, m('input', {
5961
- id: option.id,
5962
- type: 'checkbox',
5963
- checked: selectedIds.includes(option.id),
5964
- disabled: option.disabled ? true : undefined,
5965
- onclick: (e) => {
5966
- e.stopPropagation();
5967
- },
5968
- }), m('span', option.label))
5969
- : option.label))),
5952
+ })), [
5953
+ option.img && m('img', { src: option.img, alt: option.label }),
5954
+ m('span', [
5955
+ multiple
5956
+ ? m('label', { for: option.id }, m('input', {
5957
+ id: option.id,
5958
+ type: 'checkbox',
5959
+ checked: selectedIds.includes(option.id),
5960
+ disabled: option.disabled ? true : undefined,
5961
+ onclick: (e) => {
5962
+ e.stopPropagation();
5963
+ },
5964
+ }), m('span', option.label))
5965
+ : m('span', option.label),
5966
+ ].filter(Boolean)),
5967
+ ])),
5970
5968
  // Render grouped options
5971
5969
  Object.entries(options
5972
5970
  .filter((option) => option.group)
@@ -5986,17 +5984,22 @@ const Select = () => {
5986
5984
  e.stopPropagation();
5987
5985
  toggleOption(option.id, multiple, attrs);
5988
5986
  },
5989
- })), m('span', multiple
5990
- ? m('label', { for: option.id }, m('input', {
5991
- id: option.id,
5992
- type: 'checkbox',
5993
- checked: selectedIds.includes(option.id),
5994
- disabled: option.disabled ? true : undefined,
5995
- onclick: (e) => {
5996
- e.stopPropagation();
5997
- },
5998
- }), m('span', option.label))
5999
- : option.label))),
5987
+ })), [
5988
+ option.img && m('img', { src: option.img, alt: option.label }),
5989
+ m('span', [
5990
+ multiple
5991
+ ? m('label', { for: option.id }, m('input', {
5992
+ id: option.id,
5993
+ type: 'checkbox',
5994
+ checked: selectedIds.includes(option.id),
5995
+ disabled: option.disabled ? true : undefined,
5996
+ onclick: (e) => {
5997
+ e.stopPropagation();
5998
+ },
5999
+ }), m('span', option.label))
6000
+ : m('span', option.label),
6001
+ ].filter(Boolean)),
6002
+ ])),
6000
6003
  ])
6001
6004
  .reduce((acc, val) => acc.concat(val), []),
6002
6005
  ]),
package/dist/index.umd.js CHANGED
@@ -5881,20 +5881,13 @@
5881
5881
  // Get selected IDs from props or internal state
5882
5882
  let selectedIds;
5883
5883
  if (controlled) {
5884
- selectedIds = attrs.checkedId !== undefined
5885
- ? Array.isArray(attrs.checkedId)
5886
- ? attrs.checkedId
5887
- : [attrs.checkedId]
5888
- : [];
5884
+ selectedIds =
5885
+ attrs.checkedId !== undefined ? (Array.isArray(attrs.checkedId) ? attrs.checkedId : [attrs.checkedId]) : [];
5889
5886
  }
5890
5887
  else if (disabled) {
5891
5888
  // Non-interactive components: prefer defaultCheckedId, fallback to checkedId
5892
5889
  const fallbackId = (_a = attrs.defaultCheckedId) !== null && _a !== void 0 ? _a : attrs.checkedId;
5893
- selectedIds = fallbackId !== undefined
5894
- ? Array.isArray(fallbackId)
5895
- ? fallbackId
5896
- : [fallbackId]
5897
- : [];
5890
+ selectedIds = fallbackId !== undefined ? (Array.isArray(fallbackId) ? fallbackId : [fallbackId]) : [];
5898
5891
  }
5899
5892
  else {
5900
5893
  // Interactive uncontrolled: use internal state
@@ -5958,17 +5951,22 @@
5958
5951
  e.stopPropagation();
5959
5952
  toggleOption(option.id, multiple, attrs);
5960
5953
  },
5961
- })), m('span', multiple
5962
- ? m('label', { for: option.id }, m('input', {
5963
- id: option.id,
5964
- type: 'checkbox',
5965
- checked: selectedIds.includes(option.id),
5966
- disabled: option.disabled ? true : undefined,
5967
- onclick: (e) => {
5968
- e.stopPropagation();
5969
- },
5970
- }), m('span', option.label))
5971
- : option.label))),
5954
+ })), [
5955
+ option.img && m('img', { src: option.img, alt: option.label }),
5956
+ m('span', [
5957
+ multiple
5958
+ ? m('label', { for: option.id }, m('input', {
5959
+ id: option.id,
5960
+ type: 'checkbox',
5961
+ checked: selectedIds.includes(option.id),
5962
+ disabled: option.disabled ? true : undefined,
5963
+ onclick: (e) => {
5964
+ e.stopPropagation();
5965
+ },
5966
+ }), m('span', option.label))
5967
+ : m('span', option.label),
5968
+ ].filter(Boolean)),
5969
+ ])),
5972
5970
  // Render grouped options
5973
5971
  Object.entries(options
5974
5972
  .filter((option) => option.group)
@@ -5988,17 +5986,22 @@
5988
5986
  e.stopPropagation();
5989
5987
  toggleOption(option.id, multiple, attrs);
5990
5988
  },
5991
- })), m('span', multiple
5992
- ? m('label', { for: option.id }, m('input', {
5993
- id: option.id,
5994
- type: 'checkbox',
5995
- checked: selectedIds.includes(option.id),
5996
- disabled: option.disabled ? true : undefined,
5997
- onclick: (e) => {
5998
- e.stopPropagation();
5999
- },
6000
- }), m('span', option.label))
6001
- : option.label))),
5989
+ })), [
5990
+ option.img && m('img', { src: option.img, alt: option.label }),
5991
+ m('span', [
5992
+ multiple
5993
+ ? m('label', { for: option.id }, m('input', {
5994
+ id: option.id,
5995
+ type: 'checkbox',
5996
+ checked: selectedIds.includes(option.id),
5997
+ disabled: option.disabled ? true : undefined,
5998
+ onclick: (e) => {
5999
+ e.stopPropagation();
6000
+ },
6001
+ }), m('span', option.label))
6002
+ : m('span', option.label),
6003
+ ].filter(Boolean)),
6004
+ ])),
6002
6005
  ])
6003
6006
  .reduce((acc, val) => acc.concat(val), []),
6004
6007
  ]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mithril-materialized",
3
- "version": "3.3.6",
3
+ "version": "3.3.7",
4
4
  "description": "A materialize library for mithril.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",