@react-spectrum/accordion 3.0.0-alpha.14 → 3.0.0-alpha.16
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/dist/main.css +1 -1
- package/dist/main.js +57 -37
- package/dist/main.js.map +1 -1
- package/dist/module.js +57 -37
- package/dist/module.js.map +1 -1
- package/package.json +12 -12
- package/src/Accordion.tsx +1 -1
package/dist/main.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.spectrum-Accordion_b4e47f{margin:0;padding:0;list-style:none;display:block}[dir=ltr] .spectrum-Accordion-itemIndicator_b4e47f{padding-left:var(--spectrum-accordion-icon-spacing,16px)}[dir=rtl] .spectrum-Accordion-itemIndicator_b4e47f{padding-right:var(--spectrum-accordion-icon-spacing,16px)}[dir=ltr] .spectrum-Accordion-itemIndicator_b4e47f{padding-right:var(--spectrum-accordion-icon-gap,var(--spectrum-global-dimension-size-100))}[dir=rtl] .spectrum-Accordion-itemIndicator_b4e47f{padding-left:var(--spectrum-accordion-icon-gap,var(--spectrum-global-dimension-size-100))}.spectrum-Accordion-itemIndicator_b4e47f{transition:transform ease var(--spectrum-global-animation-duration-100
|
|
1
|
+
.spectrum-Accordion_b4e47f{margin:0;padding:0;list-style:none;display:block}[dir=ltr] .spectrum-Accordion-itemIndicator_b4e47f{padding-left:var(--spectrum-accordion-icon-spacing,16px)}[dir=rtl] .spectrum-Accordion-itemIndicator_b4e47f{padding-right:var(--spectrum-accordion-icon-spacing,16px)}[dir=ltr] .spectrum-Accordion-itemIndicator_b4e47f{padding-right:var(--spectrum-accordion-icon-gap,var(--spectrum-global-dimension-size-100))}[dir=rtl] .spectrum-Accordion-itemIndicator_b4e47f{padding-left:var(--spectrum-accordion-icon-gap,var(--spectrum-global-dimension-size-100))}.spectrum-Accordion-itemIndicator_b4e47f{transition:transform ease var(--spectrum-global-animation-duration-100,.13s);display:block}.spectrum-Accordion-item_b4e47f{z-index:inherit;border-bottom:var(--spectrum-accordion-item-border-size,var(--spectrum-alias-border-size-thin))solid transparent;margin:0;display:list-item;position:relative}.spectrum-Accordion-item_b4e47f:first-of-type{border-top:var(--spectrum-accordion-item-border-size,var(--spectrum-alias-border-size-thin))solid transparent}.spectrum-Accordion-itemHeading_b4e47f{margin:0}[dir=ltr] .spectrum-Accordion-itemHeader_b4e47f{padding-left:2px}[dir=rtl] .spectrum-Accordion-itemHeader_b4e47f{padding-right:2px}[dir=ltr] .spectrum-Accordion-itemHeader_b4e47f{padding-right:var(--spectrum-accordion-item-padding,16px)}[dir=rtl] .spectrum-Accordion-itemHeader_b4e47f{padding-left:var(--spectrum-accordion-item-padding,16px)}[dir=ltr] .spectrum-Accordion-itemHeader_b4e47f{text-align:left}[dir=rtl] .spectrum-Accordion-itemHeader_b4e47f{text-align:right}.spectrum-Accordion-itemHeader_b4e47f{box-sizing:border-box;padding-top:var(--spectrum-global-dimension-size-150);padding-bottom:var(--spectrum-global-dimension-size-150);min-height:calc(var(--spectrum-accordion-item-height,40px) - var(--spectrum-accordion-item-border-size,var(--spectrum-alias-border-size-thin)));font-size:var(--spectrum-global-dimension-font-size-300);text-overflow:ellipsis;cursor:default;line-height:1.3;font-weight:var(--spectrum-global-font-weight-bold,700);-webkit-appearance:none;appearance:none;background-color:inherit;width:100%;border:0;justify-content:flex-start;align-items:center;margin:0;font-family:inherit;display:flex;position:relative}.spectrum-Accordion-itemHeader_b4e47f:focus{outline:none}[dir=ltr] .spectrum-Accordion-itemHeader_b4e47f:focus:after{left:0}[dir=rtl] .spectrum-Accordion-itemHeader_b4e47f:focus:after{right:0}.spectrum-Accordion-itemHeader_b4e47f:focus:after{content:"";top:calc(var(--spectrum-accordion-item-border-size,var(--spectrum-alias-border-size-thin))*-1);bottom:calc(var(--spectrum-accordion-item-border-size,var(--spectrum-alias-border-size-thin))*-1);width:var(--spectrum-accordion-item-border-size-key-focus,2px);position:absolute}.spectrum-Accordion-itemContent_b4e47f{padding:0 var(--spectrum-accordion-item-content-padding,var(--spectrum-global-dimension-size-200))var(--spectrum-accordion-item-content-padding,var(--spectrum-global-dimension-size-200))var(--spectrum-accordion-item-content-padding,var(--spectrum-global-dimension-size-200));display:none}[dir=ltr] .spectrum-Accordion-item_b4e47f.is-open_b4e47f>.spectrum-Accordion-itemHeading_b4e47f>.spectrum-Accordion-itemHeader_b4e47f>.spectrum-Accordion-itemIndicator_b4e47f{transform:rotate(90deg)}[dir=rtl] .spectrum-Accordion-item_b4e47f.is-open_b4e47f>.spectrum-Accordion-itemHeading_b4e47f>.spectrum-Accordion-itemHeader_b4e47f>.spectrum-Accordion-itemIndicator_b4e47f{transform:rotate(-90deg)}.spectrum-Accordion-item_b4e47f.is-open_b4e47f>.spectrum-Accordion-itemHeader_b4e47f:after{height:calc(var(--spectrum-accordion-item-height,40px) - var(--spectrum-accordion-item-border-size,var(--spectrum-alias-border-size-thin)))}.spectrum-Accordion-item_b4e47f.is-open_b4e47f>.spectrum-Accordion-itemContent_b4e47f{display:block}.spectrum-Accordion-item_b4e47f.is-disabled_b4e47f .spectrum-Accordion-itemHeader_b4e47f{cursor:default}.spectrum-Accordion-item_b4e47f{border-color:var(--spectrum-accordion-border-color,var(--spectrum-global-color-gray-300))}.spectrum-Accordion-item_b4e47f:first-of-type{border-top-color:var(--spectrum-accordion-border-color,var(--spectrum-global-color-gray-300))}.spectrum-Accordion-itemIndicator_b4e47f,.spectrum-Accordion-itemHeader_b4e47f{color:var(--spectrum-alias-text-color,var(--spectrum-global-color-gray-800))}.spectrum-Accordion-itemHeader_b4e47f.is-hovered_b4e47f{color:var(--spectrum-alias-text-color-hover,var(--spectrum-global-color-gray-900));background-color:var(--spectrum-accordion-background-color-hover,var(--spectrum-global-color-gray-200))}.spectrum-Accordion-itemHeader_b4e47f.is-hovered_b4e47f+.spectrum-Accordion-itemIndicator_b4e47f{color:var(--spectrum-alias-text-color-hover,var(--spectrum-global-color-gray-900))}.spectrum-Accordion-itemHeader_b4e47f.focus-ring_b4e47f:after{background-color:var(--spectrum-accordion-border-left-color-key-focus,var(--spectrum-alias-border-color-focus))}.spectrum-Accordion-item_b4e47f.is-open_b4e47f .spectrum-Accordion-itemHeader_b4e47f.is-hovered_b4e47f{background-color:#0000}.spectrum-Accordion-item_b4e47f.is-disabled_b4e47f .spectrum-Accordion-itemHeader_b4e47f,.spectrum-Accordion-item_b4e47f.is-disabled_b4e47f .spectrum-Accordion-itemHeader_b4e47f.is-hovered_b4e47f,.spectrum-Accordion-item_b4e47f.is-disabled_b4e47f .spectrum-Accordion-itemHeader_b4e47f.focus-ring_b4e47f{color:var(--spectrum-alias-text-color-disabled,var(--spectrum-global-color-gray-500));background-color:#0000}.spectrum-Accordion-item_b4e47f.is-disabled_b4e47f .spectrum-Accordion-itemHeader_b4e47f+.spectrum-Accordion-itemIndicator_b4e47f{color:var(--spectrum-accordion-icon-color-disabled,var(--spectrum-global-color-gray-400))}@media (forced-colors:active){.spectrum-Accordion-itemHeader_b4e47f.focus-ring_b4e47f{outline:3px solid CanvasText}}
|
package/dist/main.js
CHANGED
|
@@ -21,7 +21,28 @@ function $parcel$interopDefault(a) {
|
|
|
21
21
|
|
|
22
22
|
$parcel$export(module.exports, "Accordion", () => $d8f45715b3ce327a$export$a766cd26d0d69044);
|
|
23
23
|
$parcel$export(module.exports, "Item", () => $6boyC$reactstatelycollections.Item);
|
|
24
|
-
|
|
24
|
+
/*
|
|
25
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
26
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
27
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
28
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
+
*
|
|
30
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
31
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
32
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
33
|
+
* governing permissions and limitations under the License.
|
|
34
|
+
*/ /// <reference types="css-module-types" />
|
|
35
|
+
/*
|
|
36
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
37
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
38
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
39
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
+
*
|
|
41
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
42
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
43
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
44
|
+
* governing permissions and limitations under the License.
|
|
45
|
+
*/
|
|
25
46
|
|
|
26
47
|
|
|
27
48
|
|
|
@@ -67,65 +88,64 @@ $5ab573b23bc1d039$export$f39a09f249340e2a = "focus-ring_b4e47f";
|
|
|
67
88
|
|
|
68
89
|
|
|
69
90
|
function $d8f45715b3ce327a$var$Accordion(props, ref) {
|
|
70
|
-
props = $6boyC$reactspectrumprovider.useProviderProps(props);
|
|
71
|
-
let state = $6boyC$reactstatelytree.useTreeState(props);
|
|
72
|
-
let { styleProps: styleProps } = $6boyC$reactspectrumutils.useStyleProps(props);
|
|
73
|
-
let domRef = $6boyC$reactspectrumutils.useDOMRef(ref);
|
|
74
|
-
let { accordionProps: accordionProps } = $6boyC$reactariaaccordion.useAccordion(props, state, domRef);
|
|
75
|
-
return
|
|
76
|
-
|
|
91
|
+
props = (0, $6boyC$reactspectrumprovider.useProviderProps)(props);
|
|
92
|
+
let state = (0, $6boyC$reactstatelytree.useTreeState)(props);
|
|
93
|
+
let { styleProps: styleProps } = (0, $6boyC$reactspectrumutils.useStyleProps)(props);
|
|
94
|
+
let domRef = (0, $6boyC$reactspectrumutils.useDOMRef)(ref);
|
|
95
|
+
let { accordionProps: accordionProps } = (0, $6boyC$reactariaaccordion.useAccordion)(props, state, domRef);
|
|
96
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement("div", {
|
|
97
|
+
...(0, $6boyC$reactariautils.filterDOMProps)(props),
|
|
77
98
|
...accordionProps,
|
|
78
99
|
...styleProps,
|
|
79
100
|
ref: domRef,
|
|
80
|
-
className: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
101
|
+
className: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "spectrum-Accordion", styleProps.className)
|
|
81
102
|
}, [
|
|
82
103
|
...state.collection
|
|
83
|
-
].map((item)=>/*#__PURE__*/ ($parcel$interopDefault($6boyC$react)).createElement($d8f45715b3ce327a$var$AccordionItem, {
|
|
104
|
+
].map((item)=>/*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement($d8f45715b3ce327a$var$AccordionItem, {
|
|
84
105
|
key: item.key,
|
|
85
106
|
item: item,
|
|
86
107
|
state: state
|
|
87
|
-
})
|
|
88
|
-
)));
|
|
108
|
+
})));
|
|
89
109
|
}
|
|
90
110
|
function $d8f45715b3ce327a$var$AccordionItem(props) {
|
|
91
|
-
props = $6boyC$reactspectrumprovider.useProviderProps(props);
|
|
92
|
-
let ref = $6boyC$react.useRef();
|
|
111
|
+
props = (0, $6boyC$reactspectrumprovider.useProviderProps)(props);
|
|
112
|
+
let ref = (0, $6boyC$react.useRef)(null);
|
|
93
113
|
let { state: state , item: item } = props;
|
|
94
|
-
let { buttonProps: buttonProps , regionProps: regionProps } = $6boyC$reactariaaccordion.useAccordionItem(props, state, ref);
|
|
114
|
+
let { buttonProps: buttonProps , regionProps: regionProps } = (0, $6boyC$reactariaaccordion.useAccordionItem)(props, state, ref);
|
|
95
115
|
let isOpen = state.expandedKeys.has(item.key);
|
|
96
116
|
let isDisabled = state.disabledKeys.has(item.key);
|
|
97
|
-
let { isHovered: isHovered , hoverProps: hoverProps } = $6boyC$reactariainteractions.useHover({
|
|
117
|
+
let { isHovered: isHovered , hoverProps: hoverProps } = (0, $6boyC$reactariainteractions.useHover)({
|
|
98
118
|
isDisabled: isDisabled
|
|
99
119
|
});
|
|
100
|
-
let { direction: direction } = $6boyC$reactariai18n.useLocale();
|
|
101
|
-
return
|
|
102
|
-
className: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
103
|
-
|
|
104
|
-
|
|
120
|
+
let { direction: direction } = (0, $6boyC$reactariai18n.useLocale)();
|
|
121
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement("div", {
|
|
122
|
+
className: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "spectrum-Accordion-item", {
|
|
123
|
+
"is-open": isOpen,
|
|
124
|
+
"is-disabled": isDisabled
|
|
105
125
|
})
|
|
106
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($6boyC$react)).createElement("h3", {
|
|
107
|
-
className: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
108
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($6boyC$react)).createElement($6boyC$reactariafocus.FocusRing, {
|
|
126
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement("h3", {
|
|
127
|
+
className: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "spectrum-Accordion-itemHeading")
|
|
128
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement((0, $6boyC$reactariafocus.FocusRing), {
|
|
109
129
|
within: true,
|
|
110
|
-
focusRingClass: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
111
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($6boyC$react)).createElement("button", {
|
|
112
|
-
|
|
130
|
+
focusRingClass: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "focus-ring")
|
|
131
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement("button", {
|
|
132
|
+
...(0, $6boyC$reactariautils.mergeProps)(buttonProps, hoverProps),
|
|
113
133
|
ref: ref,
|
|
114
|
-
className: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
115
|
-
|
|
134
|
+
className: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "spectrum-Accordion-itemHeader", {
|
|
135
|
+
"is-hovered": isHovered
|
|
116
136
|
})
|
|
117
|
-
}, direction ===
|
|
137
|
+
}, direction === "ltr" ? /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement((0, ($parcel$interopDefault($6boyC$spectrumiconsuiChevronRightMedium))), {
|
|
118
138
|
"aria-hidden": "true",
|
|
119
|
-
UNSAFE_className: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
120
|
-
}) : /*#__PURE__*/ ($parcel$interopDefault($6boyC$react)).createElement(($parcel$interopDefault($6boyC$spectrumiconsuiChevronLeftMedium)), {
|
|
139
|
+
UNSAFE_className: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "spectrum-Accordion-itemIndicator")
|
|
140
|
+
}) : /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement((0, ($parcel$interopDefault($6boyC$spectrumiconsuiChevronLeftMedium))), {
|
|
121
141
|
"aria-hidden": "true",
|
|
122
|
-
UNSAFE_className: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
123
|
-
}), item.props.title))), /*#__PURE__*/ ($parcel$interopDefault($6boyC$react)).createElement("div", {
|
|
142
|
+
UNSAFE_className: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "spectrum-Accordion-itemIndicator")
|
|
143
|
+
}), item.props.title))), /*#__PURE__*/ (0, ($parcel$interopDefault($6boyC$react))).createElement("div", {
|
|
124
144
|
...regionProps,
|
|
125
|
-
className: $6boyC$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports)),
|
|
126
|
-
}, item.props.children))
|
|
145
|
+
className: (0, $6boyC$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5ab573b23bc1d039$exports))), "spectrum-Accordion-itemContent")
|
|
146
|
+
}, item.props.children));
|
|
127
147
|
}
|
|
128
|
-
const $d8f45715b3ce327a$export$a766cd26d0d69044 = /*#__PURE__*/ $6boyC$react.forwardRef($d8f45715b3ce327a$var$Accordion);
|
|
148
|
+
const $d8f45715b3ce327a$export$a766cd26d0d69044 = /*#__PURE__*/ (0, $6boyC$react.forwardRef)($d8f45715b3ce327a$var$Accordion);
|
|
129
149
|
|
|
130
150
|
|
|
131
151
|
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"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","sources":["packages/@react-spectrum/accordion/src/index.ts","packages/@react-spectrum/accordion/src/Accordion.tsx","packages/@adobe/spectrum-css-temp/components/accordion/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Accordion} from './Accordion';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumAccordionProps} from '@react-types/accordion';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, Node} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useRef} from 'react';\nimport {SpectrumAccordionProps} from '@react-types/accordion';\nimport styles from '@adobe/spectrum-css-temp/components/accordion/vars.css';\nimport {TreeState, useTreeState} from '@react-stately/tree';\nimport {useAccordion, useAccordionItem} from '@react-aria/accordion';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n\nfunction Accordion<T extends object>(props: SpectrumAccordionProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let state = useTreeState<T>(props);\n let {styleProps} = useStyleProps(props);\n let domRef = useDOMRef(ref);\n let {accordionProps} = useAccordion(props, state, domRef);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...accordionProps}\n {...styleProps}\n ref={domRef}\n className={classNames(styles, 'spectrum-Accordion', styleProps.className)}>\n {[...state.collection].map(item => (\n <AccordionItem<T> key={item.key} item={item} state={state} />\n ))}\n </div>\n );\n}\n\ninterface AccordionItemProps<T> {\n item: Node<T>,\n state: TreeState<T>\n}\n\nfunction AccordionItem<T>(props: AccordionItemProps<T>) {\n props = useProviderProps(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {state, item} = props;\n let {buttonProps, regionProps} = useAccordionItem<T>(props, state, ref);\n let isOpen = state.expandedKeys.has(item.key);\n let isDisabled = state.disabledKeys.has(item.key);\n let {isHovered, hoverProps} = useHover({isDisabled});\n let {direction} = useLocale();\n\n return (\n <div\n className={classNames(styles, 'spectrum-Accordion-item', {\n 'is-open': isOpen,\n 'is-disabled': isDisabled\n })}>\n <h3 className={classNames(styles, 'spectrum-Accordion-itemHeading')}>\n <FocusRing within focusRingClass={classNames(styles, 'focus-ring')}>\n <button\n {...mergeProps(buttonProps, hoverProps)}\n ref={ref}\n className={classNames(styles, 'spectrum-Accordion-itemHeader', {\n 'is-hovered': isHovered\n })}>\n {direction === 'ltr' ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(styles, 'spectrum-Accordion-itemIndicator')} />\n ) : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(styles, 'spectrum-Accordion-itemIndicator')} />\n )}\n {item.props.title}\n </button>\n </FocusRing>\n </h3>\n <div {...regionProps} className={classNames(styles, 'spectrum-Accordion-itemContent')}>\n {item.props.children}\n </div>\n </div>\n );\n}\n\nconst _Accordion = forwardRef(Accordion) as <T>(props: SpectrumAccordionProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReturnType<typeof Accordion>;\nexport {_Accordion as Accordion};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -18,7 +18,28 @@ function $parcel$interopDefault(a) {
|
|
|
18
18
|
function $parcel$export(e, n, v, s) {
|
|
19
19
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
/*
|
|
22
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
23
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
+
* governing permissions and limitations under the License.
|
|
31
|
+
*/ /// <reference types="css-module-types" />
|
|
32
|
+
/*
|
|
33
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
34
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
36
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
37
|
+
*
|
|
38
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
39
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
40
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
41
|
+
* governing permissions and limitations under the License.
|
|
42
|
+
*/
|
|
22
43
|
|
|
23
44
|
|
|
24
45
|
|
|
@@ -64,65 +85,64 @@ $cd9bb50514faf076$export$f39a09f249340e2a = "focus-ring_b4e47f";
|
|
|
64
85
|
|
|
65
86
|
|
|
66
87
|
function $2a5a5b7faca81754$var$Accordion(props, ref) {
|
|
67
|
-
props = $3Uu4R$useProviderProps(props);
|
|
68
|
-
let state = $3Uu4R$useTreeState(props);
|
|
69
|
-
let { styleProps: styleProps } = $3Uu4R$useStyleProps(props);
|
|
70
|
-
let domRef = $3Uu4R$useDOMRef(ref);
|
|
71
|
-
let { accordionProps: accordionProps } = $3Uu4R$useAccordion(props, state, domRef);
|
|
72
|
-
return
|
|
73
|
-
|
|
88
|
+
props = (0, $3Uu4R$useProviderProps)(props);
|
|
89
|
+
let state = (0, $3Uu4R$useTreeState)(props);
|
|
90
|
+
let { styleProps: styleProps } = (0, $3Uu4R$useStyleProps)(props);
|
|
91
|
+
let domRef = (0, $3Uu4R$useDOMRef)(ref);
|
|
92
|
+
let { accordionProps: accordionProps } = (0, $3Uu4R$useAccordion)(props, state, domRef);
|
|
93
|
+
return /*#__PURE__*/ (0, $3Uu4R$react).createElement("div", {
|
|
94
|
+
...(0, $3Uu4R$filterDOMProps)(props),
|
|
74
95
|
...accordionProps,
|
|
75
96
|
...styleProps,
|
|
76
97
|
ref: domRef,
|
|
77
|
-
className: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
98
|
+
className: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "spectrum-Accordion", styleProps.className)
|
|
78
99
|
}, [
|
|
79
100
|
...state.collection
|
|
80
|
-
].map((item)=>/*#__PURE__*/ $3Uu4R$react.createElement($2a5a5b7faca81754$var$AccordionItem, {
|
|
101
|
+
].map((item)=>/*#__PURE__*/ (0, $3Uu4R$react).createElement($2a5a5b7faca81754$var$AccordionItem, {
|
|
81
102
|
key: item.key,
|
|
82
103
|
item: item,
|
|
83
104
|
state: state
|
|
84
|
-
})
|
|
85
|
-
)));
|
|
105
|
+
})));
|
|
86
106
|
}
|
|
87
107
|
function $2a5a5b7faca81754$var$AccordionItem(props) {
|
|
88
|
-
props = $3Uu4R$useProviderProps(props);
|
|
89
|
-
let ref = $3Uu4R$useRef();
|
|
108
|
+
props = (0, $3Uu4R$useProviderProps)(props);
|
|
109
|
+
let ref = (0, $3Uu4R$useRef)(null);
|
|
90
110
|
let { state: state , item: item } = props;
|
|
91
|
-
let { buttonProps: buttonProps , regionProps: regionProps } = $3Uu4R$useAccordionItem(props, state, ref);
|
|
111
|
+
let { buttonProps: buttonProps , regionProps: regionProps } = (0, $3Uu4R$useAccordionItem)(props, state, ref);
|
|
92
112
|
let isOpen = state.expandedKeys.has(item.key);
|
|
93
113
|
let isDisabled = state.disabledKeys.has(item.key);
|
|
94
|
-
let { isHovered: isHovered , hoverProps: hoverProps } = $3Uu4R$useHover({
|
|
114
|
+
let { isHovered: isHovered , hoverProps: hoverProps } = (0, $3Uu4R$useHover)({
|
|
95
115
|
isDisabled: isDisabled
|
|
96
116
|
});
|
|
97
|
-
let { direction: direction } = $3Uu4R$useLocale();
|
|
98
|
-
return
|
|
99
|
-
className: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
100
|
-
|
|
101
|
-
|
|
117
|
+
let { direction: direction } = (0, $3Uu4R$useLocale)();
|
|
118
|
+
return /*#__PURE__*/ (0, $3Uu4R$react).createElement("div", {
|
|
119
|
+
className: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "spectrum-Accordion-item", {
|
|
120
|
+
"is-open": isOpen,
|
|
121
|
+
"is-disabled": isDisabled
|
|
102
122
|
})
|
|
103
|
-
}, /*#__PURE__*/ $3Uu4R$react.createElement("h3", {
|
|
104
|
-
className: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
105
|
-
}, /*#__PURE__*/ $3Uu4R$react.createElement($3Uu4R$FocusRing, {
|
|
123
|
+
}, /*#__PURE__*/ (0, $3Uu4R$react).createElement("h3", {
|
|
124
|
+
className: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "spectrum-Accordion-itemHeading")
|
|
125
|
+
}, /*#__PURE__*/ (0, $3Uu4R$react).createElement((0, $3Uu4R$FocusRing), {
|
|
106
126
|
within: true,
|
|
107
|
-
focusRingClass: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
108
|
-
}, /*#__PURE__*/ $3Uu4R$react.createElement("button", {
|
|
109
|
-
|
|
127
|
+
focusRingClass: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "focus-ring")
|
|
128
|
+
}, /*#__PURE__*/ (0, $3Uu4R$react).createElement("button", {
|
|
129
|
+
...(0, $3Uu4R$mergeProps)(buttonProps, hoverProps),
|
|
110
130
|
ref: ref,
|
|
111
|
-
className: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
112
|
-
|
|
131
|
+
className: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "spectrum-Accordion-itemHeader", {
|
|
132
|
+
"is-hovered": isHovered
|
|
113
133
|
})
|
|
114
|
-
}, direction ===
|
|
134
|
+
}, direction === "ltr" ? /*#__PURE__*/ (0, $3Uu4R$react).createElement((0, $3Uu4R$spectrumiconsuiChevronRightMedium), {
|
|
115
135
|
"aria-hidden": "true",
|
|
116
|
-
UNSAFE_className: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
117
|
-
}) : /*#__PURE__*/ $3Uu4R$react.createElement($3Uu4R$spectrumiconsuiChevronLeftMedium, {
|
|
136
|
+
UNSAFE_className: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "spectrum-Accordion-itemIndicator")
|
|
137
|
+
}) : /*#__PURE__*/ (0, $3Uu4R$react).createElement((0, $3Uu4R$spectrumiconsuiChevronLeftMedium), {
|
|
118
138
|
"aria-hidden": "true",
|
|
119
|
-
UNSAFE_className: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
120
|
-
}), item.props.title))), /*#__PURE__*/ $3Uu4R$react.createElement("div", {
|
|
139
|
+
UNSAFE_className: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "spectrum-Accordion-itemIndicator")
|
|
140
|
+
}), item.props.title))), /*#__PURE__*/ (0, $3Uu4R$react).createElement("div", {
|
|
121
141
|
...regionProps,
|
|
122
|
-
className: $3Uu4R$classNames((/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports)),
|
|
123
|
-
}, item.props.children))
|
|
142
|
+
className: (0, $3Uu4R$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd9bb50514faf076$exports))), "spectrum-Accordion-itemContent")
|
|
143
|
+
}, item.props.children));
|
|
124
144
|
}
|
|
125
|
-
const $2a5a5b7faca81754$export$a766cd26d0d69044 = /*#__PURE__*/ $3Uu4R$forwardRef($2a5a5b7faca81754$var$Accordion);
|
|
145
|
+
const $2a5a5b7faca81754$export$a766cd26d0d69044 = /*#__PURE__*/ (0, $3Uu4R$forwardRef)($2a5a5b7faca81754$var$Accordion);
|
|
126
146
|
|
|
127
147
|
|
|
128
148
|
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"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","sources":["packages/@react-spectrum/accordion/src/index.ts","packages/@react-spectrum/accordion/src/Accordion.tsx","packages/@adobe/spectrum-css-temp/components/accordion/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Accordion} from './Accordion';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumAccordionProps} from '@react-types/accordion';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, Node} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useRef} from 'react';\nimport {SpectrumAccordionProps} from '@react-types/accordion';\nimport styles from '@adobe/spectrum-css-temp/components/accordion/vars.css';\nimport {TreeState, useTreeState} from '@react-stately/tree';\nimport {useAccordion, useAccordionItem} from '@react-aria/accordion';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n\nfunction Accordion<T extends object>(props: SpectrumAccordionProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let state = useTreeState<T>(props);\n let {styleProps} = useStyleProps(props);\n let domRef = useDOMRef(ref);\n let {accordionProps} = useAccordion(props, state, domRef);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...accordionProps}\n {...styleProps}\n ref={domRef}\n className={classNames(styles, 'spectrum-Accordion', styleProps.className)}>\n {[...state.collection].map(item => (\n <AccordionItem<T> key={item.key} item={item} state={state} />\n ))}\n </div>\n );\n}\n\ninterface AccordionItemProps<T> {\n item: Node<T>,\n state: TreeState<T>\n}\n\nfunction AccordionItem<T>(props: AccordionItemProps<T>) {\n props = useProviderProps(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {state, item} = props;\n let {buttonProps, regionProps} = useAccordionItem<T>(props, state, ref);\n let isOpen = state.expandedKeys.has(item.key);\n let isDisabled = state.disabledKeys.has(item.key);\n let {isHovered, hoverProps} = useHover({isDisabled});\n let {direction} = useLocale();\n\n return (\n <div\n className={classNames(styles, 'spectrum-Accordion-item', {\n 'is-open': isOpen,\n 'is-disabled': isDisabled\n })}>\n <h3 className={classNames(styles, 'spectrum-Accordion-itemHeading')}>\n <FocusRing within focusRingClass={classNames(styles, 'focus-ring')}>\n <button\n {...mergeProps(buttonProps, hoverProps)}\n ref={ref}\n className={classNames(styles, 'spectrum-Accordion-itemHeader', {\n 'is-hovered': isHovered\n })}>\n {direction === 'ltr' ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(styles, 'spectrum-Accordion-itemIndicator')} />\n ) : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(styles, 'spectrum-Accordion-itemIndicator')} />\n )}\n {item.props.title}\n </button>\n </FocusRing>\n </h3>\n <div {...regionProps} className={classNames(styles, 'spectrum-Accordion-itemContent')}>\n {item.props.children}\n </div>\n </div>\n );\n}\n\nconst _Accordion = forwardRef(Accordion) as <T>(props: SpectrumAccordionProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReturnType<typeof Accordion>;\nexport {_Accordion as Accordion};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/accordion",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.16",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"url": "https://github.com/adobe/react-spectrum"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@react-aria/
|
|
36
|
-
"@react-aria/
|
|
37
|
-
"@react-aria/
|
|
38
|
-
"@react-aria/
|
|
39
|
-
"@react-
|
|
40
|
-
"@react-
|
|
41
|
-
"@react-stately/
|
|
42
|
-
"@react-stately/tree": "^3.4.0",
|
|
34
|
+
"@react-aria/accordion": "3.0.0-alpha.14",
|
|
35
|
+
"@react-aria/focus": "^3.10.1",
|
|
36
|
+
"@react-aria/i18n": "^3.6.3",
|
|
37
|
+
"@react-aria/interactions": "^3.13.1",
|
|
38
|
+
"@react-aria/utils": "^3.14.2",
|
|
39
|
+
"@react-spectrum/utils": "^3.8.1",
|
|
40
|
+
"@react-stately/collections": "^3.5.1",
|
|
41
|
+
"@react-stately/tree": "^3.4.1",
|
|
43
42
|
"@react-types/accordion": "3.0.0-alpha.11",
|
|
44
43
|
"@react-types/shared": "^3.16.0",
|
|
45
|
-
"@spectrum-icons/ui": "^3.4.
|
|
44
|
+
"@spectrum-icons/ui": "^3.4.2",
|
|
45
|
+
"@swc/helpers": "^0.4.14"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "79f62e8fbf64e8359fb603f3a1cc41a2808389e2"
|
|
58
58
|
}
|
package/src/Accordion.tsx
CHANGED
|
@@ -54,7 +54,7 @@ interface AccordionItemProps<T> {
|
|
|
54
54
|
|
|
55
55
|
function AccordionItem<T>(props: AccordionItemProps<T>) {
|
|
56
56
|
props = useProviderProps(props);
|
|
57
|
-
let ref = useRef<HTMLButtonElement>();
|
|
57
|
+
let ref = useRef<HTMLButtonElement>(null);
|
|
58
58
|
let {state, item} = props;
|
|
59
59
|
let {buttonProps, regionProps} = useAccordionItem<T>(props, state, ref);
|
|
60
60
|
let isOpen = state.expandedKeys.has(item.key);
|