webcoreui 0.6.1 → 0.8.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 (85) hide show
  1. package/README.md +46 -7
  2. package/astro.d.ts +21 -0
  3. package/astro.js +14 -0
  4. package/components/Accordion/Accordion.astro +32 -20
  5. package/components/Accordion/Accordion.svelte +22 -4
  6. package/components/Accordion/Accordion.tsx +29 -7
  7. package/components/Accordion/accordion.module.scss +12 -0
  8. package/components/Accordion/accordion.ts +4 -0
  9. package/components/AspectRatio/AspectRatio.astro +21 -0
  10. package/components/AspectRatio/AspectRatio.svelte +19 -0
  11. package/components/AspectRatio/AspectRatio.tsx +28 -0
  12. package/components/AspectRatio/aspect-ratio.module.scss +10 -0
  13. package/components/AspectRatio/aspectratio.ts +8 -0
  14. package/components/Banner/Banner.astro +56 -0
  15. package/components/Banner/Banner.svelte +47 -0
  16. package/components/Banner/Banner.tsx +54 -0
  17. package/components/Banner/banner.module.scss +57 -0
  18. package/components/Banner/banner.ts +12 -0
  19. package/components/Breadcrumb/breadcrumb.module.scss +26 -26
  20. package/components/Button/button.module.scss +4 -0
  21. package/components/Carousel/carousel.module.scss +1 -1
  22. package/components/Collapsible/collapsible.module.scss +29 -29
  23. package/components/ConditionalWrapper/conditionalwrapper.ts +1 -0
  24. package/components/DataTable/datatable.module.scss +102 -102
  25. package/components/Footer/footer.module.scss +61 -61
  26. package/components/Group/group.module.scss +43 -43
  27. package/components/Icon/map.ts +2 -0
  28. package/components/Kbd/Kbd.astro +20 -0
  29. package/components/Kbd/Kbd.svelte +18 -0
  30. package/components/Kbd/Kbd.tsx +27 -0
  31. package/components/Kbd/kbd.module.scss +8 -0
  32. package/components/Kbd/kbd.ts +26 -0
  33. package/components/Kbd/keyMap.ts +21 -0
  34. package/components/List/list.module.scss +91 -91
  35. package/components/Masonry/masonry.module.scss +1 -1
  36. package/components/Modal/modal.module.scss +110 -110
  37. package/components/Pagination/pagination.module.scss +1 -1
  38. package/components/Popover/popover.module.scss +52 -52
  39. package/components/Ribbon/Ribbon.astro +28 -0
  40. package/components/Ribbon/Ribbon.svelte +26 -0
  41. package/components/Ribbon/Ribbon.tsx +33 -0
  42. package/components/Ribbon/ribbon.module.scss +84 -0
  43. package/components/Ribbon/ribbon.ts +16 -0
  44. package/components/Select/select.module.scss +25 -25
  45. package/components/Sheet/sheet.module.scss +68 -68
  46. package/components/Sidebar/sidebar.module.scss +43 -43
  47. package/components/Skeleton/Skeleton.astro +35 -0
  48. package/components/Skeleton/Skeleton.svelte +31 -0
  49. package/components/Skeleton/Skeleton.tsx +34 -0
  50. package/components/Skeleton/skeleton.module.scss +68 -0
  51. package/components/Skeleton/skeleton.ts +9 -0
  52. package/components/Slider/slider.module.scss +68 -68
  53. package/components/Spoiler/Spoiler.astro +50 -0
  54. package/components/Spoiler/Spoiler.svelte +45 -0
  55. package/components/Spoiler/Spoiler.tsx +50 -0
  56. package/components/Spoiler/spoiler.module.scss +40 -0
  57. package/components/Spoiler/spoiler.ts +11 -0
  58. package/components/Stepper/Stepper.astro +61 -0
  59. package/components/Stepper/Stepper.svelte +59 -0
  60. package/components/Stepper/Stepper.tsx +60 -0
  61. package/components/Stepper/stepper.module.scss +102 -0
  62. package/components/Stepper/stepper.ts +17 -0
  63. package/components/Table/Table.tsx +1 -1
  64. package/components/Textarea/textarea.module.scss +36 -36
  65. package/icons/close.svg +1 -1
  66. package/icons/plus.svg +3 -0
  67. package/icons.d.ts +1 -0
  68. package/icons.js +1 -0
  69. package/package.json +5 -5
  70. package/react.d.ts +21 -0
  71. package/react.js +14 -0
  72. package/scss/config/color-palette.scss +2 -0
  73. package/scss/config/css-values.scss +2 -0
  74. package/scss/config/layout.scss +2 -0
  75. package/scss/config/mixins.scss +7 -0
  76. package/scss/config/typography.scss +2 -0
  77. package/scss/config/variables.scss +2 -0
  78. package/scss/config.scss +7 -7
  79. package/scss/global/utility.scss +4 -0
  80. package/scss/global.scss +4 -4
  81. package/scss/index.scss +3 -3
  82. package/scss/resets.scss +10 -5
  83. package/scss/setup.scss +7 -1
  84. package/svelte.d.ts +21 -0
  85. package/svelte.js +14 -0
@@ -0,0 +1,56 @@
1
+ ---
2
+ import type { BannerProps } from './banner'
3
+
4
+ import Button from '../Button/Button.astro'
5
+
6
+ import closeIcon from '../../icons/close.svg?raw'
7
+
8
+ import styles from './banner.module.scss'
9
+
10
+ interface Props extends BannerProps {}
11
+
12
+ const {
13
+ top,
14
+ bottom,
15
+ closeable,
16
+ padded,
17
+ sticky = true,
18
+ className
19
+ } = Astro.props
20
+
21
+ const classes = [
22
+ styles.banner,
23
+ bottom && styles.bottom,
24
+ closeable && styles.closeable,
25
+ padded && styles.padded,
26
+ !sticky && styles.relative,
27
+ className
28
+ ]
29
+
30
+ const style = top
31
+ ? `--w-banner-top: ${top}px;`
32
+ : null
33
+ ---
34
+
35
+ <div class:list={classes} style={style}>
36
+ <slot />
37
+ {closeable && (
38
+ <Button
39
+ theme="flat"
40
+ className={styles.close}
41
+ data-id="w-banner-close"
42
+ >
43
+ <Fragment set:html={closeIcon} />
44
+ </Button>
45
+ )}
46
+ </div>
47
+
48
+ <script>
49
+ import { on } from '../../utils/DOMUtils'
50
+
51
+ on('[data-id="w-banner-close"]', 'click', (event: Event) => {
52
+ const target = event.currentTarget as HTMLDivElement
53
+
54
+ target.parentElement?.remove()
55
+ }, true)
56
+ </script>
@@ -0,0 +1,47 @@
1
+ <script lang="ts">
2
+ import type { BannerProps } from './banner'
3
+
4
+ import Button from '../Button/Button.svelte'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import closeIcon from '../../icons/close.svg?raw'
9
+
10
+ import styles from './banner.module.scss'
11
+
12
+ export let top: BannerProps['top'] = 0
13
+ export let bottom: BannerProps['bottom'] = false
14
+ export let closeable: BannerProps['closeable'] = false
15
+ export let padded: BannerProps['padded'] = false
16
+ export let sticky: BannerProps['sticky'] = true
17
+ export let className: BannerProps['className'] = ''
18
+
19
+ let visible = true
20
+
21
+ const classes = classNames([
22
+ styles.banner,
23
+ bottom && styles.bottom,
24
+ padded && styles.padded,
25
+ !sticky && styles.relative,
26
+ className
27
+ ])
28
+
29
+ const style = top
30
+ ? `--w-banner-top: ${top}px;`
31
+ : null
32
+ </script>
33
+
34
+ {#if visible}
35
+ <div class={classes} style={style}>
36
+ <slot />
37
+ {#if closeable}
38
+ <Button
39
+ theme="flat"
40
+ className={styles.close}
41
+ onClick={() => visible = false}
42
+ >
43
+ {@html closeIcon}
44
+ </Button>
45
+ {/if}
46
+ </div>
47
+ {/if}
@@ -0,0 +1,54 @@
1
+ import React, { useState } from 'react'
2
+ import type { ReactBannerProps } from './banner'
3
+
4
+ import Button from '../Button/Button.tsx'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import closeIcon from '../../icons/close.svg?raw'
9
+
10
+ import styles from './banner.module.scss'
11
+
12
+ const Banner = ({
13
+ top,
14
+ bottom,
15
+ closeable,
16
+ padded,
17
+ sticky = true,
18
+ className,
19
+ children
20
+ }: ReactBannerProps) => {
21
+ const [visible, setVisible] = useState(true)
22
+
23
+ const classes = classNames([
24
+ styles.banner,
25
+ bottom && styles.bottom,
26
+ padded && styles.padded,
27
+ !sticky && styles.relative,
28
+ className
29
+ ])
30
+
31
+ const style = top
32
+ ? { '--w-banner-top': `${top}px` } as React.CSSProperties
33
+ : undefined
34
+
35
+ if (!visible) {
36
+ return null
37
+ }
38
+
39
+ return (
40
+ <div className={classes} style={style}>
41
+ {children}
42
+ {closeable && (
43
+ <Button
44
+ theme="flat"
45
+ className={styles.close}
46
+ dangerouslySetInnerHTML={{ __html: closeIcon }}
47
+ onClick={() => setVisible(false)}
48
+ />
49
+ )}
50
+ </div>
51
+ )
52
+ }
53
+
54
+ export default Banner
@@ -0,0 +1,57 @@
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ body {
4
+ --w-banner-top: 0;
5
+ }
6
+
7
+ .banner {
8
+ @include background(primary-60);
9
+ @include spacing(p-default);
10
+ @include position(sticky);
11
+ @include layer(top);
12
+ @include typography(center);
13
+
14
+ top: var(--w-banner-top);
15
+
16
+ &.padded {
17
+ @include border-radius();
18
+ @include position(l20px);
19
+
20
+ width: calc(100% - 40px);
21
+ top: calc(var(--w-banner-top) + 20px);
22
+
23
+ &.bottom {
24
+ @include position(l20px, b20px);
25
+ }
26
+ }
27
+
28
+ &.relative {
29
+ @include position(relative);
30
+ top: auto;
31
+ }
32
+
33
+ &.bottom {
34
+ @include position(fixed, b0, l0, r0);
35
+
36
+ top: auto;
37
+ }
38
+
39
+ &.closeable {
40
+ @include spacing(pl-default, pt-default, pb-default, pr-3xl);
41
+ }
42
+
43
+ .close {
44
+ @include position(absolute, v-center, r10px);
45
+ @include spacing(p-xs);
46
+
47
+ svg {
48
+ @include size(10px);
49
+ }
50
+ }
51
+ }
52
+
53
+ @include media(xs) {
54
+ .banner.closeable {
55
+ @include spacing(p-default);
56
+ }
57
+ }
@@ -0,0 +1,12 @@
1
+ export type BannerProps = {
2
+ top?: number
3
+ bottom?: boolean
4
+ closeable?: boolean
5
+ padded?: boolean
6
+ sticky?: boolean
7
+ className?: string
8
+ }
9
+
10
+ export type ReactBannerProps = {
11
+ children: React.ReactNode
12
+ } & BannerProps
@@ -1,26 +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
- }
1
+ @use '../../scss/config.scss' as *;
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
+ }
@@ -89,4 +89,8 @@
89
89
  @include background(alert-accent);
90
90
  }
91
91
  }
92
+
93
+ svg {
94
+ pointer-events: none;
95
+ }
92
96
  }
@@ -1,4 +1,4 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
2
 
3
3
  body {
4
4
  --w-slide-width: 100%;
@@ -1,29 +1,29 @@
1
- @import '../../scss/config.scss';
2
-
3
- body {
4
- --w-collapsible-initial-height: 0;
5
- --w-collapsible-max-height: 100%;
6
- }
7
-
8
- .collapsible {
9
- @include layout(flex, column, xs);
10
-
11
- &:not([data-toggled="true"]) [data-toggle-off],
12
- &[data-toggled="true"] [data-toggle-on] {
13
- @include visibility(none);
14
- }
15
-
16
- &[data-toggled="true"] .wrapper {
17
- max-height: var(--w-collapsible-max-height);
18
- }
19
-
20
- &.animated .wrapper {
21
- @include transition(max-height, .5s);
22
- }
23
-
24
- .wrapper {
25
- @include visibility(hidden);
26
-
27
- max-height: var(--w-collapsible-initial-height);
28
- }
29
- }
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ body {
4
+ --w-collapsible-initial-height: 0;
5
+ --w-collapsible-max-height: 100%;
6
+ }
7
+
8
+ .collapsible {
9
+ @include layout(flex, column, xs);
10
+
11
+ &:not([data-toggled="true"]) [data-toggle-off],
12
+ &[data-toggled="true"] [data-toggle-on] {
13
+ @include visibility(none);
14
+ }
15
+
16
+ &[data-toggled="true"] .wrapper {
17
+ max-height: var(--w-collapsible-max-height);
18
+ }
19
+
20
+ &.animated .wrapper {
21
+ @include transition(max-height, .5s);
22
+ }
23
+
24
+ .wrapper {
25
+ @include visibility(hidden);
26
+
27
+ max-height: var(--w-collapsible-initial-height);
28
+ }
29
+ }
@@ -1,5 +1,6 @@
1
1
  export type ConditionalWrapperProps = {
2
2
  condition: boolean
3
+ [key: string]: any
3
4
  }
4
5
 
5
6
  export type ReactConditionalWrapperProps = {
@@ -1,102 +1,102 @@
1
- @import '../../scss/config.scss';
2
-
3
- .filters {
4
- @include layout(flex, xs);
5
- @include spacing(mb-sm);
6
- }
7
-
8
- .table {
9
- @include visibility(auto);
10
-
11
- table {
12
- @include size('w100%');
13
- @include typography(left);
14
-
15
- border-collapse: collapse;
16
- }
17
-
18
- thead,
19
- thead button {
20
- @include typography(bold);
21
- }
22
-
23
- thead button {
24
- @include spacing(p-xxs);
25
-
26
- svg {
27
- @include size(15px);
28
- pointer-events: none;
29
- }
30
- }
31
-
32
- th,
33
- td {
34
- @include spacing(py-xs, px-sm);
35
-
36
- &.no-results {
37
- @include typography(center);
38
- }
39
- }
40
-
41
- thead,
42
- tr {
43
- @include border(bottom, primary-50);
44
-
45
- &:last-child {
46
- @include border(bottom, 0);
47
- }
48
- }
49
-
50
- [data-hidden] {
51
- @include visibility(none);
52
- }
53
-
54
- &.hover tr:hover,
55
- &.striped-rows tbody tr:nth-child(odd),
56
- &.striped-rows.offset tbody tr:nth-child(even),
57
- &.striped-columns td:nth-child(odd),
58
- &.striped-columns.offset td:nth-child(even),
59
- &.hover.striped-rows.offset tbody tr:nth-child(odd):hover {
60
- @include background(primary-60);
61
- }
62
-
63
- &.striped-rows tr,
64
- &.striped-columns tr,
65
- &.striped-columns thead {
66
- @include border(bottom, 0);
67
- }
68
-
69
- &.striped-rows.offset tbody tr:nth-child(odd),
70
- &.striped-columns.offset td:nth-child(odd) {
71
- @include background(transparent);
72
- }
73
-
74
- &.compact {
75
- th, td {
76
- @include spacing(py-xxs, px-sm);
77
- }
78
- }
79
-
80
- &.scroll {
81
- @include spacing(pr-sm);
82
-
83
- thead {
84
- @include position(sticky, t0);
85
- @include background(primary-70);
86
- box-shadow: 0 .5px 0 var(--w-color-primary-50);
87
- }
88
- }
89
- }
90
-
91
- .footer {
92
- @include layout(flex, h-end, v-center, xs);
93
- @include spacing(mt-sm);
94
-
95
- &.between {
96
- @include layout(h-between);
97
- }
98
-
99
- .subtext {
100
- @include typography(md, primary-20);
101
- }
102
- }
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ .filters {
4
+ @include layout(flex, xs);
5
+ @include spacing(mb-sm);
6
+ }
7
+
8
+ .table {
9
+ @include visibility(auto);
10
+
11
+ table {
12
+ @include size('w100%');
13
+ @include typography(left);
14
+
15
+ border-collapse: collapse;
16
+ }
17
+
18
+ thead,
19
+ thead button {
20
+ @include typography(bold);
21
+ }
22
+
23
+ thead button {
24
+ @include spacing(p-xxs);
25
+
26
+ svg {
27
+ @include size(15px);
28
+ pointer-events: none;
29
+ }
30
+ }
31
+
32
+ th,
33
+ td {
34
+ @include spacing(py-xs, px-sm);
35
+
36
+ &.no-results {
37
+ @include typography(center);
38
+ }
39
+ }
40
+
41
+ thead,
42
+ tr {
43
+ @include border(bottom, primary-50);
44
+
45
+ &:last-child {
46
+ @include border(bottom, 0);
47
+ }
48
+ }
49
+
50
+ [data-hidden] {
51
+ @include visibility(none);
52
+ }
53
+
54
+ &.hover tr:hover,
55
+ &.striped-rows tbody tr:nth-child(odd),
56
+ &.striped-rows.offset tbody tr:nth-child(even),
57
+ &.striped-columns td:nth-child(odd),
58
+ &.striped-columns.offset td:nth-child(even),
59
+ &.hover.striped-rows.offset tbody tr:nth-child(odd):hover {
60
+ @include background(primary-60);
61
+ }
62
+
63
+ &.striped-rows tr,
64
+ &.striped-columns tr,
65
+ &.striped-columns thead {
66
+ @include border(bottom, 0);
67
+ }
68
+
69
+ &.striped-rows.offset tbody tr:nth-child(odd),
70
+ &.striped-columns.offset td:nth-child(odd) {
71
+ @include background(transparent);
72
+ }
73
+
74
+ &.compact {
75
+ th, td {
76
+ @include spacing(py-xxs, px-sm);
77
+ }
78
+ }
79
+
80
+ &.scroll {
81
+ @include spacing(pr-sm);
82
+
83
+ thead {
84
+ @include position(sticky, t0);
85
+ @include background(primary-70);
86
+ box-shadow: 0 .5px 0 var(--w-color-primary-50);
87
+ }
88
+ }
89
+ }
90
+
91
+ .footer {
92
+ @include layout(flex, h-end, v-center, xs);
93
+ @include spacing(mt-sm);
94
+
95
+ &.between {
96
+ @include layout(h-between);
97
+ }
98
+
99
+ .subtext {
100
+ @include typography(md, primary-20);
101
+ }
102
+ }
@@ -1,61 +1,61 @@
1
- @import '../../scss/config.scss';
2
-
3
- .footer {
4
- @include border(top, primary-50);
5
-
6
- .column-title {
7
- @include spacing(mb-default);
8
-
9
- display: block;
10
- }
11
-
12
- .column {
13
- @include spacing(0);
14
-
15
- list-style-type: none;
16
-
17
- a {
18
- @include typography(primary-10, none);
19
-
20
- &:hover,
21
- &.active {
22
- @include typography(primary, underline);
23
- }
24
- }
25
- }
26
- }
27
-
28
- .container {
29
- @include spacing(auto-default, px-default);
30
-
31
- max-width: 1200px;
32
- }
33
-
34
- .wrapper {
35
- @include layout(flex, column, default, h-between);
36
- }
37
-
38
- .columns {
39
- @include layout(flex, column, default);
40
- }
41
-
42
- .subtext {
43
- @include border(top, primary-60);
44
- @include spacing(mt-default, py-default);
45
- @include layout(flex, column, default, h-between);
46
-
47
- span {
48
- @include typography(md, primary-20);
49
- }
50
- }
51
-
52
- @include media('sm') {
53
- .wrapper,
54
- .subtext {
55
- @include layout(row, none);
56
- }
57
-
58
- .columns {
59
- @include layout(row, '5xl');
60
- }
61
- }
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ .footer {
4
+ @include border(top, primary-50);
5
+
6
+ .column-title {
7
+ @include spacing(mb-default);
8
+
9
+ display: block;
10
+ }
11
+
12
+ .column {
13
+ @include spacing(0);
14
+
15
+ list-style-type: none;
16
+
17
+ a {
18
+ @include typography(primary-10, none);
19
+
20
+ &:hover,
21
+ &.active {
22
+ @include typography(primary, underline);
23
+ }
24
+ }
25
+ }
26
+ }
27
+
28
+ .container {
29
+ @include spacing(auto-default, px-default);
30
+
31
+ max-width: 1200px;
32
+ }
33
+
34
+ .wrapper {
35
+ @include layout(flex, column, default, h-between);
36
+ }
37
+
38
+ .columns {
39
+ @include layout(flex, column, default);
40
+ }
41
+
42
+ .subtext {
43
+ @include border(top, primary-60);
44
+ @include spacing(mt-default, py-default);
45
+ @include layout(flex, column, default, h-between);
46
+
47
+ span {
48
+ @include typography(md, primary-20);
49
+ }
50
+ }
51
+
52
+ @include media('sm') {
53
+ .wrapper,
54
+ .subtext {
55
+ @include layout(row, none);
56
+ }
57
+
58
+ .columns {
59
+ @include layout(row, '5xl');
60
+ }
61
+ }