feat(beta): add BasicTable beta component (src/beta/basic-table-0.1) - #4868
Draft
gethinwebster wants to merge 12 commits into
Draft
feat(beta): add BasicTable beta component (src/beta/basic-table-0.1)#4868gethinwebster wants to merge 12 commits into
gethinwebster wants to merge 12 commits into
Conversation
Moved from the standalone AWS-UI-Basic-Table-Components package. Flat API (BasicTable + BasicTable* named exports). Toolkit imports re-pointed to the OSS @cloudscape-design/component-toolkit + repo originals (table-role, sticky-columns, drag-handle-wrapper, transition); vendored dupes deleted.
… exports listBetaItems() enumerates src/beta/* ; excluded 'beta' from listPublicItems so it is not treated as a normal component (kept out of the top-level barrel). package.json exports gains ./beta/<name> -> ./beta/<name>/index.js.
…pass Variant A: each flat BasicTable* part gets its own dir (basic-table-row, ...) whose basename pascalCases to the component name, so the documenter names each natively (no documenter-package change). docs.js gains a beta pass with glob src/beta/*/*/index.tsx (verified via micromatch to match exactly the 7 component dirs). Subpath entry re-exports the unchanged flat surface.
Converts the 9 ported suites to jest globals and the flat BasicTable* API (71/84 green in a source run). NOT wired to the repo's build-then-test-against-lib model yet: the global css.js mapper was reverted, and the RTL12 renderHook import + test-utils-from-lib + test-utils-gen-for-beta remain. Pending test-model decision.
- beta tests import component/test-utils/styles from lib/components/beta/... and renderHook from the repo's src/__tests__/render-hook helper (RTL12 has none). - re-point base-component + use-base-component to repo originals (drop vendored copies whose orphan styles.css.js side-effect broke the lib build). - re-point styles.scss to repo internal/styles + tokens (drop vendored internal/styles). - add beta test-utils/dom subpath export. All 9 suites green (84/84) against lib via gulp quick-build.
- part dirs are now documenter-recognized wrappers (function decls / forwardRef); root component dir is lean (BasicTable + BasicTableProps), hooks+shared types live on the beta entry. - getAllComponents excludes 'beta' so the documenter snapshot governs stable components only (beta is opt-in/ungoverned). - beta documenter pass deferred with a TODO: parts extend React.*HTMLAttributes which the documenter can't serialize (ReactEventHandler<T>); unblock by minimizing part interfaces (also aligns with the minimal-interface convention). docs() OK, documenter snapshot green (97), beta unit 84/84, build green.
…d internal/types, relocate test-utils to root - Remove use-virtualization primitive + its 3 test suites; virtualization is now bring-your-own (consumer spreads offset/measure props onto Body/Row). - Delete the vendored internal/ and types/ folders; re-point apply-display-name, events, and the base-component/event types to the repo originals (extends the toolkit-revert). - Move test-utils from beta/basic-table-0.1/test-utils to src/test-utils/dom/basic-table so it is generated + exported like every other component (drops the beta test-utils subpath). - Reword USAGE.md + interface/code comments to reflect BYO virtualization.
…tils - Add BasicTable to the test-utils pluralization map (findAllBasicTables). - Make findRowByIndex use a nth-child selector so the generated selectors wrapper compiles. - Regenerate documenter snapshot to include the BasicTable dom/selectors test-utils definitions.
…nter Drop `React.*HTMLAttributes` from HeaderCell/Body/Row/Cell props in favour of an explicit, minimal surface: className, style, and a `data-*` pass-through (so 3rd-party virtualization libraries — react-window, TanStack Virtual — can spread their measurement hooks), plus `aria-sort` (sortable header) and `aria-rowindex` (virtualized row-position override). This removes the event-handler grab-bag the documenter cannot serialize and over-exposed the DOM. Retype `Row.onToggleExpand` as a `NonCancelableEventHandler` (Cloudscape event convention — the documenter rejects a bare `() => void` on an `on*` prop); the internal row context keeps a plain thunk and Row fires the event. Re-enable the beta documenter pass, writing definitions to a separate `components-beta` folder so it does not clobber the stable `components` index barrel (each pass rewrites the index from its own glob). Verified: quick-build green; 6 beta suites / 58 tests pass against lib; documenter snapshot test 97 pass (stable definitions unaffected); beta definitions generate for all 7 components.
Expose the beta api-docs barrel at @cloudscape-design/components-definitions/components-beta so the website's component-metadata definitions can source the beta components' definitions (the beta documenter pass writes here to avoid clobbering the stable components index).
…arate barrel) Per review, beta components must not ship as a separate definitions barrel. The docs task now documents the stable components AND the versioned beta components into the single `components` output via a combined glob, and post-stamps the 7 beta definitions with releaseStatus: 'beta' (the documenter hard-codes 'stable' with no tag override). The website already derives isBeta from releaseStatus, so beta components surface (beta header alert + nav badge) with no website definitions wiring. Reverts the separate components-beta subpath export. Verified: single components barrel = 95 stable + 7 beta; beta defs flagged 'beta'; documenter snapshot test 97 pass (stable unaffected).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduces BasicTable as the first beta component, published at a versioned export path
@cloudscape-design/components/beta/basic-table-0.1. Because we publish via Brazil (no semver escapehatch), the version lives in the directory/subpath: a breaking API change bumps the dir
(
…-0.2) rather than the package version. This is the same escape-hatch idea used long ago for topnavigation, generalised here.
Moving BasicTable into the components repo (from a standalone package) lets it inherit the existing
build infrastructure out of the box — screenshot testing, multi-variant output, the documenter — and
lets us drop the shared code that had been duplicated into the toolkit.
Design decisions (feedback welcome — this establishes the beta convention):
BasicTable(root) +BasicTableHeader/HeaderCell/Body/Row/Cell/ExpandedContentasflat named exports (not a
BasicTable.Rowcompound namespace). Flat exports are individuallytree-shakeable, each is a normal documentable component, and it matches every existing repo
release/doc/test-utils convention.
beta/basic-table-0.1subpath; it is intentionally excluded from@cloudscape-design/components.src/beta/basic-table-0.1/so the documenter names each part from itsdir basename (Variant A) — no documenter-package change needed.
primitive. To window a large/streaming dataset, a consumer brings their own virtualizer and spreads
the offset/measure props onto
Body/Row;totalRowCountkeepsaria-rowcount/empty-detectioncorrect for the un-rendered rows.
@cloudscape-design/component-toolkit+ repooriginals (
table/table-role,table/sticky-columns,internal/components/*,internal/base-component,internal/events,internal/utils/apply-display-name). The vendoredinternal/andtypes/folders are deleted entirely — nothing is duplicated from the toolkit orrepo internals anymore.
BasicTablewrapper lives atsrc/test-utils/dom/basic-table/likeevery other component (not under
beta/*), so it is generated + exported the standard way:createWrapper().findBasicTable()and the./test-utils/dom/basic-tablesubpath both come for free.Build-tools additions (all beta-scoped):
listBetaItems()enumeratessrc/beta/*;betaexcluded fromlistPublicItems(kept out of thebarrel) and from the documenter-snapshot
getAllComponents.package.jsonexportsgains./beta/basic-table-0.1. Test-utils are NOT a beta subpath — thewrapper lives in the root tree, so it's exported as
./test-utils/dom/basic-tableand generatedinto the standard
createWrapper()aggregate (addedBasicTableto the test-utils pluralization map).Tracked follow-ups (not in this PR):
pass is deferred (commented, with a TODO): the parts currently
extends React.*HTMLAttributes, whichthe documenter can't serialise (
ReactEventHandler<T>). Unblock by minimising the part interfaces toexplicit, consumer-facing props — which also aligns with the repo's minimal-interface convention.
AWS-UI-Component-Toolkit(separate CR), now thatBasicTable uses the repo originals again.
How has this been tested?
Local
gulp quick-buildis green; the component compiles tolib/components/beta/basic-table-0.1/**with correct subpath exports, and the top-level barrel excludes it. All 6 beta unit suites pass
(58/58) under the repo's jest config (run against
lib, using the reporenderHookhelper). Thedocumenter snapshot test passes (97), regenerated to include the BasicTable dom/selectors test-utils
definitions; stable components are otherwise unchanged and beta is excluded from
getAllComponents.Draft: functional/visual-regression e2e pages and the beta documenter pass are follow-ups (see above).