@aminnausin/cedar-ui 0.0.9 → 0.0.11

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
@@ -8,6 +8,7 @@ import { FunctionalComponent } from 'vue';
8
8
  import { MethodOptions } from 'vue';
9
9
  import { ModelRef } from 'vue';
10
10
  import { Ref } from 'vue';
11
+ import { _RouterLinkI } from 'vue-router';
11
12
  import { ShallowRef } from 'vue';
12
13
  import { UnwrapRef } from 'vue';
13
14
 
@@ -17,12 +18,24 @@ export declare interface AccordionItem {
17
18
  content: string;
18
19
  }
19
20
 
21
+ export declare type AnchorTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {});
22
+
20
23
  export declare interface BreadCrumbItem {
21
24
  name: string;
22
25
  url: string;
23
26
  icon?: Component;
24
27
  }
25
28
 
29
+ export declare type ButtonComponent = 'button' | 'a' | _RouterLinkI;
30
+
31
+ export declare interface ButtonProps {
32
+ type?: ButtonType;
33
+ }
34
+
35
+ export declare type ButtonType = 'button' | 'submit' | 'reset';
36
+
37
+ export declare type ButtonVariant = 'default';
38
+
26
39
  declare function close_2(): void;
27
40
 
28
41
  export declare function cn(...inputs: any[]): string;
@@ -33,14 +46,6 @@ export declare const CompareStrategies: {
33
46
  number: (a: any, b: any) => number;
34
47
  };
35
48
 
36
- export declare interface ContextMenu {
37
- disabled?: boolean;
38
- style?: string;
39
- itemStyle?: string;
40
- items?: ContextMenuItem[];
41
- scrollContainer?: 'window' | 'body';
42
- }
43
-
44
49
  export declare interface ContextMenuItem {
45
50
  text?: string;
46
51
  shortcut?: string;
@@ -53,9 +58,38 @@ export declare interface ContextMenuItem {
53
58
  disabled?: boolean;
54
59
  hidden?: boolean;
55
60
  icon?: Component;
61
+ target?: AnchorTarget;
62
+ }
63
+
64
+ export declare interface ContextMenuOptions {
65
+ disabled?: boolean;
66
+ style?: string;
67
+ itemStyle?: string;
68
+ items?: ContextMenuItem[];
69
+ scrollContainer?: 'window' | 'body';
56
70
  }
57
71
 
58
- declare interface DatePickerProps {
72
+ export declare function createDrawerCore(): {
73
+ isOpen: Readonly< Ref<boolean, boolean>>;
74
+ isAnimating: Readonly< Ref<boolean, boolean>>;
75
+ animationTime: Ref<number, number>;
76
+ props: ShallowRef<Partial<DrawerProps>, Partial<DrawerProps>>;
77
+ component: ShallowRef<null, null> | ShallowRef<ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions>, ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions>> | ShallowRef<FunctionalComponent<any, {}, any, {}>, FunctionalComponent<any, {}, any, {}>> | ShallowRef<{
78
+ new (...args: any[]): any;
79
+ __isFragment?: never;
80
+ __isTeleport?: never;
81
+ __isSuspense?: never;
82
+ }, {
83
+ new (...args: any[]): any;
84
+ __isFragment?: never;
85
+ __isTeleport?: never;
86
+ __isSuspense?: never;
87
+ }>;
88
+ open: (drawerComponent: Component, drawerProps?: DrawerProps) => void;
89
+ close: (reason: DrawerCloseReason) => void;
90
+ };
91
+
92
+ export declare interface DatePickerProps {
59
93
  model?: ModelRef<string | undefined>;
60
94
  defaultDate?: string;
61
95
  useDefaultDate?: boolean;
@@ -63,6 +97,32 @@ declare interface DatePickerProps {
63
97
 
64
98
  export declare const DEFAULT_GAP = 16;
65
99
 
100
+ export declare const drawer: {
101
+ open: (comp: Component, props?: DrawerProps) => void;
102
+ close: (reason: DrawerCloseReason) => void;
103
+ };
104
+
105
+ export declare type DrawerCloseReason = 'user' | 'escape' | 'programmatic';
106
+
107
+ export declare interface DrawerControllerProps {
108
+ teleportTarget?: string;
109
+ }
110
+
111
+ export declare interface DrawerProps {
112
+ title?: string;
113
+ description?: string;
114
+ showHeader?: boolean;
115
+ showFooter?: boolean;
116
+ direction?: SwipeDirection;
117
+ rootClass?: string;
118
+ closeOnEsc?: boolean;
119
+ closeOnBackdrop?: boolean;
120
+ preventClose?: boolean;
121
+ payload?: unknown;
122
+ onOpen?: () => void;
123
+ onClose?: () => void;
124
+ }
125
+
66
126
  export declare interface DropdownMenuItem {
67
127
  name: string;
68
128
  url?: string;
@@ -85,6 +145,8 @@ export declare interface ExternalToast {
85
145
 
86
146
  export declare type FieldType = 'text' | 'textArea' | 'number' | 'date' | 'url' | 'multi' | 'select' | 'password';
87
147
 
148
+ export declare type FormButtonVariant = ButtonVariant | 'submit' | 'reset' | 'auth';
149
+
88
150
  export declare interface FormField {
89
151
  name: string;
90
152
  text?: string;
@@ -115,6 +177,18 @@ export declare interface FormHooks {
115
177
  onFinish?: () => any;
116
178
  }
117
179
 
180
+ export declare interface FormLabelledTextInputProps extends TextInputProps, LabelProps {
181
+ required?: boolean;
182
+ }
183
+
184
+ export declare interface FormLabelProps extends LabelProps {
185
+ for: string;
186
+ }
187
+
188
+ export declare interface FormNumberFieldProps extends NumberFieldProps {
189
+ field: FormField;
190
+ }
191
+
118
192
  export declare interface FormState<T> {
119
193
  fields: FormFields<T>;
120
194
  errors: {
@@ -133,8 +207,42 @@ export declare interface FormState<T> {
133
207
  }) => void;
134
208
  }
135
209
 
210
+ export declare interface FormTextAreaProps {
211
+ field: FormField;
212
+ maxHeight?: number;
213
+ }
214
+
215
+ export declare interface HoverCardProps extends RelativeHoverCardProps {
216
+ contentTitle?: string;
217
+ margin?: number;
218
+ paddingLeft?: number;
219
+ scrollContainer?: 'body' | 'window';
220
+ disabled?: boolean;
221
+ }
222
+
223
+ export declare type IconButtonVariant = ButtonVariant | 'ghost' | 'transparent';
224
+
225
+ export declare interface InputProps {
226
+ id?: string;
227
+ disabled?: boolean;
228
+ placeholder?: string;
229
+ class?: string;
230
+ }
231
+
232
+ export declare interface InputShellProps extends InputProps {
233
+ clampText?: boolean;
234
+ }
235
+
136
236
  export declare function isInputLikeElement(element: EventTarget | null, key: string): boolean;
137
237
 
238
+ export declare interface LabelledTextInputProps extends TextInputProps, LabelProps {
239
+ }
240
+
241
+ export declare interface LabelProps {
242
+ text?: string;
243
+ subtext?: string;
244
+ }
245
+
138
246
  export declare interface Message<T extends Component = Component> {
139
247
  id: string;
140
248
  title: string;
@@ -152,12 +260,35 @@ export declare interface Message<T extends Component = Component> {
152
260
 
153
261
  export declare const MOBILE_VIEWPORT_OFFSET = "16px";
154
262
 
155
- declare interface ModalProps {
263
+ export declare interface ModalProps {
156
264
  title?: string;
157
265
  submitText?: string;
158
266
  animationTime?: number;
159
267
  }
160
268
 
269
+ export declare interface MultiSelectItem {
270
+ id: number;
271
+ name: string;
272
+ relationships?: any;
273
+ disabled?: boolean;
274
+ }
275
+
276
+ export declare interface MultiSelectProps {
277
+ class?: string;
278
+ rootClass?: string;
279
+ placeholder?: string;
280
+ defaultItems?: MultiSelectItem[];
281
+ options?: MultiSelectItem[];
282
+ max?: number;
283
+ disabled?: boolean;
284
+ title?: string;
285
+ fieldName?: string;
286
+ }
287
+
288
+ export declare interface NumberFieldProps {
289
+ increment?: number;
290
+ }
291
+
161
292
  declare class Observer {
162
293
  subscribers: Array<(toast: Message | ToastToDismiss) => void>;
163
294
  toasts: Array<Message>;
@@ -191,12 +322,38 @@ export declare interface PopoverItem {
191
322
  selectedIcon?: Component;
192
323
  }
193
324
 
325
+ export declare interface RelativeHoverCardProps {
326
+ content?: string;
327
+ positionClasses?: string;
328
+ hoverCardDelay?: number;
329
+ hoverCardLeaveDelay?: number;
330
+ iconHidden?: boolean;
331
+ icon?: Component;
332
+ }
333
+
194
334
  export declare const SCALE_STEP = 0.06;
195
335
 
196
336
  export declare interface SelectItem {
197
- id: number;
198
- name: string;
199
- relationships?: any;
337
+ title: string;
338
+ value: any;
339
+ key?: any;
340
+ disabled?: boolean;
341
+ }
342
+
343
+ export declare interface SelectProps {
344
+ name?: string;
345
+ class?: string;
346
+ rootClass?: string;
347
+ placeholder?: string;
348
+ defaultItem?: number | null;
349
+ options?: SelectItem[];
350
+ disabled?: boolean;
351
+ title?: string;
352
+ prefix?: string;
353
+ menuMargin?: {
354
+ top: string;
355
+ bottom: string;
356
+ };
200
357
  }
201
358
 
202
359
  export declare type SortDir = 1 | -1;
@@ -212,8 +369,37 @@ export declare function sortObjectNew<T>(keys: SortKey<T>[], direction?: SortDir
212
369
 
213
370
  export declare const SWIPE_THRESHOLD = 45;
214
371
 
372
+ export declare type SwipeAxis = 'x' | 'y';
373
+
374
+ export declare interface SwipeConstraint {
375
+ minDelta: number;
376
+ maxDelta: number;
377
+ }
378
+
215
379
  export declare type SwipeDirection = 'top' | 'right' | 'bottom' | 'left';
216
380
 
381
+ export declare interface SwipeThreshold {
382
+ px?: number;
383
+ percent?: number;
384
+ }
385
+
386
+ export declare interface TablePaginationButtonProps {
387
+ currentPage?: number;
388
+ pageNumber?: number;
389
+ text?: string;
390
+ underline?: boolean;
391
+ sticky?: boolean;
392
+ disabled?: boolean;
393
+ }
394
+
395
+ export declare interface TablePaginationProps {
396
+ listLength: number;
397
+ currentPage: number;
398
+ itemsPerPage: number;
399
+ useIcons: boolean;
400
+ maxVisiblePages?: number;
401
+ }
402
+
217
403
  export declare interface TableProps<T> {
218
404
  useToolbar?: boolean;
219
405
  usePagination?: boolean;
@@ -263,6 +449,13 @@ export declare interface TabsTriggerProps {
263
449
  value: string;
264
450
  }
265
451
 
452
+ export declare type TextButtonVariant = ButtonVariant | 'ghost' | 'transparent' | 'form';
453
+
454
+ export declare interface TextInputProps extends InputProps {
455
+ minlength?: number;
456
+ maxlength?: number;
457
+ }
458
+
266
459
  export declare const toast: typeof toastFunction & {
267
460
  add: (message: string, options?: ToastOptions) => string;
268
461
  success: (message: string, options?: ToastOptions) => string;
@@ -274,6 +467,8 @@ export declare const toast: typeof toastFunction & {
274
467
 
275
468
  export declare const TOAST_LIFE = 3000;
276
469
 
470
+ export declare const TOAST_SWIPE_THRESHOLD = 45;
471
+
277
472
  export declare const TOAST_WIDTH = 0;
278
473
 
279
474
  export declare interface ToastControllerProps {
@@ -346,7 +541,7 @@ export declare function useDatePicker(props: DatePickerProps, datePickerInput: R
346
541
  datePickerCalendar: Ref<HTMLElement | null, HTMLElement | null>;
347
542
  datePickerOpen: Ref<boolean, boolean>;
348
543
  datePickerValue: Ref<string, string>;
349
- datePickerPanel: Ref<"Y" | "M" | "D", "Y" | "M" | "D">;
544
+ datePickerPanel: Ref<"D" | "M" | "Y", "D" | "M" | "Y">;
350
545
  datePickerFormat: Ref<"F d, Y" | "d M, Y" | "Y M d" | "MM-DD-YYYY" | "DD-MM-YYYY" | "YYYY-MM-DD" | "D d M, Y", "F d, Y" | "d M, Y" | "Y M d" | "MM-DD-YYYY" | "DD-MM-YYYY" | "YYYY-MM-DD" | "D d M, Y">;
351
546
  datePickerMonth: Ref<number, number>;
352
547
  datePickerMonthVerbose: ComputedRef<string>;
@@ -357,7 +552,7 @@ export declare function useDatePicker(props: DatePickerProps, datePickerInput: R
357
552
  datePickerBlankDaysInMonth: Ref<number[], number[]>;
358
553
  datePickerMonthNames: string[];
359
554
  datePickerDays: string[];
360
- datePickerPosition: Ref<"bottom" | "top", "bottom" | "top">;
555
+ datePickerPosition: Ref<"top" | "bottom", "top" | "bottom">;
361
556
  toggleDatePicker: (state?: boolean) => void;
362
557
  datePickerValueClicked: (value: number) => void;
363
558
  datePickerPrevious: () => void;
@@ -367,6 +562,46 @@ export declare function useDatePicker(props: DatePickerProps, datePickerInput: R
367
562
  showDatePickerPanel: (panel?: "Y" | "M" | "D") => void;
368
563
  };
369
564
 
565
+ export declare function useDrawer(): {
566
+ isOpen: Readonly< Ref<boolean, boolean>>;
567
+ isAnimating: Readonly< Ref<boolean, boolean>>;
568
+ animationTime: Ref<number, number>;
569
+ props: ShallowRef<Partial<DrawerProps>, Partial<DrawerProps>>;
570
+ component: ShallowRef<null, null> | ShallowRef<ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions>, ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions>> | ShallowRef<FunctionalComponent<any, {}, any, {}>, FunctionalComponent<any, {}, any, {}>> | ShallowRef<{
571
+ new (...args: any[]): any;
572
+ __isFragment?: never;
573
+ __isTeleport?: never;
574
+ __isSuspense?: never;
575
+ }, {
576
+ new (...args: any[]): any;
577
+ __isFragment?: never;
578
+ __isTeleport?: never;
579
+ __isSuspense?: never;
580
+ }>;
581
+ open: (drawerComponent: Component, drawerProps?: DrawerProps) => void;
582
+ close: (reason: DrawerCloseReason) => void;
583
+ };
584
+
585
+ export declare function useDrawerCore(): {
586
+ isOpen: Readonly< Ref<boolean, boolean>>;
587
+ isAnimating: Readonly< Ref<boolean, boolean>>;
588
+ animationTime: Ref<number, number>;
589
+ props: ShallowRef<Partial<DrawerProps>, Partial<DrawerProps>>;
590
+ component: ShallowRef<null, null> | ShallowRef<ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions>, ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions>> | ShallowRef<FunctionalComponent<any, {}, any, {}>, FunctionalComponent<any, {}, any, {}>> | ShallowRef<{
591
+ new (...args: any[]): any;
592
+ __isFragment?: never;
593
+ __isTeleport?: never;
594
+ __isSuspense?: never;
595
+ }, {
596
+ new (...args: any[]): any;
597
+ __isFragment?: never;
598
+ __isTeleport?: never;
599
+ __isSuspense?: never;
600
+ }>;
601
+ open: (drawerComponent: Component, drawerProps?: DrawerProps) => void;
602
+ close: (reason: DrawerCloseReason) => void;
603
+ };
604
+
370
605
  export declare function useForm<T extends Record<string, any>>(fields: FormFields<T>): {
371
606
  fields: UnwrapRef<FormFields<T>>;
372
607
  errors: {
@@ -385,16 +620,6 @@ export declare function useForm<T extends Record<string, any>>(fields: FormField
385
620
  }) => void;
386
621
  };
387
622
 
388
- export declare function useModal(props: ModalProps): {
389
- modalOpen: boolean;
390
- isAnimating: boolean;
391
- animationTime: number;
392
- toggleModal: (state?: boolean | null) => void;
393
- setTitle: (title: string) => void;
394
- title: string;
395
- submitText?: string | undefined;
396
- };
397
-
398
623
  export declare function useModalCore(): {
399
624
  isOpen: Ref<boolean, boolean>;
400
625
  isAnimating: Ref<boolean, boolean>;
@@ -463,7 +688,7 @@ export declare function useSelect(options: any, refs: any): {
463
688
  selectPositionUpdate: () => void;
464
689
  };
465
690
 
466
- export declare function useSwipeHandler({ directions, threshold, onSwipeOut }: UseSwipeHandlerOptions): {
691
+ export declare function useSwipeHandler({ directions, swipeThreshold, velocityThreshold, getElementSize, onSwipeOut }: UseSwipeHandlerOptions): {
467
692
  offset: Ref<{
468
693
  x: number;
469
694
  y: number;
@@ -478,11 +703,15 @@ export declare function useSwipeHandler({ directions, threshold, onSwipeOut }: U
478
703
  onPointerDown: (e: PointerEvent) => void;
479
704
  onPointerMove: (e: PointerEvent) => void;
480
705
  onPointerUp: () => void;
706
+ onPointerCancel: () => void;
707
+ isTapGesture: () => boolean;
481
708
  };
482
709
 
483
- declare interface UseSwipeHandlerOptions {
710
+ export declare interface UseSwipeHandlerOptions {
484
711
  directions: Ref<SwipeDirection[]>;
485
- threshold: number;
712
+ swipeThreshold: SwipeThreshold;
713
+ velocityThreshold?: number;
714
+ getElementSize?: (axis: SwipeAxis) => number;
486
715
  onSwipeOut: () => void;
487
716
  }
488
717
 
@@ -501,13 +730,15 @@ export declare function useToastTimer({ duration, isPaused, onTimeout, immediate
501
730
  cancel: () => void;
502
731
  };
503
732
 
504
- declare interface UseToastTimerOptions {
733
+ export declare interface UseToastTimerOptions {
505
734
  duration: number;
506
735
  isPaused: () => boolean;
507
736
  onTimeout: () => void;
508
737
  immediate?: boolean;
509
738
  }
510
739
 
740
+ export declare const VELOCITY_THRESHOLD = 0.11;
741
+
511
742
  export declare const VIEWPORT_OFFSET = "24px";
512
743
 
513
744
  export declare const VISIBLE_TOASTS_AMOUNT = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aminnausin/cedar-ui",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",