@esportsplus/ui 0.2.3 → 0.2.9

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 (112) hide show
  1. package/build/components/accordion/index.d.ts +15 -0
  2. package/build/components/accordion/index.js +27 -0
  3. package/build/components/aurora/index.d.ts +8 -0
  4. package/build/components/aurora/index.js +12 -0
  5. package/build/components/clipboard/index.d.ts +4 -0
  6. package/build/components/clipboard/index.js +2 -0
  7. package/build/components/clipboard/write.d.ts +2 -0
  8. package/build/components/clipboard/write.js +9 -0
  9. package/build/components/ellipsis/index.d.ts +2 -0
  10. package/build/components/ellipsis/index.js +8 -0
  11. package/build/components/field/description.d.ts +1 -1
  12. package/build/components/field/error.d.ts +1 -1
  13. package/build/components/field/index.d.ts +65 -180
  14. package/build/components/field/optional.d.ts +7 -87
  15. package/build/components/field/select.js +4 -2
  16. package/build/components/field/title.d.ts +1 -1
  17. package/build/components/form/action.js +1 -2
  18. package/build/components/form/index.d.ts +5 -5
  19. package/build/components/form/input.d.ts +1 -1
  20. package/build/components/form/types.d.ts +0 -1
  21. package/build/components/json/index.d.ts +4 -0
  22. package/build/components/json/index.js +2 -0
  23. package/build/components/scrollbar/index.d.ts +3 -3
  24. package/build/components/scrollbar/index.js +3 -5
  25. package/build/components/site/index.d.ts +2 -3
  26. package/build/components/site/index.js +6 -5
  27. package/build/components/tooltip/index.d.ts +2 -27
  28. package/build/components/tooltip/index.js +2 -13
  29. package/build/index.d.ts +5 -2
  30. package/build/index.js +5 -2
  31. package/components/styles.css +14 -14
  32. package/components/variables.css +18 -19
  33. package/package.json +5 -5
  34. package/src/components/accordion/index.ts +34 -0
  35. package/src/components/accordion/scss/variables.scss +6 -1
  36. package/src/components/anchor/scss/variables.scss +0 -1
  37. package/src/components/aurora/index.ts +22 -0
  38. package/src/components/aurora/scss/index.scss +60 -0
  39. package/src/components/banner/scss/index.scss +1 -1
  40. package/src/components/banner/scss/variables.scss +4 -0
  41. package/src/components/button/scss/index.scss +25 -3
  42. package/src/components/button/scss/variables.scss +3 -6
  43. package/src/components/card/scss/variables.scss +0 -1
  44. package/src/components/clipboard/index.ts +4 -0
  45. package/src/components/clipboard/write.ts +9 -0
  46. package/src/components/container/scss/index.scss +2 -4
  47. package/src/components/container/scss/variables.scss +2 -2
  48. package/src/components/ellipsis/index.ts +10 -0
  49. package/src/components/ellipsis/scss/index.scss +19 -63
  50. package/src/components/ellipsis/scss/variables.scss +3 -1
  51. package/src/components/field/scss/index.scss +2 -2
  52. package/src/components/field/scss/variables.scss +0 -1
  53. package/src/components/field/select.ts +4 -2
  54. package/src/components/form/action.ts +3 -2
  55. package/src/components/form/types.ts +1 -1
  56. package/src/components/grid/scss/index.scss +6 -0
  57. package/src/components/grid/scss/variables.scss +6 -0
  58. package/src/components/group/scss/index.scss +4 -4
  59. package/src/components/icon/scss/index.scss +0 -1
  60. package/src/components/json/index.ts +4 -0
  61. package/src/components/link/scss/variables.scss +0 -1
  62. package/src/components/loading/scss/index.scss +9 -16
  63. package/src/components/loading/scss/variables.scss +3 -28
  64. package/src/components/modal/scss/index.scss +7 -4
  65. package/src/components/modal/scss/variables.scss +3 -7
  66. package/src/components/page/scss/variables.scss +0 -12
  67. package/src/components/root/onclick.ts +1 -1
  68. package/src/components/root/scss/variables.scss +2 -5
  69. package/src/components/scrollbar/index.ts +3 -5
  70. package/src/components/scrollbar/scss/index.scss +2 -1
  71. package/src/components/scrollbar/scss/variables.scss +1 -1
  72. package/src/components/sidebar/scss/index.scss +5 -6
  73. package/src/components/sidebar/scss/variables.scss +4 -5
  74. package/src/components/site/index.ts +9 -8
  75. package/src/components/text/scss/variables.scss +0 -1
  76. package/src/components/tooltip/index.ts +4 -17
  77. package/src/components/tooltip/scss/variables.scss +0 -1
  78. package/src/css-utilities/absolute/scss/index.scss +11 -34
  79. package/src/css-utilities/hidden/scss/index.scss +1 -1
  80. package/src/css-utilities/squircle/scss/index.scss +5 -0
  81. package/src/css-utilities/text/scss/index.scss +2 -6
  82. package/src/css-utilities/text/scss/variables.scss +7 -7
  83. package/src/index.ts +5 -2
  84. package/src/lib/scss/breakpoint.scss +3 -3
  85. package/src/lib/scss/position.scss +25 -49
  86. package/src/tokens/scss/box-shadow.scss +17 -12
  87. package/src/tokens/scss/transition-duration.scss +1 -5
  88. package/tsconfig.json +1 -9
  89. package/utilities/styles.css +4 -4
  90. package/utilities/variables.css +1 -3
  91. package/build/components/alert/index.d.ts +0 -10
  92. package/build/components/alert/index.js +0 -122
  93. package/build/components/export/clipboard.d.ts +0 -2
  94. package/build/components/export/clipboard.js +0 -8
  95. package/build/components/export/index.d.ts +0 -5
  96. package/build/components/export/index.js +0 -3
  97. package/build/components/tooltip/menu.d.ts +0 -25
  98. package/build/components/tooltip/menu.js +0 -44
  99. package/src/components/alert/index.ts +0 -157
  100. package/src/components/alert/scss/index.scss +0 -55
  101. package/src/components/alert/scss/variables.scss +0 -8
  102. package/src/components/export/clipboard.ts +0 -12
  103. package/src/components/export/index.ts +0 -5
  104. package/src/components/processing/scss/index.scss +0 -47
  105. package/src/components/processing/scss/variables.scss +0 -11
  106. package/src/components/tooltip/menu.ts +0 -71
  107. package/src/css-utilities/slide/scss/index.scss +0 -21
  108. package/src/css-utilities/slide/scss/variables.scss +0 -10
  109. package/src/css-utilities/transition/scss/variables.scss +0 -14
  110. /package/build/components/{export/json.d.ts → json/download.d.ts} +0 -0
  111. /package/build/components/{export/json.js → json/download.js} +0 -0
  112. /package/src/components/{export/json.ts → json/download.ts} +0 -0
@@ -29,7 +29,6 @@
29
29
  --line-height: var(--line-height-400);
30
30
  --padding-horizontal: var(--size-400);
31
31
  --padding-vertical: var(--size-400);
32
- --transition-duration: var(--transition-duration-400);
33
32
  --width: auto;
34
33
 
35
34
  @include tokens.state(active) {
@@ -59,11 +58,9 @@
59
58
  --border-color: var(--color);
60
59
  --border-width: var(--border-width-400);
61
60
  --size: var(--size-400);
61
+ }
62
62
 
63
- @each $key in lib.map-keys(tokens.$border-width) {
64
- &-#{$key} {
65
- --border-width: var(--border-width-#{$key});
66
- }
67
- }
63
+ &--skeleton {
64
+ --animation-duration: 6.4s;
68
65
  }
69
66
  }
@@ -19,7 +19,6 @@
19
19
  --box-shadow-pressed: none;
20
20
  --padding-horizontal: 0px;
21
21
  --padding-vertical: 0px;
22
- --transition-duration: var(--transition-duration-400);
23
22
  --width: auto;
24
23
 
25
24
  @include tokens.state(active) {
@@ -0,0 +1,4 @@
1
+ import write from './write';
2
+
3
+
4
+ export default { write };
@@ -0,0 +1,9 @@
1
+ export default async (value: string) => {
2
+ try {
3
+ await navigator.clipboard.writeText(value);
4
+ return true;
5
+ }
6
+ catch {
7
+ return false;
8
+ }
9
+ };
@@ -2,9 +2,7 @@
2
2
  display: flex;
3
3
  flex-wrap: wrap;
4
4
  justify-content: flex-start;
5
- margin: 0 auto;
6
- max-width: var(--max-width);
7
- padding: var(--padding-vertical) var(--padding-horizontal);
5
+ margin: var(--margin-vertical) auto;
8
6
  position: relative;
9
- width: 100%;
7
+ width: min(var(--max-width), calc(100% - var(--margin-horizontal) * 2));
10
8
  }
@@ -1,5 +1,5 @@
1
1
  .container {
2
+ --margin-horizontal: var(--size-600);
3
+ --margin-vertical: 0px;
2
4
  --max-width: 1400px;
3
- --padding-horizontal: var(--size-600);
4
- --padding-vertical: 0px;
5
5
  }
@@ -0,0 +1,10 @@
1
+ import { html } from '@esportsplus/template';
2
+
3
+
4
+ export default (attributes?: Record<string, string>) => html`
5
+ <div class="ellipsis" ${attributes}>
6
+ <span></span>
7
+ <span></span>
8
+ <span></span>
9
+ </div>
10
+ `;
@@ -1,72 +1,28 @@
1
1
  .ellipsis {
2
- &-dot {
3
- &:nth-child(1) {
4
- animation: ellipsis-dot-one var(--animation-duration) linear infinite;
5
- }
2
+ span {
3
+ animation: Ellipsis var(--animation-duration) infinite linear;
4
+ background-color: var(--color);
5
+ border-radius: 100%;
6
+ display: inline-block;
7
+ height: var(--size);
8
+ margin: 0 var(--margin-horizontal);
9
+ width: var(--size);
6
10
 
7
- &:nth-child(2) {
8
- animation: ellipsis-dot-two var(--animation-duration) linear infinite;
11
+ :nth-child(2) {
12
+ animation-delay: 0.24s;
9
13
  }
10
14
 
11
- &:nth-child(3) {
12
- animation: ellipsis-dot-three var(--animation-duration) linear infinite;
15
+ :nth-child(3) {
16
+ animation-delay: 0.48s;
13
17
  }
14
18
  }
15
- }
16
-
17
- @keyframes ellipsis-dot-one {
18
- 0% {
19
- opacity: 1;
20
- }
21
- 65% {
22
- opacity: 1;
23
- }
24
- 66% {
25
- opacity: 0;
26
- }
27
- 100% {
28
- opacity: 0;
29
- }
30
- }
31
-
32
- @keyframes ellipsis-dot-two {
33
- 0% {
34
- opacity: 0;
35
- }
36
- 21% {
37
- opacity: 0;
38
- }
39
- 22% {
40
- opacity: 1;
41
- }
42
- 65% {
43
- opacity: 1;
44
- }
45
- 66% {
46
- opacity: 0;
47
- }
48
- 100% {
49
- opacity: 0;
50
- }
51
- }
52
19
 
53
- @keyframes ellipsis-dot-three {
54
- 0% {
55
- opacity: 0;
56
- }
57
- 43% {
58
- opacity: 0;
59
- }
60
- 44% {
61
- opacity: 1;
62
- }
63
- 65% {
64
- opacity: 1;
65
- }
66
- 66% {
67
- opacity: 0;
68
- }
69
- 100% {
70
- opacity: 0;
20
+ @keyframes Ellipsis {
21
+ 0%, 100% {
22
+ opacity: 0.16;
23
+ }
24
+ 20% {
25
+ opacity: 1;
26
+ }
71
27
  }
72
28
  }
@@ -1,3 +1,5 @@
1
1
  .ellipsis {
2
- --animation-duration: 2s;
2
+ --animation-duration: 1.24s;
3
+ --marign-horizontal: var(--size-100);
4
+ --size: var(--size-200);
3
5
  }
@@ -62,9 +62,9 @@
62
62
  }
63
63
 
64
64
  &-error {
65
- animation: field-error 0.32s 1 linear;
65
+ animation: FieldError 0.32s 1 linear;
66
66
 
67
- @keyframes field-error {
67
+ @keyframes FieldError {
68
68
  0% {
69
69
  transform: translate(8px);
70
70
  }
@@ -3,7 +3,6 @@
3
3
  @use 'text' as text;
4
4
 
5
5
  .field {
6
- --transition-duration: var(--transition-duration-400);
7
6
  --width: 100%;
8
7
 
9
8
 
@@ -55,8 +55,10 @@ function parse(keys: (number | string)[], selected: number | string) {
55
55
 
56
56
  function template(data: Data, state: { active: boolean, options: Record<number | string, boolean>, selected: number | string }) {
57
57
  let { attributes: a, html: h } = scrollbar({
58
- fixed: true,
59
- style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
58
+ attributes: {
59
+ style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
60
+ },
61
+ fixed: true
60
62
  });
61
63
 
62
64
  return html`
@@ -1,6 +1,6 @@
1
1
  import response from '@esportsplus/action';
2
2
  import { Action } from './types';
3
- import alert from '~/components/alert';
3
+ // import alert from '~/components/alert';
4
4
  import input from './input';
5
5
 
6
6
 
@@ -45,7 +45,8 @@ export default function(action: Action) {
45
45
  event?.submitter?.classList.add('button--processing');
46
46
 
47
47
  let { errors } = await action({
48
- alert,
48
+ // @ts-ignore
49
+ alert: null,
49
50
  input: parse( Object.fromEntries( new FormData( this )?.entries() ) ),
50
51
  response
51
52
  });
@@ -1,5 +1,5 @@
1
1
  import response, { Response } from '@esportsplus/action';
2
- import alert from '~/components/alert';
2
+ // import alert from '~/components/alert';
3
3
 
4
4
 
5
5
  type Action = (data: Payload) => Promise<Errors> | Errors;
@@ -0,0 +1,6 @@
1
+ .grid {
2
+ display: grid;
3
+ grid-gap: var(--margin-horizontal) var(--margin-vertical);
4
+ grid-template-columns: repeat(auto-fit, minmax(var(--min-width), var(--max-width)));
5
+ position: relative;
6
+ }
@@ -0,0 +1,6 @@
1
+ .group {
2
+ --margin-horizontal: var(--size-400);
3
+ --margin-vertical: var(--size-400);
4
+ --max-width: 1fr;
5
+ --min-width: 200px;
6
+ }
@@ -2,9 +2,9 @@
2
2
  display: flex;
3
3
  flex-wrap: wrap;
4
4
  justify-content: flex-start;
5
- margin: 0 calc(var(--margin-horizontal) / -2);
5
+ margin: 0 calc(var(--margin-horizontal) * -1);
6
6
  position: relative;
7
- width: calc(100% + var(--margin-horizontal));
7
+ width: calc(100% + var(--margin-horizontal) * 2);
8
8
 
9
9
 
10
10
  &--offset {
@@ -25,12 +25,12 @@
25
25
 
26
26
  &-item {
27
27
  display: flex;
28
- margin: var(--margin-vertical) calc(var(--margin-horizontal) / 2) 0;
28
+ margin: var(--margin-vertical) var(--margin-horizontal) 0;
29
29
  position: relative;
30
30
  width: var(--width);
31
31
 
32
32
  &[class*='--width'] {
33
- width: calc(var(--width) - var(--margin-horizontal));
33
+ width: calc(var(--width) - var(--margin-horizontal) * 2);
34
34
  }
35
35
  }
36
36
  }
@@ -3,7 +3,6 @@
3
3
  display: flex;
4
4
  flex: 0 0 var(--width);
5
5
  height: var(--height);
6
- pointer-events: none;
7
6
  position: relative;
8
7
  width: var(--width);
9
8
 
@@ -0,0 +1,4 @@
1
+ import download from './download';
2
+
3
+
4
+ export default { download };
@@ -23,7 +23,6 @@
23
23
  --line-height: var(--line-height-400);
24
24
  --padding-horizontal: var(--size-400);
25
25
  --padding-vertical: var(--size-400);
26
- --transition-duration: var(--transition-duration-400);
27
26
  --width: auto;
28
27
 
29
28
 
@@ -1,24 +1,17 @@
1
1
  .loading {
2
- animation: loading var(--animation-duration) infinite linear;
3
- animation-delay: var(--animation-delay);
4
- border: var(--border-width) var(--border-style) var(--border-color);
2
+ animation: Loading var(--animation-duration) linear infinite;
3
+ border: var(--border-width) solid color-mix(in srgb, var(--border-color), transparent 90%);
4
+ border-left-color: var(--border-color);
5
5
  border-radius: 100%;
6
- border-right-color: transparent;
7
- border-top-color: transparent;
8
- box-shadow: var(--box-shadow);
9
- height: var(--height);
10
- pointer-events: none;
11
- position: relative;
12
- transition: border-color var(--transition-duration) ease-in-out;
13
- width: var(--width);
14
- z-index: 0;
6
+ height: var(--size);
7
+ width: var(--size);
15
8
  }
16
9
 
17
- @keyframes loading {
10
+ @keyframes Loading {
18
11
  0% {
19
- transform: rotate(0deg);
12
+ transform: rotate(0deg)
20
13
  }
21
14
  100% {
22
- transform: rotate(360deg);
15
+ transform: rotate(360deg)
23
16
  }
24
- }
17
+ }
@@ -1,31 +1,6 @@
1
1
  .loading {
2
- --animation-delay: calc(0s + (0.032s * var(--i)));
3
- --animation-duration: calc(0.64s * (var(--i) + 1.5));
4
- --border-color: inherit;
5
- --border-style: solid;
2
+ --animation-duration: 0.64s;
3
+ --border-color: var(--color);
6
4
  --border-width: var(--border-width-400);
7
- --box-shadow: none;
8
- --height: calc(var(--size) * var(--multiplier));
9
- --i: 0;
10
- --multiplier: calc(1 - (.2 * var(--i)));
11
5
  --size: var(--size-400);
12
- --transition-duration: var(--transition-duration-400);
13
- --width: calc(var(--size) * var(--multiplier));
14
-
15
- .loading {
16
- --i: 1;
17
- --size: inherit;
18
-
19
- .loading {
20
- --i: 2;
21
-
22
- .loading {
23
- --i: 3;
24
-
25
- .loading {
26
- --i: 4;
27
- }
28
- }
29
- }
30
- }
31
- }
6
+ }
@@ -4,11 +4,12 @@
4
4
  .modal {
5
5
  @include lib.position(fixed, center);
6
6
  max-height: var(--max-height);
7
- max-width: var(--max-width);
8
7
  overflow: hidden;
9
- transition: opacity var(--transition-duration) ease-in-out, transform var(--transition-duration) ease-in-out;
8
+ transition:
9
+ opacity var(--transition-duration) ease-in-out,
10
+ transform var(--transition-duration) ease-in-out;
10
11
  transform-origin: center;
11
- width: var(--width);
12
+ width: min(var(--max-width), calc(100svw - (var(--margin-horizontal) * 2)));
12
13
  z-index: 2;
13
14
 
14
15
  @include tokens.state(inactive) {
@@ -22,7 +23,9 @@
22
23
  }
23
24
 
24
25
  &-frame {
25
- transition: opacity var(--transition-duration) ease-in-out, transform var(--transition-duration) ease-in-out;
26
+ transition:
27
+ opacity var(--transition-duration) ease-in-out,
28
+ transform var(--transition-duration) ease-in-out;
26
29
  transform-origin: center;
27
30
 
28
31
  @include tokens.state(inactive) {
@@ -1,10 +1,6 @@
1
1
  .modal {
2
- --max-height: calc(100svh - (var(--margin) * 2));
2
+ --margin-horizontal: 0px;
3
+ --margin-vertical: 0px;
4
+ --max-height: calc(100svh - (var(--margin-vertical) * 2));
3
5
  --max-width: 320px;
4
- --width: calc(100svw - (var(--margin) * 2));
5
-
6
- &,
7
- &-frame {
8
- --transition-duration: var(--transition-duration-300);
9
- }
10
6
  }
@@ -7,21 +7,9 @@
7
7
  --line-height: var(--line-height-400);
8
8
  }
9
9
 
10
- &-suptitle + &-title {
11
- &::before {
12
- --line-height: 1;
13
- }
14
- }
15
-
16
10
  &-title {
17
11
  --color: var(--color-default);
18
12
  --color-default: var(--color-text-500);
19
13
  --line-height: var(--line-height-400);
20
14
  }
21
-
22
- &-title:has(+ .page-subtitle) {
23
- &::after {
24
- --line-height: 1;
25
- }
26
- }
27
15
  }
@@ -1,4 +1,4 @@
1
- let queue: VoidFunction[] = [];
1
+ let queue: (VoidFunction | (() => Promise<void>))[] = [];
2
2
 
3
3
 
4
4
  const onclick = async () => {
@@ -3,15 +3,14 @@
3
3
 
4
4
  body {
5
5
  @include lib.css-variables(border-radius, tokens.$border-radius);
6
- @include lib.css-variables(box-shadow, tokens.$box-shadow);
7
6
  @include lib.css-variables(border-width, tokens.$border-width);
7
+ @include lib.css-variables(box-shadow, tokens.$box-shadow);
8
8
  @include lib.css-variables(color, tokens.$color);
9
9
  @include lib.css-variables(font-size, tokens.$font-size);
10
10
  @include lib.css-variables(font-weight, tokens.$font-weight);
11
11
  @include lib.css-variables(line-height, tokens.$line-height);
12
12
  @include lib.css-variables(size, tokens.$size);
13
13
  @include lib.css-variables(spacer, tokens.$spacer);
14
- @include lib.css-variables(transition-duration, tokens.$transition-duration);
15
14
 
16
15
  --background: var(--color-grey-400);
17
16
  --color: var(--color-text-400);
@@ -20,10 +19,8 @@ body {
20
19
  --font-weight: var(--font-weight-400);
21
20
  --line-height: var(--line-height-400);
22
21
  --min-width: 320px;
23
-
24
- // Used by components requiring scrollbar width
25
- // - Should be updated using JS on load
26
22
  --scrollbar-width: 17px;
23
+ --transition-duration: tokens.$transition-duration;
27
24
  }
28
25
 
29
26
  section {
@@ -6,7 +6,7 @@ let root = document.body,
6
6
  width: number | undefined;
7
7
 
8
8
 
9
- export default ({ fixed, style }: { fixed?: boolean, style?: string } = {}) => {
9
+ export default ({ attributes, fixed }: { attributes?: Record<string, unknown>, fixed?: boolean } = {}) => {
10
10
  let state = reactive({
11
11
  height: 100,
12
12
  translate: 0
@@ -14,9 +14,7 @@ export default ({ fixed, style }: { fixed?: boolean, style?: string } = {}) => {
14
14
 
15
15
  return {
16
16
  attributes: {
17
- class: () => {
18
- return '--scrollbar-content';
19
- },
17
+ class: '--scrollbar-content',
20
18
  onscroll: function(this: HTMLElement) {
21
19
  if (width === undefined) {
22
20
  width = this.offsetWidth - this.clientWidth;
@@ -34,10 +32,10 @@ export default ({ fixed, style }: { fixed?: boolean, style?: string } = {}) => {
34
32
  <div
35
33
  class='scrollbar ${fixed ? 'scrollbar--fixed' : ''} ${() => state.height >= 100 ? 'scrollbar--hidden' : ''}'
36
34
  style='${() => `
37
- ${style || ''}
38
35
  --translate: translate3d(0, ${state.translate}%, 0);
39
36
  --height: ${state.height}%;
40
37
  `}'
38
+ ${attributes}
41
39
  ></div>
42
40
  `
43
41
  };
@@ -20,6 +20,7 @@
20
20
  margin-right: calc(var(--scrollbar-width) * -1);
21
21
  overflow-x: hidden;
22
22
  overflow-y: scroll;
23
+ scrollbar-gutter: stable;
23
24
  scroll-behavior: smooth;
24
25
  width: calc(100% + var(--scrollbar-width));
25
26
  }
@@ -36,7 +37,7 @@
36
37
  right: 0;
37
38
  top: 0;
38
39
  transition: opacity var(--transition-duration) ease-in-out;
39
- width: 4px;
40
+ width: var(--width);
40
41
  }
41
42
 
42
43
  &::before {
@@ -1,6 +1,6 @@
1
1
  .scrollbar {
2
2
  --background-default: transparent;
3
3
  --height: 0;
4
- --transition-duration: var(--transition-duration-400);
5
4
  --translate: translate3d(0, 0, 0);
5
+ --width: 4px;
6
6
  }
@@ -2,16 +2,15 @@
2
2
  @use '/tokens';
3
3
 
4
4
  .sidebar {
5
- @include lib.position(absolute, var(--position-vertical) null var(--position-vertical) null);
5
+ @include lib.position(absolute, var(--margin-vertical) null var(--margin-vertical) null);
6
6
  cursor: default;
7
- height: calc(100% - (var(--position-vertical) * 2));
8
- max-width: var(--width);
7
+ height: calc(100% - (var(--margin-vertical) * 2));
9
8
  overflow: hidden;
10
9
  transition:
11
10
  max-width var(--transition-duration) ease-in-out,
12
11
  opacity var(--transition-duration) ease-in-out,
13
12
  transform var(--transition-duration) ease-in-out;
14
- width: calc(100% - (var(--position-horizontal) * 2));
13
+ width: min(var(--width), calc(100% - (var(--margin-horizontal) * 2)));
15
14
  z-index: 1;
16
15
 
17
16
 
@@ -23,7 +22,7 @@
23
22
 
24
23
 
25
24
  &--e {
26
- right: var(--position-horizontal);
25
+ right: var(--margin-horizontal);
27
26
 
28
27
  &.sidebar--offscreen {
29
28
  @include tokens.state(inactive) {
@@ -33,7 +32,7 @@
33
32
  }
34
33
 
35
34
  &--w {
36
- left: var(--position-horizontal);
35
+ left: var(--margin-horizontal);
37
36
 
38
37
  &.sidebar--offscreen {
39
38
  @include tokens.state(inactive) {
@@ -1,9 +1,8 @@
1
1
  @use '/tokens';
2
2
 
3
3
  .sidebar {
4
- --position-horizontal: 0px;
5
- --position-vertical: 0px;
6
- --transition-duration: var(--transition-duration-400);
4
+ --margin-horizontal: 0px;
5
+ --margin-vertical: 0px;
7
6
  --width: var(--width-default);
8
7
  --width-closed: var(--width-default);
9
8
  --width-default: 320px;
@@ -15,7 +14,7 @@
15
14
 
16
15
 
17
16
  &--floating {
18
- --position-horizontal: var(--size-100);
19
- --position-vertical: var(--size-100);
17
+ --margin-horizontal: var(--size-100);
18
+ --margin-vertical: var(--size-100);
20
19
  }
21
20
  }
@@ -6,20 +6,21 @@ import scrollbar from '~/components/scrollbar';
6
6
  type Data = {
7
7
  class?: string;
8
8
  content?: any;
9
- scrollbar?: {
10
- style?: string;
11
- };
9
+ scrollbar?: Parameters<typeof scrollbar>[0];
12
10
  };
13
11
 
14
12
 
15
13
  export default (data: Data) => {
16
- let { attributes: a, html: h } = scrollbar({
17
- fixed: true,
18
- style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
19
- });
14
+ let sb = data.scrollbar ??= {};
15
+
16
+ sb.attributes ??= {};
17
+ sb.attributes.style ??= '--background-default: var(--color-black-400);';
18
+ sb.fixed ??= true;
19
+
20
+ let { attributes: a, html: h } = scrollbar(sb);
20
21
 
21
22
  return html`
22
- <section class='site ${data?.class || ''}' onclick='${onclick}' ${a}>
23
+ <section class='site ${data?.class || ''}' ${{ onclick }} ${a}>
23
24
  ${data?.content || ''}
24
25
  ${h}
25
26
  </section>
@@ -4,6 +4,5 @@
4
4
  --font-size: var(--font-size-400);
5
5
  --font-weight: var(--font-weight-400);
6
6
  --line-height: var(--line-height-400);
7
- --transition-duration: var(--transition-duration-400);
8
7
  --width: auto;
9
8
  }