webcoreui 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +37 -1
  2. package/astro.d.ts +12 -0
  3. package/astro.js +12 -0
  4. package/components/Accordion/accordion.module.scss +1 -2
  5. package/components/Alert/Alert.tsx +4 -1
  6. package/components/Alert/alert.module.scss +3 -3
  7. package/components/Avatar/avatar.module.scss +2 -0
  8. package/components/Badge/badge.module.scss +1 -1
  9. package/components/Button/button.module.scss +2 -2
  10. package/components/Button/button.ts +1 -1
  11. package/components/Card/card.module.scss +0 -1
  12. package/components/Checkbox/checkbox.module.scss +4 -4
  13. package/components/Collapsible/Collapsible.astro +63 -0
  14. package/components/Collapsible/Collapsible.svelte +48 -0
  15. package/components/Collapsible/Collapsible.tsx +54 -0
  16. package/components/Collapsible/collapsible.module.scss +29 -0
  17. package/components/Collapsible/collapsible.ts +14 -0
  18. package/components/Icon/map.ts +2 -0
  19. package/components/Input/input.module.scss +2 -2
  20. package/components/Menu/Menu.astro +7 -3
  21. package/components/Menu/Menu.svelte +11 -3
  22. package/components/Menu/Menu.tsx +7 -1
  23. package/components/Menu/menu.module.scss +4 -1
  24. package/components/Menu/menu.ts +1 -0
  25. package/components/Modal/Modal.astro +70 -0
  26. package/components/Modal/Modal.svelte +71 -0
  27. package/components/Modal/Modal.tsx +76 -0
  28. package/components/Modal/modal.module.scss +103 -0
  29. package/components/Modal/modal.ts +18 -0
  30. package/components/Popover/Popover.astro +23 -0
  31. package/components/Popover/Popover.svelte +21 -0
  32. package/components/Popover/Popover.tsx +27 -0
  33. package/components/Popover/popover.module.scss +51 -0
  34. package/components/Popover/popover.ts +8 -0
  35. package/components/Progress/progress.module.scss +3 -3
  36. package/components/Radio/radio.module.scss +1 -2
  37. package/components/Rating/Rating.astro +2 -2
  38. package/components/Rating/Rating.svelte +2 -2
  39. package/components/Rating/Rating.tsx +2 -2
  40. package/components/Rating/rating.module.scss +1 -1
  41. package/components/Sheet/Sheet.astro +29 -0
  42. package/components/Sheet/Sheet.svelte +24 -0
  43. package/components/Sheet/Sheet.tsx +32 -0
  44. package/components/Sheet/sheet.module.scss +68 -0
  45. package/components/Sheet/sheet.ts +10 -0
  46. package/components/Slider/Slider.astro +44 -0
  47. package/components/Slider/Slider.svelte +42 -0
  48. package/components/Slider/Slider.tsx +48 -0
  49. package/components/Slider/slider.module.scss +68 -0
  50. package/components/Slider/slider.ts +20 -0
  51. package/components/Switch/switch.module.scss +1 -1
  52. package/components/Table/Table.astro +6 -1
  53. package/components/Table/Table.svelte +3 -1
  54. package/components/Table/Table.tsx +7 -1
  55. package/components/Table/table.module.scss +11 -1
  56. package/components/Table/table.ts +1 -0
  57. package/components/Tabs/tabs.module.scss +6 -1
  58. package/components/Textarea/Textarea.astro +44 -0
  59. package/components/Textarea/Textarea.svelte +45 -0
  60. package/components/Textarea/Textarea.tsx +50 -0
  61. package/components/Textarea/textarea.module.scss +36 -0
  62. package/components/Textarea/textarea.ts +18 -0
  63. package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -0
  64. package/components/ThemeSwitcher/ThemeSwitcher.svelte +2 -1
  65. package/components/ThemeSwitcher/ThemeSwitcher.tsx +2 -1
  66. package/components/Timeline/timeline.module.scss +4 -4
  67. package/components/TimelineItem/TimelineItem.tsx +1 -6
  68. package/components/TimelineItem/timelineitem.module.scss +2 -3
  69. package/components/TimelineItem/timelineitem.ts +5 -0
  70. package/components/Toast/Toast.svelte +11 -6
  71. package/icons/close.svg +3 -0
  72. package/icons.d.ts +1 -0
  73. package/icons.js +1 -0
  74. package/index.d.ts +69 -0
  75. package/index.js +4 -0
  76. package/package.json +2 -1
  77. package/react.d.ts +14 -2
  78. package/react.js +12 -0
  79. package/scss/config/color-palette.scss +1 -0
  80. package/scss/config/mixins.scss +152 -155
  81. package/scss/config/typography.scss +8 -9
  82. package/scss/global/theme.scss +71 -38
  83. package/scss/global/tooltip.scss +5 -3
  84. package/scss/global/utility.scss +76 -58
  85. package/scss/resets.scss +10 -5
  86. package/scss/setup.scss +2 -2
  87. package/svelte.d.ts +12 -0
  88. package/svelte.js +12 -0
  89. package/utils/debounce.ts +24 -0
  90. package/utils/interpolate.ts +23 -0
  91. package/utils/modal.ts +59 -0
  92. package/utils/popover.ts +201 -0
  93. package/utils/toast.ts +0 -6
@@ -28,11 +28,11 @@ body {
28
28
  left: $leftOffset
29
29
  }
30
30
 
31
- &.fill li::before {
31
+ &.fill > li::before {
32
32
  content: '';
33
33
  }
34
34
 
35
- &.stroke li::before {
35
+ &.stroke > li::before {
36
36
  @include background(primary-70);
37
37
  border: 2px solid var(--w-timeline-color);
38
38
  }
@@ -47,7 +47,7 @@ body {
47
47
  left: calc(50% - 1px);
48
48
  }
49
49
 
50
- li {
50
+ > li {
51
51
  @include size('w50%');
52
52
 
53
53
  &:nth-child(odd) {
@@ -69,7 +69,7 @@ body {
69
69
  }
70
70
  }
71
71
 
72
- &.centered li:nth-child(odd) {
72
+ &.centered > li:nth-child(odd) {
73
73
  @include typography(right);
74
74
  }
75
75
  }
@@ -1,14 +1,9 @@
1
1
  import React from 'react'
2
- import type { TimelineItemProps } from './timelineitem'
2
+ import type { ReactTimelineItemProps } from './timelineitem'
3
3
 
4
4
  import styles from './timelineitem.module.scss'
5
5
  import { classNames } from '../../utils/classNames'
6
6
 
7
- type ReactTimelineItemProps = {
8
- TitleTag?: keyof JSX.IntrinsicElements
9
- children: React.ReactNode
10
- } & Omit<TimelineItemProps, 'titleTag'>
11
-
12
7
  const TimelineItem = ({
13
8
  title,
14
9
  TitleTag = 'span',
@@ -2,7 +2,6 @@
2
2
 
3
3
  .item {
4
4
  @include position(relative);
5
- @include typography(md);
6
5
  @include spacing(m0);
7
6
 
8
7
  &::before {
@@ -10,7 +9,7 @@
10
9
  @include size(25px);
11
10
  @include border-radius(max);
12
11
  @include background(var(--w-timeline-color));
13
- @include typography(sm);
12
+ @include typography(md);
14
13
  @include layout(inline-flex, center);
15
14
  @include border(2px, primary-70);
16
15
 
@@ -21,7 +20,7 @@
21
20
  }
22
21
 
23
22
  .title {
24
- @include typography(bold, default);
23
+ @include typography(bold, lg);
25
24
  @include spacing(mb-sm);
26
25
 
27
26
  display: block;
@@ -3,3 +3,8 @@ export type TimelineItemProps = {
3
3
  titleTag?: string
4
4
  className?: string
5
5
  }
6
+
7
+ export type ReactTimelineItemProps = {
8
+ TitleTag?: keyof JSX.IntrinsicElements
9
+ children: React.ReactNode
10
+ } & Omit<TimelineItemProps, 'titleTag'>
@@ -24,9 +24,14 @@
24
24
  }
25
25
  </script>
26
26
 
27
- <Alert {...$$restProps} className={classes} {...additionalProps}>
28
- {#if $$slots.icon}
29
- <slot name="icon" />
30
- {/if}
31
- <slot />
32
- </Alert>
27
+ {#if $$slots.icon}
28
+ <Alert {...$$restProps} className={classes} {...additionalProps}>
29
+ <slot slot="icon" name="icon" />
30
+ <slot />
31
+ </Alert>
32
+ {:else}
33
+ <Alert {...$$restProps} className={classes} {...additionalProps}>
34
+ <slot />
35
+ </Alert>
36
+ {/if}
37
+
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M0.390524 0.390524C0.911223 -0.130175 1.75544 -0.130175 2.27614 0.390524L12 10.1144L21.7239 0.390524C22.2446 -0.130175 23.0888 -0.130175 23.6095 0.390524C24.1302 0.911223 24.1302 1.75544 23.6095 2.27614L13.8856 12L23.6095 21.7239C24.1302 22.2446 24.1302 23.0888 23.6095 23.6095C23.0888 24.1302 22.2446 24.1302 21.7239 23.6095L12 13.8856L2.27614 23.6095C1.75544 24.1302 0.911223 24.1302 0.390524 23.6095C-0.130175 23.0888 -0.130175 22.2446 0.390524 21.7239L10.1144 12L0.390524 2.27614C-0.130175 1.75544 -0.130175 0.911223 0.390524 0.390524Z" fill="currentColor"/>
3
+ </svg>
package/icons.d.ts CHANGED
@@ -3,6 +3,7 @@ declare module 'webcoreui/icons' {
3
3
  export const arrowDown: string
4
4
  export const check: string
5
5
  export const circleCheck: string
6
+ export const close: string
6
7
  export const github: string
7
8
  export const info: string
8
9
  export const moon: string
package/icons.js CHANGED
@@ -2,6 +2,7 @@ export { default as alert } from './icons/alert.svg?raw'
2
2
  export { default as arrowDown } from './icons/arrow-down.svg?raw'
3
3
  export { default as check } from './icons/check.svg?raw'
4
4
  export { default as circleCheck } from './icons/circle-check.svg?raw'
5
+ export { default as close } from './icons/close.svg?raw'
5
6
  export { default as github } from './icons/github.svg?raw'
6
7
  export { default as info } from './icons/info.svg?raw'
7
8
  export { default as moon } from './icons/moon.svg?raw'
package/index.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ type PopoverPosition = 'top'
2
+ | 'top-start'
3
+ | 'top-end'
4
+ | 'left'
5
+ | 'left-start'
6
+ | 'left-end'
7
+ | 'right'
8
+ | 'right-start'
9
+ | 'right-end'
10
+ | 'bottom'
11
+ | 'bottom-start'
12
+ | 'bottom-end'
13
+
14
+ type Popover = {
15
+ trigger: string
16
+ popover: string
17
+ position?: PopoverPosition
18
+ offset?: number
19
+ closeOnBlur?: boolean
20
+ }
21
+
22
+ type Toast = {
23
+ element: string
24
+ timeout?: number
25
+ title?: string
26
+ content?: string
27
+ theme?: 'info' | 'success' | 'warning' | 'alert' | null
28
+ position?: 'bottom-left'
29
+ | 'top-left'
30
+ | 'top-right'
31
+ | 'bottom-full'
32
+ | 'top-full'
33
+ }
34
+
35
+ declare module 'webcoreui' {
36
+ export const classNames = (classes: any[]) => string
37
+
38
+ export const setCookie = (name: string, value: string, days: number) => {}
39
+ export const getCookie = (name: string) => string | null
40
+ export const removeCookie = (name: string) => {}
41
+
42
+ export const debounce = (fn: any, waitFor: number) => any
43
+
44
+ export const dispatch = (event: string, detail: any) => {}
45
+ export const listen = (event: string, callback: (e: any) => any) => {
46
+ remove()
47
+ }
48
+
49
+ export const clamp = (num: number, min: number, max: number) => number
50
+ export const lerp = (start: number, end: number, value: number) => number
51
+ export const invlerp = (start: number, end: number, value: number) => number
52
+ export const interpolate = (
53
+ value: number,
54
+ input: [start: number, end: number],
55
+ output: [start: number, end: number],
56
+ ) => number
57
+
58
+ export const modal = (selector: string) => {}
59
+ export const closeModal = (selector: string) => {}
60
+
61
+ export const popover = (config: Popover) => {
62
+ remove()
63
+ }
64
+ export const closePopover = (selector: string) => {}
65
+
66
+ export const setDefaultTimeout = (time: number) => number
67
+ export const toast = (config: Toast | string) => {}
68
+ export const hideToast = (element: string) => {}
69
+ }
package/index.js CHANGED
@@ -1,4 +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'
5
+ export * from './utils/interpolate.ts'
6
+ export * from './utils/modal.ts'
7
+ export * from './utils/popover.ts'
4
8
  export * from './utils/toast.ts'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webcoreui",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.3.0",
5
5
  "scripts": {
6
6
  "dev": "astro dev",
7
7
  "build": "astro check && astro build",
@@ -43,6 +43,7 @@
43
43
  "react.d.ts",
44
44
  "react.js",
45
45
  "index.js",
46
+ "index.d.ts",
46
47
  "README.md",
47
48
  "LICENSE"
48
49
  ],
package/react.d.ts CHANGED
@@ -6,20 +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'
10
11
  import type { IconProps } from './components/Icon/icon'
11
12
  import type { ReactInputProps } from './components/Input/input'
12
13
  import type { ReactMenuProps } from './components/Menu/menu'
14
+ import type { ReactModalProps } from './components/Modal/modal'
15
+ import type { ReactPopoverProps } from './components/Popover/popover'
13
16
  import type { ProgressProps } from './components/Progress/progress'
14
17
  import type { ReactRadioProps } from './components/Radio/radio'
15
18
  import type { RatingProps } from './components/Rating/rating'
19
+ import type { ReactSheetProps } from './components/Sheet/sheet'
20
+ import type { ReactSliderProps } from './components/Slider/slider'
16
21
  import type { SpinnerProps } from './components/Spinner/spinner'
17
22
  import type { ReactSwitchProps } from './components/Switch/switch'
18
23
  import type { TableProps } from './components/Table/table'
19
24
  import type { ReactTabsProps } from './components/Tabs/tabs'
25
+ import type { ReactTextareaProps } from './components/Textarea/textarea'
20
26
  import type { ReactThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
21
27
  import type { ReactTimelineProps } from './components/Timeline/timeline'
22
- import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
28
+ import type { ReactTimelineItemProps } from './components/TimelineItem/timelineitem'
23
29
  import type { ReactToastProps } from './components/Toast/toast'
24
30
 
25
31
  declare module 'webcoreui/react' {
@@ -30,19 +36,25 @@ declare module 'webcoreui/react' {
30
36
  export const Button: FC<ReactButtonProps>
31
37
  export const Card: FC<ReactCardProps>
32
38
  export const Checkbox: FC<ReactCheckboxProps>
39
+ export const Collapsible: FC<ReactCollapsibleProps>
33
40
  export const ConditionalWrapper: FC<ReactConditionalWrapperProps>
34
41
  export const Icon: FC<IconProps>
35
42
  export const Input: FC<ReactInputProps>
36
43
  export const Menu: FC<ReactMenuProps>
44
+ export const Modal: FC<ReactModalProps>
45
+ export const Popover: FC<ReactPopoverProps>
37
46
  export const Progress: FC<ProgressProps>
38
47
  export const Radio: FC<ReactRadioProps>
39
48
  export const Rating: FC<RatingProps>
49
+ export const Sheet: FC<ReactSheetProps>
50
+ export const Slider: FC<ReactSliderProps>
40
51
  export const Spinner: FC<SpinnerProps>
41
52
  export const Switch: FC<ReactSwitchProps>
42
53
  export const Table: FC<TableProps>
43
54
  export const Tabs: FC<ReactTabsProps>
55
+ export const Textarea: FC<ReactTextareaProps>
44
56
  export const ThemeSwitcher: FC<ReactThemeSwitcherProps>
45
57
  export const Timeline: FC<ReactTimelineProps>
46
- export const TimelineItem: FC<TimelineItemProps>
58
+ export const TimelineItem: FC<ReactTimelineItemProps>
47
59
  export const Toast: FC<ReactToastProps>
48
60
  }
package/react.js CHANGED
@@ -5,17 +5,23 @@ import BadgeComponent from './components/Badge/Badge.tsx'
5
5
  import ButtonComponent from './components/Button/Button.tsx'
6
6
  import CardComponent from './components/Card/Card.tsx'
7
7
  import CheckboxComponent from './components/Checkbox/Checkbox.tsx'
8
+ import CollapsibleComponent from './components/Collapsible/Collapsible.tsx'
8
9
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.tsx'
9
10
  import IconComponent from './components/Icon/Icon.tsx'
10
11
  import InputComponent from './components/Input/Input.tsx'
11
12
  import MenuComponent from './components/Menu/Menu.tsx'
13
+ import ModalComponent from './components/Modal/Modal.tsx'
14
+ import PopoverComponent from './components/Popover/Popover.tsx'
12
15
  import ProgressComponent from './components/Progress/Progress.tsx'
13
16
  import RadioComponent from './components/Radio/Radio.tsx'
14
17
  import RatingComponent from './components/Rating/Rating.tsx'
18
+ import SheetComponent from './components/Sheet/Sheet.tsx'
19
+ import SliderComponent from './components/Slider/Slider.tsx'
15
20
  import SpinnerComponent from './components/Spinner/Spinner.tsx'
16
21
  import SwitchComponent from './components/Switch/Switch.tsx'
17
22
  import TableComponent from './components/Table/Table.tsx'
18
23
  import TabsComponent from './components/Tabs/Tabs.tsx'
24
+ import TextareaComponent from './components/Textarea/Textarea.tsx'
19
25
  import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.tsx'
20
26
  import TimelineComponent from './components/Timeline/Timeline.tsx'
21
27
  import TimelineItemComponent from './components/TimelineItem/TimelineItem.tsx'
@@ -28,17 +34,23 @@ export const Badge = BadgeComponent
28
34
  export const Button = ButtonComponent
29
35
  export const Card = CardComponent
30
36
  export const Checkbox = CheckboxComponent
37
+ export const Collapsible = CollapsibleComponent
31
38
  export const ConditionalWrapper = ConditionalWrapperComponent
32
39
  export const Icon = IconComponent
33
40
  export const Input = InputComponent
34
41
  export const Menu = MenuComponent
42
+ export const Modal = ModalComponent
43
+ export const Popover = PopoverComponent
35
44
  export const Progress = ProgressComponent
36
45
  export const Radio = RadioComponent
37
46
  export const Rating = RatingComponent
47
+ export const Sheet = SheetComponent
48
+ export const Slider = SliderComponent
38
49
  export const Spinner = SpinnerComponent
39
50
  export const Switch = SwitchComponent
40
51
  export const Table = TableComponent
41
52
  export const Tabs = TabsComponent
53
+ export const Textarea = TextareaComponent
42
54
  export const ThemeSwitcher = ThemeSwitcherComponent
43
55
  export const Timeline = TimelineComponent
44
56
  export const TimelineItem = TimelineItemComponent
@@ -20,4 +20,5 @@ $colorPalette: (
20
20
  'alert': var(--w-color-alert),
21
21
  'alert-accent': var(--w-color-alert-accent),
22
22
  'alert-fg': var(--w-color-alert-fg),
23
+ 'overlay': var(--w-color-overlay)
23
24
  ) !default;