@tesouro/embedded-components-react 0.7.70 → 0.7.73

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 (46) hide show
  1. package/README.md +15 -12
  2. package/dist/index.css +24 -6
  3. package/dist/index.d.ts +76 -8
  4. package/dist/lib/LinkedAccountsWidget.d.ts +9 -0
  5. package/dist/lib/ProductsWidget.d.ts +12 -6
  6. package/dist/lib/ReceivablesWidget.d.ts +1 -5
  7. package/dist/lib/TransfersWidget.d.ts +55 -2
  8. package/dist/lib/WidgetSuite.d.ts +63 -1
  9. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +6 -4
  10. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +199 -182
  11. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +23 -24
  12. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/constants.js +6 -2
  13. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsTable.js +112 -51
  14. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsWidget.js +80 -56
  15. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index.js +6 -5
  16. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +15 -6
  17. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +170 -135
  18. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +49 -150
  19. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js +152 -24
  20. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js +28 -0
  21. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js +13 -12
  23. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +2 -2
  24. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +41 -27
  26. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +70 -52
  27. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +7 -6
  28. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +19 -8
  29. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +171 -218
  30. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +52 -180
  31. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index5.js +188 -46
  32. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +47 -124
  33. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index7.js +128 -0
  34. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetFeature.js +4 -3
  35. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +99 -108
  36. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/testIds.js +2 -0
  37. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +135 -0
  38. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +140 -153
  39. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js +15 -0
  40. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js +111 -0
  41. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferStatusBadge.js +18 -0
  42. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +181 -126
  43. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +33 -0
  44. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/TransfersSection.js +16 -8
  45. package/dist/packages/shared-ui-shadcn/dist/index.js +328 -327
  46. package/package.json +1 -1
@@ -1,9 +1,8 @@
1
- import { LABEL_LABELS_EN as e, REQUIRED_FIELDS_LEGEND_LABELS_EN as t } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
1
+ import { LABEL_LABELS_EN as e, REQUIRED_FIELDS_LEGEND_LABELS_EN as t, mergeRequiredFieldsLegendLabels as n } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
2
  //#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js
3
- var n = {
3
+ var r = {
4
4
  createTitle: "Add a product or service",
5
5
  headerDescription: "Save the products and services you sell so you can quickly add them as line items on invoices.",
6
- editTitle: "Edit {type}",
7
6
  editingBanner: "Editing {type} details",
8
7
  nameLabel: "Name",
9
8
  namePlaceholder: "e.g. House blend espresso beans",
@@ -19,14 +18,26 @@ var n = {
19
18
  unitEmpty: "No units found",
20
19
  unitClearAriaLabel: "Clear unit",
21
20
  priceLabel: "Price per unit",
22
- pricePrefix: "$",
23
21
  pricePlaceholder: "0.00",
24
22
  cancelButton: "Cancel",
25
23
  createButton: "Save {type}",
26
24
  saveButton: "Save",
27
25
  fieldMarkers: e,
28
26
  requiredFieldsLegend: t
29
- }, r = {
27
+ };
28
+ function i(e) {
29
+ let t = {
30
+ ...r.fieldMarkers,
31
+ ...e?.fieldMarkers
32
+ };
33
+ return {
34
+ ...r,
35
+ ...e,
36
+ fieldMarkers: t,
37
+ requiredFieldsLegend: n(t, e?.requiredFieldsLegend)
38
+ };
39
+ }
40
+ var a = {
30
41
  title: "Manage measure units",
31
42
  hiddenDescription: "Create, edit, and delete measure units",
32
43
  searchPlaceholder: "Search",
@@ -42,7 +53,7 @@ var n = {
42
53
  saveAction: "Save unit",
43
54
  cancelAction: "Cancel edit",
44
55
  emptyText: "No measure units yet."
45
- }, i = {
56
+ }, o = {
46
57
  titleNoItems: "Delete “{name}” unit?",
47
58
  titleWithItems: "Delete “{name}” unit and associated items?",
48
59
  messageNoItems: "There are no items created with this measure unit.",
@@ -51,11 +62,11 @@ var n = {
51
62
  messageWithItemsHint: "Please, check the list of products and services that will get deleted:",
52
63
  confirmButton: "Delete",
53
64
  cancelButton: "Cancel"
54
- }, a = {
65
+ }, s = {
55
66
  fieldLabel: "Item name",
56
67
  placeholder: "e.g., Office supplies",
57
68
  emptyText: "No saved items found - type to add an item",
58
69
  toggleListButton: "Show saved items"
59
70
  };
60
71
  //#endregion
61
- export { r as MEASURE_UNITS_MANAGER_LABELS_EN, i as MEASURE_UNIT_DELETE_DIALOG_LABELS_EN, n as PRODUCT_FORM_SHEET_LABELS_EN, a as PRODUCT_SELECTOR_LABELS_EN };
72
+ export { a as MEASURE_UNITS_MANAGER_LABELS_EN, o as MEASURE_UNIT_DELETE_DIALOG_LABELS_EN, r as PRODUCT_FORM_SHEET_LABELS_EN, s as PRODUCT_SELECTOR_LABELS_EN, i as mergeProductFormSheetLabels };
@@ -1,234 +1,187 @@
1
- import { Button as e, Combobox as t, FieldRequirement as n, Input as r, InputGroup as i, InputGroupAddon as a, InputGroupInput as o, Label as s, RadioGroup as c, RadioGroupItem as l, RequiredFieldsLegend as u, Sheet as d, SheetContent as f, SheetDescription as p, SheetFooter as m, SheetHeader as h, SheetTitle as g, Textarea as _, Typography as v, mergeRequiredFieldsLegendLabels as y } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { PRODUCT_FORM_SHEET_LABELS_EN as b } from "./index2.js";
3
- import { useId as x } from "react";
4
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
1
+ import { Combobox as e, FieldRequirement as t, Input as n, InputGroup as r, InputGroupAddon as i, InputGroupInput as a, Label as o, RadioGroup as s, RadioGroupItem as c, RequiredFieldsLegend as l, Textarea as u, Typography as d } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { mergeProductFormSheetLabels as f } from "./index2.js";
3
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
5
4
  //#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js
6
- var w = "__no_unit__", T = "ttw:flex ttw:cursor-pointer ttw:items-center ttw:gap-2 ttw:rounded-full ttw:border ttw:border-border ttw:bg-background ttw:px-3 ttw:py-1.5 ttw:text-sm ttw:has-[:checked]:border-primary ttw:has-[:checked]:bg-primary/10";
7
- function E({ id: e, message: t }) {
8
- return t ? /* @__PURE__ */ S("p", {
5
+ var g = "__no_unit__", _ = "ttw:flex ttw:cursor-pointer ttw:items-center ttw:gap-2 ttw:rounded-full ttw:border ttw:border-border ttw:bg-background ttw:px-3 ttw:py-1.5 ttw:text-sm ttw:has-[:checked]:border-primary ttw:has-[:checked]:bg-primary/10", v = "ttw:bg-background!";
6
+ function y({ id: e, message: t }) {
7
+ return t ? /* @__PURE__ */ m("p", {
9
8
  id: e,
10
9
  className: "ttw:text-sm ttw:text-destructive",
11
10
  children: t
12
11
  }) : null;
13
12
  }
14
- function D({ open: D, onOpenChange: O, mode: k, values: A, errors: j, unitOptions: M, inProgress: N, onChange: P, onSubmit: F, onCancel: I, labels: L }) {
15
- let R = {
16
- ...b.fieldMarkers,
17
- ...L?.fieldMarkers
18
- }, z = {
19
- ...b,
20
- ...L,
21
- fieldMarkers: R,
22
- requiredFieldsLegend: y(R, L?.requiredFieldsLegend)
23
- }, B = x(), V = A.type === "service" ? z.typeService.toLowerCase() : z.typeProduct.toLowerCase(), H = k === "edit" ? z.editTitle.replace("{type}", V) : z.createTitle, U = z.createButton.replace("{type}", V);
24
- return /* @__PURE__ */ S(d, {
25
- open: D,
26
- onOpenChange: O,
27
- children: /* @__PURE__ */ C(f, {
28
- className: "ttw:w-150 ttw:sm:max-w-150 ttw:gap-0",
13
+ function b({ idPrefix: b, values: x, errors: S, unitOptions: C, pricePrefix: w, onChange: T, labels: E }) {
14
+ let D = f(E);
15
+ return /* @__PURE__ */ h(p, { children: [
16
+ /* @__PURE__ */ m(l, { labels: D.requiredFieldsLegend }),
17
+ S?.form && /* @__PURE__ */ m("p", {
18
+ role: "alert",
19
+ className: "ttw:rounded-md ttw:bg-destructive/10 ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-destructive",
20
+ children: S.form
21
+ }),
22
+ /* @__PURE__ */ h("fieldset", {
23
+ className: "ttw:flex ttw:flex-col ttw:gap-2",
29
24
  children: [
30
- /* @__PURE__ */ C(h, {
31
- className: "ttw:border-b ttw:border-border",
32
- children: [/* @__PURE__ */ S(g, {
33
- className: "ttw:text-2xl",
34
- children: H
35
- }), k === "create" ? /* @__PURE__ */ S(p, {
36
- className: "ttw:max-w-130",
37
- children: z.headerDescription
38
- }) : /* @__PURE__ */ S(p, {
39
- className: "ttw:sr-only",
40
- children: H
41
- })]
25
+ /* @__PURE__ */ m("legend", {
26
+ className: "ttw:mb-1 ttw:text-sm ttw:font-medium",
27
+ children: D.typeLabel
28
+ }),
29
+ /* @__PURE__ */ m(s, {
30
+ className: "ttw:flex ttw:flex-wrap ttw:gap-2",
31
+ value: x.type,
32
+ "aria-describedby": S?.type ? `${b}-type-error` : void 0,
33
+ onValueChange: (e) => T({ type: e }),
34
+ children: [{
35
+ value: "product",
36
+ label: D.typeProduct
37
+ }, {
38
+ value: "service",
39
+ label: D.typeService
40
+ }].map((e) => /* @__PURE__ */ h(o, {
41
+ htmlFor: `${b}-type-${e.value}`,
42
+ className: _,
43
+ children: [/* @__PURE__ */ m(c, {
44
+ value: e.value,
45
+ id: `${b}-type-${e.value}`
46
+ }), /* @__PURE__ */ m("span", {
47
+ className: "ttw:font-medium",
48
+ children: e.label
49
+ })]
50
+ }, e.value))
51
+ }),
52
+ /* @__PURE__ */ m(y, {
53
+ id: `${b}-type-error`,
54
+ message: S?.type
55
+ })
56
+ ]
57
+ }),
58
+ /* @__PURE__ */ h("div", {
59
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
60
+ children: [
61
+ /* @__PURE__ */ m(o, {
62
+ htmlFor: `${b}-name`,
63
+ requirement: t.Required,
64
+ labels: D.fieldMarkers,
65
+ children: D.nameLabel
42
66
  }),
43
- /* @__PURE__ */ S("form", {
44
- id: B,
45
- onSubmit: (e) => {
46
- e.preventDefault(), e.stopPropagation(), F();
47
- },
48
- children: /* @__PURE__ */ C("div", {
49
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:px-6 ttw:py-8 ttw:overflow-auto",
50
- children: [
51
- /* @__PURE__ */ S(u, { labels: z.requiredFieldsLegend }),
52
- j?.form && /* @__PURE__ */ S("p", {
53
- role: "alert",
54
- className: "ttw:rounded-md ttw:bg-destructive/10 ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-destructive",
55
- children: j.form
56
- }),
57
- k === "edit" && /* @__PURE__ */ S("div", {
58
- className: "ttw:flex ttw:items-center ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
59
- children: /* @__PURE__ */ S(v, {
60
- variant: "body1",
61
- className: "ttw:font-medium",
62
- children: z.editingBanner.replace("{type}", V)
63
- })
64
- }),
65
- /* @__PURE__ */ C("fieldset", {
66
- className: "ttw:flex ttw:flex-col ttw:gap-2",
67
- children: [
68
- /* @__PURE__ */ S("legend", {
69
- className: "ttw:mb-1 ttw:text-sm ttw:font-medium",
70
- children: z.typeLabel
71
- }),
72
- /* @__PURE__ */ S(c, {
73
- className: "ttw:flex ttw:flex-wrap ttw:gap-2",
74
- value: A.type,
75
- onValueChange: (e) => P({ type: e }),
76
- children: [{
77
- value: "product",
78
- label: z.typeProduct
79
- }, {
80
- value: "service",
81
- label: z.typeService
82
- }].map((e) => /* @__PURE__ */ C(s, {
83
- htmlFor: `${B}-type-${e.value}`,
84
- className: T,
85
- children: [/* @__PURE__ */ S(l, {
86
- value: e.value,
87
- id: `${B}-type-${e.value}`
88
- }), /* @__PURE__ */ S("span", {
89
- className: "ttw:font-medium",
90
- children: e.label
91
- })]
92
- }, e.value))
93
- }),
94
- /* @__PURE__ */ S(E, { message: j?.type })
95
- ]
96
- }),
97
- /* @__PURE__ */ C("div", {
98
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
99
- children: [
100
- /* @__PURE__ */ S(s, {
101
- htmlFor: `${B}-name`,
102
- requirement: n.Required,
103
- labels: z.fieldMarkers,
104
- children: z.nameLabel
105
- }),
106
- /* @__PURE__ */ S(r, {
107
- id: `${B}-name`,
108
- autoFocus: !0,
109
- "aria-required": !0,
110
- placeholder: z.namePlaceholder,
111
- value: A.name,
112
- "aria-invalid": !!j?.name,
113
- onChange: (e) => P({ name: e.target.value })
114
- }),
115
- /* @__PURE__ */ S(E, { message: j?.name })
116
- ]
117
- }),
118
- /* @__PURE__ */ C("div", {
119
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
120
- children: [/* @__PURE__ */ C("div", {
121
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
122
- children: [
123
- /* @__PURE__ */ S(s, {
124
- htmlFor: `${B}-price`,
125
- requirement: n.Optional,
126
- labels: z.fieldMarkers,
127
- children: z.priceLabel
128
- }),
129
- /* @__PURE__ */ C(i, { children: [/* @__PURE__ */ S(a, {
130
- align: "inline-start",
131
- children: z.pricePrefix
132
- }), /* @__PURE__ */ S(o, {
133
- id: `${B}-price`,
134
- "data-has-start-addon": !0,
135
- inputMode: "decimal",
136
- placeholder: z.pricePlaceholder,
137
- value: A.pricePerUnit,
138
- "aria-invalid": !!j?.pricePerUnit || void 0,
139
- "aria-describedby": j?.pricePerUnit ? `${B}-price-error` : void 0,
140
- className: "ttw:text-end",
141
- onChange: (e) => P({ pricePerUnit: e.target.value })
142
- })] }),
143
- /* @__PURE__ */ S(E, {
144
- id: `${B}-price-error`,
145
- message: j?.pricePerUnit
146
- })
147
- ]
148
- }), /* @__PURE__ */ C("div", {
149
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
150
- children: [
151
- /* @__PURE__ */ S(s, {
152
- htmlFor: `${B}-unit`,
153
- requirement: n.Optional,
154
- labels: z.fieldMarkers,
155
- children: z.unitLabel
156
- }),
157
- /* @__PURE__ */ S(t, {
158
- inputId: `${B}-unit`,
159
- items: [{
160
- value: w,
161
- label: z.noUnit
162
- }, ...M],
163
- value: A.unitId || null,
164
- invalid: !!j?.unitId,
165
- describedBy: j?.unitId ? `${B}-unit-error` : void 0,
166
- labels: {
167
- placeholder: z.unitPlaceholder,
168
- emptyMessage: z.unitEmpty,
169
- clearAriaLabel: z.unitClearAriaLabel
170
- },
171
- onValueChange: (e) => P({ unitId: typeof e == "string" && e !== w ? e : "" })
172
- }),
173
- /* @__PURE__ */ S(E, {
174
- id: `${B}-unit-error`,
175
- message: j?.unitId
176
- })
177
- ]
178
- })]
179
- }),
180
- /* @__PURE__ */ C("div", {
181
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
182
- children: [
183
- /* @__PURE__ */ S(s, {
184
- htmlFor: `${B}-description`,
185
- requirement: n.Optional,
186
- labels: z.fieldMarkers,
187
- children: z.descriptionLabel
188
- }),
189
- /* @__PURE__ */ S(_, {
190
- id: `${B}-description`,
191
- rows: 4,
192
- placeholder: z.descriptionPlaceholder,
193
- value: A.description,
194
- maxLength: 255,
195
- "aria-invalid": !!j?.description,
196
- onChange: (e) => P({ description: e.target.value })
197
- }),
198
- /* @__PURE__ */ C("div", {
199
- className: "ttw:flex ttw:justify-between ttw:items-start",
200
- children: [/* @__PURE__ */ S(E, { message: j?.description }), /* @__PURE__ */ S(v, {
201
- variant: "caption",
202
- color: "muted",
203
- className: "ttw:ml-auto ttw:leading-none",
204
- children: z.descriptionCount.replace("{count}", String(A.description.length))
205
- })]
206
- })
207
- ]
208
- })
209
- ]
67
+ /* @__PURE__ */ m(n, {
68
+ id: `${b}-name`,
69
+ autoFocus: !0,
70
+ "aria-required": !0,
71
+ className: v,
72
+ placeholder: D.namePlaceholder,
73
+ value: x.name,
74
+ "aria-invalid": !!S?.name,
75
+ "aria-describedby": S?.name ? `${b}-name-error` : void 0,
76
+ onChange: (e) => T({ name: e.target.value })
77
+ }),
78
+ /* @__PURE__ */ m(y, {
79
+ id: `${b}-name-error`,
80
+ message: S?.name
81
+ })
82
+ ]
83
+ }),
84
+ /* @__PURE__ */ h("div", {
85
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
86
+ children: [/* @__PURE__ */ h("div", {
87
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
88
+ children: [
89
+ /* @__PURE__ */ m(o, {
90
+ htmlFor: `${b}-price`,
91
+ requirement: t.Optional,
92
+ labels: D.fieldMarkers,
93
+ children: D.priceLabel
94
+ }),
95
+ /* @__PURE__ */ h(r, {
96
+ className: v,
97
+ children: [/* @__PURE__ */ m(i, {
98
+ align: "inline-start",
99
+ children: w
100
+ }), /* @__PURE__ */ m(a, {
101
+ id: `${b}-price`,
102
+ "data-has-start-addon": !0,
103
+ inputMode: "decimal",
104
+ placeholder: D.pricePlaceholder,
105
+ value: x.pricePerUnit,
106
+ "aria-invalid": !!S?.pricePerUnit || void 0,
107
+ "aria-describedby": S?.pricePerUnit ? `${b}-price-error` : void 0,
108
+ className: "ttw:text-end",
109
+ onChange: (e) => T({ pricePerUnit: e.target.value })
110
+ })]
111
+ }),
112
+ /* @__PURE__ */ m(y, {
113
+ id: `${b}-price-error`,
114
+ message: S?.pricePerUnit
210
115
  })
116
+ ]
117
+ }), /* @__PURE__ */ h("div", {
118
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
119
+ children: [
120
+ /* @__PURE__ */ m(o, {
121
+ htmlFor: `${b}-unit`,
122
+ requirement: t.Optional,
123
+ labels: D.fieldMarkers,
124
+ children: D.unitLabel
125
+ }),
126
+ /* @__PURE__ */ m(e, {
127
+ className: "ttw:rounded-md ttw:bg-background",
128
+ inputId: `${b}-unit`,
129
+ items: [{
130
+ value: g,
131
+ label: D.noUnit
132
+ }, ...C],
133
+ value: x.unitId || null,
134
+ invalid: !!S?.unitId,
135
+ describedBy: S?.unitId ? `${b}-unit-error` : void 0,
136
+ labels: {
137
+ placeholder: D.unitPlaceholder,
138
+ emptyMessage: D.unitEmpty,
139
+ clearAriaLabel: D.unitClearAriaLabel
140
+ },
141
+ onValueChange: (e) => T({ unitId: typeof e == "string" && e !== g ? e : "" })
142
+ }),
143
+ /* @__PURE__ */ m(y, {
144
+ id: `${b}-unit-error`,
145
+ message: S?.unitId
146
+ })
147
+ ]
148
+ })]
149
+ }),
150
+ /* @__PURE__ */ h("div", {
151
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
152
+ children: [
153
+ /* @__PURE__ */ m(o, {
154
+ htmlFor: `${b}-description`,
155
+ requirement: t.Optional,
156
+ labels: D.fieldMarkers,
157
+ children: D.descriptionLabel
158
+ }),
159
+ /* @__PURE__ */ m(u, {
160
+ id: `${b}-description`,
161
+ rows: 4,
162
+ className: v,
163
+ placeholder: D.descriptionPlaceholder,
164
+ value: x.description,
165
+ maxLength: 255,
166
+ "aria-invalid": !!S?.description,
167
+ "aria-describedby": S?.description ? `${b}-description-error` : void 0,
168
+ onChange: (e) => T({ description: e.target.value })
211
169
  }),
212
- /* @__PURE__ */ C(m, {
213
- className: "ttw:border-t ttw:border-border ttw:flex-row ttw:justify-end",
214
- children: [/* @__PURE__ */ S(e, {
215
- type: "button",
216
- variant: "outline",
217
- className: "ttw:w-fit ttw:border-border",
218
- onClick: I,
219
- children: z.cancelButton
220
- }), /* @__PURE__ */ S(e, {
221
- type: "submit",
222
- form: B,
223
- className: "ttw:w-fit",
224
- disabled: N,
225
- loading: N,
226
- children: k === "edit" ? z.saveButton : U
170
+ /* @__PURE__ */ h("div", {
171
+ className: "ttw:flex ttw:justify-between ttw:items-start",
172
+ children: [/* @__PURE__ */ m(y, {
173
+ id: `${b}-description-error`,
174
+ message: S?.description
175
+ }), /* @__PURE__ */ m(d, {
176
+ variant: "caption",
177
+ color: "muted",
178
+ className: "ttw:ml-auto ttw:leading-none",
179
+ children: D.descriptionCount.replace("{count}", String(x.description.length))
227
180
  })]
228
181
  })
229
182
  ]
230
183
  })
231
- });
184
+ ] });
232
185
  }
233
186
  //#endregion
234
- export { D as ProductFormSheet, D as default };
187
+ export { b as ProductFormFields, b as default };