@kth/style 0.0.1-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @kth/style
2
+
3
+ **WORK IN PROGRESS**. Styles and components used across KTH.
4
+
5
+ ## Requirements
6
+
7
+ - Sass
8
+ - React
9
+
10
+ ## Getting started
11
+
12
+ 1. Install `@kth/style` from npm:
13
+
14
+ ```
15
+ npm i @kth/style
16
+ ```
17
+
18
+ 2. In your Sass file, import and include the sizes mixin:
19
+
20
+ ```scss
21
+ @use "node_modules/@kth/style/scss/utils" as sizes;
22
+
23
+ @include utils.sizes;
24
+ ```
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import "./button.css";
3
+ interface ButtonProps {
4
+ /**
5
+ * Is this the principal call to action on the page?
6
+ */
7
+ primary?: boolean;
8
+ /**
9
+ * What background color to use
10
+ */
11
+ backgroundColor?: string;
12
+ /**
13
+ * How large should the button be?
14
+ */
15
+ size?: "small" | "medium" | "large";
16
+ /**
17
+ * Button contents
18
+ */
19
+ label: string;
20
+ /**
21
+ * Optional click handler
22
+ */
23
+ onClick?: () => void;
24
+ }
25
+ /**
26
+ * Primary UI component for user interaction
27
+ */
28
+ export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => JSX.Element;
29
+ export {};
package/dist/Button.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = void 0;
4
+ const react_1 = require("react");
5
+ require("./button.css");
6
+ /**
7
+ * Primary UI component for user interaction
8
+ */
9
+ const Button = ({ primary = false, size = "medium", backgroundColor, label, ...props }) => {
10
+ const mode = primary
11
+ ? "storybook-button--primary"
12
+ : "storybook-button--secondary";
13
+ return (react_1.default.createElement("button", { type: "button", className: ["storybook-button", `storybook-button--${size}`, mode].join(" "), style: { backgroundColor }, ...props }, label));
14
+ };
15
+ exports.Button = Button;
package/dist/Tabs.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ export declare function NavigationTabs({ id, children, url, defaultValue, }: {
3
+ id: string;
4
+ children: React.ReactElement<TabProps>[];
5
+ url?: "query" | "none";
6
+ defaultValue?: string;
7
+ }): JSX.Element;
8
+ export declare function ContentTabs({ id, children, url, defaultValue, }: {
9
+ id: string;
10
+ children: React.ReactElement<TabProps>[];
11
+ url?: "hash" | "none";
12
+ defaultValue?: string;
13
+ }): JSX.Element;
14
+ interface TabProps {
15
+ children?: React.ReactNode;
16
+ id: string;
17
+ title: string;
18
+ }
19
+ export declare function Tab({ children, id }: TabProps): JSX.Element;
20
+ export {};
package/dist/Tabs.js ADDED
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tab = exports.ContentTabs = exports.NavigationTabs = void 0;
4
+ const react_1 = require("react");
5
+ /** Get current URL hash */
6
+ function useUrlHash() {
7
+ const [currentHash, setCurrentHash] = react_1.default.useState("");
8
+ react_1.default.useEffect(() => {
9
+ function updateValue(event) {
10
+ const hash = new URL(event?.newURL || location.href).hash.slice(1);
11
+ setCurrentHash(hash);
12
+ }
13
+ window.addEventListener("hashchange", updateValue);
14
+ updateValue();
15
+ return () => {
16
+ window.removeEventListener("hashchange", updateValue);
17
+ };
18
+ });
19
+ return currentHash;
20
+ }
21
+ /** Keep in sync the value of the query parameter `param` */
22
+ function useUrlQuery(param) {
23
+ const [value, _setValue] = react_1.default.useState("");
24
+ react_1.default.useEffect(() => {
25
+ function updateValue() {
26
+ const url = new URL(location.href);
27
+ const value = url.searchParams.get(param) || "";
28
+ _setValue(value);
29
+ }
30
+ window.addEventListener("popstate", updateValue);
31
+ updateValue();
32
+ return () => {
33
+ window.removeEventListener("popstate", updateValue);
34
+ };
35
+ }, [param]);
36
+ function setValue(newValue) {
37
+ const url = new URL(location.href);
38
+ url.searchParams.set(param, newValue);
39
+ history.pushState(undefined, "", url);
40
+ _setValue(newValue);
41
+ }
42
+ return [value, setValue];
43
+ }
44
+ function NavigationTabs({ id, children, url = "query", defaultValue, }) {
45
+ const containerRef = react_1.default.useRef(null);
46
+ const [queryTab, setQueryTab] = useUrlQuery(id);
47
+ const [manualTab, setManualTab] = react_1.default.useState(defaultValue || "");
48
+ const activeTab = url === "query" ? queryTab : manualTab;
49
+ let activeTabIndex = children.findIndex((c) => c.props.id === activeTab);
50
+ if (activeTabIndex === -1) {
51
+ activeTabIndex = 0;
52
+ }
53
+ return (react_1.default.createElement(react_1.default.Fragment, null,
54
+ react_1.default.createElement("div", { ref: containerRef, className: "kth-navigation-tabs", id: id },
55
+ react_1.default.createElement("ul", { className: "kth-navigation-tabs__tablist" }, children.map((child, index) => (react_1.default.createElement("li", { key: child.props.id },
56
+ react_1.default.createElement("button", { className: "kth-navigation-tabs__tab", "aria-selected": index === activeTabIndex, onClick: (event) => {
57
+ event.preventDefault();
58
+ if (url === "query") {
59
+ setQueryTab(child.props.id);
60
+ }
61
+ else {
62
+ setManualTab(child.props.id);
63
+ }
64
+ } }, child.props.title)))))),
65
+ children[activeTabIndex]));
66
+ }
67
+ exports.NavigationTabs = NavigationTabs;
68
+ function ContentTabs({ id, children, url = "hash", defaultValue, }) {
69
+ const containerRef = react_1.default.useRef(null);
70
+ const [manualActiveTab, setManualActiveTab] = react_1.default.useState("");
71
+ const hashActiveTab = useUrlHash() || defaultValue || "";
72
+ const activeTab = url === "hash" ? hashActiveTab : manualActiveTab;
73
+ let activeTabIndex = children.findIndex((c) => c.props.id === activeTab);
74
+ if (activeTabIndex === -1) {
75
+ activeTabIndex = 0;
76
+ }
77
+ return (react_1.default.createElement(react_1.default.Fragment, null,
78
+ react_1.default.createElement("div", { ref: containerRef, className: "kth-content-tabs", id: id },
79
+ react_1.default.createElement("ul", { className: "kth-content-tabs__tablist" }, children.map((child, index) => (react_1.default.createElement("li", { key: child.props.id },
80
+ react_1.default.createElement("a", { href: `#${child.props.id}`, className: "kth-content-tabs__tab", "aria-selected": index === activeTabIndex, onClick: (event) => {
81
+ if (url === "none") {
82
+ event.preventDefault();
83
+ setManualActiveTab(child.props.id);
84
+ }
85
+ } }, child.props.title)))))),
86
+ children[activeTabIndex]));
87
+ }
88
+ exports.ContentTabs = ContentTabs;
89
+ function Tab({ children, id }) {
90
+ return react_1.default.createElement("div", { id: id }, children);
91
+ }
92
+ exports.Tab = Tab;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@kth/style",
3
+ "version": "0.0.1-1",
4
+ "scripts": {
5
+ "clean": "rm -rf dist",
6
+ "dev": "storybook dev -p 6006",
7
+ "build": "npm run clean && npm run build:components && npm run build:storybook",
8
+ "build:components": "tsc",
9
+ "build:storybook": "storybook build -o ../../apps/style-web/public/storybook",
10
+ "test": "npm run test:lint",
11
+ "test:lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
12
+ },
13
+ "files": [
14
+ "scss",
15
+ "dist"
16
+ ],
17
+ "dependencies": {
18
+ "react": "^18.2.0",
19
+ "react-dom": "^18.2.0"
20
+ },
21
+ "devDependencies": {
22
+ "@storybook/addon-essentials": "^7.0.6",
23
+ "@storybook/addon-interactions": "^7.0.6",
24
+ "@storybook/addon-links": "^7.0.6",
25
+ "@storybook/blocks": "^7.0.6",
26
+ "@storybook/react": "^7.0.6",
27
+ "@storybook/react-vite": "^7.0.6",
28
+ "@storybook/testing-library": "^0.0.14-next.2",
29
+ "@types/react": "^18.0.28",
30
+ "@types/react-dom": "^18.0.11",
31
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
32
+ "@typescript-eslint/parser": "^5.57.1",
33
+ "@vitejs/plugin-react": "^4.0.0-beta.0",
34
+ "eslint": "^8.38.0",
35
+ "eslint-plugin-react-hooks": "^4.6.0",
36
+ "eslint-plugin-react-refresh": "^0.3.4",
37
+ "eslint-plugin-storybook": "^0.6.11",
38
+ "prop-types": "^15.8.1",
39
+ "storybook": "^7.0.6",
40
+ "typescript": "^5.0.2",
41
+ "vite": "^4.3.0"
42
+ }
43
+ }
@@ -0,0 +1,56 @@
1
+ @use "../tokens/" as t;
2
+
3
+ $border-secondary: 1px solid t.$color-neutral-10;
4
+
5
+ @layer kth-style {
6
+ .kth-content-tabs {
7
+ overflow: auto;
8
+ padding-block: t.$space-4;
9
+ }
10
+
11
+ .kth-content-tabs__tablist {
12
+ position: sticky;
13
+ list-style: none;
14
+ padding: 0;
15
+ margin: 0;
16
+ display: inline-flex;
17
+ flex-wrap: nowrap;
18
+ align-items: end;
19
+ gap: t.$space-4;
20
+ min-width: 100%;
21
+ border-block-end: $border-secondary;
22
+
23
+ li {
24
+ margin-bottom: -1px;
25
+ }
26
+ }
27
+ .kth-content-tabs__tab {
28
+ box-sizing: border-box;
29
+ padding-inline: var(--kth-0-button-padding-inline);
30
+ padding-block: calc(var(--kth-0-button-padding-block) - 1px);
31
+ border-block-width: 1px;
32
+ white-space: nowrap;
33
+ display: block;
34
+ text-decoration: none;
35
+ margin-block-end: -1px;
36
+ color: t.$color-neutral-10;
37
+ border: $border-secondary;
38
+ border-radius: t.border-radius(8 8 0 0);
39
+
40
+ &:hover {
41
+ text-decoration: underline;
42
+ }
43
+
44
+ &[aria-selected="false"] {
45
+ background: t.$color-neutral-2;
46
+ }
47
+
48
+ &[aria-selected="true"] {
49
+ background: t.$color-neutral-0;
50
+ padding-block-start: calc(
51
+ var(--kth-0-button-padding-block) + #{t.$space-8} - 1px
52
+ );
53
+ border-block-end-color: transparent;
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,49 @@
1
+ @use "../tokens/" as t;
2
+
3
+ $border-secondary: 1px solid t.$color-neutral-10;
4
+
5
+ @layer kth-style {
6
+ .kth-navigation-tabs {
7
+ overflow: auto;
8
+ }
9
+
10
+ .kth-navigation-tabs__tablist {
11
+ list-style: none;
12
+ padding: 0;
13
+ margin: 0;
14
+ display: inline-flex;
15
+ flex-wrap: nowrap;
16
+ align-items: end;
17
+ gap: t.$space-4;
18
+ min-width: 100%;
19
+ border-block-end: $border-secondary;
20
+ }
21
+
22
+ .kth-navigation-tabs__tab {
23
+ font: inherit;
24
+ background: none;
25
+ border: none;
26
+ box-sizing: border-box;
27
+ padding-inline: var(--kth-0-button-padding-inline);
28
+ padding-block: var(--kth-0-button-padding-block);
29
+ white-space: nowrap;
30
+ display: block;
31
+ text-decoration: none;
32
+ color: t.$color-neutral-10;
33
+ margin-block-end: -1px;
34
+
35
+ &:hover {
36
+ text-decoration: underline;
37
+ }
38
+
39
+ &[aria-selected="false"] {
40
+ color: t.$color-neutral-10;
41
+ }
42
+
43
+ &[aria-selected="true"] {
44
+ color: t.$color-primary-5;
45
+ padding-block-end: calc(var(--kth-0-button-padding-block) - 3px);
46
+ border-block-end: 3px t.$color-primary-5 solid;
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,5 @@
1
+ @use "utils/reset";
2
+ @use "utils/sizes";
3
+
4
+ @include reset.reset();
5
+ @include sizes.sizes();
@@ -0,0 +1,20 @@
1
+ // 1. Colors
2
+ $color-neutral-10: #000;
3
+ $color-neutral-6: #65656c;
4
+ $color-neutral-2: #d4d4d4;
5
+ $color-neutral-1: #f6f6f6;
6
+ $color-neutral-0: #fff;
7
+
8
+ $color-primary-6: #006388;
9
+ $color-primary-5: #007fae;
10
+
11
+ $color-success-6: #3f6600;
12
+ $color-success-5: #528400;
13
+ $color-success-1: #dff0d8;
14
+
15
+ $color-danger-6: #b52c17;
16
+ $color-danger-5: #d4351c;
17
+ $color-danger-1: #f5e6e6;
18
+
19
+ $color-warning-3: #fab919;
20
+ $color-warning-1: #fcf8e3;
@@ -0,0 +1,40 @@
1
+ ---
2
+ lang: en
3
+ ---
4
+
5
+ # How to use
6
+
7
+ We provide two ways for consuming these values:
8
+
9
+ - With the utility functions `padding`, `margin` and `gap`
10
+ - With the variables `$space-<number>`
11
+
12
+ ## Utility functions `padding`, `margin` and `gap`
13
+
14
+ All three functions accept an arbitrary number of arguments, so they can be used in shorthand and non-shorthand CSS properties.
15
+
16
+ ```scss
17
+ @use "@kth/style/scss/tokens" as t;
18
+
19
+ .an-element {
20
+ // Passing two values at the same time
21
+ padding: t.padding(2 8);
22
+
23
+ // Passing one value only
24
+ margin-inline-end: t.margin(0);
25
+ }
26
+ ```
27
+
28
+ All three functions will throw an error if the passed value is invalid. Accepted values are: 0, 2, 4, 6, 8, 12, 16, 20, 24, 32, 40, 48, 64 and 80.
29
+
30
+ ## Variables `$space-<value>`
31
+
32
+ This package also exports variables named `$space-<value>` (example: `$space-2`) which can be convenient if you need a single value.
33
+
34
+ ```scss
35
+ @use "@kth/style/scss/tokens" as t;
36
+
37
+ .an-element {
38
+ padding-top: t.$space-4;
39
+ }
40
+ ```
@@ -0,0 +1,81 @@
1
+ @use "sass:list";
2
+ @use "sass:map";
3
+ /// Design Tokens for spacing
4
+
5
+ $space-0: 0;
6
+ $space-2: 0.125rem;
7
+ $space-4: 0.25rem;
8
+ $space-6: 0.375rem;
9
+ $space-8: 0.5rem;
10
+ $space-12: 0.75rem;
11
+ $space-16: 1rem;
12
+ $space-20: 1.25rem;
13
+ $space-24: 1.5rem;
14
+ $space-32: 2rem;
15
+ $space-40: 2.5rem;
16
+ $space-48: 3rem;
17
+ $space-64: 4rem;
18
+ $space-80: 5rem;
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
+ }
@@ -0,0 +1,70 @@
1
+ // 2. Typography
2
+
3
+ // Base tokens
4
+ // All allowed single values for different properties
5
+ // Name convention: `font-<property>-identifier`
6
+ $font-family-sans: "Open Sans", sans-serif;
7
+ $font-family-serif: Georgia, serif;
8
+
9
+ // 2.2. Font sizes
10
+ $font-size-base: 1rem;
11
+ $font-size-l: 1.25rem;
12
+ $font-size-xl: 1.5rem;
13
+ $font-size-2xl: 1.875rem;
14
+ $font-size-3xl: 2.75rem;
15
+
16
+ // 2.3. Line heights
17
+ $font-lh-base: 1.5rem;
18
+ $font-lh-l: 2rem;
19
+ $font-lh-xl: 2.25rem;
20
+ $font-lh-2xl: 3rem;
21
+ $font-lh-3xl: 4rem;
22
+
23
+ // 2.4. Font weights
24
+ $font-weight-normal: 400;
25
+ $font-weight-bold: 600;
26
+
27
+ // 2.5. Combinations of font size, line height and font weight
28
+ @mixin font-h1 {
29
+ font-weight: $font-weight-bold;
30
+ font-size: $font-size-3xl;
31
+ line-height: $font-lh-3xl;
32
+ }
33
+
34
+ @mixin font-h2 {
35
+ font-weight: $font-weight-bold;
36
+ font-size: $font-size-2xl;
37
+ line-height: $font-lh-2xl;
38
+ }
39
+
40
+ @mixin font-h3 {
41
+ font-weight: $font-weight-bold;
42
+ font-size: $font-size-xl;
43
+ line-height: $font-lh-xl;
44
+ }
45
+
46
+ @mixin font-h4 {
47
+ font-weight: $font-weight-bold;
48
+ font-size: $font-size-l;
49
+ line-height: $font-lh-l;
50
+ }
51
+
52
+ @mixin font-h5 {
53
+ font-weight: $font-weight-bold;
54
+ font-size: $font-size-base;
55
+ line-height: $font-lh-base;
56
+ }
57
+
58
+ @mixin font-body-copy {
59
+ font-family: $font-serif;
60
+ font-weight: 400;
61
+ font-size: g.rem(18);
62
+ line-height: g.rem(28);
63
+ }
64
+
65
+ @mixin font-body-lead {
66
+ font-family: $font-serif;
67
+ font-weight: 400;
68
+ font-size: g.rem(22);
69
+ line-height: g.rem(32);
70
+ }
@@ -0,0 +1,6 @@
1
+ /// List of all KTH Style Design Tokens
2
+ @forward "./typography";
3
+ @forward "./spacing";
4
+ @forward "./colors";
5
+
6
+ @use "./spacing" as spacing;
@@ -0,0 +1,244 @@
1
+ @use "../tokens/index.scss" as t;
2
+
3
+ /// Adaptation of normalize.css v8.0.1
4
+ /// github.com/necolas/normalize.css
5
+ ///
6
+ /// The aim of this mixin is to normalize all browsers and at the same time
7
+ /// provide basic global styles for everything
8
+ ///
9
+ /// Use this mixin if you wanted a **scoped** version of the mixin, i.e., if you
10
+ /// want the reset to be applied to a part of the document.
11
+ ///
12
+ /// If you want a global version of this, use the `reset` file outside of the
13
+ /// `globals` directory
14
+ @mixin reset {
15
+ // HTML
16
+ // 1. Prevent adjustments of font size after orientation changes in iOS.
17
+ html {
18
+ line-height: t.$font-lh-base;
19
+ -webkit-text-size-adjust: 100%; /* 1 */
20
+ }
21
+
22
+ /* Sections
23
+ ========================================================================== */
24
+
25
+ // Body
26
+ // 1. Remove the margin in all browsers
27
+ // 2. Default fonts
28
+ body {
29
+ margin: 0;
30
+ font-family: t.$font-family-sans;
31
+ font-weight: t.$font-weight-normal;
32
+ line-height: t.$font-lh-base;
33
+ }
34
+
35
+ h1 {
36
+ @include t.font-h1();
37
+ }
38
+
39
+ h2 {
40
+ @include t.font-h2();
41
+ }
42
+
43
+ h3 {
44
+ @include t.font-h3();
45
+ }
46
+
47
+ h4 {
48
+ @include t.font-h4();
49
+ }
50
+
51
+ h5,
52
+ h6 {
53
+ @include t.font-h5();
54
+ }
55
+
56
+ /* Grouping content
57
+ ========================================================================== */
58
+
59
+ // 1. Add the correct box sizing in Firefox.
60
+ // 2. Show the overflow in Edge and IE.
61
+ hr {
62
+ box-sizing: content-box; /* 1 */
63
+ height: 0; /* 1 */
64
+ overflow: visible; /* 2 */
65
+ }
66
+
67
+ // 1. Correct the inheritance and scaling of font size in all browsers.
68
+ // 2. Correct the odd `em` font sizing in all browsers.
69
+ pre {
70
+ font-family: monospace, monospace; /* 1 */
71
+ font-size: 1em; /* 2 */
72
+ }
73
+
74
+ /* Text-level semantics
75
+ ========================================================================== */
76
+ a {
77
+ // color: t.$color-blue-5;
78
+ text-decoration: none;
79
+
80
+ &:hover {
81
+ text-decoration: underline;
82
+ }
83
+ }
84
+
85
+ // 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
86
+ abbr[title] {
87
+ text-decoration: underline; /* 2 */
88
+ text-decoration: underline dotted; /* 2 */
89
+ }
90
+
91
+ b,
92
+ strong {
93
+ font-weight: t.$font-weight-bold;
94
+ }
95
+
96
+ // 1. Correct the inheritance and scaling of font size in all browsers.
97
+ // 2. Correct the odd `em` font sizing in all browsers.
98
+ code,
99
+ kbd,
100
+ samp {
101
+ font-family: monospace, monospace; /* 1 */
102
+ font-size: 1em; /* 2 */
103
+ }
104
+
105
+ small {
106
+ // TODO: This is the default in normalize.css. Define the right one
107
+ font-size: 80%;
108
+ }
109
+
110
+ // Prevent `sub` and `sup` elements from affecting the line height in all browsers.
111
+ sub,
112
+ sup {
113
+ font-size: 75%;
114
+ line-height: 0;
115
+ position: relative;
116
+ vertical-align: baseline;
117
+ }
118
+
119
+ sub {
120
+ bottom: -0.25em;
121
+ }
122
+
123
+ sup {
124
+ top: -0.5em;
125
+ }
126
+
127
+ /* Forms
128
+ ========================================================================== */
129
+
130
+ // 1. Change the font styles in all browsers.
131
+ // 2. Remove the margin in Firefox and Safari.
132
+ button,
133
+ input,
134
+ optgroup,
135
+ select,
136
+ textarea {
137
+ font-family: inherit; /* 1 */
138
+ font-size: 100%; /* 1 */
139
+ line-height: t.$font-lh-base; /* 1 */
140
+ margin: 0; /* 2 */
141
+ }
142
+
143
+ // Remove the inheritance of text transform in Edge, Firefox, and IE.
144
+ // Remove the inheritance of text transform in Firefox.
145
+ button,
146
+ select {
147
+ /* 1 */
148
+ text-transform: none;
149
+ }
150
+
151
+ // Correct the inability to style clickable types in iOS and Safari.
152
+ button,
153
+ [type="button"],
154
+ [type="reset"],
155
+ [type="submit"] {
156
+ -webkit-appearance: button;
157
+ }
158
+
159
+ // Remove the inner border and padding in Firefox.
160
+ button::-moz-focus-inner,
161
+ [type="button"]::-moz-focus-inner,
162
+ [type="reset"]::-moz-focus-inner,
163
+ [type="submit"]::-moz-focus-inner {
164
+ border-style: none;
165
+ padding: 0;
166
+ }
167
+
168
+ // Restore the focus styles unset by the previous rule.
169
+ button:-moz-focusring,
170
+ [type="button"]:-moz-focusring,
171
+ [type="reset"]:-moz-focusring,
172
+ [type="submit"]:-moz-focusring {
173
+ outline: 1px dotted ButtonText;
174
+ }
175
+
176
+ // Correct the padding in Firefox.
177
+ fieldset {
178
+ // TODO: unifiy with our own values
179
+ padding: 0.35em 0.75em 0.625em;
180
+ }
181
+
182
+ // 1. Correct the text wrapping in Edge and IE.
183
+ // 2. Correct the color inheritance from `fieldset` elements in IE.
184
+ // 3. Remove the padding so developers are not caught out when they zero out
185
+ // `fieldset` elements in all browsers.
186
+ legend {
187
+ box-sizing: border-box; /* 1 */
188
+ color: inherit; /* 2 */
189
+ display: table; /* 1 */
190
+ max-width: 100%; /* 1 */
191
+ padding: 0; /* 3 */
192
+ white-space: normal; /* 1 */
193
+ }
194
+
195
+ // Add the correct vertical alignment in Chrome, Firefox, and Opera.
196
+ progress {
197
+ vertical-align: baseline;
198
+ }
199
+
200
+ // Correct the cursor style of increment and decrement buttons in Chrome.
201
+ [type="number"]::-webkit-inner-spin-button,
202
+ [type="number"]::-webkit-outer-spin-button {
203
+ height: auto;
204
+ }
205
+
206
+ // 1. Correct the odd appearance in Chrome and Safari.
207
+ // 2. Correct the outline style in Safari.
208
+ [type="search"] {
209
+ -webkit-appearance: textfield; /* 1 */
210
+ outline-offset: -2px; /* 2 */
211
+ }
212
+
213
+ // Remove the inner padding in Chrome and Safari on macOS.
214
+ [type="search"]::-webkit-search-decoration {
215
+ -webkit-appearance: none;
216
+ }
217
+
218
+ // 1. Correct the inability to style clickable types in iOS and Safari.
219
+ // 2. Change font properties to `inherit` in Safari.
220
+ ::-webkit-file-upload-button {
221
+ -webkit-appearance: button; /* 1 */
222
+ font: inherit; /* 2 */
223
+ }
224
+
225
+ /* Interactive
226
+ ========================================================================== */
227
+ // Add the correct display in Edge, IE 10+, and Firefox.
228
+ details {
229
+ display: block;
230
+ }
231
+
232
+ // Add the correct display in all browsers.
233
+ summary {
234
+ display: list-item;
235
+ }
236
+
237
+ /* Misc
238
+ ========================================================================== */
239
+
240
+ // Add the correct display
241
+ [hidden] {
242
+ display: none;
243
+ }
244
+ }
@@ -0,0 +1,19 @@
1
+ @use "../tokens" as t;
2
+
3
+ @mixin sizes {
4
+ :root {
5
+ // Padding (block and inline axis) for clickable elements
6
+ --kth-0-button-padding-block: #{t.$space-8};
7
+ --kth-0-button-padding-inline: #{t.$space-16};
8
+ }
9
+
10
+ .kth-0-normal {
11
+ --kth-0-button-padding-block: #{t.$space-8};
12
+ --kth-0-button-padding-inline: #{t.$space-16};
13
+ }
14
+
15
+ .kth-0-small {
16
+ --kth-0-button-padding-block: #{t.$space-4};
17
+ --kth-0-button-padding-inline: #{t.$space-12};
18
+ }
19
+ }