@commercelayer/app-elements 0.0.80 → 0.1.1

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 (128) hide show
  1. package/README.md +14 -48
  2. package/dist/{Async-a8cbdb5b.js → Async-566ec3f7.js} +3 -3
  3. package/dist/{InputDateComponent-a8c34dc1.js → InputDateComponent-4461b3e6.js} +3 -3
  4. package/dist/{Select-e581ae99.js → Select-89937223.js} +3 -3
  5. package/dist/helpers/appsNavigation.d.ts +1 -1
  6. package/dist/{main-dd440dc6.js → main-795be39b.js} +7119 -7022
  7. package/dist/main.d.ts +22 -38
  8. package/dist/main.js +97 -97
  9. package/dist/mocks/setup.d.ts +3 -0
  10. package/dist/{overrides-0673bab0.js → overrides-346bb0f6.js} +621 -618
  11. package/dist/providers/TokenProvider/TokenProvider.d.ts +15 -11
  12. package/dist/providers/TokenProvider/getInfoFromJwt.d.ts +3 -2
  13. package/dist/providers/TokenProvider/url.d.ts +3 -2
  14. package/dist/providers/TokenProvider/validateToken.d.ts +6 -1
  15. package/dist/style.css +1 -1
  16. package/dist/ui/atoms/Section.d.ts +31 -0
  17. package/dist/ui/atoms/Table/Table.d.ts +21 -0
  18. package/dist/ui/atoms/Table/Td.d.ts +8 -0
  19. package/dist/ui/atoms/{tables → Table}/index.d.ts +3 -2
  20. package/dist/ui/{lists → composite}/ListDetails.d.ts +1 -1
  21. package/dist/ui/composite/TableData.d.ts +23 -0
  22. package/dist/ui/forms/Form/index.d.ts +1 -0
  23. package/dist/ui/{hook-form → forms/Input}/HookedInput.d.ts +4 -4
  24. package/dist/ui/forms/{Input.d.ts → Input/Input.d.ts} +2 -3
  25. package/dist/ui/forms/Input/index.d.ts +2 -0
  26. package/dist/ui/{hook-form → forms/InputCheckbox}/HookedInputCheckbox.d.ts +4 -4
  27. package/dist/ui/forms/{InputCheckbox.d.ts → InputCheckbox/InputCheckbox.d.ts} +2 -2
  28. package/dist/ui/forms/InputCheckbox/index.d.ts +2 -0
  29. package/dist/ui/forms/InputCheckboxGroup.d.ts +2 -3
  30. package/dist/ui/{hook-form → forms/InputCurrency}/HookedInputCurrency.d.ts +4 -4
  31. package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +48 -0
  32. package/dist/ui/forms/InputCurrency/index.d.ts +3 -58
  33. package/dist/ui/forms/InputCurrency/utils.d.ts +10 -0
  34. package/dist/ui/forms/InputCurrencyRange.d.ts +8 -5
  35. package/dist/ui/{hook-form → forms/InputDate}/HookedInputDate.d.ts +4 -4
  36. package/dist/ui/forms/InputDate/InputDate.d.ts +4 -0
  37. package/dist/ui/forms/InputDate/InputDateComponent.d.ts +1 -2
  38. package/dist/ui/forms/InputDate/index.d.ts +2 -5
  39. package/dist/ui/{hook-form → forms/InputDateRange}/HookedInputDateRange.d.ts +4 -4
  40. package/dist/ui/forms/{InputDateRange.d.ts → InputDateRange/InputDateRange.d.ts} +3 -4
  41. package/dist/ui/forms/InputDateRange/index.d.ts +2 -0
  42. package/dist/ui/forms/InputFeedback.d.ts +2 -3
  43. package/dist/ui/forms/InputFile.d.ts +6 -2
  44. package/dist/ui/forms/InputJson.d.ts +2 -3
  45. package/dist/ui/{hook-form → forms/InputMetadata}/HookedInputMetadata.d.ts +3 -3
  46. package/dist/ui/forms/InputMetadata/index.d.ts +1 -0
  47. package/dist/ui/forms/InputRadioGroup.d.ts +9 -4
  48. package/dist/ui/forms/InputReadonly.d.ts +3 -3
  49. package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/Checkbox.d.ts +1 -1
  50. package/dist/ui/forms/InputResourceGroup/HookedInputResourceGroup.d.ts +15 -0
  51. package/dist/ui/forms/InputResourceGroup/InputResourceGroup.d.ts +28 -0
  52. package/dist/ui/forms/InputResourceGroup/index.d.ts +2 -0
  53. package/dist/ui/forms/InputSelect/Async.d.ts +1 -1
  54. package/dist/ui/{hook-form → forms/InputSelect}/HookedInputSelect.d.ts +4 -4
  55. package/dist/ui/forms/InputSelect/InputSelect.d.ts +91 -0
  56. package/dist/ui/forms/InputSelect/Select.d.ts +1 -1
  57. package/dist/ui/forms/InputSelect/index.d.ts +2 -91
  58. package/dist/ui/forms/InputSimpleSelect/HookedInputSimpleSelect.d.ts +21 -0
  59. package/dist/ui/forms/InputSimpleSelect/InputSimpleSelect.d.ts +12 -0
  60. package/dist/ui/forms/InputSimpleSelect/index.d.ts +2 -0
  61. package/dist/ui/{hook-form → forms/InputSpinner}/HookedInputSpinner.d.ts +4 -4
  62. package/dist/ui/forms/{InputSpinner.d.ts → InputSpinner/InputSpinner.d.ts} +2 -3
  63. package/dist/ui/forms/InputSpinner/index.d.ts +2 -0
  64. package/dist/ui/{hook-form/HookedInputToggleBox.d.ts → forms/InputSwitch/HookedInputSwitch.d.ts} +6 -6
  65. package/dist/ui/forms/InputSwitch/InputSwitch.d.ts +5 -0
  66. package/dist/ui/forms/InputSwitch/index.d.ts +2 -0
  67. package/dist/ui/forms/InputTextArea.d.ts +2 -2
  68. package/dist/ui/forms/InputToggleButton/HookedInputToggleButton.d.ts +18 -0
  69. package/dist/ui/forms/{ToggleButtons.d.ts → InputToggleButton/InputToggleButton.d.ts} +7 -6
  70. package/dist/ui/forms/InputToggleButton/index.d.ts +2 -0
  71. package/dist/ui/forms/Label.d.ts +6 -3
  72. package/dist/ui/forms/Legend.d.ts +14 -0
  73. package/dist/ui/{hook-form → forms/ReactHookForm}/HookedValidationApiError.d.ts +3 -3
  74. package/dist/ui/{hook-form → forms/ReactHookForm}/HookedValidationError.d.ts +3 -3
  75. package/dist/ui/forms/ReactHookForm/index.d.ts +4 -0
  76. package/dist/ui/{hook-form → forms/ReactHookForm}/useValidationFeedback.d.ts +1 -1
  77. package/dist/ui/internals/InputWrapper.d.ts +6 -1
  78. package/dist/ui/resources/Filters/types.d.ts +4 -4
  79. package/dist/ui/resources/Filters/useFilters.d.ts +2 -1
  80. package/dist/ui/resources/ResourceList/ResourceList.d.ts +64 -0
  81. package/dist/ui/resources/ResourceList/index.d.ts +1 -45
  82. package/dist/{unsupportedIterableToArray-0f93b40f.js → unsupportedIterableToArray-a3020d44.js} +1 -1
  83. package/dist/utils/children.d.ts +4 -3
  84. package/dist/utils/extractHeaders.d.ts +2 -1
  85. package/dist/utils/text.d.ts +8 -1
  86. package/package.json +26 -26
  87. package/dist/ui/atoms/Legend.d.ts +0 -32
  88. package/dist/ui/atoms/tables/Td.d.ts +0 -9
  89. package/dist/ui/forms/InputToggleBox.d.ts +0 -9
  90. package/dist/ui/forms/InputToggleListBox.d.ts +0 -15
  91. package/dist/ui/forms/RadioButtons.d.ts +0 -19
  92. package/dist/ui/hook-form/HookedInputToggleListBox.d.ts +0 -21
  93. package/dist/ui/hook-form/HookedRelationshipSelector.d.ts +0 -18
  94. package/dist/ui/hook-form/HookedToggleButtons.d.ts +0 -18
  95. package/dist/ui/resources/RelationshipSelector/index.d.ts +0 -26
  96. package/dist/ui/resources/ResourceList/index.test.d.ts +0 -1
  97. package/dist/ui/tables/Table.d.ts +0 -10
  98. package/dist/ui/tables/TableData.d.ts +0 -14
  99. package/dist/utils/tests.d.ts +0 -1
  100. /package/dist/ui/atoms/{Legend.test.d.ts → Section.test.d.ts} +0 -0
  101. /package/dist/ui/{tables → atoms/Table}/Table.test.d.ts +0 -0
  102. /package/dist/ui/atoms/{tables → Table}/Th.d.ts +0 -0
  103. /package/dist/ui/atoms/{tables → Table}/Tr.d.ts +0 -0
  104. /package/dist/ui/{lists → composite}/List.d.ts +0 -0
  105. /package/dist/ui/{lists → composite}/List.test.d.ts +0 -0
  106. /package/dist/ui/{lists → composite}/ListDetails.test.d.ts +0 -0
  107. /package/dist/ui/{lists → composite}/ListDetailsItem.d.ts +0 -0
  108. /package/dist/ui/{lists → composite}/ListDetailsItem.test.d.ts +0 -0
  109. /package/dist/ui/{lists → composite}/ListItem.d.ts +0 -0
  110. /package/dist/ui/{lists → composite}/ListItem.test.d.ts +0 -0
  111. /package/dist/ui/{tables → composite}/TableData.test.d.ts +0 -0
  112. /package/dist/ui/{hook-form → forms/Form}/HookedForm.d.ts +0 -0
  113. /package/dist/ui/forms/{Input.test.d.ts → Input/Input.test.d.ts} +0 -0
  114. /package/dist/ui/forms/{InputCheckbox.test.d.ts → InputCheckbox/InputCheckbox.test.d.ts} +0 -0
  115. /package/dist/ui/forms/InputCurrency/{index.test.d.ts → InputCurrency.test.d.ts} +0 -0
  116. /package/dist/ui/forms/InputDate/{InputDate.test.d.ts → InputDateComponent.test.d.ts} +0 -0
  117. /package/dist/ui/forms/{InputDateRange.test.d.ts → InputDateRange/InputDateRange.test.d.ts} +0 -0
  118. /package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/FullList.d.ts +0 -0
  119. /package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/utils.d.ts +0 -0
  120. /package/dist/ui/{resources/RelationshipSelector → forms/InputResourceGroup}/utils.test.d.ts +0 -0
  121. /package/dist/ui/forms/InputSelect/{index.test.d.ts → InputSelect.test.d.ts} +0 -0
  122. /package/dist/ui/forms/{InputSpinner.test.d.ts → InputSimpleSelect/InputSimpleSelect.test.d.ts} +0 -0
  123. /package/dist/ui/forms/{InputToggleBox.test.d.ts → InputSpinner/InputSpinner.test.d.ts} +0 -0
  124. /package/dist/ui/forms/{InputToggleListBox.test.d.ts → InputSwitch/InputSwitch.test.d.ts} +0 -0
  125. /package/dist/ui/forms/{RadioButtons.test.d.ts → InputToggleButton/InputToggleButton.test.d.ts} +0 -0
  126. /package/dist/ui/{hook-form → forms/ReactHookForm}/setApiFormErrors.d.ts +0 -0
  127. /package/dist/ui/{hook-form → forms/ReactHookForm}/setApiFormErrors.test.d.ts +0 -0
  128. /package/dist/ui/{forms/ToggleButtons.test.d.ts → resources/ResourceList/ResourceList.test.d.ts} +0 -0
package/README.md CHANGED
@@ -1,59 +1,25 @@
1
- # App Elements
2
-
3
- React UI Elements for Commerce Layer applications.
4
-
5
- ## What is Commerce Layer?
6
-
7
- [Commerce Layer](https://commercelayer.io) is a multi-market commerce API and order management system that lets you add global shopping capabilities to any website, mobile app, chatbot, wearable, voice, or IoT device, with ease. Compose your stack with the best-of-breed tools you already mastered and love. Make any experience shoppable, anywhere, through a blazing-fast, enterprise-grade, and secure API.
1
+ > [!WARNING]
2
+ > This library is still in active development.
8
3
 
9
- ## Table of contents
10
-
11
- - [Getting started](#getting-started)
12
- - [Preact](#preact)
4
+ # App Elements
13
5
 
14
- ## Getting started
6
+ `App Elements` is a React components library used to build Commerce Layer dashboard HUB apps. This library contains different types of components, helpers and hooks, from simple and small bits like `Button` o `Card` to complex components like `OrderSummary`.
15
7
 
16
- 1. Install the package as dependency
8
+ ## Local development
17
9
 
18
10
  ```sh
19
- pnpm install @commercelayer/app-elements
20
- ```
21
-
22
- 2. Add global css in your app index.tsx
23
-
24
- ```jsx
25
- import "@commercelayer/app-elements/style.css";
26
-
27
-
28
- React.createRoot(document.getElementById("root") as HTMLElement).render(
29
- <React.StrictMode>
30
- <App />
31
- </React.StrictMode>
32
- )
11
+ pnpm install
12
+ pnpm dev
33
13
  ```
34
14
 
35
- 3. load Manrope Google font into your html
15
+ ### Link to other application
36
16
 
37
- ```html
38
- <head>
39
- <link rel="preconnect" href="https://fonts.gstatic.com" />
40
- <link
41
- href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap"
42
- rel="stylesheet"
43
- />
44
- </head>
45
- ```
17
+ ```sh
18
+ pnpm build:elements --watch
46
19
 
47
- 4. Import any components your need
20
+ cd ~/projects/app-elements/packages/app-elements
21
+ pnpm link --global
48
22
 
49
- ```jsx
50
- import { Container, Button, Label } from "@commercelayer/app-elements";
23
+ cd ~/projects/my-app/packages/app
24
+ pnpm link --global @commercelayer/app-elements
51
25
  ```
52
-
53
- 5. (optional) install `@commercelayer/sdk` to use `<TokenProvider>` component
54
-
55
- ## Preact
56
-
57
- Support for `preact` is provided out of the box, thanks to the fact we are not including React jsx-runtime modules in bundled files.
58
- The application where this package is installed to is responsible of this.
59
- But no extra configuration should be required in your project, in fact all latest versions of vite, react and preact will handle this automatically.
@@ -1,8 +1,8 @@
1
- import { L as de, H as le } from "./main-dd440dc6.js";
1
+ import { L as de, H as le } from "./main-795be39b.js";
2
2
  import * as ce from "react";
3
3
  import { useRef as F, useState as a, useEffect as x, useCallback as D, forwardRef as ve } from "react";
4
- import { _ as Oe, a as s, h as Se, b as g, u as me, S as _e, c as he, s as ge } from "./overrides-0673bab0.js";
5
- import { d as ye } from "./unsupportedIterableToArray-0f93b40f.js";
4
+ import { _ as Oe, a as s, h as Se, b as g, u as me, S as _e, c as he, s as ge } from "./overrides-346bb0f6.js";
5
+ import { d as ye } from "./unsupportedIterableToArray-a3020d44.js";
6
6
  import "react-dom";
7
7
  import "@commercelayer/sdk";
8
8
  import "react-hook-form";
@@ -1,7 +1,7 @@
1
- import { P as Ma, r as E, a as Rn, t as H, b as Mt, c as Ee, d as _, g as Cr, _ as Qt, s as je, e as cr, f as xa, h as ur, i as Ln, j as Sa, k as Oa, l as Ea, m as qr, n as _a, o as Kr, p as Pa, q as Ta, u as Na, v as An, w as ae, x as nt, y as pr, z as Hn, A as Ya, B as lr, C as Zr, D as Ia, E as Ra, F as La, G as At, H as Ke, I as Aa, J as Ha, K as Fa } from "./main-dd440dc6.js";
1
+ import { P as Ma, r as E, a as Rn, t as H, b as Mt, c as Ee, d as _, g as Cr, _ as Qt, s as je, e as cr, f as xa, h as ur, i as Ln, j as Sa, k as Oa, l as Ea, m as qr, n as _a, o as Kr, p as Pa, q as Ta, u as Na, v as An, w as ae, x as nt, y as pr, z as Hn, A as Ya, B as lr, C as Zr, D as Ia, E as Ra, F as La, G as At, H as Ke, I as Aa, J as Ha, K as Fa } from "./main-795be39b.js";
2
2
  import * as B from "react";
3
3
  import h, { forwardRef as Fn, createElement as ja, Component as Ua, createRef as Ba } from "react";
4
- import { _ as Wa, a as I, b as R, c as N, d as D, e as b, f as Y } from "./unsupportedIterableToArray-0f93b40f.js";
4
+ import { _ as Wa, a as I, b as R, c as N, d as D, e as b, f as Y } from "./unsupportedIterableToArray-a3020d44.js";
5
5
  import * as Va from "react-dom";
6
6
  import Qa, { findDOMNode as $a } from "react-dom";
7
7
  import "@commercelayer/sdk";
@@ -5227,7 +5227,7 @@ const Lc = Fn(
5227
5227
  hint: p,
5228
5228
  feedback: f,
5229
5229
  label: s,
5230
- children: /* @__PURE__ */ Ke.jsxs("div", { className: "relative", children: [
5230
+ children: /* @__PURE__ */ Ke.jsxs("div", { className: "relative w-full", children: [
5231
5231
  /* @__PURE__ */ Ke.jsx(
5232
5232
  Ic,
5233
5233
  {
@@ -1,12 +1,12 @@
1
- import { H as n } from "./main-dd440dc6.js";
2
- import { u as s, S as m, c as p, s as i } from "./overrides-0673bab0.js";
1
+ import { H as n } from "./main-795be39b.js";
2
+ import { u as s, S as m, c as p, s as i } from "./overrides-346bb0f6.js";
3
3
  import * as c from "react";
4
4
  import { forwardRef as S } from "react";
5
5
  import "react-dom";
6
6
  import "@commercelayer/sdk";
7
7
  import "react-hook-form";
8
8
  import "query-string";
9
- import "./unsupportedIterableToArray-0f93b40f.js";
9
+ import "./unsupportedIterableToArray-a3020d44.js";
10
10
  var f = /* @__PURE__ */ S(function(e, t) {
11
11
  var o = s(e);
12
12
  return /* @__PURE__ */ c.createElement(m, p({
@@ -68,5 +68,5 @@ interface NavigateToExternalDetailsParams {
68
68
  export declare function navigateToDetail(params: NavigateToInternalDetailsParams | NavigateToExternalDetailsParams): {
69
69
  href: string;
70
70
  onClick: (e: React.MouseEvent<HTMLAnchorElement | HTMLDivElement, MouseEvent>) => void;
71
- };
71
+ } | null;
72
72
  export {};