@gusto/embedded-react-sdk 0.55.3 → 0.55.5

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 (99) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.d.ts +2 -1
  3. package/dist/components/Common/DataView/DataCards/DataCards.js +63 -54
  4. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  5. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +14 -12
  6. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
  7. package/dist/components/Common/DataView/DataTable/DataTable.d.ts +2 -1
  8. package/dist/components/Common/DataView/DataTable/DataTable.js +75 -66
  9. package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
  10. package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js +8 -4
  11. package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js.map +1 -1
  12. package/dist/components/Common/DataView/DataView.js +18 -17
  13. package/dist/components/Common/DataView/DataView.js.map +1 -1
  14. package/dist/components/Company/Locations/LocationsList/List.js +27 -25
  15. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  16. package/dist/components/Company/Locations/LocationsList/LocationsList.js +41 -36
  17. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  18. package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -0
  19. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  20. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.d.ts +9 -2
  21. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +19 -18
  22. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  23. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +63 -62
  24. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  25. package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js +69 -65
  26. package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js.map +1 -1
  27. package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js +30 -23
  28. package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js.map +1 -1
  29. package/dist/components/Company/StateTaxes/shared/RequirementFields.d.ts +8 -4
  30. package/dist/components/Company/StateTaxes/shared/RequirementFields.js +13 -12
  31. package/dist/components/Company/StateTaxes/shared/RequirementFields.js.map +1 -1
  32. package/dist/components/Company/StateTaxes/shared/prepareRequirements.d.ts +29 -0
  33. package/dist/components/Company/StateTaxes/shared/prepareRequirements.js +24 -0
  34. package/dist/components/Company/StateTaxes/shared/prepareRequirements.js.map +1 -0
  35. package/dist/components/Company/StateTaxes/shared/prepareRequirements.test.d.ts +1 -0
  36. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +68 -55
  37. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  38. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +36 -35
  39. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  40. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +84 -96
  41. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
  42. package/dist/components/Flow/Flow.js +22 -22
  43. package/dist/components/Flow/Flow.js.map +1 -1
  44. package/dist/components/Flow/useFlow.js +3 -3
  45. package/dist/components/InformationRequests/InformationRequests.d.ts +1 -1
  46. package/dist/components/InformationRequests/InformationRequests.js +66 -52
  47. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  48. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +52 -50
  49. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  50. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
  51. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +86 -67
  52. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
  53. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +4 -0
  54. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.d.ts +1 -1
  55. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js +26 -21
  56. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -1
  57. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.d.ts +8 -1
  58. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +29 -17
  59. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
  60. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js +21 -18
  61. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js.map +1 -1
  62. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js +9 -7
  63. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js.map +1 -1
  64. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +2 -0
  65. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -1
  66. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +193 -191
  67. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  68. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +3 -2
  69. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +31 -31
  70. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  71. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +254 -243
  72. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  73. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +83 -76
  74. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  75. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +23 -22
  76. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  77. package/dist/components/Payroll/PayrollList/PayrollList.js +108 -97
  78. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  79. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +38 -37
  80. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  81. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +176 -167
  82. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  83. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
  84. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +173 -164
  85. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  86. package/dist/helpers/openPdfInNewTab.d.ts +15 -0
  87. package/dist/helpers/openPdfInNewTab.js +28 -0
  88. package/dist/helpers/openPdfInNewTab.js.map +1 -0
  89. package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
  90. package/dist/i18n/en/Payroll.OffCycleCreation.json.js +11 -9
  91. package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
  92. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +7 -7
  93. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +29 -27
  94. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
  95. package/dist/i18n/en/Payroll.PayrollOverview.json.js +43 -41
  96. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
  97. package/dist/i18n/types.d.ts +20 -0
  98. package/dist/style.css +1 -1
  99. package/package.json +17 -17
@@ -1,52 +1,53 @@
1
- import { jsxs as C, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as C, jsx as s } from "react/jsx-runtime";
2
2
  import { useRef as D, useMemo as w } from "react";
3
3
  import { PaginationControl as x } from "../PaginationControl/PaginationControl.js";
4
- import h from "./DataView.module.scss.js";
5
- import { DataTable as j } from "./DataTable/DataTable.js";
6
- import { DataCards as v } from "./DataCards/DataCards.js";
7
- import B from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
8
- const T = ({
4
+ import j from "./DataView.module.scss.js";
5
+ import { DataTable as v } from "./DataTable/DataTable.js";
6
+ import { DataCards as B } from "./DataCards/DataCards.js";
7
+ import M from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
8
+ const g = ({
9
9
  pagination: t,
10
- isFetching: s,
10
+ isFetching: o,
11
11
  breakAt: a = "small",
12
12
  breakpoints: i,
13
13
  footer: m,
14
14
  isWithinBox: p,
15
- emptyState: c,
16
- selectionMode: l,
15
+ emptyState: l,
16
+ selectionMode: c,
17
17
  onSelectAll: f,
18
18
  ...d
19
19
  }) => {
20
- const e = D(null), o = B({
20
+ const e = D(null), r = M({
21
21
  ref: e,
22
22
  breakpoints: i
23
- }), u = o.length > 0, r = !o.includes(a), b = w(() => r ? v : j, [r]);
23
+ }), u = r.length > 0, n = !r.includes(a), b = w(() => n ? B : v, [n]);
24
24
  return /* @__PURE__ */ C(
25
25
  "div",
26
26
  {
27
27
  "data-testid": "data-view",
28
- className: h.dataViewContainer,
28
+ className: j.dataViewContainer,
29
29
  ref: (k) => {
30
30
  e.current = k;
31
31
  },
32
32
  children: [
33
- u && /* @__PURE__ */ n(
33
+ u && /* @__PURE__ */ s(
34
34
  b,
35
35
  {
36
36
  ...d,
37
37
  onSelectAll: f,
38
38
  footer: m,
39
39
  isWithinBox: p,
40
- emptyState: c,
41
- selectionMode: l
40
+ emptyState: l,
41
+ selectionMode: c,
42
+ isFetching: o
42
43
  }
43
44
  ),
44
- t && /* @__PURE__ */ n(x, { ...t, isFetching: s })
45
+ t && /* @__PURE__ */ s(x, { ...t, isFetching: o })
45
46
  ]
46
47
  }
47
48
  );
48
49
  };
49
50
  export {
50
- T as DataView
51
+ g as DataView
51
52
  };
52
53
  //# sourceMappingURL=DataView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataView.js","sources":["../../../../src/components/Common/DataView/DataView.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react'\nimport { PaginationControl } from '../PaginationControl/PaginationControl'\nimport type { TableProps } from '../UI/Table/TableTypes'\nimport styles from './DataView.module.scss'\nimport { DataTable } from './DataTable/DataTable'\nimport type { useDataViewPropReturn, SelectionMode } from './useDataView'\nimport { DataCards } from './DataCards/DataCards'\nimport type { useContainerBreakpointsProps } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\n/** @internal */\nexport type DataViewProps<T> = {\n columns: useDataViewPropReturn<T>['columns']\n data: T[]\n pagination?: useDataViewPropReturn<T>['pagination']\n label: string\n itemMenu?: useDataViewPropReturn<T>['itemMenu']\n onSelect?: useDataViewPropReturn<T>['onSelect']\n onSelectAll?: useDataViewPropReturn<T>['onSelectAll']\n getIsItemSelected?: (item: T) => boolean\n hideSelectAll?: useDataViewPropReturn<T>['hideSelectAll']\n breakAt?: string\n breakpoints?: useContainerBreakpointsProps['breakpoints']\n footer?: useDataViewPropReturn<T>['footer']\n isFetching?: boolean\n isWithinBox?: TableProps['isWithinBox']\n emptyState?: useDataViewPropReturn<T>['emptyState']\n selectionMode?: SelectionMode\n}\n\n/** @internal */\nexport const DataView = <T,>({\n pagination,\n isFetching,\n breakAt = 'small',\n breakpoints: customBreakpoints,\n footer,\n isWithinBox,\n emptyState,\n selectionMode,\n onSelectAll,\n ...dataViewProps\n}: DataViewProps<T>) => {\n const containerRef = useRef<HTMLElement | null>(null)\n const breakpoints = useContainerBreakpoints({\n ref: containerRef,\n breakpoints: customBreakpoints,\n })\n\n // Wait for breakpoints to be detected before rendering\n const isBreakpointsDetected = breakpoints.length > 0\n const isMobile = !breakpoints.includes(breakAt)\n\n const Component = useMemo(() => {\n return isMobile ? DataCards : DataTable\n }, [isMobile])\n\n return (\n <div\n data-testid=\"data-view\"\n className={styles.dataViewContainer}\n ref={ref => {\n containerRef.current = ref\n }}\n >\n {isBreakpointsDetected && (\n <Component\n {...dataViewProps}\n onSelectAll={onSelectAll}\n footer={footer}\n isWithinBox={isWithinBox}\n emptyState={emptyState}\n selectionMode={selectionMode}\n />\n )}\n {pagination && <PaginationControl {...pagination} isFetching={isFetching} />}\n </div>\n )\n}\n"],"names":["DataView","pagination","isFetching","breakAt","customBreakpoints","footer","isWithinBox","emptyState","selectionMode","onSelectAll","dataViewProps","containerRef","useRef","breakpoints","useContainerBreakpoints","isBreakpointsDetected","isMobile","Component","useMemo","DataCards","DataTable","jsxs","styles","ref","jsx","PaginationControl"],"mappings":";;;;;;;AA+BO,MAAMA,IAAW,CAAK;AAAA,EAC3B,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,aAAaC;AAAA,EACb,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAGC;AACL,MAAwB;AACtB,QAAMC,IAAeC,EAA2B,IAAI,GAC9CC,IAAcC,EAAwB;AAAA,IAC1C,KAAKH;AAAA,IACL,aAAaP;AAAA,EAAA,CACd,GAGKW,IAAwBF,EAAY,SAAS,GAC7CG,IAAW,CAACH,EAAY,SAASV,CAAO,GAExCc,IAAYC,EAAQ,MACjBF,IAAWG,IAAYC,GAC7B,CAACJ,CAAQ,CAAC;AAEb,SACE,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,WAAWC,EAAO;AAAA,MAClB,KAAK,CAAAC,MAAO;AACV,QAAAZ,EAAa,UAAUY;AAAA,MACzB;AAAA,MAEC,UAAA;AAAA,QAAAR,KACC,gBAAAS;AAAA,UAACP;AAAA,UAAA;AAAA,YACE,GAAGP;AAAA,YACJ,aAAAD;AAAA,YACA,QAAAJ;AAAA,YACA,aAAAC;AAAA,YACA,YAAAC;AAAA,YACA,eAAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAGHP,KAAc,gBAAAuB,EAACC,GAAA,EAAmB,GAAGxB,GAAY,YAAAC,EAAA,CAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhF;"}
1
+ {"version":3,"file":"DataView.js","sources":["../../../../src/components/Common/DataView/DataView.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react'\nimport { PaginationControl } from '../PaginationControl/PaginationControl'\nimport type { TableProps } from '../UI/Table/TableTypes'\nimport styles from './DataView.module.scss'\nimport { DataTable } from './DataTable/DataTable'\nimport type { useDataViewPropReturn, SelectionMode } from './useDataView'\nimport { DataCards } from './DataCards/DataCards'\nimport type { useContainerBreakpointsProps } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\n/** @internal */\nexport type DataViewProps<T> = {\n columns: useDataViewPropReturn<T>['columns']\n data: T[]\n pagination?: useDataViewPropReturn<T>['pagination']\n label: string\n itemMenu?: useDataViewPropReturn<T>['itemMenu']\n onSelect?: useDataViewPropReturn<T>['onSelect']\n onSelectAll?: useDataViewPropReturn<T>['onSelectAll']\n getIsItemSelected?: (item: T) => boolean\n hideSelectAll?: useDataViewPropReturn<T>['hideSelectAll']\n breakAt?: string\n breakpoints?: useContainerBreakpointsProps['breakpoints']\n footer?: useDataViewPropReturn<T>['footer']\n isFetching?: boolean\n isWithinBox?: TableProps['isWithinBox']\n emptyState?: useDataViewPropReturn<T>['emptyState']\n selectionMode?: SelectionMode\n}\n\n/** @internal */\nexport const DataView = <T,>({\n pagination,\n isFetching,\n breakAt = 'small',\n breakpoints: customBreakpoints,\n footer,\n isWithinBox,\n emptyState,\n selectionMode,\n onSelectAll,\n ...dataViewProps\n}: DataViewProps<T>) => {\n const containerRef = useRef<HTMLElement | null>(null)\n const breakpoints = useContainerBreakpoints({\n ref: containerRef,\n breakpoints: customBreakpoints,\n })\n\n // Wait for breakpoints to be detected before rendering\n const isBreakpointsDetected = breakpoints.length > 0\n const isMobile = !breakpoints.includes(breakAt)\n\n const Component = useMemo(() => {\n return isMobile ? DataCards : DataTable\n }, [isMobile])\n\n return (\n <div\n data-testid=\"data-view\"\n className={styles.dataViewContainer}\n ref={ref => {\n containerRef.current = ref\n }}\n >\n {isBreakpointsDetected && (\n <Component\n {...dataViewProps}\n onSelectAll={onSelectAll}\n footer={footer}\n isWithinBox={isWithinBox}\n emptyState={emptyState}\n selectionMode={selectionMode}\n isFetching={isFetching}\n />\n )}\n {pagination && <PaginationControl {...pagination} isFetching={isFetching} />}\n </div>\n )\n}\n"],"names":["DataView","pagination","isFetching","breakAt","customBreakpoints","footer","isWithinBox","emptyState","selectionMode","onSelectAll","dataViewProps","containerRef","useRef","breakpoints","useContainerBreakpoints","isBreakpointsDetected","isMobile","Component","useMemo","DataCards","DataTable","jsxs","styles","ref","jsx","PaginationControl"],"mappings":";;;;;;;AA+BO,MAAMA,IAAW,CAAK;AAAA,EAC3B,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,aAAaC;AAAA,EACb,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAGC;AACL,MAAwB;AACtB,QAAMC,IAAeC,EAA2B,IAAI,GAC9CC,IAAcC,EAAwB;AAAA,IAC1C,KAAKH;AAAA,IACL,aAAaP;AAAA,EAAA,CACd,GAGKW,IAAwBF,EAAY,SAAS,GAC7CG,IAAW,CAACH,EAAY,SAASV,CAAO,GAExCc,IAAYC,EAAQ,MACjBF,IAAWG,IAAYC,GAC7B,CAACJ,CAAQ,CAAC;AAEb,SACE,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,WAAWC,EAAO;AAAA,MAClB,KAAK,CAAAC,MAAO;AACV,QAAAZ,EAAa,UAAUY;AAAA,MACzB;AAAA,MAEC,UAAA;AAAA,QAAAR,KACC,gBAAAS;AAAA,UAACP;AAAA,UAAA;AAAA,YACE,GAAGP;AAAA,YACJ,aAAAD;AAAA,YACA,QAAAJ;AAAA,YACA,aAAAC;AAAA,YACA,YAAAC;AAAA,YACA,eAAAC;AAAA,YACA,YAAAN;AAAA,UAAA;AAAA,QAAA;AAAA,QAGHD,KAAc,gBAAAuB,EAACC,GAAA,EAAmB,GAAGxB,GAAY,YAAAC,EAAA,CAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhF;"}
@@ -1,18 +1,18 @@
1
- import { jsxs as r, jsx as e, Fragment as o } from "react/jsx-runtime";
2
- import { useTranslation as P } from "react-i18next";
3
- import { useLocationsList as y } from "./useLocationsList.js";
4
- import b from "./List.module.scss.js";
5
- import x from "../../../../assets/icons/pencil.svg.js";
6
- import { EmptyData as T } from "../../../Common/EmptyData/EmptyData.js";
7
- import { HamburgerMenu as A } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
8
- import { useComponentContext as k } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
9
- import { getStreet as w, getCityStateZip as D } from "../../../../helpers/formattedStrings.js";
1
+ import { jsxs as r, jsx as e, Fragment as n } from "react/jsx-runtime";
2
+ import { useTranslation as y } from "react-i18next";
3
+ import { useLocationsList as b } from "./useLocationsList.js";
4
+ import x from "./List.module.scss.js";
5
+ import T from "../../../../assets/icons/pencil.svg.js";
6
+ import { EmptyData as A } from "../../../Common/EmptyData/EmptyData.js";
7
+ import { HamburgerMenu as k } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
8
+ import { useComponentContext as w } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
9
+ import { getStreet as D, getCityStateZip as F } from "../../../../helpers/formattedStrings.js";
10
10
  import { VisuallyHidden as S } from "../../../Common/VisuallyHidden/VisuallyHidden.js";
11
11
  import { useDataView as V } from "../../../Common/DataView/useDataView.js";
12
12
  import { DataView as v } from "../../../Common/DataView/DataView.js";
13
- const J = () => {
14
- const a = k(), {
15
- locationList: n,
13
+ const K = () => {
14
+ const a = w(), {
15
+ locationList: o,
16
16
  handleEditLocation: s,
17
17
  currentPage: d,
18
18
  totalPages: l,
@@ -23,24 +23,25 @@ const J = () => {
23
23
  handleNextPage: p,
24
24
  handlePreviousPage: h,
25
25
  handleAddLocation: f,
26
- itemsPerPage: C
27
- } = y(), { t } = P("Company.Locations"), { ...L } = V({
28
- data: n,
26
+ itemsPerPage: C,
27
+ isFetching: L
28
+ } = b(), { t } = y("Company.Locations"), { ...P } = V({
29
+ data: o,
29
30
  columns: [
30
31
  {
31
32
  key: "name",
32
33
  title: t("locationListCol1"),
33
- render: (i) => /* @__PURE__ */ r("address", { className: b.addressCell, children: [
34
- /* @__PURE__ */ e(a.Text, { size: "sm", weight: "medium", children: w(i) }),
35
- /* @__PURE__ */ e(a.Text, { size: "sm", children: D(i) })
34
+ render: (i) => /* @__PURE__ */ r("address", { className: x.addressCell, children: [
35
+ /* @__PURE__ */ e(a.Text, { size: "sm", weight: "medium", children: D(i) }),
36
+ /* @__PURE__ */ e(a.Text, { size: "sm", children: F(i) })
36
37
  ] })
37
38
  },
38
39
  {
39
40
  key: "status",
40
41
  title: /* @__PURE__ */ e(S, { children: t("locationListCol2") }),
41
- render: (i) => /* @__PURE__ */ r(o, { children: [
42
+ render: (i) => /* @__PURE__ */ r(n, { children: [
42
43
  i.mailingAddress && /* @__PURE__ */ e(a.Badge, { status: "info", children: t("mailingAddress") }),
43
- i.filingAddress && /* @__PURE__ */ r(o, { children: [
44
+ i.filingAddress && /* @__PURE__ */ r(n, { children: [
44
45
  " ",
45
46
  /* @__PURE__ */ e(a.Badge, { status: "info", children: t("filingAddress") })
46
47
  ] })
@@ -48,7 +49,7 @@ const J = () => {
48
49
  }
49
50
  ],
50
51
  itemMenu: (i) => /* @__PURE__ */ e(
51
- A,
52
+ k,
52
53
  {
53
54
  items: [
54
55
  {
@@ -56,7 +57,7 @@ const J = () => {
56
57
  onClick: () => {
57
58
  s(i.uuid);
58
59
  },
59
- icon: /* @__PURE__ */ e(x, { "aria-hidden": !0 }),
60
+ icon: /* @__PURE__ */ e(T, { "aria-hidden": !0 }),
60
61
  "data-testid": "edit-location"
61
62
  }
62
63
  ],
@@ -75,11 +76,12 @@ const J = () => {
75
76
  totalCount: m,
76
77
  itemsPerPage: C
77
78
  },
78
- emptyState: () => /* @__PURE__ */ e(T, { title: t("emptyTableTitle"), description: t("emptyTableDescription"), children: /* @__PURE__ */ e(a.Button, { variant: "secondary", onClick: f, children: t("addFirstLocationCta") }) })
79
+ emptyState: () => /* @__PURE__ */ e(A, { title: t("emptyTableTitle"), description: t("emptyTableDescription"), children: /* @__PURE__ */ e(a.Button, { variant: "secondary", onClick: f, children: t("addFirstLocationCta") }) }),
80
+ isFetching: L
79
81
  });
80
- return /* @__PURE__ */ e(v, { label: t("locationListLabel"), ...L });
82
+ return /* @__PURE__ */ e(v, { label: t("locationListLabel"), ...P });
81
83
  };
82
84
  export {
83
- J as List
85
+ K as List
84
86
  };
85
87
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../src/components/Company/Locations/LocationsList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useLocationsList } from './useLocationsList'\nimport styles from './List.module.scss'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { DataView, EmptyData, useDataView, VisuallyHidden } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { getCityStateZip, getStreet } from '@/helpers/formattedStrings'\n\n/** @internal */\nexport const List = () => {\n const Components = useComponentContext()\n const {\n locationList,\n handleEditLocation,\n currentPage,\n totalPages,\n totalCount,\n handleFirstPage,\n handleItemsPerPageChange,\n handleLastPage,\n handleNextPage,\n handlePreviousPage,\n handleAddLocation,\n itemsPerPage,\n } = useLocationsList()\n\n const { t } = useTranslation('Company.Locations')\n const { ...dataViewProps } = useDataView({\n data: locationList,\n columns: [\n {\n key: 'name',\n title: t('locationListCol1'),\n render: location => {\n return (\n <address className={styles.addressCell}>\n <Components.Text size=\"sm\" weight=\"medium\">\n {getStreet(location)}\n </Components.Text>\n <Components.Text size=\"sm\">{getCityStateZip(location)}</Components.Text>\n </address>\n )\n },\n },\n {\n key: 'status',\n title: <VisuallyHidden>{t('locationListCol2')}</VisuallyHidden>,\n render: location => {\n return (\n <>\n {location.mailingAddress && (\n <Components.Badge status={'info'}>{t('mailingAddress')}</Components.Badge>\n )}\n {location.filingAddress && (\n <>\n {' '}\n <Components.Badge status={'info'}>{t('filingAddress')}</Components.Badge>\n </>\n )}\n </>\n )\n },\n },\n ],\n itemMenu: location => {\n return (\n <HamburgerMenu\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEditLocation(location.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n 'data-testid': 'edit-location',\n },\n ]}\n data-testid=\"location-hamburger\"\n triggerLabel={t('hamburgerTitle')}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n totalCount,\n itemsPerPage,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <Components.Button variant=\"secondary\" onClick={handleAddLocation}>\n {t('addFirstLocationCta')}\n </Components.Button>\n </EmptyData>\n ),\n })\n return <DataView label={t('locationListLabel')} {...dataViewProps} />\n}\n"],"names":["List","Components","useComponentContext","locationList","handleEditLocation","currentPage","totalPages","totalCount","handleFirstPage","handleItemsPerPageChange","handleLastPage","handleNextPage","handlePreviousPage","handleAddLocation","itemsPerPage","useLocationsList","useTranslation","dataViewProps","useDataView","location","jsxs","styles","jsx","getStreet","getCityStateZip","VisuallyHidden","Fragment","HamburgerMenu","PencilSvg","EmptyData","DataView"],"mappings":";;;;;;;;;;;;AAUO,MAAMA,IAAO,MAAM;AACxB,QAAMC,IAAaC,EAAA,GACb;AAAA,IACJ,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEC,EAAA,GAEE,EAAE,EAAA,IAAMC,EAAe,mBAAmB,GAC1C,EAAE,GAAGC,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAMf;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,kBAAkB;AAAA,QAC3B,QAAQ,CAAAgB,MAEJ,gBAAAC,EAAC,WAAA,EAAQ,WAAWC,EAAO,aACzB,UAAA;AAAA,UAAA,gBAAAC,EAACrB,EAAW,MAAX,EAAgB,MAAK,MAAK,QAAO,UAC/B,UAAAsB,EAAUJ,CAAQ,EAAA,CACrB;AAAA,UACA,gBAAAG,EAACrB,EAAW,MAAX,EAAgB,MAAK,MAAM,UAAAuB,EAAgBL,CAAQ,EAAA,CAAE;AAAA,QAAA,GACxD;AAAA,MAEJ;AAAA,MAEF;AAAA,QACE,KAAK;AAAA,QACL,OAAO,gBAAAG,EAACG,GAAA,EAAgB,UAAA,EAAE,kBAAkB,GAAE;AAAA,QAC9C,QAAQ,CAAAN,MAEJ,gBAAAC,EAAAM,GAAA,EACG,UAAA;AAAA,UAAAP,EAAS,oCACPlB,EAAW,OAAX,EAAiB,QAAQ,QAAS,UAAA,EAAE,gBAAgB,EAAA,CAAE;AAAA,UAExDkB,EAAS,iBACR,gBAAAC,EAAAM,GAAA,EACG,UAAA;AAAA,YAAA;AAAA,YACD,gBAAAJ,EAACrB,EAAW,OAAX,EAAiB,QAAQ,QAAS,UAAA,EAAE,eAAe,EAAA,CAAE;AAAA,UAAA,EAAA,CACxD;AAAA,QAAA,GAEJ;AAAA,MAEJ;AAAA,IACF;AAAA,IAEF,UAAU,CAAAkB,MAEN,gBAAAG;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL;AAAA,YACE,OAAO,EAAE,SAAS;AAAA,YAClB,SAAS,MAAM;AACb,cAAAvB,EAAmBe,EAAS,IAAI;AAAA,YAClC;AAAA,YACA,MAAM,gBAAAG,EAACM,GAAA,EAAU,eAAW,GAAA,CAAC;AAAA,YAC7B,eAAe;AAAA,UAAA;AAAA,QACjB;AAAA,QAEF,eAAY;AAAA,QACZ,cAAc,EAAE,gBAAgB;AAAA,MAAA;AAAA,IAAA;AAAA,IAItC,YAAY;AAAA,MACV,gBAAAjB;AAAA,MACA,iBAAAH;AAAA,MACA,gBAAAE;AAAA,MACA,oBAAAE;AAAA,MACA,0BAAAH;AAAA,MACA,aAAAJ;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAO;AAAA,IAAA;AAAA,IAEF,YAAY,MACV,gBAAAQ,EAACO,GAAA,EAAU,OAAO,EAAE,iBAAiB,GAAG,aAAa,EAAE,uBAAuB,GAC5E,UAAA,gBAAAP,EAACrB,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASY,GAC7C,UAAA,EAAE,qBAAqB,EAAA,CAC1B,EAAA,CACF;AAAA,EAAA,CAEH;AACD,2BAAQiB,GAAA,EAAS,OAAO,EAAE,mBAAmB,GAAI,GAAGb,GAAe;AACrE;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../src/components/Company/Locations/LocationsList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useLocationsList } from './useLocationsList'\nimport styles from './List.module.scss'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { DataView, EmptyData, useDataView, VisuallyHidden } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { getCityStateZip, getStreet } from '@/helpers/formattedStrings'\n\n/** @internal */\nexport const List = () => {\n const Components = useComponentContext()\n const {\n locationList,\n handleEditLocation,\n currentPage,\n totalPages,\n totalCount,\n handleFirstPage,\n handleItemsPerPageChange,\n handleLastPage,\n handleNextPage,\n handlePreviousPage,\n handleAddLocation,\n itemsPerPage,\n isFetching,\n } = useLocationsList()\n\n const { t } = useTranslation('Company.Locations')\n const { ...dataViewProps } = useDataView({\n data: locationList,\n columns: [\n {\n key: 'name',\n title: t('locationListCol1'),\n render: location => {\n return (\n <address className={styles.addressCell}>\n <Components.Text size=\"sm\" weight=\"medium\">\n {getStreet(location)}\n </Components.Text>\n <Components.Text size=\"sm\">{getCityStateZip(location)}</Components.Text>\n </address>\n )\n },\n },\n {\n key: 'status',\n title: <VisuallyHidden>{t('locationListCol2')}</VisuallyHidden>,\n render: location => {\n return (\n <>\n {location.mailingAddress && (\n <Components.Badge status={'info'}>{t('mailingAddress')}</Components.Badge>\n )}\n {location.filingAddress && (\n <>\n {' '}\n <Components.Badge status={'info'}>{t('filingAddress')}</Components.Badge>\n </>\n )}\n </>\n )\n },\n },\n ],\n itemMenu: location => {\n return (\n <HamburgerMenu\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEditLocation(location.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n 'data-testid': 'edit-location',\n },\n ]}\n data-testid=\"location-hamburger\"\n triggerLabel={t('hamburgerTitle')}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n totalCount,\n itemsPerPage,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <Components.Button variant=\"secondary\" onClick={handleAddLocation}>\n {t('addFirstLocationCta')}\n </Components.Button>\n </EmptyData>\n ),\n isFetching,\n })\n return <DataView label={t('locationListLabel')} {...dataViewProps} />\n}\n"],"names":["List","Components","useComponentContext","locationList","handleEditLocation","currentPage","totalPages","totalCount","handleFirstPage","handleItemsPerPageChange","handleLastPage","handleNextPage","handlePreviousPage","handleAddLocation","itemsPerPage","isFetching","useLocationsList","useTranslation","dataViewProps","useDataView","location","jsxs","styles","jsx","getStreet","getCityStateZip","VisuallyHidden","Fragment","HamburgerMenu","PencilSvg","EmptyData","DataView"],"mappings":";;;;;;;;;;;;AAUO,MAAMA,IAAO,MAAM;AACxB,QAAMC,IAAaC,EAAA,GACb;AAAA,IACJ,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,IACEC,EAAA,GAEE,EAAE,EAAA,IAAMC,EAAe,mBAAmB,GAC1C,EAAE,GAAGC,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAMhB;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,kBAAkB;AAAA,QAC3B,QAAQ,CAAAiB,MAEJ,gBAAAC,EAAC,WAAA,EAAQ,WAAWC,EAAO,aACzB,UAAA;AAAA,UAAA,gBAAAC,EAACtB,EAAW,MAAX,EAAgB,MAAK,MAAK,QAAO,UAC/B,UAAAuB,EAAUJ,CAAQ,EAAA,CACrB;AAAA,UACA,gBAAAG,EAACtB,EAAW,MAAX,EAAgB,MAAK,MAAM,UAAAwB,EAAgBL,CAAQ,EAAA,CAAE;AAAA,QAAA,GACxD;AAAA,MAEJ;AAAA,MAEF;AAAA,QACE,KAAK;AAAA,QACL,OAAO,gBAAAG,EAACG,GAAA,EAAgB,UAAA,EAAE,kBAAkB,GAAE;AAAA,QAC9C,QAAQ,CAAAN,MAEJ,gBAAAC,EAAAM,GAAA,EACG,UAAA;AAAA,UAAAP,EAAS,oCACPnB,EAAW,OAAX,EAAiB,QAAQ,QAAS,UAAA,EAAE,gBAAgB,EAAA,CAAE;AAAA,UAExDmB,EAAS,iBACR,gBAAAC,EAAAM,GAAA,EACG,UAAA;AAAA,YAAA;AAAA,YACD,gBAAAJ,EAACtB,EAAW,OAAX,EAAiB,QAAQ,QAAS,UAAA,EAAE,eAAe,EAAA,CAAE;AAAA,UAAA,EAAA,CACxD;AAAA,QAAA,GAEJ;AAAA,MAEJ;AAAA,IACF;AAAA,IAEF,UAAU,CAAAmB,MAEN,gBAAAG;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL;AAAA,YACE,OAAO,EAAE,SAAS;AAAA,YAClB,SAAS,MAAM;AACb,cAAAxB,EAAmBgB,EAAS,IAAI;AAAA,YAClC;AAAA,YACA,MAAM,gBAAAG,EAACM,GAAA,EAAU,eAAW,GAAA,CAAC;AAAA,YAC7B,eAAe;AAAA,UAAA;AAAA,QACjB;AAAA,QAEF,eAAY;AAAA,QACZ,cAAc,EAAE,gBAAgB;AAAA,MAAA;AAAA,IAAA;AAAA,IAItC,YAAY;AAAA,MACV,gBAAAlB;AAAA,MACA,iBAAAH;AAAA,MACA,gBAAAE;AAAA,MACA,oBAAAE;AAAA,MACA,0BAAAH;AAAA,MACA,aAAAJ;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAO;AAAA,IAAA;AAAA,IAEF,YAAY,MACV,gBAAAS,EAACO,GAAA,EAAU,OAAO,EAAE,iBAAiB,GAAG,aAAa,EAAE,uBAAuB,GAC5E,UAAA,gBAAAP,EAACtB,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASY,GAC7C,UAAA,EAAE,qBAAqB,EAAA,CAC1B,EAAA,CACF;AAAA,IAEF,YAAAE;AAAA,EAAA,CACD;AACD,2BAAQgB,GAAA,EAAS,OAAO,EAAE,mBAAmB,GAAI,GAAGb,GAAe;AACrE;"}
@@ -1,48 +1,53 @@
1
- import { jsx as o, jsxs as l, Fragment as L } from "react/jsx-runtime";
2
- import { useLocationsGetSuspense as h } from "@gusto/embedded-api/react-query/locationsGet";
3
- import { Head as u } from "./Head.js";
4
- import { List as C } from "./List.js";
5
- import { Actions as O } from "./Actions.js";
6
- import { LocationsListProvider as A } from "./useLocationsList.js";
7
- import { useI18n as E } from "../../../../i18n/I18n.js";
8
- import { BaseComponent as N } from "../../../Base/Base.js";
9
- import { useBase as P } from "../../../Base/useBase.js";
10
- import { Flex as g } from "../../../Common/Flex/Flex.js";
11
- import { companyEvents as i } from "../../../../shared/constants.js";
12
- import { usePagination as I } from "../../../../hooks/usePagination/usePagination.js";
13
- function H(t) {
14
- return /* @__PURE__ */ o(N, { ...t, children: /* @__PURE__ */ o(_, { ...t, children: t.children }) });
1
+ import { jsx as o, jsxs as h, Fragment as O } from "react/jsx-runtime";
2
+ import { keepPreviousData as C } from "@tanstack/react-query";
3
+ import { useLocationsGet as A } from "@gusto/embedded-api/react-query/locationsGet";
4
+ import { Head as g } from "./Head.js";
5
+ import { List as E } from "./List.js";
6
+ import { Actions as P } from "./Actions.js";
7
+ import { LocationsListProvider as N } from "./useLocationsList.js";
8
+ import { useI18n as I } from "../../../../i18n/I18n.js";
9
+ import { BaseComponent as _, BaseLayout as v } from "../../../Base/Base.js";
10
+ import { useBase as x } from "../../../Base/useBase.js";
11
+ import { Flex as D } from "../../../Common/Flex/Flex.js";
12
+ import { companyEvents as r } from "../../../../shared/constants.js";
13
+ import { usePagination as T } from "../../../../hooks/usePagination/usePagination.js";
14
+ function J(t) {
15
+ return /* @__PURE__ */ o(_, { ...t, children: /* @__PURE__ */ o(y, { ...t, children: t.children }) });
15
16
  }
16
- function _({ companyId: t, className: r, children: e }) {
17
- E("Company.Locations");
18
- const { onEvent: n } = P(), { getPaginationProps: s } = I(), {
19
- data: { companyLocationsList: m, httpMeta: a }
20
- } = h({ companyId: t }), c = () => {
21
- n(i.COMPANY_LOCATION_DONE);
22
- }, p = () => {
23
- n(i.COMPANY_LOCATION_CREATE);
24
- }, d = (f) => {
25
- n(i.COMPANY_LOCATION_EDIT, { uuid: f });
17
+ function y({ companyId: t, className: a, children: i, LoaderComponent: s }) {
18
+ I("Company.Locations");
19
+ const { onEvent: n } = x(), { getPaginationProps: m } = T(), { data: e, isFetching: c } = A(
20
+ { companyId: t },
21
+ { placeholderData: C, throwOnError: !0 }
22
+ ), p = () => {
23
+ n(r.COMPANY_LOCATION_DONE);
24
+ }, d = () => {
25
+ n(r.COMPANY_LOCATION_CREATE);
26
+ }, f = (u) => {
27
+ n(r.COMPANY_LOCATION_EDIT, { uuid: u });
26
28
  };
27
- return /* @__PURE__ */ o("section", { className: r, children: /* @__PURE__ */ o(
28
- A,
29
+ if (!e)
30
+ return /* @__PURE__ */ o(v, { isLoading: !0, LoaderComponent: s });
31
+ const { companyLocationsList: l, httpMeta: L } = e;
32
+ return /* @__PURE__ */ o("section", { className: a, children: /* @__PURE__ */ o(
33
+ N,
29
34
  {
30
35
  value: {
31
- ...s(a.response.headers),
32
- locationList: m ?? [],
33
- handleAddLocation: p,
34
- handleEditLocation: d,
35
- handleContinue: c
36
+ ...m(L.response.headers, c),
37
+ locationList: l ?? [],
38
+ handleAddLocation: d,
39
+ handleEditLocation: f,
40
+ handleContinue: p
36
41
  },
37
- children: /* @__PURE__ */ o(g, { flexDirection: "column", gap: 32, alignItems: "stretch", children: e || /* @__PURE__ */ l(L, { children: [
38
- /* @__PURE__ */ o(u, {}),
39
- /* @__PURE__ */ o(C, {}),
40
- /* @__PURE__ */ o(O, {})
42
+ children: /* @__PURE__ */ o(D, { flexDirection: "column", gap: 32, alignItems: "stretch", children: i || /* @__PURE__ */ h(O, { children: [
43
+ /* @__PURE__ */ o(g, {}),
44
+ /* @__PURE__ */ o(E, {}),
45
+ /* @__PURE__ */ o(P, {})
41
46
  ] }) })
42
47
  }
43
48
  ) });
44
49
  }
45
50
  export {
46
- H as LocationsList
51
+ J as LocationsList
47
52
  };
48
53
  //# sourceMappingURL=LocationsList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/LocationsList.tsx"],"sourcesContent":["import { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { LocationsListProvider } from './useLocationsList'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex } from '@/components/Common'\nimport { companyEvents } from '@/shared/constants'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for the {@link LocationsList} component.\n *\n * @public\n */\nexport interface LocationsListProps extends BaseComponentInterface<'Company.Locations'> {\n /** The associated company identifier. */\n companyId: string\n}\n\n/**\n * Displays the list of work locations for a company.\n *\n * @remarks\n * Standalone building block used internally by the orchestrated `Locations` component for its list view. Use this directly when you need full control over navigation between the list and form views.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `company/location/add` | A user chose to add a new location | — |\n * | `company/location/edit` | A user chose to edit a specific location | `{ uuid: string }` |\n * | `company/location/done` | The user chose to proceed to the next step | — |\n *\n * @param props - Component props including the `companyId` whose locations should be listed.\n * @returns The rendered locations list section.\n * @public\n */\nexport function LocationsList(props: LocationsListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, className, children }: LocationsListProps) {\n useI18n('Company.Locations')\n const { onEvent } = useBase()\n\n const { getPaginationProps } = usePagination()\n\n const {\n data: { companyLocationsList, httpMeta },\n } = useLocationsGetSuspense({ companyId })\n\n const handleContinue = () => {\n onEvent(companyEvents.COMPANY_LOCATION_DONE)\n }\n const handleAddLocation = () => {\n onEvent(companyEvents.COMPANY_LOCATION_CREATE)\n }\n const handleEditLocation = (uuid: string) => {\n onEvent(companyEvents.COMPANY_LOCATION_EDIT, { uuid })\n }\n\n return (\n <section className={className}>\n <LocationsListProvider\n value={{\n ...getPaginationProps(httpMeta.response.headers),\n locationList: companyLocationsList ?? [],\n handleAddLocation,\n handleEditLocation,\n handleContinue,\n }}\n >\n <Flex flexDirection=\"column\" gap={32} alignItems=\"stretch\">\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Actions />\n </>\n )}\n </Flex>\n </LocationsListProvider>\n </section>\n )\n}\n"],"names":["LocationsList","props","jsx","BaseComponent","Root","companyId","className","children","useI18n","onEvent","useBase","getPaginationProps","usePagination","companyLocationsList","httpMeta","useLocationsGetSuspense","handleContinue","companyEvents","handleAddLocation","handleEditLocation","uuid","LocationsListProvider","Flex","jsxs","Fragment","Head","List","Actions"],"mappings":";;;;;;;;;;;;AAuCO,SAASA,EAAcC,GAA2B;AACvD,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,WAAAC,GAAW,UAAAC,KAAgC;AACpE,EAAAC,EAAQ,mBAAmB;AAC3B,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,oBAAAC,EAAA,IAAuBC,EAAA,GAEzB;AAAA,IACJ,MAAM,EAAE,sBAAAC,GAAsB,UAAAC,EAAA;AAAA,EAAS,IACrCC,EAAwB,EAAE,WAAAV,GAAW,GAEnCW,IAAiB,MAAM;AAC3B,IAAAP,EAAQQ,EAAc,qBAAqB;AAAA,EAC7C,GACMC,IAAoB,MAAM;AAC9B,IAAAT,EAAQQ,EAAc,uBAAuB;AAAA,EAC/C,GACME,IAAqB,CAACC,MAAiB;AAC3C,IAAAX,EAAQQ,EAAc,uBAAuB,EAAE,MAAAG,EAAA,CAAM;AAAA,EACvD;AAEA,SACE,gBAAAlB,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACmB;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,GAAGV,EAAmBG,EAAS,SAAS,OAAO;AAAA,QAC/C,cAAcD,KAAwB,CAAA;AAAA,QACtC,mBAAAK;AAAA,QACA,oBAAAC;AAAA,QACA,gBAAAH;AAAA,MAAA;AAAA,MAGF,UAAA,gBAAAd,EAACoB,GAAA,EAAK,eAAc,UAAS,KAAK,IAAI,YAAW,WAC9C,UAAAf,KAGC,gBAAAgB,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAtB,EAACuB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"LocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/LocationsList.tsx"],"sourcesContent":["import { keepPreviousData } from '@tanstack/react-query'\nimport { useLocationsGet } from '@gusto/embedded-api/react-query/locationsGet'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { LocationsListProvider } from './useLocationsList'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, BaseLayout, type BaseComponentInterface } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex } from '@/components/Common'\nimport { companyEvents } from '@/shared/constants'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for the {@link LocationsList} component.\n *\n * @public\n */\nexport interface LocationsListProps extends BaseComponentInterface<'Company.Locations'> {\n /** The associated company identifier. */\n companyId: string\n}\n\n/**\n * Displays the list of work locations for a company.\n *\n * @remarks\n * Standalone building block used internally by the orchestrated `Locations` component for its list view. Use this directly when you need full control over navigation between the list and form views.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `company/location/add` | A user chose to add a new location | — |\n * | `company/location/edit` | A user chose to edit a specific location | `{ uuid: string }` |\n * | `company/location/done` | The user chose to proceed to the next step | — |\n *\n * @param props - Component props including the `companyId` whose locations should be listed.\n * @returns The rendered locations list section.\n * @public\n */\nexport function LocationsList(props: LocationsListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, className, children, LoaderComponent }: LocationsListProps) {\n useI18n('Company.Locations')\n const { onEvent } = useBase()\n\n const { getPaginationProps } = usePagination()\n\n const { data, isFetching } = useLocationsGet(\n { companyId },\n { placeholderData: keepPreviousData, throwOnError: true },\n )\n\n const handleContinue = () => {\n onEvent(companyEvents.COMPANY_LOCATION_DONE)\n }\n const handleAddLocation = () => {\n onEvent(companyEvents.COMPANY_LOCATION_CREATE)\n }\n const handleEditLocation = (uuid: string) => {\n onEvent(companyEvents.COMPANY_LOCATION_EDIT, { uuid })\n }\n\n if (!data) {\n return <BaseLayout isLoading LoaderComponent={LoaderComponent} />\n }\n\n const { companyLocationsList, httpMeta } = data\n\n return (\n <section className={className}>\n <LocationsListProvider\n value={{\n ...getPaginationProps(httpMeta.response.headers, isFetching),\n locationList: companyLocationsList ?? [],\n handleAddLocation,\n handleEditLocation,\n handleContinue,\n }}\n >\n <Flex flexDirection=\"column\" gap={32} alignItems=\"stretch\">\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Actions />\n </>\n )}\n </Flex>\n </LocationsListProvider>\n </section>\n )\n}\n"],"names":["LocationsList","props","jsx","BaseComponent","Root","companyId","className","children","LoaderComponent","useI18n","onEvent","useBase","getPaginationProps","usePagination","data","isFetching","useLocationsGet","keepPreviousData","handleContinue","companyEvents","handleAddLocation","handleEditLocation","uuid","BaseLayout","companyLocationsList","httpMeta","LocationsListProvider","Flex","jsxs","Fragment","Head","List","Actions"],"mappings":";;;;;;;;;;;;;AAwCO,SAASA,EAAcC,GAA2B;AACvD,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,WAAAC,GAAW,UAAAC,GAAU,iBAAAC,KAAuC;AACrF,EAAAC,EAAQ,mBAAmB;AAC3B,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,oBAAAC,EAAA,IAAuBC,EAAA,GAEzB,EAAE,MAAAC,GAAM,YAAAC,EAAA,IAAeC;AAAA,IAC3B,EAAE,WAAAX,EAAA;AAAA,IACF,EAAE,iBAAiBY,GAAkB,cAAc,GAAA;AAAA,EAAK,GAGpDC,IAAiB,MAAM;AAC3B,IAAAR,EAAQS,EAAc,qBAAqB;AAAA,EAC7C,GACMC,IAAoB,MAAM;AAC9B,IAAAV,EAAQS,EAAc,uBAAuB;AAAA,EAC/C,GACME,IAAqB,CAACC,MAAiB;AAC3C,IAAAZ,EAAQS,EAAc,uBAAuB,EAAE,MAAAG,EAAA,CAAM;AAAA,EACvD;AAEA,MAAI,CAACR;AACH,WAAO,gBAAAZ,EAACqB,GAAA,EAAW,WAAS,IAAC,iBAAAf,EAAA,CAAkC;AAGjE,QAAM,EAAE,sBAAAgB,GAAsB,UAAAC,EAAA,IAAaX;AAE3C,SACE,gBAAAZ,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACwB;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,GAAGd,EAAmBa,EAAS,SAAS,SAASV,CAAU;AAAA,QAC3D,cAAcS,KAAwB,CAAA;AAAA,QACtC,mBAAAJ;AAAA,QACA,oBAAAC;AAAA,QACA,gBAAAH;AAAA,MAAA;AAAA,MAGF,UAAA,gBAAAhB,EAACyB,GAAA,EAAK,eAAc,UAAS,KAAK,IAAI,YAAW,WAC9C,UAAApB,KAGC,gBAAAqB,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAA3B,EAAC4B,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -6,6 +6,7 @@ type LocationsListContextType = {
6
6
  totalCount: number;
7
7
  currentPage: number;
8
8
  itemsPerPage: PaginationItemsPerPage;
9
+ isFetching?: boolean;
9
10
  handleItemsPerPageChange: (n: PaginationItemsPerPage) => void;
10
11
  handleFirstPage: () => void;
11
12
  handlePreviousPage: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
1
+ {"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n isFetching?: boolean\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
@@ -1,2 +1,9 @@
1
- /** @internal */
2
- export declare function Form(): (import("react").JSX.Element | null)[];
1
+ /**
2
+ * Renders one section per requirement set, skipping sets that have nothing left to edit once
3
+ * non-editable requirements — and requirements resolved as never-applicable against a
4
+ * non-editable sibling — are dropped (mirrors gws-flows' `TaxRequirements::Edit.set_editable?`,
5
+ * which drops such sets from its own edit view entirely).
6
+ *
7
+ * @internal
8
+ */
9
+ export declare function Form(): import("react").JSX.Element | (import("react").JSX.Element | null)[];
@@ -1,26 +1,27 @@
1
- import { jsxs as i, Fragment as d, jsx as e } from "react/jsx-runtime";
2
- import { useTranslation as x } from "react-i18next";
3
- import { RequirementFields as h } from "../shared/RequirementFields.js";
1
+ import { jsxs as u, Fragment as q, jsx as t } from "react/jsx-runtime";
2
+ import { useTranslation as h } from "react-i18next";
3
+ import { RequirementFields as x } from "../shared/RequirementFields.js";
4
4
  import { getUniqueRhfKey as F } from "../shared/rhfKey.js";
5
- import { useStateTaxesForm as q } from "./context.js";
6
- import { useComponentContext as y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
5
+ import { isRequirementSetEditable as b } from "../shared/prepareRequirements.js";
6
+ import { useStateTaxesForm as y } from "./context.js";
7
+ import { useComponentContext as R } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
7
8
  import { useDateFormatter as S } from "../../../../hooks/useDateFormatter.js";
8
- function k() {
9
- const { t: s } = x("Company.StateTaxes", { keyPrefix: "form" }), a = S(), { stateTaxRequirements: f } = q(), t = y(), r = f.requirementSets ?? [];
10
- return r.map((o, u) => {
11
- const { requirements: c, label: p, effectiveFrom: n, key: l } = o;
12
- if (!l) return null;
13
- const m = F(o, u, r);
14
- return /* @__PURE__ */ i(d, { children: [
15
- /* @__PURE__ */ i("div", { children: [
16
- /* @__PURE__ */ e(t.Heading, { as: "h3", children: p }),
17
- n && /* @__PURE__ */ e(t.Text, { size: "sm", children: s("effectiveFromLabel", { date: a.formatLongWithYear(n) }) })
9
+ function K() {
10
+ const { t: r } = h("Company.StateTaxes", { keyPrefix: "form" }), l = S(), { stateTaxRequirements: f } = y(), n = R(), o = f.requirementSets ?? [], i = o.map((e, c) => {
11
+ const { requirements: m, label: p, effectiveFrom: s, key: d } = e;
12
+ if (!d || !b(m ?? [])) return null;
13
+ const a = F(e, c, o);
14
+ return /* @__PURE__ */ u(q, { children: [
15
+ /* @__PURE__ */ u("div", { children: [
16
+ /* @__PURE__ */ t(n.Heading, { as: "h3", children: p }),
17
+ s && /* @__PURE__ */ t(n.Text, { size: "sm", children: r("effectiveFromLabel", { date: l.formatLongWithYear(s) }) })
18
18
  ] }),
19
- /* @__PURE__ */ e(h, { requirements: c, requirementSetKey: m })
20
- ] }, m);
19
+ /* @__PURE__ */ t(x, { requirements: m, requirementSetKey: a })
20
+ ] }, a);
21
21
  });
22
+ return i.every((e) => e === null) ? /* @__PURE__ */ t(n.Alert, { status: "info", label: r("noEditableRequirementsTitle"), children: r("noEditableRequirementsDescription") }) : i;
22
23
  }
23
24
  export {
24
- k as Form
25
+ K as Form
25
26
  };
26
27
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { RequirementFields } from '../shared/RequirementFields'\nimport { getUniqueRhfKey } from '../shared/rhfKey'\nimport { useStateTaxesForm } from './context'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\n/** @internal */\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n const requirementSets = stateTaxRequirements.requirementSets ?? []\n\n // A single key (e.g. \"taxrates\") can appear in more than one set when a future-dated set is\n // already scheduled alongside the current one — each rendered section still needs its own\n // disambiguated form path so the two sections' fields don't share state.\n return requirementSets.map((requirementSet, index) => {\n const { requirements, label, effectiveFrom, key } = requirementSet\n if (!key) return null\n const requirementSetPath = getUniqueRhfKey(requirementSet, index, requirementSets)\n return (\n <Fragment key={requirementSetPath}>\n <div>\n <Components.Heading as=\"h3\">{label}</Components.Heading>\n {effectiveFrom && (\n <Components.Text size=\"sm\">\n {t('effectiveFromLabel', { date: dateFormatter.formatLongWithYear(effectiveFrom) })}\n </Components.Text>\n )}\n </div>\n <RequirementFields requirements={requirements} requirementSetKey={requirementSetPath} />\n </Fragment>\n )\n })\n}\n"],"names":["Form","t","useTranslation","dateFormatter","useDateFormatter","stateTaxRequirements","useStateTaxesForm","Components","useComponentContext","requirementSets","requirementSet","index","requirements","label","effectiveFrom","key","requirementSetPath","getUniqueRhfKey","Fragment","jsxs","jsx","RequirementFields"],"mappings":";;;;;;;AASO,SAASA,IAAO;AACrB,QAAM,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClEC,IAAgBC,EAAA,GAChB,EAAE,sBAAAC,EAAA,IAAyBC,EAAA,GAC3BC,IAAaC,EAAA,GACbC,IAAkBJ,EAAqB,mBAAmB,CAAA;AAKhE,SAAOI,EAAgB,IAAI,CAACC,GAAgBC,MAAU;AACpD,UAAM,EAAE,cAAAC,GAAc,OAAAC,GAAO,eAAAC,GAAe,KAAAC,MAAQL;AACpD,QAAI,CAACK,EAAK,QAAO;AACjB,UAAMC,IAAqBC,EAAgBP,GAAgBC,GAAOF,CAAe;AACjF,6BACGS,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAC,EAAC,OAAA,EACC,UAAA;AAAA,QAAA,gBAAAC,EAACb,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAM,GAAM;AAAA,QAClCC,KACC,gBAAAM,EAACb,EAAW,MAAX,EAAgB,MAAK,MACnB,UAAAN,EAAE,sBAAsB,EAAE,MAAME,EAAc,mBAAmBW,CAAa,EAAA,CAAG,EAAA,CACpF;AAAA,MAAA,GAEJ;AAAA,MACA,gBAAAM,EAACC,GAAA,EAAkB,cAAAT,GAA4B,mBAAmBI,EAAA,CAAoB;AAAA,IAAA,EAAA,GATzEA,CAUf;AAAA,EAEJ,CAAC;AACH;"}
1
+ {"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { RequirementFields } from '../shared/RequirementFields'\nimport { getUniqueRhfKey } from '../shared/rhfKey'\nimport { isRequirementSetEditable } from '../shared/prepareRequirements'\nimport { useStateTaxesForm } from './context'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\n/**\n * Renders one section per requirement set, skipping sets that have nothing left to edit once\n * non-editable requirements — and requirements resolved as never-applicable against a\n * non-editable sibling — are dropped (mirrors gws-flows' `TaxRequirements::Edit.set_editable?`,\n * which drops such sets from its own edit view entirely).\n *\n * @internal\n */\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n const requirementSets = stateTaxRequirements.requirementSets ?? []\n\n // A single key (e.g. \"taxrates\") can appear in more than one set when a future-dated set is\n // already scheduled alongside the current one — each rendered section still needs its own\n // disambiguated form path so the two sections' fields don't share state.\n const sections = requirementSets.map((requirementSet, index) => {\n const { requirements, label, effectiveFrom, key } = requirementSet\n if (!key) return null\n if (!isRequirementSetEditable(requirements ?? [])) return null\n const requirementSetPath = getUniqueRhfKey(requirementSet, index, requirementSets)\n return (\n <Fragment key={requirementSetPath}>\n <div>\n <Components.Heading as=\"h3\">{label}</Components.Heading>\n {effectiveFrom && (\n <Components.Text size=\"sm\">\n {t('effectiveFromLabel', { date: dateFormatter.formatLongWithYear(effectiveFrom) })}\n </Components.Text>\n )}\n </div>\n <RequirementFields requirements={requirements} requirementSetKey={requirementSetPath} />\n </Fragment>\n )\n })\n\n if (sections.every(section => section === null)) {\n return (\n <Components.Alert status=\"info\" label={t('noEditableRequirementsTitle')}>\n {t('noEditableRequirementsDescription')}\n </Components.Alert>\n )\n }\n\n return sections\n}\n"],"names":["Form","t","useTranslation","dateFormatter","useDateFormatter","stateTaxRequirements","useStateTaxesForm","Components","useComponentContext","requirementSets","sections","requirementSet","index","requirements","label","effectiveFrom","key","isRequirementSetEditable","requirementSetPath","getUniqueRhfKey","Fragment","jsxs","jsx","RequirementFields","section"],"mappings":";;;;;;;;AAiBO,SAASA,IAAO;AACrB,QAAM,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClEC,IAAgBC,EAAA,GAChB,EAAE,sBAAAC,EAAA,IAAyBC,EAAA,GAC3BC,IAAaC,EAAA,GACbC,IAAkBJ,EAAqB,mBAAmB,CAAA,GAK1DK,IAAWD,EAAgB,IAAI,CAACE,GAAgBC,MAAU;AAC9D,UAAM,EAAE,cAAAC,GAAc,OAAAC,GAAO,eAAAC,GAAe,KAAAC,MAAQL;AAEpD,QADI,CAACK,KACD,CAACC,EAAyBJ,KAAgB,CAAA,CAAE,EAAG,QAAO;AAC1D,UAAMK,IAAqBC,EAAgBR,GAAgBC,GAAOH,CAAe;AACjF,6BACGW,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAC,EAAC,OAAA,EACC,UAAA;AAAA,QAAA,gBAAAC,EAACf,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAO,GAAM;AAAA,QAClCC,KACC,gBAAAO,EAACf,EAAW,MAAX,EAAgB,MAAK,MACnB,UAAAN,EAAE,sBAAsB,EAAE,MAAME,EAAc,mBAAmBY,CAAa,EAAA,CAAG,EAAA,CACpF;AAAA,MAAA,GAEJ;AAAA,MACA,gBAAAO,EAACC,GAAA,EAAkB,cAAAV,GAA4B,mBAAmBK,EAAA,CAAoB;AAAA,IAAA,EAAA,GATzEA,CAUf;AAAA,EAEJ,CAAC;AAED,SAAIR,EAAS,MAAM,CAAAc,MAAWA,MAAY,IAAI,IAE1C,gBAAAF,EAACf,EAAW,OAAX,EAAiB,QAAO,QAAO,OAAON,EAAE,6BAA6B,GACnE,UAAAA,EAAE,mCAAmC,EAAA,CACxC,IAIGS;AACT;"}
@@ -1,87 +1,88 @@
1
- import { jsx as t, jsxs as D, Fragment as M } from "react/jsx-runtime";
2
- import { useForm as _, FormProvider as w } from "react-hook-form";
3
- import { zodResolver as z } from "@hookform/resolvers/zod";
4
- import { useTaxRequirementsUpdateStateMutation as H } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
- import { useTaxRequirementsGetSuspense as K } from "@gusto/embedded-api/react-query/taxRequirementsGet";
1
+ import { jsx as t, jsxs as M, Fragment as _ } from "react/jsx-runtime";
2
+ import { useForm as w, FormProvider as z } from "react-hook-form";
3
+ import { zodResolver as H } from "@hookform/resolvers/zod";
4
+ import { useTaxRequirementsUpdateStateMutation as K } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
+ import { useTaxRequirementsGetSuspense as N } from "@gusto/embedded-api/react-query/taxRequirementsGet";
6
6
  import { z as b } from "zod";
7
- import { useMemo as N } from "react";
8
- import { useTranslation as O } from "react-i18next";
7
+ import { useMemo as O } from "react";
8
+ import { useTranslation as G } from "react-i18next";
9
9
  import { getUniqueRhfKey as d } from "../shared/rhfKey.js";
10
- import { isRequirementApplicable as G } from "../shared/applicableIf.js";
11
- import { buildRequirementSchema as L } from "../shared/buildRequirementSchema.js";
12
- import { stringifyRequirementValue as X } from "../shared/requirementValue.js";
13
- import { Head as Y } from "./Head.js";
14
- import { StateTaxesFormProvider as $ } from "./context.js";
15
- import { Form as I } from "./Form.js";
16
- import { Actions as J } from "./Actions.js";
17
- import { BaseComponent as Q } from "../../../Base/Base.js";
18
- import { useI18n as W } from "../../../../i18n/I18n.js";
19
- import { Flex as Z } from "../../../Common/Flex/Flex.js";
20
- import { Form as ee } from "../../../Common/Form/Form.js";
21
- import { componentEvents as R } from "../../../../shared/constants.js";
22
- import { useBase as te } from "../../../Base/useBase.js";
23
- function Pe(n) {
24
- return /* @__PURE__ */ t(Q, { ...n, children: /* @__PURE__ */ t(re, { ...n, children: n.children }) });
10
+ import { isRequirementApplicable as L } from "../shared/applicableIf.js";
11
+ import { prepareRequirements as v } from "../shared/prepareRequirements.js";
12
+ import { buildRequirementSchema as X } from "../shared/buildRequirementSchema.js";
13
+ import { stringifyRequirementValue as Y } from "../shared/requirementValue.js";
14
+ import { Head as $ } from "./Head.js";
15
+ import { StateTaxesFormProvider as I } from "./context.js";
16
+ import { Form as J } from "./Form.js";
17
+ import { Actions as Q } from "./Actions.js";
18
+ import { BaseComponent as W } from "../../../Base/Base.js";
19
+ import { useI18n as Z } from "../../../../i18n/I18n.js";
20
+ import { Flex as ee } from "../../../Common/Flex/Flex.js";
21
+ import { Form as te } from "../../../Common/Form/Form.js";
22
+ import { componentEvents as F } from "../../../../shared/constants.js";
23
+ import { useBase as re } from "../../../Base/useBase.js";
24
+ function ke(o) {
25
+ return /* @__PURE__ */ t(W, { ...o, children: /* @__PURE__ */ t(oe, { ...o, children: o.children }) });
25
26
  }
26
- function re({ companyId: n, state: a, className: v, children: S }) {
27
- W("Company.StateTaxes");
28
- const { onEvent: y, baseSubmitHandler: F } = te(), { t: q } = O("Company.StateTaxes", { keyPrefix: "form" }), { data: P } = K({ companyUuid: n, state: a }), c = P.taxRequirementsState, { mutateAsync: g, isPending: k } = H(), { dynamicSchema: A, defaultValues: C } = N(() => {
29
- const u = {}, m = {}, f = c.requirementSets ?? [];
30
- return f.forEach((s, e) => {
31
- if (!s.key) return;
32
- const r = d(s, e, f), { shape: i, defaults: p } = L(s.requirements, q);
33
- Object.keys(i).length > 0 && (u[r] = b.object(i), m[r] = p);
27
+ function oe({ companyId: o, state: c, className: P, children: q }) {
28
+ Z("Company.StateTaxes");
29
+ const { onEvent: y, baseSubmitHandler: g } = re(), { t: x } = G("Company.StateTaxes", { keyPrefix: "form" }), { data: k } = N({ companyUuid: o, state: c }), u = k.taxRequirementsState, { mutateAsync: A, isPending: C } = K(), { dynamicSchema: E, defaultValues: U } = O(() => {
30
+ const f = {}, n = {}, p = u.requirementSets ?? [];
31
+ return p.forEach((i, e) => {
32
+ if (!i.key) return;
33
+ const r = d(i, e, p), s = v(i.requirements ?? []), { shape: a, defaults: h } = X(s, x);
34
+ Object.keys(a).length > 0 && (f[r] = b.object(a), n[r] = h);
34
35
  }), {
35
- dynamicSchema: b.object(u),
36
- defaultValues: m
36
+ dynamicSchema: b.object(f),
37
+ defaultValues: n
37
38
  };
38
- }, [c, q]), { control: E, ...x } = _({
39
- resolver: z(A),
40
- defaultValues: C
41
- }), U = async (u) => {
42
- await F(u, async (m) => {
43
- const f = m, l = c.requirementSets ?? [], s = l.map((e, r) => ({ requirementSet: e, setIndex: r })).filter(({ requirementSet: e, setIndex: r }) => {
39
+ }, [u, x]), { control: j, ...R } = w({
40
+ resolver: H(E),
41
+ defaultValues: U
42
+ }), B = async (f) => {
43
+ await g(f, async (n) => {
44
+ const p = n, l = u.requirementSets ?? [], i = l.map((e, r) => ({ requirementSet: e, setIndex: r })).filter(({ requirementSet: e, setIndex: r }) => {
44
45
  if (!e.key) return !1;
45
- const i = d(e, r, l);
46
- return !!m[i];
46
+ const s = d(e, r, l);
47
+ return !!n[s];
47
48
  }).map(({ requirementSet: e, setIndex: r }) => {
48
- const i = e.key, p = d(e, r, l), B = m[p], T = e.requirements ?? [], V = T.map((o, h) => ({ req: o, index: h })).filter(({ req: o }) => o.editable !== !1).filter(({ req: o }) => G(o, p, f));
49
+ const s = e.key, a = d(e, r, l), h = n[a], T = v(e.requirements ?? []), D = T.map((m, S) => ({ req: m, index: S })).filter(({ req: m }) => L(m, a, p));
49
50
  return {
50
- state: a,
51
- key: i,
51
+ state: c,
52
+ key: s,
52
53
  effectiveFrom: e.effectiveFrom,
53
- requirements: V.map(({ req: o, index: h }) => ({
54
- key: o.key,
55
- value: X(
56
- B[d(o, h, T)]
54
+ requirements: D.map(({ req: m, index: S }) => ({
55
+ key: m.key,
56
+ value: Y(
57
+ h[d(m, S, T)]
57
58
  )
58
59
  }))
59
60
  };
60
61
  });
61
- await g({
62
+ await A({
62
63
  request: {
63
- companyUuid: n,
64
- requestBody: { requirementSets: s },
65
- state: a
64
+ companyUuid: o,
65
+ requestBody: { requirementSets: i },
66
+ state: c
66
67
  }
67
- }), y(R.COMPANY_STATE_TAX_UPDATED);
68
+ }), y(F.COMPANY_STATE_TAX_UPDATED);
68
69
  });
69
- }, j = () => {
70
- y(R.CANCEL);
70
+ }, V = () => {
71
+ y(F.CANCEL);
71
72
  };
72
- return /* @__PURE__ */ t("section", { className: v, children: /* @__PURE__ */ t(w, { ...x, control: E, children: /* @__PURE__ */ t(ee, { onSubmit: x.handleSubmit(U), children: /* @__PURE__ */ t(
73
- $,
73
+ return /* @__PURE__ */ t("section", { className: P, children: /* @__PURE__ */ t(z, { ...R, control: j, children: /* @__PURE__ */ t(te, { onSubmit: R.handleSubmit(B), children: /* @__PURE__ */ t(
74
+ I,
74
75
  {
75
- value: { stateTaxRequirements: c, isPending: k, state: a, handleCancel: j },
76
- children: /* @__PURE__ */ t(Z, { flexDirection: "column", gap: 32, children: S || /* @__PURE__ */ D(M, { children: [
77
- /* @__PURE__ */ t(Y, {}),
78
- /* @__PURE__ */ t(I, {}),
79
- /* @__PURE__ */ t(J, {})
76
+ value: { stateTaxRequirements: u, isPending: C, state: c, handleCancel: V },
77
+ children: /* @__PURE__ */ t(ee, { flexDirection: "column", gap: 32, children: q || /* @__PURE__ */ M(_, { children: [
78
+ /* @__PURE__ */ t($, {}),
79
+ /* @__PURE__ */ t(J, {}),
80
+ /* @__PURE__ */ t(Q, {})
80
81
  ] }) })
81
82
  }
82
83
  ) }) }) });
83
84
  }
84
85
  export {
85
- Pe as StateTaxesForm
86
+ ke as StateTaxesForm
86
87
  };
87
88
  //# sourceMappingURL=StateTaxesForm.js.map