@solexllc/usx-react 0.8.0 → 0.9.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 (58) hide show
  1. package/README.md +15 -0
  2. package/dist/index.cjs +3173 -3238
  3. package/dist/index.js +3174 -3239
  4. package/package.json +4 -4
  5. package/src/components/checkbox/Checkbox.tsx +9 -4
  6. package/src/components/checkbox/checkbox.django.html +2 -2
  7. package/src/components/checkbox/config.json +9 -0
  8. package/src/components/data-table/DataTable.tsx +177 -0
  9. package/src/components/data-table/README.md +42 -0
  10. package/src/components/data-table/TableBody.tsx +123 -0
  11. package/src/components/{table → data-table}/TableCell.tsx +6 -3
  12. package/src/components/data-table/TableContext.tsx +49 -0
  13. package/src/components/{table → data-table}/TableFoot.tsx +8 -7
  14. package/src/components/data-table/TableGroup.tsx +62 -0
  15. package/src/components/data-table/TableHead.tsx +126 -0
  16. package/src/components/data-table/TableRow.tsx +24 -0
  17. package/src/components/data-table/cells.ts +49 -0
  18. package/src/components/data-table/columns.ts +15 -0
  19. package/src/components/data-table/config.json +375 -0
  20. package/src/components/data-table/data-table.django-snapshot.html +13560 -0
  21. package/src/components/data-table/data-table.django.html +13 -0
  22. package/src/components/data-table/data-table.html +34 -0
  23. package/src/components/data-table/data-table.react-snapshot.html +12033 -0
  24. package/src/components/{table → data-table}/table-body.django.html +12 -12
  25. package/src/components/{table → data-table}/table-foot.django.html +6 -6
  26. package/src/components/data-table/table-group.django.html +24 -0
  27. package/src/components/data-table/table-head.django.html +21 -0
  28. package/src/components/data-table/table-row.django.html +57 -0
  29. package/src/components/{table → data-table}/types.ts +48 -5
  30. package/src/components/pagination/Pagination.tsx +7 -1
  31. package/src/components/pagination/config.json +8 -0
  32. package/src/components/pagination/navigation/PaginationNavigation.tsx +10 -0
  33. package/src/components/pagination/step-options/PaginationStepOptions.tsx +3 -0
  34. package/src/components/radio-buttons/RadioButtons.tsx +37 -27
  35. package/src/components/radio-buttons/config.json +19 -1
  36. package/src/components/radio-buttons/radio-buttons.django-snapshot.html +28 -60
  37. package/src/components/radio-buttons/radio-buttons.django.html +16 -28
  38. package/src/components/table/Table.tsx +64 -334
  39. package/src/components/table/config.json +21 -339
  40. package/src/components/table/table.django-snapshot.html +712 -1482
  41. package/src/components/table/table.django.html +14 -59
  42. package/src/components/table/table.html +7 -2364
  43. package/src/components/table/table.react-snapshot.html +711 -2085
  44. package/src/index.js +1 -0
  45. package/src/components/table/TableBody.tsx +0 -256
  46. package/src/components/table/TableContext.tsx +0 -87
  47. package/src/components/table/TableGroup.tsx +0 -69
  48. package/src/components/table/TableHead.tsx +0 -139
  49. package/src/components/table/TableRow.tsx +0 -56
  50. package/src/components/table/hooks/useRowDetails.ts +0 -34
  51. package/src/components/table/hooks/useTableGroups.ts +0 -61
  52. package/src/components/table/hooks/useTableSelect.ts +0 -82
  53. package/src/components/table/hooks/useTableSort.ts +0 -60
  54. package/src/components/table/table-group.django.html +0 -40
  55. package/src/components/table/table-head.django.html +0 -85
  56. package/src/components/table/table-row.django.html +0 -98
  57. package/src/components/table/table_helper.py +0 -298
  58. /package/src/components/{table → data-table}/table-detail-row.django.html +0 -0
@@ -1,60 +1,15 @@
1
- {% load static components %}
2
- {# ─── USX Table ───────────────────────────────────────────────────────────────── #}
3
- {# #}
4
- {# Primary props (same contract as React Table): #}
5
- {# columns, data, primaryKey, caption, striped, borderless, compact, #}
6
- {# scrollable, height, responsive, stickyHeader, stickyFirstColumn, #}
7
- {# selectionMode, selectionPosition, select, disabled, onClickRow, #}
8
- {# rowDetails, showFooter, paginate, placeholder, loading, className #}
9
- {# #}
10
- {# Django-only props (pre-computed by view via table_helper): #}
11
- {# header_rows — output of build_header_rows(columns) #}
12
- {# leaf_columns — output of get_leaf_cols(columns) #}
13
- {# total_cols — output of total_col_count(...) #}
14
- {# total_depth — len(header_rows) #}
15
- {# sort — {'key': ..., 'direction': 'asc'|'desc'|None} #}
16
- {# groups — output of group_data() when groupBy is set #}
17
- {# footerValues — output of compute_footer() when showFooter is True #}
18
- {# expandedRows — list of primary-key values with detail open #}
19
- {# rowDetailTemplate — path to a partial template for detail content #}
20
- {# rowDetailField — row dict key whose value is used as detail content #}
21
- {# rowUrlField — row dict key whose value is the navigation URL #}
22
- {# paginateUrlPrefix — URL prefix for pagination links (default '?page=') #}
23
- {# pagination — {'current_page', 'total_pages', 'total', 'page_size'} #}
24
- {# ─────────────────────────────────────────────────────────────────────────── #}
25
-
26
- {# ── Scrollable wrapper ──────────────────────────────────────────────────── #}
27
- {% if scrollable|default:False or height %}
28
- <div class="usa-table-container--scrollable usx-table-container--scrollable"
29
- tabindex="0"
30
- {% if height %}style="max-height: {{ height }}; overflow: auto;"{% endif %}>
31
- {% endif %}
32
-
33
- <table id="{{ id }}" class="usa-table usx-table{% if striped|default:False %} usa-table--striped{% endif %}{% if borderless|default:False %} usa-table--borderless{% endif %}{% if compact|default:False %} usa-table--compact{% endif %}{% if stickyHeader|default:False %} usa-table--sticky-header{% endif %}{% if responsive == 'stack' %} usa-table--stacked{% endif %}{% if responsive == 'stack-header' %} usa-table--stacked-header{% endif %}{% if stickyFirstColumn|default:False %} usx-table--sticky-first-col{% endif %}{% if className %} {{ className }}{% endif %}"
34
- >
35
- {% if caption %}
36
- <caption class="usx-table__caption">{{ caption }}</caption>
37
- {% endif %}
38
-
39
- {% table_head tableId=id header_rows=header_rows total_depth=total_depth sort=sort onSort=onSort selectionMode=selectionMode|default:None selectionPosition=selectionPosition|default:"left" rowDetails=rowDetails stickyFirstColumn=stickyFirstColumn|default:False %}{% endtable_head %}
40
-
41
- {% table_body tableId=id data=data groups=groups leaf_columns=leaf_columns total_cols=total_cols primaryKey=primaryKey|default:"id" select=select|default:"" disabled=disabled|default:"" selectionMode=selectionMode|default:None selectionPosition=selectionPosition|default:"left" onClickRow=onClickRow rowUrlField=rowUrlField rowDetails=rowDetails rowDetailTemplate=rowDetailTemplate rowDetailField=rowDetailField expandedRows=expandedRows responsive=responsive|default:False placeholder=placeholder loading=loading defaultExpanded=defaultExpanded %}{% endtable_body %}
42
-
43
- {% if showFooter %}
44
- {% table_foot tableId=id leaf_columns=leaf_columns footerValues=footerValues selectionMode=selectionMode|default:None rowDetails=rowDetails %}{% endtable_foot %}
45
- {% endif %}
46
-
1
+ {% load components %}
2
+ {% if scrollable %}<div class="usa-table-container--scrollable" tabindex="0"{% if scrollHeight %} style="height: {{ scrollHeight }}; overflow: auto"{% endif %}>{% endif %}
3
+ <table{% if id %} id="{{ id }}"{% endif %} class="usa-table usx-table{% if striped %} usa-table--striped{% endif %}{% if borderless %} usa-table--borderless{% endif %}{% if compact %} usa-table--compact{% endif %}{% if stickyHeader %} usa-table--sticky-header{% endif %}{% if responsive == 'stack' %} usa-table--stacked{% elif responsive == 'stack-header' %} usa-table--stacked-header{% endif %}{% if className %} {{ className }}{% endif %}">
4
+ <caption class="usx-table__caption">{{ caption|default:'Data table' }}</caption>
5
+ <thead><tr>{% for column in columns %}<th scope="col"{% if column.sortable %} data-sortable{% endif %}>{{ column.header }}</th>{% endfor %}</tr></thead>
6
+ <tbody>
7
+ {% for row in data %}<tr>
8
+ {% for column in columns %}{% with value=row|get_item:column.key %}
9
+ {% if column.primary %}<th scope="row"{% if responsive %} data-label="{{ column.header }}"{% endif %}>{{ value }}</th>{% else %}<td{% if responsive %} data-label="{{ column.header }}"{% endif %}>{{ value }}</td>{% endif %}
10
+ {% endwith %}{% endfor %}
11
+ </tr>{% endfor %}
12
+ </tbody>
47
13
  </table>
48
-
49
- {# USWDS sort announcement region — required for uncontrolled sort accessibility #}
50
- <div class="usa-sr-only usa-table__announcement-region" aria-live="polite"></div>
51
-
52
- {% if scrollable|default:False or height %}</div>{% endif %}
53
-
54
- {# ── Pagination ─────────────────────────────────────────────────────────── #}
55
- {% if paginate and pagination %}
56
- <div class="usx-table__pagination">
57
- {% pagination currentPage=pagination.current_page totalPages=pagination.total_pages pages=pagination.pages pageUrlPrefix=paginateUrlPrefix|default:"?page=" %}{% endpagination %}
58
- </div>
59
- {% endif %}
60
-
14
+ {% if columns|has_sortable %}<div class="usa-sr-only usa-table__announcement-region" aria-live="polite"></div>{% endif %}
15
+ {% if scrollable %}</div>{% endif %}