mithril-materialized 0.19.6 → 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,13 +1,14 @@
1
- /// <reference types="materialize-css" />
2
- import { FactoryComponent, Attributes } from 'mithril';
3
- export interface IParallax extends Partial<M.ParallaxOptions>, Attributes {
4
- /** Image source */
5
- src: string;
6
- }
7
- /**
8
- * Parallax component:
9
- * Parallax is an effect where the background content or image in this case,
10
- * is moved at a different speed than the foreground content while scrolling.
11
- * @see https://materializecss.com/parallax.html
12
- */
13
- export declare const Parallax: FactoryComponent<IParallax>;
1
+ import { FactoryComponent, Attributes } from 'mithril';
2
+ export interface ParallaxAttributes extends Attributes {
3
+ /** Enable responsive parallax (disable on mobile for performance) */
4
+ responsiveThreshold?: number;
5
+ /** Image source */
6
+ src: string;
7
+ /** Alt text for the image */
8
+ alt?: string;
9
+ }
10
+ /**
11
+ * MaterializeCSS Parallax component with dynamic positioning
12
+ * Port of the original MaterializeCSS parallax logic
13
+ */
14
+ export declare const Parallax: FactoryComponent<ParallaxAttributes>;
package/dist/pickers.d.ts CHANGED
@@ -1,8 +1,130 @@
1
- /// <reference types="materialize-css" />
2
- /// <reference types="materialize-css" />
3
- import { FactoryComponent } from 'mithril';
4
- import { IInputOptions } from './input-options';
5
- /** Component to pick a date */
6
- export declare const DatePicker: FactoryComponent<IInputOptions<Date> & Partial<M.DatepickerOptions>>;
7
- /** Component to pick a time */
8
- export declare const TimePicker: FactoryComponent<IInputOptions & Partial<M.TimepickerOptions>>;
1
+ import { FactoryComponent } from 'mithril';
2
+ import { InputAttributes } from './input-options';
3
+ export interface DatePickerI18n {
4
+ cancel?: string;
5
+ clear?: string;
6
+ done?: string;
7
+ previousMonth?: string;
8
+ nextMonth?: string;
9
+ months?: string[];
10
+ monthsShort?: string[];
11
+ weekdays?: string[];
12
+ weekdaysShort?: string[];
13
+ weekdaysAbbrev?: string[];
14
+ }
15
+ export interface DatePickerOptions {
16
+ /** Close when date is selected */
17
+ autoClose?: boolean;
18
+ /** The default output format for the input field value */
19
+ format?: string;
20
+ /** Custom parse function */
21
+ parse?: (dateString: string, format: string) => Date | null;
22
+ /** The initial date to view when first opened */
23
+ defaultDate?: Date;
24
+ /** Make the defaultDate the initial selected value */
25
+ setDefaultDate?: boolean;
26
+ /** Disable weekends */
27
+ disableWeekends?: boolean;
28
+ /** Custom function to disable specific days */
29
+ disableDayFn?: (date: Date) => boolean;
30
+ /** First day of week (0: Sunday, 1: Monday etc) */
31
+ firstDay?: number;
32
+ /** The earliest date that can be selected */
33
+ minDate?: Date;
34
+ /** The latest date that can be selected */
35
+ maxDate?: Date;
36
+ /** Number of years either side, or array of upper/lower range */
37
+ yearRange?: number | number[];
38
+ /** Show clear button */
39
+ showClearBtn?: boolean;
40
+ /** Internationalization */
41
+ i18n?: DatePickerI18n;
42
+ /** Callback when date is selected */
43
+ onSelect?: (date: Date) => void;
44
+ /** Callback when picker is opened */
45
+ onOpen?: () => void;
46
+ /** Callback when picker is closed */
47
+ onClose?: () => void;
48
+ }
49
+ export interface DatePickerAttributes extends InputAttributes<string>, DatePickerOptions {
50
+ /** Date format attribute (alternative to format property) */
51
+ format?: string;
52
+ /** Year range attribute (alternative to yearRange property) */
53
+ yearrange?: string;
54
+ /** Legacy: Date label (use label instead) */
55
+ dateLabel?: string;
56
+ /** Legacy: Display format (use format instead) */
57
+ displayFormat?: string;
58
+ }
59
+ /**
60
+ * Enhanced DatePicker component based on Materialize CSS datepicker
61
+ */
62
+ export declare const DatePicker: FactoryComponent<DatePickerAttributes>;
63
+ export interface TimePickerI18n {
64
+ /** Label for time field */
65
+ timeLabel?: string;
66
+ /** Helper text showing format */
67
+ helperText?: string;
68
+ /** Now button text */
69
+ nowLabel?: string;
70
+ /** Clear button text */
71
+ clearLabel?: string;
72
+ /** Close button text */
73
+ closeLabel?: string;
74
+ /** Icon for time input */
75
+ iconName?: string;
76
+ /** AM label for 12-hour format */
77
+ amLabel?: string;
78
+ /** PM label for 12-hour format */
79
+ pmLabel?: string;
80
+ /** Toggle 12h/24h button text */
81
+ toggleFormatLabel?: string;
82
+ }
83
+ export interface TimePickerFormat {
84
+ /** Use 12-hour format */
85
+ twelveHour?: boolean;
86
+ /** Allow user to toggle between 12h/24h format */
87
+ allowFormatToggle?: boolean;
88
+ }
89
+ export interface TimePickerOptions extends TimePickerI18n, TimePickerFormat {
90
+ /** Show clear button */
91
+ showClearBtn?: boolean;
92
+ /** Show now button */
93
+ showNowBtn?: boolean;
94
+ /** Use modal for time selection (default: true) */
95
+ useModal?: boolean;
96
+ /** Disabled state - prevents all interaction */
97
+ disabled?: boolean;
98
+ /** Readonly state - shows value but prevents editing */
99
+ readonly?: boolean;
100
+ /**
101
+ * Default time to revert to when field is cleared (optional).
102
+ * Note: Use initialValue (from InputOptions) to set the current/initial value of the field.
103
+ * defaultTime is only used as a fallback when the user clears the field and you want to provide a default.
104
+ */
105
+ defaultTime?: string;
106
+ /** Auto close picker after selection */
107
+ autoClose?: boolean;
108
+ /** Callback when time is selected */
109
+ onSelect?: (hours: number, minutes: number) => void;
110
+ /** Callback when picker is opened */
111
+ onOpen?: () => void;
112
+ /** Callback when picker is closed */
113
+ onClose?: () => void;
114
+ /** Input handler - fires on every change */
115
+ oninput?: (value: string) => void;
116
+ /** Change handler for the time value (24h format) - fires on blur/focus loss */
117
+ onchange?: (value: string) => void;
118
+ }
119
+ export interface TimePickerAttributes extends InputAttributes<string>, TimePickerOptions {
120
+ }
121
+ /**
122
+ * Enhanced TimePicker component with i18n support and improved functionality.
123
+ *
124
+ * Usage:
125
+ * - Use `initialValue` to set the current/initial time value (24h format: "HH:MM")
126
+ * - Use `defaultTime` only if you need a fallback when the field is cleared
127
+ * - The component accepts and outputs 24-hour format strings ("HH:MM")
128
+ * - Display format (12h/24h) is controlled by the `twelveHour` property
129
+ */
130
+ export declare const TimePicker: FactoryComponent<TimePickerAttributes>;
package/dist/radio.d.ts CHANGED
@@ -1,37 +1,41 @@
1
- import { FactoryComponent, Attributes } from 'mithril';
2
- import { IInputOption } from './option';
3
- export interface IRadioButtons extends Attributes {
4
- /** Element ID */
5
- id?: string;
6
- /** Optional title or label */
7
- label?: string;
8
- /** The options that you have */
9
- options: IInputOption[];
10
- /** Event handler that is called when an option is changed */
11
- onchange: (id: string | number) => void;
12
- /** Selected id (in oninit lifecycle) */
13
- initialValue?: string | number;
14
- /** Selected id (in oninit and onupdate lifecycle) */
15
- checkedId?: string | number;
16
- /** Optional description */
17
- description?: string;
18
- /** If true, start on a new row */
19
- newRow?: boolean;
20
- /** If true, add a mandatory '*' after the label */
21
- isMandatory?: boolean;
22
- /** Optional CSS that is added to the input checkbox, e.g. if you add col s4, the items will be put inline */
23
- checkboxClass?: string;
24
- /** Disable the button */
25
- disabled?: boolean;
26
- }
27
- /** Component to show a list of radio buttons, from which you can choose one. */
28
- export declare const RadioButtons: FactoryComponent<IRadioButtons>;
29
- export interface IRadioButton extends Attributes {
30
- id: string | number;
31
- checked?: boolean;
32
- onchange: (id: string | number) => void;
33
- label: string;
34
- groupId: string;
35
- disabled?: boolean;
36
- }
37
- export declare const RadioButton: FactoryComponent<IRadioButton>;
1
+ import { Attributes, Component } from 'mithril';
2
+ import { InputOption } from './option';
3
+ export interface RadioButtonsAttributes<T extends string | number> extends Attributes {
4
+ /** Element ID */
5
+ id?: string;
6
+ /** Optional title or label */
7
+ label?: string;
8
+ /** The options that you have */
9
+ options: InputOption<T>[];
10
+ /** Event handler that is called when an option is changed */
11
+ onchange: (id: T) => void;
12
+ /** Selected id (in oninit lifecycle) */
13
+ initialValue?: T;
14
+ /** Selected id (in oninit and onupdate lifecycle) */
15
+ checkedId?: T;
16
+ /** Optional description */
17
+ description?: string;
18
+ /** If true, start on a new row */
19
+ newRow?: boolean;
20
+ /** If true, add a mandatory '*' after the label */
21
+ isMandatory?: boolean;
22
+ /** Optional CSS that is added to the input checkbox, e.g. if you add col s4, the items will be put inline */
23
+ checkboxClass?: string;
24
+ /** Disable the button */
25
+ disabled?: boolean;
26
+ /** Layout for the options: 'vertical' (default) or 'horizontal' */
27
+ layout?: 'vertical' | 'horizontal';
28
+ }
29
+ export interface RadioButtonAttributes<T extends string | number> extends Attributes {
30
+ id: T;
31
+ checked?: boolean;
32
+ onchange: (id: T) => void;
33
+ label: string;
34
+ groupId: string;
35
+ disabled?: boolean;
36
+ /** Optional input id for the radio button */
37
+ inputId?: string;
38
+ }
39
+ export declare const RadioButton: <T extends string | number>() => Component<RadioButtonAttributes<T>>;
40
+ /** Component to show a list of radio buttons, from which you can choose one. */
41
+ export declare const RadioButtons: <T extends string | number>() => Component<RadioButtonsAttributes<T>>;
@@ -0,0 +1,41 @@
1
+ import { Attributes, Component } from 'mithril';
2
+ export interface Option<T extends string | number> {
3
+ id: T;
4
+ label?: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface SearchSelectAttributes<T extends string | number> extends Attributes {
8
+ /** Options to display in the select */
9
+ options?: Option<T>[];
10
+ /** Initial value */
11
+ initialValue?: T[];
12
+ /** Callback when user selects or deselects an option */
13
+ onchange?: (selectedOptions: T[]) => void | Promise<void>;
14
+ /** Callback when user creates a new option: should return new ID */
15
+ oncreateNewOption?: (term: string) => Option<T> | Promise<Option<T>>;
16
+ /** Label for the search select, no default */
17
+ label?: string;
18
+ /** Placeholder text for the search input, no default */
19
+ placeholder?: string;
20
+ /** Placeholder text for the search input, default 'Search options...' */
21
+ searchPlaceholder?: string;
22
+ /** When no options are left, displays this text, default 'No options found' */
23
+ noOptionsFound?: string;
24
+ /** Max height of the dropdown menu, default '25rem' */
25
+ maxHeight?: string;
26
+ }
27
+ interface SearchSelectState<T extends string | number> {
28
+ isOpen: boolean;
29
+ selectedOptions: Option<T>[];
30
+ searchTerm: string;
31
+ options: Option<T>[];
32
+ inputRef: HTMLElement | null;
33
+ dropdownRef: HTMLElement | null;
34
+ focusedIndex: number;
35
+ onchange: any;
36
+ }
37
+ /**
38
+ * Mithril Factory Component for Multi-Select Dropdown with search
39
+ */
40
+ export declare const SearchSelect: <T extends string | number>() => Component<SearchSelectAttributes<T>, SearchSelectState<T>>;
41
+ export {};
package/dist/select.d.ts CHANGED
@@ -1,45 +1,46 @@
1
- /// <reference types="materialize-css" />
2
- import { FactoryComponent, Attributes } from 'mithril';
3
- import { IInputOption } from './option';
4
- export interface ISelectOptions extends Attributes, Partial<M.FormSelectOptions> {
5
- /** Options to select from */
6
- options: IInputOption[];
7
- /** Called when the value is changed, either contains a single or all selected (checked) ids */
8
- onchange: (checkedIds: Array<string | number>) => void;
9
- /**
10
- * Selected id or ids (in case of multiple options). Processed in the oninit and onupdate lifecycle.
11
- * When the checkedId property changes (using a shallow compare), the selections are updated accordingly.
12
- */
13
- checkedId?: string | number | Array<string | number>;
14
- /** Selected id or ids (in case of multiple options). Only processed in the oninit lifecycle. */
15
- initialValue?: string | number | Array<string | number>;
16
- /** Select a single option or multiple options */
17
- multiple?: boolean;
18
- /** Optional label. */
19
- label?: string;
20
- /** Optional ID. */
21
- id?: string;
22
- /** Unique key for use of the element in an array. */
23
- key?: string | number;
24
- /** Add a a placeholder to the input field. */
25
- placeholder?: string;
26
- /** Add a description underneath the input field. */
27
- helperText?: string;
28
- /** Uses Materialize icons as a prefix or postfix. */
29
- iconName?: string;
30
- /** Sets the input field to disabled. */
31
- disabled?: boolean;
32
- /** Optional style information. */
33
- style?: string;
34
- /** If true, break to a new row */
35
- newRow?: boolean;
36
- /**
37
- * If true, add a mandatory * after the label (if any),
38
- * and add the required and aria-required attributes to the input element.
39
- */
40
- isMandatory?: boolean;
41
- /** Add the required and aria-required attributes to the input element */
42
- required?: boolean;
43
- }
44
- /** Component to select from a list of values in a dropdowns */
45
- export declare const Select: FactoryComponent<ISelectOptions>;
1
+ import { Attributes, Component } from 'mithril';
2
+ import { InputOption } from './option';
3
+ export interface SelectAttributes<T extends string | number> extends Attributes {
4
+ /** Options to select from */
5
+ options: InputOption<T>[];
6
+ /** Called when the value is changed, either contains a single or all selected (checked) ids */
7
+ onchange: (checkedIds: T[]) => void;
8
+ /**
9
+ * Selected id or ids (in case of multiple options). Processed in the oninit and onupdate lifecycle.
10
+ * When the checkedId property changes (using a shallow compare), the selections are updated accordingly.
11
+ */
12
+ checkedId?: T | T[];
13
+ /** Selected id or ids (in case of multiple options). Only processed in the oninit lifecycle. */
14
+ initialValue?: T | T[];
15
+ /** Select a single option or multiple options */
16
+ multiple?: boolean;
17
+ /** Optional label. */
18
+ label?: string;
19
+ /** Optional ID. */
20
+ id?: string;
21
+ /** Unique key for use of the element in an array. */
22
+ key?: string | number;
23
+ /** Add a a placeholder to the input field. */
24
+ placeholder?: string;
25
+ /** Add a description underneath the input field. */
26
+ helperText?: string;
27
+ /** Uses Materialize icons as a prefix or postfix. */
28
+ iconName?: string;
29
+ /** Sets the input field to disabled. */
30
+ disabled?: boolean;
31
+ /** Optional style information. */
32
+ style?: string;
33
+ /** If true, break to a new row */
34
+ newRow?: boolean;
35
+ /**
36
+ * If true, add a mandatory * after the label (if any),
37
+ * and add the required and aria-required attributes to the input element.
38
+ */
39
+ isMandatory?: boolean;
40
+ /** Add the required and aria-required attributes to the input element */
41
+ required?: boolean;
42
+ /** Enable the clear icon */
43
+ showClearButton?: boolean;
44
+ }
45
+ /** Select component */
46
+ export declare const Select: <T extends string | number>() => Component<SelectAttributes<T>>;
package/dist/switch.d.ts CHANGED
@@ -1,13 +1,12 @@
1
- import { FactoryComponent } from 'mithril';
2
- import { IInputOptions } from './input-options';
3
- import './styles/switch.css';
4
- export interface ISwitchOptions extends Partial<IInputOptions<boolean>> {
5
- /** Left text label */
6
- left?: string;
7
- /** Right text label */
8
- right?: string;
9
- /** If checked is true, the switch is set in the right position. */
10
- checked?: boolean;
11
- }
12
- /** Component to display a switch with two values. */
13
- export declare const Switch: FactoryComponent<ISwitchOptions>;
1
+ import { FactoryComponent } from 'mithril';
2
+ import { InputAttributes } from './input-options';
3
+ export interface SwitchOptions extends Partial<InputAttributes<boolean>> {
4
+ /** Left text label */
5
+ left?: string;
6
+ /** Right text label */
7
+ right?: string;
8
+ /** If checked is true, the switch is set in the right position. Only processed in oninit. */
9
+ checked?: boolean;
10
+ }
11
+ /** Component to display a switch with two values. */
12
+ export declare const Switch: FactoryComponent<SwitchOptions>;
package/dist/tabs.d.ts CHANGED
@@ -1,45 +1,57 @@
1
- /// <reference types="materialize-css" />
2
- import { Vnode, FactoryComponent, Attributes } from 'mithril';
3
- /**
4
- * Link or anchor target may take 4 values:
5
- * - _blank: Opens the linked document in a new window or tab
6
- * - _self: Opens the linked document in the same frame as it was clicked (this is default)
7
- * - _parent: Opens the linked document in the parent frame
8
- * - _top: Opens the linked document in the full body of the window
9
- */
10
- export declare type AnchorTarget = '_blank' | '_self' | '_parent' | '_top';
11
- export interface ITabItem {
12
- /** Title of the tab */
13
- title: string;
14
- /** Vnode to render: may be empty in case of a using the tab as a hyperlink. */
15
- vnode?: Vnode<any, any>;
16
- /** ID of the tab element. Default the title in lowercase */
17
- id?: string;
18
- /** If the tab should be active */
19
- active?: boolean;
20
- /** If the tab should be disabled */
21
- disabled?: boolean;
22
- /** CSS class for the tab (li), default `.tab.col.s3` */
23
- className?: string;
24
- /** CSS class for the content (li), default `.tab.col.s3` */
25
- contentClass?: string;
26
- /**
27
- * By default, Materialize tabs will ignore their default anchor behaviour.
28
- * To force a tab to behave as a regular hyperlink, just specify the target property of that link.
29
- */
30
- target?: AnchorTarget;
31
- /** Only used in combination with a set target to make the tab act as a regular hyperlink. */
32
- href?: string;
33
- }
34
- export interface ITabs extends Partial<M.TabsOptions>, Attributes {
35
- /** Selected tab id */
36
- selectedTabId?: string;
37
- /**
38
- * Tab width, can be `auto` to use the width of the title,
39
- * `fill` to use all availabe space, or `fixed` to use a column size.
40
- */
41
- tabWidth?: 'auto' | 'fixed' | 'fill';
42
- /** List of tab items */
43
- tabs: ITabItem[];
44
- }
45
- export declare const Tabs: FactoryComponent<ITabs>;
1
+ import { Vnode, FactoryComponent, Attributes } from 'mithril';
2
+ /**
3
+ * Link or anchor target may take 4 values:
4
+ * - _blank: Opens the linked document in a new window or tab
5
+ * - _self: Opens the linked document in the same frame as it was clicked (this is default)
6
+ * - _parent: Opens the linked document in the parent frame
7
+ * - _top: Opens the linked document in the full body of the window
8
+ */
9
+ export type AnchorTarget = '_blank' | '_self' | '_parent' | '_top';
10
+ export interface TabItem {
11
+ /** Title of the tab */
12
+ title: string;
13
+ /** Vnode to render: may be empty in case of a using the tab as a hyperlink. */
14
+ vnode?: Vnode<any, any>;
15
+ /** ID of the tab element. Default the title in lowercase */
16
+ id?: string;
17
+ /** If the tab should be active */
18
+ active?: boolean;
19
+ /** If the tab should be disabled */
20
+ disabled?: boolean;
21
+ /** CSS class for the tab (li), default `.tab.col.s3` */
22
+ className?: string;
23
+ /** CSS class for the content (li), default `.tab.col.s3` */
24
+ contentClass?: string;
25
+ /**
26
+ * By default, Materialize tabs will ignore their default anchor behaviour.
27
+ * To force a tab to behave as a regular hyperlink, just specify the target property of that link.
28
+ */
29
+ target?: AnchorTarget;
30
+ /** Only used in combination with a set target to make the tab act as a regular hyperlink. */
31
+ href?: string;
32
+ }
33
+ export interface TabsOptions {
34
+ /** Duration of tab change animation in ms */
35
+ duration?: number;
36
+ /** Called when a tab is shown */
37
+ onShow?: (tab: HTMLElement) => void;
38
+ /** The maximum width at which tabs switch to swipeable mode */
39
+ responsiveThreshold?: number;
40
+ /** Enable swiping between tabs on mobile */
41
+ swipeable?: boolean;
42
+ }
43
+ export interface TabsAttributes extends TabsOptions, Attributes {
44
+ /** Selected tab id, takes precedence over tab.active property */
45
+ selectedTabId?: string;
46
+ /**
47
+ * Tab width, can be `auto` to use the width of the title,
48
+ * `fill` to use all availabe space, or `fixed` to use a column size.
49
+ */
50
+ tabWidth?: 'auto' | 'fixed' | 'fill';
51
+ /** List of tab items */
52
+ tabs: TabItem[];
53
+ /** Callback when tab changes */
54
+ onTabChange?: (tabId: string) => void;
55
+ }
56
+ /** CSS-only Tabs component - no MaterializeCSS dependencies */
57
+ export declare const Tabs: FactoryComponent<TabsAttributes>;
package/dist/utils.d.ts CHANGED
@@ -1,70 +1,43 @@
1
- import { IInputOptions } from './input-options';
2
- /**
3
- * Create a unique ID
4
- * @see https://stackoverflow.com/a/2117523/319711
5
- *
6
- * @returns id followed by 8 hexadecimal characters.
7
- */
8
- export declare const uniqueId: () => string;
9
- /**
10
- * Create a GUID
11
- * @see https://stackoverflow.com/a/2117523/319711
12
- *
13
- * @returns RFC4122 version 4 compliant GUID
14
- */
15
- export declare const uuid4: () => string;
16
- export declare const compose: <F extends (d: any) => any, T>(...functions: F[]) => (data: T) => T;
17
- export declare const map: <T>(f: (...args: any[]) => any) => (x: T[]) => unknown[];
18
- export declare const join: <T>(seperator: string) => (list: T[]) => string;
19
- /**
20
- * Convert camel case to snake case.
21
- *
22
- * @param {string} cc: Camel case string
23
- */
24
- export declare const camelToSnake: (cc: string) => string;
25
- /** Convert an object to a string of HTML attributes */
26
- export declare const toAttributeString: <T extends {
27
- [key: string]: any;
28
- }>(x?: T | undefined) => "" | T;
29
- /** Add the disabled attribute when required */
30
- export declare const disable: ({ disabled }: {
31
- disabled?: boolean | undefined;
32
- }) => "" | "[disabled]";
33
- /** Add the required and aria-required attribute when required */
34
- export declare const req: ({ required, isMandatory }: {
35
- required?: boolean | undefined;
36
- isMandatory?: boolean | undefined;
37
- }) => "" | "[required][aria-required=true]";
38
- /** Convert input options to a set of input attributes */
39
- export declare const toAttrs: <T>(o: IInputOptions<T>) => string;
40
- /** Check if a string or number is numeric. @see https://stackoverflow.com/a/9716488/319711 */
41
- export declare const isNumeric: (n: string | number) => boolean;
42
- export declare const pipe: (...fncs: ((x: any) => any)[]) => <T>(x: T) => T;
43
- /**
44
- * Pad left, default width 2 with a '0'
45
- *
46
- * @see http://stackoverflow.com/a/10073788/319711
47
- * @param {(string | number)} n
48
- * @param {number} [width=2]
49
- * @param {string} [z='0']
50
- * @returns
51
- */
52
- export declare const padLeft: (n: string | number, width?: number, z?: string) => string;
53
- /**
54
- * Swap two elements at index i and j.
55
- * Mutates the original array.
56
- *
57
- * @param arr array of items
58
- * @param i from index
59
- * @param j to index
60
- */
61
- export declare const swap: <T>(arr: T[], i: number, j: number) => void;
62
- /**
63
- * Move an element at index i to index j.
64
- * Mutates the original array.
65
- *
66
- * @param arr array of items
67
- * @param i from index
68
- * @param j to index
69
- */
70
- export declare const move: <T>(arr: T[], i: number, j: number) => void;
1
+ /**
2
+ * Create a unique ID
3
+ * @see https://stackoverflow.com/a/2117523/319711
4
+ *
5
+ * @returns id followed by 8 hexadecimal characters.
6
+ */
7
+ export declare const uniqueId: () => string;
8
+ /**
9
+ * Create a GUID
10
+ * @see https://stackoverflow.com/a/2117523/319711
11
+ *
12
+ * @returns RFC4122 version 4 compliant GUID
13
+ */
14
+ export declare const uuid4: () => string;
15
+ /** Check if a string or number is numeric. @see https://stackoverflow.com/a/9716488/319711 */
16
+ export declare const isNumeric: (n: string | number) => boolean;
17
+ /**
18
+ * Pad left, default width 2 with a '0'
19
+ *
20
+ * @see http://stackoverflow.com/a/10073788/319711
21
+ * @param {(string | number)} n
22
+ * @param {number} [width=2]
23
+ * @param {string} [z='0']
24
+ * @returns
25
+ */
26
+ export declare const padLeft: (n: string | number, width?: number, z?: string) => string;
27
+ export declare const getDropdownStyles: (inputRef?: HTMLElement | null, overlap?: boolean, options?: {
28
+ /** ID property of the selected item */
29
+ id?: string | number;
30
+ /** Label to show in the dropdown */
31
+ label?: string;
32
+ /** Optional group */
33
+ group?: string;
34
+ /** Can we select the item */
35
+ disabled?: boolean;
36
+ /** Add a divider */
37
+ divider?: boolean;
38
+ }[], isDropDown?: boolean) => any;
39
+ /**
40
+ * Generate a range of numbers from a to and including b, i.e. [a, b]
41
+ * @example: console.log(range(5, 10)); // [5, 6, 7, 8, 9, 10]
42
+ */
43
+ export declare const range: (a: number, b: number) => number[];