@kth/style 0.1.0 → 0.2.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 (67) hide show
  1. package/README.md +28 -22
  2. package/dist/cjs/components/MenuPanel.d.ts +13 -0
  3. package/dist/cjs/index.d.ts +1 -3
  4. package/dist/cjs/index.js +54 -127
  5. package/dist/cjs/react.d.ts +1 -5
  6. package/dist/cjs/react.js +3 -175
  7. package/dist/esm/components/MenuPanel.d.ts +13 -0
  8. package/dist/esm/index.d.ts +1 -3
  9. package/dist/esm/index.js +54 -125
  10. package/dist/esm/react.d.ts +1 -5
  11. package/dist/esm/react.js +3 -147
  12. package/package.json +2 -12
  13. package/scss/components/a11y-nav.scss +31 -0
  14. package/scss/components/button.scss +18 -54
  15. package/scss/components/header.scss +40 -0
  16. package/scss/components/logotype.scss +28 -0
  17. package/scss/components/mega-menu.scss +33 -0
  18. package/scss/components/menu-item.scss +40 -0
  19. package/scss/components/menu-panel.scss +32 -0
  20. package/scss/components/search.scss +3 -1
  21. package/scss/components/visually-hidden.scss +11 -0
  22. package/scss/tokens/colors.scss +0 -3
  23. package/scss/tokens/icons.scss +11 -10
  24. package/scss/tokens/spacing.scss +0 -65
  25. package/scss/utils/mixins.scss +5 -0
  26. package/scss/utils/prose.scss +10 -5
  27. package/scss/utils/reset.scss +35 -21
  28. package/dist/cjs/components/Button.d.ts +0 -20
  29. package/dist/cjs/components/ModalNavigationPanel.d.ts +0 -4
  30. package/dist/cjs/components/NavigationPanel.d.ts +0 -7
  31. package/dist/cjs/components/Radio.d.ts +0 -20
  32. package/dist/cjs/components/Select.d.ts +0 -34
  33. package/dist/cjs/components/Tabs.d.ts +0 -1
  34. package/dist/cjs/components/react/PersonalMenuPanel.d.ts +0 -19
  35. package/dist/cjs/components/react/Tabs.d.ts +0 -34
  36. package/dist/cjs/icons/400/ArrowBack.d.ts +0 -4
  37. package/dist/cjs/icons/400/Check.d.ts +0 -4
  38. package/dist/cjs/icons/500/ArrowForward.d.ts +0 -4
  39. package/dist/cjs/stories/Button.stories.d.ts +0 -14
  40. package/dist/cjs/stories/ContentTabs.stories.d.ts +0 -12
  41. package/dist/cjs/stories/FilterTabs.stories.d.ts +0 -12
  42. package/dist/cjs/stories/InlineIcons.stories.d.ts +0 -9
  43. package/dist/cjs/stories/Select.stories.d.ts +0 -14
  44. package/dist/esm/components/Button.d.ts +0 -20
  45. package/dist/esm/components/ModalNavigationPanel.d.ts +0 -4
  46. package/dist/esm/components/NavigationPanel.d.ts +0 -7
  47. package/dist/esm/components/Radio.d.ts +0 -20
  48. package/dist/esm/components/Select.d.ts +0 -34
  49. package/dist/esm/components/Tabs.d.ts +0 -1
  50. package/dist/esm/components/react/PersonalMenuPanel.d.ts +0 -19
  51. package/dist/esm/components/react/Tabs.d.ts +0 -34
  52. package/dist/esm/icons/400/ArrowBack.d.ts +0 -4
  53. package/dist/esm/icons/400/Check.d.ts +0 -4
  54. package/dist/esm/icons/500/ArrowForward.d.ts +0 -4
  55. package/dist/esm/stories/Button.stories.d.ts +0 -14
  56. package/dist/esm/stories/ContentTabs.stories.d.ts +0 -12
  57. package/dist/esm/stories/FilterTabs.stories.d.ts +0 -12
  58. package/dist/esm/stories/InlineIcons.stories.d.ts +0 -9
  59. package/dist/esm/stories/Select.stories.d.ts +0 -14
  60. package/scss/components/checkbox.scss +0 -63
  61. package/scss/components/details.scss +0 -40
  62. package/scss/components/fieldset.scss +0 -60
  63. package/scss/components/form-control.scss +0 -25
  64. package/scss/components/header-menu-item.scss +0 -38
  65. package/scss/components/input.scss +0 -21
  66. package/scss/components/main-header.scss +0 -105
  67. package/scss/components/select.scss +0 -46
@@ -0,0 +1,32 @@
1
+ @use "../tokens/spacing";
2
+ @use "../tokens/typography";
3
+ @use "../tokens/icons";
4
+ @use "../utils/mixins";
5
+
6
+ @layer kth-style {
7
+ .kth-menu-panel {
8
+ top: 100%;
9
+ width: 100%;
10
+ border: none;
11
+ background: var(--color-background);
12
+ padding: 0;
13
+ padding-block-end: spacing.$space-48;
14
+
15
+ &__container {
16
+ @include mixins.container;
17
+ }
18
+ }
19
+
20
+ .kth-menu-panel--modal {
21
+ background-color: var(--color-background);
22
+ position: fixed;
23
+ right: 0;
24
+ left: auto;
25
+ top: 0;
26
+ max-width: 32rem;
27
+ max-height: 100dvh;
28
+ width: 100dvw;
29
+ height: 100dvh;
30
+ border: 0;
31
+ }
32
+ }
@@ -1,6 +1,8 @@
1
+ @use "sass:math";
1
2
  @use "../tokens/spacing.scss";
2
3
  @use "../tokens/icons.scss";
3
- $secondary-border-width: 1rem/16;
4
+
5
+ $secondary-border-width: math.div(1rem, 16);
4
6
 
5
7
  @layer kth-style {
6
8
  .kth-search {
@@ -0,0 +1,11 @@
1
+ @layer kth-style {
2
+ .kth-visually-hidden {
3
+ position: absolute;
4
+ top: auto;
5
+ overflow: hidden;
6
+ clip: rect(1px, 1px, 1px, 1px);
7
+ width: 1px;
8
+ height: 1px;
9
+ white-space: nowrap;
10
+ }
11
+ }
@@ -13,8 +13,6 @@ $color-blue-sky: #6298d2;
13
13
  $color-blue-marine: #08004f;
14
14
  $color-blue-digital: #221dd9;
15
15
 
16
- $color-red: #d4351c;
17
-
18
16
  // This color is specially made for links
19
17
  // 4.51:1 with `$color-blue-light` (requires 4.50)
20
18
  // 5.21:1 with `$color-white` (requires 4.50)
@@ -28,7 +26,6 @@ $color-blue-special: #036eb8;
28
26
  --color-on-primary: #{$color-white};
29
27
  --color-secondary: #{$color-black};
30
28
  --color-tertiary: #{$color-blue-special};
31
- --color-error: #{$color-red};
32
29
  // ... --hover-overlay: ...
33
30
  }
34
31
 
@@ -1,10 +1,11 @@
1
1
  $icon-url-caret-down: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.99997 12.782L5.28845 8.07053L6.06247 7.29651L9.99997 11.234L13.9375 7.29651L14.7115 8.07053L9.99997 12.782Z' fill='currentColor'%3E%3C/path%3E%3C/svg%3E%0A");
2
2
  $icon-url-globe: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%0A%3E%3Cpath d='M10.5001 17.5833C9.45625 17.5833 8.47362 17.3857 7.55217 16.9904C6.63069 16.5951 5.8254 16.0529 5.13629 15.3638C4.44719 14.6747 3.905 13.8694 3.50971 12.9479C3.1144 12.0264 2.91675 11.0438 2.91675 10C2.91675 8.94765 3.1144 7.96288 3.50971 7.04569C3.905 6.12849 4.44719 5.32534 5.13629 4.63623C5.8254 3.94713 6.63069 3.40494 7.55217 3.00965C8.47362 2.61434 9.45625 2.41669 10.5001 2.41669C11.5524 2.41669 12.5372 2.61434 13.4544 3.00965C14.3716 3.40494 15.1747 3.94713 15.8638 4.63623C16.5529 5.32534 17.0951 6.12849 17.4904 7.04569C17.8857 7.96288 18.0834 8.94765 18.0834 10C18.0834 11.0438 17.8857 12.0264 17.4904 12.9479C17.0951 13.8694 16.5529 14.6747 15.8638 15.3638C15.1747 16.0529 14.3716 16.5951 13.4544 16.9904C12.5372 17.3857 11.5524 17.5833 10.5001 17.5833ZM10.5001 16.4615C10.8003 16.1613 11.0818 15.6723 11.3446 14.9944C11.6074 14.3165 11.8094 13.5609 11.9504 12.7275H9.04973C9.20144 13.5823 9.40603 14.3485 9.66352 15.0264C9.92099 15.7043 10.1998 16.1827 10.5001 16.4615ZM9.15714 16.3574C8.89326 15.9407 8.655 15.4161 8.44239 14.7836C8.22978 14.1512 8.06685 13.4658 7.9536 12.7275H4.60581C5.04599 13.6902 5.66753 14.4901 6.47041 15.1274C7.27332 15.7647 8.16889 16.1747 9.15714 16.3574ZM11.843 16.3574C12.8312 16.1747 13.7268 15.7647 14.5297 15.1274C15.3326 14.4901 15.9541 13.6902 16.3943 12.7275H13.0465C12.9066 13.4711 12.7303 14.1592 12.5177 14.7917C12.3051 15.4242 12.0802 15.9461 11.843 16.3574ZM4.22762 11.6443H7.84623C7.80777 11.3483 7.78373 11.0585 7.77412 10.7749C7.76451 10.4912 7.75971 10.219 7.75971 9.95833C7.75971 9.69765 7.76451 9.43242 7.77412 9.16265C7.78373 8.89288 7.80777 8.62392 7.84623 8.35575H4.22762C4.1475 8.62499 4.08954 8.89849 4.05375 9.17627C4.01796 9.45405 4.00006 9.72862 4.00006 10C4.00006 10.2714 4.01796 10.546 4.05375 10.8237C4.08954 11.1015 4.1475 11.375 4.22762 11.6443ZM8.95037 11.6443H12.0497C12.0882 11.3344 12.1122 11.0473 12.1219 10.7829C12.1315 10.5184 12.1363 10.2575 12.1363 10C12.1363 9.74251 12.1315 9.47809 12.1219 9.20673C12.1122 8.93535 12.0882 8.65169 12.0497 8.35575H8.95037C8.91191 8.65169 8.88787 8.93535 8.87825 9.20673C8.86864 9.47809 8.86383 9.74251 8.86383 10C8.86383 10.2575 8.86864 10.5219 8.87825 10.7933C8.88787 11.0646 8.91191 11.3483 8.95037 11.6443ZM13.1539 11.6443H16.7725C16.8526 11.375 16.9106 11.1015 16.9464 10.8237C16.9822 10.546 17.0001 10.2714 17.0001 10C17.0001 9.72862 16.9822 9.45058 16.9464 9.16585C16.9106 8.88113 16.8526 8.6111 16.7725 8.35575H13.1539C13.1924 8.65169 13.2164 8.94149 13.226 9.22515C13.2356 9.50881 13.2404 9.78099 13.2404 10.0417C13.2404 10.3023 13.2356 10.5676 13.226 10.8374C13.2164 11.1071 13.1924 11.3761 13.1539 11.6443ZM13.0465 7.27246H16.3943C15.9488 6.29915 15.3313 5.49919 14.5417 4.87258C13.7522 4.24599 12.8526 3.83333 11.843 3.6346C12.1069 4.07798 12.3424 4.6119 12.5497 5.23638C12.757 5.86085 12.9226 6.53954 13.0465 7.27246ZM9.04973 7.27246H11.9504C11.7987 6.4231 11.5901 5.65279 11.3246 4.96154C11.0591 4.27031 10.7843 3.79594 10.5001 3.53846C10.2159 3.79594 9.94103 4.27031 9.67554 4.96154C9.41004 5.65279 9.20144 6.4231 9.04973 7.27246ZM4.60581 7.27246H7.9536C8.07753 6.53954 8.24314 5.86085 8.45041 5.23638C8.65768 4.6119 8.89326 4.07798 9.15714 3.6346C8.14219 3.83333 7.24127 4.24733 6.45439 4.8766C5.66753 5.50588 5.05134 6.3045 4.60581 7.27246Z' fill='currentColor'%3E%3C/path%3E%3C/svg%3E%0A");
3
3
  $icon-url-search: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%0A%3E%3Cpath d='M16.3895 16.6474L11.4264 11.6843C11.0097 12.0005 10.5528 12.2454 10.0557 12.419C9.5586 12.5927 9.04565 12.6795 8.51686 12.6795C7.21707 12.6795 6.11209 12.2245 5.20192 11.3146C4.29175 10.4047 3.83667 9.30024 3.83667 8.00131C3.83667 6.70237 4.29163 5.5975 5.20155 4.68671C6.11146 3.77593 7.21589 3.32054 8.51484 3.32054C9.81377 3.32054 10.9186 3.77563 11.8294 4.68579C12.7402 5.59596 13.1956 6.70094 13.1956 8.00073C13.1956 8.54555 13.1061 9.06651 12.9272 9.56362C12.7482 10.0607 12.506 10.5096 12.2004 10.9102L17.1635 15.8734L16.3895 16.6474ZM8.51613 11.5962C9.52041 11.5962 10.3708 11.2479 11.0674 10.5513C11.764 9.85471 12.1123 9.00428 12.1123 8C12.1123 6.99572 11.764 6.14529 11.0674 5.44871C10.3708 4.75213 9.52041 4.40383 8.51613 4.40383C7.51185 4.40383 6.66142 4.75213 5.96484 5.44871C5.26827 6.14529 4.91998 6.99572 4.91998 8C4.91998 9.00428 5.26827 9.85471 5.96484 10.5513C6.66142 11.2479 7.51185 11.5962 8.51613 11.5962Z' fill='currentColor'%3E%3C/path%3E%3C/svg%3E%0A");
4
- $icon-arrow-right-300: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_2740_45' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='20' height='20'%3E%3Crect width='20' height='20' fill='%23D9D9D9'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_2740_45)'%3E%3Cpath d='M13.5017 10.5417H4.41675V9.45842H13.5017L9.23406 5.19077L10.0001 4.41675L15.5834 10.0001L10.0001 15.5834L9.23406 14.8094L13.5017 10.5417Z' fill='%23212121'/%3E%3C/g%3E%3C/svg%3E%0A");
5
- $icon-arrow-right-500: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_2676_13984' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='20' height='20'%3E%3Crect width='20' height='20' fill='%23D9D9D9'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_2676_13984)'%3E%3Cpath d='M12.851 10.8645H3.83057V9.13538H12.851L8.77307 5.05748L9.99996 3.83057L16.1694 9.99996L9.99996 16.1694L8.77307 14.9424L12.851 10.8645Z' fill='%23212121'/%3E%3C/g%3E%3C/svg%3E%0A");
6
- $icon-check: url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_2742_210' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='25' height='25'%3E%3Crect x='0.764648' y='0.942017' width='24' height='24' fill='%23D9D9D9'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_2742_210)'%3E%3Cpath d='M10.3146 19.1333L4.42334 13.242L6.04561 11.6197L10.3146 15.8887L19.4837 6.71973L21.1059 8.342L10.3146 19.1333Z' fill='%231C1B1F'/%3E%3C/g%3E%3C/svg%3E%0A");
7
- $icon-close: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.06247 14.7115L5.28845 13.9375L9.22595 9.99997L5.28845 6.06247L6.06247 5.28845L9.99997 9.22595L13.9375 5.28845L14.7115 6.06247L10.774 9.99997L14.7115 13.9375L13.9375 14.7115L9.99997 10.774L6.06247 14.7115Z' fill='currentColor' /%3E%3C/svg%3E%0A");
4
+ $icon-url-arrow-right-300: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_2740_45' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='20' height='20'%3E%3Crect width='20' height='20' fill='%23D9D9D9'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_2740_45)'%3E%3Cpath d='M13.5017 10.5417H4.41675V9.45842H13.5017L9.23406 5.19077L10.0001 4.41675L15.5834 10.0001L10.0001 15.5834L9.23406 14.8094L13.5017 10.5417Z' fill='%23212121'/%3E%3C/g%3E%3C/svg%3E%0A");
5
+ $icon-url-arrow-right-500: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_2676_13984' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='20' height='20'%3E%3Crect width='20' height='20' fill='%23D9D9D9'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_2676_13984)'%3E%3Cpath d='M12.851 10.8645H3.83057V9.13538H12.851L8.77307 5.05748L9.99996 3.83057L16.1694 9.99996L9.99996 16.1694L8.77307 14.9424L12.851 10.8645Z' fill='%23212121'/%3E%3C/g%3E%3C/svg%3E%0A");
6
+ $icon-url-check: url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_2742_210' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='25' height='25'%3E%3Crect x='0.764648' y='0.942017' width='24' height='24' fill='%23D9D9D9'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_2742_210)'%3E%3Cpath d='M10.3146 19.1333L4.42334 13.242L6.04561 11.6197L10.3146 15.8887L19.4837 6.71973L21.1059 8.342L10.3146 19.1333Z' fill='%231C1B1F'/%3E%3C/g%3E%3C/svg%3E%0A");
7
+ $icon-url-close: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.06247 14.7115L5.28845 13.9375L9.22595 9.99997L5.28845 6.06247L6.06247 5.28845L9.99997 9.22595L13.9375 5.28845L14.7115 6.06247L10.774 9.99997L14.7115 13.9375L13.9375 14.7115L9.99997 10.774L6.06247 14.7115Z' fill='currentColor' /%3E%3C/svg%3E%0A");
8
+ $icon-url-info: url("data:image/svg+xml,%3Csvg width='21' height='21' viewBox='0 0 21 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_2831_14099' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='21' height='21'%3E%3Crect x='0.506958' y='0.468018' width='20' height='20' fill='%23D9D9D9'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_2831_14099)'%3E%3Cpath d='M9.75696 14.468H11.257V9.46802H9.75696V14.468ZM10.5026 7.96802C10.7138 7.96802 10.8924 7.89657 11.0382 7.75366C11.184 7.61075 11.257 7.43366 11.257 7.22241C11.257 7.01115 11.1855 6.8326 11.0426 6.68677C10.8997 6.54093 10.7226 6.46802 10.5114 6.46802C10.3001 6.46802 10.1215 6.53947 9.97571 6.68237C9.82987 6.82529 9.75696 7.00237 9.75696 7.21362C9.75696 7.42489 9.82841 7.60343 9.97131 7.74927C10.1142 7.8951 10.2913 7.96802 10.5026 7.96802ZM10.5127 18.468C9.41165 18.468 8.37501 18.2597 7.40279 17.843C6.43057 17.4264 5.57987 16.8534 4.85071 16.1243C4.12154 15.3951 3.54862 14.5447 3.13196 13.5731C2.71529 12.6014 2.50696 11.5632 2.50696 10.4585C2.50696 9.35373 2.71529 8.31871 3.13196 7.35343C3.54862 6.38816 4.12154 5.54093 4.85071 4.81177C5.57987 4.0826 6.43028 3.50968 7.40192 3.09302C8.37357 2.67635 9.41176 2.46802 10.5165 2.46802C11.6213 2.46802 12.6563 2.67635 13.6215 3.09302C14.5868 3.50968 15.434 4.0826 16.1632 4.81177C16.8924 5.54093 17.4653 6.38971 17.882 7.3581C18.2986 8.3265 18.507 9.36123 18.507 10.4623C18.507 11.5633 18.2986 12.6 17.882 13.5722C17.4653 14.5444 16.8924 15.3951 16.1632 16.1243C15.434 16.8534 14.5853 17.4264 13.6169 17.843C12.6485 18.2597 11.6138 18.468 10.5127 18.468Z' fill='%231C1B1F'/%3E%3C/g%3E%3C/svg%3E%0A");
8
9
 
9
10
  @mixin mask($icon-url) {
10
11
  -webkit-mask-image: $icon-url;
@@ -50,19 +51,19 @@ $icon-close: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0
50
51
 
51
52
  @mixin icon-arrow-left-300 {
52
53
  @include with-icon;
53
- -webkit-mask-image: $icon-arrow-right-300;
54
- mask-image: $icon-arrow-right-300;
54
+ -webkit-mask-image: $icon-url-arrow-right-300;
55
+ mask-image: $icon-url-arrow-right-300;
55
56
  rotate: 180deg;
56
57
  }
57
58
 
58
59
  @mixin icon-arrow-right-500 {
59
60
  @include with-icon;
60
- -webkit-mask-image: $icon-arrow-right-500;
61
- mask-image: $icon-arrow-right-500;
61
+ -webkit-mask-image: $icon-url-arrow-right-500;
62
+ mask-image: $icon-url-arrow-right-500;
62
63
  }
63
64
 
64
65
  @mixin icon-close {
65
66
  @include with-icon;
66
- -webkit-mask-image: $icon-close;
67
- mask-image: $icon-close;
67
+ -webkit-mask-image: $icon-url-close;
68
+ mask-image: $icon-url-close;
68
69
  }
@@ -17,80 +17,15 @@ $space-48: 3rem;
17
17
  $space-64: 4rem;
18
18
  $space-80: 5rem;
19
19
 
20
- // Convinience map that stores every value. Used internally
21
- $_all_spaces: (
22
- 0: $space-0,
23
- 2: $space-2,
24
- 4: $space-4,
25
- 6: $space-6,
26
- 8: $space-8,
27
- 12: $space-12,
28
- 16: $space-16,
29
- 20: $space-20,
30
- 24: $space-24,
31
- 32: $space-32,
32
- 40: $space-40,
33
- 48: $space-48,
34
- 64: $space-64,
35
- 80: $space-80,
36
- );
37
-
38
- /// Converts a single KTH Style space value to rem.
39
- /// Throws an Error if the argument is not part of the valid spaces
40
- ///
41
- /// This function is used internally.
42
- @function _space_to_rem($space) {
43
- @if map.get($_all_spaces, $space) == null {
44
- @error "#{$space} is not a valid spacing. Use one of the following instead: #{$_all_spaces}";
45
- }
46
-
47
- @return map.get($_all_spaces, $space);
48
- }
49
-
50
- /// Converts a list of "KTH Style space" value to their rem values.
51
- /// Throws an Error if any element is not valid
52
- ///
53
- /// This function is used internally.
54
- @function _spaces_to_rem($list-of-spaces) {
55
- $list-of-rem: ();
56
-
57
- @each $element in $list-of-spaces {
58
- $list-of-rem: list.append($list-of-rem, _space_to_rem($element));
59
- }
60
-
61
- @return $list-of-rem;
62
- }
63
-
64
- /// Converts a list of "KTH Style padding" values to actual CSS measurements.
65
- @function padding($list) {
66
- @return _spaces_to_rem($list);
67
- }
68
-
69
- /// Converts a list of "KTH Style margin" values to actual CSS measurements..
70
- @function margin($list) {
71
- @return _spaces_to_rem($list);
72
- }
73
-
74
- /// Converts a list of "KTH Style gap" values to actual CSS measurements..
75
- @function gap($list) {
76
- @return _spaces_to_rem($list);
77
- }
78
-
79
- @function border-radius($list) {
80
- @return _spaces_to_rem($list);
81
- }
82
-
83
20
  // Semantic tokens for spacing
84
21
  @mixin theme-default {
85
22
  --space-inner-inline: #{$space-16};
86
23
  --space-inner-block: #{$space-8};
87
24
  --space-inner-icon: #{$space-8};
88
- --unboxed-padding-block: #{$space-8};
89
25
  }
90
26
 
91
27
  @mixin theme-dense {
92
28
  --space-inner-inline: #{$space-12};
93
29
  --space-inner-block: #{$space-4};
94
30
  --space-inner-icon: #{$space-4};
95
- --unboxed-padding-block: #{$space-4};
96
31
  }
@@ -1,3 +1,8 @@
1
+ /// These utilities are not categorized nor documented yet.
2
+ ///
3
+ /// Do not use it outside of @kth/style!!
4
+ /// This file is not subjected to semver rules. Breaking changes might occur
5
+ /// without major version upgrading
1
6
  @use "../tokens/spacing";
2
7
 
3
8
  @mixin horizontal-list {
@@ -26,27 +26,32 @@
26
26
 
27
27
  h1 {
28
28
  font: var(--font-heading-xl);
29
- margin: s.margin(0 0 16 0);
29
+ margin-block-start: s.$space-32;
30
+ margin-block-end: s.$space-16;
30
31
  }
31
32
 
32
33
  h2 {
33
34
  font: var(--font-heading-l);
34
- margin: s.margin(32 0 16 0);
35
+ margin-block-start: s.$space-32;
36
+ margin-block-end: s.$space-16;
35
37
  }
36
38
 
37
39
  h3 {
38
40
  font: var(--font-heading-m);
39
- margin: s.margin(32 0 8 0);
41
+ margin-block-start: s.$space-32;
42
+ margin-block-end: s.$space-8;
40
43
  }
41
44
 
42
45
  h4 {
43
46
  font: var(--font-heading-s);
44
- margin: s.margin(32 0 4 0);
47
+ margin-block-start: s.$space-32;
48
+ margin-block-end: s.$space-4;
45
49
  }
46
50
 
47
51
  li {
48
52
  max-width: 60ch;
49
- margin: s.margin(8 0);
53
+ margin-block: s.$space-8;
54
+ margin-inline: 0;
50
55
  }
51
56
 
52
57
  ol,
@@ -2,33 +2,19 @@
2
2
  @use "../tokens/spacing";
3
3
  @use "../tokens/colors";
4
4
 
5
+ /// When true, the file generates CSS code for the entire document
6
+ ///
7
+ /// Set to `false` when importing if you want to use the mixin but don't want
8
+ /// to apply reset to the entire document.
9
+ $generate-css: true !default;
10
+
5
11
  /// Based on https://andy-bell.co.uk/a-more-modern-css-reset/
6
- @layer kth-style {
12
+ @mixin reset {
7
13
  *,
8
14
  *::before,
9
15
  *::after {
10
16
  box-sizing: border-box;
11
17
  }
12
- html {
13
- -moz-text-size-adjust: none;
14
- -webkit-text-size-adjust: none;
15
- text-size-adjust: none;
16
- scrollbar-gutter: stable;
17
- }
18
-
19
- :root {
20
- @include colors.theme-default;
21
- @include spacing.theme-default;
22
- @include typography.theme-default;
23
- }
24
-
25
- body {
26
- color: var(--color-text);
27
- background: var(--color-background);
28
- font: var(--font-default);
29
- min-height: 100vh;
30
- margin: 0;
31
- }
32
18
 
33
19
  h1,
34
20
  h2,
@@ -50,6 +36,7 @@
50
36
  img,
51
37
  picture {
52
38
  max-width: 100%;
39
+ height: auto;
53
40
  }
54
41
 
55
42
  input,
@@ -59,3 +46,30 @@
59
46
  font: inherit;
60
47
  }
61
48
  }
49
+
50
+ @if $generate-css {
51
+ @layer kth-style {
52
+ html {
53
+ -moz-text-size-adjust: none;
54
+ -webkit-text-size-adjust: none;
55
+ text-size-adjust: none;
56
+ scrollbar-gutter: stable;
57
+ }
58
+
59
+ :root {
60
+ @include colors.theme-default;
61
+ @include spacing.theme-default;
62
+ @include typography.theme-default;
63
+ }
64
+
65
+ body {
66
+ color: var(--color-text);
67
+ background: var(--color-background);
68
+ font: var(--font-default);
69
+ min-height: 100vh;
70
+ margin: 0;
71
+ }
72
+
73
+ @include reset;
74
+ }
75
+ }
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- interface ButtonProps {
3
- /** The label of the button */
4
- children?: string;
5
- /** The callback function when the button is clicked */
6
- onClick?: () => void;
7
- /** Appearance */
8
- appearance: "primary" | "secondary" | "tertiary";
9
- }
10
- interface IconButtonProps {
11
- /** The label of the button */
12
- children?: string;
13
- /** The callback function when the button is clicked */
14
- onClick?: () => void;
15
- }
16
- /** A button with just text */
17
- export declare function Button({ children, onClick, appearance }: ButtonProps): React.JSX.Element;
18
- export declare function BackButton({ children, onClick }: IconButtonProps): React.JSX.Element;
19
- export declare function ForwardButton({ children, onClick }: IconButtonProps): React.JSX.Element;
20
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Add open/close functionality to a set of navigation panels
3
- */
4
- export declare function setModalNavigationPanels(items: NodeListOf<Element>): void;
@@ -1,7 +0,0 @@
1
- /**
2
- * Add open/close functionality to a set of navigation panels
3
- *
4
- * @param container The element containing all the menus
5
- * @param items A list of all menu elements
6
- */
7
- export declare function setNavigationPanels(container: HTMLElement | null, items: NodeListOf<Element>): void;
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- interface RadioGroupProps {
3
- /** Options */
4
- children: React.ReactElement<RadioProps> | React.ReactElement<RadioProps>[];
5
- /** The value of the selected radio button */
6
- value: string;
7
- /** The callback function when a different choice is made by the user */
8
- onChange: (value: string) => void;
9
- }
10
- interface RadioProps {
11
- /** The value of the radio button */
12
- value: string;
13
- /** The label of the radio button */
14
- label: string;
15
- }
16
- /** Implemented as fancy radio buttons */
17
- export declare function FilterTabs({ children, value, onChange }: RadioGroupProps): React.JSX.Element;
18
- /** A single radio button */
19
- export declare function Radio({ value, label }: RadioProps): React.JSX.Element;
20
- export {};
@@ -1,34 +0,0 @@
1
- import React from "react";
2
- interface SelectProps {
3
- /** Equivalent to HTML `name` */
4
- name: string;
5
- /** Label for the select */
6
- label: string;
7
- /** Select description */
8
- description?: string;
9
- /** Current value of the select field */
10
- value: string;
11
- /** Called when the select value changes */
12
- onChange(value: string): void;
13
- /** Options */
14
- children: React.ReactNode;
15
- /**
16
- * Error message if the field has errors. `undefined` here means the field
17
- * contains no error.
18
- */
19
- error?: string;
20
- }
21
- interface OptionProps {
22
- /** The value for the option */
23
- value: string;
24
- /** Human-readable label for the option */
25
- children: string;
26
- }
27
- interface OptionGroupProps {
28
- label: string;
29
- children: React.ReactNode;
30
- }
31
- export declare function Select({ name, label, description, value, onChange, children, error, }: SelectProps): React.JSX.Element;
32
- export declare function OptionGroup({ label, children }: OptionGroupProps): React.JSX.Element;
33
- export declare function Option({ value, children }: OptionProps): React.JSX.Element;
34
- export {};
@@ -1 +0,0 @@
1
- export declare function initTabs(container: Element): void;
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- /**
3
- * A panel with a button that opens it.
4
- *
5
- * - `children` is mounted the first time the dialog is opened. It is _not_
6
- * unmounted after the dialog is closed.
7
- */
8
- export declare function PersonalMenuPanel({ label, children }: {
9
- label: any;
10
- children: any;
11
- }): React.JSX.Element;
12
- interface PersonalMenuPanelGroupProps {
13
- children: React.ReactElement;
14
- }
15
- /**
16
- * Contains all <PersonalMenuPanel /> components in a menu
17
- */
18
- export declare function PersonalMenuPanelGroup({ children, }: PersonalMenuPanelGroupProps): React.JSX.Element;
19
- export {};
@@ -1,34 +0,0 @@
1
- import React from "react";
2
- interface TabProps {
3
- children?: React.ReactNode;
4
- id: string;
5
- title: string;
6
- }
7
- interface GenericTabsProps {
8
- classPrefix: string;
9
- children: React.ReactElement<TabProps>[];
10
- id: string;
11
- defaultValue?: string;
12
- url: "query" | "hash" | "none";
13
- }
14
- interface NavigationTabsProps {
15
- id: string;
16
- children: React.ReactElement<TabProps>[];
17
- url?: "query" | "none";
18
- defaultValue?: string;
19
- }
20
- interface ContentTabsProps {
21
- id: string;
22
- children: React.ReactElement<TabProps>[];
23
- url?: "hash" | "none";
24
- defaultValue?: string;
25
- }
26
- /**
27
- * Highly customizable Tabs component made for testing purposes.
28
- * You should use {@link NavigationTabs} or {@link ContentTabs} instead.
29
- */
30
- export declare function GenericTabs({ classPrefix, children, id, defaultValue, url, }: GenericTabsProps): React.JSX.Element;
31
- export declare function NavigationTabs({ id, children, url, defaultValue, }: NavigationTabsProps): React.JSX.Element;
32
- export declare function ContentTabs({ id, children, url, defaultValue, }: ContentTabsProps): React.JSX.Element;
33
- export declare function Tab({ children }: TabProps): React.JSX.Element;
34
- export {};
@@ -1,4 +0,0 @@
1
- import * as React from "react";
2
- import type { SVGProps } from "react";
3
- declare const SvgArrowBack: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
- export default SvgArrowBack;
@@ -1,4 +0,0 @@
1
- import * as React from "react";
2
- import type { SVGProps } from "react";
3
- declare const SvgCheck: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
- export default SvgCheck;
@@ -1,4 +0,0 @@
1
- import * as React from "react";
2
- import type { SVGProps } from "react";
3
- declare const SvgArrowForward: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
- export default SvgArrowForward;
@@ -1,14 +0,0 @@
1
- import type { StoryObj } from "@storybook/react";
2
- import { Button } from "../components/Button";
3
- import "../../scss/globals.scss";
4
- import "../../scss/components/button.scss";
5
- declare const meta: {
6
- title: string;
7
- component: typeof Button;
8
- tags: string[];
9
- };
10
- export default meta;
11
- type Story = StoryObj<typeof meta>;
12
- export declare const Primary: Story;
13
- export declare const Back: StoryObj;
14
- export declare const Forward: StoryObj;
@@ -1,12 +0,0 @@
1
- import type { StoryObj } from "@storybook/react";
2
- import "../../scss/globals.scss";
3
- import "../../scss/components/content-tabs.scss";
4
- declare const meta: {
5
- title: string;
6
- component: any;
7
- tags: string[];
8
- };
9
- export default meta;
10
- type Story = StoryObj<typeof meta>;
11
- export declare const Primary: Story;
12
- export declare const Secondary: Story;
@@ -1,12 +0,0 @@
1
- import type { StoryObj } from "@storybook/react";
2
- import { FilterTabs } from "../components/Radio";
3
- import "../../scss/globals.scss";
4
- import "../../scss/components/filter-tabs.scss";
5
- declare const meta: {
6
- title: string;
7
- component: typeof FilterTabs;
8
- tags: string[];
9
- };
10
- export default meta;
11
- type Story = StoryObj<typeof meta>;
12
- export declare const Primary: Story;
@@ -1,9 +0,0 @@
1
- import type { StoryObj } from "@storybook/react";
2
- import "../../scss/globals.scss";
3
- import "../../scss/components/inline-icon.scss";
4
- declare const meta: {
5
- title: string;
6
- tags: string[];
7
- };
8
- export default meta;
9
- export declare const CheckIcon: StoryObj;
@@ -1,14 +0,0 @@
1
- import type { StoryObj } from "@storybook/react";
2
- import { Select } from "../components/Select";
3
- import "../../scss/globals.scss";
4
- import "../../scss/components/form.scss";
5
- declare const meta: {
6
- title: string;
7
- component: typeof Select;
8
- tags: string[];
9
- };
10
- export default meta;
11
- type Story = StoryObj<typeof meta>;
12
- export declare const WithDescriptions: Story;
13
- export declare const WithoutDescriptions: Story;
14
- export declare const WithError: Story;
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- interface ButtonProps {
3
- /** The label of the button */
4
- children?: string;
5
- /** The callback function when the button is clicked */
6
- onClick?: () => void;
7
- /** Appearance */
8
- appearance: "primary" | "secondary" | "tertiary";
9
- }
10
- interface IconButtonProps {
11
- /** The label of the button */
12
- children?: string;
13
- /** The callback function when the button is clicked */
14
- onClick?: () => void;
15
- }
16
- /** A button with just text */
17
- export declare function Button({ children, onClick, appearance }: ButtonProps): React.JSX.Element;
18
- export declare function BackButton({ children, onClick }: IconButtonProps): React.JSX.Element;
19
- export declare function ForwardButton({ children, onClick }: IconButtonProps): React.JSX.Element;
20
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Add open/close functionality to a set of navigation panels
3
- */
4
- export declare function setModalNavigationPanels(items: NodeListOf<Element>): void;
@@ -1,7 +0,0 @@
1
- /**
2
- * Add open/close functionality to a set of navigation panels
3
- *
4
- * @param container The element containing all the menus
5
- * @param items A list of all menu elements
6
- */
7
- export declare function setNavigationPanels(container: HTMLElement | null, items: NodeListOf<Element>): void;
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- interface RadioGroupProps {
3
- /** Options */
4
- children: React.ReactElement<RadioProps> | React.ReactElement<RadioProps>[];
5
- /** The value of the selected radio button */
6
- value: string;
7
- /** The callback function when a different choice is made by the user */
8
- onChange: (value: string) => void;
9
- }
10
- interface RadioProps {
11
- /** The value of the radio button */
12
- value: string;
13
- /** The label of the radio button */
14
- label: string;
15
- }
16
- /** Implemented as fancy radio buttons */
17
- export declare function FilterTabs({ children, value, onChange }: RadioGroupProps): React.JSX.Element;
18
- /** A single radio button */
19
- export declare function Radio({ value, label }: RadioProps): React.JSX.Element;
20
- export {};