|
1 | 1 | import { ResetWrapper } from "@storybook/components"; |
2 | | -import { styled } from "@storybook/theming"; |
3 | 2 | import { capitalize } from "lodash-es"; |
4 | 3 | import React from "react"; |
5 | | -import { ThemeContainer } from "./ThemeContainer"; |
6 | | -import { Body, Heading } from "./Typography"; |
| 4 | +import { List } from "./Layouts.jsx"; |
| 5 | +import { |
| 6 | + Swatch, |
| 7 | + SwatchColors, |
| 8 | + SwatchGroup, |
| 9 | + SwatchGroupLabel, |
| 10 | + SwatchSet, |
| 11 | +} from "./Swatches.jsx"; |
| 12 | +import { ThemeContainer } from "./ThemeContainer.jsx"; |
| 13 | +import { Body, Heading } from "./Typography.jsx"; |
7 | 14 | import { fetchToken } from "./utilities.js"; |
8 | 15 |
|
9 | | -export const SwatchGroupLabel = styled.div` |
10 | | - display: flex; |
11 | | - flex-direction: column; |
12 | | - margin-top: 16px; |
13 | | - align-self: flex-start; |
14 | | - justify-content: center; |
15 | | - text-wrap: nowrap; |
16 | | - inline-size: max-content; |
17 | | - block-size: ${props => props.size ?? 32}px; |
18 | | - color: ${props => `var(--spectrum-neutral-subdued-content-color-default, ${props.theme.defaultText})`}; |
19 | | -`; |
20 | | - |
21 | | -export const SwatchSet = styled.div` |
22 | | - display: flex; |
23 | | - flex-direction: column; |
24 | | - align-items: flex-start; |
25 | | - gap: 2px; |
26 | | - color: ${props => `var(--spectrum-neutral-subdued-content-color-default, ${props.theme.defaultText})`}; |
27 | | -`; |
28 | | - |
29 | | -export const Swatch = styled.div` |
30 | | - position: relative; |
31 | | - inline-size: var(--swatch-size, ${props => props.size ?? 32}px); |
32 | | - block-size: var(--swatch-size, ${props => props.size ?? 32}px); |
33 | | - outline: none; |
34 | | - user-select: none; |
35 | | -
|
36 | | - &::before { |
37 | | - position: absolute; |
38 | | - inset: 0; |
39 | | - inline-size: 100%; |
40 | | - block-size: 100%; |
41 | | - content: ""; |
42 | | - opacity: 1; |
43 | | -
|
44 | | - border: 1px solid rgba(0, 0, 0, 51%); |
45 | | -
|
46 | | - border-radius: ${props => `${props.theme.appBorderRadius}px` ?? `var(--spectrum-corner-radius-100, 4px)`}; |
47 | | - ${props => props.background && `background: ${props.background};`} |
48 | | - } |
49 | | -
|
50 | | - .spectrum--dark &::before, |
51 | | - .spectrum--darkest &::before { |
52 | | - border-color: rgba(255, 255, 255, 51%); |
53 | | - } |
54 | | -`; |
55 | | - |
56 | | -export const SwatchColors = styled.div` |
57 | | - display: inline-flex; |
58 | | - flex-direction: row; |
59 | | - flex-wrap: wrap; |
60 | | - gap: ${props => props.size > 0 ? (props.size * 0.2) : 8}px; |
61 | | - align-items: flex-start; |
62 | | - justify-content: flex-start; |
63 | | -`; |
64 | | - |
65 | | -export const SwatchGroup = styled.div` |
66 | | - position: relative; |
67 | | - display: flex; |
68 | | - flex-direction: column; |
69 | | - flex: 1; |
70 | | -`; |
71 | | - |
72 | | -const List = styled.div` |
73 | | - display: grid; |
74 | | - gap: 24px; |
75 | | - grid-template-columns: 1fr auto; |
76 | | - grid-template-rows: auto; |
77 | | - align-items: center; |
78 | | - justify-content: center; |
79 | | -`; |
80 | | - |
81 | 16 | /** |
82 | 17 | * A single color row your styleguide showing title, subtitle and one or more colors, used |
83 | 18 | * as a child of `ColorPalette`. |
|
0 commit comments