webcoreui 0.8.0 → 0.9.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 +16 -0
- package/astro.d.ts +23 -0
- package/astro.js +8 -0
- package/components/Accordion/accordion.module.scss +1 -0
- package/components/Badge/Badge.svelte +1 -1
- package/components/Badge/badge.ts +1 -1
- package/components/BottomNavigation/BottomNavigation.astro +51 -0
- package/components/BottomNavigation/BottomNavigation.svelte +45 -0
- package/components/BottomNavigation/BottomNavigation.tsx +63 -0
- package/components/BottomNavigation/bottomnavigation.module.scss +70 -0
- package/components/BottomNavigation/bottomnavigation.ts +16 -0
- package/components/Card/card.module.scss +1 -0
- package/components/Checkbox/Checkbox.astro +8 -2
- package/components/Checkbox/Checkbox.svelte +1 -0
- package/components/Checkbox/Checkbox.tsx +3 -1
- package/components/Checkbox/checkbox.ts +1 -0
- package/components/Copy/Copy.astro +74 -0
- package/components/Copy/Copy.svelte +61 -0
- package/components/Copy/Copy.tsx +73 -0
- package/components/Copy/copy.module.scss +37 -0
- package/components/Copy/copy.ts +14 -0
- package/components/DataTable/DataTable.astro +1 -1
- package/components/Flex/Flex.astro +34 -0
- package/components/Flex/Flex.svelte +27 -0
- package/components/Flex/Flex.tsx +30 -0
- package/components/Flex/flex.ts +22 -0
- package/components/Grid/Grid.astro +32 -0
- package/components/Grid/Grid.svelte +25 -0
- package/components/Grid/Grid.tsx +28 -0
- package/components/Grid/grid.ts +18 -0
- package/components/Icon/icon.ts +1 -0
- package/components/Icon/map.ts +2 -0
- package/components/Input/Input.astro +1 -1
- package/components/Input/Input.svelte +4 -2
- package/components/Input/Input.tsx +4 -1
- package/components/List/list.module.scss +3 -0
- package/components/Menu/Menu.svelte +5 -1
- package/components/Pagination/Pagination.svelte +1 -0
- package/components/Radio/Radio.astro +3 -1
- package/components/Radio/Radio.svelte +3 -2
- package/components/Radio/Radio.tsx +5 -3
- package/components/Radio/radio.ts +1 -0
- package/components/Select/Select.astro +34 -1
- package/components/Select/Select.svelte +40 -4
- package/components/Select/Select.tsx +33 -1
- package/components/Select/select.ts +4 -1
- package/components/Skeleton/Skeleton.astro +2 -2
- package/components/Skeleton/Skeleton.svelte +2 -2
- package/components/Skeleton/Skeleton.tsx +2 -2
- package/components/Switch/Switch.astro +3 -2
- package/components/Switch/Switch.svelte +1 -0
- package/components/Switch/Switch.tsx +3 -1
- package/components/Switch/switch.ts +1 -0
- package/components/Textarea/Textarea.astro +3 -1
- package/components/Textarea/Textarea.svelte +48 -47
- package/components/Textarea/textarea.ts +19 -18
- package/icons/copy.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/index.d.ts +74 -2
- package/index.js +1 -0
- package/package.json +24 -15
- package/react.d.ts +23 -0
- package/react.js +8 -0
- package/scss/config/color-palette.scss +1 -1
- package/scss/config/css-values.scss +1 -1
- package/scss/config/layout.scss +1 -1
- package/scss/config/mixins.scss +1 -1
- package/scss/config/typography.scss +1 -1
- package/scss/config/variables.scss +1 -1
- package/scss/config.scss +1 -1
- package/scss/global/utility.scss +48 -3
- package/svelte.d.ts +23 -0
- package/svelte.js +8 -0
- package/utils/DOMUtils.ts +2 -2
- package/utils/classNames.ts +1 -1
- package/utils/getLayoutClasses.ts +141 -0
- package/utils/modal.ts +4 -4
- package/utils/popover.ts +30 -4
package/react.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { ReactAspectRatioProps as WReactAspectRatioProps } from './componen
|
|
|
5
5
|
import type { AvatarProps as WAvatarProps } from './components/Avatar/avatar'
|
|
6
6
|
import type { ReactBadgeProps as WReactBadgeProps } from './components/Badge/badge'
|
|
7
7
|
import type { ReactBannerProps as WReactBannerProps } from './components/Banner/banner'
|
|
8
|
+
import type { ReactBottomNavigationProps as WReactBottomNavigationProps } from './components/BottomNavigation/bottomnavigation'
|
|
8
9
|
import type { BreadcrumbProps as WBreadcrumbProps } from './components/Breadcrumb/breadcrumb'
|
|
9
10
|
import type { ReactButtonProps as WReactButtonProps } from './components/Button/button'
|
|
10
11
|
import type { ReactCardProps as WReactCardProps } from './components/Card/card'
|
|
@@ -12,8 +13,11 @@ import type { ReactCarouselProps as WReactCarouselProps } from './components/Car
|
|
|
12
13
|
import type { ReactCheckboxProps as WReactCheckboxProps } from './components/Checkbox/checkbox'
|
|
13
14
|
import type { ReactCollapsibleProps as WReactCollapsibleProps } from './components/Collapsible/collapsible'
|
|
14
15
|
import type { ReactConditionalWrapperProps as WReactConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
16
|
+
import type { ReactCopyProps as WReactCopyProps } from './components/Copy/copy'
|
|
15
17
|
import type { ReactDataTableProps as WReactDataTableProps } from './components/DataTable/datatable'
|
|
18
|
+
import type { ReactFlexProps as WReactFlexProps } from './components/Flex/flex'
|
|
16
19
|
import type { ReactFooterProps as WReactFooterProps } from './components/Footer/footer'
|
|
20
|
+
import type { ReactGridProps as WReactGridProps } from './components/Grid/grid'
|
|
17
21
|
import type { ReactGroupProps as WReactGroupProps } from './components/Group/group'
|
|
18
22
|
import type { IconProps as WIconProps } from './components/Icon/icon'
|
|
19
23
|
import type { ReactInputProps as WReactInputProps } from './components/Input/input'
|
|
@@ -45,6 +49,11 @@ import type { ReactTimelineProps as WReactTimelineProps } from './components/Tim
|
|
|
45
49
|
import type { ReactTimelineItemProps as WReactTimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
46
50
|
import type { ReactToastProps as WReactToastProps } from './components/Toast/toast'
|
|
47
51
|
|
|
52
|
+
import type { DataTableEventType as WDataTableEventType, HeadingObject as WHeadingObject } from './components/DataTable/datatable.ts'
|
|
53
|
+
import type { ListEventType as WListEventType } from './components/List/list.ts'
|
|
54
|
+
import type { PaginationEventType as WPaginationEventType } from './components/Pagination/pagination.ts'
|
|
55
|
+
import type { SelectEventType as WSelectEventType } from './components/Select/select.ts'
|
|
56
|
+
|
|
48
57
|
declare module 'webcoreui/react' {
|
|
49
58
|
export const Accordion: FC<WAccordionProps>
|
|
50
59
|
export const Alert: FC<WReactAlertProps>
|
|
@@ -52,6 +61,7 @@ declare module 'webcoreui/react' {
|
|
|
52
61
|
export const Avatar: FC<WAvatarProps>
|
|
53
62
|
export const Badge: FC<WReactBadgeProps>
|
|
54
63
|
export const Banner: FC<WReactBannerProps>
|
|
64
|
+
export const BottomNavigation: FC<WReactBottomNavigationProps>
|
|
55
65
|
export const Breadcrumb: FC<WBreadcrumbProps>
|
|
56
66
|
export const Button: FC<WReactButtonProps>
|
|
57
67
|
export const Card: FC<WReactCardProps>
|
|
@@ -59,8 +69,11 @@ declare module 'webcoreui/react' {
|
|
|
59
69
|
export const Checkbox: FC<WReactCheckboxProps>
|
|
60
70
|
export const Collapsible: FC<WReactCollapsibleProps>
|
|
61
71
|
export const ConditionalWrapper: FC<WReactConditionalWrapperProps>
|
|
72
|
+
export const Copy: FC<WReactCopyProps>
|
|
62
73
|
export const DataTable: FC<WReactDataTableProps>
|
|
74
|
+
export const Flex: FC<WReactFlexProps>
|
|
63
75
|
export const Footer: FC<WReactFooterProps>
|
|
76
|
+
export const Grid: FC<WReactGridProps>
|
|
64
77
|
export const Group: FC<WReactGroupProps>
|
|
65
78
|
export const Icon: FC<WIconProps>
|
|
66
79
|
export const Input: FC<WReactInputProps>
|
|
@@ -98,6 +111,7 @@ declare module 'webcoreui/react' {
|
|
|
98
111
|
export type AvatarProps = WAvatarProps
|
|
99
112
|
export type BadgeProps = WReactBadgeProps
|
|
100
113
|
export type BannerProps = WReactBannerProps
|
|
114
|
+
export type BottomNavigationProps = WReactBottomNavigationProps
|
|
101
115
|
export type BreadcrumbProps = WBreadcrumbProps
|
|
102
116
|
export type ButtonProps = WReactButtonProps
|
|
103
117
|
export type CardProps = WReactCardProps
|
|
@@ -105,8 +119,11 @@ declare module 'webcoreui/react' {
|
|
|
105
119
|
export type CheckboxProps = WReactCheckboxProps
|
|
106
120
|
export type CollapsibleProps = WReactCollapsibleProps
|
|
107
121
|
export type ConditionalWrapperProps = WReactConditionalWrapperProps
|
|
122
|
+
export type CopyProps = WReactCopyProps
|
|
108
123
|
export type DataTableProps = WReactDataTableProps
|
|
124
|
+
export type FlexProps = WReactFlexProps
|
|
109
125
|
export type FooterProps = WReactFooterProps
|
|
126
|
+
export type GridProps = WReactGridProps
|
|
110
127
|
export type GroupProps = WReactGroupProps
|
|
111
128
|
export type IconProps = WIconProps
|
|
112
129
|
export type InputProps = WReactInputProps
|
|
@@ -137,4 +154,10 @@ declare module 'webcoreui/react' {
|
|
|
137
154
|
export type TimelineProps = WReactTimelineProps
|
|
138
155
|
export type TimelineItemProps = WReactTimelineItemProps
|
|
139
156
|
export type ToastProps = WReactToastProps
|
|
157
|
+
|
|
158
|
+
export type DataTableEventType = WDataTableEventType
|
|
159
|
+
export type HeadingObject = WHeadingObject
|
|
160
|
+
export type ListEventType = WListEventType
|
|
161
|
+
export type PaginationEventType = WPaginationEventType
|
|
162
|
+
export type SelectEventType = WSelectEventType
|
|
140
163
|
}
|
package/react.js
CHANGED
|
@@ -4,6 +4,7 @@ import AspectRatioComponent from './components/AspectRatio/AspectRatio.tsx'
|
|
|
4
4
|
import AvatarComponent from './components/Avatar/Avatar.tsx'
|
|
5
5
|
import BadgeComponent from './components/Badge/Badge.tsx'
|
|
6
6
|
import BannerComponent from './components/Banner/Banner.tsx'
|
|
7
|
+
import BottomNavigationComponent from './components/BottomNavigation/BottomNavigation.tsx'
|
|
7
8
|
import BreadcrumbComponent from './components/Breadcrumb/Breadcrumb.tsx'
|
|
8
9
|
import ButtonComponent from './components/Button/Button.tsx'
|
|
9
10
|
import CardComponent from './components/Card/Card.tsx'
|
|
@@ -11,8 +12,11 @@ import CarouselComponent from './components/Carousel/Carousel.tsx'
|
|
|
11
12
|
import CheckboxComponent from './components/Checkbox/Checkbox.tsx'
|
|
12
13
|
import CollapsibleComponent from './components/Collapsible/Collapsible.tsx'
|
|
13
14
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.tsx'
|
|
15
|
+
import CopyComponent from './components/Copy/Copy.tsx'
|
|
14
16
|
import DataTableComponent from './components/DataTable/DataTable.tsx'
|
|
17
|
+
import FlexComponent from './components/Flex/Flex.tsx'
|
|
15
18
|
import FooterComponent from './components/Footer/Footer.tsx'
|
|
19
|
+
import GridComponent from './components/Grid/Grid.tsx'
|
|
16
20
|
import GroupComponent from './components/Group/Group.tsx'
|
|
17
21
|
import IconComponent from './components/Icon/Icon.tsx'
|
|
18
22
|
import InputComponent from './components/Input/Input.tsx'
|
|
@@ -50,6 +54,7 @@ export const AspectRatio = AspectRatioComponent
|
|
|
50
54
|
export const Avatar = AvatarComponent
|
|
51
55
|
export const Badge = BadgeComponent
|
|
52
56
|
export const Banner = BannerComponent
|
|
57
|
+
export const BottomNavigation = BottomNavigationComponent
|
|
53
58
|
export const Breadcrumb = BreadcrumbComponent
|
|
54
59
|
export const Button = ButtonComponent
|
|
55
60
|
export const Card = CardComponent
|
|
@@ -57,8 +62,11 @@ export const Carousel = CarouselComponent
|
|
|
57
62
|
export const Checkbox = CheckboxComponent
|
|
58
63
|
export const Collapsible = CollapsibleComponent
|
|
59
64
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
65
|
+
export const Copy = CopyComponent
|
|
60
66
|
export const DataTable = DataTableComponent
|
|
67
|
+
export const Flex = FlexComponent
|
|
61
68
|
export const Footer = FooterComponent
|
|
69
|
+
export const Grid = GridComponent
|
|
62
70
|
export const Group = GroupComponent
|
|
63
71
|
export const Icon = IconComponent
|
|
64
72
|
export const Input = InputComponent
|
package/scss/config/layout.scss
CHANGED
package/scss/config/mixins.scss
CHANGED
package/scss/config.scss
CHANGED
package/scss/global/utility.scss
CHANGED
|
@@ -34,7 +34,7 @@ $alignments: (
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.muted {
|
|
37
|
-
@include typography(primary-20, md);
|
|
37
|
+
@include typography(primary-20, md, hmd);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// Gaps
|
|
@@ -48,7 +48,13 @@ $alignments: (
|
|
|
48
48
|
$class: string.slice($key, 2, -1) + $firstLetter;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
&.#{$class} { gap: $value; }
|
|
51
|
+
&.#{$class} { gap: $value; }
|
|
52
|
+
|
|
53
|
+
@each $key, $v in $breakpoints {
|
|
54
|
+
@include media($key) {
|
|
55
|
+
&.#{$key}-#{$class} { gap: $value; }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -69,6 +75,27 @@ $alignments: (
|
|
|
69
75
|
align-items: center;
|
|
70
76
|
}
|
|
71
77
|
|
|
78
|
+
@each $key, $value in $breakpoints {
|
|
79
|
+
@include media($key) {
|
|
80
|
+
@each $alignmentKey, $alignmentValue in $alignments {
|
|
81
|
+
.#{$key}-#{$alignmentKey} {
|
|
82
|
+
@if (string.index($alignmentKey, 'items')) {
|
|
83
|
+
align-items: $alignmentValue;
|
|
84
|
+
} @else {
|
|
85
|
+
justify-content: $alignmentValue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.flex.#{$key}-center,
|
|
91
|
+
.grid.#{$key}-center {
|
|
92
|
+
justify-content: center;
|
|
93
|
+
align-items: center;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Flex directions & wraps
|
|
72
99
|
.flex {
|
|
73
100
|
@include layout(flex, default);
|
|
74
101
|
|
|
@@ -85,6 +112,25 @@ $alignments: (
|
|
|
85
112
|
}
|
|
86
113
|
}
|
|
87
114
|
|
|
115
|
+
@each $key, $value in $breakpoints {
|
|
116
|
+
@include media($key) {
|
|
117
|
+
.flex {
|
|
118
|
+
@each $direction in $flexDirectionValues {
|
|
119
|
+
&.#{$key}-#{$direction} {
|
|
120
|
+
flex-direction: $direction;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@each $wrap in $flexWrapValues {
|
|
125
|
+
&.#{$key}-#{$wrap} {
|
|
126
|
+
flex-wrap: $wrap;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Grid columns
|
|
88
134
|
.grid {
|
|
89
135
|
@include layout(grid, default);
|
|
90
136
|
|
|
@@ -99,7 +145,6 @@ $alignments: (
|
|
|
99
145
|
}
|
|
100
146
|
}
|
|
101
147
|
|
|
102
|
-
// Grid columns
|
|
103
148
|
@each $key, $value in $breakpoints {
|
|
104
149
|
@include media($key) {
|
|
105
150
|
@for $i from 2 to map.get($breakpointMap, $key) + 1 {
|
package/svelte.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { AspectRatioProps as WAspectRatioProps } from './components/AspectR
|
|
|
5
5
|
import type { AvatarProps as WAvatarProps } from './components/Avatar/avatar'
|
|
6
6
|
import type { SvelteBadgeProps as WSvelteBadgeProps } from './components/Badge/badge'
|
|
7
7
|
import type { BannerProps as WBannerProps } from './components/Banner/banner'
|
|
8
|
+
import type { BottomNavigationProps as WBottomNavigationProps } from './components/BottomNavigation/bottomnavigation'
|
|
8
9
|
import type { BreadcrumbProps as WBreadcrumbProps } from './components/Breadcrumb/breadcrumb'
|
|
9
10
|
import type { SvelteButtonProps as WSvelteButtonProps } from './components/Button/button'
|
|
10
11
|
import type { CardProps as WCardProps } from './components/Card/card'
|
|
@@ -12,8 +13,11 @@ import type { SvelteCarouselProps as WSvelteCarouselProps } from './components/C
|
|
|
12
13
|
import type { SvelteCheckboxProps as WSvelteCheckboxProps } from './components/Checkbox/checkbox'
|
|
13
14
|
import type { CollapsibleProps as WCollapsibleProps } from './components/Collapsible/collapsible'
|
|
14
15
|
import type { ConditionalWrapperProps as WConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
16
|
+
import type { CopyProps as WCopyProps } from './components/Copy/copy'
|
|
15
17
|
import type { SvelteDataTableProps as WSvelteDataTableProps } from './components/DataTable/datatable'
|
|
18
|
+
import type { FlexProps as WFlexProps } from './components/Flex/flex'
|
|
16
19
|
import type { FooterProps as WFooterProps } from './components/Footer/footer'
|
|
20
|
+
import type { GridProps as WGridProps } from './components/Grid/grid'
|
|
17
21
|
import type { GroupProps as WGroupProps } from './components/Group/group'
|
|
18
22
|
import type { IconProps as WIconProps } from './components/Icon/icon'
|
|
19
23
|
import type { SvelteInputProps as WSvelteInputProps } from './components/Input/input'
|
|
@@ -45,6 +49,11 @@ import type { TimelineProps as WTimelineProps } from './components/Timeline/time
|
|
|
45
49
|
import type { TimelineItemProps as WTimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
46
50
|
import type { ToastProps as WToastProps } from './components/Toast/toast'
|
|
47
51
|
|
|
52
|
+
import type { DataTableEventType as WDataTableEventType, HeadingObject as WHeadingObject } from './components/DataTable/datatable.ts'
|
|
53
|
+
import type { ListEventType as WListEventType } from './components/List/list.ts'
|
|
54
|
+
import type { PaginationEventType as WPaginationEventType } from './components/Pagination/pagination.ts'
|
|
55
|
+
import type { SelectEventType as WSelectEventType } from './components/Select/select.ts'
|
|
56
|
+
|
|
48
57
|
declare module 'webcoreui/svelte' {
|
|
49
58
|
export class Accordion extends SvelteComponent<WAccordionProps> {}
|
|
50
59
|
export class Alert extends SvelteComponent<WAlertProps> {}
|
|
@@ -52,6 +61,7 @@ declare module 'webcoreui/svelte' {
|
|
|
52
61
|
export class Avatar extends SvelteComponent<WAvatarProps> {}
|
|
53
62
|
export class Badge extends SvelteComponent<WSvelteBadgeProps> {}
|
|
54
63
|
export class Banner extends SvelteComponent<WBannerProps> {}
|
|
64
|
+
export class BottomNavigation extends SvelteComponent<WBottomNavigationProps> {}
|
|
55
65
|
export class Breadcrumb extends SvelteComponent<WBreadcrumbProps> {}
|
|
56
66
|
export class Button extends SvelteComponent<WSvelteButtonProps> {}
|
|
57
67
|
export class Card extends SvelteComponent<WCardProps> {}
|
|
@@ -59,8 +69,11 @@ declare module 'webcoreui/svelte' {
|
|
|
59
69
|
export class Checkbox extends SvelteComponent<WSvelteCheckboxProps> {}
|
|
60
70
|
export class Collapsible extends SvelteComponent<WCollapsibleProps> {}
|
|
61
71
|
export class ConditionalWrapper extends SvelteComponent<WConditionalWrapperProps> {}
|
|
72
|
+
export class Copy extends SvelteComponent<WCopyProps> {}
|
|
62
73
|
export class DataTable extends SvelteComponent<WSvelteDataTableProps> {}
|
|
74
|
+
export class Flex extends SvelteComponent<WFlexProps> {}
|
|
63
75
|
export class Footer extends SvelteComponent<WFooterProps> {}
|
|
76
|
+
export class Grid extends SvelteComponent<WGridProps> {}
|
|
64
77
|
export class Group extends SvelteComponent<WGroupProps> {}
|
|
65
78
|
export class Icon extends SvelteComponent<WIconProps> {}
|
|
66
79
|
export class Input extends SvelteComponent<WSvelteInputProps> {}
|
|
@@ -98,6 +111,7 @@ declare module 'webcoreui/svelte' {
|
|
|
98
111
|
export type AvatarProps = WAvatarProps
|
|
99
112
|
export type BadgeProps = WSvelteBadgeProps
|
|
100
113
|
export type BannerProps = WBannerProps
|
|
114
|
+
export type BottomNavigationProps = WBottomNavigationProps
|
|
101
115
|
export type BreadcrumbProps = WBreadcrumbProps
|
|
102
116
|
export type ButtonProps = WSvelteButtonProps
|
|
103
117
|
export type CardProps = WCardProps
|
|
@@ -105,8 +119,11 @@ declare module 'webcoreui/svelte' {
|
|
|
105
119
|
export type CheckboxProps = WSvelteCheckboxProps
|
|
106
120
|
export type CollapsibleProps = WCollapsibleProps
|
|
107
121
|
export type ConditionalWrapperProps = WConditionalWrapperProps
|
|
122
|
+
export type CopyProps = WCopyProps
|
|
108
123
|
export type DataTableProps = WSvelteDataTableProps
|
|
124
|
+
export type FlexProps = WFlexProps
|
|
109
125
|
export type FooterProps = WFooterProps
|
|
126
|
+
export type GridProps = WGridProps
|
|
110
127
|
export type GroupProps = WGroupProps
|
|
111
128
|
export type IconProps = WIconProps
|
|
112
129
|
export type InputProps = WSvelteInputProps
|
|
@@ -137,4 +154,10 @@ declare module 'webcoreui/svelte' {
|
|
|
137
154
|
export type TimelineProps = WTimelineProps
|
|
138
155
|
export type TimelineItemProps = WTimelineItemProps
|
|
139
156
|
export type ToastProps = WToastProps
|
|
157
|
+
|
|
158
|
+
export type DataTableEventType = WDataTableEventType
|
|
159
|
+
export type HeadingObject = WHeadingObject
|
|
160
|
+
export type ListEventType = WListEventType
|
|
161
|
+
export type PaginationEventType = WPaginationEventType
|
|
162
|
+
export type SelectEventType = WSelectEventType
|
|
140
163
|
}
|
package/svelte.js
CHANGED
|
@@ -4,6 +4,7 @@ import AspectRatioComponent from './components/AspectRatio/AspectRatio.svelte'
|
|
|
4
4
|
import AvatarComponent from './components/Avatar/Avatar.svelte'
|
|
5
5
|
import BadgeComponent from './components/Badge/Badge.svelte'
|
|
6
6
|
import BannerComponent from './components/Banner/Banner.svelte'
|
|
7
|
+
import BottomNavigationComponent from './components/BottomNavigation/BottomNavigation.svelte'
|
|
7
8
|
import BreadcrumbComponent from './components/Breadcrumb/Breadcrumb.svelte'
|
|
8
9
|
import ButtonComponent from './components/Button/Button.svelte'
|
|
9
10
|
import CardComponent from './components/Card/Card.svelte'
|
|
@@ -11,8 +12,11 @@ import CarouselComponent from './components/Carousel/Carousel.svelte'
|
|
|
11
12
|
import CheckboxComponent from './components/Checkbox/Checkbox.svelte'
|
|
12
13
|
import CollapsibleComponent from './components/Collapsible/Collapsible.svelte'
|
|
13
14
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.svelte'
|
|
15
|
+
import CopyComponent from './components/Copy/Copy.svelte'
|
|
14
16
|
import DataTableComponent from './components/DataTable/DataTable.svelte'
|
|
17
|
+
import FlexComponent from './components/Flex/Flex.svelte'
|
|
15
18
|
import FooterComponent from './components/Footer/Footer.svelte'
|
|
19
|
+
import GridComponent from './components/Grid/Grid.svelte'
|
|
16
20
|
import GroupComponent from './components/Group/Group.svelte'
|
|
17
21
|
import IconComponent from './components/Icon/Icon.svelte'
|
|
18
22
|
import InputComponent from './components/Input/Input.svelte'
|
|
@@ -50,6 +54,7 @@ export const AspectRatio = AspectRatioComponent
|
|
|
50
54
|
export const Avatar = AvatarComponent
|
|
51
55
|
export const Badge = BadgeComponent
|
|
52
56
|
export const Banner = BannerComponent
|
|
57
|
+
export const BottomNavigation = BottomNavigationComponent
|
|
53
58
|
export const Breadcrumb = BreadcrumbComponent
|
|
54
59
|
export const Button = ButtonComponent
|
|
55
60
|
export const Card = CardComponent
|
|
@@ -57,8 +62,11 @@ export const Carousel = CarouselComponent
|
|
|
57
62
|
export const Checkbox = CheckboxComponent
|
|
58
63
|
export const Collapsible = CollapsibleComponent
|
|
59
64
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
65
|
+
export const Copy = CopyComponent
|
|
60
66
|
export const DataTable = DataTableComponent
|
|
67
|
+
export const Flex = FlexComponent
|
|
61
68
|
export const Footer = FooterComponent
|
|
69
|
+
export const Grid = GridComponent
|
|
62
70
|
export const Group = GroupComponent
|
|
63
71
|
export const Icon = IconComponent
|
|
64
72
|
export const Input = InputComponent
|
package/utils/DOMUtils.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export const get = (selector: string, all
|
|
1
|
+
export const get = (selector: string, all?: boolean) => all
|
|
2
2
|
? document?.querySelectorAll(selector)
|
|
3
3
|
: document?.querySelector(selector)
|
|
4
4
|
|
|
5
5
|
export const on = (
|
|
6
|
-
selector: string | HTMLElement,
|
|
6
|
+
selector: string | HTMLElement | Document,
|
|
7
7
|
event: string,
|
|
8
8
|
callback: any,
|
|
9
9
|
all?: boolean
|
package/utils/classNames.ts
CHANGED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { classNames } from './classNames'
|
|
2
|
+
|
|
3
|
+
export type Gap = 'none'
|
|
4
|
+
| 'xxs'
|
|
5
|
+
| 'xs'
|
|
6
|
+
| 'sm'
|
|
7
|
+
| 'md'
|
|
8
|
+
| 'default'
|
|
9
|
+
| 'lg'
|
|
10
|
+
| 'xl'
|
|
11
|
+
| 'xl2'
|
|
12
|
+
| 'xl3'
|
|
13
|
+
| 'xl4'
|
|
14
|
+
| 'xl5'
|
|
15
|
+
| ''
|
|
16
|
+
|
|
17
|
+
export type VerticalAlignment = 'center'
|
|
18
|
+
| 'start'
|
|
19
|
+
| 'end'
|
|
20
|
+
| 'baseline'
|
|
21
|
+
| 'stretch'
|
|
22
|
+
| ''
|
|
23
|
+
|
|
24
|
+
export type HorizontalAlignment = 'center'
|
|
25
|
+
| 'start'
|
|
26
|
+
| 'end'
|
|
27
|
+
| 'between'
|
|
28
|
+
| 'around'
|
|
29
|
+
| 'evenly'
|
|
30
|
+
| 'stretch'
|
|
31
|
+
| ''
|
|
32
|
+
|
|
33
|
+
export type Direction = 'row'
|
|
34
|
+
| 'column'
|
|
35
|
+
| 'row-reverse'
|
|
36
|
+
| 'column-reverse'
|
|
37
|
+
| ''
|
|
38
|
+
|
|
39
|
+
export type Wrap = 'wrap'
|
|
40
|
+
| 'nowrap'
|
|
41
|
+
| 'wrap-reverse'
|
|
42
|
+
| ''
|
|
43
|
+
|
|
44
|
+
export type Column = (2 | 3) | {
|
|
45
|
+
default?: 2 | 3
|
|
46
|
+
xs?: 2 | 3 | 4
|
|
47
|
+
sm?: 2 | 3 | 4
|
|
48
|
+
md?: 2 | 3 | 4 | 5 | 6
|
|
49
|
+
lg?: 2 | 3 | 4 | 5 | 6 | 7 | 8
|
|
50
|
+
} | null
|
|
51
|
+
|
|
52
|
+
export type Responsive<T> = T | {
|
|
53
|
+
default?: T
|
|
54
|
+
xs?: T
|
|
55
|
+
sm?: T
|
|
56
|
+
md?: T
|
|
57
|
+
lg?: T
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type Alignment = {
|
|
61
|
+
horizontal?: HorizontalAlignment
|
|
62
|
+
vertical?: VerticalAlignment
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type getLayoutClassesConfig = {
|
|
66
|
+
gap?: Responsive<Gap>
|
|
67
|
+
alignment?: Responsive<Alignment>
|
|
68
|
+
direction?: Responsive<Direction>
|
|
69
|
+
wrap?: Responsive<Wrap>
|
|
70
|
+
column?: Responsive<Column>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const getLayoutClasses = ({
|
|
74
|
+
gap,
|
|
75
|
+
alignment,
|
|
76
|
+
direction,
|
|
77
|
+
wrap,
|
|
78
|
+
column
|
|
79
|
+
}: getLayoutClassesConfig) => {
|
|
80
|
+
const gaps = typeof gap === 'string'
|
|
81
|
+
? gap
|
|
82
|
+
: Object.entries(gap || {}).map(([key, value]) => key === 'default'
|
|
83
|
+
? value
|
|
84
|
+
: `${key}-${value}`)
|
|
85
|
+
|
|
86
|
+
const directions = typeof direction === 'string'
|
|
87
|
+
? direction
|
|
88
|
+
: Object.entries(direction || {}).map(([key, value]) => key === 'default'
|
|
89
|
+
? value
|
|
90
|
+
: `${key}-${value}`)
|
|
91
|
+
|
|
92
|
+
const wraps = typeof wrap === 'string'
|
|
93
|
+
? wrap
|
|
94
|
+
: Object.entries(wrap || {}).map(([key, value]) => key === 'default'
|
|
95
|
+
? value
|
|
96
|
+
: `${key}-${value}`)
|
|
97
|
+
|
|
98
|
+
const columns = typeof column === 'number'
|
|
99
|
+
? `col-${column}`
|
|
100
|
+
: Object.entries(column || {}).map(([key, value]) => key === 'default'
|
|
101
|
+
? `col-${value}`
|
|
102
|
+
: `${key}-${value}`)
|
|
103
|
+
|
|
104
|
+
// Flatten alignments, eg.: { xs: { horizontal: 'center' } } to { xs-justify: 'center' }
|
|
105
|
+
const flattenAlignments = (obj: Responsive<Alignment>, prefix = ''): Responsive<Alignment> => {
|
|
106
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
107
|
+
const newKey = (prefix ? `${prefix}-${key}` : key)
|
|
108
|
+
.replace('horizontal', 'justify')
|
|
109
|
+
.replace('vertical', 'items')
|
|
110
|
+
|
|
111
|
+
if (typeof value === 'object') {
|
|
112
|
+
return { ...acc, ...flattenAlignments(value, newKey) }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return { ...acc, [newKey.replace('default-', '')]: value }
|
|
116
|
+
}, {})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const alignments = [...new Set(
|
|
120
|
+
Object.entries(flattenAlignments(alignment || {}))
|
|
121
|
+
.map(([key, value]) => `${key}-${value}`) // Turn key-value pairs into strings
|
|
122
|
+
.map((item, _, array) => { // Simplify center alignments
|
|
123
|
+
const hasDuplicate = array.filter(entry => {
|
|
124
|
+
return entry.includes('justify-center') || entry.includes('items-center')
|
|
125
|
+
}).length > 1
|
|
126
|
+
|
|
127
|
+
return hasDuplicate ? item
|
|
128
|
+
.replace('justify-center', 'center')
|
|
129
|
+
.replace('items-center', 'center')
|
|
130
|
+
: item
|
|
131
|
+
})
|
|
132
|
+
)]
|
|
133
|
+
|
|
134
|
+
return classNames([
|
|
135
|
+
gaps,
|
|
136
|
+
alignments,
|
|
137
|
+
directions,
|
|
138
|
+
wraps,
|
|
139
|
+
columns
|
|
140
|
+
])
|
|
141
|
+
}
|
package/utils/modal.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
type
|
|
1
|
+
export type ModalCallback = {
|
|
2
2
|
trigger: Element | null
|
|
3
3
|
modal: HTMLElement
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
type Modal = {
|
|
6
|
+
export type Modal = {
|
|
7
7
|
trigger: string
|
|
8
8
|
modal: string
|
|
9
|
-
onOpen?: (args:
|
|
10
|
-
onClose?: (args:
|
|
9
|
+
onOpen?: (args: ModalCallback) => unknown
|
|
10
|
+
onClose?: (args: ModalCallback) => unknown
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const modal = (config: Modal | string) => {
|
package/utils/popover.ts
CHANGED
|
@@ -14,20 +14,21 @@ export type PopoverPosition = 'top'
|
|
|
14
14
|
| 'bottom-start'
|
|
15
15
|
| 'bottom-end'
|
|
16
16
|
|
|
17
|
-
type
|
|
17
|
+
export type PopoverCallback = {
|
|
18
18
|
trigger: HTMLElement
|
|
19
19
|
popover: HTMLElement
|
|
20
20
|
position: PopoverPosition | undefined
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
type Popover = {
|
|
23
|
+
export type Popover = {
|
|
24
24
|
trigger: string
|
|
25
25
|
popover: string
|
|
26
26
|
position?: PopoverPosition
|
|
27
27
|
offset?: number
|
|
28
28
|
closeOnBlur?: boolean
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
closeOnEsc?: boolean
|
|
30
|
+
onOpen?: (args: PopoverCallback) => unknown
|
|
31
|
+
onClose?: (args: PopoverCallback) => unknown
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export const popover = ({
|
|
@@ -36,6 +37,7 @@ export const popover = ({
|
|
|
36
37
|
position,
|
|
37
38
|
offset = 10,
|
|
38
39
|
closeOnBlur = true,
|
|
40
|
+
closeOnEsc = true,
|
|
39
41
|
onOpen,
|
|
40
42
|
onClose
|
|
41
43
|
}: Popover) => {
|
|
@@ -184,6 +186,22 @@ export const popover = ({
|
|
|
184
186
|
}, 300)
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
const handleCloseOnEsc = (event: KeyboardEvent) => {
|
|
190
|
+
if (event.key === 'Escape' && popoverDOM.dataset.show) {
|
|
191
|
+
popoverDOM.dataset.show = ''
|
|
192
|
+
|
|
193
|
+
onClose?.({
|
|
194
|
+
trigger: triggerDOM,
|
|
195
|
+
popover: popoverDOM,
|
|
196
|
+
position
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
setTimeout(() => {
|
|
200
|
+
popoverDOM.removeAttribute('data-show')
|
|
201
|
+
}, 300)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
187
205
|
const removeOnResize = debounce(() => {
|
|
188
206
|
popoverDOM.dataset.show = ''
|
|
189
207
|
|
|
@@ -207,6 +225,10 @@ export const popover = ({
|
|
|
207
225
|
document.addEventListener('click', handleClose)
|
|
208
226
|
}
|
|
209
227
|
|
|
228
|
+
if (closeOnEsc) {
|
|
229
|
+
document.addEventListener('keydown', handleCloseOnEsc)
|
|
230
|
+
}
|
|
231
|
+
|
|
210
232
|
return {
|
|
211
233
|
remove() {
|
|
212
234
|
triggerDOM.removeEventListener('click', handleOpen)
|
|
@@ -215,6 +237,10 @@ export const popover = ({
|
|
|
215
237
|
if (closeOnBlur) {
|
|
216
238
|
document.removeEventListener('click', handleClose)
|
|
217
239
|
}
|
|
240
|
+
|
|
241
|
+
if (closeOnEsc) {
|
|
242
|
+
document.removeEventListener('keydown', handleCloseOnEsc)
|
|
243
|
+
}
|
|
218
244
|
}
|
|
219
245
|
}
|
|
220
246
|
}
|