webcoreui 0.0.10 → 0.0.12

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 (123) hide show
  1. package/README.md +35 -7
  2. package/astro.d.ts +8 -0
  3. package/astro.js +8 -0
  4. package/components/Accordion/Accordion.astro +10 -8
  5. package/components/Accordion/Accordion.svelte +8 -8
  6. package/components/Accordion/Accordion.tsx +7 -6
  7. package/components/Accordion/{accordion.scss → accordion.module.scss} +18 -10
  8. package/components/Alert/Alert.astro +11 -7
  9. package/components/Alert/Alert.svelte +9 -7
  10. package/components/Alert/Alert.tsx +11 -7
  11. package/components/Alert/alert.module.scss +54 -0
  12. package/components/Alert/alert.ts +3 -1
  13. package/components/Avatar/Avatar.astro +4 -4
  14. package/components/Avatar/Avatar.svelte +13 -7
  15. package/components/Avatar/Avatar.tsx +11 -9
  16. package/components/Avatar/{avatar.scss → avatar.module.scss} +2 -2
  17. package/components/Badge/Badge.astro +8 -8
  18. package/components/Badge/Badge.svelte +25 -13
  19. package/components/Badge/Badge.tsx +26 -8
  20. package/components/Badge/badge.module.scss +89 -0
  21. package/components/Badge/badge.ts +8 -1
  22. package/components/Button/Button.astro +10 -6
  23. package/components/Button/Button.svelte +15 -11
  24. package/components/Button/Button.tsx +11 -7
  25. package/components/Button/button.module.scss +94 -0
  26. package/components/Button/button.ts +6 -1
  27. package/components/Card/Card.astro +7 -15
  28. package/components/Card/Card.svelte +16 -13
  29. package/components/Card/Card.tsx +15 -11
  30. package/components/Card/card.module.scss +33 -0
  31. package/components/Checkbox/Checkbox.astro +10 -10
  32. package/components/Checkbox/Checkbox.svelte +19 -18
  33. package/components/Checkbox/Checkbox.tsx +12 -11
  34. package/components/Checkbox/{checkbox.scss → checkbox.module.scss} +16 -17
  35. package/components/Checkbox/checkbox.ts +5 -1
  36. package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
  37. package/components/Icon/Icon.svelte +1 -8
  38. package/components/Icon/Icon.tsx +1 -8
  39. package/components/Icon/map.ts +23 -0
  40. package/components/Input/Input.astro +50 -0
  41. package/components/Input/Input.svelte +52 -0
  42. package/components/Input/Input.tsx +59 -0
  43. package/components/Input/input.module.scss +87 -0
  44. package/components/Input/input.ts +50 -0
  45. package/components/Menu/Menu.astro +107 -0
  46. package/components/Menu/Menu.svelte +88 -0
  47. package/components/Menu/Menu.tsx +107 -0
  48. package/components/Menu/menu.module.scss +144 -0
  49. package/components/Menu/menu.ts +21 -0
  50. package/components/Progress/Progress.astro +42 -40
  51. package/components/Progress/Progress.svelte +40 -38
  52. package/components/Progress/Progress.tsx +48 -47
  53. package/components/Progress/{progress.scss → progress.module.scss} +66 -66
  54. package/components/Radio/Radio.astro +57 -57
  55. package/components/Radio/Radio.svelte +58 -56
  56. package/components/Radio/Radio.tsx +69 -68
  57. package/components/Radio/{radio.scss → radio.module.scss} +92 -92
  58. package/components/Radio/radio.ts +4 -0
  59. package/components/Rating/Rating.astro +13 -10
  60. package/components/Rating/Rating.svelte +15 -15
  61. package/components/Rating/Rating.tsx +22 -11
  62. package/components/Rating/{rating.scss → rating.module.scss} +10 -9
  63. package/components/Rating/rating.ts +1 -1
  64. package/components/Spinner/Spinner.astro +44 -42
  65. package/components/Spinner/Spinner.svelte +40 -38
  66. package/components/Spinner/Spinner.tsx +45 -44
  67. package/components/Spinner/{spinner.scss → spinner.module.scss} +41 -41
  68. package/components/Switch/Switch.astro +13 -11
  69. package/components/Switch/Switch.svelte +26 -24
  70. package/components/Switch/Switch.tsx +14 -12
  71. package/components/Switch/{switch.scss → switch.module.scss} +4 -4
  72. package/components/Switch/switch.ts +8 -4
  73. package/components/Table/Table.astro +60 -0
  74. package/components/Table/Table.svelte +56 -0
  75. package/components/Table/Table.tsx +64 -0
  76. package/components/Table/table.module.scss +64 -0
  77. package/components/Table/table.ts +10 -0
  78. package/components/Tabs/Tabs.astro +77 -76
  79. package/components/Tabs/Tabs.svelte +56 -54
  80. package/components/Tabs/Tabs.tsx +70 -69
  81. package/components/Tabs/{tabs.scss → tabs.module.scss} +30 -31
  82. package/components/ThemeSwitcher/ThemeSwitcher.astro +106 -0
  83. package/components/ThemeSwitcher/ThemeSwitcher.svelte +76 -0
  84. package/components/ThemeSwitcher/ThemeSwitcher.tsx +89 -0
  85. package/components/ThemeSwitcher/themeswitcher.module.scss +74 -0
  86. package/components/ThemeSwitcher/themeswitcher.ts +13 -0
  87. package/components/Timeline/Timeline.astro +36 -34
  88. package/components/Timeline/Timeline.svelte +32 -30
  89. package/components/Timeline/Timeline.tsx +38 -37
  90. package/components/Timeline/{timeline.scss → timeline.module.scss} +71 -71
  91. package/components/TimelineItem/TimelineItem.astro +27 -26
  92. package/components/TimelineItem/TimelineItem.svelte +24 -22
  93. package/components/TimelineItem/TimelineItem.tsx +33 -32
  94. package/components/TimelineItem/{timelineitem.scss → timelineitem.module.scss} +31 -31
  95. package/components/Toast/Toast.astro +41 -30
  96. package/components/Toast/Toast.svelte +32 -21
  97. package/components/Toast/Toast.tsx +38 -28
  98. package/components/Toast/{toast.scss → toast.module.scss} +44 -43
  99. package/components/Toast/toast.ts +3 -6
  100. package/icons/moon.svg +3 -0
  101. package/icons/sun.svg +3 -0
  102. package/index.js +3 -0
  103. package/package.json +3 -1
  104. package/react.d.ts +8 -0
  105. package/react.js +8 -0
  106. package/scss/global/elements.scss +1 -1
  107. package/scss/global/scrollbar.scss +21 -0
  108. package/scss/global/theme.scss +140 -0
  109. package/scss/global/tooltip.scss +8 -5
  110. package/scss/global/utility.scss +29 -0
  111. package/scss/global.scss +2 -0
  112. package/scss/resets.scss +5 -5
  113. package/scss/setup.scss +39 -18
  114. package/svelte.d.ts +18 -10
  115. package/svelte.js +8 -0
  116. package/utils/classNames.ts +4 -0
  117. package/utils/cookies.ts +28 -0
  118. package/utils/event.ts +17 -0
  119. package/utils/toast.ts +12 -9
  120. package/components/Alert/alert.scss +0 -53
  121. package/components/Badge/badge.scss +0 -85
  122. package/components/Button/button.scss +0 -91
  123. package/components/Card/card.scss +0 -37
@@ -1,47 +1,48 @@
1
- import React from 'react'
2
- import type { ProgressProps } from './progress'
3
-
4
- import './progress.scss'
5
-
6
- const Progress = ({
7
- value,
8
- size,
9
- label,
10
- color,
11
- background,
12
- square,
13
- striped,
14
- stripeLight,
15
- stripeDark,
16
- className
17
- }: ProgressProps) => {
18
- const classes = [
19
- 'w-progress',
20
- size,
21
- striped && 'striped',
22
- square && 'square',
23
- className
24
- ].filter(Boolean).join(' ')
25
-
26
- const styles = {
27
- ...(color && { '--w-progress-color': color }),
28
- ...(background && { '--w-progress-background': background }),
29
- ...(stripeLight && { '--w-progress-stripe-light': stripeLight }),
30
- ...(stripeDark && { '--w-progress-stripe-dark': stripeDark }),
31
- } as React.CSSProperties
32
-
33
- const percent = {
34
- '--w-progress-width': `${value}%`
35
- } as React.CSSProperties
36
-
37
- return (
38
- <div className={classes} style={styles}>
39
- <div className="progress" style={percent}>
40
- {label && `${value}%`}
41
- </div>
42
- </div>
43
- )
44
- }
45
-
46
- export default Progress
47
-
1
+ import React from 'react'
2
+ import type { ProgressProps } from './progress'
3
+
4
+ import styles from './progress.module.scss'
5
+ import { classNames } from '../../utils/classNames'
6
+
7
+ const Progress = ({
8
+ value,
9
+ size,
10
+ label,
11
+ color,
12
+ background,
13
+ square,
14
+ striped,
15
+ stripeLight,
16
+ stripeDark,
17
+ className
18
+ }: ProgressProps) => {
19
+ const classes = classNames([
20
+ styles['w-progress'],
21
+ size && styles[size],
22
+ striped && styles.striped,
23
+ square && styles.square,
24
+ className
25
+ ])
26
+
27
+ const styleVariables = {
28
+ ...(color && { '--w-progress-color': color }),
29
+ ...(background && { '--w-progress-background': background }),
30
+ ...(stripeLight && { '--w-progress-stripe-light': stripeLight }),
31
+ ...(stripeDark && { '--w-progress-stripe-dark': stripeDark }),
32
+ } as React.CSSProperties
33
+
34
+ const percent = {
35
+ '--w-progress-width': `${value}%`
36
+ } as React.CSSProperties
37
+
38
+ return (
39
+ <div className={classes} style={styleVariables}>
40
+ <div className={styles.progress} style={percent}>
41
+ {label && `${value}%`}
42
+ </div>
43
+ </div>
44
+ )
45
+ }
46
+
47
+ export default Progress
48
+
@@ -1,66 +1,66 @@
1
- @import '../../scss/config.scss';
2
-
3
- .w-progress {
4
- width: 100%;
5
- height: 10px;
6
- background: var(--w-progress-background);
7
- border-radius: 20px;
8
- overflow: hidden;
9
- color: var(--w-progress-background);
10
- font-family: Bold;
11
- font-size: 10px;
12
-
13
- &.medium {
14
- height: 15px;
15
- font-size: 12px;
16
- }
17
-
18
- &.large {
19
- height: 20px;
20
- font-size: 14px;
21
- }
22
-
23
- &.square {
24
- border-radius: 2px;
25
-
26
- .progress {
27
- border-radius: 2px;
28
- }
29
- }
30
-
31
- &.striped {
32
-
33
- .progress {
34
- background-size: 10px 10px;
35
- background-image: linear-gradient(
36
- -45deg,
37
- var(--w-progress-stripe-light) 25%,
38
- var(--w-progress-stripe-dark) 25%,
39
- var(--w-progress-stripe-dark) 50%,
40
- var(--w-progress-stripe-light) 50%,
41
- var(--w-progress-stripe-light) 75%,
42
- var(--w-progress-stripe-dark) 75%,
43
- var(--w-progress-stripe-dark)
44
- );
45
- }
46
-
47
- &.medium .progress {
48
- background-size: 15px 15px;
49
- }
50
-
51
- &.large .progress {
52
- background-size: 20px 20px;
53
- }
54
- }
55
-
56
- .progress {
57
- @include Transition(width);
58
- width: var(--w-progress-width);
59
- height: 100%;
60
- background: var(--w-progress-color);
61
- border-radius: 20px;
62
- display: flex;
63
- align-items: center;
64
- justify-content: center;
65
- }
66
- }
1
+ @import '../../scss/config.scss';
2
+
3
+ .w-progress {
4
+ width: 100%;
5
+ height: 10px;
6
+ background: var(--w-progress-background);
7
+ border-radius: 20px;
8
+ overflow: hidden;
9
+ color: var(--w-progress-background);
10
+ font-family: Bold;
11
+ font-size: 10px;
12
+
13
+ &.medium {
14
+ height: 15px;
15
+ font-size: 12px;
16
+ }
17
+
18
+ &.large {
19
+ height: 20px;
20
+ font-size: 14px;
21
+ }
22
+
23
+ &.square {
24
+ border-radius: 2px;
25
+
26
+ .progress {
27
+ border-radius: 2px;
28
+ }
29
+ }
30
+
31
+ &.striped {
32
+
33
+ .progress {
34
+ background-size: 10px 10px;
35
+ background-image: linear-gradient(
36
+ -45deg,
37
+ var(--w-progress-stripe-light) 25%,
38
+ var(--w-progress-stripe-dark) 25%,
39
+ var(--w-progress-stripe-dark) 50%,
40
+ var(--w-progress-stripe-light) 50%,
41
+ var(--w-progress-stripe-light) 75%,
42
+ var(--w-progress-stripe-dark) 75%,
43
+ var(--w-progress-stripe-dark)
44
+ );
45
+ }
46
+
47
+ &.medium .progress {
48
+ background-size: 15px 15px;
49
+ }
50
+
51
+ &.large .progress {
52
+ background-size: 20px 20px;
53
+ }
54
+ }
55
+
56
+ .progress {
57
+ @include Transition(width);
58
+ width: var(--w-progress-width);
59
+ height: 100%;
60
+ background: var(--w-progress-color);
61
+ border-radius: 20px;
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ }
66
+ }
@@ -1,57 +1,57 @@
1
- ---
2
- import type { RadioProps } from './radio'
3
- import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
4
-
5
- import './radio.scss'
6
-
7
- interface Props extends RadioProps {}
8
-
9
- const {
10
- name,
11
- items,
12
- color,
13
- inline,
14
- className
15
- } = Astro.props
16
-
17
- const classes = [
18
- 'w-radio',
19
- inline && 'inline',
20
- className
21
- ]
22
-
23
- const style = color
24
- ? `--w-radio-color: ${color};`
25
- : null
26
- ---
27
-
28
- <div class:list={classes} style={style}>
29
- {items.map(item => (
30
- <label class:list={[
31
- item.subText && 'col',
32
- item.disabled && 'disabled'
33
- ]}>
34
- <ConditionalWrapper condition={!!(item.subText)}>
35
- <div class="radio-wrapper" slot="wrapper">
36
- children
37
- </div>
38
- <input
39
- type="radio"
40
- name={name}
41
- value={item.value}
42
- checked={item.selected}
43
- disabled={item.disabled}
44
- />
45
- <span class="radio" />
46
- <span class="label">
47
- <Fragment set:html={item.label} />
48
- </span>
49
- </ConditionalWrapper>
50
- {item.subText && (
51
- <span class="sub-text">
52
- <Fragment set:html={item.subText} />
53
- </span>
54
- )}
55
- </label>
56
- ))}
57
- </div>
1
+ ---
2
+ import type { RadioProps } from './radio'
3
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
4
+
5
+ import styles from './radio.module.scss'
6
+
7
+ interface Props extends RadioProps {}
8
+
9
+ const {
10
+ name,
11
+ items,
12
+ color,
13
+ inline,
14
+ className
15
+ } = Astro.props
16
+
17
+ const classes = [
18
+ styles.radio,
19
+ inline && styles.inline,
20
+ className
21
+ ]
22
+
23
+ const style = color
24
+ ? `--w-radio-color: ${color};`
25
+ : null
26
+ ---
27
+
28
+ <div class:list={classes} style={style}>
29
+ {items.map(item => (
30
+ <label class:list={[
31
+ item.subText && styles.col,
32
+ item.disabled && styles.disabled
33
+ ]}>
34
+ <ConditionalWrapper condition={!!(item.subText)}>
35
+ <div class={styles.wrapper} slot="wrapper">
36
+ children
37
+ </div>
38
+ <input
39
+ type="radio"
40
+ name={name}
41
+ value={item.value}
42
+ checked={item.selected}
43
+ disabled={item.disabled}
44
+ />
45
+ <span class={styles.icon} />
46
+ <span class={styles.label}>
47
+ <Fragment set:html={item.label} />
48
+ </span>
49
+ </ConditionalWrapper>
50
+ {item.subText && (
51
+ <span class={styles.subtext}>
52
+ <Fragment set:html={item.subText} />
53
+ </span>
54
+ )}
55
+ </label>
56
+ ))}
57
+ </div>
@@ -1,56 +1,58 @@
1
- <script lang="ts">
2
- import type { RadioProps } from './radio'
3
- import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
4
-
5
- import './radio.scss'
6
-
7
- export let name: RadioProps['name'] = ''
8
- export let items: RadioProps['items'] = []
9
- export let color: RadioProps['color'] = ''
10
- export let inline: RadioProps['inline'] = false
11
- export let className: RadioProps['className'] = ''
12
- export let onChange: () => any = () => {}
13
-
14
- const classes = [
15
- 'w-radio',
16
- inline && 'inline',
17
- className
18
- ].filter(Boolean).join(' ')
19
-
20
- const style = color
21
- ? `--w-radio-color: ${color};`
22
- : null
23
- </script>
24
-
25
- <div class={classes} style={style}>
26
- {#each items as item}
27
- <label
28
- class:col={item.subText}
29
- class:disabled={item.disabled}
30
- >
31
- <ConditionalWrapper
32
- condition={!!(item.subText)}
33
- element="div"
34
- class="radio-wrapper"
35
- >
36
- <input
37
- type="radio"
38
- name={name}
39
- value={item.value}
40
- checked={item.selected}
41
- disabled={item.disabled}
42
- on:change={onChange}
43
- />
44
- <span class="radio" />
45
- <span class="label">
46
- {@html item.label}
47
- </span>
48
- </ConditionalWrapper>
49
- {#if item.subText}
50
- <span class="sub-text">
51
- {@html item.subText}
52
- </span>
53
- {/if}
54
- </label>
55
- {/each}
56
- </div>
1
+ <script lang="ts">
2
+ import type { SvelteRadioProps } from './radio'
3
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
4
+
5
+ import styles from './radio.module.scss'
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ export let name: SvelteRadioProps['name'] = ''
9
+ export let items: SvelteRadioProps['items'] = []
10
+ export let color: SvelteRadioProps['color'] = ''
11
+ export let inline: SvelteRadioProps['inline'] = false
12
+ export let className: SvelteRadioProps['className'] = ''
13
+ export let onChange: SvelteRadioProps['onChange'] = () => {}
14
+
15
+ const classes = classNames([
16
+ styles.radio,
17
+ inline && styles.inline,
18
+ className
19
+ ])
20
+
21
+ const style = color
22
+ ? `--w-radio-color: ${color};`
23
+ : null
24
+ </script>
25
+
26
+ <div class={classes} style={style}>
27
+ {#each items as item}
28
+ <label class={[
29
+ item.subText && styles.col,
30
+ item.disabled && styles.disabled
31
+ ].filter(Boolean).join(' ')}
32
+ >
33
+ <ConditionalWrapper
34
+ condition={!!(item.subText)}
35
+ element="div"
36
+ class={styles.wrapper}
37
+ >
38
+ <input
39
+ type="radio"
40
+ name={name}
41
+ value={item.value}
42
+ checked={item.selected}
43
+ disabled={item.disabled}
44
+ on:change={onChange}
45
+ />
46
+ <span class={styles.icon} />
47
+ <span class={styles.label}>
48
+ {@html item.label}
49
+ </span>
50
+ </ConditionalWrapper>
51
+ {#if item.subText}
52
+ <span class={styles.subtext}>
53
+ {@html item.subText}
54
+ </span>
55
+ {/if}
56
+ </label>
57
+ {/each}
58
+ </div>
@@ -1,68 +1,69 @@
1
- import React from 'react'
2
- import type { ReactRadioProps } from './radio'
3
-
4
- import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
5
-
6
- import './radio.scss'
7
-
8
- const Radio = ({
9
- name,
10
- items,
11
- color,
12
- inline,
13
- className,
14
- onChange
15
- }: ReactRadioProps) => {
16
- const classes = [
17
- 'w-radio',
18
- inline && 'inline',
19
- className
20
- ].filter(Boolean).join(' ')
21
-
22
- const style = color
23
- ? { '--w-radio-color': color } as React.CSSProperties
24
- : undefined
25
-
26
- return (
27
- <div className={classes} style={style}>
28
- {items.map((item, index) => (
29
- <label className={[
30
- item.subText && 'col',
31
- item.disabled && 'disabled'
32
- ].filter(Boolean).join(' ')} key={index}>
33
- <ConditionalWrapper
34
- condition={!!(item.subText)}
35
- wrapper={children => (
36
- <div className="radio-wrapper">
37
- {children}
38
- </div>
39
- )}
40
- >
41
- <input
42
- type="radio"
43
- name={name}
44
- value={item.value}
45
- defaultChecked={item.selected}
46
- disabled={item.disabled}
47
- onChange={onChange}
48
- />
49
- <span className="radio" />
50
- <span
51
- className="label"
52
- dangerouslySetInnerHTML={{ __html: item.label }}
53
- />
54
- </ConditionalWrapper>
55
- {item.subText && (
56
- <span
57
- className="sub-text"
58
- dangerouslySetInnerHTML={{ __html: item.subText }}
59
- />
60
- )}
61
- </label>
62
- ))}
63
- </div>
64
- )
65
- }
66
-
67
- export default Radio
68
-
1
+ import React from 'react'
2
+ import type { ReactRadioProps } from './radio'
3
+
4
+ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
5
+
6
+ import styles from './radio.module.scss'
7
+ import { classNames } from '../../utils/classNames'
8
+
9
+ const Radio = ({
10
+ name,
11
+ items,
12
+ color,
13
+ inline,
14
+ className,
15
+ onChange
16
+ }: ReactRadioProps) => {
17
+ const classes = classNames([
18
+ styles.radio,
19
+ inline && styles.inline,
20
+ className
21
+ ])
22
+
23
+ const style = color
24
+ ? { '--w-radio-color': color } as React.CSSProperties
25
+ : undefined
26
+
27
+ return (
28
+ <div className={classes} style={style}>
29
+ {items.map((item, index) => (
30
+ <label className={[
31
+ item.subText && styles.col,
32
+ item.disabled && styles.disabled
33
+ ].filter(Boolean).join(' ')} key={index}>
34
+ <ConditionalWrapper
35
+ condition={!!(item.subText)}
36
+ wrapper={children => (
37
+ <div className={styles.wrapper}>
38
+ {children}
39
+ </div>
40
+ )}
41
+ >
42
+ <input
43
+ type="radio"
44
+ name={name}
45
+ value={item.value}
46
+ defaultChecked={item.selected}
47
+ disabled={item.disabled}
48
+ onChange={onChange}
49
+ />
50
+ <span className={styles.icon} />
51
+ <span
52
+ className={styles.label}
53
+ dangerouslySetInnerHTML={{ __html: item.label }}
54
+ />
55
+ </ConditionalWrapper>
56
+ {item.subText && (
57
+ <span
58
+ className={styles.subtext}
59
+ dangerouslySetInnerHTML={{ __html: item.subText }}
60
+ />
61
+ )}
62
+ </label>
63
+ ))}
64
+ </div>
65
+ )
66
+ }
67
+
68
+ export default Radio
69
+