@ktjs/mui 0.19.0 → 0.20.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.d.ts CHANGED
@@ -1,3 +1,34 @@
1
+ interface KTMuiAlertProps {
2
+ class?: string;
3
+ style?: string | Partial<CSSStyleDeclaration>;
4
+ children: string | HTMLElement | JSX.Element | Array<string | HTMLElement | JSX.Element>;
5
+ severity?: 'error' | 'warning' | 'info' | 'success';
6
+ variant?: 'standard' | 'filled' | 'outlined';
7
+ icon?: HTMLElement | false;
8
+ 'kt:close'?: () => void;
9
+ }
10
+ declare function Alert(props: KTMuiAlertProps): JSX.Element;
11
+
12
+ interface KTMuiButtonProps {
13
+ class?: string;
14
+ style?: string | Partial<CSSStyleDeclaration>;
15
+ children?: string | HTMLElement | JSX.Element;
16
+ variant?: 'contained' | 'outlined' | 'text';
17
+ color?: 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success';
18
+ size?: 'small' | 'medium' | 'large';
19
+ disabled?: boolean;
20
+ fullWidth?: boolean;
21
+ iconOnly?: boolean;
22
+ startIcon?: HTMLElement | JSX.Element;
23
+ endIcon?: HTMLElement | JSX.Element;
24
+ type?: 'button' | 'submit' | 'reset';
25
+ 'on:click'?: (event: Event) => void;
26
+ }
27
+ /**
28
+ * Button component - mimics MUI Button appearance and behavior
29
+ */
30
+ declare function Button(props: KTMuiButtonProps): JSX.Element;
31
+
1
32
  type otherstring = string & {};
2
33
 
3
34
  type RefChangeHandler<T> = (newValue: T, oldValue: T) => void;
@@ -18,6 +49,79 @@ declare class KTRef<T> {
18
49
  removeOnChange(callback: RefChangeHandler<T>): boolean;
19
50
  }
20
51
 
52
+ type SingleContent = KTRef<any> | HTMLElement | Element | Node | string | number | boolean | null | undefined;
53
+ type KTAvailableContent = SingleContent | KTAvailableContent[];
54
+ type KTRawContent = KTAvailableContent | Promise<KTAvailableContent>;
55
+
56
+ /**
57
+ * Used to create enhanced HTML elements
58
+ */
59
+ interface KTBaseAttribute {
60
+ [k: string]: any;
61
+
62
+ // # kt-specific attributes
63
+ ref?: KTRef<JSX.Element>;
64
+ 'k-if'?: any;
65
+
66
+ // # normal HTML attributes
67
+ id?: string;
68
+ class?: string;
69
+ className?: string;
70
+ style?: string | Partial<CSSStyleDeclaration>;
71
+
72
+ type?:
73
+ | 'text'
74
+ | 'password'
75
+ | 'email'
76
+ | 'number'
77
+ | 'tel'
78
+ | 'url'
79
+ | 'search'
80
+ | 'date'
81
+ | 'datetime-local'
82
+ | 'time'
83
+ | 'month'
84
+ | 'week'
85
+ | 'color'
86
+ | 'range'
87
+ | 'file'
88
+ | 'checkbox'
89
+ | 'radio'
90
+ | 'hidden'
91
+ | 'submit'
92
+ | 'reset'
93
+ | 'button'
94
+ | 'image'
95
+ | otherstring;
96
+ for?: string;
97
+
98
+ name?: string;
99
+ title?: string;
100
+ placeholder?: string;
101
+ contenteditable?: boolean;
102
+ value?: any;
103
+ valueAsDate?: Date;
104
+ valueAsNumber?: number;
105
+ label?: string;
106
+ disabled?: boolean;
107
+
108
+ min?: string | number;
109
+ max?: string | number;
110
+ step?: string | number;
111
+
112
+ selected?: boolean;
113
+ checked?: boolean;
114
+
115
+ action?: string;
116
+ method?: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE' | otherstring;
117
+ }
118
+
119
+ type KTPrefixedEventHandlers = {
120
+ [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
121
+ };
122
+
123
+ type KTAttribute = KTBaseAttribute & KTPrefixedEventHandlers;
124
+
21
125
  // Base events available to all HTML elements
22
126
  interface BaseAttr {
23
127
  [k: string]: any;
@@ -997,17 +1101,9 @@ interface SVGAttributesMap {
997
1101
  view: AttributesMap['svg'] & { viewBox?: string; preserveAspectRatio?: string };
998
1102
  }
999
1103
 
1000
- type KTHTMLElement<El extends HTMLElement = HTMLElement> = El & {
1001
- /**
1002
- * Automically generate a redraw function if it is not provided
1003
- * @param props
1004
- */
1005
- redraw: (props?: KTAttribute, ...args: any[]) => KTHTMLElement;
1006
- };
1007
-
1008
1104
  declare global {
1009
1105
  namespace JSX {
1010
- type Element = KTHTMLElement;
1106
+ type Element = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
1011
1107
 
1012
1108
  interface IntrinsicElements {
1013
1109
  // Document-level & metadata
@@ -1181,7 +1277,7 @@ declare global {
1181
1277
  }
1182
1278
 
1183
1279
  interface IntrinsicAttributes {
1184
- ref?: KTRef<HTMLElement>;
1280
+ ref?: KTRef<any>;
1185
1281
  'k-if'?: any;
1186
1282
  children?: KTRawContent;
1187
1283
  }
@@ -1192,116 +1288,9 @@ declare global {
1192
1288
  }
1193
1289
  }
1194
1290
 
1195
- type SingleContent = KTRef<any> | HTMLElement | Element | Node | string | number | boolean | null | undefined;
1196
- type KTAvailableContent = SingleContent | KTAvailableContent[];
1197
- type KTRawContent = KTAvailableContent | Promise<KTAvailableContent>;
1198
-
1199
- /**
1200
- * Used to create enhanced HTML elements
1201
- */
1202
- interface KTBaseAttribute {
1203
- [k: string]: any;
1204
-
1205
- // # kt-specific attributes
1206
- ref?: KTRef<KTHTMLElement>;
1207
- 'k-if'?: any;
1208
-
1209
- // # normal HTML attributes
1210
- id?: string;
1211
- class?: string;
1212
- className?: string;
1213
- style?: string | Partial<CSSStyleDeclaration>;
1214
-
1215
- type?:
1216
- | 'text'
1217
- | 'password'
1218
- | 'email'
1219
- | 'number'
1220
- | 'tel'
1221
- | 'url'
1222
- | 'search'
1223
- | 'date'
1224
- | 'datetime-local'
1225
- | 'time'
1226
- | 'month'
1227
- | 'week'
1228
- | 'color'
1229
- | 'range'
1230
- | 'file'
1231
- | 'checkbox'
1232
- | 'radio'
1233
- | 'hidden'
1234
- | 'submit'
1235
- | 'reset'
1236
- | 'button'
1237
- | 'image'
1238
- | otherstring;
1239
- for?: string;
1240
-
1241
- name?: string;
1242
- title?: string;
1243
- placeholder?: string;
1244
- contenteditable?: boolean;
1245
- value?: any;
1246
- valueAsDate?: Date;
1247
- valueAsNumber?: number;
1248
- label?: string;
1249
- disabled?: boolean;
1250
-
1251
- min?: string | number;
1252
- max?: string | number;
1253
- step?: string | number;
1254
-
1255
- selected?: boolean;
1256
- checked?: boolean;
1257
-
1258
- action?: string;
1259
- method?: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE' | otherstring;
1260
- }
1261
-
1262
- type KTPrefixedEventHandlers = {
1263
- [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
1264
- };
1265
-
1266
- type KTAttribute = KTBaseAttribute & KTPrefixedEventHandlers;
1267
-
1268
- interface AlertProps {
1269
- class?: string;
1270
- style?: string | Partial<CSSStyleDeclaration>;
1271
- children: string | HTMLElement | KTHTMLElement | Array<string | HTMLElement | KTHTMLElement>;
1272
- severity?: 'error' | 'warning' | 'info' | 'success';
1273
- variant?: 'standard' | 'filled' | 'outlined';
1274
- icon?: HTMLElement | KTHTMLElement | false;
1275
- 'kt:close'?: () => void;
1276
- }
1277
- /**s
1278
- * Alert component - mimics MUI Alert appearance and behavior
1279
- */
1280
- declare function Alert(props: AlertProps): KTHTMLElement;
1281
-
1282
- interface ButtonProps {
1283
- class?: string;
1284
- style?: string | Partial<CSSStyleDeclaration>;
1285
- children: string | HTMLElement | KTHTMLElement;
1286
- variant?: 'contained' | 'outlined' | 'text';
1287
- color?: 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success';
1288
- size?: 'small' | 'medium' | 'large';
1289
- disabled?: boolean;
1290
- fullWidth?: boolean;
1291
- iconOnly?: boolean;
1292
- startIcon?: HTMLElement | KTHTMLElement;
1293
- endIcon?: HTMLElement | KTHTMLElement;
1294
- type?: 'button' | 'submit' | 'reset';
1295
- 'on:click'?: (event: Event) => void;
1296
- }
1297
- /**
1298
- * Button component - mimics MUI Button appearance and behavior
1299
- */
1300
- declare function Button(props: ButtonProps): KTHTMLElement;
1301
-
1302
1291
  interface KTMuiCheckboxProps {
1303
1292
  value: string;
1304
- label?: string | KTHTMLElement | HTMLElement;
1293
+ label?: string | JSX.Element | HTMLElement;
1305
1294
  checked?: boolean;
1306
1295
  size?: 'small' | 'medium';
1307
1296
  'kt:change'?: ((checked: boolean, value: string) => void) | KTRef<boolean>;
@@ -1320,13 +1309,13 @@ interface KTMuiCheckboxGroupProps {
1320
1309
  row?: boolean;
1321
1310
  }
1322
1311
 
1323
- type KTMuiCheckbox = KTHTMLElement & {
1312
+ type KTMuiCheckbox = JSX.Element & {
1324
1313
  checked: boolean;
1325
1314
  value: string;
1326
1315
  disabled: boolean;
1327
1316
  };
1328
1317
 
1329
- type KTMuiCheckboxGroup = KTHTMLElement & {
1318
+ type KTMuiCheckboxGroup = JSX.Element & {
1330
1319
  value: string[];
1331
1320
  disabled: boolean[];
1332
1321
  disableAll: () => void;
@@ -1346,12 +1335,12 @@ interface KTMuiDialogProps {
1346
1335
  open?: boolean;
1347
1336
  'kt:close'?: () => void;
1348
1337
  title?: string;
1349
- children?: HTMLElement | HTMLElement[] | string;
1338
+ children?: HTMLElement | HTMLElement[] | JSX.Element | JSX.Element[] | string;
1350
1339
  actions?: HTMLElement | HTMLElement[];
1351
1340
  maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
1352
1341
  fullWidth?: boolean;
1353
1342
  }
1354
- type KTMuiDialog = KTHTMLElement & {
1343
+ type KTMuiDialog = JSX.Element & {
1355
1344
  /**
1356
1345
  * Controls whether the dialog is open or closed
1357
1346
  */
@@ -1364,7 +1353,7 @@ type KTMuiDialog = KTHTMLElement & {
1364
1353
  declare function Dialog(props: KTMuiDialogProps): KTMuiDialog;
1365
1354
 
1366
1355
  interface FormLabelProps {
1367
- children: string | HTMLElement | KTHTMLElement;
1356
+ children: string | HTMLElement | JSX.Element;
1368
1357
  required?: boolean;
1369
1358
  error?: boolean;
1370
1359
  disabled?: boolean;
@@ -1376,7 +1365,7 @@ interface FormLabelProps {
1376
1365
  /**
1377
1366
  * FormLabel component - mimics MUI FormLabel appearance and behavior
1378
1367
  */
1379
- declare function FormLabel(props: FormLabelProps): KTHTMLElement;
1368
+ declare function FormLabel(props: FormLabelProps): JSX.Element;
1380
1369
 
1381
1370
  interface LinearProgressProps {
1382
1371
  class?: string;
@@ -1385,7 +1374,7 @@ interface LinearProgressProps {
1385
1374
  progress?: number;
1386
1375
  color?: 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success';
1387
1376
  }
1388
- type KTMuiLinearProgress = KTHTMLElement & {
1377
+ type KTMuiLinearProgress = JSX.Element & {
1389
1378
  /**
1390
1379
  * Reactive property to get or set the current progress value (0-100)
1391
1380
  */
@@ -1424,7 +1413,7 @@ interface KTMuiTextFieldProps<T extends InputTypes> {
1424
1413
  'kt:focus'?: () => void;
1425
1414
  }
1426
1415
 
1427
- type KTMuiTextField = KTHTMLElement & {
1416
+ type KTMuiTextField = JSX.Element & {
1428
1417
  /**
1429
1418
  * Reactive `value` of the input field
1430
1419
  */
@@ -1481,7 +1470,7 @@ interface KTMuiRadioProps {
1481
1470
  class?: string;
1482
1471
  style?: string | Partial<CSSStyleDeclaration>;
1483
1472
  value: string;
1484
- label: string | KTHTMLElement | HTMLElement;
1473
+ label: string | JSX.Element | HTMLElement;
1485
1474
  checked?: boolean;
1486
1475
  size?: 'small' | 'medium';
1487
1476
  'kt:change'?: (checked: boolean, value: string) => void;
@@ -1501,7 +1490,7 @@ interface KTMuiRadioGroupProps {
1501
1490
  row?: boolean;
1502
1491
  }
1503
1492
 
1504
- type KTMuiRadio = KTHTMLElement & {
1493
+ type KTMuiRadio = JSX.Element & {
1505
1494
  /**
1506
1495
  * The value of the radio button
1507
1496
  * @readonly
@@ -1513,7 +1502,7 @@ type KTMuiRadio = KTHTMLElement & {
1513
1502
  */
1514
1503
  checked: boolean;
1515
1504
  };
1516
- type KTMuiRadioGroup = KTHTMLElement & {
1505
+ type KTMuiRadioGroup = JSX.Element & {
1517
1506
  /**
1518
1507
  * Reactive checked state of the radio button
1519
1508
  */
@@ -1545,10 +1534,20 @@ interface KTMuiSelectProps {
1545
1534
  fullWidth?: boolean;
1546
1535
  disabled?: boolean;
1547
1536
  }
1537
+ type KTMuiSelect = JSX.Element & {
1538
+ /**
1539
+ * Reactive `value` of the select component
1540
+ */
1541
+ value: string;
1542
+ /**
1543
+ * Reactive `disabled` state of the select component
1544
+ */
1545
+ disabled: boolean;
1546
+ };
1548
1547
  /**
1549
1548
  * Select component - mimics MUI Select appearance and behavior
1550
1549
  */
1551
- declare function Select(props: KTMuiSelectProps): JSX.Element;
1550
+ declare function Select(props: KTMuiSelectProps): KTMuiSelect;
1552
1551
 
1553
1552
  declare function DownloadIcon(props: KTAttribute): JSX.Element;
1554
1553
 
@@ -1594,5 +1593,5 @@ declare function ContentCopyIcon(props: KTAttribute): JSX.Element;
1594
1593
 
1595
1594
  declare function SelectAllIcon(props: KTAttribute): JSX.Element;
1596
1595
 
1597
- export { Alert, Button, Checkbox, CheckboxGroup, ColorLensIcon, CompressIcon, ContentCopyIcon, ContentPasteIcon, DeleteIcon, Dialog, DownloadIcon, ExpandMoreIcon, FileOpenIcon as FileOpen, FileOpenIcon, FolderOpenIcon, FormLabel, HomeIcon, LinearProgress, MenuIcon, NewReleasesIcon, PlayArrowIcon, QueuePlayNextIcon, Radio, RadioGroup, SaveIcon, Select, SelectAllIcon, SettingsIcon, StopIcon, SubtitlesIcon, TextField, UploadFileIcon, VideoFileIcon, WallpaperIcon };
1596
+ export { Alert, Button, Checkbox, CheckboxGroup, ColorLensIcon, CompressIcon, ContentCopyIcon, ContentPasteIcon, DeleteIcon, Dialog, DownloadIcon, ExpandMoreIcon, FileOpenIcon, FolderOpenIcon, FormLabel, HomeIcon, LinearProgress, MenuIcon, NewReleasesIcon, PlayArrowIcon, QueuePlayNextIcon, Radio, RadioGroup, SaveIcon, Select, SelectAllIcon, SettingsIcon, StopIcon, SubtitlesIcon, TextField, UploadFileIcon, VideoFileIcon, WallpaperIcon };
1598
1597
  export type { KTMuiDialog, KTMuiLinearProgress, KTMuiRadio, KTMuiRadioGroup, KTMuiRadioProps, KTMuiSelectProps, KTMuiTextField, KTMuiTextFieldProps };