webcoreui 0.2.0 → 0.3.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.
Files changed (37) hide show
  1. package/README.md +8 -0
  2. package/astro.d.ts +8 -0
  3. package/astro.js +8 -0
  4. package/components/Alert/Alert.tsx +4 -1
  5. package/components/Avatar/avatar.module.scss +2 -0
  6. package/components/Collapsible/Collapsible.astro +63 -0
  7. package/components/Collapsible/Collapsible.svelte +48 -0
  8. package/components/Collapsible/Collapsible.tsx +54 -0
  9. package/components/Collapsible/collapsible.module.scss +29 -0
  10. package/components/Collapsible/collapsible.ts +14 -0
  11. package/components/Modal/modal.module.scss +1 -1
  12. package/components/Popover/Popover.astro +23 -0
  13. package/components/Popover/Popover.svelte +21 -0
  14. package/components/Popover/Popover.tsx +27 -0
  15. package/components/Popover/popover.module.scss +51 -0
  16. package/components/Popover/popover.ts +8 -0
  17. package/components/Sheet/Sheet.astro +29 -0
  18. package/components/Sheet/Sheet.svelte +24 -0
  19. package/components/Sheet/Sheet.tsx +32 -0
  20. package/components/Sheet/sheet.module.scss +68 -0
  21. package/components/Sheet/sheet.ts +10 -0
  22. package/components/Textarea/Textarea.astro +44 -0
  23. package/components/Textarea/Textarea.svelte +45 -0
  24. package/components/Textarea/Textarea.tsx +50 -0
  25. package/components/Textarea/textarea.module.scss +36 -0
  26. package/components/Textarea/textarea.ts +18 -0
  27. package/components/Toast/Toast.svelte +11 -6
  28. package/index.d.ts +69 -0
  29. package/index.js +2 -0
  30. package/package.json +2 -1
  31. package/react.d.ts +8 -0
  32. package/react.js +8 -0
  33. package/svelte.d.ts +8 -0
  34. package/svelte.js +8 -0
  35. package/utils/debounce.ts +24 -0
  36. package/utils/popover.ts +201 -0
  37. package/utils/toast.ts +0 -6
@@ -0,0 +1,10 @@
1
+ import type { ModalProps, ReactModalProps } from '../Modal/modal'
2
+
3
+ export type SheetProps = {
4
+ position?: 'left'
5
+ | 'top'
6
+ | 'bottom'
7
+ | null
8
+ } & ModalProps
9
+
10
+ export type ReactSheetProps = SheetProps & ReactModalProps
@@ -0,0 +1,44 @@
1
+ ---
2
+ import type { TextareaProps } from './textarea'
3
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
4
+
5
+ import styles from './textarea.module.scss'
6
+
7
+ interface Props extends TextareaProps {}
8
+
9
+ const {
10
+ label,
11
+ placeholder,
12
+ subText,
13
+ value = '',
14
+ disabled,
15
+ className
16
+ } = Astro.props
17
+
18
+ const classes = [
19
+ styles.textarea,
20
+ className
21
+ ]
22
+
23
+ const useLabel = !!(label || subText)
24
+ ---
25
+
26
+ <ConditionalWrapper condition={useLabel}>
27
+ <label slot="wrapper" class={styles['label-wrapper']}>
28
+ {label && (
29
+ <div class={styles.label}>{label}</div>
30
+ )}
31
+ children
32
+ {subText && (
33
+ <div class={styles.subtext}>
34
+ <Fragment set:html={subText} />
35
+ </div>
36
+ )}
37
+ </label>
38
+
39
+ <textarea
40
+ placeholder={placeholder}
41
+ disabled={disabled}
42
+ class:list={classes}
43
+ >{value}</textarea>
44
+ </ConditionalWrapper>
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ import type { SvelteTextareaProps } from './textarea'
3
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
4
+
5
+ import styles from './textarea.module.scss'
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ export let label: SvelteTextareaProps['label'] = ''
9
+ export let placeholder: SvelteTextareaProps['placeholder'] = ''
10
+ export let subText: SvelteTextareaProps['subText'] = ''
11
+ export let value: SvelteTextareaProps['value'] = ''
12
+ export let disabled: SvelteTextareaProps['disabled'] = false
13
+ export let className: SvelteTextareaProps['className'] = ''
14
+ export let onChange: SvelteTextareaProps['onChange'] = () => {}
15
+ export let onKeyUp: SvelteTextareaProps['onKeyUp'] = () => {}
16
+
17
+ const classes = classNames([
18
+ styles.textarea,
19
+ className
20
+ ])
21
+
22
+ const useLabel = !!(label || subText)
23
+ </script>
24
+
25
+ <ConditionalWrapper
26
+ condition={useLabel}
27
+ element="label"
28
+ class={styles['label-wrapper']}
29
+ >
30
+ {#if label}
31
+ <div class={styles.label}>{label}</div>
32
+ {/if}
33
+ <textarea
34
+ placeholder={placeholder}
35
+ disabled={disabled}
36
+ class={classes}
37
+ on:change={onChange}
38
+ on:keyup={onKeyUp}
39
+ >{value}</textarea>
40
+ {#if subText}
41
+ <div class={styles.subtext}>
42
+ {@html subText}
43
+ </div>
44
+ {/if}
45
+ </ConditionalWrapper>
@@ -0,0 +1,50 @@
1
+ import React from 'react'
2
+ import type { ReactTextareaProps } from './textarea'
3
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
4
+
5
+ import styles from './textarea.module.scss'
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ const Textarea = ({
9
+ label,
10
+ placeholder,
11
+ subText,
12
+ value = '',
13
+ disabled,
14
+ className,
15
+ ...rest
16
+ }: ReactTextareaProps) => {
17
+ const classes = classNames([
18
+ styles.textarea,
19
+ className
20
+ ])
21
+
22
+ const useLabel = !!(label || subText)
23
+
24
+ return (
25
+ <ConditionalWrapper condition={useLabel} wrapper={children => (
26
+ <label className={styles['label-wrapper']}>
27
+ {label && (
28
+ <div className={styles.label}>{label}</div>
29
+ )}
30
+ {children}
31
+ {subText && (
32
+ <div
33
+ className={styles.subtext}
34
+ dangerouslySetInnerHTML={{ __html: subText }}
35
+ />
36
+ )}
37
+ </label>
38
+ )}>
39
+ <textarea
40
+ placeholder={placeholder}
41
+ disabled={disabled}
42
+ className={classes}
43
+ defaultValue={value}
44
+ {...rest}
45
+ />
46
+ </ConditionalWrapper>
47
+ )
48
+ }
49
+
50
+ export default Textarea
@@ -0,0 +1,36 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ .textarea {
4
+ @include size('w100%');
5
+ @include background(transparent);
6
+ @include border-radius(sm);
7
+ @include border(primary-50);
8
+ @include spacing(p-sm);
9
+ @include typography(regular, primary, hlg);
10
+
11
+ min-height: 50px;
12
+ resize: vertical;
13
+
14
+ &[disabled] {
15
+ @include typography(primary-30);
16
+ cursor: no-drop;
17
+ }
18
+
19
+ &::placeholder {
20
+ @include typography(primary-30);
21
+ }
22
+ }
23
+
24
+ .label-wrapper {
25
+ @include layout(flex, column);
26
+
27
+ .label {
28
+ @include typography(primary-20);
29
+ @include spacing(mb-xs);
30
+ }
31
+
32
+ .subtext {
33
+ @include typography(md, primary-30);
34
+ @include spacing(mt-xs);
35
+ }
36
+ }
@@ -0,0 +1,18 @@
1
+ export type TextareaProps = {
2
+ label?: string
3
+ placeholder?: string
4
+ subText?: string
5
+ value?: string
6
+ disabled?: boolean
7
+ className?: string
8
+ }
9
+
10
+ export type SvelteTextareaProps = {
11
+ onChange?: (e: any) => any
12
+ onKeyUp?: (e: any) => any
13
+ } & TextareaProps
14
+
15
+ export type ReactTextareaProps = {
16
+ onChange?: (e: any) => any
17
+ onKeyUp?: (e: any) => any
18
+ } & TextareaProps
@@ -24,9 +24,14 @@
24
24
  }
25
25
  </script>
26
26
 
27
- <Alert {...$$restProps} className={classes} {...additionalProps}>
28
- {#if $$slots.icon}
29
- <slot name="icon" />
30
- {/if}
31
- <slot />
32
- </Alert>
27
+ {#if $$slots.icon}
28
+ <Alert {...$$restProps} className={classes} {...additionalProps}>
29
+ <slot slot="icon" name="icon" />
30
+ <slot />
31
+ </Alert>
32
+ {:else}
33
+ <Alert {...$$restProps} className={classes} {...additionalProps}>
34
+ <slot />
35
+ </Alert>
36
+ {/if}
37
+
package/index.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ type PopoverPosition = 'top'
2
+ | 'top-start'
3
+ | 'top-end'
4
+ | 'left'
5
+ | 'left-start'
6
+ | 'left-end'
7
+ | 'right'
8
+ | 'right-start'
9
+ | 'right-end'
10
+ | 'bottom'
11
+ | 'bottom-start'
12
+ | 'bottom-end'
13
+
14
+ type Popover = {
15
+ trigger: string
16
+ popover: string
17
+ position?: PopoverPosition
18
+ offset?: number
19
+ closeOnBlur?: boolean
20
+ }
21
+
22
+ type Toast = {
23
+ element: string
24
+ timeout?: number
25
+ title?: string
26
+ content?: string
27
+ theme?: 'info' | 'success' | 'warning' | 'alert' | null
28
+ position?: 'bottom-left'
29
+ | 'top-left'
30
+ | 'top-right'
31
+ | 'bottom-full'
32
+ | 'top-full'
33
+ }
34
+
35
+ declare module 'webcoreui' {
36
+ export const classNames = (classes: any[]) => string
37
+
38
+ export const setCookie = (name: string, value: string, days: number) => {}
39
+ export const getCookie = (name: string) => string | null
40
+ export const removeCookie = (name: string) => {}
41
+
42
+ export const debounce = (fn: any, waitFor: number) => any
43
+
44
+ export const dispatch = (event: string, detail: any) => {}
45
+ export const listen = (event: string, callback: (e: any) => any) => {
46
+ remove()
47
+ }
48
+
49
+ export const clamp = (num: number, min: number, max: number) => number
50
+ export const lerp = (start: number, end: number, value: number) => number
51
+ export const invlerp = (start: number, end: number, value: number) => number
52
+ export const interpolate = (
53
+ value: number,
54
+ input: [start: number, end: number],
55
+ output: [start: number, end: number],
56
+ ) => number
57
+
58
+ export const modal = (selector: string) => {}
59
+ export const closeModal = (selector: string) => {}
60
+
61
+ export const popover = (config: Popover) => {
62
+ remove()
63
+ }
64
+ export const closePopover = (selector: string) => {}
65
+
66
+ export const setDefaultTimeout = (time: number) => number
67
+ export const toast = (config: Toast | string) => {}
68
+ export const hideToast = (element: string) => {}
69
+ }
package/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from './utils/classNames.ts'
2
2
  export * from './utils/cookies.ts'
3
+ export * from './utils/debounce.ts'
3
4
  export * from './utils/event.ts'
4
5
  export * from './utils/interpolate.ts'
5
6
  export * from './utils/modal.ts'
7
+ export * from './utils/popover.ts'
6
8
  export * from './utils/toast.ts'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webcoreui",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "scripts": {
6
6
  "dev": "astro dev",
7
7
  "build": "astro check && astro build",
@@ -43,6 +43,7 @@
43
43
  "react.d.ts",
44
44
  "react.js",
45
45
  "index.js",
46
+ "index.d.ts",
46
47
  "README.md",
47
48
  "LICENSE"
48
49
  ],
package/react.d.ts CHANGED
@@ -6,19 +6,23 @@ import type { ReactBadgeProps } from './components/Badge/badge'
6
6
  import type { ReactButtonProps } from './components/Button/button'
7
7
  import type { ReactCardProps } from './components/Card/card'
8
8
  import type { ReactCheckboxProps } from './components/Checkbox/checkbox'
9
+ import type { ReactCollapsibleProps } from './components/Collapsible/collapsible'
9
10
  import type { ReactConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
10
11
  import type { IconProps } from './components/Icon/icon'
11
12
  import type { ReactInputProps } from './components/Input/input'
12
13
  import type { ReactMenuProps } from './components/Menu/menu'
13
14
  import type { ReactModalProps } from './components/Modal/modal'
15
+ import type { ReactPopoverProps } from './components/Popover/popover'
14
16
  import type { ProgressProps } from './components/Progress/progress'
15
17
  import type { ReactRadioProps } from './components/Radio/radio'
16
18
  import type { RatingProps } from './components/Rating/rating'
19
+ import type { ReactSheetProps } from './components/Sheet/sheet'
17
20
  import type { ReactSliderProps } from './components/Slider/slider'
18
21
  import type { SpinnerProps } from './components/Spinner/spinner'
19
22
  import type { ReactSwitchProps } from './components/Switch/switch'
20
23
  import type { TableProps } from './components/Table/table'
21
24
  import type { ReactTabsProps } from './components/Tabs/tabs'
25
+ import type { ReactTextareaProps } from './components/Textarea/textarea'
22
26
  import type { ReactThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
23
27
  import type { ReactTimelineProps } from './components/Timeline/timeline'
24
28
  import type { ReactTimelineItemProps } from './components/TimelineItem/timelineitem'
@@ -32,19 +36,23 @@ declare module 'webcoreui/react' {
32
36
  export const Button: FC<ReactButtonProps>
33
37
  export const Card: FC<ReactCardProps>
34
38
  export const Checkbox: FC<ReactCheckboxProps>
39
+ export const Collapsible: FC<ReactCollapsibleProps>
35
40
  export const ConditionalWrapper: FC<ReactConditionalWrapperProps>
36
41
  export const Icon: FC<IconProps>
37
42
  export const Input: FC<ReactInputProps>
38
43
  export const Menu: FC<ReactMenuProps>
39
44
  export const Modal: FC<ReactModalProps>
45
+ export const Popover: FC<ReactPopoverProps>
40
46
  export const Progress: FC<ProgressProps>
41
47
  export const Radio: FC<ReactRadioProps>
42
48
  export const Rating: FC<RatingProps>
49
+ export const Sheet: FC<ReactSheetProps>
43
50
  export const Slider: FC<ReactSliderProps>
44
51
  export const Spinner: FC<SpinnerProps>
45
52
  export const Switch: FC<ReactSwitchProps>
46
53
  export const Table: FC<TableProps>
47
54
  export const Tabs: FC<ReactTabsProps>
55
+ export const Textarea: FC<ReactTextareaProps>
48
56
  export const ThemeSwitcher: FC<ReactThemeSwitcherProps>
49
57
  export const Timeline: FC<ReactTimelineProps>
50
58
  export const TimelineItem: FC<ReactTimelineItemProps>
package/react.js CHANGED
@@ -5,19 +5,23 @@ import BadgeComponent from './components/Badge/Badge.tsx'
5
5
  import ButtonComponent from './components/Button/Button.tsx'
6
6
  import CardComponent from './components/Card/Card.tsx'
7
7
  import CheckboxComponent from './components/Checkbox/Checkbox.tsx'
8
+ import CollapsibleComponent from './components/Collapsible/Collapsible.tsx'
8
9
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.tsx'
9
10
  import IconComponent from './components/Icon/Icon.tsx'
10
11
  import InputComponent from './components/Input/Input.tsx'
11
12
  import MenuComponent from './components/Menu/Menu.tsx'
12
13
  import ModalComponent from './components/Modal/Modal.tsx'
14
+ import PopoverComponent from './components/Popover/Popover.tsx'
13
15
  import ProgressComponent from './components/Progress/Progress.tsx'
14
16
  import RadioComponent from './components/Radio/Radio.tsx'
15
17
  import RatingComponent from './components/Rating/Rating.tsx'
18
+ import SheetComponent from './components/Sheet/Sheet.tsx'
16
19
  import SliderComponent from './components/Slider/Slider.tsx'
17
20
  import SpinnerComponent from './components/Spinner/Spinner.tsx'
18
21
  import SwitchComponent from './components/Switch/Switch.tsx'
19
22
  import TableComponent from './components/Table/Table.tsx'
20
23
  import TabsComponent from './components/Tabs/Tabs.tsx'
24
+ import TextareaComponent from './components/Textarea/Textarea.tsx'
21
25
  import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.tsx'
22
26
  import TimelineComponent from './components/Timeline/Timeline.tsx'
23
27
  import TimelineItemComponent from './components/TimelineItem/TimelineItem.tsx'
@@ -30,19 +34,23 @@ export const Badge = BadgeComponent
30
34
  export const Button = ButtonComponent
31
35
  export const Card = CardComponent
32
36
  export const Checkbox = CheckboxComponent
37
+ export const Collapsible = CollapsibleComponent
33
38
  export const ConditionalWrapper = ConditionalWrapperComponent
34
39
  export const Icon = IconComponent
35
40
  export const Input = InputComponent
36
41
  export const Menu = MenuComponent
37
42
  export const Modal = ModalComponent
43
+ export const Popover = PopoverComponent
38
44
  export const Progress = ProgressComponent
39
45
  export const Radio = RadioComponent
40
46
  export const Rating = RatingComponent
47
+ export const Sheet = SheetComponent
41
48
  export const Slider = SliderComponent
42
49
  export const Spinner = SpinnerComponent
43
50
  export const Switch = SwitchComponent
44
51
  export const Table = TableComponent
45
52
  export const Tabs = TabsComponent
53
+ export const Textarea = TextareaComponent
46
54
  export const ThemeSwitcher = ThemeSwitcherComponent
47
55
  export const Timeline = TimelineComponent
48
56
  export const TimelineItem = TimelineItemComponent
package/svelte.d.ts CHANGED
@@ -5,19 +5,23 @@ import type { SvelteBadgeProps } from './components/Badge/badge'
5
5
  import type { SvelteButtonProps } from './components/Button/button'
6
6
  import type { CardProps } from './components/Card/card'
7
7
  import type { SvelteCheckboxProps } from './components/Checkbox/checkbox'
8
+ import type { CollapsibleProps } from './components/Collapsible/collapsible'
8
9
  import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
9
10
  import type { IconProps } from './components/Icon/icon'
10
11
  import type { SvelteInputProps } from './components/Input/input'
11
12
  import type { MenuProps } from './components/Menu/menu'
12
13
  import type { ModalProps } from './components/Modal/modal'
14
+ import type { PopoverProps } from './components/Popover/popover'
13
15
  import type { ProgressProps } from './components/Progress/progress'
14
16
  import type { SvelteRadioProps } from './components/Radio/radio'
15
17
  import type { RatingProps } from './components/Rating/rating'
18
+ import type { SheetProps } from './components/Sheet/sheet'
16
19
  import type { SvelteSliderProps } from './components/Slider/slider'
17
20
  import type { SpinnerProps } from './components/Spinner/spinner'
18
21
  import type { SvelteSwitchProps } from './components/Switch/switch'
19
22
  import type { TableProps } from './components/Table/table'
20
23
  import type { TabsProps } from './components/Tabs/tabs'
24
+ import type { SvelteTextareaProps } from './components/Textarea/textarea'
21
25
  import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
22
26
  import type { TimelineProps } from './components/Timeline/timeline'
23
27
  import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
@@ -31,19 +35,23 @@ declare module 'webcoreui/svelte' {
31
35
  export function Button(_props: SvelteButtonProps): any
32
36
  export function Card(_props: CardProps): any
33
37
  export function Checkbox(_props: SvelteCheckboxProps): any
38
+ export function Collapsible(_props: CollapsibleProps): any
34
39
  export function ConditionalWrapper(_props: ConditionalWrapperProps): any
35
40
  export function Icon(_props: IconProps): any
36
41
  export function Input(_props: SvelteInputProps): any
37
42
  export function Menu(_props: MenuProps): any
38
43
  export function Modal(_props: ModalProps): any
44
+ export function Popover(_props: PopoverProps): any
39
45
  export function Progress(_props: ProgressProps): any
40
46
  export function Radio(_props: SvelteRadioProps): any
41
47
  export function Rating(_props: RatingProps): any
48
+ export function Sheet(_props: SheetProps): any
42
49
  export function Slider(_props: SvelteSliderProps): any
43
50
  export function Spinner(_props: SpinnerProps): any
44
51
  export function Switch(_props: SvelteSwitchProps): any
45
52
  export function Table(_props: TableProps): any
46
53
  export function Tabs(_props: TabsProps): any
54
+ export function Textarea(_props: SvelteTextareaProps): any
47
55
  export function ThemeSwitcher(_props: ThemeSwitcherProps): any
48
56
  export function Timeline(_props: TimelineProps): any
49
57
  export function TimelineItem(_props: TimelineItemProps): any
package/svelte.js CHANGED
@@ -5,19 +5,23 @@ import BadgeComponent from './components/Badge/Badge.svelte'
5
5
  import ButtonComponent from './components/Button/Button.svelte'
6
6
  import CardComponent from './components/Card/Card.svelte'
7
7
  import CheckboxComponent from './components/Checkbox/Checkbox.svelte'
8
+ import CollapsibleComponent from './components/Collapsible/Collapsible.svelte'
8
9
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.svelte'
9
10
  import IconComponent from './components/Icon/Icon.svelte'
10
11
  import InputComponent from './components/Input/Input.svelte'
11
12
  import MenuComponent from './components/Menu/Menu.svelte'
12
13
  import ModalComponent from './components/Modal/Modal.svelte'
14
+ import PopoverComponent from './components/Popover/Popover.svelte'
13
15
  import ProgressComponent from './components/Progress/Progress.svelte'
14
16
  import RadioComponent from './components/Radio/Radio.svelte'
15
17
  import RatingComponent from './components/Rating/Rating.svelte'
18
+ import SheetComponent from './components/Sheet/Sheet.svelte'
16
19
  import SliderComponent from './components/Slider/Slider.svelte'
17
20
  import SpinnerComponent from './components/Spinner/Spinner.svelte'
18
21
  import SwitchComponent from './components/Switch/Switch.svelte'
19
22
  import TableComponent from './components/Table/Table.svelte'
20
23
  import TabsComponent from './components/Tabs/Tabs.svelte'
24
+ import TextareaComponent from './components/Textarea/Textarea.svelte'
21
25
  import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.svelte'
22
26
  import TimelineComponent from './components/Timeline/Timeline.svelte'
23
27
  import TimelineItemComponent from './components/TimelineItem/TimelineItem.svelte'
@@ -30,19 +34,23 @@ export const Badge = BadgeComponent
30
34
  export const Button = ButtonComponent
31
35
  export const Card = CardComponent
32
36
  export const Checkbox = CheckboxComponent
37
+ export const Collapsible = CollapsibleComponent
33
38
  export const ConditionalWrapper = ConditionalWrapperComponent
34
39
  export const Icon = IconComponent
35
40
  export const Input = InputComponent
36
41
  export const Menu = MenuComponent
37
42
  export const Modal = ModalComponent
43
+ export const Popover = PopoverComponent
38
44
  export const Progress = ProgressComponent
39
45
  export const Radio = RadioComponent
40
46
  export const Rating = RatingComponent
47
+ export const Sheet = SheetComponent
41
48
  export const Slider = SliderComponent
42
49
  export const Spinner = SpinnerComponent
43
50
  export const Switch = SwitchComponent
44
51
  export const Table = TableComponent
45
52
  export const Tabs = TabsComponent
53
+ export const Textarea = TextareaComponent
46
54
  export const ThemeSwitcher = ThemeSwitcherComponent
47
55
  export const Timeline = TimelineComponent
48
56
  export const TimelineItem = TimelineItemComponent
@@ -0,0 +1,24 @@
1
+ export const debounce = (fn: any, waitFor = 100) => {
2
+ let timeout: ReturnType<typeof setTimeout> | null
3
+
4
+ const clear = () => {
5
+ if (timeout !== null) {
6
+ clearTimeout(timeout)
7
+ timeout = null
8
+ }
9
+ }
10
+
11
+ const debouncedFn = (...args: any[]) => {
12
+ clear()
13
+
14
+ timeout = setTimeout(() => {
15
+ fn(...args)
16
+ }, waitFor)
17
+ }
18
+
19
+ debouncedFn.cancel = () => {
20
+ clear()
21
+ }
22
+
23
+ return debouncedFn
24
+ }