@praxiis/ui 0.0.1 → 0.0.2

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 (26) hide show
  1. package/package.json +11 -12
  2. package/src/README.md +688 -0
  3. package/src/components/CalendarStrip/CalendarStrip.a11y.ts +51 -0
  4. package/src/components/CalendarStrip/DayCard/DayCard.a11y.ts +52 -0
  5. package/src/components/EmptyState/EmptyState.a11y.ts +53 -0
  6. package/src/components/Header/Header.a11y.ts +82 -0
  7. package/src/components/ScheduleItem/ScheduleItem/ScheduleItem.a11y.ts +15 -0
  8. package/src/primitives/actions/Button/Button.a11y.ts +38 -0
  9. package/src/primitives/actions/IconButton/IconButton.a11y.ts +55 -0
  10. package/src/primitives/content/Avatar/Avatar.a11y.ts +50 -0
  11. package/src/primitives/content/Badge/Badge.a11y.ts +83 -0
  12. package/src/primitives/content/Card/Card.a11y.ts +60 -0
  13. package/src/primitives/content/Chip/Chip.a11y.ts +101 -0
  14. package/src/primitives/content/Icon/Icon.a11y.ts +43 -0
  15. package/src/primitives/feedback/ProgressBar/ProgressBar.a11y.ts +68 -0
  16. package/src/primitives/feedback/Skeleton/Skeleton.a11y.ts +46 -0
  17. package/src/primitives/feedback/Spinner/Spinner.a11y.ts +47 -0
  18. package/src/primitives/feedback/Toast/Toast.a11y.ts +75 -0
  19. package/src/primitives/inputs/Checkbox/Checkbox.a11y.ts +47 -0
  20. package/src/primitives/inputs/RadioButton/RadioButton.a11y.ts +48 -0
  21. package/src/primitives/inputs/SegmentedControl/SegmentedControl.a11y.ts +59 -0
  22. package/src/primitives/inputs/SelectSheet/SelectSheet.a11y.ts +117 -0
  23. package/src/primitives/inputs/Switch/Switch.a11y.ts +29 -0
  24. package/src/primitives/inputs/TextInput/TextInput.a11y.ts +77 -0
  25. package/src/primitives/layout/Divider/Divider.a11y.ts +55 -0
  26. package/src/primitives/overlays/Modal/Modal.a11y.ts +64 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Modal Accessibility Helpers
3
+ *
4
+ * Generates accessibility props for the Modal component.
5
+ *
6
+ * WCAG References:
7
+ * - 4.1.2 Name, Role, Value: Modal needs proper label and modal indication
8
+ * - 1.3.1 Info and Relationships: State must be programmatically determinable
9
+ * - 2.4.3 Focus Order: Modal must trap focus when visible
10
+ *
11
+ * The modal uses accessibilityViewIsModal to indicate to assistive
12
+ * technologies that content behind the modal is not accessible.
13
+ *
14
+ * @see https://www.w3.org/WAI/WCAG21/Understanding/name-role-value
15
+ */
16
+
17
+ import type { ModalA11yParams, ModalA11yProps, ModalCloseButtonA11yParams } from "./Modal.types";
18
+
19
+ /**
20
+ * Generate accessibility props for Modal container.
21
+ *
22
+ * @param params - Accessibility parameters
23
+ * @returns Object to spread onto the Modal container
24
+ *
25
+ * @warning Logs console warning in dev if title and accessibilityLabel are both missing
26
+ *
27
+ * @example
28
+ * const a11yProps = getModalA11y({
29
+ * title: "Confirm Delete",
30
+ * position: "center",
31
+ * });
32
+ * // { accessible: true, accessibilityRole: "none", accessibilityLabel: "Confirm Delete dialog", accessibilityViewIsModal: true }
33
+ */
34
+ export function getModalA11y(params: ModalA11yParams): ModalA11yProps {
35
+ const { title, position, accessibilityLabel, fallbackTitle, positionLabels } = params;
36
+
37
+ if (!accessibilityLabel && !title && process.env.NODE_ENV !== "production") {
38
+ console.warn(
39
+ "[Modal] Missing title or accessibilityLabel (WCAG 4.1.2)"
40
+ );
41
+ }
42
+
43
+ const positionLabel = positionLabels[position];
44
+
45
+ return {
46
+ accessible: true,
47
+ accessibilityRole: "none",
48
+ accessibilityLabel:
49
+ accessibilityLabel || `${title || fallbackTitle} ${positionLabel}`,
50
+ accessibilityViewIsModal: true,
51
+ };
52
+ }
53
+
54
+ /**
55
+ * Get accessibility props for the modal close button.
56
+ */
57
+ export function getModalCloseButtonA11yProps(params: ModalCloseButtonA11yParams) {
58
+ return {
59
+ accessible: true as const,
60
+ accessibilityRole: "button" as const,
61
+ accessibilityLabel: params.closeLabel,
62
+ accessibilityHint: params.closeHint,
63
+ };
64
+ }