webcoreui 0.3.0 → 0.4.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 (127) hide show
  1. package/README.md +5 -2
  2. package/astro.d.ts +7 -1
  3. package/astro.js +6 -0
  4. package/components/Accordion/Accordion.astro +2 -0
  5. package/components/Accordion/Accordion.svelte +2 -0
  6. package/components/Accordion/Accordion.tsx +2 -0
  7. package/components/Alert/Alert.astro +3 -2
  8. package/components/Alert/Alert.svelte +4 -3
  9. package/components/Alert/Alert.tsx +3 -2
  10. package/components/Avatar/Avatar.astro +2 -1
  11. package/components/Avatar/Avatar.svelte +2 -1
  12. package/components/Avatar/Avatar.tsx +3 -3
  13. package/components/Badge/Badge.astro +1 -0
  14. package/components/Badge/Badge.svelte +3 -2
  15. package/components/Badge/Badge.tsx +2 -1
  16. package/components/Button/Button.astro +4 -5
  17. package/components/Button/Button.svelte +2 -1
  18. package/components/Button/Button.tsx +2 -1
  19. package/components/Button/button.ts +1 -1
  20. package/components/Card/Card.astro +11 -3
  21. package/components/Card/Card.svelte +5 -2
  22. package/components/Card/Card.tsx +5 -2
  23. package/components/Card/card.ts +1 -0
  24. package/components/Checkbox/Checkbox.astro +1 -0
  25. package/components/Checkbox/Checkbox.svelte +7 -5
  26. package/components/Checkbox/Checkbox.tsx +4 -2
  27. package/components/Collapsible/Collapsible.astro +2 -1
  28. package/components/Collapsible/Collapsible.svelte +2 -1
  29. package/components/Collapsible/Collapsible.tsx +55 -54
  30. package/components/ConditionalWrapper/ConditionalWrapper.astro +2 -1
  31. package/components/ConditionalWrapper/ConditionalWrapper.tsx +1 -2
  32. package/components/Group/Group.astro +22 -0
  33. package/components/Group/Group.svelte +20 -0
  34. package/components/Group/Group.tsx +22 -0
  35. package/components/Group/group.module.scss +43 -0
  36. package/components/Group/group.ts +8 -0
  37. package/components/Icon/map.ts +2 -0
  38. package/components/Input/Input.astro +8 -1
  39. package/components/Input/Input.svelte +15 -3
  40. package/components/Input/Input.tsx +10 -3
  41. package/components/Input/input.module.scss +4 -1
  42. package/components/Input/input.ts +9 -4
  43. package/components/List/List.astro +169 -0
  44. package/components/List/List.svelte +147 -0
  45. package/components/List/List.tsx +168 -0
  46. package/components/List/list.module.scss +91 -0
  47. package/components/List/list.ts +37 -0
  48. package/components/Menu/Menu.astro +2 -1
  49. package/components/Menu/Menu.svelte +7 -5
  50. package/components/Menu/Menu.tsx +116 -113
  51. package/components/Modal/Modal.astro +6 -4
  52. package/components/Modal/Modal.svelte +8 -6
  53. package/components/Modal/Modal.tsx +79 -76
  54. package/components/Modal/modal.ts +1 -0
  55. package/components/Popover/Popover.astro +4 -1
  56. package/components/Popover/Popover.svelte +4 -2
  57. package/components/Popover/Popover.tsx +55 -27
  58. package/components/Popover/popover.module.scss +1 -0
  59. package/components/Popover/popover.ts +2 -0
  60. package/components/Progress/Progress.astro +2 -1
  61. package/components/Progress/Progress.svelte +2 -1
  62. package/components/Progress/Progress.tsx +3 -2
  63. package/components/Radio/Radio.astro +1 -0
  64. package/components/Radio/Radio.svelte +4 -2
  65. package/components/Radio/Radio.tsx +3 -2
  66. package/components/Rating/Rating.astro +3 -1
  67. package/components/Rating/Rating.svelte +9 -7
  68. package/components/Rating/Rating.tsx +4 -2
  69. package/components/Select/Select.astro +135 -0
  70. package/components/Select/Select.svelte +122 -0
  71. package/components/Select/Select.tsx +142 -0
  72. package/components/Select/select.module.scss +25 -0
  73. package/components/Select/select.ts +21 -0
  74. package/components/Sheet/Sheet.astro +2 -1
  75. package/components/Sheet/Sheet.svelte +2 -1
  76. package/components/Sheet/Sheet.tsx +33 -32
  77. package/components/Slider/Slider.astro +2 -1
  78. package/components/Slider/Slider.svelte +2 -1
  79. package/components/Slider/Slider.tsx +49 -48
  80. package/components/Spinner/Spinner.astro +4 -3
  81. package/components/Spinner/Spinner.svelte +3 -2
  82. package/components/Spinner/Spinner.tsx +4 -3
  83. package/components/Switch/Switch.astro +2 -1
  84. package/components/Switch/Switch.svelte +5 -4
  85. package/components/Switch/Switch.tsx +2 -2
  86. package/components/Switch/switch.module.scss +1 -1
  87. package/components/Table/Table.astro +1 -0
  88. package/components/Table/Table.svelte +2 -1
  89. package/components/Table/Table.tsx +2 -1
  90. package/components/Tabs/Tabs.astro +2 -1
  91. package/components/Tabs/Tabs.svelte +2 -1
  92. package/components/Tabs/Tabs.tsx +4 -3
  93. package/components/Textarea/Textarea.astro +1 -0
  94. package/components/Textarea/Textarea.svelte +3 -1
  95. package/components/Textarea/Textarea.tsx +52 -50
  96. package/components/ThemeSwitcher/ThemeSwitcher.astro +108 -107
  97. package/components/ThemeSwitcher/ThemeSwitcher.svelte +5 -4
  98. package/components/ThemeSwitcher/ThemeSwitcher.tsx +91 -90
  99. package/components/Timeline/Timeline.astro +3 -2
  100. package/components/Timeline/Timeline.svelte +3 -2
  101. package/components/Timeline/Timeline.tsx +3 -2
  102. package/components/TimelineItem/TimelineItem.svelte +2 -1
  103. package/components/TimelineItem/TimelineItem.tsx +2 -1
  104. package/components/Toast/Toast.astro +3 -1
  105. package/components/Toast/Toast.svelte +3 -1
  106. package/components/Toast/Toast.tsx +3 -1
  107. package/icons/moon.svg +1 -1
  108. package/icons/search.svg +3 -0
  109. package/icons.d.ts +1 -0
  110. package/icons.js +1 -0
  111. package/index.d.ts +55 -25
  112. package/package.json +22 -2
  113. package/react.d.ts +6 -0
  114. package/react.js +6 -0
  115. package/scss/config/mixins.scss +12 -10
  116. package/scss/config/variables.scss +1 -0
  117. package/scss/config.scss +1 -0
  118. package/scss/global/utility.scss +2 -0
  119. package/svelte.d.ts +7 -1
  120. package/svelte.js +6 -0
  121. package/utils/cookies.ts +4 -4
  122. package/utils/debounce.ts +1 -1
  123. package/utils/event.ts +2 -2
  124. package/utils/interpolate.ts +5 -5
  125. package/utils/modal.ts +90 -27
  126. package/utils/popover.ts +30 -8
  127. package/utils/toast.ts +6 -2
@@ -1,9 +1,10 @@
1
1
  <script lang="ts">
2
2
  import type { SvelteSliderProps } from './slider'
3
3
 
4
- import styles from './slider.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './slider.module.scss'
7
+
7
8
  export let min: SvelteSliderProps['min'] = 0
8
9
  export let max: SvelteSliderProps['max'] = 100
9
10
  export let value: SvelteSliderProps['value'] = 0
@@ -1,48 +1,49 @@
1
- import React from 'react'
2
- import type { ReactSliderProps } from './slider'
3
-
4
- import styles from './slider.module.scss'
5
- import { classNames } from '../../utils/classNames'
6
-
7
- const Slider = ({
8
- min,
9
- max,
10
- value,
11
- step,
12
- disabled,
13
- color,
14
- background,
15
- thumb,
16
- id,
17
- className,
18
- onChange
19
- }: ReactSliderProps) => {
20
- const classes = classNames([
21
- styles.slider,
22
- className
23
- ])
24
-
25
- const styleVariables = {
26
- ...(color && { '--w-slider-color': color }),
27
- ...(background && { '--w-slider-background': background }),
28
- ...(thumb && { '--w-slider-thumb': thumb })
29
- } as React.CSSProperties
30
-
31
- return (
32
- <input
33
- type="range"
34
- min={min}
35
- max={max}
36
- defaultValue={value || min}
37
- step={step}
38
- disabled={disabled}
39
- className={classes}
40
- id={id}
41
- style={styleVariables}
42
- onChange={onChange}
43
- />
44
-
45
- )
46
- }
47
-
48
- export default Slider
1
+ import React from 'react'
2
+ import type { ReactSliderProps } from './slider'
3
+
4
+ import { classNames } from '../../utils/classNames'
5
+
6
+ import styles from './slider.module.scss'
7
+
8
+ const Slider = ({
9
+ min,
10
+ max,
11
+ value,
12
+ step,
13
+ disabled,
14
+ color,
15
+ background,
16
+ thumb,
17
+ id,
18
+ className,
19
+ onChange
20
+ }: ReactSliderProps) => {
21
+ const classes = classNames([
22
+ styles.slider,
23
+ className
24
+ ])
25
+
26
+ const styleVariables = {
27
+ ...(color && { '--w-slider-color': color }),
28
+ ...(background && { '--w-slider-background': background }),
29
+ ...(thumb && { '--w-slider-thumb': thumb })
30
+ } as React.CSSProperties
31
+
32
+ return (
33
+ <input
34
+ type="range"
35
+ min={min}
36
+ max={max}
37
+ defaultValue={value || min}
38
+ step={step}
39
+ disabled={disabled}
40
+ className={classes}
41
+ id={id}
42
+ style={styleVariables}
43
+ onChange={onChange}
44
+ />
45
+
46
+ )
47
+ }
48
+
49
+ export default Slider
@@ -1,9 +1,10 @@
1
1
  ---
2
2
  import type { SpinnerProps } from './spinner'
3
3
 
4
- import styles from './spinner.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './spinner.module.scss'
7
+
7
8
  interface Props extends SpinnerProps {}
8
9
 
9
10
  const {
@@ -11,7 +12,7 @@ const {
11
12
  width,
12
13
  speed,
13
14
  size,
14
- dashArray,
15
+ dashArray
15
16
  } = Astro.props
16
17
 
17
18
  const classes = [
@@ -24,7 +25,7 @@ const styleVariables = classNames([
24
25
  width && `--w-spinner-width: ${width}px;`,
25
26
  speed && `--w-spinner-speed: ${speed}s;`,
26
27
  size && `--w-spinner-size: ${size}px;`,
27
- dashArray && `--w-spinner-dash: ${dashArray}`,
28
+ dashArray && `--w-spinner-dash: ${dashArray}`
28
29
  ])
29
30
  ---
30
31
 
@@ -1,9 +1,10 @@
1
1
  <script lang="ts">
2
2
  import type { SpinnerProps } from './spinner'
3
3
 
4
- import styles from './spinner.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './spinner.module.scss'
7
+
7
8
  export let color: SpinnerProps['color'] = ''
8
9
  export let width: SpinnerProps['width'] = 0
9
10
  export let speed: SpinnerProps['speed'] = 0
@@ -20,7 +21,7 @@
20
21
  width && `--w-spinner-width: ${width}px;`,
21
22
  speed && `--w-spinner-speed: ${speed}s;`,
22
23
  size && `--w-spinner-size: ${size}px;`,
23
- dashArray && `--w-spinner-dash: ${dashArray}`,
24
+ dashArray && `--w-spinner-dash: ${dashArray}`
24
25
  ])
25
26
  </script>
26
27
 
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
2
  import type { SpinnerProps } from './spinner'
3
3
 
4
- import styles from './spinner.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './spinner.module.scss'
7
+
7
8
  const Spinner = ({
8
9
  color,
9
10
  width,
@@ -15,13 +16,13 @@ const Spinner = ({
15
16
  styles.spinner,
16
17
  dashArray && styles.dashed
17
18
  ])
18
-
19
+
19
20
  const stylesVariable = {
20
21
  ...(color && { '--w-spinner-color': color }),
21
22
  ...(width && { '--w-spinner-width': `${width}px;` }),
22
23
  ...(speed && { '--w-spinner-speed': `${speed}s;` }),
23
24
  ...(size && { '--w-spinner-size': `${size}px;` }),
24
- ...(dashArray && { '--w-spinner-dash': dashArray }),
25
+ ...(dashArray && { '--w-spinner-dash': dashArray })
25
26
  } as React.CSSProperties
26
27
 
27
28
  return (
@@ -1,9 +1,10 @@
1
1
  ---
2
2
  import type { SwitchProps } from './switch'
3
3
 
4
- import styles from './switch.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './switch.module.scss'
7
+
7
8
  interface Props extends SwitchProps {}
8
9
 
9
10
  const {
@@ -1,9 +1,10 @@
1
1
  <script lang="ts">
2
2
  import type { SvelteSwitchProps } from './switch'
3
3
 
4
- import styles from './switch.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
-
5
+
6
+ import styles from './switch.module.scss'
7
+
7
8
  export let label: SvelteSwitchProps['label'] = ''
8
9
  export let toggled: SvelteSwitchProps['toggled'] = false
9
10
  export let offColor: SvelteSwitchProps['offColor'] = ''
@@ -14,7 +15,7 @@
14
15
  export let disabled: SvelteSwitchProps['disabled'] = false
15
16
  export let className: SvelteSwitchProps['className'] = ''
16
17
  export let onClick: SvelteSwitchProps['onClick'] = () => {}
17
-
18
+
18
19
  const classes = classNames([
19
20
  styles.switch,
20
21
  reverse && styles.reverse,
@@ -23,7 +24,7 @@
23
24
  disabled && styles.disabled,
24
25
  className
25
26
  ])
26
-
27
+
27
28
  const styleVariables = classNames([
28
29
  offColor && `--w-switch-off-color: ${offColor};`,
29
30
  onColor && `--w-switch-on-color: ${onColor};`
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
2
  import type { ReactSwitchProps } from './switch'
3
3
 
4
- import styles from './switch.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './switch.module.scss'
7
+
7
8
  const Switch = ({
8
9
  label,
9
10
  toggled,
@@ -42,7 +43,6 @@ const Switch = ({
42
43
  {label && <span className={styles.label}>{label}</span>}
43
44
  </label>
44
45
  )
45
-
46
46
  }
47
47
 
48
48
  export default Switch
@@ -68,13 +68,13 @@ body {
68
68
  @include background(var(--w-switch-off-color));
69
69
 
70
70
  &::before {
71
+ @include transition(transform);
71
72
  @include position(absolute, l3px, b3px);
72
73
  @include size(24px);
73
74
  @include border-radius(max);
74
75
  @include background(primary-70);
75
76
 
76
77
  content: '';
77
- transition: 0.3s;
78
78
  }
79
79
  }
80
80
  }
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { TableProps } from './table'
3
+
3
4
  import styles from './table.module.scss'
4
5
 
5
6
  interface Props extends TableProps {}
@@ -1,9 +1,10 @@
1
1
  <script lang="ts">
2
2
  import type { TableProps } from './table'
3
3
 
4
- import styles from './table.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './table.module.scss'
7
+
7
8
  export let headings: TableProps['headings'] = []
8
9
  export let footer: TableProps['footer'] = []
9
10
  export let data: TableProps['data'] = []
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
2
  import type { TableProps } from './table'
3
3
 
4
- import styles from './table.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './table.module.scss'
7
+
7
8
  const Table = ({
8
9
  headings,
9
10
  footer,
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { TabsProps } from './tabs'
3
+
3
4
  import styles from './tabs.module.scss'
4
5
 
5
6
  interface Props extends TabsProps {}
@@ -59,7 +60,7 @@ const classes = [
59
60
  } else {
60
61
  element.dataset.active = false
61
62
  }
62
- })
63
+ })
63
64
 
64
65
  const tabs = target.parentElement?.querySelectorAll('button') as NodeListOf<HTMLButtonElement>
65
66
 
@@ -1,9 +1,10 @@
1
1
  <script lang="ts">
2
2
  import type { TabsProps } from './tabs'
3
3
 
4
- import styles from './tabs.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './tabs.module.scss'
7
+
7
8
  export let items: TabsProps['items'] = []
8
9
  export let theme: TabsProps['theme'] = null
9
10
  export let vertical: TabsProps['vertical'] = false
@@ -1,9 +1,10 @@
1
- import React, { useState, useRef } from 'react'
1
+ import React, { useRef,useState } from 'react'
2
2
  import type { ReactTabsProps } from './tabs'
3
3
 
4
- import styles from './tabs.module.scss'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
6
+ import styles from './tabs.module.scss'
7
+
7
8
  const Tabs = ({
8
9
  items,
9
10
  theme,
@@ -33,7 +34,7 @@ const Tabs = ({
33
34
  item.dataset.active = true
34
35
  }
35
36
  })
36
-
37
+
37
38
  setActive(tab)
38
39
  }
39
40
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { TextareaProps } from './textarea'
3
+
3
4
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
4
5
 
5
6
  import styles from './textarea.module.scss'
@@ -1,10 +1,12 @@
1
1
  <script lang="ts">
2
2
  import type { SvelteTextareaProps } from './textarea'
3
+
3
4
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
4
5
 
5
- import styles from './textarea.module.scss'
6
6
  import { classNames } from '../../utils/classNames'
7
7
 
8
+ import styles from './textarea.module.scss'
9
+
8
10
  export let label: SvelteTextareaProps['label'] = ''
9
11
  export let placeholder: SvelteTextareaProps['placeholder'] = ''
10
12
  export let subText: SvelteTextareaProps['subText'] = ''
@@ -1,50 +1,52 @@
1
- import React from 'react'
2
- import type { ReactTextareaProps } from './textarea'
3
- import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
4
-
5
- import styles from './textarea.module.scss'
6
- import { classNames } from '../../utils/classNames'
7
-
8
- const Textarea = ({
9
- label,
10
- placeholder,
11
- subText,
12
- value = '',
13
- disabled,
14
- className,
15
- ...rest
16
- }: ReactTextareaProps) => {
17
- const classes = classNames([
18
- styles.textarea,
19
- className
20
- ])
21
-
22
- const useLabel = !!(label || subText)
23
-
24
- return (
25
- <ConditionalWrapper condition={useLabel} wrapper={children => (
26
- <label className={styles['label-wrapper']}>
27
- {label && (
28
- <div className={styles.label}>{label}</div>
29
- )}
30
- {children}
31
- {subText && (
32
- <div
33
- className={styles.subtext}
34
- dangerouslySetInnerHTML={{ __html: subText }}
35
- />
36
- )}
37
- </label>
38
- )}>
39
- <textarea
40
- placeholder={placeholder}
41
- disabled={disabled}
42
- className={classes}
43
- defaultValue={value}
44
- {...rest}
45
- />
46
- </ConditionalWrapper>
47
- )
48
- }
49
-
50
- export default Textarea
1
+ import React from 'react'
2
+ import type { ReactTextareaProps } from './textarea'
3
+
4
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import styles from './textarea.module.scss'
9
+
10
+ const Textarea = ({
11
+ label,
12
+ placeholder,
13
+ subText,
14
+ value = '',
15
+ disabled,
16
+ className,
17
+ ...rest
18
+ }: ReactTextareaProps) => {
19
+ const classes = classNames([
20
+ styles.textarea,
21
+ className
22
+ ])
23
+
24
+ const useLabel = !!(label || subText)
25
+
26
+ return (
27
+ <ConditionalWrapper condition={useLabel} wrapper={children => (
28
+ <label className={styles['label-wrapper']}>
29
+ {label && (
30
+ <div className={styles.label}>{label}</div>
31
+ )}
32
+ {children}
33
+ {subText && (
34
+ <div
35
+ className={styles.subtext}
36
+ dangerouslySetInnerHTML={{ __html: subText }}
37
+ />
38
+ )}
39
+ </label>
40
+ )}>
41
+ <textarea
42
+ placeholder={placeholder}
43
+ disabled={disabled}
44
+ className={classes}
45
+ defaultValue={value}
46
+ {...rest}
47
+ />
48
+ </ConditionalWrapper>
49
+ )
50
+ }
51
+
52
+ export default Textarea