mithril-materialized 3.5.5 → 3.5.6

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
@@ -3300,8 +3300,8 @@ const InputField = (type, defaultClass = '') => () => {
3300
3300
  const shouldValidate = !isNonInteractive && (validate || type === 'email' || type === 'url' || isNumeric);
3301
3301
  return m('.input-field', { className: cn, style }, [
3302
3302
  iconName ? m('i.material-icons.prefix', iconName) : undefined,
3303
- m('input', Object.assign(Object.assign({ class: shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
3304
- placeholder, value: controlled ? value : undefined, class: type === 'range' && attrs.vertical ? 'range-slider vertical' : undefined, style: type === 'range' && attrs.vertical
3303
+ m('input', Object.assign(Object.assign({ class: type === 'range' && attrs.vertical ? 'range-slider vertical' : shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
3304
+ placeholder, value: controlled ? value : undefined, style: type === 'range' && attrs.vertical
3305
3305
  ? {
3306
3306
  height: attrs.height || '200px',
3307
3307
  width: '6px',
@@ -4894,7 +4894,7 @@ const ModalPanel = () => {
4894
4894
  closeModal(attrs);
4895
4895
  }
4896
4896
  }
4897
- const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, } = attrs;
4897
+ const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, closeOnButtonClick = true, } = attrs;
4898
4898
  const modalClasses = [
4899
4899
  'modal',
4900
4900
  className || '',
@@ -4991,7 +4991,7 @@ const ModalPanel = () => {
4991
4991
  }, buttons.map((buttonProps) => m(FlatButton, Object.assign(Object.assign({}, buttonProps), { className: `modal-close ${buttonProps.className || ''}`, onclick: (e) => {
4992
4992
  if (buttonProps.onclick)
4993
4993
  buttonProps.onclick(e);
4994
- closeModal(attrs);
4994
+ closeOnButtonClick && closeModal(attrs);
4995
4995
  } })))),
4996
4996
  ]),
4997
4997
  ]);
@@ -5169,6 +5169,7 @@ const defaultOptions = {
5169
5169
  autoClose: false,
5170
5170
  twelveHour: true,
5171
5171
  vibrate: true,
5172
+ roundBy5: false,
5172
5173
  onOpen: () => { },
5173
5174
  onOpenStart: () => { },
5174
5175
  onOpenEnd: () => { },
@@ -5220,7 +5221,7 @@ const TimePicker = () => {
5220
5221
  const clickPos = getPos(e);
5221
5222
  state.dx = clickPos.x - state.x0;
5222
5223
  state.dy = clickPos.y - state.y0;
5223
- setHand(state.dx, state.dy, false);
5224
+ setHand(state.dx, state.dy, options.roundBy5);
5224
5225
  document.addEventListener('mousemove', handleDocumentClickMove);
5225
5226
  document.addEventListener('touchmove', handleDocumentClickMove);
5226
5227
  document.addEventListener('mouseup', handleDocumentClickEnd);
@@ -5232,7 +5233,7 @@ const TimePicker = () => {
5232
5233
  const x = clickPos.x - state.x0;
5233
5234
  const y = clickPos.y - state.y0;
5234
5235
  state.moved = true;
5235
- setHand(x, y, false);
5236
+ setHand(x, y, options.roundBy5);
5236
5237
  m.redraw();
5237
5238
  };
5238
5239
  const handleDocumentClickEnd = (e) => {
package/dist/index.js CHANGED
@@ -3302,8 +3302,8 @@ const InputField = (type, defaultClass = '') => () => {
3302
3302
  const shouldValidate = !isNonInteractive && (validate || type === 'email' || type === 'url' || isNumeric);
3303
3303
  return m('.input-field', { className: cn, style }, [
3304
3304
  iconName ? m('i.material-icons.prefix', iconName) : undefined,
3305
- m('input', Object.assign(Object.assign({ class: shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
3306
- placeholder, value: controlled ? value : undefined, class: type === 'range' && attrs.vertical ? 'range-slider vertical' : undefined, style: type === 'range' && attrs.vertical
3305
+ m('input', Object.assign(Object.assign({ class: type === 'range' && attrs.vertical ? 'range-slider vertical' : shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
3306
+ placeholder, value: controlled ? value : undefined, style: type === 'range' && attrs.vertical
3307
3307
  ? {
3308
3308
  height: attrs.height || '200px',
3309
3309
  width: '6px',
@@ -4896,7 +4896,7 @@ const ModalPanel = () => {
4896
4896
  closeModal(attrs);
4897
4897
  }
4898
4898
  }
4899
- const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, } = attrs;
4899
+ const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, closeOnButtonClick = true, } = attrs;
4900
4900
  const modalClasses = [
4901
4901
  'modal',
4902
4902
  className || '',
@@ -4993,7 +4993,7 @@ const ModalPanel = () => {
4993
4993
  }, buttons.map((buttonProps) => m(FlatButton, Object.assign(Object.assign({}, buttonProps), { className: `modal-close ${buttonProps.className || ''}`, onclick: (e) => {
4994
4994
  if (buttonProps.onclick)
4995
4995
  buttonProps.onclick(e);
4996
- closeModal(attrs);
4996
+ closeOnButtonClick && closeModal(attrs);
4997
4997
  } })))),
4998
4998
  ]),
4999
4999
  ]);
@@ -5171,6 +5171,7 @@ const defaultOptions = {
5171
5171
  autoClose: false,
5172
5172
  twelveHour: true,
5173
5173
  vibrate: true,
5174
+ roundBy5: false,
5174
5175
  onOpen: () => { },
5175
5176
  onOpenStart: () => { },
5176
5177
  onOpenEnd: () => { },
@@ -5222,7 +5223,7 @@ const TimePicker = () => {
5222
5223
  const clickPos = getPos(e);
5223
5224
  state.dx = clickPos.x - state.x0;
5224
5225
  state.dy = clickPos.y - state.y0;
5225
- setHand(state.dx, state.dy, false);
5226
+ setHand(state.dx, state.dy, options.roundBy5);
5226
5227
  document.addEventListener('mousemove', handleDocumentClickMove);
5227
5228
  document.addEventListener('touchmove', handleDocumentClickMove);
5228
5229
  document.addEventListener('mouseup', handleDocumentClickEnd);
@@ -5234,7 +5235,7 @@ const TimePicker = () => {
5234
5235
  const x = clickPos.x - state.x0;
5235
5236
  const y = clickPos.y - state.y0;
5236
5237
  state.moved = true;
5237
- setHand(x, y, false);
5238
+ setHand(x, y, options.roundBy5);
5238
5239
  m.redraw();
5239
5240
  };
5240
5241
  const handleDocumentClickEnd = (e) => {
package/dist/index.umd.js CHANGED
@@ -3304,8 +3304,8 @@
3304
3304
  const shouldValidate = !isNonInteractive && (validate || type === 'email' || type === 'url' || isNumeric);
3305
3305
  return m('.input-field', { className: cn, style }, [
3306
3306
  iconName ? m('i.material-icons.prefix', iconName) : undefined,
3307
- m('input', Object.assign(Object.assign({ class: shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
3308
- placeholder, value: controlled ? value : undefined, class: type === 'range' && attrs.vertical ? 'range-slider vertical' : undefined, style: type === 'range' && attrs.vertical
3307
+ m('input', Object.assign(Object.assign({ class: type === 'range' && attrs.vertical ? 'range-slider vertical' : shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
3308
+ placeholder, value: controlled ? value : undefined, style: type === 'range' && attrs.vertical
3309
3309
  ? {
3310
3310
  height: attrs.height || '200px',
3311
3311
  width: '6px',
@@ -4898,7 +4898,7 @@
4898
4898
  closeModal(attrs);
4899
4899
  }
4900
4900
  }
4901
- const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, } = attrs;
4901
+ const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, closeOnButtonClick = true, } = attrs;
4902
4902
  const modalClasses = [
4903
4903
  'modal',
4904
4904
  className || '',
@@ -4995,7 +4995,7 @@
4995
4995
  }, buttons.map((buttonProps) => m(FlatButton, Object.assign(Object.assign({}, buttonProps), { className: `modal-close ${buttonProps.className || ''}`, onclick: (e) => {
4996
4996
  if (buttonProps.onclick)
4997
4997
  buttonProps.onclick(e);
4998
- closeModal(attrs);
4998
+ closeOnButtonClick && closeModal(attrs);
4999
4999
  } })))),
5000
5000
  ]),
5001
5001
  ]);
@@ -5173,6 +5173,7 @@
5173
5173
  autoClose: false,
5174
5174
  twelveHour: true,
5175
5175
  vibrate: true,
5176
+ roundBy5: false,
5176
5177
  onOpen: () => { },
5177
5178
  onOpenStart: () => { },
5178
5179
  onOpenEnd: () => { },
@@ -5224,7 +5225,7 @@
5224
5225
  const clickPos = getPos(e);
5225
5226
  state.dx = clickPos.x - state.x0;
5226
5227
  state.dy = clickPos.y - state.y0;
5227
- setHand(state.dx, state.dy, false);
5228
+ setHand(state.dx, state.dy, options.roundBy5);
5228
5229
  document.addEventListener('mousemove', handleDocumentClickMove);
5229
5230
  document.addEventListener('touchmove', handleDocumentClickMove);
5230
5231
  document.addEventListener('mouseup', handleDocumentClickEnd);
@@ -5236,7 +5237,7 @@
5236
5237
  const x = clickPos.x - state.x0;
5237
5238
  const y = clickPos.y - state.y0;
5238
5239
  state.moved = true;
5239
- setHand(x, y, false);
5240
+ setHand(x, y, options.roundBy5);
5240
5241
  m.redraw();
5241
5242
  };
5242
5243
  const handleDocumentClickEnd = (e) => {
package/dist/modal.d.ts CHANGED
@@ -27,10 +27,12 @@ export interface ModalAttrs extends Attributes {
27
27
  onToggle?: (open: boolean) => void;
28
28
  /** Called when modal is closed */
29
29
  onClose?: () => void;
30
- /** Show close button in top right */
30
+ /** Show close button in top right (default true) */
31
31
  showCloseButton?: boolean;
32
- /** Close modal when clicking backdrop */
32
+ /** Close modal when clicking backdrop (default true) */
33
33
  closeOnBackdropClick?: boolean;
34
+ /** Close modal when clicking a button (default true) */
35
+ closeOnButtonClick?: boolean;
34
36
  /** Close modal when pressing escape key */
35
37
  closeOnEsc?: boolean;
36
38
  }
@@ -19,6 +19,7 @@ export interface TimepickerOptions {
19
19
  autoClose?: boolean;
20
20
  twelveHour?: boolean;
21
21
  vibrate?: boolean;
22
+ roundBy5?: boolean;
22
23
  onOpen?: () => void;
23
24
  onOpenStart?: () => void;
24
25
  onOpenEnd?: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mithril-materialized",
3
- "version": "3.5.5",
3
+ "version": "3.5.6",
4
4
  "description": "A materialize library for mithril.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -38,7 +38,7 @@
38
38
  "build": "rollup -c rollup.config.mjs && npm run build:css-min",
39
39
  "build:css-min": "sass --no-source-map --style=compressed --no-charset ./src/index.scss ./dist/index.min.css && npm run build:css-modules",
40
40
  "build:css-modules": "sass --no-source-map ./src/core.scss ./dist/core.css && sass --no-source-map ./src/components.scss ./dist/components.css && sass --no-source-map ./src/forms.scss ./dist/forms.css && sass --no-source-map ./src/pickers.scss ./dist/pickers.css && sass --no-source-map ./src/advanced.scss ./dist/advanced.css && sass --no-source-map ./src/utilities.scss ./dist/utilities.css",
41
- "dev": "concurrently \"rollup -c rollup.config.mjs -w\" \"npm run css:watch\"",
41
+ "dev": "concurrently \"rollup -c rollup.config.mjs -w\" \"pnpm run css:watch\"",
42
42
  "start": "pnpm run dev",
43
43
  "clean": "rimraf dist node_modules/.cache",
44
44
  "test": "jest",
@@ -55,7 +55,7 @@
55
55
  "dry-run": "npm publish --dry-run",
56
56
  "sass:watch": "sass --watch ./sass/materialize.scss ./dist/index.css",
57
57
  "css:watch": "sass --watch --no-source-map --style=compressed --no-charset ./src/index.scss ./dist/index.min.css",
58
- "dev:full": "npm run dev & npm run css:watch",
58
+ "dev:full": "pnpm run dev & pnpm run css:watch",
59
59
  "patch-release": "npm run clean && npm run build && npm version patch --force -m \"Patch release\" && npm publish && git push --follow-tags",
60
60
  "minor-release": "npm run clean && npm run build && npm version minor --force -m \"Minor release\" && npm publish && git push --follow-tags",
61
61
  "major-release": "npm run clean && npm run build && npm version major --force -m \"Major release\" && npm publish && git push --follow-tags"
@@ -72,30 +72,29 @@
72
72
  "author": "Erik Vullings <erik.vullings@gmail.com> (http://www.tno.nl)",
73
73
  "license": "MIT",
74
74
  "dependencies": {
75
- "mithril": "^2.3.7"
75
+ "mithril": "^2.3.8"
76
76
  },
77
77
  "devDependencies": {
78
- "@playwright/test": "^1.56.1",
78
+ "@playwright/test": "^1.57.0",
79
79
  "@rollup/plugin-typescript": "^12.3.0",
80
80
  "@testing-library/dom": "^10.4.1",
81
81
  "@testing-library/jest-dom": "^6.9.1",
82
82
  "@testing-library/user-event": "^14.6.1",
83
83
  "@types/jest": "^30.0.0",
84
84
  "@types/mithril": "^2.2.7",
85
- "autoprefixer": "^10.4.21",
85
+ "autoprefixer": "^10.4.23",
86
86
  "concurrently": "^9.2.1",
87
- "express": "^5.1.0",
88
87
  "identity-obj-proxy": "^3.0.0",
89
88
  "jest": "^30.2.0",
90
89
  "jest-environment-jsdom": "^30.2.0",
91
- "js-yaml": "^4.1.0",
92
- "rimraf": "^6.1.0",
93
- "rollup": "^4.52.5",
90
+ "js-yaml": "^4.1.1",
91
+ "rimraf": "^6.1.2",
92
+ "rollup": "^4.54.0",
94
93
  "rollup-plugin-postcss": "^4.0.2",
95
- "sass": "^1.93.2",
96
- "ts-jest": "^29.4.5",
94
+ "sass": "^1.97.1",
95
+ "ts-jest": "^29.4.6",
97
96
  "tslib": "^2.8.1",
98
- "typedoc": "^0.28.14",
97
+ "typedoc": "^0.28.15",
99
98
  "typescript": "^5.9.3"
100
99
  }
101
100
  }