webcoreui 0.5.0 → 0.6.1

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 (74) hide show
  1. package/README.md +7 -0
  2. package/astro.d.ts +115 -68
  3. package/astro.js +8 -0
  4. package/components/Badge/Badge.astro +4 -0
  5. package/components/Badge/Badge.svelte +5 -1
  6. package/components/Badge/Badge.tsx +4 -0
  7. package/components/Badge/badge.module.scss +8 -0
  8. package/components/Badge/badge.ts +7 -3
  9. package/components/Breadcrumb/Breadcrumb.astro +51 -0
  10. package/components/Breadcrumb/Breadcrumb.svelte +45 -0
  11. package/components/Breadcrumb/Breadcrumb.tsx +51 -0
  12. package/components/Breadcrumb/breadcrumb.module.scss +26 -0
  13. package/components/Breadcrumb/breadcrumb.ts +12 -0
  14. package/components/Button/button.ts +13 -3
  15. package/components/Carousel/Carousel.astro +16 -7
  16. package/components/Carousel/Carousel.svelte +15 -5
  17. package/components/Carousel/Carousel.tsx +15 -5
  18. package/components/Carousel/carousel.module.scss +4 -1
  19. package/components/Carousel/carousel.ts +1 -1
  20. package/components/Checkbox/checkbox.ts +4 -2
  21. package/components/DataTable/DataTable.astro +2 -2
  22. package/components/DataTable/DataTable.tsx +287 -287
  23. package/components/Footer/Footer.astro +91 -0
  24. package/components/Footer/Footer.svelte +94 -0
  25. package/components/Footer/Footer.tsx +107 -0
  26. package/components/Footer/footer.module.scss +61 -0
  27. package/components/Footer/footer.ts +29 -0
  28. package/components/Icon/Icon.svelte +1 -1
  29. package/components/Icon/icon.ts +18 -1
  30. package/components/Icon/map.ts +8 -0
  31. package/components/List/list.ts +3 -1
  32. package/components/Masonry/Masonry.astro +54 -0
  33. package/components/Masonry/Masonry.svelte +54 -0
  34. package/components/Masonry/Masonry.tsx +62 -0
  35. package/components/Masonry/masonry.module.scss +18 -0
  36. package/components/Masonry/masonry.ts +36 -0
  37. package/components/Menu/Menu.astro +1 -1
  38. package/components/Menu/Menu.svelte +1 -1
  39. package/components/Menu/Menu.tsx +1 -1
  40. package/components/Menu/menu.ts +4 -2
  41. package/components/Modal/Modal.astro +2 -0
  42. package/components/Modal/Modal.svelte +2 -0
  43. package/components/Modal/Modal.tsx +2 -0
  44. package/components/Modal/modal.module.scss +29 -22
  45. package/components/Modal/modal.ts +1 -0
  46. package/components/Pagination/Pagination.astro +2 -0
  47. package/components/Pagination/Pagination.svelte +6 -3
  48. package/components/Pagination/Pagination.tsx +5 -3
  49. package/components/Pagination/pagination.ts +1 -0
  50. package/components/Rating/rating.ts +3 -1
  51. package/components/Sidebar/Sidebar.astro +61 -0
  52. package/components/Sidebar/Sidebar.svelte +50 -0
  53. package/components/Sidebar/Sidebar.tsx +58 -0
  54. package/components/Sidebar/sidebar.module.scss +43 -0
  55. package/components/Sidebar/sidebar.ts +21 -0
  56. package/components/Switch/switch.ts +4 -2
  57. package/icons/circle-close.svg +3 -0
  58. package/icons/components.svg +3 -0
  59. package/icons/file.svg +3 -0
  60. package/icons/home.svg +4 -0
  61. package/icons/sun.svg +1 -1
  62. package/icons.d.ts +4 -0
  63. package/icons.js +4 -0
  64. package/index.d.ts +8 -0
  65. package/index.js +1 -0
  66. package/package.json +9 -10
  67. package/react.d.ts +115 -68
  68. package/react.js +8 -0
  69. package/scss/config/typography.scss +3 -1
  70. package/scss/global/utility.scss +1 -1
  71. package/svelte.d.ts +116 -68
  72. package/svelte.js +8 -0
  73. package/utils/DOMUtils.ts +28 -0
  74. package/scss/global/elements.scss +0 -31
package/README.md CHANGED
@@ -117,6 +117,9 @@ html body {
117
117
  --w-collapsible-initial-height: 0;
118
118
  --w-collapsible-max-height: 100%;
119
119
 
120
+ // Masonry component
121
+ --w-masonry-gap: 5px;
122
+
120
123
  // Progress component
121
124
  --w-progress-color: var(--w-color-primary);
122
125
  --w-progress-background: var(--w-color-primary-50);
@@ -198,6 +201,7 @@ import { Accordion } from 'webcoreui/react'
198
201
  - [Alert](https://github.com/Frontendland/webcoreui/tree/main/src/components/Alert)
199
202
  - [Avatar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Avatar)
200
203
  - [Badge](https://github.com/Frontendland/webcoreui/tree/main/src/components/Badge)
204
+ - [Breadcrumb](https://github.com/Frontendland/webcoreui/tree/main/src/components/Breadcrumb)
201
205
  - [Button](https://github.com/Frontendland/webcoreui/tree/main/src/components/Button)
202
206
  - [Card](https://github.com/Frontendland/webcoreui/tree/main/src/components/Card)
203
207
  - [Carousel](https://github.com/Frontendland/webcoreui/tree/main/src/components/Carousel)
@@ -205,10 +209,12 @@ import { Accordion } from 'webcoreui/react'
205
209
  - [Collapsible](https://github.com/Frontendland/webcoreui/tree/main/src/components/Collapsible)
206
210
  - [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
207
211
  - [DataTable](https://github.com/Frontendland/webcoreui/tree/main/src/components/DataTable)
212
+ - [Footer](https://github.com/Frontendland/webcoreui/tree/main/src/components/Footer)
208
213
  - [Group](https://github.com/Frontendland/webcoreui/tree/main/src/components/Group)
209
214
  - [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
210
215
  - [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
211
216
  - [List](https://github.com/Frontendland/webcoreui/tree/main/src/components/List)
217
+ - [Masonry](https://github.com/Frontendland/webcoreui/tree/main/src/components/Masonry)
212
218
  - [Menu](https://github.com/Frontendland/webcoreui/tree/main/src/components/Menu)
213
219
  - [Modal](https://github.com/Frontendland/webcoreui/tree/main/src/components/Modal)
214
220
  - [Pagination](https://github.com/Frontendland/webcoreui/tree/main/src/components/Pagination)
@@ -218,6 +224,7 @@ import { Accordion } from 'webcoreui/react'
218
224
  - [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
219
225
  - [Select](https://github.com/Frontendland/webcoreui/tree/main/src/components/Select)
220
226
  - [Sheet](https://github.com/Frontendland/webcoreui/tree/main/src/components/Sheet)
227
+ - [Sidebar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Sidebar)
221
228
  - [Slider](https://github.com/Frontendland/webcoreui/tree/main/src/components/Slider)
222
229
  - [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
223
230
  - [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
package/astro.d.ts CHANGED
@@ -1,71 +1,118 @@
1
- import type { AccordionProps } from './components/Accordion/accordion'
2
- import type { AlertProps } from './components/Alert/alert'
3
- import type { AvatarProps } from './components/Avatar/avatar'
4
- import type { BadgeProps } from './components/Badge/badge'
5
- import type { ButtonProps } from './components/Button/button'
6
- import type { CardProps } from './components/Card/card'
7
- import type { CarouselProps } from './components/Carousel/carousel'
8
- import type { CheckboxProps } from './components/Checkbox/checkbox'
9
- import type { CollapsibleProps } from './components/Collapsible/collapsible'
10
- import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
11
- import type { DataTableProps } from './components/DataTable/datatable'
12
- import type { GroupProps } from './components/Group/group'
13
- import type { IconProps } from './components/Icon/icon'
14
- import type { InputProps } from './components/Input/input'
15
- import type { ListProps } from './components/List/list'
16
- import type { MenuProps } from './components/Menu/menu'
17
- import type { ModalProps } from './components/Modal/modal'
18
- import type { PaginationProps } from './components/Pagination/pagination'
19
- import type { PopoverProps } from './components/Popover/popover'
20
- import type { ProgressProps } from './components/Progress/progress'
21
- import type { RadioProps } from './components/Radio/radio'
22
- import type { RatingProps } from './components/Rating/rating'
23
- import type { SelectProps } from './components/Select/select'
24
- import type { SheetProps } from './components/Sheet/sheet'
25
- import type { SliderProps } from './components/Slider/slider'
26
- import type { SpinnerProps } from './components/Spinner/spinner'
27
- import type { SwitchProps } from './components/Switch/switch'
28
- import type { TableProps } from './components/Table/table'
29
- import type { TabsProps } from './components/Tabs/tabs'
30
- import type { TextareaProps } from './components/Textarea/textarea'
31
- import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
32
- import type { TimelineProps } from './components/Timeline/timeline'
33
- import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
34
- import type { ToastProps } from './components/Toast/toast'
1
+ import type { AccordionProps as WAccordionProps } from './components/Accordion/accordion'
2
+ import type { AlertProps as WAlertProps } from './components/Alert/alert'
3
+ import type { AvatarProps as WAvatarProps } from './components/Avatar/avatar'
4
+ import type { BadgeProps as WBadgeProps } from './components/Badge/badge'
5
+ import type { BreadcrumbProps as WBreadcrumbProps } from './components/Breadcrumb/breadcrumb'
6
+ import type { ButtonProps as WButtonProps } from './components/Button/button'
7
+ import type { CardProps as WCardProps } from './components/Card/card'
8
+ import type { CarouselProps as WCarouselProps } from './components/Carousel/carousel'
9
+ import type { CheckboxProps as WCheckboxProps } from './components/Checkbox/checkbox'
10
+ import type { CollapsibleProps as WCollapsibleProps } from './components/Collapsible/collapsible'
11
+ import type { ConditionalWrapperProps as WConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
12
+ import type { DataTableProps as WDataTableProps } from './components/DataTable/datatable'
13
+ import type { FooterProps as WFooterProps } from './components/Footer/footer'
14
+ import type { GroupProps as WGroupProps } from './components/Group/group'
15
+ import type { IconProps as WIconProps } from './components/Icon/icon'
16
+ import type { InputProps as WInputProps } from './components/Input/input'
17
+ import type { ListProps as WListProps } from './components/List/list'
18
+ import type { MasonryProps as WMasonryProps } from './components/Masonry/masonry'
19
+ import type { MenuProps as WMenuProps } from './components/Menu/menu'
20
+ import type { ModalProps as WModalProps } from './components/Modal/modal'
21
+ import type { PaginationProps as WPaginationProps } from './components/Pagination/pagination'
22
+ import type { PopoverProps as WPopoverProps } from './components/Popover/popover'
23
+ import type { ProgressProps as WProgressProps } from './components/Progress/progress'
24
+ import type { RadioProps as WRadioProps } from './components/Radio/radio'
25
+ import type { RatingProps as WRatingProps } from './components/Rating/rating'
26
+ import type { SelectProps as WSelectProps } from './components/Select/select'
27
+ import type { SheetProps as WSheetProps } from './components/Sheet/sheet'
28
+ import type { SidebarProps as WSidebarProps } from './components/Sidebar/sidebar'
29
+ import type { SliderProps as WSliderProps } from './components/Slider/slider'
30
+ import type { SpinnerProps as WSpinnerProps } from './components/Spinner/spinner'
31
+ import type { SwitchProps as WSwitchProps } from './components/Switch/switch'
32
+ import type { TableProps as WTableProps } from './components/Table/table'
33
+ import type { TabsProps as WTabsProps } from './components/Tabs/tabs'
34
+ import type { TextareaProps as WTextareaProps } from './components/Textarea/textarea'
35
+ import type { ThemeSwitcherProps as WThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
36
+ import type { TimelineProps as WTimelineProps } from './components/Timeline/timeline'
37
+ import type { TimelineItemProps as WTimelineItemProps } from './components/TimelineItem/timelineitem'
38
+ import type { ToastProps as WToastProps } from './components/Toast/toast'
35
39
 
36
40
  declare module 'webcoreui/astro' {
37
- export function Accordion(_props: AccordionProps): any
38
- export function Alert(_props: AlertProps): any
39
- export function Avatar(_props: AvatarProps): any
40
- export function Badge(_props: BadgeProps): any
41
- export function Button(_props: ButtonProps): any
42
- export function Card(_props: CardProps): any
43
- export function Carousel(_props: CarouselProps): any
44
- export function Checkbox(_props: CheckboxProps): any
45
- export function Collapsible(_props: CollapsibleProps): any
46
- export function ConditionalWrapper(_props: ConditionalWrapperProps): any
47
- export function DataTable(_props: DataTableProps): any
48
- export function Group(_props: GroupProps): any
49
- export function Icon(_props: IconProps): any
50
- export function Input(_props: InputProps): any
51
- export function List(_props: ListProps): any
52
- export function Menu(_props: MenuProps): any
53
- export function Modal(_props: ModalProps): any
54
- export function Pagination(_props: PaginationProps): any
55
- export function Popover(_props: PopoverProps): any
56
- export function Progress(_props: ProgressProps): any
57
- export function Radio(_props: RadioProps): any
58
- export function Rating(_props: RatingProps): any
59
- export function Select(_props: SelectProps): any
60
- export function Sheet(_props: SheetProps): any
61
- export function Slider(_props: SliderProps): any
62
- export function Spinner(_props: SpinnerProps): any
63
- export function Switch(_props: SwitchProps): any
64
- export function Table(_props: TableProps): any
65
- export function Tabs(_props: TabsProps): any
66
- export function Textarea(_props: TextareaProps): any
67
- export function ThemeSwitcher(_props: ThemeSwitcherProps): any
68
- export function Timeline(_props: TimelineProps): any
69
- export function TimelineItem(_props: TimelineItemProps): any
70
- export function Toast(_props: ToastProps): any
41
+ export function Accordion(_props: WAccordionProps): any
42
+ export function Alert(_props: WAlertProps): any
43
+ export function Avatar(_props: WAvatarProps): any
44
+ export function Badge(_props: WBadgeProps): any
45
+ export function Breadcrumb(_props: WBreadcrumbProps): any
46
+ export function Button(_props: WButtonProps): any
47
+ export function Card(_props: WCardProps): any
48
+ export function Carousel(_props: WCarouselProps): any
49
+ export function Checkbox(_props: WCheckboxProps): any
50
+ export function Collapsible(_props: WCollapsibleProps): any
51
+ export function ConditionalWrapper(_props: WConditionalWrapperProps): any
52
+ export function DataTable(_props: WDataTableProps): any
53
+ export function Footer(_props: WFooterProps): any
54
+ export function Group(_props: WGroupProps): any
55
+ export function Icon(_props: WIconProps): any
56
+ export function Input(_props: WInputProps): any
57
+ export function List(_props: WListProps): any
58
+ export function Masonry(_props: WMasonryProps): any
59
+ export function Menu(_props: WMenuProps): any
60
+ export function Modal(_props: WModalProps): any
61
+ export function Pagination(_props: WPaginationProps): any
62
+ export function Popover(_props: WPopoverProps): any
63
+ export function Progress(_props: WProgressProps): any
64
+ export function Radio(_props: WRadioProps): any
65
+ export function Rating(_props: WRatingProps): any
66
+ export function Select(_props: WSelectProps): any
67
+ export function Sheet(_props: WSheetProps): any
68
+ export function Sidebar(_props: WSidebarProps): any
69
+ export function Slider(_props: WSliderProps): any
70
+ export function Spinner(_props: WSpinnerProps): any
71
+ export function Switch(_props: WSwitchProps): any
72
+ export function Table(_props: WTableProps): any
73
+ export function Tabs(_props: WTabsProps): any
74
+ export function Textarea(_props: WTextareaProps): any
75
+ export function ThemeSwitcher(_props: WThemeSwitcherProps): any
76
+ export function Timeline(_props: WTimelineProps): any
77
+ export function TimelineItem(_props: WTimelineItemProps): any
78
+ export function Toast(_props: WToastProps): any
79
+
80
+ export type AccordionProps = WAccordionProps
81
+ export type AlertProps = WAlertProps
82
+ export type AvatarProps = WAvatarProps
83
+ export type BadgeProps = WBadgeProps
84
+ export type BreadcrumbProps = WBreadcrumbProps
85
+ export type ButtonProps = WButtonProps
86
+ export type CardProps = WCardProps
87
+ export type CarouselProps = WCarouselProps
88
+ export type CheckboxProps = WCheckboxProps
89
+ export type CollapsibleProps = WCollapsibleProps
90
+ export type ConditionalWrapperProps = WConditionalWrapperProps
91
+ export type DataTableProps = WDataTableProps
92
+ export type FooterProps = WFooterProps
93
+ export type GroupProps = WGroupProps
94
+ export type IconProps = WIconProps
95
+ export type InputProps = WInputProps
96
+ export type ListProps = WListProps
97
+ export type MasonryProps = WMasonryProps
98
+ export type MenuProps = WMenuProps
99
+ export type ModalProps = WModalProps
100
+ export type PaginationProps = WPaginationProps
101
+ export type PopoverProps = WPopoverProps
102
+ export type ProgressProps = WProgressProps
103
+ export type RadioProps = WRadioProps
104
+ export type RatingProps = WRatingProps
105
+ export type SelectProps = WSelectProps
106
+ export type SheetProps = WSheetProps
107
+ export type SidebarProps = WSidebarProps
108
+ export type SliderProps = WSliderProps
109
+ export type SpinnerProps = WSpinnerProps
110
+ export type SwitchProps = WSwitchProps
111
+ export type TableProps = WTableProps
112
+ export type TabsProps = WTabsProps
113
+ export type TextareaProps = WTextareaProps
114
+ export type ThemeSwitcherProps = WThemeSwitcherProps
115
+ export type TimelineProps = WTimelineProps
116
+ export type TimelineItemProps = WTimelineItemProps
117
+ export type ToastProps = WToastProps
71
118
  }
package/astro.js CHANGED
@@ -2,6 +2,7 @@ import AccordionComponent from './components/Accordion/Accordion.astro'
2
2
  import AlertComponent from './components/Alert/Alert.astro'
3
3
  import AvatarComponent from './components/Avatar/Avatar.astro'
4
4
  import BadgeComponent from './components/Badge/Badge.astro'
5
+ import BreadcrumbComponent from './components/Breadcrumb/Breadcrumb.astro'
5
6
  import ButtonComponent from './components/Button/Button.astro'
6
7
  import CardComponent from './components/Card/Card.astro'
7
8
  import CarouselComponent from './components/Carousel/Carousel.astro'
@@ -9,10 +10,12 @@ import CheckboxComponent from './components/Checkbox/Checkbox.astro'
9
10
  import CollapsibleComponent from './components/Collapsible/Collapsible.astro'
10
11
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
11
12
  import DataTableComponent from './components/DataTable/DataTable.astro'
13
+ import FooterComponent from './components/Footer/Footer.astro'
12
14
  import GroupComponent from './components/Group/Group.astro'
13
15
  import IconComponent from './components/Icon/Icon.astro'
14
16
  import InputComponent from './components/Input/Input.astro'
15
17
  import ListComponent from './components/List/List.astro'
18
+ import MasonryComponent from './components/Masonry/Masonry.astro'
16
19
  import MenuComponent from './components/Menu/Menu.astro'
17
20
  import ModalComponent from './components/Modal/Modal.astro'
18
21
  import PaginationComponent from './components/Pagination/Pagination.astro'
@@ -22,6 +25,7 @@ import RadioComponent from './components/Radio/Radio.astro'
22
25
  import RatingComponent from './components/Rating/Rating.astro'
23
26
  import SelectComponent from './components/Select/Select.astro'
24
27
  import SheetComponent from './components/Sheet/Sheet.astro'
28
+ import SidebarComponent from './components/Sidebar/Sidebar.astro'
25
29
  import SliderComponent from './components/Slider/Slider.astro'
26
30
  import SpinnerComponent from './components/Spinner/Spinner.astro'
27
31
  import SwitchComponent from './components/Switch/Switch.astro'
@@ -37,6 +41,7 @@ export const Accordion = AccordionComponent
37
41
  export const Alert = AlertComponent
38
42
  export const Avatar = AvatarComponent
39
43
  export const Badge = BadgeComponent
44
+ export const Breadcrumb = BreadcrumbComponent
40
45
  export const Button = ButtonComponent
41
46
  export const Card = CardComponent
42
47
  export const Carousel = CarouselComponent
@@ -44,10 +49,12 @@ export const Checkbox = CheckboxComponent
44
49
  export const Collapsible = CollapsibleComponent
45
50
  export const ConditionalWrapper = ConditionalWrapperComponent
46
51
  export const DataTable = DataTableComponent
52
+ export const Footer = FooterComponent
47
53
  export const Group = GroupComponent
48
54
  export const Icon = IconComponent
49
55
  export const Input = InputComponent
50
56
  export const List = ListComponent
57
+ export const Masonry = MasonryComponent
51
58
  export const Menu = MenuComponent
52
59
  export const Modal = ModalComponent
53
60
  export const Pagination = PaginationComponent
@@ -57,6 +64,7 @@ export const Radio = RadioComponent
57
64
  export const Rating = RatingComponent
58
65
  export const Select = SelectComponent
59
66
  export const Sheet = SheetComponent
67
+ export const Sidebar = SidebarComponent
60
68
  export const Slider = SliderComponent
61
69
  export const Spinner = SpinnerComponent
62
70
  export const Switch = SwitchComponent
@@ -8,6 +8,8 @@ interface Props extends BadgeProps {}
8
8
  const {
9
9
  theme,
10
10
  hover,
11
+ small,
12
+ rounded,
11
13
  className,
12
14
  ...rest
13
15
  } = Astro.props
@@ -16,6 +18,8 @@ const classes = [
16
18
  styles.badge,
17
19
  theme && styles[theme],
18
20
  hover && styles.hover,
21
+ small && styles.small,
22
+ rounded && styles.round,
19
23
  className
20
24
  ]
21
25
  ---
@@ -6,14 +6,18 @@
6
6
  import styles from './badge.module.scss'
7
7
 
8
8
  export let theme: SvelteBadgeProps['theme'] = null
9
- export let onClick: SvelteBadgeProps['onClick'] = null
10
9
  export let hover: SvelteBadgeProps['hover'] = false
10
+ export let small: SvelteBadgeProps['small'] = false
11
+ export let rounded: SvelteBadgeProps['rounded'] = false
11
12
  export let className: SvelteBadgeProps['className'] = ''
13
+ export let onClick: SvelteBadgeProps['onClick'] = () => {}
12
14
 
13
15
  const classes = classNames([
14
16
  styles.badge,
15
17
  theme && styles[theme],
16
18
  (onClick || hover) && styles.hover,
19
+ small && styles.small,
20
+ rounded && styles.round,
17
21
  className
18
22
  ])
19
23
  </script>
@@ -9,6 +9,8 @@ const Badge = ({
9
9
  theme,
10
10
  onClick,
11
11
  hover,
12
+ small,
13
+ rounded,
12
14
  className,
13
15
  children,
14
16
  ...rest
@@ -17,6 +19,8 @@ const Badge = ({
17
19
  styles.badge,
18
20
  theme && styles[theme],
19
21
  (onClick || hover) && styles.hover,
22
+ small && styles.small,
23
+ rounded && styles.round,
20
24
  className
21
25
  ])
22
26
 
@@ -83,4 +83,12 @@
83
83
  @include typography(alert-fg);
84
84
  @include background(alert);
85
85
  }
86
+
87
+ &.small {
88
+ @include spacing(py-xxs, px-xs);
89
+ }
90
+
91
+ &.round {
92
+ @include border-radius(lg);
93
+ }
86
94
  }
@@ -1,3 +1,5 @@
1
+ import type { MouseEventHandler } from 'svelte/elements'
2
+
1
3
  export type BadgeProps = {
2
4
  theme?: 'secondary'
3
5
  | 'outline'
@@ -8,15 +10,17 @@ export type BadgeProps = {
8
10
  | 'alert'
9
11
  | null
10
12
  hover?: boolean
13
+ small?: boolean
14
+ rounded?: boolean
11
15
  className?: string
12
16
  [key: string]: any
13
17
  }
14
18
 
15
19
  export type SvelteBadgeProps = {
16
- onClick?: (() => any) | null
20
+ onClick?: MouseEventHandler<HTMLButtonElement>
17
21
  } & BadgeProps
18
22
 
19
23
  export type ReactBadgeProps = {
20
- onClick?: (() => any) | null
21
- children: React.ReactNode
24
+ onClick?: React.MouseEventHandler<HTMLButtonElement>
25
+ children?: React.ReactNode
22
26
  } & BadgeProps
@@ -0,0 +1,51 @@
1
+ ---
2
+ import type { BreadcrumbProps } from './breadcrumb'
3
+
4
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
5
+ import Icon from '../Icon/Icon.astro'
6
+
7
+ import styles from './breadcrumb.module.scss'
8
+
9
+ import type { IconProps } from '../Icon/icon'
10
+
11
+ interface Props extends BreadcrumbProps {}
12
+
13
+ const {
14
+ items,
15
+ separator,
16
+ className
17
+ } = Astro.props
18
+
19
+ const classes = [
20
+ styles.breadcrumb,
21
+ className
22
+ ]
23
+ ---
24
+
25
+ <ul class:list={classes}>
26
+ {items?.map((item, index) => (
27
+ <li>
28
+ <ConditionalWrapper condition={!!(item.href && index !== items.length - 1)}>
29
+ <a href={item.href} target={item.target} slot="wrapper">
30
+ children
31
+ </a>
32
+ {item.icon && (
33
+ <Fragment>
34
+ {item.icon.startsWith('<svg')
35
+ ? <Fragment set:html={item.icon} />
36
+ : <Icon type={item.icon as IconProps['type']} />
37
+ }
38
+ </Fragment>
39
+ )}
40
+ {item.label}
41
+ </ConditionalWrapper>
42
+ </li>
43
+ <Fragment>
44
+ {index < items.length - 1 && (
45
+ <li>
46
+ {separator || <Icon type="arrow-right" />}
47
+ </li>
48
+ )}
49
+ </Fragment>
50
+ ))}
51
+ </ul>
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ import type { BreadcrumbProps } from './breadcrumb'
3
+
4
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import ArrowRight from '../../icons/arrow-right.svg?raw'
9
+
10
+ import styles from './breadcrumb.module.scss'
11
+
12
+ export let items: BreadcrumbProps['items'] = []
13
+ export let separator: BreadcrumbProps['separator'] = ''
14
+ export let className: BreadcrumbProps['className'] = ''
15
+
16
+ const classes = classNames([
17
+ styles.breadcrumb,
18
+ className
19
+ ])
20
+ </script>
21
+
22
+ <ul class={classes}>
23
+ {#each items as item, index}
24
+ <li>
25
+ <ConditionalWrapper
26
+ condition={!!(item.href && index !== items.length - 1)}
27
+ element="a"
28
+ href={item.href}
29
+ target={item.target}
30
+ >
31
+ {#if item.icon}
32
+ {@html item.icon}
33
+ {/if}
34
+ {#if item.label}
35
+ {item.label}
36
+ {/if}
37
+ </ConditionalWrapper>
38
+ </li>
39
+ {#if index < items.length - 1 }
40
+ <li>
41
+ {@html separator || ArrowRight}
42
+ </li>
43
+ {/if}
44
+ {/each}
45
+ </ul>
@@ -0,0 +1,51 @@
1
+ import React from 'react'
2
+ import type { BreadcrumbProps } from './breadcrumb'
3
+
4
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import ArrowRight from '../../icons/arrow-right.svg?raw'
9
+
10
+ import styles from './breadcrumb.module.scss'
11
+
12
+ const Breadcrumb = ({
13
+ items,
14
+ separator,
15
+ className
16
+ }: BreadcrumbProps) => {
17
+ const classes = classNames([
18
+ styles.breadcrumb,
19
+ className
20
+ ])
21
+
22
+ return (
23
+ <ul className={classes}>
24
+ {items?.map((item, index) => (
25
+ <React.Fragment key={index}>
26
+ <li>
27
+ <ConditionalWrapper
28
+ condition={!!(item.href && index !== items.length - 1)}
29
+ wrapper={children => (
30
+ <a href={item.href} target={item.target}>{children}</a>
31
+ )}
32
+ >
33
+ {item.icon && <span dangerouslySetInnerHTML={{ __html: item.icon }} />}
34
+ {item.label}
35
+ </ConditionalWrapper>
36
+ </li>
37
+ {index < items.length - 1 && (
38
+ <li>
39
+ {separator
40
+ ? separator
41
+ : <span dangerouslySetInnerHTML={{ __html: ArrowRight }} />
42
+ }
43
+ </li>
44
+ )}
45
+ </React.Fragment>
46
+ ))}
47
+ </ul>
48
+ )
49
+ }
50
+
51
+ export default Breadcrumb
@@ -0,0 +1,26 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ .breadcrumb {
4
+ @include layout(flex, v-center, sm, wrap);
5
+ @include spacing(0);
6
+
7
+ list-style-type: none;
8
+
9
+ li {
10
+ @include layout(flex, v-center, xs);
11
+ @include spacing(m0);
12
+
13
+ a {
14
+ @include layout(flex, v-center, xs);
15
+ @include typography(none, primary-20);
16
+
17
+ &:hover {
18
+ @include typography(primary);
19
+ }
20
+ }
21
+ }
22
+
23
+ svg {
24
+ @include size(14px);
25
+ }
26
+ }
@@ -0,0 +1,12 @@
1
+ import type { ButtonProps } from '../Button/button'
2
+
3
+ export type BreadcrumbProps = {
4
+ items: {
5
+ icon?: string
6
+ label?: string
7
+ href?: string
8
+ target?: ButtonProps['target']
9
+ }[]
10
+ separator?: string
11
+ className?: string
12
+ }
@@ -1,3 +1,5 @@
1
+ import type { MouseEventHandler } from 'svelte/elements'
2
+
1
3
  export type ButtonProps = {
2
4
  theme?: 'secondary'
3
5
  | 'outline'
@@ -7,16 +9,24 @@ export type ButtonProps = {
7
9
  | 'warning'
8
10
  | 'alert'
9
11
  | null
12
+ | undefined
13
+ target?: '_self'
14
+ | '_blank'
15
+ | '_parent'
16
+ | '_top'
17
+ | '_unfencedTop'
18
+ | ''
19
+ | undefined
10
20
  href?: string
11
21
  className?: string
12
22
  [key: string]: any
13
23
  }
14
24
 
15
25
  export type SvelteButtonProps = {
16
- onClick?: (() => any) | null
26
+ onClick?: MouseEventHandler<HTMLButtonElement>
17
27
  } & ButtonProps
18
28
 
19
29
  export type ReactButtonProps = {
20
- onClick?: (() => any) | null
21
- children: React.ReactNode
30
+ onClick?: React.MouseEventHandler<HTMLButtonElement>
31
+ children?: React.ReactNode
22
32
  } & ButtonProps