@digigov/ui 0.32.1 → 0.32.2

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Change Log - @digigov/ui
2
2
 
3
- This log was last generated on Thu, 11 May 2023 10:48:56 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 16 May 2023 13:42:28 GMT and should not be manually modified.
4
+
5
+ ## 0.32.2
6
+ Tue, 16 May 2023 13:42:28 GMT
7
+
8
+ ### Patches
9
+
10
+ - fix functionality for AccessibilityMenuOptionButton and AccordionSectionSummaryHeading components
4
11
 
5
12
  ## 0.32.1
6
13
  Thu, 11 May 2023 10:48:56 GMT
@@ -1,3 +1,9 @@
1
+ import { AccessibilityMenuOptionButtonProps as AccessibilityMenuOptionButtonBaseProps } from '@digigov/react-extensions/admin/AccessibilityMenuOptionButton';
2
+ export interface AccessibilityMenuOptionButtonProps extends AccessibilityMenuOptionButtonBaseProps {
3
+ steps?: 0 | 1 | 2 | 3 | 4;
4
+ }
5
+ import React from 'react';
6
+ export declare const AccessibilityMenuOptionButton: React.ForwardRefExoticComponent<Pick<AccessibilityMenuOptionButtonProps, "form" | "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "name" | "type" | "role" | "tabIndex" | "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" | "children" | "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" | "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" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "selected" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "xsUpHidden" | "smUpHidden" | "mdUpHidden" | "lgUpHidden" | "xlUpHidden" | "xsHidden" | "smHidden" | "mdHidden" | "lgHidden" | "xlHidden" | "steps"> & React.RefAttributes<HTMLButtonElement>>;
1
7
  export * from '@digigov/react-extensions/admin/AccessibilityMenu';
2
8
  export * from '@digigov/react-extensions/admin/AccessibilityMenuButton';
3
9
  export * from '@digigov/react-extensions/admin/AccessibilityMenuContent';
@@ -1,12 +1,48 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  var _typeof = require("@babel/runtime/helpers/typeof");
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
- var _exportNames = {};
9
- exports["default"] = void 0;
10
+ var _exportNames = {
11
+ AccessibilityMenuOptionButton: true
12
+ };
13
+ exports["default"] = exports.AccessibilityMenuOptionButton = void 0;
14
+
15
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
+
17
+ var _AccessibilityMenuOptionButton = _interopRequireWildcard(require("@digigov/react-extensions/admin/AccessibilityMenuOptionButton"));
18
+
19
+ Object.keys(_AccessibilityMenuOptionButton).forEach(function (key) {
20
+ if (key === "default" || key === "__esModule") return;
21
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
22
+ if (key in exports && exports[key] === _AccessibilityMenuOptionButton[key]) return;
23
+ Object.defineProperty(exports, key, {
24
+ enumerable: true,
25
+ get: function get() {
26
+ return _AccessibilityMenuOptionButton[key];
27
+ }
28
+ });
29
+ });
30
+
31
+ var _AccessibilityMenuSteps = _interopRequireWildcard(require("@digigov/react-extensions/admin/AccessibilityMenuSteps"));
32
+
33
+ Object.keys(_AccessibilityMenuSteps).forEach(function (key) {
34
+ if (key === "default" || key === "__esModule") return;
35
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
36
+ if (key in exports && exports[key] === _AccessibilityMenuSteps[key]) return;
37
+ Object.defineProperty(exports, key, {
38
+ enumerable: true,
39
+ get: function get() {
40
+ return _AccessibilityMenuSteps[key];
41
+ }
42
+ });
43
+ });
44
+
45
+ var _react = _interopRequireWildcard(require("react"));
10
46
 
11
47
  var _AccessibilityMenu = _interopRequireWildcard(require("@digigov/react-extensions/admin/AccessibilityMenu"));
12
48
 
@@ -106,34 +142,6 @@ Object.keys(_AccessibilityMenuListItem).forEach(function (key) {
106
142
  });
107
143
  });
108
144
 
109
- var _AccessibilityMenuOptionButton = require("@digigov/react-extensions/admin/AccessibilityMenuOptionButton");
110
-
111
- Object.keys(_AccessibilityMenuOptionButton).forEach(function (key) {
112
- if (key === "default" || key === "__esModule") return;
113
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
114
- if (key in exports && exports[key] === _AccessibilityMenuOptionButton[key]) return;
115
- Object.defineProperty(exports, key, {
116
- enumerable: true,
117
- get: function get() {
118
- return _AccessibilityMenuOptionButton[key];
119
- }
120
- });
121
- });
122
-
123
- var _AccessibilityMenuSteps = require("@digigov/react-extensions/admin/AccessibilityMenuSteps");
124
-
125
- Object.keys(_AccessibilityMenuSteps).forEach(function (key) {
126
- if (key === "default" || key === "__esModule") return;
127
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
128
- if (key in exports && exports[key] === _AccessibilityMenuSteps[key]) return;
129
- Object.defineProperty(exports, key, {
130
- enumerable: true,
131
- get: function get() {
132
- return _AccessibilityMenuSteps[key];
133
- }
134
- });
135
- });
136
-
137
145
  var _AccessibilityIcon = require("@digigov/react-core/AccessibilityIcon");
138
146
 
139
147
  Object.keys(_AccessibilityIcon).forEach(function (key) {
@@ -166,5 +174,52 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
166
174
 
167
175
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
168
176
 
177
+ var AccessibilityMenuOptionButton = /*#__PURE__*/_react["default"].forwardRef(function AccessibilityMenuOptionButton(_ref, ref) {
178
+ var _ref$steps = _ref.steps,
179
+ steps = _ref$steps === void 0 ? 0 : _ref$steps,
180
+ children = _ref.children;
181
+
182
+ var _useState = (0, _react.useState)(false),
183
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
184
+ selected = _useState2[0],
185
+ setSelected = _useState2[1];
186
+
187
+ var _useState3 = (0, _react.useState)(0),
188
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
189
+ activeStep = _useState4[0],
190
+ setActiveStep = _useState4[1];
191
+
192
+ var handleClick = function handleClick() {
193
+ if (!selected) {
194
+ setSelected(true);
195
+
196
+ if (steps > 0) {
197
+ setActiveStep(activeStep + 1);
198
+ }
199
+ } else {
200
+ if (steps > 0) {
201
+ if (steps > activeStep) {
202
+ setActiveStep(activeStep + 1);
203
+ } else {
204
+ setActiveStep(0);
205
+ setSelected(false);
206
+ }
207
+ } else {
208
+ setSelected(false);
209
+ }
210
+ }
211
+ };
212
+
213
+ return /*#__PURE__*/_react["default"].createElement(_AccessibilityMenuOptionButton["default"], {
214
+ onClick: handleClick,
215
+ ref: ref,
216
+ selected: selected
217
+ }, children, /*#__PURE__*/_react["default"].createElement(_AccessibilityMenuSteps["default"], {
218
+ steps: steps,
219
+ activeStep: activeStep
220
+ }));
221
+ });
222
+
223
+ exports.AccessibilityMenuOptionButton = AccessibilityMenuOptionButton;
169
224
  var _default = _AccessibilityMenu["default"];
170
225
  exports["default"] = _default;
@@ -2,11 +2,15 @@ import React from 'react';
2
2
  import Accordion from '@digigov/react-core/Accordion';
3
3
  import AccordionSection from '@digigov/react-core/AccordionSection';
4
4
  import AccordionSectionContent from '@digigov/react-core/AccordionSectionContent';
5
- import AccordionSectionSummaryHeading from '@digigov/react-core/AccordionSectionSummaryHeading';
5
+ import { AccordionSectionSummaryHeadingProps as AccordionSectionSummaryHeadingBaseProps } from '@digigov/react-core/AccordionSectionSummaryHeading';
6
6
  import AccordionSectionSummary from '@digigov/react-core/AccordionSectionSummary';
7
7
  import AccordionControls from '@digigov/react-core/AccordionControls';
8
8
  import { UseTogglableTabReturn } from '@digigov/ui/hooks/useTogglableTab';
9
9
  export declare const AccordionItemDetails: React.ForwardRefExoticComponent<Pick<import("@digigov/react-core/AccordionSectionContent").AccordionSectionContentProps, "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "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" | "children" | "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" | "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" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "xsUpHidden" | "smUpHidden" | "mdUpHidden" | "lgUpHidden" | "xlUpHidden" | "xsHidden" | "smHidden" | "mdHidden" | "lgHidden" | "xlHidden"> & React.RefAttributes<HTMLDivElement>>;
10
+ export interface AccordionSectionSummaryHeadingProps extends AccordionSectionSummaryHeadingBaseProps {
11
+ children: React.ReactNode;
12
+ }
13
+ declare const AccordionSectionSummaryHeading: React.ForwardRefExoticComponent<Pick<AccordionSectionSummaryHeadingProps, "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "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" | "children" | "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" | "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" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "xsUpHidden" | "smUpHidden" | "mdUpHidden" | "lgUpHidden" | "xlUpHidden" | "xsHidden" | "smHidden" | "mdHidden" | "lgHidden" | "xlHidden"> & React.RefAttributes<HTMLHeadingElement>>;
10
14
  export declare const AccordionItemSummary: ({ children, ...props }: {
11
15
  [x: string]: any;
12
16
  children: any;
@@ -11,11 +11,11 @@ var _exportNames = {
11
11
  AccordionItemDetails: true,
12
12
  AccordionItemSummary: true,
13
13
  AccordionItem: true,
14
+ AccordionSectionSummaryHeading: true,
14
15
  useAccordion: true,
15
16
  Accordion: true,
16
17
  AccordionSection: true,
17
18
  AccordionSectionContent: true,
18
- AccordionSectionSummaryHeading: true,
19
19
  AccordionSectionSummary: true,
20
20
  AccordionControls: true
21
21
  };
@@ -50,19 +50,15 @@ Object.defineProperty(exports, "AccordionSectionSummary", {
50
50
  return _AccordionSectionSummary["default"];
51
51
  }
52
52
  });
53
- Object.defineProperty(exports, "AccordionSectionSummaryHeading", {
54
- enumerable: true,
55
- get: function get() {
56
- return _AccordionSectionSummaryHeading["default"];
57
- }
58
- });
59
- exports.useAccordion = exports["default"] = void 0;
53
+ exports.useAccordion = exports["default"] = exports.AccordionSectionSummaryHeading = void 0;
60
54
 
61
55
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
62
56
 
57
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
58
+
63
59
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
64
60
 
65
- var _react = _interopRequireDefault(require("react"));
61
+ var _react = _interopRequireWildcard(require("react"));
66
62
 
67
63
  var _Accordion = _interopRequireWildcard(require("@digigov/react-core/Accordion"));
68
64
 
@@ -166,7 +162,8 @@ Object.keys(_AccordionSectionHeader).forEach(function (key) {
166
162
  });
167
163
  });
168
164
  var _excluded = ["children"],
169
- _excluded2 = ["register", "setOpened", "opened", "registered"];
165
+ _excluded2 = ["children"],
166
+ _excluded3 = ["register", "setOpened", "opened", "registered"];
170
167
 
171
168
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
172
169
 
@@ -177,10 +174,46 @@ var AccordionItemDetails = (0, _withDeprecation["default"])(_AccordionSectionCon
177
174
  rename: 'AccordionSectionContent'
178
175
  });
179
176
  exports.AccordionItemDetails = AccordionItemDetails;
180
- var AccordionItemSummary = (0, _withDeprecation["default"])(function (_ref) {
177
+
178
+ var AccordionSectionSummaryHeading = /*#__PURE__*/_react["default"].forwardRef(function AccordionSectionSummaryHeading(_ref, ref) {
181
179
  var children = _ref.children,
182
180
  props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
183
- return /*#__PURE__*/_react["default"].createElement(_AccordionSectionSummary["default"], props, /*#__PURE__*/_react["default"].createElement(_AccordionSectionSummaryHeading["default"], null, children));
181
+
182
+ var toggleExpanded = function toggleExpanded() {
183
+ setExpanded(!isExpanded);
184
+ };
185
+
186
+ var _useState = (0, _react.useState)(false),
187
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
188
+ isExpanded = _useState2[0],
189
+ setExpanded = _useState2[1];
190
+
191
+ return /*#__PURE__*/_react["default"].createElement(_AccordionSectionSummaryHeading["default"], (0, _extends2["default"])({
192
+ ref: ref
193
+ }, props, {
194
+ onClick: toggleExpanded,
195
+ "aria-expanded": isExpanded
196
+ }), children);
197
+ });
198
+
199
+ exports.AccordionSectionSummaryHeading = AccordionSectionSummaryHeading;
200
+ var AccordionItemSummary = (0, _withDeprecation["default"])(function (_ref2) {
201
+ var children = _ref2.children,
202
+ props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
203
+
204
+ var toggleExpanded = function toggleExpanded() {
205
+ setExpanded(!isExpanded);
206
+ };
207
+
208
+ var _useState3 = (0, _react.useState)(false),
209
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
210
+ isExpanded = _useState4[0],
211
+ setExpanded = _useState4[1];
212
+
213
+ return /*#__PURE__*/_react["default"].createElement(_AccordionSectionSummary["default"], props, /*#__PURE__*/_react["default"].createElement(_AccordionSectionSummaryHeading["default"], {
214
+ onClick: toggleExpanded,
215
+ "aria-expanded": isExpanded
216
+ }, children));
184
217
  }, {
185
218
  name: 'AccordionItemSummary',
186
219
  warning: 'There is no need to use AccordionSectionHeader components anymore. It will be removed in a later version and impelented using AccordionSectionSummary and AccordionSectionSummaryHeading'
@@ -204,7 +237,7 @@ var useAccordion = function useAccordion(props) {
204
237
  setOpened = _useTogglableTab.setOpened,
205
238
  opened = _useTogglableTab.opened,
206
239
  registered = _useTogglableTab.registered,
207
- rest = (0, _objectWithoutProperties2["default"])(_useTogglableTab, _excluded2);
240
+ rest = (0, _objectWithoutProperties2["default"])(_useTogglableTab, _excluded3);
208
241
 
209
242
  return (0, _extends2["default"])({
210
243
  register: register,
@@ -1,3 +1,52 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import AccessibilityMenuOptionButtonBase from '@digigov/react-extensions/admin/AccessibilityMenuOptionButton';
3
+ import AccessibilityMenuSteps from '@digigov/react-extensions/admin/AccessibilityMenuSteps';
4
+ import React, { useState } from 'react';
5
+ export var AccessibilityMenuOptionButton = /*#__PURE__*/React.forwardRef(function AccessibilityMenuOptionButton(_ref, ref) {
6
+ var _ref$steps = _ref.steps,
7
+ steps = _ref$steps === void 0 ? 0 : _ref$steps,
8
+ children = _ref.children;
9
+
10
+ var _useState = useState(false),
11
+ _useState2 = _slicedToArray(_useState, 2),
12
+ selected = _useState2[0],
13
+ setSelected = _useState2[1];
14
+
15
+ var _useState3 = useState(0),
16
+ _useState4 = _slicedToArray(_useState3, 2),
17
+ activeStep = _useState4[0],
18
+ setActiveStep = _useState4[1];
19
+
20
+ var handleClick = function handleClick() {
21
+ if (!selected) {
22
+ setSelected(true);
23
+
24
+ if (steps > 0) {
25
+ setActiveStep(activeStep + 1);
26
+ }
27
+ } else {
28
+ if (steps > 0) {
29
+ if (steps > activeStep) {
30
+ setActiveStep(activeStep + 1);
31
+ } else {
32
+ setActiveStep(0);
33
+ setSelected(false);
34
+ }
35
+ } else {
36
+ setSelected(false);
37
+ }
38
+ }
39
+ };
40
+
41
+ return /*#__PURE__*/React.createElement(AccessibilityMenuOptionButtonBase, {
42
+ onClick: handleClick,
43
+ ref: ref,
44
+ selected: selected
45
+ }, children, /*#__PURE__*/React.createElement(AccessibilityMenuSteps, {
46
+ steps: steps,
47
+ activeStep: activeStep
48
+ }));
49
+ });
1
50
  export * from '@digigov/react-extensions/admin/AccessibilityMenu';
2
51
  export * from '@digigov/react-extensions/admin/AccessibilityMenuButton';
3
52
  export * from '@digigov/react-extensions/admin/AccessibilityMenuContent';
@@ -1,14 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
4
  var _excluded = ["children"],
4
- _excluded2 = ["register", "setOpened", "opened", "registered"];
5
+ _excluded2 = ["children"],
6
+ _excluded3 = ["register", "setOpened", "opened", "registered"];
5
7
 
6
8
  /* eslint-disable react-hooks/exhaustive-deps */
7
- import React from 'react';
9
+ import React, { useState } from 'react';
8
10
  import Accordion from '@digigov/react-core/Accordion';
9
11
  import AccordionSection from '@digigov/react-core/AccordionSection';
10
12
  import AccordionSectionContent from '@digigov/react-core/AccordionSectionContent';
11
- import AccordionSectionSummaryHeading from '@digigov/react-core/AccordionSectionSummaryHeading';
13
+ import AccordionSectionSummaryHeadingBase from '@digigov/react-core/AccordionSectionSummaryHeading';
12
14
  import AccordionSectionSummary from '@digigov/react-core/AccordionSectionSummary';
13
15
  import AccordionControls from '@digigov/react-core/AccordionControls';
14
16
  import withDeprecation from '@digigov/ui/utils/withDeprecation';
@@ -17,11 +19,43 @@ export var AccordionItemDetails = withDeprecation(AccordionSectionContent, {
17
19
  name: 'AccordionItemDetails',
18
20
  rename: 'AccordionSectionContent'
19
21
  });
20
- export var AccordionItemSummary = withDeprecation(function (_ref) {
22
+ var AccordionSectionSummaryHeading = /*#__PURE__*/React.forwardRef(function AccordionSectionSummaryHeading(_ref, ref) {
21
23
  var children = _ref.children,
22
24
  props = _objectWithoutProperties(_ref, _excluded);
23
25
 
24
- return /*#__PURE__*/React.createElement(AccordionSectionSummary, props, /*#__PURE__*/React.createElement(AccordionSectionSummaryHeading, null, children));
26
+ var toggleExpanded = function toggleExpanded() {
27
+ setExpanded(!isExpanded);
28
+ };
29
+
30
+ var _useState = useState(false),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ isExpanded = _useState2[0],
33
+ setExpanded = _useState2[1];
34
+
35
+ return /*#__PURE__*/React.createElement(AccordionSectionSummaryHeadingBase, _extends({
36
+ ref: ref
37
+ }, props, {
38
+ onClick: toggleExpanded,
39
+ "aria-expanded": isExpanded
40
+ }), children);
41
+ });
42
+ export var AccordionItemSummary = withDeprecation(function (_ref2) {
43
+ var children = _ref2.children,
44
+ props = _objectWithoutProperties(_ref2, _excluded2);
45
+
46
+ var toggleExpanded = function toggleExpanded() {
47
+ setExpanded(!isExpanded);
48
+ };
49
+
50
+ var _useState3 = useState(false),
51
+ _useState4 = _slicedToArray(_useState3, 2),
52
+ isExpanded = _useState4[0],
53
+ setExpanded = _useState4[1];
54
+
55
+ return /*#__PURE__*/React.createElement(AccordionSectionSummary, props, /*#__PURE__*/React.createElement(AccordionSectionSummaryHeadingBase, {
56
+ onClick: toggleExpanded,
57
+ "aria-expanded": isExpanded
58
+ }, children));
25
59
  }, {
26
60
  name: 'AccordionItemSummary',
27
61
  warning: 'There is no need to use AccordionSectionHeader components anymore. It will be removed in a later version and impelented using AccordionSectionSummary and AccordionSectionSummaryHeading'
@@ -43,7 +77,7 @@ var useAccordion = function useAccordion(props) {
43
77
  setOpened = _useTogglableTab.setOpened,
44
78
  opened = _useTogglableTab.opened,
45
79
  registered = _useTogglableTab.registered,
46
- rest = _objectWithoutProperties(_useTogglableTab, _excluded2);
80
+ rest = _objectWithoutProperties(_useTogglableTab, _excluded3);
47
81
 
48
82
  return _extends({
49
83
  register: register,
@@ -1,3 +1,52 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import AccessibilityMenuOptionButtonBase from '@digigov/react-extensions/admin/AccessibilityMenuOptionButton';
3
+ import AccessibilityMenuSteps from '@digigov/react-extensions/admin/AccessibilityMenuSteps';
4
+ import React, { useState } from 'react';
5
+ export var AccessibilityMenuOptionButton = /*#__PURE__*/React.forwardRef(function AccessibilityMenuOptionButton(_ref, ref) {
6
+ var _ref$steps = _ref.steps,
7
+ steps = _ref$steps === void 0 ? 0 : _ref$steps,
8
+ children = _ref.children;
9
+
10
+ var _useState = useState(false),
11
+ _useState2 = _slicedToArray(_useState, 2),
12
+ selected = _useState2[0],
13
+ setSelected = _useState2[1];
14
+
15
+ var _useState3 = useState(0),
16
+ _useState4 = _slicedToArray(_useState3, 2),
17
+ activeStep = _useState4[0],
18
+ setActiveStep = _useState4[1];
19
+
20
+ var handleClick = function handleClick() {
21
+ if (!selected) {
22
+ setSelected(true);
23
+
24
+ if (steps > 0) {
25
+ setActiveStep(activeStep + 1);
26
+ }
27
+ } else {
28
+ if (steps > 0) {
29
+ if (steps > activeStep) {
30
+ setActiveStep(activeStep + 1);
31
+ } else {
32
+ setActiveStep(0);
33
+ setSelected(false);
34
+ }
35
+ } else {
36
+ setSelected(false);
37
+ }
38
+ }
39
+ };
40
+
41
+ return /*#__PURE__*/React.createElement(AccessibilityMenuOptionButtonBase, {
42
+ onClick: handleClick,
43
+ ref: ref,
44
+ selected: selected
45
+ }, children, /*#__PURE__*/React.createElement(AccessibilityMenuSteps, {
46
+ steps: steps,
47
+ activeStep: activeStep
48
+ }));
49
+ });
1
50
  export * from '@digigov/react-extensions/admin/AccessibilityMenu';
2
51
  export * from '@digigov/react-extensions/admin/AccessibilityMenuButton';
3
52
  export * from '@digigov/react-extensions/admin/AccessibilityMenuContent';
@@ -1,14 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
4
  var _excluded = ["children"],
4
- _excluded2 = ["register", "setOpened", "opened", "registered"];
5
+ _excluded2 = ["children"],
6
+ _excluded3 = ["register", "setOpened", "opened", "registered"];
5
7
 
6
8
  /* eslint-disable react-hooks/exhaustive-deps */
7
- import React from 'react';
9
+ import React, { useState } from 'react';
8
10
  import Accordion from '@digigov/react-core/Accordion';
9
11
  import AccordionSection from '@digigov/react-core/AccordionSection';
10
12
  import AccordionSectionContent from '@digigov/react-core/AccordionSectionContent';
11
- import AccordionSectionSummaryHeading from '@digigov/react-core/AccordionSectionSummaryHeading';
13
+ import AccordionSectionSummaryHeadingBase from '@digigov/react-core/AccordionSectionSummaryHeading';
12
14
  import AccordionSectionSummary from '@digigov/react-core/AccordionSectionSummary';
13
15
  import AccordionControls from '@digigov/react-core/AccordionControls';
14
16
  import withDeprecation from '@digigov/ui/utils/withDeprecation';
@@ -17,11 +19,43 @@ export var AccordionItemDetails = withDeprecation(AccordionSectionContent, {
17
19
  name: 'AccordionItemDetails',
18
20
  rename: 'AccordionSectionContent'
19
21
  });
20
- export var AccordionItemSummary = withDeprecation(function (_ref) {
22
+ var AccordionSectionSummaryHeading = /*#__PURE__*/React.forwardRef(function AccordionSectionSummaryHeading(_ref, ref) {
21
23
  var children = _ref.children,
22
24
  props = _objectWithoutProperties(_ref, _excluded);
23
25
 
24
- return /*#__PURE__*/React.createElement(AccordionSectionSummary, props, /*#__PURE__*/React.createElement(AccordionSectionSummaryHeading, null, children));
26
+ var toggleExpanded = function toggleExpanded() {
27
+ setExpanded(!isExpanded);
28
+ };
29
+
30
+ var _useState = useState(false),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ isExpanded = _useState2[0],
33
+ setExpanded = _useState2[1];
34
+
35
+ return /*#__PURE__*/React.createElement(AccordionSectionSummaryHeadingBase, _extends({
36
+ ref: ref
37
+ }, props, {
38
+ onClick: toggleExpanded,
39
+ "aria-expanded": isExpanded
40
+ }), children);
41
+ });
42
+ export var AccordionItemSummary = withDeprecation(function (_ref2) {
43
+ var children = _ref2.children,
44
+ props = _objectWithoutProperties(_ref2, _excluded2);
45
+
46
+ var toggleExpanded = function toggleExpanded() {
47
+ setExpanded(!isExpanded);
48
+ };
49
+
50
+ var _useState3 = useState(false),
51
+ _useState4 = _slicedToArray(_useState3, 2),
52
+ isExpanded = _useState4[0],
53
+ setExpanded = _useState4[1];
54
+
55
+ return /*#__PURE__*/React.createElement(AccordionSectionSummary, props, /*#__PURE__*/React.createElement(AccordionSectionSummaryHeadingBase, {
56
+ onClick: toggleExpanded,
57
+ "aria-expanded": isExpanded
58
+ }, children));
25
59
  }, {
26
60
  name: 'AccordionItemSummary',
27
61
  warning: 'There is no need to use AccordionSectionHeader components anymore. It will be removed in a later version and impelented using AccordionSectionSummary and AccordionSectionSummaryHeading'
@@ -43,7 +77,7 @@ var useAccordion = function useAccordion(props) {
43
77
  setOpened = _useTogglableTab.setOpened,
44
78
  opened = _useTogglableTab.opened,
45
79
  registered = _useTogglableTab.registered,
46
- rest = _objectWithoutProperties(_useTogglableTab, _excluded2);
80
+ rest = _objectWithoutProperties(_useTogglableTab, _excluded3);
47
81
 
48
82
  return _extends({
49
83
  register: register,
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Digigov v0.32.1
1
+ /** @license Digigov v0.32.2
2
2
  *
3
3
  * This source code is licensed under the BSD-2-Clause license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/ui",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "@digigov reusable components toolkit",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -20,8 +20,8 @@
20
20
  "clsx": "1.1.1",
21
21
  "react": "^16.8.0 || ^17.0.0",
22
22
  "react-dom": "^16.8.0 || ^17.0.0",
23
- "@digigov/react-core": "0.23.0",
24
- "@digigov/react-extensions": "0.21.2"
23
+ "@digigov/react-core": "0.23.1",
24
+ "@digigov/react-extensions": "0.21.3"
25
25
  },
26
26
  "gitHead": "c903a46306f77f55ad7fc4d2e274006f39a6c871",
27
27
  "private": false,
@@ -1,3 +1,55 @@
1
+ import AccessibilityMenuOptionButtonBase, {
2
+ AccessibilityMenuOptionButtonProps as AccessibilityMenuOptionButtonBaseProps,
3
+ } from '@digigov/react-extensions/admin/AccessibilityMenuOptionButton';
4
+ import AccessibilityMenuSteps from '@digigov/react-extensions/admin/AccessibilityMenuSteps';
5
+ export interface AccessibilityMenuOptionButtonProps
6
+ extends AccessibilityMenuOptionButtonBaseProps {
7
+ steps?: 0 | 1 | 2 | 3 | 4;
8
+ }
9
+
10
+ import React, { useState } from 'react';
11
+
12
+ export const AccessibilityMenuOptionButton = React.forwardRef<
13
+ HTMLButtonElement,
14
+ AccessibilityMenuOptionButtonProps
15
+ >(function AccessibilityMenuOptionButton(
16
+ { steps = 0, children },
17
+ ref: React.Ref<HTMLButtonElement>
18
+ ) {
19
+ const [selected, setSelected] = useState(false);
20
+ const [activeStep, setActiveStep] = useState<number>(0);
21
+
22
+ const handleClick = () => {
23
+ if (!selected) {
24
+ setSelected(true);
25
+ if (steps > 0) {
26
+ setActiveStep(activeStep + 1);
27
+ }
28
+ } else {
29
+ if (steps > 0) {
30
+ if (steps > activeStep) {
31
+ setActiveStep(activeStep + 1);
32
+ } else {
33
+ setActiveStep(0);
34
+ setSelected(false);
35
+ }
36
+ } else {
37
+ setSelected(false);
38
+ }
39
+ }
40
+ };
41
+ return (
42
+ <AccessibilityMenuOptionButtonBase
43
+ onClick={handleClick}
44
+ ref={ref}
45
+ selected={selected}
46
+ >
47
+ {children}
48
+ <AccessibilityMenuSteps steps={steps} activeStep={activeStep} />
49
+ </AccessibilityMenuOptionButtonBase>
50
+ );
51
+ });
52
+
1
53
  export * from '@digigov/react-extensions/admin/AccessibilityMenu';
2
54
  export * from '@digigov/react-extensions/admin/AccessibilityMenuButton';
3
55
  export * from '@digigov/react-extensions/admin/AccessibilityMenuContent';
@@ -1,9 +1,11 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
- import React from 'react';
2
+ import React, { useState } from 'react';
3
3
  import Accordion from '@digigov/react-core/Accordion';
4
4
  import AccordionSection from '@digigov/react-core/AccordionSection';
5
5
  import AccordionSectionContent from '@digigov/react-core/AccordionSectionContent';
6
- import AccordionSectionSummaryHeading from '@digigov/react-core/AccordionSectionSummaryHeading';
6
+ import AccordionSectionSummaryHeadingBase, {
7
+ AccordionSectionSummaryHeadingProps as AccordionSectionSummaryHeadingBaseProps,
8
+ } from '@digigov/react-core/AccordionSectionSummaryHeading';
7
9
  import AccordionSectionSummary from '@digigov/react-core/AccordionSectionSummary';
8
10
  import AccordionControls from '@digigov/react-core/AccordionControls';
9
11
  import withDeprecation from '@digigov/ui/utils/withDeprecation';
@@ -17,13 +19,45 @@ export const AccordionItemDetails = withDeprecation(AccordionSectionContent, {
17
19
  rename: 'AccordionSectionContent',
18
20
  });
19
21
 
22
+ export interface AccordionSectionSummaryHeadingProps
23
+ extends AccordionSectionSummaryHeadingBaseProps {
24
+ children: React.ReactNode;
25
+ }
26
+
27
+ const AccordionSectionSummaryHeading = React.forwardRef<
28
+ HTMLHeadingElement,
29
+ AccordionSectionSummaryHeadingProps
30
+ >(function AccordionSectionSummaryHeading({ children, ...props }, ref) {
31
+ const toggleExpanded = () => {
32
+ setExpanded(!isExpanded);
33
+ };
34
+ const [isExpanded, setExpanded] = useState(false);
35
+ return (
36
+ <AccordionSectionSummaryHeadingBase
37
+ ref={ref}
38
+ {...props}
39
+ onClick={toggleExpanded}
40
+ aria-expanded={isExpanded}
41
+ >
42
+ {children}
43
+ </AccordionSectionSummaryHeadingBase>
44
+ );
45
+ });
46
+
20
47
  export const AccordionItemSummary = withDeprecation(
21
48
  ({ children, ...props }) => {
49
+ const toggleExpanded = () => {
50
+ setExpanded(!isExpanded);
51
+ };
52
+ const [isExpanded, setExpanded] = useState(false);
22
53
  return (
23
54
  <AccordionSectionSummary {...props}>
24
- <AccordionSectionSummaryHeading>
55
+ <AccordionSectionSummaryHeadingBase
56
+ onClick={toggleExpanded}
57
+ aria-expanded={isExpanded}
58
+ >
25
59
  {children}
26
- </AccordionSectionSummaryHeading>
60
+ </AccordionSectionSummaryHeadingBase>
27
61
  </AccordionSectionSummary>
28
62
  );
29
63
  },