webcoreui 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +237 -227
  2. package/astro.d.ts +115 -62
  3. package/astro.js +14 -0
  4. package/components/Avatar/Avatar.astro +9 -2
  5. package/components/Avatar/Avatar.svelte +3 -1
  6. package/components/Avatar/Avatar.tsx +4 -2
  7. package/components/Avatar/avatar.ts +1 -0
  8. package/components/Badge/Badge.astro +4 -0
  9. package/components/Badge/Badge.svelte +5 -1
  10. package/components/Badge/Badge.tsx +4 -0
  11. package/components/Badge/badge.module.scss +8 -0
  12. package/components/Badge/badge.ts +7 -3
  13. package/components/Breadcrumb/Breadcrumb.astro +51 -0
  14. package/components/Breadcrumb/Breadcrumb.svelte +45 -0
  15. package/components/Breadcrumb/Breadcrumb.tsx +51 -0
  16. package/components/Breadcrumb/breadcrumb.module.scss +26 -0
  17. package/components/Breadcrumb/breadcrumb.ts +12 -0
  18. package/components/Button/button.module.scss +6 -1
  19. package/components/Button/button.ts +13 -3
  20. package/components/Carousel/Carousel.astro +198 -0
  21. package/components/Carousel/Carousel.svelte +161 -0
  22. package/components/Carousel/Carousel.tsx +172 -0
  23. package/components/Carousel/carousel.module.scss +58 -0
  24. package/components/Carousel/carousel.ts +26 -0
  25. package/components/Checkbox/checkbox.ts +4 -2
  26. package/components/DataTable/DataTable.astro +332 -0
  27. package/components/DataTable/DataTable.svelte +272 -0
  28. package/components/DataTable/DataTable.tsx +287 -0
  29. package/components/DataTable/datatable.module.scss +102 -0
  30. package/components/DataTable/datatable.ts +41 -0
  31. package/components/Footer/Footer.astro +91 -0
  32. package/components/Footer/Footer.svelte +94 -0
  33. package/components/Footer/Footer.tsx +107 -0
  34. package/components/Footer/footer.module.scss +61 -0
  35. package/components/Footer/footer.ts +29 -0
  36. package/components/Icon/Icon.svelte +1 -1
  37. package/components/Icon/icon.ts +18 -1
  38. package/components/Icon/map.ts +14 -0
  39. package/components/Input/input.module.scss +6 -0
  40. package/components/List/List.astro +1 -1
  41. package/components/List/List.svelte +1 -1
  42. package/components/List/List.tsx +1 -2
  43. package/components/List/list.ts +3 -1
  44. package/components/Masonry/Masonry.astro +54 -0
  45. package/components/Masonry/Masonry.svelte +54 -0
  46. package/components/Masonry/Masonry.tsx +62 -0
  47. package/components/Masonry/masonry.module.scss +18 -0
  48. package/components/Masonry/masonry.ts +36 -0
  49. package/components/Menu/Menu.astro +1 -1
  50. package/components/Menu/Menu.svelte +1 -1
  51. package/components/Menu/Menu.tsx +1 -1
  52. package/components/Menu/menu.ts +4 -2
  53. package/components/Modal/Modal.astro +2 -0
  54. package/components/Modal/Modal.svelte +2 -0
  55. package/components/Modal/Modal.tsx +2 -0
  56. package/components/Modal/modal.module.scss +29 -22
  57. package/components/Modal/modal.ts +1 -0
  58. package/components/Pagination/Pagination.astro +189 -0
  59. package/components/Pagination/Pagination.svelte +144 -0
  60. package/components/Pagination/Pagination.tsx +162 -0
  61. package/components/Pagination/pagination.module.scss +49 -0
  62. package/components/Pagination/pagination.ts +35 -0
  63. package/components/Rating/rating.ts +3 -1
  64. package/components/Select/Select.astro +8 -4
  65. package/components/Select/Select.svelte +15 -6
  66. package/components/Select/Select.tsx +15 -8
  67. package/components/Select/select.ts +7 -2
  68. package/components/Sidebar/Sidebar.astro +61 -0
  69. package/components/Sidebar/Sidebar.svelte +50 -0
  70. package/components/Sidebar/Sidebar.tsx +58 -0
  71. package/components/Sidebar/sidebar.module.scss +43 -0
  72. package/components/Sidebar/sidebar.ts +21 -0
  73. package/components/Switch/switch.ts +4 -2
  74. package/components/Table/Table.svelte +1 -1
  75. package/components/Table/table.ts +1 -1
  76. package/icons/arrow-left.svg +3 -0
  77. package/icons/arrow-right.svg +3 -0
  78. package/icons/circle-close.svg +3 -0
  79. package/icons/components.svg +3 -0
  80. package/icons/file.svg +3 -0
  81. package/icons/home.svg +4 -0
  82. package/icons/order.svg +3 -0
  83. package/icons/sun.svg +1 -1
  84. package/icons.d.ts +7 -0
  85. package/icons.js +7 -0
  86. package/index.d.ts +6 -6
  87. package/package.json +8 -10
  88. package/react.d.ts +115 -62
  89. package/react.js +14 -0
  90. package/scss/resets.scss +27 -1
  91. package/svelte.d.ts +116 -62
  92. package/svelte.js +14 -0
package/astro.d.ts CHANGED
@@ -1,65 +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 { CheckboxProps } from './components/Checkbox/checkbox'
8
- import type { CollapsibleProps } from './components/Collapsible/collapsible'
9
- import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
10
- import type { GroupProps } from './components/Group/group'
11
- import type { IconProps } from './components/Icon/icon'
12
- import type { InputProps } from './components/Input/input'
13
- import type { ListProps } from './components/List/list'
14
- import type { MenuProps } from './components/Menu/menu'
15
- import type { ModalProps } from './components/Modal/modal'
16
- import type { PopoverProps } from './components/Popover/popover'
17
- import type { ProgressProps } from './components/Progress/progress'
18
- import type { RadioProps } from './components/Radio/radio'
19
- import type { RatingProps } from './components/Rating/rating'
20
- import type { SelectProps } from './components/Select/select'
21
- import type { SheetProps } from './components/Sheet/sheet'
22
- import type { SliderProps } from './components/Slider/slider'
23
- import type { SpinnerProps } from './components/Spinner/spinner'
24
- import type { SwitchProps } from './components/Switch/switch'
25
- import type { TableProps } from './components/Table/table'
26
- import type { TabsProps } from './components/Tabs/tabs'
27
- import type { TextareaProps } from './components/Textarea/textarea'
28
- import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
29
- import type { TimelineProps } from './components/Timeline/timeline'
30
- import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
31
- 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'
32
39
 
33
40
  declare module 'webcoreui/astro' {
34
- export function Accordion(_props: AccordionProps): any
35
- export function Alert(_props: AlertProps): any
36
- export function Avatar(_props: AvatarProps): any
37
- export function Badge(_props: BadgeProps): any
38
- export function Button(_props: ButtonProps): any
39
- export function Card(_props: CardProps): any
40
- export function Checkbox(_props: CheckboxProps): any
41
- export function Collapsible(_props: CollapsibleProps): any
42
- export function ConditionalWrapper(_props: ConditionalWrapperProps): any
43
- export function Group(_props: GroupProps): any
44
- export function Icon(_props: IconProps): any
45
- export function Input(_props: InputProps): any
46
- export function List(_props: ListProps): any
47
- export function Menu(_props: MenuProps): any
48
- export function Modal(_props: ModalProps): any
49
- export function Popover(_props: PopoverProps): any
50
- export function Progress(_props: ProgressProps): any
51
- export function Radio(_props: RadioProps): any
52
- export function Rating(_props: RatingProps): any
53
- export function Select(_props: SelectProps): any
54
- export function Sheet(_props: SheetProps): any
55
- export function Slider(_props: SliderProps): any
56
- export function Spinner(_props: SpinnerProps): any
57
- export function Switch(_props: SwitchProps): any
58
- export function Table(_props: TableProps): any
59
- export function Tabs(_props: TabsProps): any
60
- export function Textarea(_props: TextareaProps): any
61
- export function ThemeSwitcher(_props: ThemeSwitcherProps): any
62
- export function Timeline(_props: TimelineProps): any
63
- export function TimelineItem(_props: TimelineItemProps): any
64
- 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
65
118
  }
package/astro.js CHANGED
@@ -2,23 +2,30 @@ 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'
8
+ import CarouselComponent from './components/Carousel/Carousel.astro'
7
9
  import CheckboxComponent from './components/Checkbox/Checkbox.astro'
8
10
  import CollapsibleComponent from './components/Collapsible/Collapsible.astro'
9
11
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
12
+ import DataTableComponent from './components/DataTable/DataTable.astro'
13
+ import FooterComponent from './components/Footer/Footer.astro'
10
14
  import GroupComponent from './components/Group/Group.astro'
11
15
  import IconComponent from './components/Icon/Icon.astro'
12
16
  import InputComponent from './components/Input/Input.astro'
13
17
  import ListComponent from './components/List/List.astro'
18
+ import MasonryComponent from './components/Masonry/Masonry.astro'
14
19
  import MenuComponent from './components/Menu/Menu.astro'
15
20
  import ModalComponent from './components/Modal/Modal.astro'
21
+ import PaginationComponent from './components/Pagination/Pagination.astro'
16
22
  import PopoverComponent from './components/Popover/Popover.astro'
17
23
  import ProgressComponent from './components/Progress/Progress.astro'
18
24
  import RadioComponent from './components/Radio/Radio.astro'
19
25
  import RatingComponent from './components/Rating/Rating.astro'
20
26
  import SelectComponent from './components/Select/Select.astro'
21
27
  import SheetComponent from './components/Sheet/Sheet.astro'
28
+ import SidebarComponent from './components/Sidebar/Sidebar.astro'
22
29
  import SliderComponent from './components/Slider/Slider.astro'
23
30
  import SpinnerComponent from './components/Spinner/Spinner.astro'
24
31
  import SwitchComponent from './components/Switch/Switch.astro'
@@ -34,23 +41,30 @@ export const Accordion = AccordionComponent
34
41
  export const Alert = AlertComponent
35
42
  export const Avatar = AvatarComponent
36
43
  export const Badge = BadgeComponent
44
+ export const Breadcrumb = BreadcrumbComponent
37
45
  export const Button = ButtonComponent
38
46
  export const Card = CardComponent
47
+ export const Carousel = CarouselComponent
39
48
  export const Checkbox = CheckboxComponent
40
49
  export const Collapsible = CollapsibleComponent
41
50
  export const ConditionalWrapper = ConditionalWrapperComponent
51
+ export const DataTable = DataTableComponent
52
+ export const Footer = FooterComponent
42
53
  export const Group = GroupComponent
43
54
  export const Icon = IconComponent
44
55
  export const Input = InputComponent
45
56
  export const List = ListComponent
57
+ export const Masonry = MasonryComponent
46
58
  export const Menu = MenuComponent
47
59
  export const Modal = ModalComponent
60
+ export const Pagination = PaginationComponent
48
61
  export const Popover = PopoverComponent
49
62
  export const Progress = ProgressComponent
50
63
  export const Radio = RadioComponent
51
64
  export const Rating = RatingComponent
52
65
  export const Select = SelectComponent
53
66
  export const Sheet = SheetComponent
67
+ export const Sidebar = SidebarComponent
54
68
  export const Slider = SliderComponent
55
69
  export const Spinner = SpinnerComponent
56
70
  export const Switch = SwitchComponent
@@ -13,7 +13,8 @@ const {
13
13
  borderColor,
14
14
  borderless,
15
15
  reverse,
16
- className
16
+ className,
17
+ groupClassName
17
18
  } = Astro.props
18
19
 
19
20
  const classes = [
@@ -21,10 +22,16 @@ const classes = [
21
22
  borderless && styles.borderless,
22
23
  className
23
24
  ]
25
+
26
+ const groupClasses = [
27
+ styles.group,
28
+ reverse && styles.reverse,
29
+ groupClassName
30
+ ]
24
31
  ---
25
32
 
26
33
  {Array.isArray(img) ? (
27
- <div class:list={[styles.group, reverse && styles.reverse]}
34
+ <div class:list={groupClasses}
28
35
  style={borderColor ? `--w-avatar-border: ${borderColor};` : null}
29
36
  >
30
37
  {img.map((img, index) => (
@@ -13,6 +13,7 @@
13
13
  export let borderless: AvatarProps['borderless'] = false
14
14
  export let reverse: AvatarProps['reverse'] = false
15
15
  export let className: AvatarProps['className'] = ''
16
+ export let groupClassName: AvatarProps['groupClassName'] = ''
16
17
 
17
18
  const classes = classNames([
18
19
  styles.avatar,
@@ -22,7 +23,8 @@
22
23
 
23
24
  const groupStyles = classNames([
24
25
  styles.group,
25
- reverse && styles.reverse
26
+ reverse && styles.reverse,
27
+ groupClassName
26
28
  ])
27
29
  </script>
28
30
 
@@ -13,7 +13,8 @@ const Avatar = ({
13
13
  borderColor,
14
14
  borderless,
15
15
  reverse,
16
- className
16
+ className,
17
+ groupClassName
17
18
  }: AvatarProps) => {
18
19
  const classes = classNames([
19
20
  styles.avatar,
@@ -23,7 +24,8 @@ const Avatar = ({
23
24
 
24
25
  const groupStyles = classNames([
25
26
  styles.group,
26
- reverse && styles.reverse
27
+ reverse && styles.reverse,
28
+ groupClassName
27
29
  ])
28
30
 
29
31
  const borderColorStyle = borderColor
@@ -7,4 +7,5 @@ export type AvatarProps = {
7
7
  borderless?: boolean
8
8
  reverse?: boolean
9
9
  className?: string
10
+ groupClassName?: string
10
11
  }
@@ -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
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  .button {
4
4
  @include layout(inline-flex, center, xs);
5
- @include typography(default, primary-50, none);
5
+ @include typography(default, primary-50, none, normal);
6
6
  @include spacing(py-sm, px-md);
7
7
  @include border-radius(xs);
8
8
  @include border(0);
@@ -38,6 +38,11 @@
38
38
  @include typography(primary);
39
39
  box-shadow: inset 0px 0px 0px 1px var(--w-color-primary);
40
40
  }
41
+
42
+ &[disabled] {
43
+ @include typography(primary-30);
44
+ box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-30);
45
+ }
41
46
  }
42
47
 
43
48
  &.flat {