@reach/disclosure
Advanced tools
Comparing version 0.8.2 to 0.8.3
@@ -159,3 +159,3 @@ 'use strict'; | ||
onClick: utils.wrapEvent(onClick, handleClick), | ||
"data-reach-disclosure-trigger": "", | ||
"data-reach-disclosure-button": "", | ||
"data-state": open ? exports.DisclosureStates.Open : exports.DisclosureStates.Collapsed | ||
@@ -162,0 +162,0 @@ }), children); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@reach/utils"),o=require("@reach/auto-id");function s(e,r){if(null==e)return{};var t,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r.indexOf(t=s[n])>=0||(o[t]=e[t]);return o}require("prop-types"),require("warning");var a,l=n.createNamedContext("DisclosureContext",{}),i=function(){return r.useContext(l)};(a=exports.DisclosureStates||(exports.DisclosureStates={})).Open="open",a.Collapsed="collapsed";var u=n.forwardRefWithAs((function(e,o){var a=e.as,l=void 0===a?"button":a,u=e.children,c=e.onClick,d=s(e,["as","children","onClick","onMouseDown","onPointerDown"]),p=i(),f=p.onSelect,v=p.open,x=p.panelId,h=r.useRef(null),D=n.useForkedRef(o,h);return t.createElement(l,Object.assign({"aria-controls":x,"aria-expanded":v},d,{ref:D,onClick:n.wrapEvent(c,(function(e){e.preventDefault(),h.current&&h.current.focus(),f()})),"data-reach-disclosure-trigger":"","data-state":v?exports.DisclosureStates.Open:exports.DisclosureStates.Collapsed}),u)})),c=r.forwardRef((function(e,r){var n=e.children,o=s(e,["children"]),a=i(),l=a.open;return t.createElement("div",Object.assign({ref:r,hidden:!l},o,{"data-reach-disclosure-panel":"","data-state":l?exports.DisclosureStates.Open:exports.DisclosureStates.Collapsed,id:a.panelId,tabIndex:-1}),n)}));exports.Disclosure=function(e){var a=e.children,i=e.defaultOpen,u=void 0!==i&&i,c=e.onChange,d=e.open,p=s(e,["children","defaultOpen","onChange","open"]),f=r.useRef(null!=d).current,v=o.useId(null!=p.id?String(p.id):void 0)||"disclosure",x=n.makeId("panel",v),h=r.useState(f?d:u),D=h[0],C=h[1],O={disclosureId:v,onSelect:function(){c&&c(),f||C(!D)},open:D,panelId:x};return f&&d!==D&&C(d),t.createElement(l.Provider,{value:O},a)},exports.DisclosureButton=u,exports.DisclosurePanel=c; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@reach/utils"),o=require("@reach/auto-id");function s(e,r){if(null==e)return{};var t,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r.indexOf(t=s[n])>=0||(o[t]=e[t]);return o}require("prop-types"),require("warning");var a,l=n.createNamedContext("DisclosureContext",{}),u=function(){return r.useContext(l)};(a=exports.DisclosureStates||(exports.DisclosureStates={})).Open="open",a.Collapsed="collapsed";var i=n.forwardRefWithAs((function(e,o){var a=e.as,l=void 0===a?"button":a,i=e.children,c=e.onClick,d=s(e,["as","children","onClick","onMouseDown","onPointerDown"]),p=u(),f=p.onSelect,v=p.open,x=p.panelId,h=r.useRef(null),D=n.useForkedRef(o,h);return t.createElement(l,Object.assign({"aria-controls":x,"aria-expanded":v},d,{ref:D,onClick:n.wrapEvent(c,(function(e){e.preventDefault(),h.current&&h.current.focus(),f()})),"data-reach-disclosure-button":"","data-state":v?exports.DisclosureStates.Open:exports.DisclosureStates.Collapsed}),i)})),c=r.forwardRef((function(e,r){var n=e.children,o=s(e,["children"]),a=u(),l=a.open;return t.createElement("div",Object.assign({ref:r,hidden:!l},o,{"data-reach-disclosure-panel":"","data-state":l?exports.DisclosureStates.Open:exports.DisclosureStates.Collapsed,id:a.panelId,tabIndex:-1}),n)}));exports.Disclosure=function(e){var a=e.children,u=e.defaultOpen,i=void 0!==u&&u,c=e.onChange,d=e.open,p=s(e,["children","defaultOpen","onChange","open"]),f=r.useRef(null!=d).current,v=o.useId(null!=p.id?String(p.id):void 0)||"disclosure",x=n.makeId("panel",v),h=r.useState(f?d:i),D=h[0],C=h[1],O={disclosureId:v,onSelect:function(){c&&c(),f||C(!D)},open:D,panelId:x};return f&&d!==D&&C(d),t.createElement(l.Provider,{value:O},a)},exports.DisclosureButton=i,exports.DisclosurePanel=c; | ||
//# sourceMappingURL=disclosure.cjs.production.min.js.map |
@@ -155,3 +155,3 @@ import React, { useRef, useState, useContext, forwardRef } from 'react'; | ||
onClick: wrapEvent(onClick, handleClick), | ||
"data-reach-disclosure-trigger": "", | ||
"data-reach-disclosure-button": "", | ||
"data-state": open ? DisclosureStates.Open : DisclosureStates.Collapsed | ||
@@ -158,0 +158,0 @@ }), children); |
{ | ||
"name": "@reach/disclosure", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"description": "Accessible React disclosure component", | ||
@@ -19,3 +19,3 @@ "author": "React Training <hello@reacttraining.com>", | ||
"@reach/auto-id": "^0.8.2", | ||
"@reach/utils": "^0.8.2", | ||
"@reach/utils": "^0.8.3", | ||
"tslib": "^1.10.0", | ||
@@ -35,3 +35,3 @@ "warning": "^4.0.3" | ||
], | ||
"gitHead": "ed24a5bb43a87adc36179283ca1de2c5af4ea26e" | ||
"gitHead": "5bf1ce48db867c6b3c88e19f1614a6a725e829a0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
57556
Updated@reach/utils@^0.8.3