@papillonarts/components 0.38.0 → 0.40.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 (76) hide show
  1. package/build/Legacy/Alert/Alert.d.ts.map +1 -1
  2. package/build/Legacy/Alert/Alert.js +2 -3
  3. package/build/Legacy/Alert/Alert.type.d.ts.map +1 -1
  4. package/build/Legacy/Alert/Alert.type.js +3 -1
  5. package/build/Legacy/Alert/__tests__/Alert.doc.md +74 -41
  6. package/build/Legacy/Blankslate/__tests__/Blankslate.doc.md +60 -22
  7. package/build/Legacy/BranchName/branch-name.scss +2 -2
  8. package/build/Legacy/Breadcrumb/Breadcrumb.js +1 -1
  9. package/build/Legacy/Breadcrumb/__tests__/Breadcrumb.doc.md +39 -13
  10. package/build/Legacy/Button/Button.js +3 -3
  11. package/build/Legacy/Button/Button.scss +4 -4
  12. package/build/Legacy/Button/ButtonGroup.scss +2 -2
  13. package/build/Legacy/Button/__tests__/Button.doc.md +339 -0
  14. package/build/Legacy/Button/misc.scss +2 -2
  15. package/build/Legacy/Dropdown/Dropdown.js +6 -6
  16. package/build/Legacy/Dropdown/__tests__/Dropdown.doc.md +54 -0
  17. package/build/Legacy/ErrorBoundary/ErrorBoundary.type.d.ts.map +1 -1
  18. package/build/Legacy/ErrorBoundary/__tests__/ErrorBoundary.doc.md +33 -0
  19. package/build/Legacy/Form/Checkbox/Checkbox.js +1 -1
  20. package/build/Legacy/Form/Checkbox/__tests__/Checkbox.doc.md +87 -0
  21. package/build/Legacy/Form/Input/__tests__/Input.doc.md +84 -0
  22. package/build/Legacy/Form/Radio/Radio.js +1 -1
  23. package/build/Legacy/Form/Radio/__tests__/Radio.doc.md +66 -0
  24. package/build/Legacy/Form/form-control.scss +4 -4
  25. package/build/Legacy/Form/form-select.scss +4 -4
  26. package/build/Legacy/Grid/DisplayTable/DisplayTable.js +5 -5
  27. package/build/Legacy/Grid/DisplayTable/__tests__/DisplayTable.doc.md +34 -0
  28. package/build/Legacy/Grid/FlexGrid/FlexGrid.d.ts.map +1 -1
  29. package/build/Legacy/Grid/FlexGrid/FlexGrid.js +12 -15
  30. package/build/Legacy/Grid/FlexGrid/__tests__/FlexGrid.doc.md +158 -0
  31. package/build/Legacy/Icon/__tests__/Icon.doc.md +58 -0
  32. package/build/Legacy/Label/Label.js +1 -1
  33. package/build/Legacy/Label/__tests__/Label.doc.md +33 -0
  34. package/build/Legacy/Label/mixins.scss +3 -3
  35. package/build/Legacy/Layout/container.scss +1 -1
  36. package/build/Legacy/Layout/grid-offset.scss +1 -1
  37. package/build/Legacy/Layout/grid.scss +2 -2
  38. package/build/Legacy/Loader/Loader.js +2 -2
  39. package/build/Legacy/Loader/__tests__/Loader.doc.md +61 -0
  40. package/build/Legacy/Markdown/__tests__/Markdown.doc.md +28 -13
  41. package/build/Legacy/Navigation/Menu/Menu.js +2 -2
  42. package/build/Legacy/Navigation/Menu/__tests__/Menu.doc.md +53 -0
  43. package/build/Legacy/Navigation/TabNav/__tests__/TabNav.doc.md +99 -0
  44. package/build/Legacy/Navigation/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  45. package/build/Legacy/Navigation/UnderlineNav/UnderlineNav.js +1 -2
  46. package/build/Legacy/Navigation/UnderlineNav/__tests__/UnderlineNav.doc.md +106 -0
  47. package/build/Legacy/Pagination/PreviousNext/PreviousNext.js +1 -1
  48. package/build/Legacy/Pagination/PreviousNext/PreviousNext.scss +2 -2
  49. package/build/Legacy/Pagination/PreviousNext/__tests__/PreviousNext.doc.md +57 -0
  50. package/build/Legacy/Popover/Popover.js +5 -5
  51. package/build/Legacy/Popover/__tests__/Popover.doc.md +260 -0
  52. package/build/Legacy/Progress/Progress.js +1 -1
  53. package/build/Legacy/Progress/__tests__/Progress.doc.md +51 -0
  54. package/build/Legacy/Select/Select.js +1 -1
  55. package/build/Legacy/Select/Select.scss +2 -2
  56. package/build/Legacy/Select/__tests__/Select.doc.md +54 -0
  57. package/build/Legacy/SelectMenu/SelectMenu.js +5 -5
  58. package/build/Legacy/SelectMenu/SelectMenu.scss +4 -4
  59. package/build/Legacy/SelectMenu/__tests__/SelectMenu.doc.md +35 -0
  60. package/build/Legacy/Subhead/Subhead.scss +3 -3
  61. package/build/Legacy/Subhead/__tests__/Subhead.doc.md +43 -0
  62. package/build/Legacy/SyntaxHighlighter/__tests__/SyntaxHighlighter.doc.md +45 -21
  63. package/build/Legacy/Toast/Toast.js +1 -1
  64. package/build/Legacy/Toast/Toast.scss +3 -3
  65. package/build/Legacy/Toast/__tests__/Toast.doc.md +73 -0
  66. package/build/Legacy/index.d.ts +1 -1
  67. package/build/Legacy/index.d.ts.map +1 -1
  68. package/build/Legacy/index.js +1 -1
  69. package/build/Modern/Flash/__tests__/Flash.doc.md +151 -6
  70. package/build/Modern/Link/__tests__/Link.doc.md +91 -5
  71. package/build/Modern/Pagination/__tests__/Pagination.doc.md +89 -7
  72. package/build/Modern/index.d.ts +1 -1
  73. package/build/Modern/index.d.ts.map +1 -1
  74. package/build/Modern/index.js +1 -1
  75. package/build/__tests__/README.md +159 -0
  76. package/package.json +4 -4
@@ -1,12 +1,94 @@
1
- # Pagination
1
+ # Features
2
2
 
3
- > Pagination component all features
3
+ ```
4
+ Pagination all props and variants
5
+ ```
6
+
7
+ ## Props
8
+
9
+ ```typescript
10
+ export type PaginationProps = {
11
+ className?: string
12
+ pageCount: number
13
+ currentPage: number
14
+ onPageChange?: (e: React.MouseEvent, n: number) => void
15
+ hrefBuilder?: (n: number) => string
16
+ marginPageCount?: number
17
+ showPages?: boolean | ResponsiveValue<boolean>
18
+ surroundingPageCount?: number
19
+ renderPage?: (props: PageProps) => React.ReactNode
20
+ }
21
+ ```
22
+
23
+ ## Variants
24
+
25
+ ```
26
+ Default
27
+
28
+ LargerPageCountMargin
29
+
30
+ HidePageNumbers
31
+
32
+ HidePageNumbersByViewport
33
+
34
+ HigherSurroundingPageCount
35
+
36
+ RenderLinks
37
+ ```
38
+
39
+ ### Default
40
+
41
+ > Pagination default variant
42
+
43
+ ```tsx
44
+ <Pagination pageCount={15} currentPage={2} onPageChange={(e) => e.preventDefault()} showPages={{ narrow: false }} />
45
+ ```
46
+
47
+ ### Larger PageCount Margin
48
+
49
+ > Pagination larger page count margin variant
4
50
 
51
+ ```tsx
52
+ <Pagination pageCount={15} currentPage={5} marginPageCount={4} onPageChange={(e) => e.preventDefault()} />
5
53
  ```
6
- # Featues
7
54
 
8
- > Defaults
9
- > LargerPageCountMargin
10
- > HidePageNumbers, HidePageNumbersByViewport, HigherSurroundingPageCount
11
- > RenderLinks
55
+ ### Hide Page Numbers
56
+
57
+ > Pagination hide page numbers variant
58
+
59
+ ```tsx
60
+ <Pagination pageCount={15} currentPage={5} showPages={false} onPageChange={(e) => e.preventDefault()} />
61
+ ```
62
+
63
+ ### Hide Page Numbers By Viewport
64
+
65
+ > Pagination hide page numbers by viewport variant
66
+
67
+ ```tsx
68
+ <Pagination pageCount={15} currentPage={5} showPages={{ narrow: false }} onPageChange={(e) => e.preventDefault()} />
69
+ <p>Page numbers are hidden on narrow viewports.</p>
70
+ ```
71
+
72
+ ### Higher Surrounding Page Count
73
+
74
+ > Pagination higher surrounding page count variant
75
+
76
+ ```tsx
77
+ <Pagination pageCount={15} currentPage={5} surroundingPageCount={4} onPageChange={(e) => e.preventDefault()} />
78
+ ```
79
+
80
+ ### Render Links
81
+
82
+ > Pagination render links variant
83
+
84
+ ```tsx
85
+ <Pagination
86
+ pageCount={15}
87
+ currentPage={page}
88
+ onPageChange={(e, n) => {
89
+ e.preventDefault()
90
+ setPage(n)
91
+ }}
92
+ renderPage={({ number, ...props }) => <ReactRouterLikeLink to={`#${number}`} {...props} />}
93
+ />
12
94
  ```
@@ -1,4 +1,4 @@
1
- import '@papillonarts/css/build/primer/index.scss';
1
+ import '@papillonarts/css/index.scss';
2
2
  import { Pagination } from './Pagination';
3
3
  export type { FlashProps } from './Flash';
4
4
  export type { LinkProps } from './Link';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Modern/index.ts"],"names":[],"mappings":"AAAA,OAAO,2CAA2C,CAAA;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAUlB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Modern/index.ts"],"names":[],"mappings":"AAAA,OAAO,8BAA8B,CAAA;AAGrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAUlB,CAAA"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Modern = void 0;
7
- require("@papillonarts/css/build/primer/index.scss");
7
+ require("@papillonarts/css/index.scss");
8
8
  var _Flash = require("./Flash");
9
9
  var _Link = require("./Link");
10
10
  var _Pagination = require("./Pagination");
@@ -0,0 +1,159 @@
1
+ # Test Environment
2
+
3
+ ## Date Handling
4
+
5
+ All tests use UTC timezone with ISO-like formatting to prevent snapshot drift across different environments and timezones.
6
+
7
+ Date.prototype methods are patched in [jest.setup.js](../../../../jest.setup.js) to ensure deterministic output:
8
+ - `toLocaleString()` → "yyyy-MM-ddTHH:mm:ssZ" (ISO-like, explicit UTC)
9
+ - `toLocaleDateString()` → "yyyy-MM-dd"
10
+ - `toLocaleTimeString()` → "HH:mm:ssZ"
11
+
12
+ **Example:**
13
+ ```javascript
14
+ new Date('2020-07-05T19:04:15Z').toLocaleString() // "2020-07-05T19:04:15Z"
15
+ ```
16
+
17
+ ## Test Scripts
18
+
19
+ - **`npm test`** - Fast parallel execution (no coverage, no snapshot updates)
20
+ - Best for: Local development, quick feedback
21
+ - Workers: 50% of CPU cores
22
+ - Duration: ~49s
23
+
24
+ - **`npm run test:ci`** - Full CI run (serial, coverage, updates snapshots)
25
+ - Best for: CI/CD, pre-commit validation, snapshot updates
26
+ - Workers: 1 (--runInBand for determinism)
27
+ - Duration: ~97s
28
+
29
+ - **`npm run test:coverage`** - Parallel with coverage
30
+ - Best for: Coverage reports without snapshot updates
31
+ - Workers: 50% of CPU cores
32
+ - Duration: ~49s
33
+
34
+ - **`npm run test:tdd`** - Watch mode for local development
35
+ - Best for: Test-driven development
36
+ - Features: Watch mode, verbose output, only changed files
37
+
38
+ - **`npm run test:update-snapshots`** - Update snapshots only
39
+ - Best for: Intentional snapshot updates without full CI run
40
+
41
+ - **`npm run test:generate-output`** - Generate JSON output for Storybook
42
+ - Best for: Storybook integration
43
+
44
+ ## Test Structure
45
+
46
+ ```
47
+ packages/components/src/
48
+ ├── Legacy/
49
+ │ ├── Button/
50
+ │ │ ├── __tests__/
51
+ │ │ │ ├── Button.test.ts # Test file
52
+ │ │ │ └── __snapshots__/ # Snapshot files
53
+ │ │ └── Button.tsx
54
+ │ └── ...
55
+ ├── Modern/
56
+ │ └── ...
57
+ └── __tests__/
58
+ ├── README.md # This file
59
+ └── test-utils.ts # Shared test utilities
60
+ ```
61
+
62
+ ## Test Conventions
63
+
64
+ - **Test files**: `*.test.ts` or `*.test.tsx`
65
+ - **Snapshot files**: Stored in `__snapshots__/` directories
66
+ - **Test utilities**: Shared helpers in `__tests__/test-utils.ts`
67
+
68
+ ## Coverage Thresholds
69
+
70
+ Thresholds reflect the broader instrumentation baseline and are enforced only in CI or when explicitly enabled.
71
+
72
+ | Metric | Threshold | Rationale |
73
+ |-------------|-----------|----------------------------------------------|
74
+ | Statements | 63% | Broader scope including library/lodash |
75
+ | Branches | 60% | Accounts for untested conditional paths |
76
+ | Functions | 52% | Library barrels and type-only exports |
77
+ | Lines | 64% | Matches statements threshold |
78
+
79
+ Enforcement:
80
+ - Local fast dev (`npm test`): thresholds not enforced.
81
+ - Local CI-style (`COVERAGE=true npm run test:ci`): thresholds enforced.
82
+ - CI (`CI=true npm run test:ci`): thresholds enforced.
83
+
84
+ ## Running Tests
85
+
86
+ ### Quick Development Cycle
87
+ ```bash
88
+ npm test # Fast feedback
89
+ npm run test:tdd # Watch mode
90
+ ```
91
+
92
+ ### Before Committing
93
+ ```bash
94
+ npm run test:ci # Full validation with coverage
95
+ ```
96
+
97
+ ### Updating Snapshots
98
+ ```bash
99
+ npm run test:update-snapshots # Update snapshots only
100
+ npm run test:ci # Update + coverage
101
+ ```
102
+
103
+ ## Shared Test Utilities
104
+
105
+ Use helpers from `test-utils.ts` to reduce boilerplate:
106
+
107
+ ```typescript
108
+ import { renderSnapshot, renderSnapshotAsync } from '../__tests__/test-utils'
109
+
110
+ // Synchronous snapshot
111
+ test('must match defaults()', () => {
112
+ renderSnapshot(defaults())
113
+ })
114
+
115
+ // Async snapshot
116
+ test('must match async()', async () => {
117
+ await renderSnapshotAsync(async())
118
+ })
119
+ ```
120
+
121
+ ## Troubleshooting
122
+
123
+ ### Snapshot Drift
124
+ If snapshots keep changing:
125
+ 1. Verify UTC timezone is set (`process.env.TZ = 'UTC'` in jest.setup.js)
126
+ 2. Check date formatting functions are using UTC methods (`getUTCDate()`, not `getDate()`)
127
+ 3. Run `npm run test:ci` to update snapshots with deterministic settings
128
+
129
+ ### Coverage Threshold Failures
130
+ - Local `npm test` does not enforce thresholds; use it for fast development.
131
+ - Use `COVERAGE=true npm run test:ci` to enforce thresholds locally before CI.
132
+ - Coverage thresholds are enforced in CI to maintain code quality.
133
+
134
+ ### Slow Test Execution
135
+ - Use `npm test` instead of `npm run test:ci` for development (2x faster)
136
+ - Use `npm run test:tdd` to run only changed tests
137
+ - Check for heavy setup/teardown in `beforeEach`/`afterEach` hooks
138
+
139
+ ## CI/CD Integration
140
+
141
+ For CI pipelines, always use:
142
+ ```bash
143
+ CI=true npm run test:ci
144
+ ```
145
+
146
+ This ensures:
147
+ - Serial execution for deterministic results
148
+ - Coverage reports for Codecov
149
+ - Snapshot updates are captured
150
+ - Coverage thresholds are enforced
151
+ - Consistent timing measurements
152
+
153
+ ## Shared Utilities
154
+
155
+ Import helpers from this folder to reduce boilerplate:
156
+
157
+ ```ts
158
+ import { renderSnapshot, renderSnapshotAsync, waitFor } from './test-utils'
159
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papillonarts/components",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "description": "Papillon Arts Components",
5
5
  "homepage": "https://github.com/papillonarts/papillonarts/tree/master/packages/components",
6
6
  "repository": {
@@ -26,8 +26,8 @@
26
26
  "build-release": "npm run build"
27
27
  },
28
28
  "dependencies": {
29
- "@papillonarts/css": "^0.38.0",
30
- "@papillonarts/library": "^0.38.0"
29
+ "@papillonarts/css": "^0.40.0",
30
+ "@papillonarts/library": "^0.40.0"
31
31
  },
32
- "gitHead": "af44ef015fbdee8b28e2dfbe647d8587e4307ce6"
32
+ "gitHead": "7a19d357d33591ad460a6cb42f18963082beffd8"
33
33
  }