webcoreui 0.2.0 → 0.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/README.md +12 -1
- package/astro.d.ts +15 -1
- package/astro.js +14 -0
- package/components/Accordion/Accordion.astro +2 -0
- package/components/Accordion/Accordion.svelte +2 -0
- package/components/Accordion/Accordion.tsx +2 -0
- package/components/Alert/Alert.astro +3 -2
- package/components/Alert/Alert.svelte +4 -3
- package/components/Alert/Alert.tsx +7 -3
- package/components/Avatar/Avatar.astro +2 -1
- package/components/Avatar/Avatar.svelte +2 -1
- package/components/Avatar/Avatar.tsx +3 -3
- package/components/Avatar/avatar.module.scss +2 -0
- package/components/Badge/Badge.astro +1 -0
- package/components/Badge/Badge.svelte +3 -2
- package/components/Badge/Badge.tsx +2 -1
- package/components/Button/Button.astro +4 -5
- package/components/Button/Button.svelte +2 -1
- package/components/Button/Button.tsx +2 -1
- package/components/Button/button.ts +1 -1
- package/components/Card/Card.astro +11 -3
- package/components/Card/Card.svelte +5 -2
- package/components/Card/Card.tsx +5 -2
- package/components/Card/card.ts +1 -0
- package/components/Checkbox/Checkbox.astro +1 -0
- package/components/Checkbox/Checkbox.svelte +7 -5
- package/components/Checkbox/Checkbox.tsx +4 -2
- package/components/Collapsible/Collapsible.astro +64 -0
- package/components/Collapsible/Collapsible.svelte +49 -0
- package/components/Collapsible/Collapsible.tsx +55 -0
- package/components/Collapsible/collapsible.module.scss +29 -0
- package/components/Collapsible/collapsible.ts +14 -0
- package/components/ConditionalWrapper/ConditionalWrapper.astro +2 -1
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +1 -2
- package/components/Group/Group.astro +22 -0
- package/components/Group/Group.svelte +20 -0
- package/components/Group/Group.tsx +22 -0
- package/components/Group/group.module.scss +43 -0
- package/components/Group/group.ts +8 -0
- package/components/Icon/map.ts +2 -0
- package/components/Input/Input.astro +8 -1
- package/components/Input/Input.svelte +15 -3
- package/components/Input/Input.tsx +10 -3
- package/components/Input/input.module.scss +4 -1
- package/components/Input/input.ts +9 -4
- package/components/List/List.astro +169 -0
- package/components/List/List.svelte +147 -0
- package/components/List/List.tsx +168 -0
- package/components/List/list.module.scss +91 -0
- package/components/List/list.ts +37 -0
- package/components/Menu/Menu.astro +2 -1
- package/components/Menu/Menu.svelte +7 -5
- package/components/Menu/Menu.tsx +116 -113
- package/components/Modal/Modal.astro +6 -4
- package/components/Modal/Modal.svelte +8 -6
- package/components/Modal/Modal.tsx +79 -76
- package/components/Modal/modal.module.scss +1 -1
- package/components/Modal/modal.ts +1 -0
- package/components/Popover/Popover.astro +26 -0
- package/components/Popover/Popover.svelte +23 -0
- package/components/Popover/Popover.tsx +55 -0
- package/components/Popover/popover.module.scss +52 -0
- package/components/Popover/popover.ts +10 -0
- package/components/Progress/Progress.astro +2 -1
- package/components/Progress/Progress.svelte +2 -1
- package/components/Progress/Progress.tsx +3 -2
- package/components/Radio/Radio.astro +1 -0
- package/components/Radio/Radio.svelte +4 -2
- package/components/Radio/Radio.tsx +3 -2
- package/components/Rating/Rating.astro +3 -1
- package/components/Rating/Rating.svelte +9 -7
- package/components/Rating/Rating.tsx +4 -2
- package/components/Select/Select.astro +135 -0
- package/components/Select/Select.svelte +122 -0
- package/components/Select/Select.tsx +142 -0
- package/components/Select/select.module.scss +25 -0
- package/components/Select/select.ts +21 -0
- package/components/Sheet/Sheet.astro +30 -0
- package/components/Sheet/Sheet.svelte +25 -0
- package/components/Sheet/Sheet.tsx +33 -0
- package/components/Sheet/sheet.module.scss +68 -0
- package/components/Sheet/sheet.ts +10 -0
- package/components/Slider/Slider.astro +2 -1
- package/components/Slider/Slider.svelte +2 -1
- package/components/Slider/Slider.tsx +49 -48
- package/components/Spinner/Spinner.astro +4 -3
- package/components/Spinner/Spinner.svelte +3 -2
- package/components/Spinner/Spinner.tsx +4 -3
- package/components/Switch/Switch.astro +2 -1
- package/components/Switch/Switch.svelte +5 -4
- package/components/Switch/Switch.tsx +2 -2
- package/components/Switch/switch.module.scss +1 -1
- package/components/Table/Table.astro +1 -0
- package/components/Table/Table.svelte +2 -1
- package/components/Table/Table.tsx +2 -1
- package/components/Tabs/Tabs.astro +2 -1
- package/components/Tabs/Tabs.svelte +2 -1
- package/components/Tabs/Tabs.tsx +4 -3
- package/components/Textarea/Textarea.astro +45 -0
- package/components/Textarea/Textarea.svelte +47 -0
- package/components/Textarea/Textarea.tsx +52 -0
- package/components/Textarea/textarea.module.scss +36 -0
- package/components/Textarea/textarea.ts +18 -0
- package/components/ThemeSwitcher/ThemeSwitcher.astro +108 -107
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +5 -4
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +91 -90
- package/components/Timeline/Timeline.astro +3 -2
- package/components/Timeline/Timeline.svelte +3 -2
- package/components/Timeline/Timeline.tsx +3 -2
- package/components/TimelineItem/TimelineItem.svelte +2 -1
- package/components/TimelineItem/TimelineItem.tsx +2 -1
- package/components/Toast/Toast.astro +3 -1
- package/components/Toast/Toast.svelte +14 -7
- package/components/Toast/Toast.tsx +3 -1
- package/icons/moon.svg +1 -1
- package/icons/search.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/index.d.ts +99 -0
- package/index.js +2 -0
- package/package.json +23 -4
- package/react.d.ts +14 -0
- package/react.js +14 -0
- package/scss/config/mixins.scss +12 -10
- package/scss/config/variables.scss +1 -0
- package/scss/config.scss +1 -0
- package/scss/global/utility.scss +2 -0
- package/svelte.d.ts +15 -1
- package/svelte.js +14 -0
- package/utils/cookies.ts +4 -4
- package/utils/debounce.ts +24 -0
- package/utils/event.ts +2 -2
- package/utils/interpolate.ts +5 -5
- package/utils/modal.ts +90 -27
- package/utils/popover.ts +223 -0
- package/utils/toast.ts +6 -8
package/index.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
type ModalCallback = {
|
|
3
|
+
trigger: Element | null
|
|
4
|
+
modal: HTMLElement
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type Modal = {
|
|
8
|
+
trigger: string
|
|
9
|
+
modal: string
|
|
10
|
+
onOpen?: (args: ModalCallback) => unknown
|
|
11
|
+
onClose?: (args: ModalCallback) => unknown
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type PopoverPosition = 'top'
|
|
15
|
+
| 'top-start'
|
|
16
|
+
| 'top-end'
|
|
17
|
+
| 'left'
|
|
18
|
+
| 'left-start'
|
|
19
|
+
| 'left-end'
|
|
20
|
+
| 'right'
|
|
21
|
+
| 'right-start'
|
|
22
|
+
| 'right-end'
|
|
23
|
+
| 'bottom'
|
|
24
|
+
| 'bottom-start'
|
|
25
|
+
| 'bottom-end'
|
|
26
|
+
|
|
27
|
+
type PopoverCallback = {
|
|
28
|
+
trigger: HTMLElement
|
|
29
|
+
popover: HTMLElement
|
|
30
|
+
position: PopoverPosition | undefined
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type Popover = {
|
|
34
|
+
trigger: string
|
|
35
|
+
popover: string
|
|
36
|
+
position?: PopoverPosition
|
|
37
|
+
offset?: number
|
|
38
|
+
closeOnBlur?: boolean
|
|
39
|
+
onOpen?: (args: PopoverCallback) => unknown
|
|
40
|
+
onClose?: (args: PopoverCallback) => unknown
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type Toast = {
|
|
44
|
+
element: string
|
|
45
|
+
timeout?: number
|
|
46
|
+
title?: string
|
|
47
|
+
content?: string
|
|
48
|
+
position?: 'bottom-left'
|
|
49
|
+
| 'top-left'
|
|
50
|
+
| 'top-right'
|
|
51
|
+
| 'bottom-full'
|
|
52
|
+
| 'top-full'
|
|
53
|
+
| null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare module 'webcoreui' {
|
|
57
|
+
export const classNames: (classes: any[]) => string
|
|
58
|
+
|
|
59
|
+
export const setCookie: (name: string, value: string, days: number) => void
|
|
60
|
+
export const getCookie: (name: string) => string | null
|
|
61
|
+
export const removeCookie: (name: string) => void
|
|
62
|
+
|
|
63
|
+
export const debounce: <T extends (...args: any[]) => any>(
|
|
64
|
+
fn: T,
|
|
65
|
+
waitFor?: number
|
|
66
|
+
) => {
|
|
67
|
+
(...args: Parameters<T>): void
|
|
68
|
+
cancel: () => void
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const dispatch: (event: string, detail: unknown) => void
|
|
72
|
+
export const listen: (event: string, callback: (e: any) => unknown) => {
|
|
73
|
+
remove: () => void
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const clamp: (num: number, min: number, max: number) => number
|
|
77
|
+
export const lerp: (start: number, end: number, value: number) => number
|
|
78
|
+
export const invlerp: (start: number, end: number, value: number) => number
|
|
79
|
+
export const interpolate: (
|
|
80
|
+
value: number,
|
|
81
|
+
input: [start: number, end: number],
|
|
82
|
+
output: [start: number, end: number]
|
|
83
|
+
) => number
|
|
84
|
+
|
|
85
|
+
export const modal: (config: Modal | string) => {
|
|
86
|
+
open: () => void
|
|
87
|
+
remove: () => void
|
|
88
|
+
} | void
|
|
89
|
+
export const closeModal: (modal: string) => void
|
|
90
|
+
|
|
91
|
+
export const popover: (config: Popover) => {
|
|
92
|
+
remove: () => void
|
|
93
|
+
} | void
|
|
94
|
+
export const closePopover: (selector: string) => void
|
|
95
|
+
|
|
96
|
+
export const setDefaultTimeout: (time: number) => number
|
|
97
|
+
export const toast: (config: Toast | string) => void
|
|
98
|
+
export const hideToast: (element: string) => void
|
|
99
|
+
}
|
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,24 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcoreui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"scripts": {
|
|
6
|
+
"prepare": "husky",
|
|
7
|
+
"pre-commit": "lint-staged",
|
|
6
8
|
"dev": "astro dev",
|
|
7
9
|
"build": "astro check && astro build",
|
|
8
10
|
"build:package": "node scripts/build.js",
|
|
9
11
|
"test": "echo \"Error: no test specified\"",
|
|
10
|
-
"create-component": "node scripts/createComponent.js"
|
|
12
|
+
"create-component": "node scripts/createComponent.js",
|
|
13
|
+
"lint": "eslint src/**/* --fix"
|
|
11
14
|
},
|
|
12
|
-
"
|
|
15
|
+
"devDependencies": {
|
|
13
16
|
"@astrojs/check": "0.7.0",
|
|
14
17
|
"@astrojs/react": "3.5.0",
|
|
15
18
|
"@astrojs/svelte": "5.5.0",
|
|
19
|
+
"@eslint/js": "9.9.1",
|
|
20
|
+
"@typescript-eslint/parser": "^8.3.0",
|
|
16
21
|
"astro": "4.10.2",
|
|
22
|
+
"astro-eslint-parser": "1.0.2",
|
|
23
|
+
"eslint": "9.9.1",
|
|
24
|
+
"eslint-plugin-astro": "1.2.3",
|
|
25
|
+
"eslint-plugin-react": "7.35.0",
|
|
26
|
+
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
27
|
+
"eslint-plugin-svelte": "2.43.0",
|
|
28
|
+
"husky": "9.1.5",
|
|
29
|
+
"lint-staged": "15.2.9",
|
|
17
30
|
"react": "18.3.1",
|
|
18
31
|
"react-dom": "18.3.1",
|
|
19
32
|
"sass": "1.77.5",
|
|
20
33
|
"svelte": "4.2.18",
|
|
21
|
-
"
|
|
34
|
+
"svelte-eslint-parser": "0.41.0",
|
|
35
|
+
"typescript": "5.4.5",
|
|
36
|
+
"typescript-eslint": "8.3.0"
|
|
22
37
|
},
|
|
23
38
|
"exports": {
|
|
24
39
|
".": "./index.js",
|
|
@@ -43,6 +58,7 @@
|
|
|
43
58
|
"react.d.ts",
|
|
44
59
|
"react.js",
|
|
45
60
|
"index.js",
|
|
61
|
+
"index.d.ts",
|
|
46
62
|
"README.md",
|
|
47
63
|
"LICENSE"
|
|
48
64
|
],
|
|
@@ -68,5 +84,8 @@
|
|
|
68
84
|
},
|
|
69
85
|
"bugs": {
|
|
70
86
|
"url": "https://github.com/Frontendland/webcoreui/issues"
|
|
87
|
+
},
|
|
88
|
+
"lint-staged": {
|
|
89
|
+
"*.{js,ts,jsx,tsx,svelte,astro}": "eslint src/**/*"
|
|
71
90
|
}
|
|
72
91
|
}
|
package/react.d.ts
CHANGED
|
@@ -6,19 +6,26 @@ 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'
|
|
11
|
+
import type { ReactGroupProps } from './components/Group/group'
|
|
10
12
|
import type { IconProps } from './components/Icon/icon'
|
|
11
13
|
import type { ReactInputProps } from './components/Input/input'
|
|
14
|
+
import type { ReactListProps } from './components/List/list'
|
|
12
15
|
import type { ReactMenuProps } from './components/Menu/menu'
|
|
13
16
|
import type { ReactModalProps } from './components/Modal/modal'
|
|
17
|
+
import type { ReactPopoverProps } from './components/Popover/popover'
|
|
14
18
|
import type { ProgressProps } from './components/Progress/progress'
|
|
15
19
|
import type { ReactRadioProps } from './components/Radio/radio'
|
|
16
20
|
import type { RatingProps } from './components/Rating/rating'
|
|
21
|
+
import type { ReactSelectProps } from './components/Select/select'
|
|
22
|
+
import type { ReactSheetProps } from './components/Sheet/sheet'
|
|
17
23
|
import type { ReactSliderProps } from './components/Slider/slider'
|
|
18
24
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
19
25
|
import type { ReactSwitchProps } from './components/Switch/switch'
|
|
20
26
|
import type { TableProps } from './components/Table/table'
|
|
21
27
|
import type { ReactTabsProps } from './components/Tabs/tabs'
|
|
28
|
+
import type { ReactTextareaProps } from './components/Textarea/textarea'
|
|
22
29
|
import type { ReactThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
|
|
23
30
|
import type { ReactTimelineProps } from './components/Timeline/timeline'
|
|
24
31
|
import type { ReactTimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
@@ -32,19 +39,26 @@ declare module 'webcoreui/react' {
|
|
|
32
39
|
export const Button: FC<ReactButtonProps>
|
|
33
40
|
export const Card: FC<ReactCardProps>
|
|
34
41
|
export const Checkbox: FC<ReactCheckboxProps>
|
|
42
|
+
export const Collapsible: FC<ReactCollapsibleProps>
|
|
35
43
|
export const ConditionalWrapper: FC<ReactConditionalWrapperProps>
|
|
44
|
+
export const Group: FC<ReactGroupProps>
|
|
36
45
|
export const Icon: FC<IconProps>
|
|
37
46
|
export const Input: FC<ReactInputProps>
|
|
47
|
+
export const List: FC<ReactListProps>
|
|
38
48
|
export const Menu: FC<ReactMenuProps>
|
|
39
49
|
export const Modal: FC<ReactModalProps>
|
|
50
|
+
export const Popover: FC<ReactPopoverProps>
|
|
40
51
|
export const Progress: FC<ProgressProps>
|
|
41
52
|
export const Radio: FC<ReactRadioProps>
|
|
42
53
|
export const Rating: FC<RatingProps>
|
|
54
|
+
export const Select: FC<ReactSelectProps>
|
|
55
|
+
export const Sheet: FC<ReactSheetProps>
|
|
43
56
|
export const Slider: FC<ReactSliderProps>
|
|
44
57
|
export const Spinner: FC<SpinnerProps>
|
|
45
58
|
export const Switch: FC<ReactSwitchProps>
|
|
46
59
|
export const Table: FC<TableProps>
|
|
47
60
|
export const Tabs: FC<ReactTabsProps>
|
|
61
|
+
export const Textarea: FC<ReactTextareaProps>
|
|
48
62
|
export const ThemeSwitcher: FC<ReactThemeSwitcherProps>
|
|
49
63
|
export const Timeline: FC<ReactTimelineProps>
|
|
50
64
|
export const TimelineItem: FC<ReactTimelineItemProps>
|
package/react.js
CHANGED
|
@@ -5,19 +5,26 @@ 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'
|
|
10
|
+
import GroupComponent from './components/Group/Group.tsx'
|
|
9
11
|
import IconComponent from './components/Icon/Icon.tsx'
|
|
10
12
|
import InputComponent from './components/Input/Input.tsx'
|
|
13
|
+
import ListComponent from './components/List/List.tsx'
|
|
11
14
|
import MenuComponent from './components/Menu/Menu.tsx'
|
|
12
15
|
import ModalComponent from './components/Modal/Modal.tsx'
|
|
16
|
+
import PopoverComponent from './components/Popover/Popover.tsx'
|
|
13
17
|
import ProgressComponent from './components/Progress/Progress.tsx'
|
|
14
18
|
import RadioComponent from './components/Radio/Radio.tsx'
|
|
15
19
|
import RatingComponent from './components/Rating/Rating.tsx'
|
|
20
|
+
import SelectComponent from './components/Select/Select.tsx'
|
|
21
|
+
import SheetComponent from './components/Sheet/Sheet.tsx'
|
|
16
22
|
import SliderComponent from './components/Slider/Slider.tsx'
|
|
17
23
|
import SpinnerComponent from './components/Spinner/Spinner.tsx'
|
|
18
24
|
import SwitchComponent from './components/Switch/Switch.tsx'
|
|
19
25
|
import TableComponent from './components/Table/Table.tsx'
|
|
20
26
|
import TabsComponent from './components/Tabs/Tabs.tsx'
|
|
27
|
+
import TextareaComponent from './components/Textarea/Textarea.tsx'
|
|
21
28
|
import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.tsx'
|
|
22
29
|
import TimelineComponent from './components/Timeline/Timeline.tsx'
|
|
23
30
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.tsx'
|
|
@@ -30,19 +37,26 @@ export const Badge = BadgeComponent
|
|
|
30
37
|
export const Button = ButtonComponent
|
|
31
38
|
export const Card = CardComponent
|
|
32
39
|
export const Checkbox = CheckboxComponent
|
|
40
|
+
export const Collapsible = CollapsibleComponent
|
|
33
41
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
42
|
+
export const Group = GroupComponent
|
|
34
43
|
export const Icon = IconComponent
|
|
35
44
|
export const Input = InputComponent
|
|
45
|
+
export const List = ListComponent
|
|
36
46
|
export const Menu = MenuComponent
|
|
37
47
|
export const Modal = ModalComponent
|
|
48
|
+
export const Popover = PopoverComponent
|
|
38
49
|
export const Progress = ProgressComponent
|
|
39
50
|
export const Radio = RadioComponent
|
|
40
51
|
export const Rating = RatingComponent
|
|
52
|
+
export const Select = SelectComponent
|
|
53
|
+
export const Sheet = SheetComponent
|
|
41
54
|
export const Slider = SliderComponent
|
|
42
55
|
export const Spinner = SpinnerComponent
|
|
43
56
|
export const Switch = SwitchComponent
|
|
44
57
|
export const Table = TableComponent
|
|
45
58
|
export const Tabs = TabsComponent
|
|
59
|
+
export const Textarea = TextareaComponent
|
|
46
60
|
export const ThemeSwitcher = ThemeSwitcherComponent
|
|
47
61
|
export const Timeline = TimelineComponent
|
|
48
62
|
export const TimelineItem = TimelineItemComponent
|
package/scss/config/mixins.scss
CHANGED
|
@@ -330,18 +330,20 @@
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
@mixin transition($args...) {
|
|
333
|
-
$
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
@
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
333
|
+
@if (not $disableAnimations) {
|
|
334
|
+
$property: all;
|
|
335
|
+
$speed: .3s;
|
|
336
|
+
|
|
337
|
+
@each $arg in $args {
|
|
338
|
+
@if (meta.type-of($arg) == 'number') {
|
|
339
|
+
$speed: $arg;
|
|
340
|
+
} @else {
|
|
341
|
+
$property: $arg;
|
|
342
|
+
}
|
|
341
343
|
}
|
|
344
|
+
|
|
345
|
+
transition: $property $speed cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
342
346
|
}
|
|
343
|
-
|
|
344
|
-
transition: $property $speed cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
345
347
|
}
|
|
346
348
|
|
|
347
349
|
@mixin typography($args...) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$disableAnimations: false !default;
|
package/scss/config.scss
CHANGED
package/scss/global/utility.scss
CHANGED
package/svelte.d.ts
CHANGED
|
@@ -5,24 +5,31 @@ 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'
|
|
10
|
+
import type { GroupProps } from './components/Group/group'
|
|
9
11
|
import type { IconProps } from './components/Icon/icon'
|
|
10
12
|
import type { SvelteInputProps } from './components/Input/input'
|
|
13
|
+
import type { SvelteListProps } from './components/List/list'
|
|
11
14
|
import type { MenuProps } from './components/Menu/menu'
|
|
12
15
|
import type { ModalProps } from './components/Modal/modal'
|
|
16
|
+
import type { PopoverProps } from './components/Popover/popover'
|
|
13
17
|
import type { ProgressProps } from './components/Progress/progress'
|
|
14
18
|
import type { SvelteRadioProps } from './components/Radio/radio'
|
|
15
19
|
import type { RatingProps } from './components/Rating/rating'
|
|
20
|
+
import type { SvelteSelectProps } from './components/Select/select'
|
|
21
|
+
import type { SheetProps } from './components/Sheet/sheet'
|
|
16
22
|
import type { SvelteSliderProps } from './components/Slider/slider'
|
|
17
23
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
18
24
|
import type { SvelteSwitchProps } from './components/Switch/switch'
|
|
19
25
|
import type { TableProps } from './components/Table/table'
|
|
20
26
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
27
|
+
import type { SvelteTextareaProps } from './components/Textarea/textarea'
|
|
21
28
|
import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
|
|
22
29
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
23
30
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
24
31
|
import type { ToastProps } from './components/Toast/toast'
|
|
25
|
-
|
|
32
|
+
|
|
26
33
|
declare module 'webcoreui/svelte' {
|
|
27
34
|
export function Accordion(_props: AccordionProps): any
|
|
28
35
|
export function Alert(_props: AlertProps): any
|
|
@@ -31,19 +38,26 @@ declare module 'webcoreui/svelte' {
|
|
|
31
38
|
export function Button(_props: SvelteButtonProps): any
|
|
32
39
|
export function Card(_props: CardProps): any
|
|
33
40
|
export function Checkbox(_props: SvelteCheckboxProps): any
|
|
41
|
+
export function Collapsible(_props: CollapsibleProps): any
|
|
34
42
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
43
|
+
export function Group(_props: GroupProps): any
|
|
35
44
|
export function Icon(_props: IconProps): any
|
|
36
45
|
export function Input(_props: SvelteInputProps): any
|
|
46
|
+
export function List(_props: SvelteListProps): any
|
|
37
47
|
export function Menu(_props: MenuProps): any
|
|
38
48
|
export function Modal(_props: ModalProps): any
|
|
49
|
+
export function Popover(_props: PopoverProps): any
|
|
39
50
|
export function Progress(_props: ProgressProps): any
|
|
40
51
|
export function Radio(_props: SvelteRadioProps): any
|
|
41
52
|
export function Rating(_props: RatingProps): any
|
|
53
|
+
export function Select(_props: SvelteSelectProps): any
|
|
54
|
+
export function Sheet(_props: SheetProps): any
|
|
42
55
|
export function Slider(_props: SvelteSliderProps): any
|
|
43
56
|
export function Spinner(_props: SpinnerProps): any
|
|
44
57
|
export function Switch(_props: SvelteSwitchProps): any
|
|
45
58
|
export function Table(_props: TableProps): any
|
|
46
59
|
export function Tabs(_props: TabsProps): any
|
|
60
|
+
export function Textarea(_props: SvelteTextareaProps): any
|
|
47
61
|
export function ThemeSwitcher(_props: ThemeSwitcherProps): any
|
|
48
62
|
export function Timeline(_props: TimelineProps): any
|
|
49
63
|
export function TimelineItem(_props: TimelineItemProps): any
|
package/svelte.js
CHANGED
|
@@ -5,19 +5,26 @@ 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'
|
|
10
|
+
import GroupComponent from './components/Group/Group.svelte'
|
|
9
11
|
import IconComponent from './components/Icon/Icon.svelte'
|
|
10
12
|
import InputComponent from './components/Input/Input.svelte'
|
|
13
|
+
import ListComponent from './components/List/List.svelte'
|
|
11
14
|
import MenuComponent from './components/Menu/Menu.svelte'
|
|
12
15
|
import ModalComponent from './components/Modal/Modal.svelte'
|
|
16
|
+
import PopoverComponent from './components/Popover/Popover.svelte'
|
|
13
17
|
import ProgressComponent from './components/Progress/Progress.svelte'
|
|
14
18
|
import RadioComponent from './components/Radio/Radio.svelte'
|
|
15
19
|
import RatingComponent from './components/Rating/Rating.svelte'
|
|
20
|
+
import SelectComponent from './components/Select/Select.svelte'
|
|
21
|
+
import SheetComponent from './components/Sheet/Sheet.svelte'
|
|
16
22
|
import SliderComponent from './components/Slider/Slider.svelte'
|
|
17
23
|
import SpinnerComponent from './components/Spinner/Spinner.svelte'
|
|
18
24
|
import SwitchComponent from './components/Switch/Switch.svelte'
|
|
19
25
|
import TableComponent from './components/Table/Table.svelte'
|
|
20
26
|
import TabsComponent from './components/Tabs/Tabs.svelte'
|
|
27
|
+
import TextareaComponent from './components/Textarea/Textarea.svelte'
|
|
21
28
|
import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.svelte'
|
|
22
29
|
import TimelineComponent from './components/Timeline/Timeline.svelte'
|
|
23
30
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.svelte'
|
|
@@ -30,19 +37,26 @@ export const Badge = BadgeComponent
|
|
|
30
37
|
export const Button = ButtonComponent
|
|
31
38
|
export const Card = CardComponent
|
|
32
39
|
export const Checkbox = CheckboxComponent
|
|
40
|
+
export const Collapsible = CollapsibleComponent
|
|
33
41
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
42
|
+
export const Group = GroupComponent
|
|
34
43
|
export const Icon = IconComponent
|
|
35
44
|
export const Input = InputComponent
|
|
45
|
+
export const List = ListComponent
|
|
36
46
|
export const Menu = MenuComponent
|
|
37
47
|
export const Modal = ModalComponent
|
|
48
|
+
export const Popover = PopoverComponent
|
|
38
49
|
export const Progress = ProgressComponent
|
|
39
50
|
export const Radio = RadioComponent
|
|
40
51
|
export const Rating = RatingComponent
|
|
52
|
+
export const Select = SelectComponent
|
|
53
|
+
export const Sheet = SheetComponent
|
|
41
54
|
export const Slider = SliderComponent
|
|
42
55
|
export const Spinner = SpinnerComponent
|
|
43
56
|
export const Switch = SwitchComponent
|
|
44
57
|
export const Table = TableComponent
|
|
45
58
|
export const Tabs = TabsComponent
|
|
59
|
+
export const Textarea = TextareaComponent
|
|
46
60
|
export const ThemeSwitcher = ThemeSwitcherComponent
|
|
47
61
|
export const Timeline = TimelineComponent
|
|
48
62
|
export const TimelineItem = TimelineItemComponent
|
package/utils/cookies.ts
CHANGED
|
@@ -4,17 +4,17 @@ export const setCookie = (name: string, value: string, days: number) => {
|
|
|
4
4
|
if (days) {
|
|
5
5
|
const date = new Date()
|
|
6
6
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000))
|
|
7
|
-
expires =
|
|
7
|
+
expires = `; expires=${date.toUTCString()}`
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
document.cookie = name
|
|
10
|
+
document.cookie = `${name}=${value || ''}${expires}; path=/`
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const getCookie = (name: string) => {
|
|
14
14
|
const cookies = document.cookie.split(';')
|
|
15
15
|
|
|
16
16
|
for (const cookie of cookies) {
|
|
17
|
-
if (cookie.indexOf(name
|
|
17
|
+
if (cookie.indexOf(`${name}=`) > -1) {
|
|
18
18
|
return cookie.split('=')[1]
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -23,6 +23,6 @@ export const getCookie = (name: string) => {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export const removeCookie = (name: string) => {
|
|
26
|
-
document.cookie = name
|
|
26
|
+
document.cookie = `${name}=; Max-Age=-1;`
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -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
|
+
}
|
package/utils/event.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export const dispatch = (event: string, detail:
|
|
1
|
+
export const dispatch = (event: string, detail: unknown) => {
|
|
2
2
|
document.dispatchEvent(new CustomEvent(event, {
|
|
3
3
|
detail
|
|
4
4
|
}))
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export const listen = (event: string, callback: (e: any) =>
|
|
7
|
+
export const listen = (event: string, callback: (e: any) => unknown) => {
|
|
8
8
|
const fn = (e: any) => callback(e.detail)
|
|
9
9
|
|
|
10
10
|
document.addEventListener(event, fn)
|
package/utils/interpolate.ts
CHANGED
|
@@ -3,21 +3,21 @@ export const clamp = (
|
|
|
3
3
|
min: number,
|
|
4
4
|
max: number
|
|
5
5
|
) => Math.min(Math.max(num, min), max)
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
export const lerp = (
|
|
8
8
|
x: number,
|
|
9
9
|
y: number,
|
|
10
10
|
z: number
|
|
11
|
-
) => x * (1 - z) + y * z
|
|
12
|
-
|
|
11
|
+
) => (x * (1 - z)) + (y * z)
|
|
12
|
+
|
|
13
13
|
export const invlerp = (
|
|
14
14
|
x: number,
|
|
15
15
|
y: number,
|
|
16
16
|
z: number
|
|
17
17
|
) => clamp((z - x) / (y - x), 0, 1)
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
export const interpolate = (
|
|
20
20
|
value: number,
|
|
21
21
|
input: [x: number, y: number],
|
|
22
|
-
output: [x: number, y: number]
|
|
22
|
+
output: [x: number, y: number]
|
|
23
23
|
) => lerp(output[0], output[1], invlerp(input[0], input[1], value))
|