@faststore/ui 2.0.36-alpha.0 → 2.0.38-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/molecules/AggregateRating/AggregateRating.d.ts +3 -3
  3. package/dist/components/molecules/AggregateRating/AggregateRating.js.map +1 -1
  4. package/dist/components/molecules/OrderSummary/OrderSummary.d.ts +3 -3
  5. package/dist/components/molecules/OrderSummary/OrderSummary.js +1 -1
  6. package/dist/components/molecules/OrderSummary/OrderSummary.js.map +1 -1
  7. package/dist/index.d.ts +0 -2
  8. package/dist/index.js +0 -1
  9. package/dist/index.js.map +1 -1
  10. package/package.json +4 -12
  11. package/src/components/molecules/Accordion/styles.scss +70 -0
  12. package/src/components/molecules/AggregateRating/AggregateRating.tsx +2 -3
  13. package/src/components/molecules/OrderSummary/OrderSummary.tsx +3 -3
  14. package/src/index.ts +0 -13
  15. package/src/styles/components.scss +1 -0
  16. package/dist/components/molecules/Accordion/Accordion.d.ts +0 -26
  17. package/dist/components/molecules/Accordion/Accordion.js +0 -21
  18. package/dist/components/molecules/Accordion/Accordion.js.map +0 -1
  19. package/dist/components/molecules/Accordion/AccordionButton.d.ts +0 -10
  20. package/dist/components/molecules/Accordion/AccordionButton.js +0 -37
  21. package/dist/components/molecules/Accordion/AccordionButton.js.map +0 -1
  22. package/dist/components/molecules/Accordion/AccordionItem.d.ts +0 -31
  23. package/dist/components/molecules/Accordion/AccordionItem.js +0 -22
  24. package/dist/components/molecules/Accordion/AccordionItem.js.map +0 -1
  25. package/dist/components/molecules/Accordion/AccordionPanel.d.ts +0 -10
  26. package/dist/components/molecules/Accordion/AccordionPanel.js +0 -10
  27. package/dist/components/molecules/Accordion/AccordionPanel.js.map +0 -1
  28. package/dist/components/molecules/Accordion/index.d.ts +0 -8
  29. package/dist/components/molecules/Accordion/index.js +0 -5
  30. package/dist/components/molecules/Accordion/index.js.map +0 -1
  31. package/src/components/molecules/Accordion/Accordion.tsx +0 -76
  32. package/src/components/molecules/Accordion/AccordionButton.tsx +0 -81
  33. package/src/components/molecules/Accordion/AccordionItem.tsx +0 -92
  34. package/src/components/molecules/Accordion/AccordionPanel.tsx +0 -40
  35. package/src/components/molecules/Accordion/index.ts +0 -11
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.38-alpha.0](https://github.com/vtex/faststore/compare/v2.0.37-alpha.0...v2.0.38-alpha.0) (2023-01-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * Adds `Accordion` component ([#1567](https://github.com/vtex/faststore/issues/1567)) ([0173e20](https://github.com/vtex/faststore/commit/0173e20b162d53d8faae0791e08110f335c6d6f6))
12
+
13
+
14
+
15
+ ## 2.0.37-alpha.0 (2023-01-06)
16
+
17
+
18
+ ### Chores
19
+
20
+ * remove styles ([#1589](https://github.com/vtex/faststore/issues/1589)) ([7a21b1c](https://github.com/vtex/faststore/commit/7a21b1cfbbd7cee190299365087984c33cc8d4e2))
21
+
22
+
23
+
6
24
  ## [2.0.36-alpha.0](https://github.com/vtex/faststore/compare/v2.0.35-alpha.0...v2.0.36-alpha.0) (2023-01-05)
7
25
 
8
26
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import type { ListProps } from '@faststore/components';
3
- export interface AggregateRatingProps extends ListProps<'ul'> {
2
+ import type { HTMLAttributes } from 'react';
3
+ export interface AggregateRatingProps extends HTMLAttributes<HTMLUListElement> {
4
4
  /**
5
5
  * The current value of the rating, based on the quantity of child elements.
6
6
  */
@@ -14,5 +14,5 @@ export interface RatingItemProps {
14
14
  'data-fs-aggregate-rating-item'?: 'full' | 'partial' | 'empty';
15
15
  'data-testid'?: string;
16
16
  }
17
- declare const AggregateRating: React.ForwardRefExoticComponent<Pick<AggregateRatingProps, "children" | "hidden" | "testId" | "slot" | "style" | "title" | "marker" | "as" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "value"> & React.RefAttributes<HTMLUListElement>>;
17
+ declare const AggregateRating: React.ForwardRefExoticComponent<AggregateRatingProps & React.RefAttributes<HTMLUListElement>>;
18
18
  export default AggregateRating;
@@ -1 +1 @@
1
- {"version":3,"file":"AggregateRating.js","sourceRoot":"","sources":["../../../../src/components/molecules/AggregateRating/AggregateRating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAmB5C,MAAM,UAAU,GAA2C,CAAC,EAC1D,QAAQ,EACR,GAAG,UAAU,EACd,EAAE,EAAE;IACH,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QACnC,OAAO,+BAAQ,UAAU,IAAG,QAAQ,CAAM,CAAA;KAC3C;IAED,OAAO,gCAAK,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAM,CAAA;AAC5D,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,UAAU,CAChC,SAAS,eAAe,CACtB,EAAE,QAAQ,EAAE,MAAM,GAAG,wBAAwB,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,EACrE,GAAG;IAEH,MAAM,SAAS,GAAG,CAAC,SAAiB,EAAE,EAAE;QACtC,IAAI,SAAS,IAAI,CAAC,EAAE;YAClB,OAAO,MAAM,CAAA;SACd;QAED,IAAI,CAAC,GAAG,SAAS,IAAI,SAAS,GAAG,CAAC,EAAE;YAClC,OAAO,SAAS,CAAA;SACjB;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,IAAI,sCAEH,GAAG,EAAE,GAAG,iBACK,MAAM,KACf,UAAU,IAEb,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;QACrD,MAAM,iBAAiB,GAAG,KAAK,CAAA;QAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAA;QAEjD,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,oBAAoB,KAAK,EAAE,mCACD,IAAI,iBACtB,GAAG,MAAM,OAAO,IAE5B,KAAK,CACK,CACd,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,eAAe,CAAA"}
1
+ {"version":3,"file":"AggregateRating.js","sourceRoot":"","sources":["../../../../src/components/molecules/AggregateRating/AggregateRating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAkB5C,MAAM,UAAU,GAA2C,CAAC,EAC1D,QAAQ,EACR,GAAG,UAAU,EACd,EAAE,EAAE;IACH,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QACnC,OAAO,+BAAQ,UAAU,IAAG,QAAQ,CAAM,CAAA;KAC3C;IAED,OAAO,gCAAK,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAM,CAAA;AAC5D,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,UAAU,CAChC,SAAS,eAAe,CACtB,EAAE,QAAQ,EAAE,MAAM,GAAG,wBAAwB,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,EACrE,GAAG;IAEH,MAAM,SAAS,GAAG,CAAC,SAAiB,EAAE,EAAE;QACtC,IAAI,SAAS,IAAI,CAAC,EAAE;YAClB,OAAO,MAAM,CAAA;SACd;QAED,IAAI,CAAC,GAAG,SAAS,IAAI,SAAS,GAAG,CAAC,EAAE;YAClC,OAAO,SAAS,CAAA;SACjB;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,IAAI,sCAEH,GAAG,EAAE,GAAG,iBACK,MAAM,KACf,UAAU,IAEb,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;QACrD,MAAM,iBAAiB,GAAG,KAAK,CAAA;QAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAA;QAEjD,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,oBAAoB,KAAK,EAAE,mCACD,IAAI,iBACtB,GAAG,MAAM,OAAO,IAE5B,KAAK,CACK,CACd,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import type { ListProps } from '@faststore/components';
3
- export interface OrderSummaryProps extends ListProps<'ul'> {
2
+ import type { HTMLAttributes } from 'react';
3
+ export interface OrderSummaryProps extends HTMLAttributes<HTMLUListElement> {
4
4
  /**
5
5
  * ID to find this component in testing tools (e.g.: cypress,
6
6
  * testing-library, and jest).
@@ -31,5 +31,5 @@ export interface OrderSummaryProps extends ListProps<'ul'> {
31
31
  */
32
32
  totalValue?: string;
33
33
  }
34
- declare const OrderSummary: React.ForwardRefExoticComponent<Pick<OrderSummaryProps, "children" | "hidden" | "testId" | "slot" | "style" | "title" | "marker" | "as" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "subtotalLabel" | "subtotalValue" | "discountLabel" | "discountValue" | "totalLabel" | "totalValue"> & React.RefAttributes<HTMLUListElement>>;
34
+ declare const OrderSummary: React.ForwardRefExoticComponent<OrderSummaryProps & React.RefAttributes<HTMLUListElement>>;
35
35
  export default OrderSummary;
@@ -1,6 +1,6 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { List } from '@faststore/components';
3
- const OrderSummary = forwardRef(function OrderSummary({ testId = 'store-order-summary', children, subtotalLabel, subtotalValue, discountLabel, discountValue, totalLabel, totalValue, ...otherProps }, ref) {
3
+ const OrderSummary = forwardRef(function OrderSummary({ testId = 'store-order-summary', subtotalLabel, subtotalValue, discountLabel, discountValue, totalLabel, totalValue, ...otherProps }, ref) {
4
4
  return (React.createElement(List, { ref: ref, "data-fs-order-summary": true, "data-testid": testId, ...otherProps },
5
5
  subtotalValue ? (React.createElement("li", { "data-fs-order-summary-subtotal": true },
6
6
  React.createElement("span", { "data-fs-order-summary-subtotal-label": true, "data-testid": `${testId}-subtotal-label` }, subtotalLabel),
@@ -1 +1 @@
1
- {"version":3,"file":"OrderSummary.js","sourceRoot":"","sources":["../../../../src/components/molecules/OrderSummary/OrderSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAmC5C,MAAM,YAAY,GAAG,UAAU,CAC7B,SAAS,YAAY,CACnB,EACE,MAAM,GAAG,qBAAqB,EAC9B,QAAQ,EACR,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,oBAAC,IAAI,IACH,GAAG,EAAE,GAAG,gDAEK,MAAM,KACf,UAAU;QAEb,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACP,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACR;YACE,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN;YACP,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN,CACJ,CACA,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"OrderSummary.js","sourceRoot":"","sources":["../../../../src/components/molecules/OrderSummary/OrderSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAkC5C,MAAM,YAAY,GAAG,UAAU,CAC7B,SAAS,YAAY,CACnB,EACE,MAAM,GAAG,qBAAqB,EAC9B,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,oBAAC,IAAI,IACH,GAAG,EAAE,GAAG,gDAEK,MAAM,KACf,UAAU;QAEb,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACP,aAAa,CAAC,CAAC,CAAC,CACf;YACE,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT;YACP,2FAEe,GAAG,MAAM,iBAAiB,IAEtC,aAAa,CACT,CACJ,CACN,CAAC,CAAC,CAAC,IAAI;QACR;YACE,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN;YACP,wFAEe,GAAG,MAAM,cAAc,IAEnC,UAAU,CACN,CACJ,CACA,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,YAAY,CAAA"}
package/dist/index.d.ts CHANGED
@@ -47,8 +47,6 @@ export { default as PriceRange } from './components/molecules/PriceRange';
47
47
  export type { PriceRangeProps } from './components/molecules/PriceRange';
48
48
  export { default as RadioGroup, RadioOption, } from './components/molecules/RadioGroup';
49
49
  export type { RadioGroupProps, RadioOptionProps, } from './components/molecules/RadioGroup';
50
- export { default as Accordion, AccordionItem, AccordionButton, AccordionPanel, } from './components/molecules/Accordion';
51
- export type { AccordionProps, AccordionItemProps, AccordionButtonProps, AccordionPanelProps, } from './components/molecules/Accordion';
52
50
  export { default as Form } from './components/molecules/Form';
53
51
  export type { FormProps } from './components/molecules/Form';
54
52
  export { default as Alert } from './components/molecules/Alert';
package/dist/index.js CHANGED
@@ -25,7 +25,6 @@ export { default as Breadcrumb } from './components/molecules/Breadcrumb';
25
25
  export { default as LoadingButton } from './components/molecules/LoadingButton';
26
26
  export { default as PriceRange } from './components/molecules/PriceRange';
27
27
  export { default as RadioGroup, RadioOption, } from './components/molecules/RadioGroup';
28
- export { default as Accordion, AccordionItem, AccordionButton, AccordionPanel, } from './components/molecules/Accordion';
29
28
  export { default as Form } from './components/molecules/Form';
30
29
  export { default as Alert } from './components/molecules/Alert';
31
30
  export { default as QuantitySelector } from './components/molecules/QuantitySelector';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AAErC,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAG7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAGnE,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAG3E,OAAO,EACL,OAAO,IAAI,IAAI,EACf,WAAW,EACX,SAAS,GACV,MAAM,6BAA6B,CAAA;AAOpC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAG7E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAG7E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAGnF,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,oCAAoC,CAAA;AAQ3C,OAAO,EACL,OAAO,IAAI,IAAI,EACf,SAAS,EACT,WAAW,EACX,WAAW,GACZ,MAAM,6BAA6B,CAAA;AAQpC,OAAO,EACL,OAAO,IAAI,QAA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B,CAAA;AAG1D,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/ui",
3
- "version": "2.0.36-alpha.0",
3
+ "version": "2.0.38-alpha.0",
4
4
  "description": "A lightweight, framework agnostic component library for React",
5
5
  "author": "emersonlaurentino",
6
6
  "license": "MIT",
@@ -46,26 +46,18 @@
46
46
  "react-dom": "^18.2.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/core": "^7.19.6",
50
- "@faststore/eslint-config": "^2.0.34-alpha.0",
51
- "@faststore/shared": "^2.0.34-alpha.0",
52
- "@faststore/styles": "^2.0.34-alpha.0",
49
+ "@faststore/eslint-config": "^2.0.37-alpha.0",
50
+ "@faststore/shared": "^2.0.37-alpha.0",
53
51
  "@size-limit/preset-small-lib": "^7.0.8",
54
52
  "@types/tabbable": "^3.1.1",
55
53
  "babel-loader": "^8.2.5",
56
- "css-loader": "^6.7.1",
57
54
  "eslint": "7.32.0",
58
- "react": "^18.2.0",
59
- "react-dom": "^18.2.0",
60
- "sass": "^1.55.0",
61
- "sass-loader": "^13.1.0",
62
55
  "size-limit": "^7.0.8",
63
- "style-loader": "^3.3.1",
64
56
  "typescript": "^4.2.4"
65
57
  },
66
58
  "volta": {
67
59
  "node": "16.18.0",
68
60
  "yarn": "1.19.1"
69
61
  },
70
- "gitHead": "7d74c91fa7e2e91c8d9a70b37ec0d7f9381f1503"
62
+ "gitHead": "ff1e76f11da2b7183fdef1a81917cae479a162a4"
71
63
  }
@@ -0,0 +1,70 @@
1
+ [data-fs-accordion] {
2
+ // --------------------------------------------------------
3
+ // Design Tokens for Accordion
4
+ // --------------------------------------------------------
5
+
6
+ // Item
7
+ --fs-accordion-item-border-bottom-width : var(--fs-border-width);
8
+ --fs-accordion-item-border-bottom-color : var(--fs-border-color-light);
9
+
10
+ // Button
11
+ --fs-accordion-button-padding : var(--fs-spacing-3) 0;
12
+ --fs-accordion-button-font-size : var(--fs-text-size-3);
13
+ --fs-accordion-button-font-weight : var(--fs-text-weight-bold);
14
+ --fs-accordion-button-line-height : 1.2;
15
+ --fs-accordion-button-color : var(--fs-color-text);
16
+ --fs-accordion-button-bkg-color : transparent;
17
+
18
+ // Panel
19
+ --fs-accordion-panel-padding-bottom : var(--fs-spacing-4);
20
+
21
+ // --------------------------------------------------------
22
+ // Structural Styles
23
+ // --------------------------------------------------------
24
+
25
+ display: flex;
26
+ flex-direction: column;
27
+ justify-content: space-around;
28
+ width: 100%;
29
+
30
+ [data-fs-accordion-item] {
31
+ border-bottom: var(--fs-accordion-item-border-bottom-width) solid var(--fs-accordion-item-border-bottom-color);
32
+
33
+ @include media(">=notebook") {
34
+ &:last-child {
35
+ border-bottom: 0;
36
+ }
37
+ }
38
+ }
39
+
40
+ [data-fs-accordion-button] {
41
+ display: inline-flex;
42
+ align-items: center;
43
+ justify-content: space-between;
44
+ width: 100%;
45
+ padding: var(--fs-accordion-button-padding);
46
+ font-size: var(--fs-accordion-button-font-size);
47
+ font-weight: var(--fs-accordion-button-font-weight);
48
+ line-height: var(--fs-accordion-button-line-height);
49
+ color: var(--fs-accordion-button-color);
50
+ cursor: pointer;
51
+ background-color: var(--fs-accordion-button-bkg-color);
52
+ border: 0;
53
+
54
+ [data-fs-icon] {
55
+ display: flex;
56
+
57
+ [data-icon] {
58
+ display: none;
59
+ }
60
+
61
+ [data-icon="expanded"], [data-icon="collapsed"] {
62
+ display: initial;
63
+ }
64
+ }
65
+ }
66
+
67
+ [data-fs-accordion-panel] {
68
+ padding-bottom: var(--fs-accordion-panel-padding-bottom);
69
+ }
70
+ }
@@ -1,10 +1,9 @@
1
1
  import React, { forwardRef } from 'react'
2
- import type { FC, PropsWithChildren } from 'react'
2
+ import type { FC, PropsWithChildren, HTMLAttributes } from 'react'
3
3
 
4
4
  import { List } from '@faststore/components'
5
- import type { ListProps } from '@faststore/components'
6
5
 
7
- export interface AggregateRatingProps extends ListProps<'ul'> {
6
+ export interface AggregateRatingProps extends HTMLAttributes<HTMLUListElement> {
8
7
  /**
9
8
  * The current value of the rating, based on the quantity of child elements.
10
9
  */
@@ -1,8 +1,9 @@
1
1
  import React, { forwardRef } from 'react'
2
+ import type { HTMLAttributes } from 'react'
3
+
2
4
  import { List } from '@faststore/components'
3
- import type { ListProps } from '@faststore/components'
4
5
 
5
- export interface OrderSummaryProps extends ListProps<'ul'> {
6
+ export interface OrderSummaryProps extends HTMLAttributes<HTMLUListElement> {
6
7
  /**
7
8
  * ID to find this component in testing tools (e.g.: cypress,
8
9
  * testing-library, and jest).
@@ -38,7 +39,6 @@ const OrderSummary = forwardRef<HTMLUListElement, OrderSummaryProps>(
38
39
  function OrderSummary(
39
40
  {
40
41
  testId = 'store-order-summary',
41
- children,
42
42
  subtotalLabel,
43
43
  subtotalValue,
44
44
  discountLabel,
package/src/index.ts CHANGED
@@ -137,19 +137,6 @@ export type {
137
137
  RadioOptionProps,
138
138
  } from './components/molecules/RadioGroup'
139
139
 
140
- export {
141
- default as Accordion,
142
- AccordionItem,
143
- AccordionButton,
144
- AccordionPanel,
145
- } from './components/molecules/Accordion'
146
- export type {
147
- AccordionProps,
148
- AccordionItemProps,
149
- AccordionButtonProps,
150
- AccordionPanelProps,
151
- } from './components/molecules/Accordion'
152
-
153
140
  export { default as Form } from './components/molecules/Form'
154
141
  export type { FormProps } from './components/molecules/Form'
155
142
 
@@ -13,6 +13,7 @@
13
13
  @import "../components/atoms/SROnly/styles";
14
14
 
15
15
  // Molecules
16
+ @import "../components/molecules/Accordion/styles";
16
17
  @import "../components/molecules/BuyButton/styles";
17
18
  @import "../components/molecules/CheckboxField/styles";
18
19
  @import "../components/molecules/DiscountBadge/styles";
@@ -1,26 +0,0 @@
1
- import type { HTMLAttributes } from 'react';
2
- import React from 'react';
3
- interface AccordionContext {
4
- indices: Set<number>;
5
- onChange: (index: number) => void;
6
- numberOfItems: number;
7
- }
8
- declare const AccordionContext: React.Context<AccordionContext | undefined>;
9
- export interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
10
- /**
11
- * ID to find this component in testing tools (e.g.: cypress,
12
- * testing-library, and jest).
13
- */
14
- testId?: string;
15
- /**
16
- * Indices that indicate which accordion items are opened.
17
- */
18
- indices: Iterable<number>;
19
- /**
20
- * Function that is triggered when an accordion item is opened/closed.
21
- */
22
- onChange: (index: number) => void;
23
- }
24
- declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
25
- export declare function useAccordion(): AccordionContext;
26
- export default Accordion;
@@ -1,21 +0,0 @@
1
- import React, { useContext, cloneElement, forwardRef, createContext, } from 'react';
2
- const AccordionContext = createContext(undefined);
3
- const Accordion = forwardRef(function Accordion({ testId = 'store-accordion', indices, onChange, children, ...otherProps }, ref) {
4
- const childrenWithIndex = React.Children.map(children, (child, index) => cloneElement(child, { index: child.props.index ?? index }));
5
- const context = {
6
- indices: new Set(indices),
7
- onChange,
8
- numberOfItems: childrenWithIndex.length,
9
- };
10
- return (React.createElement(AccordionContext.Provider, { value: context },
11
- React.createElement("div", { ref: ref, "data-fs-accordion": true, "data-testid": testId, role: "region", ...otherProps }, childrenWithIndex)));
12
- });
13
- export function useAccordion() {
14
- const context = useContext(AccordionContext);
15
- if (context === undefined) {
16
- throw new Error('Do not use Accordion components outside the Accordion context.');
17
- }
18
- return context;
19
- }
20
- export default Accordion;
21
- //# sourceMappingURL=Accordion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../../src/components/molecules/Accordion/Accordion.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,OAAO,CAAA;AAQd,MAAM,gBAAgB,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAA;AAmB/E,MAAM,SAAS,GAAG,UAAU,CAAiC,SAAS,SAAS,CAC7E,EAAE,MAAM,GAAG,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAC1E,GAAG;IAEH,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAC1C,QAAwB,EACxB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAC7E,CAAA;IAED,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC;QACzB,QAAQ;QACR,aAAa,EAAE,iBAAiB,CAAC,MAAM;KACxC,CAAA;IAED,OAAO,CACL,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO;QACvC,6BACE,GAAG,EAAE,GAAG,4CAEK,MAAM,EACnB,IAAI,EAAC,QAAQ,KACT,UAAU,IAEb,iBAAiB,CACd,CACoB,CAC7B,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAE5C,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,eAAe,SAAS,CAAA"}
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { ButtonProps } from '@faststore/components';
3
- export interface AccordionButtonProps extends ButtonProps {
4
- /**
5
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
- */
7
- testId?: string;
8
- }
9
- declare const AccordionButton: React.ForwardRefExoticComponent<AccordionButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
- export default AccordionButton;
@@ -1,37 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import { useAccordion } from './Accordion';
3
- import { useAccordionItem } from './AccordionItem';
4
- import { Button } from '@faststore/components';
5
- const AccordionButton = forwardRef(function AccordionButton({ testId = 'store-accordion-button', children, ...otherProps }, ref) {
6
- const { indices, onChange, numberOfItems } = useAccordion();
7
- const { index, panel, button, prefixId } = useAccordionItem();
8
- const onKeyDown = (event) => {
9
- if (!['ArrowDown', 'ArrowUp'].includes(event.key)) {
10
- return;
11
- }
12
- const getNext = () => {
13
- const next = Number(index) + 1 === numberOfItems ? 0 : Number(index) + 1;
14
- return document.getElementById(`${prefixId && `${prefixId}-`}button--${next}`);
15
- };
16
- const getPrevious = () => {
17
- const previous = Number(index) - 1 < 0 ? numberOfItems - 1 : Number(index) - 1;
18
- return document.getElementById(`${prefixId && `${prefixId}-`}button--${previous}`);
19
- };
20
- switch (event.key) {
21
- case 'ArrowDown':
22
- event.preventDefault();
23
- getNext()?.focus();
24
- break;
25
- case 'ArrowUp':
26
- event.preventDefault();
27
- getPrevious()?.focus();
28
- break;
29
- default:
30
- }
31
- };
32
- return (React.createElement(Button, { ref: ref, id: button, "aria-expanded": indices.has(index), "aria-controls": panel, "data-accordion-button": true, "data-testid": testId, onKeyDown: onKeyDown, onClick: () => {
33
- onChange(index);
34
- }, ...otherProps }, children));
35
- });
36
- export default AccordionButton;
37
- //# sourceMappingURL=AccordionButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccordionButton.js","sourceRoot":"","sources":["../../../../src/components/molecules/Accordion/AccordionButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAU9C,MAAM,eAAe,GAAG,UAAU,CAChC,SAAS,eAAe,CACtB,EAAE,MAAM,GAAG,wBAAwB,EAAE,QAAQ,EAAE,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W,EAAE,EAAE,KAAK,EAAE,CAAA;gBACtB,MAAK;YAEP,QAAQ;SACT;IACH,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,MAAM,IACL,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,MAAM,mBACK,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,mBAClB,KAAK,gDAEP,MAAM,EACnB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;YACZ,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjB,CAAC,KACG,UAAU,IAEb,QAAQ,CACF,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -1,31 +0,0 @@
1
- import type { ElementType, HTMLAttributes, ReactElement } from 'react';
2
- import React from 'react';
3
- import type { PolymorphicComponentPropsWithRef } from '../../../typings';
4
- interface AccordionItemContext {
5
- index: number;
6
- panel: string;
7
- button: string;
8
- prefixId: string;
9
- }
10
- declare const AccordionItemContext: React.Context<AccordionItemContext | undefined>;
11
- interface Props extends HTMLAttributes<HTMLDivElement> {
12
- /**
13
- * ID to find this component in testing tools (e.g.: cypress,
14
- * testing-library, and jest).
15
- */
16
- testId?: string;
17
- /**
18
- * Index of the current accordion item within the accordion.
19
- */
20
- index?: number;
21
- /**
22
- * Namespace ID prefix for the current Accordion item's panel and button
23
- * to avoid ID duplication when multiple instances are on the same page.
24
- */
25
- prefixId?: string;
26
- }
27
- export type AccordionItemProps<C extends ElementType> = PolymorphicComponentPropsWithRef<C, Props>;
28
- type AccordionItemComponent = <C extends ElementType = 'div'>(props: AccordionItemProps<C>) => ReactElement | null;
29
- declare const AccordionItem: AccordionItemComponent;
30
- export declare function useAccordionItem(): AccordionItemContext;
31
- export default AccordionItem;
@@ -1,22 +0,0 @@
1
- import React, { createContext, forwardRef, useContext } from 'react';
2
- const AccordionItemContext = createContext(undefined);
3
- const AccordionItem = forwardRef(function AccordionItem({ testId = 'store-accordion-item', children, prefixId = '', index = 0, as: MaybeComponent, ...otherProps }, ref) {
4
- const Component = MaybeComponent ?? 'div';
5
- const context = {
6
- index,
7
- prefixId,
8
- panel: `${prefixId && `${prefixId}-`}panel--${index}`,
9
- button: `${prefixId && `${prefixId}-`}button--${index}`,
10
- };
11
- return (React.createElement(AccordionItemContext.Provider, { value: context },
12
- React.createElement(Component, { ref: ref, "data-accordion-item": true, "data-testid": testId, ...otherProps }, children)));
13
- });
14
- export function useAccordionItem() {
15
- const context = useContext(AccordionItemContext);
16
- if (context === undefined) {
17
- throw new Error('Do not use AccordionItem components outside the AccordionItem context.');
18
- }
19
- return context;
20
- }
21
- export default AccordionItem;
22
- //# sourceMappingURL=AccordionItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccordionItem.js","sourceRoot":"","sources":["../../../../src/components/molecules/Accordion/AccordionItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAapE,MAAM,oBAAoB,GAAG,aAAa,CACxC,SAAS,CACV,CAAA;AA2BD,MAAM,aAAa,GAA2B,UAAU,CAAC,SAAS,aAAa,CAG7E,EACE,MAAM,GAAG,sBAAsB,EAC/B,QAAQ,EACR,QAAQ,GAAG,EAAE,EACb,KAAK,GAAG,CAAC,EACT,EAAE,EAAE,cAAc,EAClB,GAAG,UAAU,EACS,EACxB,GAAsB;IAEtB,MAAM,SAAS,GAAG,cAAc,IAAI,KAAK,CAAA;IAEzC,MAAM,OAAO,GAAG;QACd,KAAK;QACL,QAAQ;QACR,KAAK,EAAE,GAAG,QAAQ,IAAI,GAAG,QAAQ,GAAG,UAAU,KAAK,EAAE;QACrD,MAAM,EAAE,GAAG,QAAQ,IAAI,GAAG,QAAQ,GAAG,WAAW,KAAK,EAAE;KACxD,CAAA;IAED,OAAO,CACL,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO;QAC3C,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,8CAEK,MAAM,KACf,UAAU,IAEb,QAAQ,CACC,CACkB,CACjC,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,gBAAgB;IAC9B,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAA;IAEhD,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAA;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,eAAe,aAAa,CAAA"}
@@ -1,10 +0,0 @@
1
- import type { HTMLAttributes } from 'react';
2
- import React from 'react';
3
- export interface AccordionPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
4
- /**
5
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
- */
7
- testId?: string;
8
- }
9
- declare const AccordionPanel: React.ForwardRefExoticComponent<AccordionPanelProps & React.RefAttributes<HTMLDivElement>>;
10
- export default AccordionPanel;
@@ -1,10 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import { useAccordion } from './Accordion';
3
- import { useAccordionItem } from './AccordionItem';
4
- const AccordionPanel = forwardRef(function AccordionPanel({ testId = 'store-accordion-panel', children, ...otherProps }, ref) {
5
- const { indices } = useAccordion();
6
- const { index, button, panel } = useAccordionItem();
7
- return (React.createElement("div", { ref: ref, id: panel, "aria-labelledby": button, role: "region", "data-accordion-panel": true, "data-testid": testId, hidden: !indices.has(index), ...otherProps }, children));
8
- });
9
- export default AccordionPanel;
10
- //# sourceMappingURL=AccordionPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccordionPanel.js","sourceRoot":"","sources":["../../../../src/components/molecules/Accordion/AccordionPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAUlD,MAAM,cAAc,GAAG,UAAU,CAC/B,SAAS,cAAc,CACrB,EAAE,MAAM,GAAG,uBAAuB,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAC7D,GAAG;IAEH,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,CAAA;IAClC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAEnD,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,KAAK,qBACQ,MAAM,EACvB,IAAI,EAAC,QAAQ,+CAEA,MAAM,EACnB,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KACvB,UAAU,IAEb,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -1,8 +0,0 @@
1
- export { default } from './Accordion';
2
- export type { AccordionProps } from './Accordion';
3
- export { default as AccordionItem } from './AccordionItem';
4
- export type { AccordionItemProps } from './AccordionItem';
5
- export { default as AccordionButton } from './AccordionButton';
6
- export type { AccordionButtonProps } from './AccordionButton';
7
- export { default as AccordionPanel } from './AccordionPanel';
8
- export type { AccordionPanelProps } from './AccordionPanel';
@@ -1,5 +0,0 @@
1
- export { default } from './Accordion';
2
- export { default as AccordionItem } from './AccordionItem';
3
- export { default as AccordionButton } from './AccordionButton';
4
- export { default as AccordionPanel } from './AccordionPanel';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/Accordion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGrC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAG9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,76 +0,0 @@
1
- import type { HTMLAttributes, ReactElement } from 'react'
2
- import React, {
3
- useContext,
4
- cloneElement,
5
- forwardRef,
6
- createContext,
7
- } from 'react'
8
-
9
- interface AccordionContext {
10
- indices: Set<number>
11
- onChange: (index: number) => void
12
- numberOfItems: number
13
- }
14
-
15
- const AccordionContext = createContext<AccordionContext | undefined>(undefined)
16
-
17
- export interface AccordionProps
18
- extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
19
- /**
20
- * ID to find this component in testing tools (e.g.: cypress,
21
- * testing-library, and jest).
22
- */
23
- testId?: string
24
- /**
25
- * Indices that indicate which accordion items are opened.
26
- */
27
- indices: Iterable<number>
28
- /**
29
- * Function that is triggered when an accordion item is opened/closed.
30
- */
31
- onChange: (index: number) => void
32
- }
33
-
34
- const Accordion = forwardRef<HTMLDivElement, AccordionProps>(function Accordion(
35
- { testId = 'store-accordion', indices, onChange, children, ...otherProps },
36
- ref
37
- ) {
38
- const childrenWithIndex = React.Children.map(
39
- children as ReactElement,
40
- (child, index) => cloneElement(child, { index: child.props.index ?? index })
41
- )
42
-
43
- const context = {
44
- indices: new Set(indices),
45
- onChange,
46
- numberOfItems: childrenWithIndex.length,
47
- }
48
-
49
- return (
50
- <AccordionContext.Provider value={context}>
51
- <div
52
- ref={ref}
53
- data-fs-accordion
54
- data-testid={testId}
55
- role="region"
56
- {...otherProps}
57
- >
58
- {childrenWithIndex}
59
- </div>
60
- </AccordionContext.Provider>
61
- )
62
- })
63
-
64
- export function useAccordion() {
65
- const context = useContext(AccordionContext)
66
-
67
- if (context === undefined) {
68
- throw new Error(
69
- 'Do not use Accordion components outside the Accordion context.'
70
- )
71
- }
72
-
73
- return context
74
- }
75
-
76
- export default Accordion
@@ -1,81 +0,0 @@
1
- import React, { forwardRef } from 'react'
2
-
3
- import { useAccordion } from './Accordion'
4
- import { useAccordionItem } from './AccordionItem'
5
-
6
- import { Button } from '@faststore/components'
7
- import type { ButtonProps } from '@faststore/components'
8
-
9
- export interface AccordionButtonProps extends ButtonProps {
10
- /**
11
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
12
- */
13
- testId?: string
14
- }
15
-
16
- const AccordionButton = forwardRef<HTMLButtonElement, AccordionButtonProps>(
17
- function AccordionButton(
18
- { testId = 'store-accordion-button', children, ...otherProps },
19
- ref
20
- ) {
21
- const { indices, onChange, numberOfItems } = useAccordion()
22
- const { index, panel, button, prefixId } = useAccordionItem()
23
-
24
- const onKeyDown = (event: React.KeyboardEvent) => {
25
- if (!['ArrowDown', 'ArrowUp'].includes(event.key)) {
26
- return
27
- }
28
-
29
- const getNext = () => {
30
- const next = Number(index) + 1 === numberOfItems ? 0 : Number(index) + 1
31
-
32
- return document.getElementById(
33
- `${prefixId && `${prefixId}-`}button--${next}`
34
- )
35
- }
36
-
37
- const getPrevious = () => {
38
- const previous =
39
- Number(index) - 1 < 0 ? numberOfItems - 1 : Number(index) - 1
40
-
41
- return document.getElementById(
42
- `${prefixId && `${prefixId}-`}button--${previous}`
43
- )
44
- }
45
-
46
- switch (event.key) {
47
- case 'ArrowDown':
48
- event.preventDefault()
49
- getNext()?.focus()
50
- break
51
-
52
- case 'ArrowUp':
53
- event.preventDefault()
54
- getPrevious()?.focus()
55
- break
56
-
57
- default:
58
- }
59
- }
60
-
61
- return (
62
- <Button
63
- ref={ref}
64
- id={button}
65
- aria-expanded={indices.has(index)}
66
- aria-controls={panel}
67
- data-accordion-button
68
- data-testid={testId}
69
- onKeyDown={onKeyDown}
70
- onClick={() => {
71
- onChange(index)
72
- }}
73
- {...otherProps}
74
- >
75
- {children}
76
- </Button>
77
- )
78
- }
79
- )
80
-
81
- export default AccordionButton
@@ -1,92 +0,0 @@
1
- import type { ElementType, HTMLAttributes, ReactElement } from 'react'
2
- import React, { createContext, forwardRef, useContext } from 'react'
3
- import type {
4
- PolymorphicComponentPropsWithRef,
5
- PolymorphicRef,
6
- } from '../../../typings'
7
-
8
- interface AccordionItemContext {
9
- index: number
10
- panel: string
11
- button: string
12
- prefixId: string
13
- }
14
-
15
- const AccordionItemContext = createContext<AccordionItemContext | undefined>(
16
- undefined
17
- )
18
-
19
- interface Props extends HTMLAttributes<HTMLDivElement> {
20
- /**
21
- * ID to find this component in testing tools (e.g.: cypress,
22
- * testing-library, and jest).
23
- */
24
- testId?: string
25
- /**
26
- * Index of the current accordion item within the accordion.
27
- */
28
- index?: number
29
- /**
30
- * Namespace ID prefix for the current Accordion item's panel and button
31
- * to avoid ID duplication when multiple instances are on the same page.
32
- */
33
- prefixId?: string
34
- }
35
-
36
- export type AccordionItemProps<
37
- C extends ElementType
38
- > = PolymorphicComponentPropsWithRef<C, Props>
39
-
40
- type AccordionItemComponent = <C extends ElementType = 'div'>(
41
- props: AccordionItemProps<C>
42
- ) => ReactElement | null
43
-
44
- const AccordionItem: AccordionItemComponent = forwardRef(function AccordionItem<
45
- C extends ElementType = 'div'
46
- >(
47
- {
48
- testId = 'store-accordion-item',
49
- children,
50
- prefixId = '',
51
- index = 0,
52
- as: MaybeComponent,
53
- ...otherProps
54
- }: AccordionItemProps<C>,
55
- ref: PolymorphicRef<C>
56
- ) {
57
- const Component = MaybeComponent ?? 'div'
58
-
59
- const context = {
60
- index,
61
- prefixId,
62
- panel: `${prefixId && `${prefixId}-`}panel--${index}`,
63
- button: `${prefixId && `${prefixId}-`}button--${index}`,
64
- }
65
-
66
- return (
67
- <AccordionItemContext.Provider value={context}>
68
- <Component
69
- ref={ref}
70
- data-accordion-item
71
- data-testid={testId}
72
- {...otherProps}
73
- >
74
- {children}
75
- </Component>
76
- </AccordionItemContext.Provider>
77
- )
78
- })
79
-
80
- export function useAccordionItem() {
81
- const context = useContext(AccordionItemContext)
82
-
83
- if (context === undefined) {
84
- throw new Error(
85
- 'Do not use AccordionItem components outside the AccordionItem context.'
86
- )
87
- }
88
-
89
- return context
90
- }
91
-
92
- export default AccordionItem
@@ -1,40 +0,0 @@
1
- import type { HTMLAttributes } from 'react'
2
- import React, { forwardRef } from 'react'
3
-
4
- import { useAccordion } from './Accordion'
5
- import { useAccordionItem } from './AccordionItem'
6
-
7
- export interface AccordionPanelProps
8
- extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
9
- /**
10
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
11
- */
12
- testId?: string
13
- }
14
-
15
- const AccordionPanel = forwardRef<HTMLDivElement, AccordionPanelProps>(
16
- function AccordionPanel(
17
- { testId = 'store-accordion-panel', children, ...otherProps },
18
- ref
19
- ) {
20
- const { indices } = useAccordion()
21
- const { index, button, panel } = useAccordionItem()
22
-
23
- return (
24
- <div
25
- ref={ref}
26
- id={panel}
27
- aria-labelledby={button}
28
- role="region"
29
- data-accordion-panel
30
- data-testid={testId}
31
- hidden={!indices.has(index)}
32
- {...otherProps}
33
- >
34
- {children}
35
- </div>
36
- )
37
- }
38
- )
39
-
40
- export default AccordionPanel
@@ -1,11 +0,0 @@
1
- export { default } from './Accordion'
2
- export type { AccordionProps } from './Accordion'
3
-
4
- export { default as AccordionItem } from './AccordionItem'
5
- export type { AccordionItemProps } from './AccordionItem'
6
-
7
- export { default as AccordionButton } from './AccordionButton'
8
- export type { AccordionButtonProps } from './AccordionButton'
9
-
10
- export { default as AccordionPanel } from './AccordionPanel'
11
- export type { AccordionPanelProps } from './AccordionPanel'