@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.
Files changed (131) hide show
  1. package/README.md +32 -0
  2. package/docs/README.md +325 -0
  3. package/docs/guides/accessibility.md +764 -0
  4. package/docs/guides/architecture.md +705 -0
  5. package/docs/guides/composition.md +688 -0
  6. package/docs/guides/css-variables.md +522 -0
  7. package/docs/guides/storybook.md +828 -0
  8. package/docs/guides/testing.md +817 -0
  9. package/docs/testing/focus-indicator-testing.md +437 -0
  10. package/libs/components/alert/alert.css +1 -1
  11. package/libs/components/alert/alert.css.map +1 -1
  12. package/libs/components/alert/alert.min.css +2 -2
  13. package/libs/components/badge/badge.css +1 -1
  14. package/libs/components/badge/badge.css.map +1 -1
  15. package/libs/components/badge/badge.min.css +2 -2
  16. package/libs/components/breadcrumbs/breadcrumb.css +1 -1
  17. package/libs/components/breadcrumbs/breadcrumb.css.map +1 -1
  18. package/libs/components/breadcrumbs/breadcrumb.min.css +2 -2
  19. package/libs/components/buttons/button.css +1 -1
  20. package/libs/components/buttons/button.css.map +1 -1
  21. package/libs/components/buttons/button.min.css +2 -2
  22. package/libs/components/cards/card.css +1 -1
  23. package/libs/components/cards/card.css.map +1 -1
  24. package/libs/components/cards/card.min.css +2 -2
  25. package/libs/components/details/details.css +1 -1
  26. package/libs/components/details/details.css.map +1 -1
  27. package/libs/components/details/details.min.css +2 -2
  28. package/libs/components/dialog/dialog.css +1 -1
  29. package/libs/components/dialog/dialog.css.map +1 -1
  30. package/libs/components/dialog/dialog.min.css +2 -2
  31. package/libs/components/form/form.css +1 -1
  32. package/libs/components/form/form.css.map +1 -1
  33. package/libs/components/form/form.min.css +2 -2
  34. package/libs/components/images/img.css +1 -1
  35. package/libs/components/images/img.css.map +1 -1
  36. package/libs/components/images/img.min.css +2 -2
  37. package/libs/components/layout/landmarks.css +1 -1
  38. package/libs/components/layout/landmarks.css.map +1 -1
  39. package/libs/components/layout/landmarks.min.css +2 -2
  40. package/libs/components/link/link.css +1 -1
  41. package/libs/components/link/link.css.map +1 -1
  42. package/libs/components/link/link.min.css +2 -2
  43. package/libs/components/list/list.css +1 -1
  44. package/libs/components/list/list.min.css +1 -1
  45. package/libs/components/nav/nav.css +1 -1
  46. package/libs/components/nav/nav.css.map +1 -1
  47. package/libs/components/nav/nav.min.css +2 -2
  48. package/libs/components/progress/progress.css +1 -1
  49. package/libs/components/progress/progress.css.map +1 -1
  50. package/libs/components/progress/progress.min.css +2 -2
  51. package/libs/components/tag/tag.css +1 -1
  52. package/libs/components/tag/tag.css.map +1 -1
  53. package/libs/components/tag/tag.min.css +2 -2
  54. package/libs/index.css +1 -1
  55. package/libs/index.css.map +1 -1
  56. package/package.json +4 -3
  57. package/src/components/README.mdx +1 -1
  58. package/src/components/alert/alert.scss +4 -4
  59. package/src/components/alert/alert.scss.backup +184 -0
  60. package/src/components/alert/alert.stories.tsx +53 -2
  61. package/src/components/badge/badge.scss +2 -2
  62. package/src/components/badge/badge.scss.backup +39 -0
  63. package/src/components/badge/badge.stories.tsx +40 -0
  64. package/src/components/breadcrumbs/breadcrumb.scss +5 -5
  65. package/src/components/breadcrumbs/breadcrumb.scss.backup +35 -0
  66. package/src/components/breadcrumbs/breadcrumb.stories.tsx +17 -1
  67. package/src/components/buttons/button.scss +32 -27
  68. package/src/components/buttons/button.scss.backup +145 -0
  69. package/src/components/buttons/button.stories.tsx +196 -7
  70. package/src/components/cards/card.scss +39 -5
  71. package/src/components/cards/card.scss.backup +67 -0
  72. package/src/components/cards/card.stories.tsx +184 -1
  73. package/src/components/details/details.scss +14 -14
  74. package/src/components/details/details.scss.backup +126 -0
  75. package/src/components/details/details.stories.tsx +41 -1
  76. package/src/components/dialog/dialog.scss +3 -3
  77. package/src/components/dialog/dialog.scss.backup +126 -0
  78. package/src/components/form/form.scss +25 -9
  79. package/src/components/form/form.scss.backup +87 -0
  80. package/src/components/form/form.stories.tsx +272 -1
  81. package/src/components/form/input.stories.tsx +159 -1
  82. package/src/components/form/select.stories.tsx +1 -1
  83. package/src/components/heading/README.mdx +292 -0
  84. package/src/components/icons/icon.stories.tsx +1 -1
  85. package/src/components/images/figure.stories.tsx +41 -1
  86. package/src/components/images/img.scss +8 -8
  87. package/src/components/images/img.scss.backup +59 -0
  88. package/src/components/layout/_header.scss +14 -14
  89. package/src/components/layout/_header.scss.backup +72 -0
  90. package/src/components/layout/landmarks.scss +7 -7
  91. package/src/components/layout/landmarks.scss.backup +51 -0
  92. package/src/components/layout/landmarks.stories.tsx +42 -0
  93. package/src/components/link/link.scss +5 -5
  94. package/src/components/link/link.scss.backup +145 -0
  95. package/src/components/link/link.stories.tsx +38 -2
  96. package/src/components/list/list.scss +1 -1
  97. package/src/components/nav/nav.scss +17 -17
  98. package/src/components/nav/nav.scss.backup +123 -0
  99. package/src/components/nav/nav.stories.tsx +36 -2
  100. package/src/components/progress/progress.scss +7 -7
  101. package/src/components/progress/progress.scss.backup +70 -0
  102. package/src/components/tag/tag.scss +10 -10
  103. package/src/components/tag/tag.scss.backup +130 -0
  104. package/src/components/tag/tag.stories.tsx +23 -2
  105. package/src/components/ui.stories.tsx +53 -19
  106. package/src/docs/accessibility.mdx +484 -0
  107. package/src/docs/composition.mdx +549 -0
  108. package/src/docs/css-variables.mdx +380 -0
  109. package/src/docs/fpkit-developer.mdx +545 -0
  110. package/src/introduction.mdx +356 -0
  111. package/src/styles/alert/alert.css +4 -4
  112. package/src/styles/badge/badge.css +2 -2
  113. package/src/styles/breadcrumbs/breadcrumb.css +5 -5
  114. package/src/styles/buttons/button.css +30 -27
  115. package/src/styles/buttons/button.css.map +1 -1
  116. package/src/styles/cards/card.css +35 -5
  117. package/src/styles/cards/card.css.map +1 -1
  118. package/src/styles/details/details.css +14 -14
  119. package/src/styles/dialog/dialog.css +3 -3
  120. package/src/styles/form/form.css +20 -10
  121. package/src/styles/form/form.css.map +1 -1
  122. package/src/styles/images/img.css +8 -8
  123. package/src/styles/index.css +179 -134
  124. package/src/styles/index.css.map +1 -1
  125. package/src/styles/layout/landmarks.css +21 -21
  126. package/src/styles/link/link.css +5 -5
  127. package/src/styles/list/list.css +1 -1
  128. package/src/styles/nav/nav.css +17 -17
  129. package/src/styles/progress/progress.css +6 -6
  130. package/src/styles/tag/tag.css +4 -4
  131. 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
- "A small inline label component for displaying status, versions, or environment indicators with WCAG 2.1 AA accessibility compliance.",
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.UI",
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 style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}>
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 style={{ fontSize: "0.875rem", color: "#721c24", marginTop: "0.5rem" }}>
804
- <strong>Problem:</strong> Screen readers cannot identify this button's
805
- purpose. <strong>Fix:</strong> Add <code>aria-label="Close"</code>
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 style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}>
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 style={{ fontSize: "0.875rem", color: "#721c24", marginTop: "0.5rem" }}>
829
- <strong>Problem:</strong> Not keyboard accessible or announced to screen
830
- readers. <strong>Fix:</strong> Use <code>as="button"</code> or add{" "}
831
- <code>role="button"</code>, <code>tabIndex=0</code>, and keyboard handlers.
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 style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}>
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 style={{ fontSize: "0.875rem", color: "#721c24", marginTop: "0.5rem" }}>
855
- <strong>Problem:</strong> Focus indicator contrast ratio is less than 3:1
856
- (WCAG 2.4.7). <strong>Fix:</strong> Use a contrasting color like dark blue
857
- on light blue background.
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 style={{ marginTop: 0, marginBottom: "0.5rem", color: "#dc3545" }}>
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 style={{ fontSize: "0.875rem", color: "#721c24", marginTop: "0.5rem" }}>
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 product
879
- documentation".
912
+ destination. <strong>Fix:</strong> Use descriptive text like "View
913
+ product documentation".
880
914
  </p>
881
915
  </div>
882
916
  </div>