@kth/style 0.0.7 → 0.0.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.
- package/dist/cjs/components/Button.d.ts +20 -0
- package/dist/cjs/components/Select.d.ts +6 -1
- package/dist/cjs/icons/400/ArrowBack.d.ts +3 -0
- package/dist/cjs/icons/400/Check.d.ts +3 -0
- package/dist/cjs/icons/500/ArrowForward.d.ts +3 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +53 -2
- package/dist/cjs/stories/Button.stories.d.ts +14 -0
- package/dist/cjs/stories/InlineIcons.stories.d.ts +9 -0
- package/dist/cjs/stories/Select.stories.d.ts +2 -1
- package/dist/esm/components/Button.d.ts +20 -0
- package/dist/esm/components/Select.d.ts +6 -1
- package/dist/esm/icons/400/ArrowBack.d.ts +3 -0
- package/dist/esm/icons/400/Check.d.ts +3 -0
- package/dist/esm/icons/500/ArrowForward.d.ts +3 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +48 -20
- package/dist/esm/stories/Button.stories.d.ts +14 -0
- package/dist/esm/stories/InlineIcons.stories.d.ts +9 -0
- package/dist/esm/stories/Select.stories.d.ts +2 -1
- package/package.json +3 -2
- package/scss/components/button.scss +25 -5
- package/scss/components/form.scss +16 -1
- package/scss/components/inline-icon.scss +7 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="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): JSX.Element;
|
|
18
|
+
export declare function BackButton({ children, onClick }: IconButtonProps): JSX.Element;
|
|
19
|
+
export declare function ForwardButton({ children, onClick }: IconButtonProps): JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -12,6 +12,11 @@ interface SelectProps {
|
|
|
12
12
|
onChange(value: string): void;
|
|
13
13
|
/** Options */
|
|
14
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;
|
|
15
20
|
}
|
|
16
21
|
interface OptionProps {
|
|
17
22
|
/** The value for the option */
|
|
@@ -23,7 +28,7 @@ interface OptionGroupProps {
|
|
|
23
28
|
label: string;
|
|
24
29
|
children: React.ReactNode;
|
|
25
30
|
}
|
|
26
|
-
export declare function Select({ name, label, description, value, onChange, children, }: SelectProps): JSX.Element;
|
|
31
|
+
export declare function Select({ name, label, description, value, onChange, children, error, }: SelectProps): JSX.Element;
|
|
27
32
|
export declare function OptionGroup({ label, children }: OptionGroupProps): JSX.Element;
|
|
28
33
|
export declare function Option({ value, children }: OptionProps): JSX.Element;
|
|
29
34
|
export {};
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { Tab, ContentTabs, NavigationTabs } from "./components/Tabs";
|
|
2
2
|
export { Select, Option, OptionGroup } from "./components/Select";
|
|
3
|
+
export { BackButton, Button, ForwardButton } from "./components/Button";
|
|
4
|
+
export { default as IconArrowBack } from "./icons/400/ArrowBack";
|
|
5
|
+
export { default as IconCheck } from "./icons/400/Check";
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
var n = Object.create(null);
|
|
7
|
+
if (e) {
|
|
8
|
+
Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default') {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
23
|
+
|
|
5
24
|
function getValueFromUrl(key) {
|
|
6
25
|
const url = new URL(location.href);
|
|
7
26
|
if (key) {
|
|
@@ -107,12 +126,13 @@ function Tab({ children }) {
|
|
|
107
126
|
return React.createElement(React.Fragment, null, children);
|
|
108
127
|
}
|
|
109
128
|
|
|
110
|
-
function Select({ name, label, description, value, onChange, children, }) {
|
|
129
|
+
function Select({ name, label, description, value, onChange, children, error, }) {
|
|
111
130
|
const id = `select-${name}`;
|
|
112
131
|
return (React.createElement("div", { className: "kth-select" },
|
|
113
132
|
React.createElement("label", { htmlFor: id }, label),
|
|
114
133
|
description && React.createElement("p", { id: `${id}-description` }, description),
|
|
115
|
-
React.createElement("select", { id: id, "aria-describedby": description && `${id}-description`, name: name, value: value, onChange: (e) => onChange(e.target.value) }, children)
|
|
134
|
+
React.createElement("select", { id: id, "aria-describedby": description && `${id}-description`, name: name, value: value, onChange: (e) => onChange(e.target.value), "aria-invalid": error !== undefined ? "true" : "false" }, children),
|
|
135
|
+
error && (React.createElement("p", { className: "kth-select__error", role: "alert" }, error))));
|
|
116
136
|
}
|
|
117
137
|
function OptionGroup({ label, children }) {
|
|
118
138
|
return React.createElement("optgroup", { label: label }, children);
|
|
@@ -121,7 +141,38 @@ function Option({ value, children }) {
|
|
|
121
141
|
return React.createElement("option", { value: value }, children);
|
|
122
142
|
}
|
|
123
143
|
|
|
144
|
+
const SvgArrowBack = (props) => (React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1.25em", height: "1.25em", viewBox: "0 0 20 20", ...props },
|
|
145
|
+
React__namespace.createElement("path", { fill: "currentColor", d: "m10 16-6-6 6-6 1.063 1.063L6.875 9.25H16v1.5H6.875l4.188 4.188L10 16Z" })));
|
|
146
|
+
|
|
147
|
+
const SvgArrowForward = (props) => (React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1.25em", height: "1.25em", viewBox: "0 0 20 20", ...props },
|
|
148
|
+
React__namespace.createElement("path", { fill: "currentColor", d: "m10 16.075-1.227-1.227 3.983-3.983h-8.83v-1.73h8.83L8.773 5.152 10 3.925 16.075 10 10 16.075Z" })));
|
|
149
|
+
|
|
150
|
+
/** A button with just text */
|
|
151
|
+
function Button({ children, onClick, appearance }) {
|
|
152
|
+
const className = ["kth-button", appearance].join(" ");
|
|
153
|
+
return (React.createElement("button", { onClick: onClick, className: className }, children));
|
|
154
|
+
}
|
|
155
|
+
function BackButton({ children, onClick }) {
|
|
156
|
+
return (React.createElement("button", { onClick: onClick, className: "kth-button tertiary" },
|
|
157
|
+
React.createElement(SvgArrowBack, null),
|
|
158
|
+
children));
|
|
159
|
+
}
|
|
160
|
+
function ForwardButton({ children, onClick }) {
|
|
161
|
+
return (React.createElement("button", { onClick: onClick, className: "kth-button primary" },
|
|
162
|
+
children,
|
|
163
|
+
React.createElement(SvgArrowForward, null)));
|
|
164
|
+
}
|
|
165
|
+
// export function NextButton() {}
|
|
166
|
+
|
|
167
|
+
const SvgCheck = (props) => (React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1.25em", height: "1.25em", viewBox: "0 0 20 20", ...props },
|
|
168
|
+
React__namespace.createElement("path", { fill: "currentColor", d: "M8.23 14.063 4.707 10.52 5.75 9.479l2.48 2.459 6.02-6L15.292 7l-7.063 7.063Z" })));
|
|
169
|
+
|
|
170
|
+
exports.BackButton = BackButton;
|
|
171
|
+
exports.Button = Button;
|
|
124
172
|
exports.ContentTabs = ContentTabs;
|
|
173
|
+
exports.ForwardButton = ForwardButton;
|
|
174
|
+
exports.IconArrowBack = SvgArrowBack;
|
|
175
|
+
exports.IconCheck = SvgCheck;
|
|
125
176
|
exports.NavigationTabs = NavigationTabs;
|
|
126
177
|
exports.Option = Option;
|
|
127
178
|
exports.OptionGroup = OptionGroup;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
import { Select } from "../components/Select";
|
|
3
3
|
import "../../scss/globals.scss";
|
|
4
|
-
import "../../scss/components/
|
|
4
|
+
import "../../scss/components/form.scss";
|
|
5
5
|
declare const meta: {
|
|
6
6
|
title: string;
|
|
7
7
|
component: typeof Select;
|
|
@@ -11,3 +11,4 @@ export default meta;
|
|
|
11
11
|
type Story = StoryObj<typeof meta>;
|
|
12
12
|
export declare const WithDescriptions: Story;
|
|
13
13
|
export declare const WithoutDescriptions: Story;
|
|
14
|
+
export declare const WithError: Story;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="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): JSX.Element;
|
|
18
|
+
export declare function BackButton({ children, onClick }: IconButtonProps): JSX.Element;
|
|
19
|
+
export declare function ForwardButton({ children, onClick }: IconButtonProps): JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -12,6 +12,11 @@ interface SelectProps {
|
|
|
12
12
|
onChange(value: string): void;
|
|
13
13
|
/** Options */
|
|
14
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;
|
|
15
20
|
}
|
|
16
21
|
interface OptionProps {
|
|
17
22
|
/** The value for the option */
|
|
@@ -23,7 +28,7 @@ interface OptionGroupProps {
|
|
|
23
28
|
label: string;
|
|
24
29
|
children: React.ReactNode;
|
|
25
30
|
}
|
|
26
|
-
export declare function Select({ name, label, description, value, onChange, children, }: SelectProps): JSX.Element;
|
|
31
|
+
export declare function Select({ name, label, description, value, onChange, children, error, }: SelectProps): JSX.Element;
|
|
27
32
|
export declare function OptionGroup({ label, children }: OptionGroupProps): JSX.Element;
|
|
28
33
|
export declare function Option({ value, children }: OptionProps): JSX.Element;
|
|
29
34
|
export {};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { Tab, ContentTabs, NavigationTabs } from "./components/Tabs";
|
|
2
2
|
export { Select, Option, OptionGroup } from "./components/Select";
|
|
3
|
+
export { BackButton, Button, ForwardButton } from "./components/Button";
|
|
4
|
+
export { default as IconArrowBack } from "./icons/400/ArrowBack";
|
|
5
|
+
export { default as IconCheck } from "./icons/400/Check";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
2
3
|
|
|
3
4
|
function getValueFromUrl(key) {
|
|
4
5
|
const url = new URL(location.href);
|
|
@@ -18,8 +19,8 @@ function getValueFromUrl(key) {
|
|
|
18
19
|
*/
|
|
19
20
|
function useUrlState(defaultValue = "", key = "", enableUrl = false) {
|
|
20
21
|
const initialValue = (enableUrl && getValueFromUrl(key)) || defaultValue;
|
|
21
|
-
const [value, _setValue] =
|
|
22
|
-
|
|
22
|
+
const [value, _setValue] = React__default.useState(initialValue);
|
|
23
|
+
React__default.useEffect(() => {
|
|
23
24
|
function updateValue() {
|
|
24
25
|
if (enableUrl) {
|
|
25
26
|
_setValue(getValueFromUrl(key) || defaultValue);
|
|
@@ -77,46 +78,73 @@ function useFocus(element) {
|
|
|
77
78
|
* You should use {@link NavigationTabs} or {@link ContentTabs} instead.
|
|
78
79
|
*/
|
|
79
80
|
function GenericTabs({ classPrefix, children, id, defaultValue, url = "none", }) {
|
|
80
|
-
const ref =
|
|
81
|
+
const ref = React__default.useRef(null);
|
|
81
82
|
const [activeTab, setActiveTab] = useUrlState(defaultValue, url === "query" ? id : "", url === "query" || url === "hash");
|
|
82
83
|
let activeTabIndex = children.findIndex((c) => c.props.id === activeTab);
|
|
83
84
|
if (activeTabIndex === -1) {
|
|
84
85
|
activeTabIndex = 0;
|
|
85
86
|
}
|
|
86
87
|
useFocus(ref.current?.querySelector(`#${activeTab}-tab`));
|
|
87
|
-
return (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
89
|
+
React__default.createElement("div", { ref: ref, className: `${classPrefix}`, id: id },
|
|
90
|
+
React__default.createElement("ul", { className: `${classPrefix}__tablist`, role: "tablist" }, children.map((child, index) => (React__default.createElement("li", { role: "presentation", className: `${classPrefix}__tab-element` },
|
|
91
|
+
React__default.createElement("button", { key: child.props.id, role: "tab", "aria-selected": index === activeTabIndex, "aria-controls": child.props.id, id: `${child.props.id}-tab`, className: `${classPrefix}__tab`, tabIndex: index === activeTabIndex ? 0 : -1, onKeyDown: (event) => {
|
|
91
92
|
handleKeyDown(event, index, children, setActiveTab);
|
|
92
93
|
}, onClick: (event) => {
|
|
93
94
|
event.preventDefault();
|
|
94
95
|
setActiveTab(child.props.id);
|
|
95
96
|
} }, child.props.title)))))),
|
|
96
|
-
children.map((child, index) => (
|
|
97
|
+
children.map((child, index) => (React__default.createElement("div", { className: `${classPrefix}__tabpanel`, role: "tabpanel", "aria-labelledby": `${child.props.id}-tab`, id: child.props.id, key: index, hidden: index !== activeTabIndex }, child)))));
|
|
97
98
|
}
|
|
98
99
|
function NavigationTabs({ id, children, url = "query", defaultValue, }) {
|
|
99
|
-
return (
|
|
100
|
+
return (React__default.createElement(GenericTabs, { id: id, children: children, url: url, defaultValue: defaultValue, classPrefix: "kth-navigation-tabs" }));
|
|
100
101
|
}
|
|
101
102
|
function ContentTabs({ id, children, url = "hash", defaultValue, }) {
|
|
102
|
-
return (
|
|
103
|
+
return (React__default.createElement(GenericTabs, { id: id, children: children, url: url, defaultValue: defaultValue, classPrefix: "kth-content-tabs" }));
|
|
103
104
|
}
|
|
104
105
|
function Tab({ children }) {
|
|
105
|
-
return
|
|
106
|
+
return React__default.createElement(React__default.Fragment, null, children);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
function Select({ name, label, description, value, onChange, children, }) {
|
|
109
|
+
function Select({ name, label, description, value, onChange, children, error, }) {
|
|
109
110
|
const id = `select-${name}`;
|
|
110
|
-
return (
|
|
111
|
-
|
|
112
|
-
description &&
|
|
113
|
-
|
|
111
|
+
return (React__default.createElement("div", { className: "kth-select" },
|
|
112
|
+
React__default.createElement("label", { htmlFor: id }, label),
|
|
113
|
+
description && React__default.createElement("p", { id: `${id}-description` }, description),
|
|
114
|
+
React__default.createElement("select", { id: id, "aria-describedby": description && `${id}-description`, name: name, value: value, onChange: (e) => onChange(e.target.value), "aria-invalid": error !== undefined ? "true" : "false" }, children),
|
|
115
|
+
error && (React__default.createElement("p", { className: "kth-select__error", role: "alert" }, error))));
|
|
114
116
|
}
|
|
115
117
|
function OptionGroup({ label, children }) {
|
|
116
|
-
return
|
|
118
|
+
return React__default.createElement("optgroup", { label: label }, children);
|
|
117
119
|
}
|
|
118
120
|
function Option({ value, children }) {
|
|
119
|
-
return
|
|
121
|
+
return React__default.createElement("option", { value: value }, children);
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
|
|
124
|
+
const SvgArrowBack = (props) => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1.25em", height: "1.25em", viewBox: "0 0 20 20", ...props },
|
|
125
|
+
React.createElement("path", { fill: "currentColor", d: "m10 16-6-6 6-6 1.063 1.063L6.875 9.25H16v1.5H6.875l4.188 4.188L10 16Z" })));
|
|
126
|
+
|
|
127
|
+
const SvgArrowForward = (props) => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1.25em", height: "1.25em", viewBox: "0 0 20 20", ...props },
|
|
128
|
+
React.createElement("path", { fill: "currentColor", d: "m10 16.075-1.227-1.227 3.983-3.983h-8.83v-1.73h8.83L8.773 5.152 10 3.925 16.075 10 10 16.075Z" })));
|
|
129
|
+
|
|
130
|
+
/** A button with just text */
|
|
131
|
+
function Button({ children, onClick, appearance }) {
|
|
132
|
+
const className = ["kth-button", appearance].join(" ");
|
|
133
|
+
return (React__default.createElement("button", { onClick: onClick, className: className }, children));
|
|
134
|
+
}
|
|
135
|
+
function BackButton({ children, onClick }) {
|
|
136
|
+
return (React__default.createElement("button", { onClick: onClick, className: "kth-button tertiary" },
|
|
137
|
+
React__default.createElement(SvgArrowBack, null),
|
|
138
|
+
children));
|
|
139
|
+
}
|
|
140
|
+
function ForwardButton({ children, onClick }) {
|
|
141
|
+
return (React__default.createElement("button", { onClick: onClick, className: "kth-button primary" },
|
|
142
|
+
children,
|
|
143
|
+
React__default.createElement(SvgArrowForward, null)));
|
|
144
|
+
}
|
|
145
|
+
// export function NextButton() {}
|
|
146
|
+
|
|
147
|
+
const SvgCheck = (props) => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1.25em", height: "1.25em", viewBox: "0 0 20 20", ...props },
|
|
148
|
+
React.createElement("path", { fill: "currentColor", d: "M8.23 14.063 4.707 10.52 5.75 9.479l2.48 2.459 6.02-6L15.292 7l-7.063 7.063Z" })));
|
|
149
|
+
|
|
150
|
+
export { BackButton, Button, ContentTabs, ForwardButton, SvgArrowBack as IconArrowBack, SvgCheck as IconCheck, NavigationTabs, Option, OptionGroup, Select, Tab };
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
import { Select } from "../components/Select";
|
|
3
3
|
import "../../scss/globals.scss";
|
|
4
|
-
import "../../scss/components/
|
|
4
|
+
import "../../scss/components/form.scss";
|
|
5
5
|
declare const meta: {
|
|
6
6
|
title: string;
|
|
7
7
|
component: typeof Select;
|
|
@@ -11,3 +11,4 @@ export default meta;
|
|
|
11
11
|
type Story = StoryObj<typeof meta>;
|
|
12
12
|
export declare const WithDescriptions: Story;
|
|
13
13
|
export declare const WithoutDescriptions: Story;
|
|
14
|
+
export declare const WithError: Story;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kth/style",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,5 +46,6 @@
|
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": "*"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "5c84200b7000ca5c45b18c5cb661280dbaf84e93"
|
|
50
51
|
}
|
|
@@ -3,19 +3,39 @@
|
|
|
3
3
|
@layer kth-style {
|
|
4
4
|
.kth-button {
|
|
5
5
|
padding-inline: var(--kth-0-clickable-padding-inline);
|
|
6
|
-
padding-block: calc(var(--kth-0-clickable-padding-block) - 1px);
|
|
7
|
-
border: 1px solid t.$color-neutral-10;
|
|
8
6
|
border-radius: t.$space-4;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
gap: t.$space-4;
|
|
9
|
+
align-items: center;
|
|
9
10
|
|
|
10
11
|
&.primary {
|
|
11
|
-
font-weight: t.$font-weight-bold;
|
|
12
12
|
background: t.$color-primary-5;
|
|
13
|
-
border-color: t.$color-primary-5;
|
|
14
13
|
color: t.$color-neutral-0;
|
|
14
|
+
border: none;
|
|
15
|
+
padding-block: var(--kth-0-clickable-padding-block);
|
|
16
|
+
font-weight: t.$font-weight-bold;
|
|
15
17
|
|
|
16
18
|
&:hover {
|
|
17
19
|
background: t.$color-primary-6;
|
|
18
|
-
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.secondary {
|
|
24
|
+
background: transparent;
|
|
25
|
+
color: t.$color-neutral-10;
|
|
26
|
+
border: 1px solid t.$color-neutral-10;
|
|
27
|
+
padding-block: calc(var(--kth-0-clickable-padding-block) - 1px);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.tertiary {
|
|
31
|
+
padding-inline: 0;
|
|
32
|
+
background: transparent;
|
|
33
|
+
color: t.$color-primary-5;
|
|
34
|
+
border: none;
|
|
35
|
+
padding-block: calc(var(--kth-0-clickable-padding-block));
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
text-decoration: underline;
|
|
19
39
|
}
|
|
20
40
|
}
|
|
21
41
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
margin-block: t.$space-24;
|
|
7
7
|
|
|
8
8
|
label {
|
|
9
|
-
display:
|
|
9
|
+
display: block;
|
|
10
10
|
font-weight: 600;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
padding-block: calc(var(--kth-0-clickable-padding-block) - 1px);
|
|
21
21
|
border-radius: t.$space-4;
|
|
22
22
|
border: 1px solid t.$color-neutral-10;
|
|
23
|
+
|
|
24
|
+
&[aria-invalid="true"] {
|
|
25
|
+
color: t.$color-danger-5;
|
|
26
|
+
border-color: t.$color-danger-5;
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
input {
|
|
@@ -28,6 +33,16 @@
|
|
|
28
33
|
padding-block: calc(var(--kth-0-clickable-padding-block) - 1px);
|
|
29
34
|
border-radius: t.$space-4;
|
|
30
35
|
border: 1px solid t.$color-neutral-10;
|
|
36
|
+
|
|
37
|
+
&[aria-invalid="true"] {
|
|
38
|
+
color: t.$color-danger-5;
|
|
39
|
+
border-color: t.$color-danger-5;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__error {
|
|
44
|
+
margin-top: t.$space-8;
|
|
45
|
+
color: t.$color-danger-5;
|
|
31
46
|
}
|
|
32
47
|
}
|
|
33
48
|
}
|