@fpkit/acss 0.6.2 → 1.0.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.
- package/README.md +32 -0
- package/docs/README.md +325 -0
- package/docs/guides/accessibility.md +764 -0
- package/docs/guides/architecture.md +705 -0
- package/docs/guides/composition.md +688 -0
- package/docs/guides/css-variables.md +522 -0
- package/docs/guides/storybook.md +828 -0
- package/docs/guides/testing.md +817 -0
- package/docs/testing/focus-indicator-testing.md +437 -0
- package/libs/components/alert/alert.css +1 -1
- package/libs/components/alert/alert.css.map +1 -1
- package/libs/components/alert/alert.min.css +2 -2
- package/libs/components/badge/badge.css +1 -1
- package/libs/components/badge/badge.css.map +1 -1
- package/libs/components/badge/badge.min.css +2 -2
- package/libs/components/breadcrumbs/breadcrumb.css +1 -1
- package/libs/components/breadcrumbs/breadcrumb.css.map +1 -1
- package/libs/components/breadcrumbs/breadcrumb.min.css +2 -2
- package/libs/components/buttons/button.css +1 -1
- package/libs/components/buttons/button.css.map +1 -1
- package/libs/components/buttons/button.min.css +2 -2
- package/libs/components/cards/card.css +1 -1
- package/libs/components/cards/card.css.map +1 -1
- package/libs/components/cards/card.min.css +2 -2
- package/libs/components/details/details.css +1 -1
- package/libs/components/details/details.css.map +1 -1
- package/libs/components/details/details.min.css +2 -2
- package/libs/components/dialog/dialog.css +1 -1
- package/libs/components/dialog/dialog.css.map +1 -1
- package/libs/components/dialog/dialog.min.css +2 -2
- package/libs/components/form/form.css +1 -1
- package/libs/components/form/form.css.map +1 -1
- package/libs/components/form/form.min.css +2 -2
- package/libs/components/images/img.css +1 -1
- package/libs/components/images/img.css.map +1 -1
- package/libs/components/images/img.min.css +2 -2
- package/libs/components/layout/landmarks.css +1 -1
- package/libs/components/layout/landmarks.css.map +1 -1
- package/libs/components/layout/landmarks.min.css +2 -2
- package/libs/components/link/link.css +1 -1
- package/libs/components/link/link.css.map +1 -1
- package/libs/components/link/link.min.css +2 -2
- package/libs/components/list/list.css +1 -1
- package/libs/components/list/list.min.css +1 -1
- package/libs/components/nav/nav.css +1 -1
- package/libs/components/nav/nav.css.map +1 -1
- package/libs/components/nav/nav.min.css +2 -2
- package/libs/components/progress/progress.css +1 -1
- package/libs/components/progress/progress.css.map +1 -1
- package/libs/components/progress/progress.min.css +2 -2
- package/libs/components/tag/tag.css +1 -1
- package/libs/components/tag/tag.css.map +1 -1
- package/libs/components/tag/tag.min.css +2 -2
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/package.json +4 -3
- package/src/components/README.mdx +1 -1
- package/src/components/alert/alert.scss +4 -4
- package/src/components/alert/alert.scss.backup +184 -0
- package/src/components/alert/alert.stories.tsx +53 -2
- package/src/components/badge/badge.scss +2 -2
- package/src/components/badge/badge.scss.backup +39 -0
- package/src/components/badge/badge.stories.tsx +40 -0
- package/src/components/breadcrumbs/breadcrumb.scss +5 -5
- package/src/components/breadcrumbs/breadcrumb.scss.backup +35 -0
- package/src/components/breadcrumbs/breadcrumb.stories.tsx +17 -1
- package/src/components/buttons/button.scss +32 -27
- package/src/components/buttons/button.scss.backup +145 -0
- package/src/components/buttons/button.stories.tsx +196 -7
- package/src/components/cards/card.scss +39 -5
- package/src/components/cards/card.scss.backup +67 -0
- package/src/components/cards/card.stories.tsx +184 -1
- package/src/components/details/details.scss +14 -14
- package/src/components/details/details.scss.backup +126 -0
- package/src/components/details/details.stories.tsx +41 -1
- package/src/components/dialog/dialog.scss +3 -3
- package/src/components/dialog/dialog.scss.backup +126 -0
- package/src/components/form/form.scss +25 -9
- package/src/components/form/form.scss.backup +87 -0
- package/src/components/form/form.stories.tsx +272 -1
- package/src/components/form/input.stories.tsx +159 -1
- package/src/components/form/select.stories.tsx +1 -1
- package/src/components/heading/README.mdx +292 -0
- package/src/components/icons/icon.stories.tsx +1 -1
- package/src/components/images/figure.stories.tsx +41 -1
- package/src/components/images/img.scss +8 -8
- package/src/components/images/img.scss.backup +59 -0
- package/src/components/layout/_header.scss +14 -14
- package/src/components/layout/_header.scss.backup +72 -0
- package/src/components/layout/landmarks.scss +7 -7
- package/src/components/layout/landmarks.scss.backup +51 -0
- package/src/components/layout/landmarks.stories.tsx +42 -0
- package/src/components/link/link.scss +5 -5
- package/src/components/link/link.scss.backup +145 -0
- package/src/components/link/link.stories.tsx +38 -2
- package/src/components/list/list.scss +1 -1
- package/src/components/nav/nav.scss +17 -17
- package/src/components/nav/nav.scss.backup +123 -0
- package/src/components/nav/nav.stories.tsx +36 -2
- package/src/components/progress/progress.scss +7 -7
- package/src/components/progress/progress.scss.backup +70 -0
- package/src/components/tag/tag.scss +10 -10
- package/src/components/tag/tag.scss.backup +130 -0
- package/src/components/tag/tag.stories.tsx +23 -2
- package/src/components/ui.stories.tsx +53 -19
- package/src/docs/accessibility.mdx +484 -0
- package/src/docs/composition.mdx +549 -0
- package/src/docs/css-variables.mdx +380 -0
- package/src/docs/fpkit-developer.mdx +545 -0
- package/src/introduction.mdx +356 -0
- package/src/styles/alert/alert.css +4 -4
- package/src/styles/badge/badge.css +2 -2
- package/src/styles/breadcrumbs/breadcrumb.css +5 -5
- package/src/styles/buttons/button.css +30 -27
- package/src/styles/buttons/button.css.map +1 -1
- package/src/styles/cards/card.css +35 -5
- package/src/styles/cards/card.css.map +1 -1
- package/src/styles/details/details.css +14 -14
- package/src/styles/dialog/dialog.css +3 -3
- package/src/styles/form/form.css +20 -10
- package/src/styles/form/form.css.map +1 -1
- package/src/styles/images/img.css +8 -8
- package/src/styles/index.css +179 -134
- package/src/styles/index.css.map +1 -1
- package/src/styles/layout/landmarks.css +21 -21
- package/src/styles/link/link.css +5 -5
- package/src/styles/list/list.css +1 -1
- package/src/styles/nav/nav.css +17 -17
- package/src/styles/progress/progress.css +6 -6
- package/src/styles/tag/tag.css +4 -4
- package/src/styles/utilities/_disabled.scss +5 -4
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tag Component Styles - WCAG 2.1 AA Compliant
|
|
3
|
+
*
|
|
4
|
+
* Provides visual styling for the Tag component with CSS custom properties
|
|
5
|
+
* for easy theming and variant support. All measurements use rem units
|
|
6
|
+
* for scalability and accessibility.
|
|
7
|
+
*
|
|
8
|
+
* Accessibility Features:
|
|
9
|
+
* - Color contrast ratios meet WCAG AA 4.5:1 minimum (WCAG 1.4.3)
|
|
10
|
+
* - Visual indicators beyond color (symbols via ::before) (WCAG 1.4.1)
|
|
11
|
+
* - Visible focus indicators with 3:1 contrast (WCAG 2.4.7)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Base Tag Styles
|
|
16
|
+
* Applied to all tag elements via role and data-tag attributes
|
|
17
|
+
*/
|
|
18
|
+
p[role='note'],
|
|
19
|
+
[role='note'],
|
|
20
|
+
small > span,
|
|
21
|
+
[data-tag] {
|
|
22
|
+
/* Variant color tokens - WCAG AA compliant colors */
|
|
23
|
+
--beta: #fbbf24; /* Amber: 6.94:1 contrast with black */
|
|
24
|
+
--stable: #0f7c3e; /* Dark green: 4.56:1 contrast with white */
|
|
25
|
+
--production: #1e3a8a; /* Dark blue: 8.59:1 contrast with white */
|
|
26
|
+
|
|
27
|
+
/* Tag component tokens */
|
|
28
|
+
--tag-px: 0.7rem; /* Horizontal padding (11.2px at 16px base) */
|
|
29
|
+
--tag-py: 0.2rem; /* Vertical padding (3.2px at 16px base) */
|
|
30
|
+
--tag-fs: 0.8rem; /* Font size (12.8px at 16px base) */
|
|
31
|
+
--tag-radius: 99rem; /* Fully rounded pill shape */
|
|
32
|
+
--tag-bg: lightgray; /* Default background color */
|
|
33
|
+
--tag-fw: 500; /* Medium font weight */
|
|
34
|
+
--tag-color: currentColor; /* Default text color (inherits) */
|
|
35
|
+
--tag-display: inline-block;/* Display type */
|
|
36
|
+
|
|
37
|
+
/* Apply CSS custom properties */
|
|
38
|
+
display: var(--tag-display);
|
|
39
|
+
padding-inline: var(--tag-px);
|
|
40
|
+
padding-block: var(--tag-py);
|
|
41
|
+
font-size: var(--tag-fs);
|
|
42
|
+
color: var(--tag-color);
|
|
43
|
+
background-color: var(--tag-bg);
|
|
44
|
+
border-radius: var(--tag-radius);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Focus Indicators (WCAG 2.4.7)
|
|
48
|
+
* Visible focus for keyboard navigation with 3:1 minimum contrast
|
|
49
|
+
*/
|
|
50
|
+
&:focus-visible {
|
|
51
|
+
outline: 2px solid currentColor;
|
|
52
|
+
outline-offset: 2px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Remove outline for mouse users while preserving for keyboard users */
|
|
56
|
+
&:focus:not(:focus-visible) {
|
|
57
|
+
outline: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Variant Modifiers
|
|
62
|
+
* Applied via data-tag attribute (e.g., data-tag="beta")
|
|
63
|
+
* Each variant includes both color AND visual symbol for accessibility (WCAG 1.4.1)
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/* Alpha variant - early development stage */
|
|
67
|
+
&[data-tag~='alpha'] {
|
|
68
|
+
--tag-color: #000000; /* Black: maximum contrast with amber background */
|
|
69
|
+
--tag-bg: var(--beta);
|
|
70
|
+
|
|
71
|
+
/* Visual indicator beyond color - warning symbol */
|
|
72
|
+
&::before {
|
|
73
|
+
content: '⚠';
|
|
74
|
+
margin-inline-end: 0.25rem;
|
|
75
|
+
font-weight: 700;
|
|
76
|
+
aria-hidden: true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Beta variant - pre-release version */
|
|
81
|
+
&[data-tag~='beta'] {
|
|
82
|
+
--tag-color: #000000; /* Black: maximum contrast with amber background */
|
|
83
|
+
--tag-bg: var(--beta);
|
|
84
|
+
|
|
85
|
+
/* Visual indicator beyond color - warning symbol */
|
|
86
|
+
&::before {
|
|
87
|
+
content: '⚠';
|
|
88
|
+
margin-inline-end: 0.25rem;
|
|
89
|
+
font-weight: 700;
|
|
90
|
+
aria-hidden: true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Stable variant - production-ready release */
|
|
95
|
+
&[data-tag~='stable'] {
|
|
96
|
+
--tag-color: #ffffff; /* White: 4.56:1 contrast with dark green */
|
|
97
|
+
--tag-bg: var(--stable);
|
|
98
|
+
|
|
99
|
+
/* Visual indicator beyond color - checkmark symbol */
|
|
100
|
+
&::before {
|
|
101
|
+
content: '✓';
|
|
102
|
+
margin-inline-end: 0.25rem;
|
|
103
|
+
font-weight: 700;
|
|
104
|
+
aria-hidden: true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Production variant - live environment indicator */
|
|
109
|
+
&[data-tag~='production'] {
|
|
110
|
+
--tag-color: #ffffff; /* White: 8.59:1 contrast with dark blue */
|
|
111
|
+
--tag-bg: var(--production);
|
|
112
|
+
|
|
113
|
+
/* Visual indicator beyond color - live indicator symbol */
|
|
114
|
+
&::before {
|
|
115
|
+
content: '●';
|
|
116
|
+
margin-inline-end: 0.25rem;
|
|
117
|
+
font-weight: 700;
|
|
118
|
+
aria-hidden: true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Block-level tag modifier
|
|
125
|
+
* Applied when Tag renders as <p> element
|
|
126
|
+
*/
|
|
127
|
+
p[role='note'] {
|
|
128
|
+
--tag-display: block;
|
|
129
|
+
--tag-radius: 0.5rem; /* Less rounded for block tags (8px at 16px base) */
|
|
130
|
+
}
|
|
@@ -48,8 +48,29 @@ const meta: Meta<typeof Tag> = {
|
|
|
48
48
|
parameters: {
|
|
49
49
|
docs: {
|
|
50
50
|
description: {
|
|
51
|
-
component:
|
|
52
|
-
|
|
51
|
+
component: `A small inline label component for displaying status, versions, or environment indicators with WCAG 2.1 AA accessibility compliance.
|
|
52
|
+
|
|
53
|
+
## CSS Variables
|
|
54
|
+
|
|
55
|
+
### Spacing
|
|
56
|
+
- \`--tag-padding-inline\`: Horizontal padding (default: 0.7rem / 11.2px)
|
|
57
|
+
- \`--tag-padding-block\`: Vertical padding (default: 0.2rem / 3.2px)
|
|
58
|
+
|
|
59
|
+
### Typography
|
|
60
|
+
- \`--tag-fs\`: Font size (default: 0.8rem / 12.8px)
|
|
61
|
+
- \`--tag-fw\`: Font weight (default: 500)
|
|
62
|
+
- \`--tag-color\`: Text color (default: currentColor)
|
|
63
|
+
|
|
64
|
+
### Appearance
|
|
65
|
+
- \`--tag-bg\`: Background color (default: lightgray)
|
|
66
|
+
- \`--tag-radius\`: Border radius (default: 99rem for pill shape, 0.5rem for block)
|
|
67
|
+
- \`--tag-display\`: Display mode (default: inline-block, block for \`<p>\`)
|
|
68
|
+
|
|
69
|
+
### Variant Colors (WCAG AA Compliant)
|
|
70
|
+
- \`--beta\`: Amber (#fbbf24) - 6.94:1 contrast with black
|
|
71
|
+
- \`--stable\`: Dark green (#0f7c3e) - 4.56:1 contrast with white
|
|
72
|
+
- \`--production\`: Dark blue (#1e3a8a) - 8.59:1 contrast with white
|
|
73
|
+
`,
|
|
53
74
|
},
|
|
54
75
|
},
|
|
55
76
|
},
|
|
@@ -15,7 +15,7 @@ import UI from "./ui";
|
|
|
15
15
|
* - Zero runtime overhead
|
|
16
16
|
*/
|
|
17
17
|
const meta = {
|
|
18
|
-
title: "FP
|
|
18
|
+
title: "FP/UI",
|
|
19
19
|
component: UI,
|
|
20
20
|
tags: ["autodocs", "primitive"],
|
|
21
21
|
parameters: {
|
|
@@ -782,7 +782,9 @@ export const CommonAccessibilityMistakes: Story = {
|
|
|
782
782
|
|
|
783
783
|
{/* Missing accessible name */}
|
|
784
784
|
<div>
|
|
785
|
-
<h4
|
|
785
|
+
<h4
|
|
786
|
+
style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}
|
|
787
|
+
>
|
|
786
788
|
❌ BAD: Icon button without accessible name
|
|
787
789
|
</h4>
|
|
788
790
|
<UI
|
|
@@ -800,15 +802,24 @@ export const CommonAccessibilityMistakes: Story = {
|
|
|
800
802
|
>
|
|
801
803
|
×
|
|
802
804
|
</UI>
|
|
803
|
-
<p
|
|
804
|
-
|
|
805
|
-
|
|
805
|
+
<p
|
|
806
|
+
style={{
|
|
807
|
+
fontSize: "0.875rem",
|
|
808
|
+
color: "#721c24",
|
|
809
|
+
marginTop: "0.5rem",
|
|
810
|
+
}}
|
|
811
|
+
>
|
|
812
|
+
<strong>Problem:</strong> Screen readers cannot identify this
|
|
813
|
+
button's purpose. <strong>Fix:</strong> Add{" "}
|
|
814
|
+
<code>aria-label="Close"</code>
|
|
806
815
|
</p>
|
|
807
816
|
</div>
|
|
808
817
|
|
|
809
818
|
{/* Non-semantic clickable div */}
|
|
810
819
|
<div>
|
|
811
|
-
<h4
|
|
820
|
+
<h4
|
|
821
|
+
style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}
|
|
822
|
+
>
|
|
812
823
|
❌ BAD: Clickable div without keyboard support
|
|
813
824
|
</h4>
|
|
814
825
|
<UI
|
|
@@ -825,16 +836,25 @@ export const CommonAccessibilityMistakes: Story = {
|
|
|
825
836
|
>
|
|
826
837
|
Click me (but you can't use keyboard!)
|
|
827
838
|
</UI>
|
|
828
|
-
<p
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
839
|
+
<p
|
|
840
|
+
style={{
|
|
841
|
+
fontSize: "0.875rem",
|
|
842
|
+
color: "#721c24",
|
|
843
|
+
marginTop: "0.5rem",
|
|
844
|
+
}}
|
|
845
|
+
>
|
|
846
|
+
<strong>Problem:</strong> Not keyboard accessible or announced to
|
|
847
|
+
screen readers. <strong>Fix:</strong> Use <code>as="button"</code>{" "}
|
|
848
|
+
or add <code>role="button"</code>, <code>tabIndex=0</code>, and
|
|
849
|
+
keyboard handlers.
|
|
832
850
|
</p>
|
|
833
851
|
</div>
|
|
834
852
|
|
|
835
853
|
{/* Poor contrast focus indicator */}
|
|
836
854
|
<div>
|
|
837
|
-
<h4
|
|
855
|
+
<h4
|
|
856
|
+
style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}
|
|
857
|
+
>
|
|
838
858
|
❌ BAD: Insufficient focus indicator contrast
|
|
839
859
|
</h4>
|
|
840
860
|
<UI
|
|
@@ -851,16 +871,24 @@ export const CommonAccessibilityMistakes: Story = {
|
|
|
851
871
|
>
|
|
852
872
|
Low contrast focus
|
|
853
873
|
</UI>
|
|
854
|
-
<p
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
874
|
+
<p
|
|
875
|
+
style={{
|
|
876
|
+
fontSize: "0.875rem",
|
|
877
|
+
color: "#721c24",
|
|
878
|
+
marginTop: "0.5rem",
|
|
879
|
+
}}
|
|
880
|
+
>
|
|
881
|
+
<strong>Problem:</strong> Focus indicator contrast ratio is less
|
|
882
|
+
than 3:1 (WCAG 2.4.7). <strong>Fix:</strong> Use a contrasting color
|
|
883
|
+
like dark blue on light blue background.
|
|
858
884
|
</p>
|
|
859
885
|
</div>
|
|
860
886
|
|
|
861
887
|
{/* Vague link text */}
|
|
862
888
|
<div>
|
|
863
|
-
<h4
|
|
889
|
+
<h4
|
|
890
|
+
style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}
|
|
891
|
+
>
|
|
864
892
|
❌ BAD: Non-descriptive link text
|
|
865
893
|
</h4>
|
|
866
894
|
<UI
|
|
@@ -873,10 +901,16 @@ export const CommonAccessibilityMistakes: Story = {
|
|
|
873
901
|
>
|
|
874
902
|
Click here
|
|
875
903
|
</UI>
|
|
876
|
-
<p
|
|
904
|
+
<p
|
|
905
|
+
style={{
|
|
906
|
+
fontSize: "0.875rem",
|
|
907
|
+
color: "#721c24",
|
|
908
|
+
marginTop: "0.5rem",
|
|
909
|
+
}}
|
|
910
|
+
>
|
|
877
911
|
<strong>Problem:</strong> "Click here" doesn't describe the link's
|
|
878
|
-
destination. <strong>Fix:</strong> Use descriptive text like "View
|
|
879
|
-
documentation".
|
|
912
|
+
destination. <strong>Fix:</strong> Use descriptive text like "View
|
|
913
|
+
product documentation".
|
|
880
914
|
</p>
|
|
881
915
|
</div>
|
|
882
916
|
</div>
|