mithril-materialized 1.3.5 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/search-select.d.ts +16 -5
- package/package.json +23 -9
package/dist/search-select.d.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
import { Component } from 'mithril';
|
|
2
|
-
export interface Option<T> {
|
|
1
|
+
import { Attributes, Component } from 'mithril';
|
|
2
|
+
export interface Option<T extends string | number> {
|
|
3
3
|
id: T;
|
|
4
4
|
label?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface SearchSelectAttrs<T> {
|
|
7
|
+
export interface SearchSelectAttrs<T extends string | number> extends Attributes {
|
|
8
|
+
/** Options to display in the select */
|
|
8
9
|
options?: Option<T>[];
|
|
9
10
|
/** Initial value */
|
|
10
11
|
initialValue?: T[];
|
|
12
|
+
/** Callback when user selects or deselects an option */
|
|
11
13
|
onchange?: (selectedOptions: T[]) => void | Promise<void>;
|
|
12
|
-
|
|
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 */
|
|
13
17
|
label?: string;
|
|
18
|
+
/** Placeholder text for the search input, no default */
|
|
14
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;
|
|
15
24
|
/** Max height of the dropdown menu, default '25rem' */
|
|
16
25
|
maxHeight?: string;
|
|
17
26
|
}
|
|
18
|
-
interface SearchSelectState<T> {
|
|
27
|
+
interface SearchSelectState<T extends string | number> {
|
|
19
28
|
isOpen: boolean;
|
|
20
29
|
selectedOptions: Option<T>[];
|
|
21
30
|
searchTerm: string;
|
|
22
31
|
options: Option<T>[];
|
|
23
32
|
inputRef: HTMLElement | null;
|
|
24
33
|
dropdownRef: HTMLElement | null;
|
|
34
|
+
focusedIndex: number;
|
|
35
|
+
onchange: any;
|
|
25
36
|
}
|
|
26
37
|
/**
|
|
27
38
|
* Mithril Factory Component for Multi-Select Dropdown with search
|
package/package.json
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mithril-materialized",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "A materialize library for mithril.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
|
+
"browser": "dist/index.umd.js",
|
|
8
|
+
"unpkg": "dist/index.umd.js",
|
|
9
|
+
"jsdelivr": "dist/index.umd.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
7
11
|
"exports": {
|
|
8
|
-
".":
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.modern.js",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.modern.js"
|
|
17
|
+
},
|
|
18
|
+
"./modern": "./dist/index.modern.js",
|
|
19
|
+
"./esm": "./dist/index.esm.js",
|
|
20
|
+
"./umd": "./dist/index.umd.js",
|
|
9
21
|
"./index.css": "./dist/index.css"
|
|
10
22
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
13
27
|
"scripts": {
|
|
14
|
-
"build": "microbundle build ./src/index.ts",
|
|
15
|
-
"dev": "microbundle watch ./src/index.ts",
|
|
28
|
+
"build": "microbundle build ./src/index.ts --external mithril,materialize-css",
|
|
29
|
+
"dev": "microbundle watch ./src/index.ts --external mithril,materialize-css",
|
|
16
30
|
"start": "npm run dev",
|
|
17
31
|
"clean": "rimraf dist node_modules/.cache",
|
|
18
32
|
"link:old": "pnpm link",
|
|
@@ -35,7 +49,7 @@
|
|
|
35
49
|
"license": "MIT",
|
|
36
50
|
"dependencies": {
|
|
37
51
|
"materialize-css": "^1.0.0",
|
|
38
|
-
"mithril": "^2.
|
|
52
|
+
"mithril": "^2.3.0"
|
|
39
53
|
},
|
|
40
54
|
"devDependencies": {
|
|
41
55
|
"@types/materialize-css": "^1.0.14",
|
|
@@ -44,7 +58,7 @@
|
|
|
44
58
|
"microbundle": "^0.15.1",
|
|
45
59
|
"rimraf": "^6.0.1",
|
|
46
60
|
"tslib": "^2.8.1",
|
|
47
|
-
"typedoc": "^0.
|
|
48
|
-
"typescript": "^5.
|
|
61
|
+
"typedoc": "^0.28.4",
|
|
62
|
+
"typescript": "^5.8.3"
|
|
49
63
|
}
|
|
50
64
|
}
|