@fpkit/acss 0.5.6 → 0.5.8
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/libs/components/alert/alert.css +1 -0
- package/libs/components/alert/alert.css.map +1 -0
- package/libs/components/alert/alert.min.css +3 -0
- package/libs/components/badge/badge.css +1 -0
- package/libs/components/badge/badge.css.map +1 -0
- package/libs/components/badge/badge.min.css +3 -0
- package/libs/components/breadcrumbs/breadcrumb.css +1 -0
- package/libs/components/breadcrumbs/breadcrumb.css.map +1 -0
- package/libs/components/breadcrumbs/breadcrumb.min.css +3 -0
- package/libs/components/buttons/button.css +1 -0
- package/libs/components/buttons/button.css.map +1 -0
- package/libs/components/buttons/button.min.css +3 -0
- package/libs/components/cards/card-style.css +1 -0
- package/libs/components/cards/card-style.css.map +1 -0
- package/libs/components/cards/card-style.min.css +3 -0
- package/libs/components/cards/card.css +1 -0
- package/libs/components/cards/card.css.map +1 -0
- package/libs/components/cards/card.min.css +3 -0
- package/libs/components/details/details.css +1 -0
- package/libs/components/details/details.css.map +1 -0
- package/libs/components/details/details.min.css +3 -0
- package/libs/components/dialog/dialog.css +1 -0
- package/libs/components/dialog/dialog.css.map +1 -0
- package/libs/components/dialog/dialog.min.css +3 -0
- package/libs/components/form/form.css +1 -0
- package/libs/components/form/form.css.map +1 -0
- package/libs/components/form/form.min.css +3 -0
- package/libs/components/icons/icon.css +1 -0
- package/libs/components/icons/icon.css.map +1 -0
- package/libs/components/icons/icon.min.css +3 -0
- package/libs/components/images/img.css +1 -0
- package/libs/components/images/img.css.map +1 -0
- package/libs/components/images/img.min.css +3 -0
- package/libs/components/layout/landmarks.css +1 -0
- package/libs/components/layout/landmarks.css.map +1 -0
- package/libs/components/layout/landmarks.min.css +3 -0
- package/libs/components/link/link.css +1 -0
- package/libs/components/link/link.css.map +1 -0
- package/libs/components/link/link.min.css +3 -0
- package/libs/components/nav/nav.css +1 -0
- package/libs/components/nav/nav.css.map +1 -0
- package/libs/components/nav/nav.min.css +3 -0
- package/libs/components/progress/progress.css +1 -0
- package/libs/components/progress/progress.css.map +1 -0
- package/libs/components/progress/progress.min.css +3 -0
- package/libs/components/styles/index.css +1 -0
- package/libs/components/styles/index.css.map +1 -0
- package/libs/components/styles/index.min.css +3 -0
- package/libs/components/tag/tag.css +1 -0
- package/libs/components/tag/tag.css.map +1 -0
- package/libs/components/tag/tag.min.css +3 -0
- package/libs/components/text-to-speech/text-to-speech.css +1 -0
- package/libs/components/text-to-speech/text-to-speech.css.map +1 -0
- package/libs/components/text-to-speech/text-to-speech.min.css +3 -0
- package/libs/index.css +1 -0
- package/libs/index.css.map +1 -0
- package/package.json +2 -2
- package/src/components/alert/README.mdx +44 -56
- package/src/components/alert/alert.scss +1 -1
- package/src/components/alert/alert.stories.tsx +8 -7
- package/src/components/alert/alert.tsx +10 -2
- package/src/components/buttons/README.mdx +96 -0
- package/src/components/buttons/button.scss +4 -2
- package/src/components/details/README.mdx +101 -0
- package/src/components/details/details.scss +21 -15
- package/src/components/details/details.stories.tsx +35 -7
- package/src/components/dialog/dialog-modal.stories.tsx +1 -1
- package/src/styles/alert/alert.css +0 -1
- package/src/styles/alert/alert.css.map +1 -1
- package/src/styles/buttons/button.css +5 -2
- package/src/styles/buttons/button.css.map +1 -1
- package/src/styles/details/details.css +18 -13
- package/src/styles/details/details.css.map +1 -1
- package/src/styles/index.css +23 -16
- package/src/styles/index.css.map +1 -1
- package/src/components/alert/alert.mdx +0 -74
|
@@ -1,86 +1,74 @@
|
|
|
1
1
|
import { Meta } from "@storybook/blocks";
|
|
2
2
|
|
|
3
|
+
<Meta title="FP.REACT Components/Alert/Readme" />
|
|
4
|
+
|
|
3
5
|
# Alert Component
|
|
4
6
|
|
|
5
7
|
## Summary
|
|
6
8
|
|
|
7
|
-
The Alert component is
|
|
8
|
-
|
|
9
|
+
The `Alert` component is a customizable component for displaying status messages
|
|
10
|
+
with different severity levels. It supports multiple severity types (default,
|
|
11
|
+
info, success, warning, error) and can include optional titles and dismissal
|
|
12
|
+
functionality.
|
|
9
13
|
|
|
10
14
|
## Features
|
|
11
15
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
+
- Multiple severity levels with matching visual indicators
|
|
17
|
+
- Optional title and dismissible states
|
|
18
|
+
- Accessible by default with appropriate ARIA attributes
|
|
19
|
+
- Customizable icons through `iconProps`
|
|
16
20
|
|
|
17
21
|
## Props
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
```tsx
|
|
24
|
+
export type AlertProps = {
|
|
25
|
+
open: boolean;
|
|
26
|
+
severity?: "default" | "info" | "success" | "warning" | "error";
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
title?: string;
|
|
29
|
+
dismissible?: boolean;
|
|
30
|
+
onDismiss?: () => void;
|
|
31
|
+
iconProps?: IconProps;
|
|
32
|
+
} & React.ComponentProps<typeof UI>;
|
|
33
|
+
```
|
|
27
34
|
|
|
28
35
|
## Technical Details
|
|
29
36
|
|
|
30
|
-
The Alert component
|
|
31
|
-
|
|
37
|
+
The `Alert` component uses the `UI` component for rendering and supports various
|
|
38
|
+
severity levels with corresponding ARIA attributes for accessibility. It also
|
|
39
|
+
allows for custom icons through the `iconProps` prop.
|
|
32
40
|
|
|
33
41
|
## Usage Example
|
|
34
42
|
|
|
35
43
|
### Basic Usage
|
|
36
44
|
|
|
37
45
|
```tsx
|
|
38
|
-
import
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
title="Alert Title"
|
|
44
|
-
dismissible={true}
|
|
45
|
-
onDismiss={() => console.log("Alert dismissed")}
|
|
46
|
-
>
|
|
47
|
-
This is an alert message
|
|
48
|
-
</Alert>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
export default App;
|
|
46
|
+
import Alert from "#components/alert";
|
|
47
|
+
|
|
48
|
+
<Alert open={true} severity="info">
|
|
49
|
+
This is an info alert.
|
|
50
|
+
</Alert>;
|
|
52
51
|
```
|
|
53
52
|
|
|
54
53
|
### Advanced Usage
|
|
55
54
|
|
|
56
55
|
```tsx
|
|
57
|
-
import
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
dismissible={true}
|
|
70
|
-
onDismiss={() => setIsOpen(false)}
|
|
71
|
-
>
|
|
72
|
-
This is an advanced alert message
|
|
73
|
-
</Alert>
|
|
74
|
-
)}
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default App;
|
|
56
|
+
import Alert from "#components/alert";
|
|
57
|
+
|
|
58
|
+
<Alert
|
|
59
|
+
open={true}
|
|
60
|
+
severity="error"
|
|
61
|
+
title="Error"
|
|
62
|
+
dismissible={true}
|
|
63
|
+
onDismiss={() => console.log("Alert dismissed")}
|
|
64
|
+
iconProps={{ fill: "#000", size: 24 }}
|
|
65
|
+
>
|
|
66
|
+
This is an error alert with a custom icon.
|
|
67
|
+
</Alert>;
|
|
80
68
|
```
|
|
81
69
|
|
|
82
70
|
### Additional Notes
|
|
83
71
|
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
-
|
|
72
|
+
- The `Alert` component is designed to be accessible by default.
|
|
73
|
+
- The `dismissible` prop allows the alert to be dismissed by the user.
|
|
74
|
+
- Custom icons can be provided through the `iconProps` prop.
|
|
@@ -104,6 +104,7 @@ export const InteractionTest: Story = {
|
|
|
104
104
|
args: {
|
|
105
105
|
open: true,
|
|
106
106
|
className: "my alert",
|
|
107
|
+
severity: "info",
|
|
107
108
|
},
|
|
108
109
|
decorators: [WithInstructions(instructions, "Alert interactions test:")],
|
|
109
110
|
play: async ({ canvasElement, step }) => {
|
|
@@ -117,13 +118,13 @@ export const InteractionTest: Story = {
|
|
|
117
118
|
expect(dismissButton).toBeInTheDocument();
|
|
118
119
|
}
|
|
119
120
|
);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
await step(
|
|
122
|
+
"Tab through the alert and check if the button gets focused",
|
|
123
|
+
async () => {
|
|
124
|
+
await userEvent.tab({ delay: 500 });
|
|
125
|
+
expect(dismissButton).toHaveFocus();
|
|
126
|
+
}
|
|
127
|
+
);
|
|
127
128
|
await step("Click the button to dismiss the alert", async () => {
|
|
128
129
|
await userEvent.click(dismissButton, { delay: 500 });
|
|
129
130
|
expect(alert).not.toBeInTheDocument();
|
|
@@ -44,6 +44,11 @@ export type AlertProps = {
|
|
|
44
44
|
*/
|
|
45
45
|
iconSize?: number;
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Whether to hide the icon.
|
|
49
|
+
*/
|
|
50
|
+
hideIcon?: boolean;
|
|
51
|
+
|
|
47
52
|
/**
|
|
48
53
|
* Additional props to pass to the Icon component.
|
|
49
54
|
*/
|
|
@@ -75,7 +80,9 @@ export type AlertProps = {
|
|
|
75
80
|
* ```
|
|
76
81
|
*
|
|
77
82
|
* @see {@link AlertProps} for available configuration options
|
|
78
|
-
*/
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
const Alert: React.FC<AlertProps> = ({
|
|
79
86
|
open,
|
|
80
87
|
severity = "default",
|
|
81
88
|
children,
|
|
@@ -84,6 +91,7 @@ export type AlertProps = {
|
|
|
84
91
|
onDismiss,
|
|
85
92
|
iconSize,
|
|
86
93
|
iconProps,
|
|
94
|
+
hideIcon,
|
|
87
95
|
...props
|
|
88
96
|
}) => {
|
|
89
97
|
const [isVisible, setIsVisible] = React.useState(open);
|
|
@@ -137,7 +145,7 @@ export type AlertProps = {
|
|
|
137
145
|
data-alert={severity}
|
|
138
146
|
{...props}
|
|
139
147
|
>
|
|
140
|
-
<UI aria-hidden="true">{severityIcons[severity]}</UI>
|
|
148
|
+
{!hideIcon && <UI aria-hidden="true">{severityIcons[severity]}</UI>}
|
|
141
149
|
<UI as="div" className="alert-message">
|
|
142
150
|
{title && (
|
|
143
151
|
<UI as="h3" className="alert-title">
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Meta } from "@storybook/blocks";
|
|
2
|
+
|
|
3
|
+
<Meta title="FP.REACT Components/Buttons/Readme" />
|
|
4
|
+
|
|
5
|
+
# Button
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
The `Button` component is a versatile and customizable button element that
|
|
10
|
+
supports various types and styles. It is designed to be reusable and accessible.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Supports `button`, `submit`, and `reset` types
|
|
15
|
+
- Customizable styles and classes
|
|
16
|
+
- Handles various pointer events
|
|
17
|
+
- Accessible with `aria-disabled` attribute
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Name | Type | Default | Description |
|
|
22
|
+
| ---------------- | ---------------------------------------------------- | ---------- | -------------------------------------- |
|
|
23
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | The button type |
|
|
24
|
+
| `styles` | `React.CSSProperties` | - | Inline styles for the button |
|
|
25
|
+
| `disabled` | `boolean` | `false` | Disables the button when set to `true` |
|
|
26
|
+
| `classes` | `string` | - | Additional CSS classes for the button |
|
|
27
|
+
| `onPointerDown` | `(e: React.PointerEvent<HTMLButtonElement>) => void` | - | Callback for pointer down event |
|
|
28
|
+
| `onPointerOver` | `(e: React.PointerEvent<HTMLButtonElement>) => void` | - | Callback for pointer over event |
|
|
29
|
+
| `onPointerLeave` | `(e: React.PointerEvent<HTMLButtonElement>) => void` | - | Callback for pointer leave event |
|
|
30
|
+
| `onClick` | `(e: React.MouseEvent<HTMLButtonElement>) => void` | - | Callback for click event |
|
|
31
|
+
|
|
32
|
+
## Technical Details
|
|
33
|
+
|
|
34
|
+
The `Button` component uses the `UI` component from the `#components/ui`
|
|
35
|
+
library. It handles various pointer events and ensures accessibility by using
|
|
36
|
+
the `aria-disabled` attribute.
|
|
37
|
+
|
|
38
|
+
## Usage Example
|
|
39
|
+
|
|
40
|
+
### Basic Usage
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import React from "react";
|
|
44
|
+
import Button from "#components/buttons/button";
|
|
45
|
+
|
|
46
|
+
const handleClick = () => {
|
|
47
|
+
console.log("Button clicked");
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const BasicButton = () => (
|
|
51
|
+
<Button type="button" onClick={handleClick}>
|
|
52
|
+
Click Me
|
|
53
|
+
</Button>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
export default BasicButton;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Advanced Usage
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import React from "react";
|
|
63
|
+
import Button from "#components/buttons/button";
|
|
64
|
+
|
|
65
|
+
const handlePointerDown = (e: React.PointerEvent<HTMLButtonElement>) => {
|
|
66
|
+
console.log("Pointer down", e);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handlePointerOver = (e: React.PointerEvent<HTMLButtonElement>) => {
|
|
70
|
+
console.log("Pointer over", e);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handlePointerLeave = (e: React.PointerEvent<HTMLButtonElement>) => {
|
|
74
|
+
console.log("Pointer leave", e);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const AdvancedButton = () => (
|
|
78
|
+
<Button
|
|
79
|
+
type="submit"
|
|
80
|
+
styles={{ backgroundColor: "blue", color: "white" }}
|
|
81
|
+
onPointerDown={handlePointerDown}
|
|
82
|
+
onPointerOver={handlePointerOver}
|
|
83
|
+
onPointerLeave={handlePointerLeave}
|
|
84
|
+
>
|
|
85
|
+
Submit
|
|
86
|
+
</Button>
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export default AdvancedButton;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Additional Notes
|
|
93
|
+
|
|
94
|
+
- Ensure the `type` prop is set to one of `'button'`, `'submit'`, or `'reset'`.
|
|
95
|
+
- The `styles` prop can be used to apply inline styles to the button.
|
|
96
|
+
- The `disabled` prop can be used to disable the button.
|
|
@@ -2,18 +2,20 @@ button {
|
|
|
2
2
|
--btn-xs: 0.6rem;
|
|
3
3
|
--btn-sm: 0.7rem;
|
|
4
4
|
--btn-md: 0.85rem;
|
|
5
|
-
--btn-lg:
|
|
5
|
+
--btn-lg: 1.3125rem;
|
|
6
6
|
--btn-pill: 100rem;
|
|
7
7
|
--btn-height: 2.5rem;
|
|
8
8
|
--fs: 0.95rem;
|
|
9
9
|
--btn-fs: 0.9375rem;
|
|
10
10
|
--btn-bg: lightgray;
|
|
11
11
|
--btn-width: max-content;
|
|
12
|
+
--btn-calc-height: var(--btn-height, calc(40rem / 16));
|
|
12
13
|
|
|
13
14
|
font-size: var(--btn-fs);
|
|
14
15
|
font-weight: var(--btn-fw, 500);
|
|
15
16
|
height: var(--btn-height, calc(40rem / 16));
|
|
16
|
-
|
|
17
|
+
max-height: var(--btn-calc-height);
|
|
18
|
+
min-height: 1.5rem;
|
|
17
19
|
place-items: var(--btn-place, center);
|
|
18
20
|
padding-inline: var(--btn-px, calc(var(--btn-fs) + 1.1%));
|
|
19
21
|
padding-block: var(--btn-py, calc(var(--btn-fs) + 0.75%));
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Meta } from "@storybook/blocks";
|
|
2
|
+
|
|
3
|
+
<Meta title="FP.REACT Components/Details/Readme" />
|
|
4
|
+
|
|
5
|
+
# Details Component
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
The `Details` component is a versatile and accessible component that provides a
|
|
10
|
+
collapsible section for displaying content. It is built using functional
|
|
11
|
+
components and hooks, ensuring reusability and performance optimization.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Accessible with aria-label support.
|
|
16
|
+
- Customizable with styles and class names.
|
|
17
|
+
- Supports icons and custom summary content.
|
|
18
|
+
- Easy to integrate and use in any React application.
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
|
|
22
|
+
| Name | Type | Description |
|
|
23
|
+
| --------------- | ----------------------------------------------------- | ------------------------------------------------- |
|
|
24
|
+
| `summary` | `React.ReactNode` | The summary text shown for the details. Required. |
|
|
25
|
+
| `ariaLabel` | `string` | The aria-label element for accessibility. |
|
|
26
|
+
| `styles` | `React.CSSProperties` | CSS styles object. |
|
|
27
|
+
| `classes` | `string` | Classnames string. |
|
|
28
|
+
| `open` | `boolean` | Whether the details is open. |
|
|
29
|
+
| `onToggle` | `(e: React.PointerEvent<HTMLDetailsElement>) => void` | onToggle callback. |
|
|
30
|
+
| `onPointerDown` | `(e: React.PointerEvent<HTMLDetailsElement>) => void` | onPointerDown callback. |
|
|
31
|
+
| `children` | `React.ReactNode` | The content inside the details. |
|
|
32
|
+
| `ref` | `React.Ref<any>` | Ref object. |
|
|
33
|
+
| `name` | `string` | Name attribute for the details element. |
|
|
34
|
+
|
|
35
|
+
## Technical Details
|
|
36
|
+
|
|
37
|
+
The `Details` component is built using TypeScript for type-checking and enhanced
|
|
38
|
+
developer experience. It uses functional components and hooks to ensure
|
|
39
|
+
performance and reusability.
|
|
40
|
+
|
|
41
|
+
## Usage Example
|
|
42
|
+
|
|
43
|
+
### Basic Usage
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import React from "react";
|
|
47
|
+
import Details from "./details";
|
|
48
|
+
import Icons from "../icons/icon";
|
|
49
|
+
|
|
50
|
+
const content = (
|
|
51
|
+
<>
|
|
52
|
+
<p>Example content inside the details component.</p>
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const icon = <Icons.Add />;
|
|
57
|
+
|
|
58
|
+
const Example = () => (
|
|
59
|
+
<Details summary="Summary Section" icon={icon} ariaLabel="Details Section">
|
|
60
|
+
{content}
|
|
61
|
+
</Details>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export default Example;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Advanced Usage
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import React from "react";
|
|
71
|
+
import Details from "./details";
|
|
72
|
+
import Icons from "../icons/icon";
|
|
73
|
+
|
|
74
|
+
const content = (
|
|
75
|
+
<>
|
|
76
|
+
<p>Advanced example content inside the details component.</p>
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const icon = <Icons.Add />;
|
|
81
|
+
|
|
82
|
+
const AdvancedExample = () => (
|
|
83
|
+
<Details
|
|
84
|
+
summary="Advanced Summary Section"
|
|
85
|
+
icon={icon}
|
|
86
|
+
ariaLabel="Advanced Details Section"
|
|
87
|
+
open={true}
|
|
88
|
+
onToggle={(e) => console.log("Toggled", e)}
|
|
89
|
+
>
|
|
90
|
+
{content}
|
|
91
|
+
</Details>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export default AdvancedExample;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Additional Notes
|
|
98
|
+
|
|
99
|
+
- Ensure to provide meaningful aria-labels for accessibility.
|
|
100
|
+
- Customize the component using the `styles` and `classes` props.
|
|
101
|
+
- Use the `onToggle` and `onPointerDown` callbacks for custom interactions.
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
details {
|
|
2
|
-
--details-
|
|
3
|
-
--details-h: max-content;
|
|
4
|
-
--details-border: 1px solid #dfdfdf;
|
|
5
|
-
--details-display: flex;
|
|
6
|
-
--details-justify: flex-start;
|
|
2
|
+
--details-border: 0.0625rem solid #dfdfdf;
|
|
7
3
|
--details-direction: column;
|
|
4
|
+
--details-display: flex;
|
|
8
5
|
--details-gap: 0rem;
|
|
6
|
+
--details-h: max-content;
|
|
7
|
+
--details-justify: flex-start;
|
|
9
8
|
--details-px: 1.5rem;
|
|
10
9
|
--details-py: 1rem;
|
|
11
|
-
--details-radius:
|
|
10
|
+
--details-radius: 0;
|
|
11
|
+
--details-w: 100%;
|
|
12
|
+
--max-h-closed: 6.25rem;
|
|
13
|
+
--max-h-open: 50rem;
|
|
14
|
+
--summary-align: center;
|
|
12
15
|
--summary-cursor: pointer;
|
|
13
|
-
--summary-transitions: all 0.75s ease-in-out;
|
|
14
16
|
--summary-display: flex;
|
|
15
|
-
--summary-justify: flex-start;
|
|
16
|
-
--summary-align: center;
|
|
17
17
|
--summary-gap: 0.5rem;
|
|
18
|
-
--
|
|
19
|
-
--
|
|
18
|
+
--summary-justify: flex-start;
|
|
19
|
+
--summary-transitions: all 0.75s ease-in-out;
|
|
20
20
|
|
|
21
21
|
interpolate-size: allow-keywords;
|
|
22
22
|
display: var(--details-display);
|
|
@@ -25,12 +25,11 @@ details {
|
|
|
25
25
|
gap: var(--details-gap);
|
|
26
26
|
width: var(--details-w);
|
|
27
27
|
border: var(--details-border);
|
|
28
|
+
border-left: none;
|
|
29
|
+
border-right: none;
|
|
28
30
|
transition: var(--summary-transitions);
|
|
29
31
|
max-height: var(--max-h-closed);
|
|
30
32
|
overflow: clip;
|
|
31
|
-
border-radius: var(--details-radius);
|
|
32
|
-
|
|
33
|
-
// Handle multiple details elements
|
|
34
33
|
& + details {
|
|
35
34
|
border-radius: 0; // remove radius from middle elements
|
|
36
35
|
border-top: none; // optional: remove double borders
|
|
@@ -71,7 +70,7 @@ details {
|
|
|
71
70
|
|
|
72
71
|
&:focus-within {
|
|
73
72
|
outline: none;
|
|
74
|
-
border-bottom: solid 2px
|
|
73
|
+
border-bottom: solid 2px currentColor;
|
|
75
74
|
background-color: whitesmoke;
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -84,6 +83,13 @@ details {
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
|
|
86
|
+
.list-styles {
|
|
87
|
+
summary {
|
|
88
|
+
border-left: none;
|
|
89
|
+
border-right: none;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
87
93
|
> section {
|
|
88
94
|
padding-inline: var(--details-px);
|
|
89
95
|
padding-block: var(--details-py);
|
|
@@ -60,6 +60,12 @@ export const DetailsDropdown: Story = {
|
|
|
60
60
|
},
|
|
61
61
|
} as Story;
|
|
62
62
|
|
|
63
|
+
export const DetailsStyles: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
classes: "list-style",
|
|
66
|
+
},
|
|
67
|
+
} as Story;
|
|
68
|
+
|
|
63
69
|
export const DetailsOpen: Story = {
|
|
64
70
|
args: {
|
|
65
71
|
open: true,
|
|
@@ -123,19 +129,41 @@ export const DetailsAccordion: Story = {
|
|
|
123
129
|
|
|
124
130
|
export const DetailsInteractionTest: Story = {
|
|
125
131
|
args: {},
|
|
126
|
-
play: async ({ canvasElement }) => {
|
|
132
|
+
play: async ({ canvasElement, step }) => {
|
|
127
133
|
const canvas = within(canvasElement);
|
|
128
134
|
|
|
129
135
|
// Find the summary element
|
|
130
136
|
const summaryElement = canvas.getByText("Summary Section");
|
|
137
|
+
// add an open step
|
|
138
|
+
await step("Open the details", async () => {
|
|
139
|
+
// Simulate a click on the summary element
|
|
140
|
+
await userEvent.click(summaryElement, { delay: 500 });
|
|
141
|
+
|
|
142
|
+
// Assert that the details element is open
|
|
143
|
+
const detailsElement = canvas.getByRole("group", {
|
|
144
|
+
name: /details dropdown/i,
|
|
145
|
+
});
|
|
146
|
+
expect(detailsElement).toHaveAttribute("open");
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
await step("Close the detail panel", async () => {
|
|
150
|
+
await userEvent.click(summaryElement, { delay: 500 });
|
|
151
|
+
|
|
152
|
+
expect(summaryElement).not.toHaveAttribute("open");
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// test if it works with the space bar
|
|
156
|
+
await step("Open the details with space", async () => {
|
|
157
|
+
summaryElement.focus();
|
|
158
|
+
expect(summaryElement).toHaveFocus();
|
|
131
159
|
|
|
132
|
-
|
|
133
|
-
await userEvent.click(summaryElement);
|
|
160
|
+
await userEvent.type(summaryElement, "{space}", { delay: 500 });
|
|
134
161
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
162
|
+
// Assert that the details element is open
|
|
163
|
+
const detailsElement = canvas.getByRole("group", {
|
|
164
|
+
name: /details dropdown/i,
|
|
165
|
+
});
|
|
166
|
+
expect(detailsElement).toHaveAttribute("open");
|
|
138
167
|
});
|
|
139
|
-
expect(detailsElement).toHaveAttribute("open");
|
|
140
168
|
},
|
|
141
169
|
};
|
|
@@ -104,7 +104,7 @@ export const ModalInteractions: Story = {
|
|
|
104
104
|
expect(openButton).not.toHaveFocus();
|
|
105
105
|
|
|
106
106
|
const dialog = canvas.getByRole("dialog");
|
|
107
|
-
await userEvent.
|
|
107
|
+
await userEvent.type(dialog, "{Escape}", { delay: 500 }); // Close the dialog with the keyboard
|
|
108
108
|
await waitFor(() => {
|
|
109
109
|
expect(dialog).not.toBeVisible();
|
|
110
110
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../components/alert/alert.scss"],"names":[],"mappings":"AAAA;AACE;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;;AACA;EACE;EACA;;AAGF;EACE;EACA;;AACA;EACE;;AAIJ;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAIA;EACE
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../components/alert/alert.scss"],"names":[],"mappings":"AAAA;AACE;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;;AACA;EACE;EACA;;AAGF;EACE;EACA;;AACA;EACE;;AAIJ;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAIA;EACE","file":"alert.css"}
|
|
@@ -2,17 +2,19 @@ button {
|
|
|
2
2
|
--btn-xs: 0.6rem;
|
|
3
3
|
--btn-sm: 0.7rem;
|
|
4
4
|
--btn-md: 0.85rem;
|
|
5
|
-
--btn-lg:
|
|
5
|
+
--btn-lg: 1.3125rem;
|
|
6
6
|
--btn-pill: 100rem;
|
|
7
7
|
--btn-height: 2.5rem;
|
|
8
8
|
--fs: 0.95rem;
|
|
9
9
|
--btn-fs: 0.9375rem;
|
|
10
10
|
--btn-bg: lightgray;
|
|
11
11
|
--btn-width: max-content;
|
|
12
|
+
--btn-calc-height: var(--btn-height, calc(40rem / 16));
|
|
12
13
|
font-size: var(--btn-fs);
|
|
13
14
|
font-weight: var(--btn-fw, 500);
|
|
14
15
|
height: var(--btn-height, 2.5rem);
|
|
15
|
-
|
|
16
|
+
max-height: var(--btn-calc-height);
|
|
17
|
+
min-height: 1.5rem;
|
|
16
18
|
place-items: var(--btn-place, center);
|
|
17
19
|
padding-inline: var(--btn-px, calc(var(--btn-fs) + 1.1%));
|
|
18
20
|
padding-block: var(--btn-py, calc(var(--btn-fs) + 0.75%));
|
|
@@ -91,6 +93,7 @@ button[data-btn~=lg] {
|
|
|
91
93
|
button[data-btn~=icon] {
|
|
92
94
|
padding: unset;
|
|
93
95
|
height: unset;
|
|
96
|
+
--btn-bg: transparent;
|
|
94
97
|
min-width: 1.5rem;
|
|
95
98
|
min-height: 1.5rem;
|
|
96
99
|
text-align: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../components/buttons/button.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EAEE;EACA;;AAGF;EAEE;;AAGA;EACE;;AAOJ;EAEE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EAGE;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA","file":"button.css"}
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../components/buttons/button.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EAEE;EACA;;AAGF;EAEE;;AAGA;EACE;;AAOJ;EAEE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EAGE;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA","file":"button.css"}
|