@solexllc/usx-react 0.8.0 → 0.10.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 (165) hide show
  1. package/README.md +16 -0
  2. package/dist/index.cjs +3231 -3270
  3. package/dist/index.js +3232 -3271
  4. package/package.json +4 -4
  5. package/src/components/accordion/Accordion.tsx +4 -1
  6. package/src/components/accordion/accordion.django.html +1 -1
  7. package/src/components/accordion/config.json +1 -0
  8. package/src/components/banner/Banner.tsx +3 -1
  9. package/src/components/banner/banner.django.html +1 -1
  10. package/src/components/banner/config.json +1 -0
  11. package/src/components/carousel/carousel.django-snapshot.html +0 -40
  12. package/src/components/carousel/carousel.react-snapshot.html +0 -38
  13. package/src/components/character-count/CharacterCount.tsx +3 -0
  14. package/src/components/character-count/character-count.django-snapshot.html +43 -0
  15. package/src/components/character-count/character-count.django.html +2 -2
  16. package/src/components/character-count/character-count.react-snapshot.html +37 -0
  17. package/src/components/character-count/config.json +9 -0
  18. package/src/components/checkbox/Checkbox.tsx +17 -13
  19. package/src/components/checkbox/checkbox.django-snapshot.html +18 -0
  20. package/src/components/checkbox/checkbox.django.html +6 -4
  21. package/src/components/checkbox/checkbox.react-snapshot.html +14 -0
  22. package/src/components/checkbox/config.json +10 -1
  23. package/src/components/checkbox-group/checkbox-group.django-snapshot.html +54 -0
  24. package/src/components/checkbox-group/checkbox-group.react-snapshot.html +45 -0
  25. package/src/components/combobox/Combobox.tsx +6 -1
  26. package/src/components/combobox/combobox.django-snapshot.html +141 -0
  27. package/src/components/combobox/combobox.django.html +2 -2
  28. package/src/components/combobox/combobox.react-snapshot.html +76 -0
  29. package/src/components/combobox/config.json +9 -0
  30. package/src/components/data-table/DataTable.tsx +180 -0
  31. package/src/components/data-table/README.md +42 -0
  32. package/src/components/data-table/TableBody.tsx +123 -0
  33. package/src/components/{table → data-table}/TableCell.tsx +6 -3
  34. package/src/components/data-table/TableContext.tsx +49 -0
  35. package/src/components/{table → data-table}/TableFoot.tsx +8 -7
  36. package/src/components/data-table/TableGroup.tsx +62 -0
  37. package/src/components/data-table/TableHead.tsx +126 -0
  38. package/src/components/data-table/TableRow.tsx +24 -0
  39. package/src/components/data-table/cells.ts +49 -0
  40. package/src/components/data-table/columns.ts +15 -0
  41. package/src/components/data-table/config.json +379 -0
  42. package/src/components/data-table/data-table.django-snapshot.html +13560 -0
  43. package/src/components/data-table/data-table.django.html +13 -0
  44. package/src/components/data-table/data-table.html +34 -0
  45. package/src/components/data-table/data-table.react-snapshot.html +12033 -0
  46. package/src/components/{table → data-table}/table-body.django.html +12 -12
  47. package/src/components/{table → data-table}/table-foot.django.html +6 -6
  48. package/src/components/data-table/table-group.django.html +24 -0
  49. package/src/components/data-table/table-head.django.html +21 -0
  50. package/src/components/data-table/table-row.django.html +57 -0
  51. package/src/components/{table → data-table}/types.ts +48 -5
  52. package/src/components/date-picker/DatePicker.tsx +6 -1
  53. package/src/components/date-picker/config.json +9 -0
  54. package/src/components/date-picker/date-picker.django-snapshot.html +23 -0
  55. package/src/components/date-picker/date-picker.django.html +4 -4
  56. package/src/components/date-picker/date-picker.react-snapshot.html +19 -0
  57. package/src/components/date-range-picker/DateRangePicker.tsx +11 -2
  58. package/src/components/date-range-picker/config.json +14 -0
  59. package/src/components/date-range-picker/date-range-picker.django-snapshot.html +47 -0
  60. package/src/components/date-range-picker/date-range-picker.django.html +5 -5
  61. package/src/components/date-range-picker/date-range-picker.react-snapshot.html +38 -0
  62. package/src/components/drawer/Drawer.tsx +3 -1
  63. package/src/components/drawer/config.json +4 -0
  64. package/src/components/drawer/drawer.django.html +1 -1
  65. package/src/components/file-input/FileInput.tsx +7 -2
  66. package/src/components/file-input/_contents.django.html +2 -1
  67. package/src/components/file-input/config.json +4 -0
  68. package/src/components/header/Header.tsx +15 -9
  69. package/src/components/header/config.json +1 -0
  70. package/src/components/header/header.django-snapshot.html +24 -0
  71. package/src/components/header/header.django.html +8 -4
  72. package/src/components/header/header.html +20 -0
  73. package/src/components/header/header.react-snapshot.html +20 -0
  74. package/src/components/in-page-nav/InPageNav.tsx +3 -0
  75. package/src/components/in-page-nav/config.json +1 -0
  76. package/src/components/in-page-nav/in-page-nav.django.html +1 -1
  77. package/src/components/input/Input.tsx +3 -0
  78. package/src/components/input/config.json +10 -0
  79. package/src/components/input/input.django-snapshot.html +24 -0
  80. package/src/components/input/input.django.html +4 -4
  81. package/src/components/input/input.react-snapshot.html +22 -0
  82. package/src/components/language-selector/LanguageSelector.tsx +10 -5
  83. package/src/components/language-selector/config.json +1 -0
  84. package/src/components/language-selector/language-selector.django.html +2 -2
  85. package/src/components/layout/Layout.tsx +3 -1
  86. package/src/components/layout/config.json +4 -0
  87. package/src/components/layout/layout.django.html +1 -1
  88. package/src/components/memorable-date/MemorableDate.tsx +18 -3
  89. package/src/components/memorable-date/config.json +15 -0
  90. package/src/components/memorable-date/memorable-date.django-snapshot.html +82 -0
  91. package/src/components/memorable-date/memorable-date.django.html +14 -14
  92. package/src/components/memorable-date/memorable-date.react-snapshot.html +70 -0
  93. package/src/components/modal/Modal.tsx +3 -0
  94. package/src/components/modal/config.json +1 -0
  95. package/src/components/modal/modal.django.html +1 -1
  96. package/src/components/pagination/Pagination.tsx +7 -1
  97. package/src/components/pagination/config.json +8 -0
  98. package/src/components/pagination/navigation/PaginationNavigation.tsx +10 -0
  99. package/src/components/pagination/step-options/PaginationStepOptions.tsx +3 -0
  100. package/src/components/popover/Popover.tsx +3 -0
  101. package/src/components/popover/config.json +4 -0
  102. package/src/components/popover/popover.django-snapshot.html +30 -0
  103. package/src/components/popover/popover.django.html +1 -0
  104. package/src/components/radio-buttons/RadioButtons.tsx +41 -27
  105. package/src/components/radio-buttons/config.json +19 -1
  106. package/src/components/radio-buttons/radio-buttons.django-snapshot.html +93 -60
  107. package/src/components/radio-buttons/radio-buttons.django.html +16 -28
  108. package/src/components/radio-buttons/radio-buttons.react-snapshot.html +53 -0
  109. package/src/components/range-slider/RangeSlider.tsx +4 -2
  110. package/src/components/range-slider/config.json +1 -0
  111. package/src/components/range-slider/range-slider.django-snapshot.html +17 -0
  112. package/src/components/range-slider/range-slider.django.html +4 -4
  113. package/src/components/range-slider/range-slider.react-snapshot.html +16 -0
  114. package/src/components/search/Search.tsx +6 -1
  115. package/src/components/search/config.json +5 -0
  116. package/src/components/search/search.django-snapshot.html +683 -563
  117. package/src/components/search/search.django.html +1 -1
  118. package/src/components/search/search.react-snapshot.html +25 -0
  119. package/src/components/select/Select.tsx +3 -1
  120. package/src/components/select/config.json +5 -0
  121. package/src/components/select/select.django-snapshot.html +15 -0
  122. package/src/components/select/select.django.html +2 -2
  123. package/src/components/select/select.react-snapshot.html +11 -0
  124. package/src/components/switch/Switch.tsx +13 -70
  125. package/src/components/switch/config.json +60 -23
  126. package/src/components/switch/switch.django-snapshot.html +507 -56
  127. package/src/components/switch/switch.django.html +23 -26
  128. package/src/components/switch/switch.html +425 -33
  129. package/src/components/switch/switch.react-snapshot.html +447 -58
  130. package/src/components/table/Table.tsx +66 -334
  131. package/src/components/table/config.json +22 -339
  132. package/src/components/table/table.django-snapshot.html +712 -1482
  133. package/src/components/table/table.django.html +14 -59
  134. package/src/components/table/table.html +7 -2364
  135. package/src/components/table/table.react-snapshot.html +711 -2085
  136. package/src/components/text-area/TextArea.tsx +3 -1
  137. package/src/components/text-area/config.json +5 -0
  138. package/src/components/text-area/text-area.django-snapshot.html +18 -0
  139. package/src/components/text-area/text-area.django.html +4 -4
  140. package/src/components/text-area/text-area.react-snapshot.html +16 -0
  141. package/src/components/theme-picker/ThemePicker.tsx +3 -1
  142. package/src/components/theme-picker/config.json +14 -1
  143. package/src/components/theme-picker/theme-picker.django-snapshot.html +64 -0
  144. package/src/components/theme-picker/theme-picker.django.html +2 -2
  145. package/src/components/theme-picker/theme-picker.react-snapshot.html +52 -0
  146. package/src/components/time-picker/TimePicker.tsx +6 -1
  147. package/src/components/time-picker/config.json +9 -0
  148. package/src/components/time-picker/time-picker.django-snapshot.html +26 -0
  149. package/src/components/time-picker/time-picker.django.html +4 -4
  150. package/src/components/time-picker/time-picker.react-snapshot.html +22 -0
  151. package/src/index.js +1 -0
  152. package/src/components/table/TableBody.tsx +0 -256
  153. package/src/components/table/TableContext.tsx +0 -87
  154. package/src/components/table/TableGroup.tsx +0 -69
  155. package/src/components/table/TableHead.tsx +0 -139
  156. package/src/components/table/TableRow.tsx +0 -56
  157. package/src/components/table/hooks/useRowDetails.ts +0 -34
  158. package/src/components/table/hooks/useTableGroups.ts +0 -61
  159. package/src/components/table/hooks/useTableSelect.ts +0 -82
  160. package/src/components/table/hooks/useTableSort.ts +0 -60
  161. package/src/components/table/table-group.django.html +0 -40
  162. package/src/components/table/table-head.django.html +0 -85
  163. package/src/components/table/table-row.django.html +0 -98
  164. package/src/components/table/table_helper.py +0 -298
  165. /package/src/components/{table → data-table}/table-detail-row.django.html +0 -0
@@ -25,14 +25,14 @@
25
25
  {# ── Grouped mode: render one <tbody> per group (no nested tables) ───────── #}
26
26
  {% if groups %}
27
27
  {% for group in groups %}
28
- {% table_group tableId=tableId groupKey=group.key label=group.key rows=group.rows leaf_columns=leaf_columns total_cols=total_cols primaryKey=primaryKey select=select disabled=disabled selectionMode=selectionMode selectionPosition=selectionPosition onClickRow=onClickRow rowUrlField=rowUrlField rowDetails=rowDetails rowDetailTemplate=rowDetailTemplate rowDetailField=rowDetailField expandedRows=expandedRows responsive=responsive defaultExpanded=defaultExpanded %}{% endtable_group %}
28
+ {% table_group tableId=tableId groupKey=group.key label=group.key rows=group.rows groupCells=group.groupCells leaf_columns=leaf_columns total_cols=total_cols primaryKey=primaryKey select=select disabled=disabled selectionMode=selectionMode selectionPosition=selectionPosition selectionVerticalAlign=selectionVerticalAlign onClickRow=onClickRow rowUrlField=rowUrlField rowDetails=rowDetails rowDetailTemplate=rowDetailTemplate rowDetailField=rowDetailField expandedRows=expandedRows responsive=responsive defaultExpanded=defaultExpanded groupRowClassName=groupRowClassName %}{% endtable_group %}
29
29
  {% endfor %}
30
30
 
31
31
  {% if loading %}
32
- <tbody class="usx-table__body usx-table__body--loading">
33
- <tr class="usx-table__loading-row" aria-live="polite">
34
- <td class="usx-table__loading-cell" colspan="{{ total_cols|default:1 }}">
35
- {% spinner label="Loading more rows…" size=3 %}{% endspinner %}
32
+ <tbody class="usx-data-table__body usx-data-table__body--loading">
33
+ <tr class="usx-data-table__loading-row" aria-live="polite">
34
+ <td class="usx-data-table__loading-cell" colspan="{{ total_cols|default:1 }}">
35
+ Loading more rows…
36
36
  </td>
37
37
  </tr>
38
38
  </tbody>
@@ -40,26 +40,26 @@
40
40
 
41
41
  {# ── Flat / empty mode: single tbody ─────────────────────────────────────── #}
42
42
  {% else %}
43
- <tbody class="usx-table__body">
43
+ <tbody class="usx-data-table__body">
44
44
 
45
45
  {% if not data %}
46
46
  {% if placeholder %}
47
- <tr class="usx-table__placeholder-row">
48
- <td class="usx-table__placeholder-cell" colspan="{{ total_cols|default:1 }}">
47
+ <tr class="usx-data-table__placeholder-row">
48
+ <td class="usx-data-table__placeholder-cell" colspan="{{ total_cols|default:1 }}">
49
49
  {{ placeholder }}
50
50
  </td>
51
51
  </tr>
52
52
  {% endif %}
53
53
  {% else %}
54
54
  {% for row in data %}
55
- {% table_row row=row rowIndex=forloop.counter0 leaf_columns=leaf_columns total_cols=total_cols primaryKey=primaryKey select=select disabled=disabled selectionMode=selectionMode selectionPosition=selectionPosition onClickRow=onClickRow rowUrlField=rowUrlField rowDetails=rowDetails rowDetailTemplate=rowDetailTemplate rowDetailField=rowDetailField expandedRows=expandedRows responsive=responsive %}{% endtable_row %}
55
+ {% table_row tableId=tableId row=row rowIndex=forloop.counter0 leaf_columns=leaf_columns total_cols=total_cols primaryKey=primaryKey select=select disabled=disabled selectionMode=selectionMode selectionPosition=selectionPosition selectionVerticalAlign=selectionVerticalAlign onClickRow=onClickRow rowUrlField=rowUrlField rowDetails=rowDetails rowDetailTemplate=rowDetailTemplate rowDetailField=rowDetailField expandedRows=expandedRows responsive=responsive %}{% endtable_row %}
56
56
  {% endfor %}
57
57
  {% endif %}
58
58
 
59
59
  {% if loading %}
60
- <tr class="usx-table__loading-row" aria-live="polite">
61
- <td class="usx-table__loading-cell" colspan="{{ total_cols|default:1 }}">
62
- {% spinner label="Loading more rows…" size=3 %}{% endspinner %}
60
+ <tr class="usx-data-table__loading-row" aria-live="polite">
61
+ <td class="usx-data-table__loading-cell" colspan="{{ total_cols|default:1 }}">
62
+ Loading more rows…
63
63
  </td>
64
64
  </tr>
65
65
  {% endif %}
@@ -7,23 +7,23 @@
7
7
  {# rowDetails truthy when row-detail column is present #}
8
8
  {# ──────────────────────────────────────────────────────────────────────────────── #}
9
9
 
10
- <tfoot class="usx-table__foot">
11
- <tr class="usx-table__foot-row">
10
+ <tfoot class="usx-data-table__foot">
11
+ <tr class="usx-data-table__foot-row">
12
12
 
13
13
  {# Empty cell for row-detail column #}
14
14
  {% if rowDetails %}
15
- <td class="usx-table__cell"></td>
15
+ <td class="usx-data-table__cell"></td>
16
16
  {% endif %}
17
17
 
18
18
  {# Empty cell for selection column #}
19
19
  {% if selectionMode and selectionMode != "null" %}
20
- <td class="usx-table__cell usx-table__cell--selection"></td>
20
+ <td class="usx-data-table__cell usx-data-table__cell--selection"></td>
21
21
  {% endif %}
22
22
 
23
23
  {# Footer values per leaf column #}
24
24
  {% for col in leaf_columns %}
25
- <td class="usx-table__cell{% if col.align %} usx-table__cell--align-{{ col.align }}{% endif %}">
26
- {% for fk, fv in footerValues.items %}{% if fk == col.key %}{{ fv }}{% endif %}{% endfor %}
25
+ <td class="usx-data-table__cell{% if col.align %} usx-data-table__cell--align-{{ col.align }}{% endif %}">
26
+ {{ footerValues|get_item:col.key }}
27
27
  </td>
28
28
  {% endfor %}
29
29
 
@@ -0,0 +1,24 @@
1
+ {% load static components usx_components %}
2
+ {% with expanded=defaultExpanded|default_bool:True %}
3
+ <tbody class="usx-data-table__group usx-data-table__group--header">
4
+ <tr class="usx-data-table__group-row{% if groupRowClassName %} {{ groupRowClassName }}{% endif %}">
5
+ {% if groupCells %}
6
+ {% if rowDetails %}<td class="usx-data-table__group-cell"></td>{% endif %}
7
+ {% if selectionMode and selectionPosition != 'right' %}<td class="usx-data-table__group-cell"></td>{% endif %}
8
+ {% for cell in groupCells %}{% with column=cell.column options=cell.options %}
9
+ {% if forloop.first %}<th scope="row"{% else %}<td{% endif %} class="usx-data-table__group-cell{% if options.align %} usx-data-table__cell--align-{{ options.align }}{% elif column.align %} usx-data-table__cell--align-{{ column.align }}{% endif %}{% if options.verticalAlign %} usx-data-table__cell--valign-{{ options.verticalAlign }}{% elif column.verticalAlign %} usx-data-table__cell--valign-{{ column.verticalAlign }}{% endif %}{% if column.className %} {{ column.className }}{% endif %}"{% if options.colSpan %} colspan="{{ options.colSpan }}"{% elif column.colSpan %} colspan="{{ column.colSpan }}"{% endif %}{% if options.backgroundColor or column.backgroundColor or options.color or column.color %} style="{% if options.backgroundColor %}background-color: {{ options.backgroundColor }};{% elif column.backgroundColor %}background-color: {{ column.backgroundColor }};{% endif %}{% if options.color %}color: {{ options.color }};{% elif column.color %}color: {{ column.color }};{% endif %}"{% endif %}>
10
+ {% if forloop.first %}<button type="button" class="usx-data-table__group-toggle" aria-expanded="{{ expanded|yesno:'true,false' }}" aria-controls="{{ tableId }}-group-{{ groupKey }}-content">{{ cell.value }}</button>{% else %}{% if options.align == 'center' or not options.align and column.align == 'center' %}<div class="usx-data-table__cell-content">{% endif %}{{ cell.value }}{% if options.align == 'center' or not options.align and column.align == 'center' %}</div>{% endif %}{% endif %}
11
+ {% if forloop.first %}</th>{% else %}</td>{% endif %}
12
+ {% endwith %}{% endfor %}
13
+ {% if selectionMode and selectionPosition == 'right' %}<td class="usx-data-table__group-cell"></td>{% endif %}
14
+ {% else %}
15
+ <th scope="row" colspan="{{ total_cols|default:1 }}" class="usx-data-table__group-cell"><button type="button" class="usx-data-table__group-toggle" aria-expanded="{{ expanded|yesno:'true,false' }}" aria-controls="{{ tableId }}-group-{{ groupKey }}-content">{{ label }}</button></th>
16
+ {% endif %}
17
+ </tr>
18
+ </tbody>
19
+ <tbody class="usx-data-table__group usx-data-table__group--content" id="{{ tableId }}-group-{{ groupKey }}-content"{% if not expanded %} hidden{% endif %}>
20
+ {% for row in rows %}
21
+ {% table_row row=row rowIndex=forloop.counter0 leaf_columns=leaf_columns total_cols=total_cols primaryKey=primaryKey select=select disabled=disabled selectionMode=selectionMode selectionPosition=selectionPosition selectionVerticalAlign=selectionVerticalAlign onClickRow=onClickRow rowUrlField=rowUrlField rowDetails=rowDetails rowDetailTemplate=rowDetailTemplate rowDetailField=rowDetailField expandedRows=expandedRows responsive=responsive tableId=tableId %}{% endtable_row %}
22
+ {% endfor %}
23
+ </tbody>
24
+ {% endwith %}
@@ -0,0 +1,21 @@
1
+ {% load components %}
2
+ <thead class="usx-data-table__head">
3
+ {% if groupHeaders %}
4
+ <tr class="usx-data-table__head-row usx-data-table__head-row--groups">
5
+ {% if rowDetails %}<th scope="col" rowspan="{{ total_depth|add:1 }}" class="usx-data-table__cell usx-data-table__cell--detail-toggle">Details</th>{% endif %}
6
+ {% if selectionMode and selectionPosition != 'right' %}<th scope="col" rowspan="{{ total_depth|add:1 }}" class="usx-data-table__cell usx-data-table__cell--selection usx-data-table__cell--valign-{{ selectionVerticalAlign }}">{% if selectionMode == 'checkbox' %}{% checkbox id=tableId|add:'-select-all' label='' ariaLabel='Select all rows' small=True formGroup=False %}{% endcheckbox %}{% endif %}</th>{% endif %}
7
+ {% for column in groupHeaders %}<th scope="col" class="usx-data-table__cell{% if column.align %} usx-data-table__cell--align-{{ column.align }}{% endif %}{% if column.verticalAlign %} usx-data-table__cell--valign-{{ column.verticalAlign }}{% endif %}{% if column.className %} {{ column.className }}{% endif %}"{% if column.colSpan > 1 %} colspan="{{ column.colSpan }}"{% endif %}{% if column.backgroundColor or column.color %} style="{% if column.backgroundColor %}background-color: {{ column.backgroundColor }};{% endif %}{% if column.color %} color: {{ column.color }};{% endif %}"{% endif %}>{{ column.header }}</th>{% endfor %}
8
+ {% if selectionMode and selectionPosition == 'right' %}<th scope="col" rowspan="{{ total_depth|add:1 }}" class="usx-data-table__cell usx-data-table__cell--selection usx-data-table__cell--valign-{{ selectionVerticalAlign }}">{% if selectionMode == 'checkbox' %}{% checkbox id=tableId|add:'-select-all' label='' ariaLabel='Select all rows' small=True formGroup=False %}{% endcheckbox %}{% endif %}</th>{% endif %}
9
+ </tr>
10
+ {% endif %}
11
+ {% for header_row in header_rows %}
12
+ <tr class="usx-data-table__head-row">
13
+ {% if forloop.first and not groupHeaders and rowDetails %}<th scope="col" class="usx-data-table__cell usx-data-table__cell--detail-toggle" aria-label="Row details"{% if total_depth > 1 %} rowspan="{{ total_depth }}"{% endif %}></th>{% endif %}
14
+ {% if forloop.first and not groupHeaders and selectionMode and selectionPosition != 'right' %}<th scope="col" class="usx-data-table__cell usx-data-table__cell--selection usx-data-table__cell--valign-{{ selectionVerticalAlign }}"{% if total_depth > 1 %} rowspan="{{ total_depth }}"{% endif %}>{% if selectionMode == 'checkbox' %}{% checkbox id=tableId|add:'-select-all' label='' ariaLabel='Select all rows' small=True formGroup=False %}{% endcheckbox %}{% endif %}</th>{% endif %}
15
+ {% for cell in header_row %}{% with column=cell.col %}
16
+ <th scope="col" class="usx-data-table__cell{% if column.headerAlign %} usx-data-table__cell--align-{{ column.headerAlign }}{% elif column.align %} usx-data-table__cell--align-{{ column.align }}{% endif %}{% if column.headerClassName %} {{ column.headerClassName }}{% endif %}"{% if cell.row_span > 1 %} rowspan="{{ cell.row_span }}"{% endif %}{% if cell.col_span > 1 %} colspan="{{ cell.col_span }}"{% endif %}{% if column.sortable and not column.columns %} data-usx-sortable="true"{% endif %} data-column-key="{{ column.key }}"{% if column.headerBackgroundColor or column.headerColor or column.width %} style="{% if column.headerBackgroundColor %}background-color: {{ column.headerBackgroundColor }};{% endif %}{% if column.headerColor %} color: {{ column.headerColor }};{% endif %}{% if column.width %} width: {{ column.width }};{% endif %}"{% endif %}>{{ column.header }}</th>
17
+ {% endwith %}{% endfor %}
18
+ {% if forloop.first and not groupHeaders and selectionMode and selectionPosition == 'right' %}<th scope="col" class="usx-data-table__cell usx-data-table__cell--selection usx-data-table__cell--valign-{{ selectionVerticalAlign }}"{% if total_depth > 1 %} rowspan="{{ total_depth }}"{% endif %}>{% if selectionMode == 'checkbox' %}{% checkbox id=tableId|add:'-select-all' label='' ariaLabel='Select all rows' small=True formGroup=False %}{% endcheckbox %}{% endif %}</th>{% endif %}
19
+ </tr>
20
+ {% endfor %}
21
+ </thead>
@@ -0,0 +1,57 @@
1
+ {% load static components usx_components %}
2
+ {% with pk=row|get_item:primaryKey %}
3
+ {% with pk_string=pk|stringformat:'s' %}
4
+ <tr class="usx-data-table__row{% if pk in select %} usx-data-table__row--selected{% endif %}{% if pk in disabled %} usx-data-table__row--disabled{% endif %}{% if onClickRow and not pk in disabled %} usx-data-table__row--clickable{% endif %}{% if row.rowProps.className %} {{ row.rowProps.className }}{% endif %}" data-row-key="{{ pk }}" data-search-value="{{ row.usxSearchText }}"{% if row.rowProps.backgroundColor or row.rowProps.color %} style="{% if row.rowProps.backgroundColor %}--usx-data-table-row-bg: {{ row.rowProps.backgroundColor }};{% endif %}{% if row.rowProps.color %} color: {{ row.rowProps.color }};{% endif %}"{% endif %}>
5
+ {% if rowDetails and rowDetails != 'null' %}
6
+ <td class="usx-data-table__cell usx-data-table__cell--detail-toggle">
7
+ {% with isExpanded=expandedRows|contains:pk %}
8
+ {% dict aria_expanded=isExpanded aria_controls=tableId|add:'-row-detail-'|add:pk_string aria_label=isExpanded|yesno:'Collapse row details,Expand row details' as detailAttributes %}
9
+ {% button variant='unstyled' className='usx-data-table__detail-toggle' extraAttributes=detailAttributes %}
10
+ {% icon name='expand_more' size=2 staticBaseUrl=staticBaseUrl %}{% endicon %}
11
+ {% endbutton %}
12
+ {% endwith %}
13
+ </td>
14
+ {% endif %}
15
+
16
+ {% if selectionMode and selectionMode != 'null' and selectionPosition != 'right' %}
17
+ <td class="usx-data-table__cell usx-data-table__cell--selection usx-data-table__cell--valign-{{ selectionVerticalAlign }}">
18
+ {% if selectionMode == 'radio' %}
19
+ {% dict id=tableId|add:'-select-'|add:pk_string value=pk_string label='' ariaLabel=row.usxSelectionLabel checked=select|contains:pk disabled=disabled|contains:pk as option %}
20
+ {% make_list option as options %}
21
+ {% radio_buttons name=tableId|add:'-selection' options=options fieldset=False small=True formGroup=False %}{% endradio_buttons %}
22
+ {% else %}
23
+ {% checkbox id=tableId|add:'-select-'|add:pk_string name=tableId|add:'-selection' value=pk_string label='' ariaLabel=row.usxSelectionLabel checked=select|contains:pk disabled=disabled|contains:pk small=True formGroup=False %}{% endcheckbox %}
24
+ {% endif %}
25
+ </td>
26
+ {% endif %}
27
+
28
+ {% for cell in row.usxCells %}{% with col=cell.column options=cell.options %}
29
+ {% if col.primary %}<th scope="{% if cell.row_span > 1 %}rowgroup{% else %}row{% endif %}"{% else %}<td{% endif %}
30
+ class="usx-data-table__cell{% if options.align %} usx-data-table__cell--align-{{ options.align }}{% elif col.align %} usx-data-table__cell--align-{{ col.align }}{% endif %}{% if options.verticalAlign %} usx-data-table__cell--valign-{{ options.verticalAlign }}{% elif col.verticalAlign %} usx-data-table__cell--valign-{{ col.verticalAlign }}{% endif %}{% if cell.class_name %} {{ cell.class_name }}{% endif %}"
31
+ data-column-key="{{ col.key }}"
32
+ {% if cell.sort_value != None %}data-sort-value="{{ cell.sort_value }}"{% endif %}
33
+ {% if cell.col_span > 1 %}colspan="{{ cell.col_span }}"{% endif %}
34
+ {% if cell.row_span > 1 %}rowspan="{{ cell.row_span }}"{% endif %}
35
+ {% if responsive == 'stack' or responsive == 'stack-header' %}{% if col.stackLabel or col.header %}data-label="{{ col.stackLabel|default:col.header }}"{% endif %}{% endif %}
36
+ {% if col.width or options.backgroundColor or col.backgroundColor or options.color or col.color %}style="{% if col.width %}width: {{ col.width }};{% endif %}{% if options.backgroundColor %}background-color: {{ options.backgroundColor }};{% elif col.backgroundColor %}background-color: {{ col.backgroundColor }};{% endif %}{% if options.color %}color: {{ options.color }};{% elif col.color %}color: {{ col.color }};{% endif %}"{% endif %}
37
+ >{% if options.align == 'center' or not options.align and col.align == 'center' %}<div class="usx-data-table__cell-content">{% endif %}{{ row|get_item:col.key|default_if_none:'--' }}{% if options.align == 'center' or not options.align and col.align == 'center' %}</div>{% endif %}{% if col.primary %}</th>{% else %}</td>{% endif %}
38
+ {% endwith %}{% endfor %}
39
+
40
+ {% if selectionMode and selectionMode != 'null' and selectionPosition == 'right' %}
41
+ <td class="usx-data-table__cell usx-data-table__cell--selection usx-data-table__cell--valign-{{ selectionVerticalAlign }}">
42
+ {% if selectionMode == 'radio' %}
43
+ {% dict id=tableId|add:'-select-'|add:pk_string value=pk_string label='' ariaLabel=row.usxSelectionLabel checked=select|contains:pk disabled=disabled|contains:pk as option %}
44
+ {% make_list option as options %}
45
+ {% radio_buttons name=tableId|add:'-selection' options=options fieldset=False small=True formGroup=False %}{% endradio_buttons %}
46
+ {% else %}
47
+ {% checkbox id=tableId|add:'-select-'|add:pk_string name=tableId|add:'-selection' value=pk_string label='' ariaLabel=row.usxSelectionLabel checked=select|contains:pk disabled=disabled|contains:pk small=True formGroup=False %}{% endcheckbox %}
48
+ {% endif %}
49
+ </td>
50
+ {% endif %}
51
+ </tr>
52
+ {% if rowDetails and rowDetails != 'null' %}
53
+ <tr id="{{ tableId }}-row-detail-{{ pk }}" class="usx-data-table__detail-row"{% if not pk in expandedRows %} hidden{% endif %}>
54
+ <td colspan="{{ total_cols|default:1 }}" class="usx-data-table__detail-cell">{% if rowDetailField %}{{ row|get_item:rowDetailField }}{% endif %}</td>
55
+ </tr>
56
+ {% endif %}
57
+ {% endwith %}{% endwith %}
@@ -1,13 +1,41 @@
1
1
  import type { ReactNode } from 'react';
2
2
 
3
- export type TableRowData = Record<string, unknown>;
4
3
  export type RowKey = string | number;
5
4
  export type Align = 'left' | 'center' | 'right';
5
+ export type VerticalAlign = 'top' | 'middle' | 'bottom';
6
6
  export type SortDirection = 'asc' | 'desc' | null;
7
7
  export type SelectionMode = 'checkbox' | 'radio' | null;
8
8
  export type Responsive = false | 'stack' | 'stack-header';
9
9
  export type Aggregate = 'sum' | 'avg' | 'min' | 'max' | 'count';
10
10
 
11
+ export interface CellOptions {
12
+ colSpan?: number;
13
+ rowSpan?: number;
14
+ align?: Align;
15
+ verticalAlign?: VerticalAlign;
16
+ backgroundColor?: string;
17
+ color?: string;
18
+ className?: string;
19
+ }
20
+
21
+ export interface RowOptions {
22
+ backgroundColor?: string;
23
+ color?: string;
24
+ className?: string;
25
+ }
26
+
27
+ export interface TableRowData extends Record<string, unknown> {
28
+ rowProps?: RowOptions;
29
+ cellProps?: Record<string, CellOptions>;
30
+ }
31
+
32
+ export interface GroupColumn extends Omit<CellOptions, 'rowSpan'> {
33
+ key: string;
34
+ header: ReactNode;
35
+ /** The first group column displays the group key unless a value is supplied. */
36
+ render?: (group: TableGroupEntry) => ReactNode;
37
+ }
38
+
11
39
  export interface SortState {
12
40
  key: string | null;
13
41
  direction: SortDirection;
@@ -21,16 +49,26 @@ export interface TableColumn {
21
49
  render?: (row: TableRowData, rowIndex: number) => ReactNode;
22
50
  footer?: ReactNode | ((data: TableRowData[]) => ReactNode);
23
51
  align?: Align;
52
+ verticalAlign?: VerticalAlign;
24
53
  headerAlign?: Align;
25
54
  sortable?: boolean;
26
- sortFn?: (a: TableRowData, b: TableRowData, direction: SortDirection) => number;
27
55
  width?: string | number;
28
56
  minWidth?: string;
29
57
  /** Render body cells as row-header `<th scope="row">`. */
30
58
  primary?: boolean;
31
59
  hidden?: boolean;
60
+ /** Exclude this column from client-side search. */
61
+ filterable?: boolean;
62
+ /** Text used by client-side search when the displayed value is computed. */
63
+ searchValue?: (row: TableRowData) => unknown;
64
+ /** Comparable value serialized into each cell for the shared JS sorter. */
65
+ sortValue?: (row: TableRowData) => string | number;
32
66
  className?: string;
33
67
  headerClassName?: string;
68
+ backgroundColor?: string;
69
+ color?: string;
70
+ headerBackgroundColor?: string;
71
+ headerColor?: string;
34
72
  aggregate?: Aggregate;
35
73
  /** data-label for stacked/responsive layouts when `header` isn't a plain string. */
36
74
  stackLabel?: string;
@@ -38,8 +76,15 @@ export interface TableColumn {
38
76
 
39
77
  export interface GroupByConfig {
40
78
  property: string;
79
+ /** Header band above the regular column headers. Defaults to columns for compatibility. */
80
+ headers?: GroupColumn[];
81
+ /** Cells displayed within each grouped row. */
82
+ columns?: GroupColumn[];
83
+ /** Classes applied to every grouped row, including bg-* and text-* utilities. */
84
+ rowClassName?: string;
85
+ /** Additional values for each group row, keyed by group key then column key. */
86
+ values?: Record<string, Record<string, unknown>>;
41
87
  expand?: RowKey[];
42
- onExpand?: (expanded: RowKey[]) => void;
43
88
  defaultExpanded?: boolean;
44
89
  }
45
90
  export type GroupBy = string | GroupByConfig | null | undefined;
@@ -47,7 +92,6 @@ export type GroupBy = string | GroupByConfig | null | undefined;
47
92
  export interface RowDetailsConfig {
48
93
  render?: (row: TableRowData) => ReactNode;
49
94
  expand?: RowKey[];
50
- onExpand?: (expanded: RowKey[]) => void;
51
95
  expandLabel?: string | ((row: TableRowData) => string);
52
96
  }
53
97
  export type RowDetails = ((row: TableRowData) => ReactNode) | RowDetailsConfig | null | undefined;
@@ -57,7 +101,6 @@ export interface PaginateConfig {
57
101
  pageSizeOptions?: number[];
58
102
  /** Total item count — enables server-side mode. */
59
103
  totalCount?: number;
60
- onPageChange?: (page: number, pageSize: number) => void;
61
104
  showStepOptions?: boolean;
62
105
  showSummary?: boolean;
63
106
  }
@@ -6,10 +6,12 @@ import ErrorMessage from '../error-message/ErrorMessage';
6
6
  import FormGroup from '../form-group/FormGroup';
7
7
 
8
8
  export interface DatePickerProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue'> {
9
+ extraAttributes?: Record<string, unknown>;
9
10
  label?: React.ReactNode;
10
11
  hint?: React.ReactNode;
11
12
  error?: React.ReactNode;
12
13
  defaultValue?: string | null;
14
+ value?: string;
13
15
  minDate?: string | null;
14
16
  maxDate?: string | null;
15
17
  rangeDate?: string | null;
@@ -25,11 +27,13 @@ export default function DatePicker({
25
27
  disabled = false,
26
28
  required = false,
27
29
  defaultValue = null,
30
+ value,
28
31
  minDate = null,
29
32
  maxDate = null,
30
33
  rangeDate = null,
31
34
  formGroup = true,
32
35
  className = '',
36
+ extraAttributes,
33
37
  ...props
34
38
  }: DatePickerProps) {
35
39
  const labelId = `${id}-label`;
@@ -47,8 +51,9 @@ export default function DatePicker({
47
51
  {hint && <Hint id={hintId}>{hint}</Hint>}
48
52
  {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}
49
53
  <div
54
+ {...extraAttributes}
50
55
  className={classNames('usa-date-picker', 'usx-date-picker', className)}
51
- {...(defaultValue ? { 'data-default-value': defaultValue } : {})}
56
+ {...((value ?? defaultValue) ? { 'data-default-value': value ?? defaultValue } : {})}
52
57
  {...(minDate ? { 'data-min-date': minDate } : {})}
53
58
  {...(maxDate ? { 'data-max-date': maxDate } : {})}
54
59
  {...(rangeDate ? { 'data-range-date': rangeDate } : {})}
@@ -9,6 +9,10 @@
9
9
  "hint": "mm/dd/yyyy"
10
10
  },
11
11
  "props": {
12
+ "extraAttributes": {
13
+ "type": "object",
14
+ "description": "Additional attributes on the USWDS enhancement target."
15
+ },
12
16
  "id": {
13
17
  "type": "string",
14
18
  "default": "appointment-date",
@@ -45,6 +49,11 @@
45
49
  "type": "string",
46
50
  "description": "Initial date (yyyy-mm-dd). Sets data-default-value on the usa-date-picker wrapper."
47
51
  },
52
+ "value": {
53
+ "type": "string",
54
+ "default": null,
55
+ "description": "Date used to initialize the USWDS date picker, taking precedence over defaultValue."
56
+ },
48
57
  "minDate": {
49
58
  "type": "string",
50
59
  "description": "Earliest selectable date (yyyy-mm-dd). Sets data-min-date on the wrapper."
@@ -148,3 +148,26 @@
148
148
  />
149
149
  </div>
150
150
  </div>
151
+
152
+ <h3 class="site-preview-heading">With Value</h3>
153
+ <div class="usa-form-group usx-form-group">
154
+ <label
155
+ id="django-date-picker-value-label"
156
+ class="usa-label usx-label"
157
+ for="django-date-picker-value"
158
+ >
159
+ Current date
160
+ </label>
161
+
162
+ <span class="usa-hint usx-hint" id="django-date-picker-value-hint">mm/dd/yyyy</span>
163
+
164
+ <div class="usa-date-picker usx-date-picker" data-default-value="2021-06-20">
165
+ <input
166
+ class="usa-input usx-input"
167
+ id="django-date-picker-value"
168
+ name="date-picker-value"
169
+ aria-labelledby="django-date-picker-value-label"
170
+ aria-describedby="django-date-picker-value-hint"
171
+ />
172
+ </div>
173
+ </div>
@@ -16,8 +16,8 @@
16
16
  {% endif %}
17
17
 
18
18
  <div
19
- class="usa-date-picker usx-date-picker{% if className %} {{ className }}{% endif %}"
20
- {% if defaultValue %} data-default-value="{{ defaultValue }}"{% endif %}
19
+ class="usa-date-picker usx-date-picker{% if className %} {{ className }}{% endif %}" {% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
20
+ {% if value is not None and value or value is None and defaultValue %} data-default-value="{% if value is not None %}{{ value }}{% else %}{{ defaultValue }}{% endif %}"{% endif %}
21
21
  {% if minDate %} data-min-date="{{ minDate }}"{% endif %}
22
22
  {% if maxDate %} data-max-date="{{ maxDate }}"{% endif %}
23
23
  {% if rangeDate %} data-range-date="{{ rangeDate }}"{% endif %}
@@ -47,8 +47,8 @@
47
47
  {% endif %}
48
48
 
49
49
  <div
50
- class="usa-date-picker usx-date-picker{% if className %} {{ className }}{% endif %}"
51
- {% if defaultValue %} data-default-value="{{ defaultValue }}"{% endif %}
50
+ class="usa-date-picker usx-date-picker{% if className %} {{ className }}{% endif %}" {% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
51
+ {% if value is not None and value or value is None and defaultValue %} data-default-value="{% if value is not None %}{{ value }}{% else %}{{ defaultValue }}{% endif %}"{% endif %}
52
52
  {% if minDate %} data-min-date="{{ minDate }}"{% endif %}
53
53
  {% if maxDate %} data-max-date="{{ maxDate }}"{% endif %}
54
54
  {% if rangeDate %} data-range-date="{{ rangeDate }}"{% endif %}
@@ -120,3 +120,22 @@
120
120
  />
121
121
  </div>
122
122
  </div>
123
+
124
+ <h3 class="site-preview-heading">With Value</h3>
125
+ <div class="usa-form-group usx-form-group">
126
+ <label
127
+ id="react-date-picker-value-label"
128
+ class="usa-label usx-label"
129
+ for="react-date-picker-value"
130
+ >Current date</label
131
+ ><span class="usa-hint usx-hint" id="react-date-picker-value-hint">mm/dd/yyyy</span>
132
+ <div class="usa-date-picker usx-date-picker" data-default-value="2021-06-20">
133
+ <input
134
+ class="usa-input usx-input"
135
+ id="react-date-picker-value"
136
+ name="date-picker-value"
137
+ aria-labelledby="react-date-picker-value-label"
138
+ aria-describedby="react-date-picker-value-hint"
139
+ />
140
+ </div>
141
+ </div>
@@ -6,6 +6,7 @@ import ErrorMessage from '../error-message/ErrorMessage';
6
6
  import FormGroup from '../form-group/FormGroup';
7
7
 
8
8
  export interface DateRangePickerProps {
9
+ extraAttributes?: Record<string, unknown>;
9
10
  startId?: string;
10
11
  endId?: string;
11
12
  startName?: string;
@@ -20,6 +21,8 @@ export interface DateRangePickerProps {
20
21
  required?: boolean;
21
22
  defaultStartDate?: string | null;
22
23
  defaultEndDate?: string | null;
24
+ startDate?: string | null;
25
+ endDate?: string | null;
23
26
  minDate?: string | null;
24
27
  maxDate?: string | null;
25
28
  className?: string;
@@ -40,9 +43,12 @@ export default function DateRangePicker({
40
43
  required = false,
41
44
  defaultStartDate = null,
42
45
  defaultEndDate = null,
46
+ startDate,
47
+ endDate,
43
48
  minDate = null,
44
49
  maxDate = null,
45
50
  className = '',
51
+ extraAttributes,
46
52
  }: DateRangePickerProps) {
47
53
  const startLabelId = `${startId}-label`;
48
54
  const startHintId = startHint ? `${startId}-hint` : undefined;
@@ -56,6 +62,7 @@ export default function DateRangePicker({
56
62
 
57
63
  return (
58
64
  <div
65
+ {...extraAttributes}
59
66
  className={classNames('usa-date-range-picker', 'usx-date-range-picker', className)}
60
67
  {...(minDate ? { 'data-min-date': minDate } : {})}
61
68
  {...(maxDate ? { 'data-max-date': maxDate } : {})}
@@ -69,8 +76,9 @@ export default function DateRangePicker({
69
76
  {startHint && <Hint id={startHintId}>{startHint}</Hint>}
70
77
  {startError && <ErrorMessage id={startErrorId}>{startError}</ErrorMessage>}
71
78
  <div
79
+ data-enhanced={extraAttributes?.['data-enhanced'] === 'true' ? 'true' : undefined}
72
80
  className="usa-date-picker usx-date-picker"
73
- {...(defaultStartDate ? { 'data-default-value': defaultStartDate } : {})}
81
+ {...((startDate ?? defaultStartDate) ? { 'data-default-value': startDate ?? defaultStartDate } : {})}
74
82
  >
75
83
  <input
76
84
  className="usa-input usx-input"
@@ -93,8 +101,9 @@ export default function DateRangePicker({
93
101
  {endHint && <Hint id={endHintId}>{endHint}</Hint>}
94
102
  {endError && <ErrorMessage id={endErrorId}>{endError}</ErrorMessage>}
95
103
  <div
104
+ data-enhanced={extraAttributes?.['data-enhanced'] === 'true' ? 'true' : undefined}
96
105
  className="usa-date-picker usx-date-picker"
97
- {...(defaultEndDate ? { 'data-default-value': defaultEndDate } : {})}
106
+ {...((endDate ?? defaultEndDate) ? { 'data-default-value': endDate ?? defaultEndDate } : {})}
98
107
  >
99
108
  <input
100
109
  className="usa-input usx-input"
@@ -11,6 +11,10 @@
11
11
  "endHint": "mm/dd/yyyy"
12
12
  },
13
13
  "props": {
14
+ "extraAttributes": {
15
+ "type": "object",
16
+ "description": "Additional attributes on the USWDS enhancement target."
17
+ },
14
18
  "startId": {
15
19
  "type": "string",
16
20
  "default": "event-date-start",
@@ -71,10 +75,20 @@
71
75
  "type": "string",
72
76
  "description": "Initial start date (yyyy-mm-dd). Sets data-default-value on the start usa-date-picker wrapper."
73
77
  },
78
+ "startDate": {
79
+ "type": "string",
80
+ "default": null,
81
+ "description": "Start date used to initialize the USWDS date picker, taking precedence over defaultStartDate."
82
+ },
74
83
  "defaultEndDate": {
75
84
  "type": "string",
76
85
  "description": "Initial end date (yyyy-mm-dd). Sets data-default-value on the end usa-date-picker wrapper."
77
86
  },
87
+ "endDate": {
88
+ "type": "string",
89
+ "default": null,
90
+ "description": "End date used to initialize the USWDS date picker, taking precedence over defaultEndDate."
91
+ },
78
92
  "minDate": {
79
93
  "type": "string",
80
94
  "description": "Earliest selectable date (yyyy-mm-dd). Sets data-min-date on the usa-date-range-picker wrapper."
@@ -299,3 +299,50 @@
299
299
  </div>
300
300
  </div>
301
301
  </div>
302
+
303
+ <h3 class="site-preview-heading">With Values</h3>
304
+ <div class="usa-date-range-picker usx-date-range-picker">
305
+ <div class="usa-form-group usx-form-group">
306
+ <label
307
+ id="django-event-date-value-start-label"
308
+ class="usa-label usx-label"
309
+ for="django-event-date-value-start"
310
+ >
311
+ Event start date
312
+ </label>
313
+
314
+ <span class="usa-hint usx-hint" id="django-event-date-value-start-hint">mm/dd/yyyy</span>
315
+
316
+ <div class="usa-date-picker usx-date-picker" data-default-value="2021-06-20">
317
+ <input
318
+ class="usa-input usx-input"
319
+ id="django-event-date-value-start"
320
+ name="event-date-value-start"
321
+ aria-labelledby="django-event-date-value-start-label"
322
+ aria-describedby="django-event-date-value-start-hint"
323
+ />
324
+ </div>
325
+ </div>
326
+
327
+ <div class="usa-form-group usx-form-group">
328
+ <label
329
+ id="django-event-date-value-end-label"
330
+ class="usa-label usx-label"
331
+ for="django-event-date-value-end"
332
+ >
333
+ Event end date
334
+ </label>
335
+
336
+ <span class="usa-hint usx-hint" id="django-event-date-value-end-hint">mm/dd/yyyy</span>
337
+
338
+ <div class="usa-date-picker usx-date-picker" data-default-value="2021-06-27">
339
+ <input
340
+ class="usa-input usx-input"
341
+ id="django-event-date-value-end"
342
+ name="event-date-value-end"
343
+ aria-labelledby="django-event-date-value-end-label"
344
+ aria-describedby="django-event-date-value-end-hint"
345
+ />
346
+ </div>
347
+ </div>
348
+ </div>
@@ -1,7 +1,7 @@
1
1
  {# Django template for DateRangePicker #}
2
2
  {% load usx_components %}
3
3
  <div
4
- class="usa-date-range-picker usx-date-range-picker{% if className %} {{ className }}{% endif %}"
4
+ class="usa-date-range-picker usx-date-range-picker{% if className %} {{ className }}{% endif %}" {% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
5
5
  {% if minDate %} data-min-date="{{ minDate }}"{% endif %}
6
6
  {% if maxDate %} data-max-date="{{ maxDate }}"{% endif %}
7
7
  >
@@ -19,8 +19,8 @@
19
19
  {% endif %}
20
20
 
21
21
  <div
22
- class="usa-date-picker usx-date-picker"
23
- {% if defaultStartDate %} data-default-value="{{ defaultStartDate }}"{% endif %}
22
+ class="usa-date-picker usx-date-picker"{% if extraAttributes %}{% for attr, value in extraAttributes.items %}{% if attr == "data-enhanced" %} data-enhanced="{{ value }}"{% endif %}{% endfor %}{% endif %}
23
+ {% if startDate is not None and startDate or startDate is None and defaultStartDate %} data-default-value="{% if startDate is not None %}{{ startDate }}{% else %}{{ defaultStartDate }}{% endif %}"{% endif %}
24
24
  >
25
25
  <input
26
26
  class="usa-input usx-input"
@@ -48,8 +48,8 @@
48
48
  {% endif %}
49
49
 
50
50
  <div
51
- class="usa-date-picker usx-date-picker"
52
- {% if defaultEndDate %} data-default-value="{{ defaultEndDate }}"{% endif %}
51
+ class="usa-date-picker usx-date-picker"{% if extraAttributes %}{% for attr, value in extraAttributes.items %}{% if attr == "data-enhanced" %} data-enhanced="{{ value }}"{% endif %}{% endfor %}{% endif %}
52
+ {% if endDate is not None and endDate or endDate is None and defaultEndDate %} data-default-value="{% if endDate is not None %}{{ endDate }}{% else %}{{ defaultEndDate }}{% endif %}"{% endif %}
53
53
  >
54
54
  <input
55
55
  class="usa-input usx-input"