mithril-materialized 0.19.7 → 1.0.0-beta.1

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.
Files changed (84) hide show
  1. package/README.md +6 -2
  2. package/dist/autocomplete.d.ts +14 -7
  3. package/dist/button.d.ts +40 -40
  4. package/dist/carousel.d.ts +38 -18
  5. package/dist/chip.d.ts +31 -11
  6. package/dist/code-block.d.ts +8 -9
  7. package/dist/collapsible.d.ts +26 -22
  8. package/dist/collection.d.ts +49 -49
  9. package/dist/dropdown.d.ts +45 -46
  10. package/dist/floating-action-button.d.ts +37 -34
  11. package/dist/icon.d.ts +11 -11
  12. package/dist/index.css +7968 -2
  13. package/dist/index.d.ts +26 -28
  14. package/dist/index.esm.js +4211 -2
  15. package/dist/index.js +4265 -2
  16. package/dist/index.umd.js +4269 -2
  17. package/dist/input-options.d.ts +85 -81
  18. package/dist/input.d.ts +47 -42
  19. package/dist/label.d.ts +21 -22
  20. package/dist/material-box.d.ts +38 -21
  21. package/dist/material-icon.d.ts +14 -0
  22. package/dist/modal.d.ts +41 -26
  23. package/dist/option.d.ts +61 -52
  24. package/dist/pagination.d.ts +16 -20
  25. package/dist/parallax.d.ts +14 -13
  26. package/dist/pickers.d.ts +130 -8
  27. package/dist/radio.d.ts +41 -37
  28. package/dist/search-select.d.ts +41 -0
  29. package/dist/select.d.ts +46 -45
  30. package/dist/switch.d.ts +12 -13
  31. package/dist/tabs.d.ts +57 -45
  32. package/dist/utils.d.ts +43 -70
  33. package/package.json +55 -16
  34. package/sass/components/_badges.scss +59 -0
  35. package/sass/components/_buttons.scss +327 -0
  36. package/sass/components/_cards.scss +197 -0
  37. package/sass/components/_carousel.scss +92 -0
  38. package/sass/components/_chips.scss +92 -0
  39. package/sass/components/_collapsible.scss +94 -0
  40. package/sass/components/_color-classes.scss +34 -0
  41. package/sass/components/_color-variables.scss +371 -0
  42. package/sass/components/_datepicker.scss +251 -0
  43. package/sass/components/_dropdown.scss +90 -0
  44. package/sass/components/_global.scss +775 -0
  45. package/sass/components/_grid.scss +160 -0
  46. package/sass/components/_icons-material-design.scss +5 -0
  47. package/sass/components/_materialbox.scss +43 -0
  48. package/sass/components/_modal.scss +97 -0
  49. package/sass/components/_navbar.scss +211 -0
  50. package/sass/components/_normalize.scss +447 -0
  51. package/sass/components/_preloader.scss +336 -0
  52. package/sass/components/_pulse.scss +34 -0
  53. package/sass/components/_sidenav.scss +213 -0
  54. package/sass/components/_slider.scss +94 -0
  55. package/sass/components/_table_of_contents.scss +36 -0
  56. package/sass/components/_tabs.scss +102 -0
  57. package/sass/components/_tapTarget.scss +105 -0
  58. package/sass/components/_timepicker.scss +170 -0
  59. package/sass/components/_toast.scss +61 -0
  60. package/sass/components/_tooltip.scss +32 -0
  61. package/sass/components/_transitions.scss +13 -0
  62. package/sass/components/_typography.scss +61 -0
  63. package/sass/components/_variables.scss +352 -0
  64. package/sass/components/_waves.scss +114 -0
  65. package/sass/components/forms/_checkboxes.scss +203 -0
  66. package/sass/components/forms/_file-input.scss +50 -0
  67. package/sass/components/forms/_form-groups.scss +28 -0
  68. package/sass/components/forms/_forms.scss +24 -0
  69. package/sass/components/forms/_input-fields.scss +361 -0
  70. package/sass/components/forms/_radio-buttons.scss +118 -0
  71. package/sass/components/forms/_range.scss +164 -0
  72. package/sass/components/forms/_select.scss +193 -0
  73. package/sass/components/forms/_switches.scss +92 -0
  74. package/sass/materialize.scss +41 -0
  75. package/dist/index.css.map +0 -1
  76. package/dist/index.esm.js.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/index.modern.js +0 -2
  79. package/dist/index.modern.js.map +0 -1
  80. package/dist/index.umd.js.map +0 -1
  81. package/dist/kanban.d.ts +0 -47
  82. package/dist/layout-form-generator.d.ts +0 -75
  83. package/dist/map-editor.d.ts +0 -63
  84. package/dist/timeline.d.ts +0 -24
@@ -1,81 +1,85 @@
1
- import { Attributes } from 'mithril';
2
- export interface IInputOptions<T = string> extends Attributes {
3
- /** Optional label. */
4
- label?: string;
5
- /** Optional ID. */
6
- id?: string;
7
- /** Unique key for use of the element in an array. */
8
- key?: string | number;
9
- /** Initial value of the input field. */
10
- initialValue?: T;
11
- /**
12
- * The autocomplete property sets or returns the value of the autocomplete
13
- * attribute in a text field. When autocomplete is on, the browser automatically
14
- * complete values based on values that the user has entered before.
15
- * @default 'on'
16
- */
17
- autocomplete?: 'on' | 'off';
18
- /**
19
- * The pattern property sets or returns the value of the pattern attribute of
20
- * a text field. The pattern attribute specifies a regular expression that the
21
- * text field's value is checked against.
22
- */
23
- pattern?: RegExp;
24
- /**
25
- * The readOnly property sets or returns whether a text field is read-only, or not.
26
- * A read-only field cannot be modified. However, a user can tab to it, highlight it,
27
- * and copy the text from it.
28
- */
29
- readOnly?: boolean;
30
- /** When true, add the autofocus attribute to the input field. */
31
- autofocus?: (() => boolean) | boolean;
32
- /** Key down event */
33
- onkeydown?: (ev: KeyboardEvent, value?: T) => void;
34
- /** Key press event */
35
- onkeypress?: (ev: KeyboardEvent, value?: T) => void;
36
- /** Key up event */
37
- onkeyup?: (ev: KeyboardEvent, value?: T) => void;
38
- /** Invoked when the value changes. */
39
- onchange?: (value: T) => void;
40
- /** Add a a placeholder to the input field. */
41
- placeholder?: string;
42
- /** Add a description underneath the input field. */
43
- helperText?: string;
44
- /**
45
- * When returning true or an empty string, clear the custom validity (= valid).
46
- * When returning false, set the custom validity message to a default string string.
47
- * When returning a non-empty string, set the custom validity message to this string.
48
- */
49
- validate?: (v: T, target?: HTMLInputElement) => boolean | string;
50
- /** Will replace the helperText, if any, when the input is invalid. */
51
- dataError?: string;
52
- /** Will replace the helperText, if any, when the input is valid. */
53
- dataSuccess?: string;
54
- /** Uses Materialize icons as a prefix or postfix. */
55
- iconName?: string;
56
- /** Sets the input field to disabled. */
57
- disabled?: boolean;
58
- /** Optional style information. */
59
- style?: string;
60
- /** When input type is a number, optionally specify the minimum value. */
61
- min?: number;
62
- /** When input type is a number, optionally specify the maximum value. */
63
- max?: number;
64
- /** When input type is a text or text area, optionally specify the minimum length. */
65
- minLength?: number;
66
- /** When input type is a text or text area, optionally specify the maximum length. */
67
- maxLength?: number;
68
- /** Number of rows of a textarea */
69
- rows?: number;
70
- /** Number of cols of a textarea */
71
- cols?: number;
72
- /** If true, break to a new row */
73
- newRow?: boolean;
74
- /**
75
- * If true, add a mandatory * after the label (if any),
76
- * and add the required and aria-required attributes to the input element.
77
- */
78
- isMandatory?: boolean;
79
- /** Add the required and aria-required attributes to the input element */
80
- required?: boolean;
81
- }
1
+ import { Attributes } from 'mithril';
2
+ export interface InputAttributes<T = string> extends Attributes {
3
+ /** Optional label. */
4
+ label?: string;
5
+ /** Optional ID. */
6
+ id?: string;
7
+ /** Unique key for use of the element in an array. */
8
+ key?: string | number;
9
+ /** Initial value of the input field. */
10
+ initialValue?: T;
11
+ /**
12
+ * The autocomplete property sets or returns the value of the autocomplete
13
+ * attribute in a text field. When autocomplete is on, the browser automatically
14
+ * complete values based on values that the user has entered before.
15
+ * @default 'on'
16
+ */
17
+ autocomplete?: 'on' | 'off';
18
+ /**
19
+ * The pattern property sets or returns the value of the pattern attribute of
20
+ * a text field. The pattern attribute specifies a regular expression that the
21
+ * text field's value is checked against.
22
+ */
23
+ pattern?: RegExp;
24
+ /**
25
+ * The readOnly property sets or returns whether a text field is read-only, or not.
26
+ * A read-only field cannot be modified. However, a user can tab to it, highlight it,
27
+ * and copy the text from it.
28
+ */
29
+ readOnly?: boolean;
30
+ /** When true, add the autofocus attribute to the input field. */
31
+ autofocus?: (() => boolean) | boolean;
32
+ /** Key down event */
33
+ onkeydown?: (ev: KeyboardEvent, value?: T) => void;
34
+ /** Key press event */
35
+ onkeypress?: (ev: KeyboardEvent, value?: T) => void;
36
+ /** Key up event */
37
+ onkeyup?: (ev: KeyboardEvent, value?: T) => void;
38
+ /** Invoked when the element looses focus */
39
+ onblur?: (ev: FocusEvent) => void;
40
+ /** Invoked when the value changes. */
41
+ oninput?: (value: T) => void;
42
+ /** Invoked when the input looses focus. */
43
+ onchange?: (value: T) => void;
44
+ /** Add a a placeholder to the input field. */
45
+ placeholder?: string;
46
+ /** Add a description underneath the input field. */
47
+ helperText?: string;
48
+ /**
49
+ * When returning true or an empty string, clear the custom validity (= valid).
50
+ * When returning false, set the custom validity message to a default string string.
51
+ * When returning a non-empty string, set the custom validity message to this string.
52
+ */
53
+ validate?: (v: T, target?: HTMLInputElement) => boolean | string;
54
+ /** Will replace the helperText, if any, when the input is invalid. */
55
+ dataError?: string;
56
+ /** Will replace the helperText, if any, when the input is valid. */
57
+ dataSuccess?: string;
58
+ /** Uses Materialize icons as a prefix or postfix. */
59
+ iconName?: string;
60
+ /** Sets the input field to disabled. */
61
+ disabled?: boolean;
62
+ /** Optional style information. */
63
+ style?: string;
64
+ /** When input type is a number, optionally specify the minimum value. */
65
+ min?: number;
66
+ /** When input type is a number, optionally specify the maximum value. */
67
+ max?: number;
68
+ /** When input type is a text or text area, optionally specify the minimum length. */
69
+ minLength?: number;
70
+ /** When input type is a text or text area, optionally specify the maximum length. */
71
+ maxLength?: number;
72
+ /** Number of rows of a textarea */
73
+ rows?: number;
74
+ /** Number of cols of a textarea */
75
+ cols?: number;
76
+ /** If true, break to a new row */
77
+ newRow?: boolean;
78
+ /**
79
+ * If true, add a mandatory * after the label (if any),
80
+ * and add the required and aria-required attributes to the input element.
81
+ */
82
+ isMandatory?: boolean;
83
+ /** Add the required and aria-required attributes to the input element */
84
+ required?: boolean;
85
+ }
package/dist/input.d.ts CHANGED
@@ -1,42 +1,47 @@
1
- import m, { FactoryComponent, Attributes } from 'mithril';
2
- import { IInputOptions } from './input-options';
3
- import './styles/input.css';
4
- /** Create a TextArea */
5
- export declare const TextArea: FactoryComponent<IInputOptions<string>>;
6
- export declare type InputType = 'url' | 'color' | 'text' | 'number' | 'email' | 'range' | 'password';
7
- /** Component for entering some text */
8
- export declare const TextInput: m.FactoryComponent<IInputOptions<string>>;
9
- /** Component for entering a password */
10
- export declare const PasswordInput: m.FactoryComponent<IInputOptions<string>>;
11
- /** Component for entering a number */
12
- export declare const NumberInput: m.FactoryComponent<IInputOptions<number>>;
13
- /** Component for entering a URL */
14
- export declare const UrlInput: m.FactoryComponent<IInputOptions<string>>;
15
- /** Component for entering a color */
16
- export declare const ColorInput: m.FactoryComponent<IInputOptions<string>>;
17
- /** Component for entering a range */
18
- export declare const RangeInput: m.FactoryComponent<IInputOptions<number>>;
19
- /** Component for entering an email */
20
- export declare const EmailInput: m.FactoryComponent<IInputOptions<string>>;
21
- export interface IFileInputOptions extends Attributes {
22
- /** Displayed on the button, @default File */
23
- label?: string;
24
- /** Current value of the file input, write only */
25
- initialValue?: string;
26
- /** Adds a placeholder message */
27
- placeholder?: string;
28
- /** If true, upload multiple files */
29
- multiple?: boolean;
30
- /** Called when the file input is changed */
31
- onchange?: (files: FileList) => void;
32
- /** If true, disable the box */
33
- disabled?: boolean;
34
- /**
35
- * Accepted file types, e.g. image/png, image/jpeg,
36
- * any image/*, video/*. audio/*, .pdf, a valid MIME type string, with no extensions, etc.
37
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers
38
- */
39
- accept?: string | string[];
40
- }
41
- /** Component for uploading a file */
42
- export declare const FileInput: FactoryComponent<IFileInputOptions>;
1
+ import m, { FactoryComponent, Attributes } from 'mithril';
2
+ import { InputAttributes } from './input-options';
3
+ /** Character counter component that tracks text length against maxLength */
4
+ export declare const CharacterCounter: FactoryComponent<{
5
+ currentLength: number;
6
+ maxLength: number;
7
+ show: boolean;
8
+ }>;
9
+ /** Create a TextArea */
10
+ export declare const TextArea: FactoryComponent<InputAttributes<string>>;
11
+ export type InputType = 'url' | 'color' | 'text' | 'number' | 'email' | 'range' | 'password';
12
+ /** Component for entering some text */
13
+ export declare const TextInput: m.FactoryComponent<InputAttributes<string>>;
14
+ /** Component for entering a password */
15
+ export declare const PasswordInput: m.FactoryComponent<InputAttributes<string>>;
16
+ /** Component for entering a number */
17
+ export declare const NumberInput: m.FactoryComponent<InputAttributes<number>>;
18
+ /** Component for entering a URL */
19
+ export declare const UrlInput: m.FactoryComponent<InputAttributes<string>>;
20
+ /** Component for entering a color */
21
+ export declare const ColorInput: m.FactoryComponent<InputAttributes<string>>;
22
+ /** Component for entering a range */
23
+ export declare const RangeInput: m.FactoryComponent<InputAttributes<number>>;
24
+ /** Component for entering an email */
25
+ export declare const EmailInput: m.FactoryComponent<InputAttributes<string>>;
26
+ export interface FileInputAttrs extends Attributes {
27
+ /** Displayed on the button, @default File */
28
+ label?: string;
29
+ /** Current value of the file input, write only */
30
+ initialValue?: string;
31
+ /** Adds a placeholder message */
32
+ placeholder?: string;
33
+ /** If true, upload multiple files */
34
+ multiple?: boolean;
35
+ /** Called when the file input is changed */
36
+ onchange?: (files: FileList) => void;
37
+ /** If true, disable the box */
38
+ disabled?: boolean;
39
+ /**
40
+ * Accepted file types, e.g. image/png, image/jpeg,
41
+ * any image/*, video/*. audio/*, .pdf, a valid MIME type string, with no extensions, etc.
42
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers
43
+ */
44
+ accept?: string | string[];
45
+ }
46
+ /** Component for uploading a file */
47
+ export declare const FileInput: FactoryComponent<FileInputAttrs>;
package/dist/label.d.ts CHANGED
@@ -1,22 +1,21 @@
1
- import { FactoryComponent, Component, Attributes } from 'mithril';
2
- import './styles/input.css';
3
- export declare const Mandatory: Component;
4
- export interface IMaterialLabel extends Attributes {
5
- /** Optional title/label */
6
- label?: string;
7
- /** Optional ID */
8
- id?: string;
9
- /** If true, add a mandatory '*' after the label */
10
- isMandatory?: boolean;
11
- /** Add the active class to the label */
12
- isActive?: boolean | string;
13
- }
14
- /** Simple label element, used for most components. */
15
- export declare const Label: FactoryComponent<IMaterialLabel>;
16
- export interface IHelperTextOptions extends Attributes {
17
- helperText?: string;
18
- dataError?: string;
19
- dataSuccess?: string;
20
- }
21
- /** Create a helper text, often used for displaying a small help text. May be replaced by the validation message. */
22
- export declare const HelperText: FactoryComponent<IHelperTextOptions>;
1
+ import { FactoryComponent, Component, Attributes } from 'mithril';
2
+ export declare const Mandatory: Component;
3
+ export interface LabelAttributes extends Attributes {
4
+ /** Optional title/label */
5
+ label?: string;
6
+ /** Optional ID */
7
+ id?: string;
8
+ /** If true, add a mandatory '*' after the label */
9
+ isMandatory?: boolean;
10
+ /** Add the active class to the label */
11
+ isActive?: boolean | string;
12
+ }
13
+ /** Simple label element, used for most components. */
14
+ export declare const Label: FactoryComponent<LabelAttributes>;
15
+ export interface HelperTextOptions extends Attributes {
16
+ helperText?: string;
17
+ dataError?: string;
18
+ dataSuccess?: string;
19
+ }
20
+ /** Create a helper text, often used for displaying a small help text. May be replaced by the validation message. */
21
+ export declare const HelperText: FactoryComponent<HelperTextOptions>;
@@ -1,21 +1,38 @@
1
- /// <reference types="materialize-css" />
2
- import { FactoryComponent, Attributes } from 'mithril';
3
- export interface IMaterialBox extends Partial<M.MaterialboxOptions>, Attributes {
4
- /** Source image path */
5
- src: string;
6
- /**
7
- * Width of the image
8
- * @default undefined
9
- */
10
- width?: number;
11
- /**
12
- * Height of the image
13
- * @default undefined
14
- */
15
- height?: number;
16
- }
17
- /**
18
- * Create an image box, that, when clicked upon, fills the screen.
19
- * @see https://materializecss.com/media.html
20
- */
21
- export declare const MaterialBox: FactoryComponent<IMaterialBox>;
1
+ import { FactoryComponent, Attributes } from 'mithril';
2
+ export interface MaterialBoxOptions {
3
+ /** Animation duration in ms */
4
+ inDuration?: number;
5
+ /** Animation duration in ms for closing */
6
+ outDuration?: number;
7
+ /** Callback when materialbox is opened */
8
+ onOpenStart?: () => void;
9
+ /** Callback when materialbox is closed */
10
+ onCloseStart?: () => void;
11
+ /** Callback when materialbox opening animation is complete */
12
+ onOpenEnd?: () => void;
13
+ /** Callback when materialbox closing animation is complete */
14
+ onCloseEnd?: () => void;
15
+ }
16
+ export interface MaterialBoxAttributes extends MaterialBoxOptions, Attributes {
17
+ /** Source image path */
18
+ src: string;
19
+ /** Alt text for the image */
20
+ alt?: string;
21
+ /**
22
+ * Width of the image
23
+ * @default undefined
24
+ */
25
+ width?: number;
26
+ /**
27
+ * Height of the image
28
+ * @default undefined
29
+ */
30
+ height?: number;
31
+ /** Caption for the image overlay */
32
+ caption?: string;
33
+ }
34
+ /**
35
+ * Pure TypeScript MaterialBox - creates an image lightbox that fills the screen when clicked
36
+ * No MaterializeCSS dependencies
37
+ */
38
+ export declare const MaterialBox: FactoryComponent<MaterialBoxAttributes>;
@@ -0,0 +1,14 @@
1
+ import { FactoryComponent, Attributes } from 'mithril';
2
+ declare const iconPaths: {
3
+ readonly caret: readonly ["M7 10l5 5 5-5z", "M0 0h24v24H0z"];
4
+ readonly close: readonly ["M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z", "M0 0h24v24H0z"];
5
+ };
6
+ type IconName = keyof typeof iconPaths;
7
+ export interface MaterialIconAttrs extends Attributes {
8
+ name: IconName;
9
+ direction?: 'up' | 'down' | 'left' | 'right';
10
+ style?: Record<string, string>;
11
+ onclick?: (e: MouseEvent) => void;
12
+ }
13
+ export declare const MaterialIcon: FactoryComponent<MaterialIconAttrs>;
14
+ export {};
package/dist/modal.d.ts CHANGED
@@ -1,26 +1,41 @@
1
- /// <reference types="materialize-css" />
2
- import { FactoryComponent, Vnode, Attributes } from 'mithril';
3
- export interface IMaterialModal extends Attributes {
4
- id: string;
5
- title: string;
6
- description?: string | Vnode<any, any>;
7
- /** Set to true when the description contains HTML */
8
- richContent?: boolean;
9
- /** Fixate the footer, so you can show more content. */
10
- fixedFooter?: boolean;
11
- /** Display on the bottom */
12
- bottomSheet?: boolean;
13
- /** Materialize css' modal options */
14
- options?: Partial<M.ModalOptions>;
15
- /** Menu buttons, from left to right */
16
- buttons?: Array<{
17
- label: string;
18
- iconName?: string;
19
- disabled?: boolean;
20
- onclick?: (e: UIEvent) => void;
21
- }>;
22
- /** Get the modal instance, so you can control it programmatically */
23
- onCreate?: (modal: M.Modal) => void;
24
- }
25
- /** Builds a modal panel, which can be triggered using its id */
26
- export declare const ModalPanel: FactoryComponent<IMaterialModal>;
1
+ import { FactoryComponent, Vnode, Attributes } from 'mithril';
2
+ export interface ModalState {
3
+ isOpen: boolean;
4
+ id: string;
5
+ }
6
+ export interface ModalAttributes extends Attributes {
7
+ id: string;
8
+ title: string;
9
+ description?: string | Vnode<any, any>;
10
+ /** Set to true when the description contains HTML */
11
+ richContent?: boolean;
12
+ /** Fixate the footer, so you can show more content. */
13
+ fixedFooter?: boolean;
14
+ /** Display on the bottom */
15
+ bottomSheet?: boolean;
16
+ /** Menu buttons, from left to right */
17
+ buttons?: Array<{
18
+ label: string;
19
+ iconName?: string;
20
+ disabled?: boolean;
21
+ onclick?: (e: UIEvent) => void;
22
+ className?: string;
23
+ }>;
24
+ /** Control modal visibility externally */
25
+ isOpen?: boolean;
26
+ /** Called when modal should be opened/closed */
27
+ onToggle?: (open: boolean) => void;
28
+ /** Called when modal is closed */
29
+ onClose?: () => void;
30
+ /** Show close button in top right */
31
+ showCloseButton?: boolean;
32
+ /** Close modal when clicking backdrop */
33
+ closeOnBackdropClick?: boolean;
34
+ /** Close modal when pressing escape key */
35
+ closeOnEsc?: boolean;
36
+ }
37
+ /**
38
+ * CSS-only Modal Panel component - no JavaScript dependencies
39
+ * Uses modern CSS techniques for modal functionality
40
+ */
41
+ export declare const ModalPanel: FactoryComponent<ModalAttributes>;
package/dist/option.d.ts CHANGED
@@ -1,52 +1,61 @@
1
- import { Vnode, FactoryComponent, Attributes } from 'mithril';
2
- export interface IInputCheckbox extends Attributes {
3
- /** Optional event handler when a checkbox is clicked */
4
- onchange?: (checked: boolean) => void;
5
- /** Label of the checkbox, can be a string or Vnode */
6
- label?: string | Vnode<any, any>;
7
- /** If true, the checkbox is checked */
8
- checked?: boolean;
9
- /** If true, the checkbox is disabled */
10
- disabled?: boolean;
11
- }
12
- /** Component to show a check box */
13
- export declare const InputCheckbox: FactoryComponent<IInputCheckbox>;
14
- export interface IInputOption {
15
- /** Option ID */
16
- id: string | number;
17
- /** Displayed label */
18
- label: string;
19
- /** Optional title, often used to display a tooltip - will only work when choosing browser-defaults */
20
- title?: string;
21
- /** Is the option disabled? */
22
- disabled?: boolean;
23
- }
24
- export interface IOptions extends Attributes {
25
- /** Element ID */
26
- id?: string;
27
- /** Optional title or label */
28
- label?: string;
29
- /** The options that you have */
30
- options: IInputOption[];
31
- /** Event handler that is called when an option is changed */
32
- onchange?: (checkedId: Array<string | number>) => void;
33
- /**
34
- * Selected id or ids (in case of multiple options)
35
- * @deprecated Please use initialValue instead
36
- */
37
- checkedId?: string | number | Array<string | number>;
38
- /** Selected id or ids (in case of multiple options) */
39
- initialValue?: string | number | Array<string | number>;
40
- /** Optional description */
41
- description?: string;
42
- /** Optional CSS that is added to the input checkbox, e.g. if you add col s4, the items will be put inline */
43
- checkboxClass?: string;
44
- /** If true, start on a new row */
45
- newRow?: boolean;
46
- /** If true, add a mandatory '*' after the label */
47
- isMandatory?: boolean;
48
- /** If true, disable the options. */
49
- disabled?: boolean;
50
- }
51
- /** A list of checkboxes */
52
- export declare const Options: FactoryComponent<IOptions>;
1
+ import { Vnode, FactoryComponent, Attributes, Component } from 'mithril';
2
+ export interface InputCheckboxAttributes extends Attributes {
3
+ /** Optional event handler when a checkbox is clicked */
4
+ onchange?: (checked: boolean) => void;
5
+ /** Label of the checkbox, can be a string or Vnode */
6
+ label?: string | Vnode<any, any>;
7
+ /** If true, the checkbox is checked */
8
+ checked?: boolean;
9
+ /** If true, the checkbox is disabled */
10
+ disabled?: boolean;
11
+ /** Optional input id for the checkbox */
12
+ inputId?: string;
13
+ }
14
+ /** Component to show a check box */
15
+ export declare const InputCheckbox: FactoryComponent<InputCheckboxAttributes>;
16
+ export interface InputOption<T extends string | number> {
17
+ /** Option ID */
18
+ id: T;
19
+ /** Displayed label */
20
+ label: string;
21
+ /** Optional title, often used to display a tooltip - will only work when choosing browser-defaults */
22
+ title?: string;
23
+ /** Is the option disabled? */
24
+ disabled?: boolean;
25
+ /** Select image */
26
+ img?: string;
27
+ /** Select group label */
28
+ group?: string;
29
+ /** Optional class name */
30
+ className?: string;
31
+ /** Optional description */
32
+ description?: string;
33
+ }
34
+ export interface OptionsAttributes<T extends string | number> extends Attributes {
35
+ /** Element ID */
36
+ id?: string;
37
+ /** Optional title or label */
38
+ label?: string;
39
+ /** The options that you have */
40
+ options: InputOption<T>[];
41
+ /** Event handler that is called when an option is changed */
42
+ onchange?: (checkedId: T[]) => void;
43
+ /** Selected id or ids (in case of multiple options) */
44
+ initialValue?: T | T[];
45
+ /** Optional description */
46
+ description?: string;
47
+ /** Optional CSS that is added to the input checkbox, e.g. if you add col s4, the items will be put inline */
48
+ checkboxClass?: string;
49
+ /** If true, start on a new row */
50
+ newRow?: boolean;
51
+ /** If true, add a mandatory '*' after the label */
52
+ isMandatory?: boolean;
53
+ /** If true, disable the options. */
54
+ disabled?: boolean;
55
+ /** Layout for the options: 'vertical' (default) or 'horizontal' */
56
+ layout?: 'vertical' | 'horizontal';
57
+ /** If true, show select all/none buttons */
58
+ showSelectAll?: boolean;
59
+ }
60
+ /** A list of checkboxes */
61
+ export declare const Options: <T extends string | number>() => Component<OptionsAttributes<T>>;
@@ -1,20 +1,16 @@
1
- import { FactoryComponent, Attributes, Vnode } from 'mithril';
2
- export interface IInternalPaginationOption extends IPaginationOption {
3
- active?: boolean;
4
- title: number | Vnode<any, any>;
5
- }
6
- export interface IPaginationOption extends Attributes {
7
- href: string;
8
- disabled?: boolean;
9
- }
10
- export interface IPaginationOptions extends Attributes {
11
- /**
12
- * How many items do we show
13
- * @default 9 or items.length, whatever is the smallest
14
- */
15
- size?: number;
16
- /** The active page index */
17
- curPage?: number;
18
- items: IPaginationOption[];
19
- }
20
- export declare const Pagination: FactoryComponent<IPaginationOptions>;
1
+ import { FactoryComponent, Attributes } from 'mithril';
2
+ export interface PaginationItem extends Attributes {
3
+ href: string;
4
+ disabled?: boolean;
5
+ }
6
+ export interface PaginationAttributes extends Attributes {
7
+ /**
8
+ * How many items do we show
9
+ * @default 9 or items.length, whatever is the smallest
10
+ */
11
+ size?: number;
12
+ /** The active page index */
13
+ curPage?: number;
14
+ items: PaginationItem[];
15
+ }
16
+ export declare const Pagination: FactoryComponent<PaginationAttributes>;