mithril-materialized 2.0.0-beta.2 → 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,6 +1,6 @@
1
1
  import { FactoryComponent } from 'mithril';
2
- import { InputAttributes } from './input-options';
3
- export interface AutoCompleteAttributes extends InputAttributes<string> {
2
+ import { InputAttrs } from './input-options';
3
+ export interface AutoCompleteAttrs extends InputAttrs<string> {
4
4
  /** The data object defining the autocomplete options */
5
5
  data?: Record<string, string | null>;
6
6
  /** Limit of how many options are shown. Default: Infinity */
@@ -11,4 +11,4 @@ export interface AutoCompleteAttributes extends InputAttributes<string> {
11
11
  onAutocomplete?: (value: string) => void;
12
12
  }
13
13
  /** Component to auto complete your text input - Pure Mithril implementation */
14
- export declare const Autocomplete: FactoryComponent<AutoCompleteAttributes>;
14
+ export declare const Autocomplete: FactoryComponent<AutoCompleteAttrs>;
package/dist/button.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import m, { FactoryComponent, Attributes } from 'mithril';
2
- export interface HtmlAttributes {
2
+ export interface HtmlAttrs {
3
3
  id?: string;
4
4
  for?: string;
5
5
  placeholder?: string;
@@ -7,7 +7,7 @@ export interface HtmlAttributes {
7
7
  disabled?: boolean;
8
8
  type?: 'submit' | 'button' | 'text' | 'textarea' | 'number';
9
9
  }
10
- export interface ButtonAttributes extends Attributes {
10
+ export interface ButtonAttrs extends Attributes {
11
11
  /** Optional (e.g. in case you only want to use an icon) button label */
12
12
  label?: string;
13
13
  /** Optional icon material-icons name, @see https://materializecss.com/icons.html */
@@ -20,7 +20,7 @@ export interface ButtonAttributes extends Attributes {
20
20
  */
21
21
  modalId?: string;
22
22
  /** Some additional HTML attributes that can be attached to the button */
23
- attr?: HtmlAttributes;
23
+ attr?: HtmlAttrs;
24
24
  /** Optional text-based tooltip, @see https://materializecss.com/tooltips.html */
25
25
  tooltip?: string;
26
26
  /** Optional location for the tooltip */
@@ -31,10 +31,10 @@ export interface ButtonAttributes extends Attributes {
31
31
  *
32
32
  * @example FlatButton = ButtonFactory('a.waves-effect.waves-teal.btn-flat');
33
33
  */
34
- export declare const ButtonFactory: (element: string, defaultClassNames: string, type?: string) => FactoryComponent<ButtonAttributes>;
35
- export declare const Button: m.FactoryComponent<ButtonAttributes>;
36
- export declare const LargeButton: m.FactoryComponent<ButtonAttributes>;
37
- export declare const SmallButton: m.FactoryComponent<ButtonAttributes>;
38
- export declare const FlatButton: m.FactoryComponent<ButtonAttributes>;
39
- export declare const RoundIconButton: m.FactoryComponent<ButtonAttributes>;
40
- export declare const SubmitButton: m.FactoryComponent<ButtonAttributes>;
34
+ export declare const ButtonFactory: (element: string, defaultClassNames: string, type?: string) => FactoryComponent<ButtonAttrs>;
35
+ export declare const Button: m.FactoryComponent<ButtonAttrs>;
36
+ export declare const LargeButton: m.FactoryComponent<ButtonAttrs>;
37
+ export declare const SmallButton: m.FactoryComponent<ButtonAttrs>;
38
+ export declare const FlatButton: m.FactoryComponent<ButtonAttrs>;
39
+ export declare const RoundIconButton: m.FactoryComponent<ButtonAttrs>;
40
+ export declare const SubmitButton: m.FactoryComponent<ButtonAttrs>;
@@ -25,7 +25,7 @@ export interface CarouselOptions {
25
25
  /** Don't wrap around and cycle through items */
26
26
  noWrap?: boolean;
27
27
  }
28
- export interface CarouselAttributes extends CarouselOptions, Attributes {
28
+ export interface CarouselAttrs extends CarouselOptions, Attributes {
29
29
  /** The list of images */
30
30
  items: CarouselItem[];
31
31
  /** Called when carousel item changes */
@@ -35,4 +35,4 @@ export interface CarouselAttributes extends CarouselOptions, Attributes {
35
35
  * Materialize CSS Carousel component with dynamic positioning
36
36
  * Port of the original MaterializeCSS carousel logic
37
37
  */
38
- export declare const Carousel: FactoryComponent<CarouselAttributes>;
38
+ export declare const Carousel: FactoryComponent<CarouselAttrs>;
package/dist/chip.d.ts CHANGED
@@ -7,7 +7,7 @@ export interface ChipData {
7
7
  export interface AutocompleteOption extends ChipData {
8
8
  value?: string;
9
9
  }
10
- export interface ChipsAttributes {
10
+ export interface ChipsAttrs {
11
11
  id?: string;
12
12
  data?: ChipData[];
13
13
  placeholder?: string;
@@ -28,4 +28,4 @@ export interface ChipsAttributes {
28
28
  onChipDelete?: (chip: ChipData) => void;
29
29
  onChipSelect?: (chip: ChipData) => void;
30
30
  }
31
- export declare const Chips: m.FactoryComponent<ChipsAttributes>;
31
+ export declare const Chips: m.FactoryComponent<ChipsAttrs>;
@@ -1,8 +1,8 @@
1
1
  import { FactoryComponent, Attributes } from 'mithril';
2
- export interface CodeBlockAttributes extends Attributes {
2
+ export interface CodeBlockAttrs extends Attributes {
3
3
  language?: string;
4
4
  code: string | string[];
5
5
  newRow?: boolean;
6
6
  }
7
7
  /** A simple code block without syntax high-lighting */
8
- export declare const CodeBlock: FactoryComponent<CodeBlockAttributes>;
8
+ export declare const CodeBlock: FactoryComponent<CodeBlockAttrs>;
@@ -9,7 +9,7 @@ export interface CollapsibleItem extends Attributes {
9
9
  /** Add an material icon in front of the header. */
10
10
  iconName?: string;
11
11
  }
12
- export interface CollapsibleAttributes extends Attributes {
12
+ export interface CollapsibleAttrs extends Attributes {
13
13
  /** The list of accordeon/collabsible items */
14
14
  items: CollapsibleItem[];
15
15
  /** If true, only one item can be expanded at a time (accordion mode) */
@@ -23,4 +23,4 @@ export declare const CollapsibleItem: FactoryComponent<CollapsibleItem & {
23
23
  * Creates a collabsible or accordion component with pure CSS/Mithril implementation.
24
24
  * No MaterializeCSS JavaScript dependencies.
25
25
  */
26
- export declare const Collapsible: FactoryComponent<CollapsibleAttributes>;
26
+ export declare const Collapsible: FactoryComponent<CollapsibleAttrs>;
@@ -26,7 +26,7 @@ export interface CollectionItem {
26
26
  /** Any other virtual element properties, including attributes and event handlers. */
27
27
  [property: string]: any;
28
28
  }
29
- export interface CollectionAttributes extends Attributes {
29
+ export interface CollectionAttrs extends Attributes {
30
30
  /** Optional header */
31
31
  header?: string;
32
32
  /** The list of items */
@@ -46,4 +46,4 @@ export declare const AnchorItem: FactoryComponent<{
46
46
  * Creates a Collection of items, optionally containing links, headers, secondary content or avatars.
47
47
  * @see https://materializecss.com/collections.html
48
48
  */
49
- export declare const Collection: FactoryComponent<CollectionAttributes>;
49
+ export declare const Collection: FactoryComponent<CollectionAttrs>;
@@ -0,0 +1,66 @@
1
+ import { FactoryComponent } from 'mithril';
2
+ import { InputAttrs } 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
+ /** Show week numbers */
41
+ showWeekNumbers?: boolean;
42
+ /** Week numbering system: 'iso' (ISO 8601) or 'local' (local convention) */
43
+ weekNumbering?: 'iso' | 'local';
44
+ /** Internationalization */
45
+ i18n?: DatePickerI18n;
46
+ /** Callback when date is selected */
47
+ onSelect?: (date: Date) => void;
48
+ /** Callback when picker is opened */
49
+ onOpen?: () => void;
50
+ /** Callback when picker is closed */
51
+ onClose?: () => void;
52
+ }
53
+ export interface DatePickerAttrs extends InputAttrs<string>, DatePickerOptions {
54
+ /** Date format attribute (alternative to format property) */
55
+ format?: string;
56
+ /** Year range attribute (alternative to yearRange property) */
57
+ yearrange?: string;
58
+ /** Legacy: Date label (use label instead) */
59
+ dateLabel?: string;
60
+ /** Legacy: Display format (use format instead) */
61
+ displayFormat?: string;
62
+ }
63
+ /**
64
+ * Enhanced DatePicker component based on Materialize CSS datepicker
65
+ */
66
+ export declare const DatePicker: FactoryComponent<DatePickerAttrs>;
@@ -11,7 +11,7 @@ export interface DropdownItem<T extends string | number> {
11
11
  /** Add a divider */
12
12
  divider?: boolean;
13
13
  }
14
- export interface DropdownAttributes<T extends string | number> extends Attributes {
14
+ export interface DropdownAttrs<T extends string | number> extends Attributes {
15
15
  /**
16
16
  * Optional id of the dropdown element
17
17
  * @default 'dropdown'
@@ -42,4 +42,4 @@ export interface DropdownAttributes<T extends string | number> extends Attribute
42
42
  helperText?: string;
43
43
  }
44
44
  /** Pure TypeScript Dropdown component - no Materialize dependencies */
45
- export declare const Dropdown: <T extends string | number>() => Component<DropdownAttributes<T>>;
45
+ export declare const Dropdown: <T extends string | number>() => Component<DropdownAttrs<T>>;
@@ -1,5 +1,5 @@
1
1
  import { FactoryComponent } from 'mithril';
2
- export interface FloatingActionButtonAttributes {
2
+ export interface FloatingActionButtonAttrs {
3
3
  /** Optional classes to add to the top element */
4
4
  className?: string;
5
5
  /** Optional style to add to the top element, e.g. for positioning it inline */
@@ -34,4 +34,4 @@ export interface FloatingActionButtonAttributes {
34
34
  /**
35
35
  * Floating Action Button
36
36
  */
37
- export declare const FloatingActionButton: FactoryComponent<FloatingActionButtonAttributes>;
37
+ export declare const FloatingActionButton: FactoryComponent<FloatingActionButtonAttrs>;
package/dist/index.css CHANGED
@@ -7734,6 +7734,9 @@ label {
7734
7734
  font-size: 1rem;
7735
7735
  margin: 0 auto;
7736
7736
  }
7737
+ .datepicker-table.with-week-numbers {
7738
+ width: 310px;
7739
+ }
7737
7740
  .datepicker-table thead {
7738
7741
  border-bottom: none;
7739
7742
  }
@@ -7741,6 +7744,13 @@ label {
7741
7744
  padding: 10px 5px;
7742
7745
  text-align: center;
7743
7746
  }
7747
+ .datepicker-table th.datepicker-week-header {
7748
+ color: rgba(0, 0, 0, 0.38);
7749
+ font-size: 0.8rem;
7750
+ font-weight: 600;
7751
+ width: 30px;
7752
+ padding: 10px 2px;
7753
+ }
7744
7754
  .datepicker-table tr {
7745
7755
  border: none;
7746
7756
  }
@@ -7763,6 +7773,18 @@ label {
7763
7773
  color: rgba(0, 0, 0, 0.3);
7764
7774
  pointer-events: none;
7765
7775
  }
7776
+ .datepicker-table td.datepicker-week-number {
7777
+ color: rgba(0, 0, 0, 0.38);
7778
+ font-size: 0.8rem;
7779
+ font-weight: 600;
7780
+ text-align: center;
7781
+ vertical-align: middle;
7782
+ border-radius: 0;
7783
+ width: 30px;
7784
+ padding: 5px 2px;
7785
+ background-color: rgba(0, 0, 0, 0.02);
7786
+ border-right: 1px solid rgba(0, 0, 0, 0.05);
7787
+ }
7766
7788
 
7767
7789
  .datepicker-day-button {
7768
7790
  background-color: transparent;
@@ -7775,9 +7797,6 @@ label {
7775
7797
  cursor: pointer;
7776
7798
  color: inherit;
7777
7799
  }
7778
- .datepicker-day-button:focus {
7779
- background-color: #eee;
7780
- }
7781
7800
 
7782
7801
  /* Footer */
7783
7802
  .datepicker-footer {
@@ -7816,6 +7835,9 @@ label {
7816
7835
  .datepicker-footer {
7817
7836
  width: 320px;
7818
7837
  }
7838
+ .datepicker-table.with-week-numbers {
7839
+ width: 350px;
7840
+ }
7819
7841
  .datepicker-day-button {
7820
7842
  line-height: 44px;
7821
7843
  }
@@ -7887,82 +7909,188 @@ label {
7887
7909
  min-width: auto;
7888
7910
  }
7889
7911
 
7912
+ /* Timepicker Containers */
7890
7913
  .timepicker-modal {
7891
- position: fixed;
7892
- top: 0;
7893
- left: 0;
7894
- width: 100%;
7895
- height: 100%;
7896
- background-color: rgba(0, 0, 0, 0.5);
7914
+ max-width: 325px;
7915
+ max-height: none;
7916
+ }
7917
+
7918
+ .timepicker-container.modal-content {
7897
7919
  display: flex;
7898
- align-items: center;
7899
- justify-content: center;
7900
- z-index: 1000;
7920
+ flex-direction: column;
7921
+ padding: 0;
7901
7922
  }
7902
- .timepicker-modal .timepicker-content {
7903
- background: white;
7904
- border-radius: 8px;
7905
- padding: 24px;
7906
- min-width: 320px;
7907
- max-width: 400px;
7908
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
7923
+
7924
+ .text-primary {
7925
+ color: rgb(255, 255, 255);
7909
7926
  }
7910
- .timepicker-modal .timepicker-content .modal-header {
7911
- display: flex;
7912
- justify-content: space-between;
7913
- align-items: center;
7914
- margin-bottom: 20px;
7927
+
7928
+ /* Clock Digital Display */
7929
+ .timepicker-digital-display {
7930
+ flex: 1 auto;
7931
+ background-color: #26a69a;
7932
+ padding: 10px;
7933
+ font-weight: 300;
7915
7934
  }
7916
- .timepicker-modal .timepicker-content .modal-header h5 {
7917
- margin: 0;
7935
+
7936
+ .timepicker-text-container {
7937
+ font-size: 4rem;
7938
+ font-weight: bold;
7939
+ text-align: center;
7940
+ color: rgba(255, 255, 255, 0.6);
7941
+ font-weight: 400;
7942
+ position: relative;
7943
+ -webkit-user-select: none;
7944
+ -moz-user-select: none;
7945
+ user-select: none;
7918
7946
  }
7919
- .timepicker-modal .timepicker-content .modal-header .btn-flat {
7920
- padding: 4px 8px;
7921
- font-size: 11px;
7922
- min-width: auto;
7947
+
7948
+ .timepicker-span-hours,
7949
+ .timepicker-span-minutes,
7950
+ .timepicker-span-am-pm div {
7951
+ cursor: pointer;
7923
7952
  }
7924
- .timepicker-modal .timepicker-content .modal-header .btn-flat i.material-icons {
7925
- font-size: 14px;
7926
- margin-right: 4px;
7953
+
7954
+ .timepicker-span-hours {
7955
+ margin-right: 3px;
7927
7956
  }
7928
- .timepicker-modal .timepicker-content .time-display {
7929
- display: flex;
7930
- align-items: center;
7931
- justify-content: center;
7932
- gap: 8px;
7933
- margin-bottom: 24px;
7934
- font-size: 2.5rem;
7935
- font-weight: 300;
7957
+
7958
+ .timepicker-span-minutes {
7959
+ margin-left: 3px;
7936
7960
  }
7937
- .timepicker-modal .timepicker-content .time-display input[type=number] {
7938
- width: 80px;
7961
+
7962
+ .timepicker-display-am-pm {
7963
+ font-size: 1.3rem;
7964
+ position: absolute;
7965
+ right: 1rem;
7966
+ bottom: 1rem;
7967
+ font-weight: 400;
7968
+ }
7969
+
7970
+ /* Analog Clock Display */
7971
+ .timepicker-analog-display {
7972
+ flex: 2.5 auto;
7973
+ }
7974
+
7975
+ .timepicker-plate {
7976
+ background-color: #eee;
7977
+ border-radius: 50%;
7978
+ width: 270px;
7979
+ height: 270px;
7980
+ overflow: visible;
7981
+ position: relative;
7982
+ margin: auto;
7983
+ margin-top: 25px;
7984
+ margin-bottom: 5px;
7985
+ -webkit-user-select: none;
7986
+ -moz-user-select: none;
7987
+ user-select: none;
7988
+ }
7989
+
7990
+ .timepicker-canvas,
7991
+ .timepicker-dial {
7992
+ position: absolute;
7993
+ left: 0;
7994
+ right: 0;
7995
+ top: 0;
7996
+ bottom: 0;
7997
+ }
7998
+
7999
+ .timepicker-minutes {
8000
+ visibility: hidden;
8001
+ }
8002
+
8003
+ .timepicker-tick {
8004
+ border-radius: 50%;
8005
+ color: rgba(0, 0, 0, 0.87);
8006
+ line-height: 40px;
7939
8007
  text-align: center;
7940
- font-size: 2.5rem;
7941
- border: 1px solid #ddd;
7942
- border-radius: 4px;
7943
- padding: 8px;
8008
+ width: 40px;
8009
+ height: 40px;
8010
+ position: absolute;
8011
+ cursor: pointer;
8012
+ font-size: 15px;
7944
8013
  }
7945
- .timepicker-modal .timepicker-content .time-display .ampm-selector {
7946
- display: flex;
7947
- flex-direction: column;
7948
- gap: 4px;
8014
+
8015
+ .timepicker-tick.active,
8016
+ .timepicker-tick:hover {
8017
+ background-color: rgba(38, 166, 154, 0.25);
7949
8018
  }
7950
- .timepicker-modal .timepicker-content .time-display .ampm-selector button {
7951
- min-width: 60px;
7952
- padding: 4px 8px;
8019
+
8020
+ .timepicker-dial {
8021
+ transition: transform 350ms, opacity 350ms;
7953
8022
  }
7954
- .timepicker-modal .timepicker-content .timepicker-actions {
8023
+
8024
+ .timepicker-dial-out {
8025
+ opacity: 0;
8026
+ }
8027
+ .timepicker-dial-out.timepicker-hours {
8028
+ transform: scale(1.1, 1.1);
8029
+ }
8030
+ .timepicker-dial-out.timepicker-minutes {
8031
+ transform: scale(0.8, 0.8);
8032
+ }
8033
+
8034
+ .timepicker-canvas {
8035
+ transition: opacity 175ms;
8036
+ }
8037
+ .timepicker-canvas line {
8038
+ stroke: #26a69a;
8039
+ stroke-width: 4;
8040
+ stroke-linecap: round;
8041
+ }
8042
+
8043
+ .timepicker-canvas-out {
8044
+ opacity: 0.25;
8045
+ }
8046
+
8047
+ .timepicker-canvas-bearing {
8048
+ stroke: none;
8049
+ fill: #26a69a;
8050
+ }
8051
+
8052
+ .timepicker-canvas-bg {
8053
+ stroke: none;
8054
+ fill: #26a69a;
8055
+ }
8056
+
8057
+ /* Footer */
8058
+ .timepicker-footer {
8059
+ margin: 0 auto;
8060
+ padding: 5px 1rem;
7955
8061
  display: flex;
7956
8062
  justify-content: space-between;
7957
- gap: 8px;
7958
- margin-top: 24px;
7959
8063
  }
7960
- .timepicker-modal .timepicker-content .timepicker-actions > div {
7961
- display: flex;
7962
- gap: 8px;
8064
+
8065
+ .timepicker-clear {
8066
+ color: #F44336;
7963
8067
  }
7964
- .timepicker-modal .timepicker-content .timepicker-actions .btn-flat {
8068
+
8069
+ .timepicker-close {
8070
+ color: #26a69a;
8071
+ }
8072
+
8073
+ .timepicker-clear,
8074
+ .timepicker-close {
7965
8075
  padding: 0 20px;
7966
8076
  }
7967
8077
 
7968
- /* Legacy styles kept for applications using old Materialize TimePicker */
8078
+ /* Media Queries */
8079
+ @media only screen and (min-width : 601px) {
8080
+ .timepicker-modal {
8081
+ max-width: 600px;
8082
+ }
8083
+ .timepicker-container.modal-content {
8084
+ flex-direction: row;
8085
+ }
8086
+ .timepicker-text-container {
8087
+ top: 32%;
8088
+ }
8089
+ .timepicker-display-am-pm {
8090
+ position: relative;
8091
+ right: auto;
8092
+ bottom: auto;
8093
+ text-align: center;
8094
+ margin-top: 1.2rem;
8095
+ }
8096
+ }
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './chip';
6
6
  export * from './code-block';
7
7
  export * from './collapsible';
8
8
  export * from './collection';
9
+ export * from './datepicker';
9
10
  export * from './dropdown';
10
11
  export * from './floating-action-button';
11
12
  export * from './icon';
@@ -17,10 +18,15 @@ export * from './modal';
17
18
  export * from './option';
18
19
  export * from './pagination';
19
20
  export * from './parallax';
20
- export * from './pickers';
21
+ export * from './datepicker';
22
+ export * from './timepicker';
23
+ export * from './pushpin';
21
24
  export * from './radio';
22
25
  export * from './select';
23
26
  export * from './switch';
24
27
  export * from './tabs';
25
28
  export * from './search-select';
29
+ export * from './timepicker';
30
+ export * from './toast';
31
+ export * from './tooltip';
26
32
  export * from './utils';