mithril-materialized 2.0.0-beta.3 → 2.0.0-beta.5

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.
@@ -1,5 +1,5 @@
1
1
  import { Attributes } from 'mithril';
2
- export interface InputAttributes<T = string> extends Attributes {
2
+ export interface InputAttrs<T = string> extends Attributes {
3
3
  /** Optional label. */
4
4
  label?: string;
5
5
  /** Optional ID. */
package/dist/input.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import m, { FactoryComponent, Attributes } from 'mithril';
2
- import { InputAttributes } from './input-options';
2
+ import { InputAttrs } from './input-options';
3
3
  /** Character counter component that tracks text length against maxLength */
4
4
  export declare const CharacterCounter: FactoryComponent<{
5
5
  currentLength: number;
@@ -7,22 +7,22 @@ export declare const CharacterCounter: FactoryComponent<{
7
7
  show: boolean;
8
8
  }>;
9
9
  /** Create a TextArea */
10
- export declare const TextArea: FactoryComponent<InputAttributes<string>>;
10
+ export declare const TextArea: FactoryComponent<InputAttrs<string>>;
11
11
  export type InputType = 'url' | 'color' | 'text' | 'number' | 'email' | 'range' | 'password';
12
12
  /** Component for entering some text */
13
- export declare const TextInput: m.FactoryComponent<InputAttributes<string>>;
13
+ export declare const TextInput: m.FactoryComponent<InputAttrs<string>>;
14
14
  /** Component for entering a password */
15
- export declare const PasswordInput: m.FactoryComponent<InputAttributes<string>>;
15
+ export declare const PasswordInput: m.FactoryComponent<InputAttrs<string>>;
16
16
  /** Component for entering a number */
17
- export declare const NumberInput: m.FactoryComponent<InputAttributes<number>>;
17
+ export declare const NumberInput: m.FactoryComponent<InputAttrs<number>>;
18
18
  /** Component for entering a URL */
19
- export declare const UrlInput: m.FactoryComponent<InputAttributes<string>>;
19
+ export declare const UrlInput: m.FactoryComponent<InputAttrs<string>>;
20
20
  /** Component for entering a color */
21
- export declare const ColorInput: m.FactoryComponent<InputAttributes<string>>;
21
+ export declare const ColorInput: m.FactoryComponent<InputAttrs<string>>;
22
22
  /** Component for entering a range */
23
- export declare const RangeInput: m.FactoryComponent<InputAttributes<number>>;
23
+ export declare const RangeInput: m.FactoryComponent<InputAttrs<number>>;
24
24
  /** Component for entering an email */
25
- export declare const EmailInput: m.FactoryComponent<InputAttributes<string>>;
25
+ export declare const EmailInput: m.FactoryComponent<InputAttrs<string>>;
26
26
  export interface FileInputAttrs extends Attributes {
27
27
  /** Displayed on the button, @default File */
28
28
  label?: string;
package/dist/label.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { FactoryComponent, Component, Attributes } from 'mithril';
2
2
  export declare const Mandatory: Component;
3
- export interface LabelAttributes extends Attributes {
3
+ export interface LabelAttrs extends Attributes {
4
4
  /** Optional title/label */
5
5
  label?: string;
6
6
  /** Optional ID */
@@ -11,7 +11,7 @@ export interface LabelAttributes extends Attributes {
11
11
  isActive?: boolean | string;
12
12
  }
13
13
  /** Simple label element, used for most components. */
14
- export declare const Label: FactoryComponent<LabelAttributes>;
14
+ export declare const Label: FactoryComponent<LabelAttrs>;
15
15
  export interface HelperTextOptions extends Attributes {
16
16
  helperText?: string;
17
17
  dataError?: string;
@@ -13,7 +13,7 @@ export interface MaterialBoxOptions {
13
13
  /** Callback when materialbox closing animation is complete */
14
14
  onCloseEnd?: () => void;
15
15
  }
16
- export interface MaterialBoxAttributes extends MaterialBoxOptions, Attributes {
16
+ export interface MaterialBoxAttrs extends MaterialBoxOptions, Attributes {
17
17
  /** Source image path */
18
18
  src: string;
19
19
  /** Alt text for the image */
@@ -35,4 +35,4 @@ export interface MaterialBoxAttributes extends MaterialBoxOptions, Attributes {
35
35
  * Pure TypeScript MaterialBox - creates an image lightbox that fills the screen when clicked
36
36
  * No MaterializeCSS dependencies
37
37
  */
38
- export declare const MaterialBox: FactoryComponent<MaterialBoxAttributes>;
38
+ export declare const MaterialBox: FactoryComponent<MaterialBoxAttrs>;
package/dist/modal.d.ts CHANGED
@@ -3,7 +3,7 @@ export interface ModalState {
3
3
  isOpen: boolean;
4
4
  id: string;
5
5
  }
6
- export interface ModalAttributes extends Attributes {
6
+ export interface ModalAttrs extends Attributes {
7
7
  id: string;
8
8
  title: string;
9
9
  description?: string | Vnode<any, any>;
@@ -38,4 +38,4 @@ export interface ModalAttributes extends Attributes {
38
38
  * CSS-only Modal Panel component - no JavaScript dependencies
39
39
  * Uses modern CSS techniques for modal functionality
40
40
  */
41
- export declare const ModalPanel: FactoryComponent<ModalAttributes>;
41
+ export declare const ModalPanel: FactoryComponent<ModalAttrs>;
package/dist/option.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Vnode, FactoryComponent, Attributes, Component } from 'mithril';
2
- export interface InputCheckboxAttributes extends Attributes {
2
+ export interface InputCheckboxAttrs extends Attributes {
3
3
  /** Optional event handler when a checkbox is clicked */
4
4
  onchange?: (checked: boolean) => void;
5
5
  /** Label of the checkbox, can be a string or Vnode */
@@ -12,7 +12,7 @@ export interface InputCheckboxAttributes extends Attributes {
12
12
  inputId?: string;
13
13
  }
14
14
  /** Component to show a check box */
15
- export declare const InputCheckbox: FactoryComponent<InputCheckboxAttributes>;
15
+ export declare const InputCheckbox: FactoryComponent<InputCheckboxAttrs>;
16
16
  export interface InputOption<T extends string | number> {
17
17
  /** Option ID */
18
18
  id: T;
@@ -31,7 +31,7 @@ export interface InputOption<T extends string | number> {
31
31
  /** Optional description */
32
32
  description?: string;
33
33
  }
34
- export interface OptionsAttributes<T extends string | number> extends Attributes {
34
+ export interface OptionsAttrs<T extends string | number> extends Attributes {
35
35
  /** Element ID */
36
36
  id?: string;
37
37
  /** Optional title or label */
@@ -58,4 +58,4 @@ export interface OptionsAttributes<T extends string | number> extends Attributes
58
58
  showSelectAll?: boolean;
59
59
  }
60
60
  /** A list of checkboxes */
61
- export declare const Options: <T extends string | number>() => Component<OptionsAttributes<T>>;
61
+ export declare const Options: <T extends string | number>() => Component<OptionsAttrs<T>>;
@@ -3,7 +3,7 @@ export interface PaginationItem extends Attributes {
3
3
  href: string;
4
4
  disabled?: boolean;
5
5
  }
6
- export interface PaginationAttributes extends Attributes {
6
+ export interface PaginationAttrs extends Attributes {
7
7
  /**
8
8
  * How many items do we show
9
9
  * @default 9 or items.length, whatever is the smallest
@@ -13,4 +13,4 @@ export interface PaginationAttributes extends Attributes {
13
13
  curPage?: number;
14
14
  items: PaginationItem[];
15
15
  }
16
- export declare const Pagination: FactoryComponent<PaginationAttributes>;
16
+ export declare const Pagination: FactoryComponent<PaginationAttrs>;
@@ -1,5 +1,5 @@
1
1
  import { FactoryComponent, Attributes } from 'mithril';
2
- export interface ParallaxAttributes extends Attributes {
2
+ export interface ParallaxAttrs extends Attributes {
3
3
  /** Enable responsive parallax (disable on mobile for performance) */
4
4
  responsiveThreshold?: number;
5
5
  /** Image source */
@@ -11,4 +11,4 @@ export interface ParallaxAttributes extends Attributes {
11
11
  * MaterializeCSS Parallax component with dynamic positioning
12
12
  * Port of the original MaterializeCSS parallax logic
13
13
  */
14
- export declare const Parallax: FactoryComponent<ParallaxAttributes>;
14
+ export declare const Parallax: FactoryComponent<ParallaxAttrs>;
@@ -0,0 +1,32 @@
1
+ import { FactoryComponent, Attributes } from 'mithril';
2
+ export interface PushpinOptions {
3
+ /** Distance from top of page where element becomes fixed */
4
+ top?: number;
5
+ /** Distance from bottom of page where element stops being fixed */
6
+ bottom?: number;
7
+ /** Offset for calculations */
8
+ offset?: number;
9
+ /** Called when pushpin position changes */
10
+ onPositionChange?: (position: 'pin-top' | 'pinned' | 'pin-bottom') => void;
11
+ }
12
+ export declare class Pushpin {
13
+ el: HTMLElement;
14
+ options: Required<PushpinOptions>;
15
+ private state;
16
+ private static defaults;
17
+ private _updateElementPositionBound;
18
+ constructor(el: HTMLElement, options?: PushpinOptions);
19
+ static getInstance(el: HTMLElement): Pushpin | undefined;
20
+ destroy(): void;
21
+ _setupEventHandlers(): void;
22
+ _removeEventHandlers(): void;
23
+ _updateElementPosition(): void;
24
+ _removePinClasses(): void;
25
+ _updatePosition(): void;
26
+ }
27
+ export interface PushpinAttrs extends Attributes, PushpinOptions {
28
+ /** Element selector or reference to attach pushpin to */
29
+ targetSelector?: string;
30
+ }
31
+ export declare const PushpinComponent: FactoryComponent<PushpinAttrs>;
32
+ export declare const initPushpins: (selector?: string, options?: PushpinOptions) => Pushpin[];
package/dist/radio.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Attributes, Component } from 'mithril';
2
2
  import { InputOption } from './option';
3
- export interface RadioButtonsAttributes<T extends string | number> extends Attributes {
3
+ export interface RadioButtonsAttrs<T extends string | number> extends Attributes {
4
4
  /** Element ID */
5
5
  id?: string;
6
6
  /** Optional title or label */
@@ -26,7 +26,7 @@ export interface RadioButtonsAttributes<T extends string | number> extends Attri
26
26
  /** Layout for the options: 'vertical' (default) or 'horizontal' */
27
27
  layout?: 'vertical' | 'horizontal';
28
28
  }
29
- export interface RadioButtonAttributes<T extends string | number> extends Attributes {
29
+ export interface RadioButtonAttrs<T extends string | number> extends Attributes {
30
30
  id: T;
31
31
  checked?: boolean;
32
32
  onchange: (id: T) => void;
@@ -36,6 +36,6 @@ export interface RadioButtonAttributes<T extends string | number> extends Attrib
36
36
  /** Optional input id for the radio button */
37
37
  inputId?: string;
38
38
  }
39
- export declare const RadioButton: <T extends string | number>() => Component<RadioButtonAttributes<T>>;
39
+ export declare const RadioButton: <T extends string | number>() => Component<RadioButtonAttrs<T>>;
40
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>>;
41
+ export declare const RadioButtons: <T extends string | number>() => Component<RadioButtonsAttrs<T>>;
@@ -4,7 +4,7 @@ export interface Option<T extends string | number> {
4
4
  label?: string;
5
5
  disabled?: boolean;
6
6
  }
7
- export interface SearchSelectAttributes<T extends string | number> extends Attributes {
7
+ export interface SearchSelectAttrs<T extends string | number> extends Attributes {
8
8
  /** Options to display in the select */
9
9
  options?: Option<T>[];
10
10
  /** Initial value */
@@ -37,5 +37,5 @@ interface SearchSelectState<T extends string | number> {
37
37
  /**
38
38
  * Mithril Factory Component for Multi-Select Dropdown with search
39
39
  */
40
- export declare const SearchSelect: <T extends string | number>() => Component<SearchSelectAttributes<T>, SearchSelectState<T>>;
40
+ export declare const SearchSelect: <T extends string | number>() => Component<SearchSelectAttrs<T>, SearchSelectState<T>>;
41
41
  export {};
package/dist/select.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Attributes, Component } from 'mithril';
2
2
  import { InputOption } from './option';
3
- export interface SelectAttributes<T extends string | number> extends Attributes {
3
+ export interface SelectAttrs<T extends string | number> extends Attributes {
4
4
  /** Options to select from */
5
5
  options: InputOption<T>[];
6
6
  /** Called when the value is changed, either contains a single or all selected (checked) ids */
@@ -43,4 +43,4 @@ export interface SelectAttributes<T extends string | number> extends Attributes
43
43
  showClearButton?: boolean;
44
44
  }
45
45
  /** Select component */
46
- export declare const Select: <T extends string | number>() => Component<SelectAttributes<T>>;
46
+ export declare const Select: <T extends string | number>() => Component<SelectAttrs<T>>;
package/dist/switch.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { FactoryComponent } from 'mithril';
2
- import { InputAttributes } from './input-options';
3
- export interface SwitchOptions extends Partial<InputAttributes<boolean>> {
2
+ import { InputAttrs } from './input-options';
3
+ export interface SwitchOptions extends Partial<InputAttrs<boolean>> {
4
4
  /** Left text label */
5
5
  left?: string;
6
6
  /** Right text label */
package/dist/tabs.d.ts CHANGED
@@ -40,7 +40,7 @@ export interface TabsOptions {
40
40
  /** Enable swiping between tabs on mobile */
41
41
  swipeable?: boolean;
42
42
  }
43
- export interface TabsAttributes extends TabsOptions, Attributes {
43
+ export interface TabsAttrs extends TabsOptions, Attributes {
44
44
  /** Selected tab id, takes precedence over tab.active property */
45
45
  selectedTabId?: string;
46
46
  /**
@@ -54,4 +54,4 @@ export interface TabsAttributes extends TabsOptions, Attributes {
54
54
  onTabChange?: (tabId: string) => void;
55
55
  }
56
56
  /** CSS-only Tabs component - no MaterializeCSS dependencies */
57
- export declare const Tabs: FactoryComponent<TabsAttributes>;
57
+ export declare const Tabs: FactoryComponent<TabsAttrs>;
@@ -0,0 +1,42 @@
1
+ import { FactoryComponent } from 'mithril';
2
+ import { InputAttrs } from './input-options';
3
+ export interface TimepickerI18n {
4
+ cancel?: string;
5
+ clear?: string;
6
+ done?: string;
7
+ }
8
+ export interface TimepickerOptions {
9
+ dialRadius?: number;
10
+ outerRadius?: number;
11
+ innerRadius?: number;
12
+ tickRadius?: number;
13
+ duration?: number;
14
+ container?: string | null;
15
+ defaultTime?: string;
16
+ fromNow?: number;
17
+ showClearBtn?: boolean;
18
+ i18n?: TimepickerI18n;
19
+ autoClose?: boolean;
20
+ twelveHour?: boolean;
21
+ vibrate?: boolean;
22
+ onOpen?: () => void;
23
+ onOpenStart?: () => void;
24
+ onOpenEnd?: () => void;
25
+ onCloseStart?: () => void;
26
+ onCloseEnd?: () => void;
27
+ onSelect?: (hour: number, minute: number) => void;
28
+ }
29
+ export interface TimePickerAttrs extends InputAttrs<string>, TimepickerOptions {
30
+ /** Use inline mode (HTML5 time input) instead of modal, default true */
31
+ useModal?: boolean;
32
+ /** Allow format toggle between 12h/24h (for inline mode) */
33
+ allowFormatToggle?: boolean;
34
+ /** Clear button label */
35
+ clearLabel?: string;
36
+ /** Close button label */
37
+ closeLabel?: string;
38
+ }
39
+ /**
40
+ * TimePicker component based on original Materialize CSS timepicker
41
+ */
42
+ export declare const TimePicker: FactoryComponent<TimePickerAttrs>;
@@ -0,0 +1,45 @@
1
+ import { FactoryComponent } from 'mithril';
2
+ export interface ToastOptions {
3
+ /** HTML content for the toast */
4
+ html?: string;
5
+ /** Display length in milliseconds */
6
+ displayLength?: number;
7
+ /** Animation in duration in milliseconds */
8
+ inDuration?: number;
9
+ /** Animation out duration in milliseconds */
10
+ outDuration?: number;
11
+ /** Additional CSS classes */
12
+ classes?: string;
13
+ /** Callback function called when toast is dismissed */
14
+ completeCallback?: () => void;
15
+ /** Activation percentage for swipe dismissal */
16
+ activationPercent?: number;
17
+ }
18
+ export declare class Toast {
19
+ el: HTMLElement;
20
+ options: Required<ToastOptions>;
21
+ private state;
22
+ private static _toasts;
23
+ private static _container;
24
+ private static _draggedToast;
25
+ private static defaults;
26
+ constructor(options?: ToastOptions);
27
+ static getInstance(el: HTMLElement): Toast | undefined;
28
+ static _createContainer(): void;
29
+ static _removeContainer(): void;
30
+ static _onDragStart: (e: Event) => void;
31
+ static _onDragMove: (e: Event) => void;
32
+ static _onDragEnd: () => void;
33
+ static _xPos(e: Event): number;
34
+ static dismissAll(): void;
35
+ _createToast(): HTMLElement;
36
+ _animateIn(): void;
37
+ _setTimer(): void;
38
+ dismiss(): void;
39
+ }
40
+ export declare const toast: (options: ToastOptions) => Toast;
41
+ export interface ToastComponentAttrs extends ToastOptions {
42
+ /** Whether to show the toast */
43
+ show?: boolean;
44
+ }
45
+ export declare const ToastComponent: FactoryComponent<ToastComponentAttrs>;
@@ -0,0 +1,59 @@
1
+ import { FactoryComponent, Attributes } from 'mithril';
2
+ export interface TooltipOptions {
3
+ /** Delay before tooltip appears on hover */
4
+ enterDelay?: number;
5
+ /** Delay before tooltip disappears after hover ends */
6
+ exitDelay?: number;
7
+ /** HTML content for the tooltip */
8
+ html?: string | null;
9
+ /** Margin from element */
10
+ margin?: number;
11
+ /** Animation in duration */
12
+ inDuration?: number;
13
+ /** Animation out duration */
14
+ outDuration?: number;
15
+ /** Position of tooltip */
16
+ position?: 'top' | 'bottom' | 'left' | 'right';
17
+ /** Movement during transition */
18
+ transitionMovement?: number;
19
+ }
20
+ export declare class Tooltip {
21
+ el: HTMLElement;
22
+ tooltipEl: HTMLElement;
23
+ options: Required<TooltipOptions>;
24
+ private state;
25
+ private static defaults;
26
+ private _handleMouseEnterBound;
27
+ private _handleMouseLeaveBound;
28
+ private _handleFocusBound;
29
+ private _handleBlurBound;
30
+ constructor(el: HTMLElement, options?: TooltipOptions);
31
+ static getInstance(el: HTMLElement): Tooltip | undefined;
32
+ destroy(): void;
33
+ _appendTooltipEl(): void;
34
+ _updateTooltipContent(): void;
35
+ _setupEventHandlers(): void;
36
+ _removeEventHandlers(): void;
37
+ open(isManual?: boolean): void;
38
+ close(): void;
39
+ _setExitDelayTimeout(): void;
40
+ _setEnterDelayTimeout(isManual: boolean): void;
41
+ _positionTooltip(): void;
42
+ _repositionWithinScreen(x: number, y: number, width: number, height: number): {
43
+ x: number;
44
+ y: number;
45
+ };
46
+ _animateIn(): void;
47
+ _animateOut(): void;
48
+ _handleMouseEnter(): void;
49
+ _handleMouseLeave(): void;
50
+ _handleFocus(): void;
51
+ _handleBlur(): void;
52
+ _getAttributeOptions(): Partial<TooltipOptions>;
53
+ }
54
+ export interface TooltipComponentAttrs extends Attributes, TooltipOptions {
55
+ /** Element selector or reference to attach tooltip to */
56
+ targetSelector?: string;
57
+ }
58
+ export declare const TooltipComponent: FactoryComponent<TooltipComponentAttrs>;
59
+ export declare const initTooltips: (selector?: string, options?: TooltipOptions) => Tooltip[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mithril-materialized",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.5",
4
4
  "description": "A materialize library for mithril.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -19,6 +19,7 @@
19
19
  "./esm": "./dist/index.esm.js",
20
20
  "./umd": "./dist/index.umd.js",
21
21
  "./index.css": "./dist/index.css",
22
+ "./index.min.css": "./dist/index.min.css",
22
23
  "./sass/*": "./sass/*"
23
24
  },
24
25
  "sideEffects": false,
@@ -27,7 +28,8 @@
27
28
  "sass"
28
29
  ],
29
30
  "scripts": {
30
- "build": "rollup -c rollup.config.mjs",
31
+ "build": "rollup -c rollup.config.mjs && npm run build:css-min",
32
+ "build:css-min": "sass --no-source-map --style=compressed ./src/index.scss ./dist/index.min.css",
31
33
  "dev": "rollup -c rollup.config.mjs -w",
32
34
  "start": "npm run dev",
33
35
  "clean": "rimraf dist node_modules/.cache",
@@ -146,6 +146,10 @@
146
146
  width: 280px;
147
147
  font-size: 1rem;
148
148
  margin: 0 auto;
149
+
150
+ &.with-week-numbers {
151
+ width: 310px;
152
+ }
149
153
 
150
154
  thead {
151
155
  border-bottom: none;
@@ -154,6 +158,14 @@
154
158
  th {
155
159
  padding: 10px 5px;
156
160
  text-align: center;
161
+
162
+ &.datepicker-week-header {
163
+ color: rgba(0, 0, 0, 0.38);
164
+ font-size: 0.8rem;
165
+ font-weight: 600;
166
+ width: 30px;
167
+ padding: 10px 2px;
168
+ }
157
169
  }
158
170
 
159
171
  tr {
@@ -181,15 +193,28 @@
181
193
  pointer-events: none;
182
194
  }
183
195
 
196
+ &.datepicker-week-number {
197
+ color: rgba(0, 0, 0, 0.38);
198
+ font-size: 0.8rem;
199
+ font-weight: 600;
200
+ text-align: center;
201
+ vertical-align: middle;
202
+ border-radius: 0;
203
+ width: 30px;
204
+ padding: 5px 2px;
205
+ background-color: rgba(0, 0, 0, 0.02);
206
+ border-right: 1px solid rgba(0, 0, 0, 0.05);
207
+ }
208
+
184
209
  border-radius: 50%;
185
210
  padding: 0;
186
211
  }
187
212
  }
188
213
 
189
214
  .datepicker-day-button {
190
- &:focus {
191
- background-color: #eee;
192
- }
215
+ // &:focus {
216
+ // background-color: #eee;
217
+ // }
193
218
 
194
219
  background-color: transparent;
195
220
  border: none;
@@ -244,6 +269,10 @@
244
269
  .datepicker-footer {
245
270
  width: 320px;
246
271
  }
272
+
273
+ .datepicker-table.with-week-numbers {
274
+ width: 350px;
275
+ }
247
276
 
248
277
  .datepicker-day-button {
249
278
  line-height: 44px;