@react-spectrum/tag 3.2.10 → 3.2.12
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/Tag.main.js +1 -1
- package/dist/Tag.mjs +1 -1
- package/dist/Tag.module.js +1 -1
- package/dist/TagGroup.main.js +4 -5
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +4 -5
- package/dist/TagGroup.module.js +4 -5
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/tags_vars_css.main.js +26 -26
- package/dist/tags_vars_css.main.js.map +1 -1
- package/dist/tags_vars_css.mjs +26 -26
- package/dist/tags_vars_css.module.js +26 -26
- package/dist/tags_vars_css.module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/{vars.f5ba1a45.css → vars.c220ab26.css} +52 -51
- package/dist/vars.c220ab26.css.map +1 -0
- package/package.json +18 -18
- package/src/TagGroup.tsx +7 -10
- package/dist/vars.f5ba1a45.css.map +0 -1
package/dist/Tag.main.js
CHANGED
package/dist/Tag.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./vars.
|
|
1
|
+
import "./vars.c220ab26.css";
|
|
2
2
|
import $X1F04$tags_vars_cssmodulejs from "./tags_vars_css.mjs";
|
|
3
3
|
import {useTag as $X1F04$useTag} from "@react-aria/tag";
|
|
4
4
|
import {useStyleProps as $X1F04$useStyleProps, classNames as $X1F04$classNames, SlotProvider as $X1F04$SlotProvider, ClearSlots as $X1F04$ClearSlots} from "@react-spectrum/utils";
|
package/dist/Tag.module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./vars.
|
|
1
|
+
import "./vars.c220ab26.css";
|
|
2
2
|
import $X1F04$tags_vars_cssmodulejs from "./tags_vars_css.module.js";
|
|
3
3
|
import {useTag as $X1F04$useTag} from "@react-aria/tag";
|
|
4
4
|
import {useStyleProps as $X1F04$useStyleProps, classNames as $X1F04$classNames, SlotProvider as $X1F04$SlotProvider, ClearSlots as $X1F04$ClearSlots} from "@react-spectrum/utils";
|
package/dist/TagGroup.main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var $a85da3418799ba7d$exports = require("./intlStrings.main.js");
|
|
2
|
-
require("./vars.
|
|
2
|
+
require("./vars.c220ab26.css");
|
|
3
3
|
var $ed889f8f1f091fc8$exports = require("./tags_vars_css.main.js");
|
|
4
4
|
var $dd2c5d00108c1840$exports = require("./Tag.main.js");
|
|
5
5
|
var $gBwi7$reactspectrumbutton = require("@react-spectrum/button");
|
|
@@ -60,7 +60,7 @@ const $e7b72d8874e98cd4$var$TAG_STYLES = {
|
|
|
60
60
|
margin: 5
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
const $e7b72d8874e98cd4$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, ($parcel$interopDefault($gBwi7$react))).forwardRef(function TagGroup(props, ref) {
|
|
64
64
|
props = (0, $gBwi7$reactspectrumprovider.useProviderProps)(props);
|
|
65
65
|
props = (0, $gBwi7$reactspectrumform.useFormProps)(props);
|
|
66
66
|
let { maxRows: maxRows, children: children, actionLabel: actionLabel, onAction: onAction, labelPosition: labelPosition, renderEmptyState: renderEmptyState = ()=>stringFormatter.format('noTags') } = props;
|
|
@@ -136,7 +136,7 @@ function $e7b72d8874e98cd4$var$TagGroup(props, ref) {
|
|
|
136
136
|
let buttons = [
|
|
137
137
|
...currActionsRef.children
|
|
138
138
|
];
|
|
139
|
-
if (maxRows && buttons.length > 0 && rowCount >= maxRows) {
|
|
139
|
+
if (maxRows && buttons.length > 0 && rowCount >= maxRows && currContainerRef.parentElement) {
|
|
140
140
|
var _tags_;
|
|
141
141
|
let buttonsWidth = buttons.reduce((acc, curr)=>acc += curr.getBoundingClientRect().width, 0);
|
|
142
142
|
buttonsWidth += $e7b72d8874e98cd4$var$TAG_STYLES[scale].margin * 2 * buttons.length;
|
|
@@ -263,8 +263,7 @@ function $e7b72d8874e98cd4$var$TagGroup(props, ref) {
|
|
|
263
263
|
onPress: ()=>onAction === null || onAction === void 0 ? void 0 : onAction(),
|
|
264
264
|
UNSAFE_className: (0, $gBwi7$reactspectrumutils.classNames)((0, ($parcel$interopDefault($ed889f8f1f091fc8$exports))), 'spectrum-Tags-actionButton')
|
|
265
265
|
}, actionLabel))))));
|
|
266
|
-
}
|
|
267
|
-
/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */ const $e7b72d8874e98cd4$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, ($parcel$interopDefault($gBwi7$react))).forwardRef($e7b72d8874e98cd4$var$TagGroup);
|
|
266
|
+
});
|
|
268
267
|
|
|
269
268
|
|
|
270
269
|
//# sourceMappingURL=TagGroup.main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAoBD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAaA,SAAS,+BAA2B,KAA+B,EAAE,GAA2B;IAC9F,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,WACF,OAAO,YACP,QAAQ,eACR,WAAW,YACX,QAAQ,iBACR,aAAa,oBACb,mBAAmB,IAAM,gBAAgB,MAAM,CAAC,WACjD,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAC1B,IAAI,UAAU,CAAA,GAAA,mBAAK,EAAyB;IAC5C,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,wCAAU;IACxB,IAAI,kBAAkB,CAAA,GAAA,gDAA0B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U,CAAC,IAAI;IAAA,KAC7E,gBAAgB,MAAM,CAAC,qBAI5B,eAAe,0BACd,0DAAC,CAAA,GAAA,uCAAW;QACV,SAAA;QACA,SAAS,IAAM,qBAAA,+BAAA;QACf,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACpC;AAUrB;AAEA,4IAA4I,GAC5I,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/tag/src/TagGroup.tsx"],"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\nimport {ActionButton} from '@react-spectrum/button';\nimport {AriaTagGroupProps, useTagGroup} from '@react-aria/tag';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {Collection, DOMRef, Node, SpectrumLabelableProps, StyleProps, Validation} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing, FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListCollection, useListState} from '@react-stately/list';\nimport {ListKeyboardDelegate} from '@react-aria/selection';\nimport {Provider, useProvider, useProviderProps} from '@react-spectrum/provider';\nimport React, {JSX, ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useId, useLayoutEffect, useResizeObserver, useValueEffect} from '@react-aria/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T> extends Omit<AriaTagGroupProps<T>, 'selectionMode' | 'disallowEmptySelection' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'selectionBehavior' | 'disabledKeys'>, StyleProps, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void,\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number\n}\n\nfunction TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({visibleTagCount: state.collection.size, showCollapseButton: false});\n let keyboardDelegate = useMemo(() => {\n let collection = (isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: domRef,\n direction,\n orientation: 'horizontal'\n });\n }, [direction, isCollapsed, state.collection, tagState.visibleTagCount, domRef]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup({...props, keyboardDelegate}, state, tagsRef);\n let actionsId = useId();\n let actionsRef = useRef(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (maxRows && buttons.length > 0 && rowCount >= maxRows) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop();\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function *() {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(() =>\n [...state.collection].slice(0, isCollapsed ? tagState.visibleTagCount : state.collection.size),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + (TAG_STYLES[scale].margin * 2)) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={\n classNames(\n styles,\n 'spectrum-Tags-fieldWrapper',\n {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n }\n )\n }>\n <div\n ref={containerRef}\n style={containerStyle}\n className={\n classNames(\n styles,\n 'spectrum-Tags-container',\n {\n 'spectrum-Tags-container--empty': isEmpty\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div\n ref={tagsRef}\n {...gridProps}\n className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag\n {...item.props}\n key={item.key}\n item={item}\n state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty &&\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed ?\n stringFormatter.format('showAllButtonLabel', {tagCount: state.collection.size}) :\n stringFormatter.format('hideButtonLabel')\n }\n </ActionButton>\n }\n {actionLabel && onAction &&\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n }\n </div>\n </Provider>\n }\n </div>\n </Field>\n </FocusScope>\n );\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nconst _TagGroup = React.forwardRef(TagGroup) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_TagGroup as TagGroup};\n"],"names":[],"version":3,"file":"TagGroup.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAoBD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAcO,MAAM,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,SAA2B,KAA+B,EAAE,GAA2B;IACvI,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,WACF,OAAO,YACP,QAAQ,eACR,WAAW,YACX,QAAQ,iBACR,aAAa,oBAC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AY,gBAAgB,MAAM,CAAC;QACnC,mBAAiB,GAAG,UAAU,EAAE,CAAC,CAAC,EAAE,WAAW;QAC/C,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAC7B,SAAS,kBAAkB,kBAC1B,0DAAC,CAAA,GAAA,uCAAW;QACV,SAAA;QACA,SAAS;QACT,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACpC,cACC,gBAAgB,MAAM,CAAC,sBAAsB;QAAC,UAAU,MAAM,UAAU,CAAC,IAAI;IAAA,KAC7E,gBAAgB,MAAM,CAAC,qBAI5B,eAAe,0BACd,0DAAC,CAAA,GAAA,uCAAW;QACV,SAAA;QACA,SAAS,IAAM,qBAAA,+BAAA;QACf,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACpC;AAUrB","sources":["packages/@react-spectrum/tag/src/TagGroup.tsx"],"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\nimport {ActionButton} from '@react-spectrum/button';\nimport {AriaTagGroupProps, useTagGroup} from '@react-aria/tag';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {Collection, DOMRef, Node, SpectrumLabelableProps, StyleProps, Validation} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing, FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListCollection, useListState} from '@react-stately/list';\nimport {ListKeyboardDelegate} from '@react-aria/selection';\nimport {Provider, useProvider, useProviderProps} from '@react-spectrum/provider';\nimport React, {JSX, ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useId, useLayoutEffect, useResizeObserver, useValueEffect} from '@react-aria/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T> extends Omit<AriaTagGroupProps<T>, 'selectionMode' | 'disallowEmptySelection' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'selectionBehavior' | 'disabledKeys'>, StyleProps, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void,\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nexport const TagGroup = React.forwardRef(function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef<HTMLDivElement>(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({visibleTagCount: state.collection.size, showCollapseButton: false});\n let keyboardDelegate = useMemo(() => {\n let collection = (isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: domRef,\n direction,\n orientation: 'horizontal'\n });\n }, [direction, isCollapsed, state.collection, tagState.visibleTagCount, domRef]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup({...props, keyboardDelegate}, state, tagsRef);\n let actionsId = useId();\n let actionsRef = useRef<HTMLDivElement>(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (maxRows && buttons.length > 0 && rowCount >= maxRows && currContainerRef.parentElement) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop()!;\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function *() {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(() =>\n [...state.collection].slice(0, isCollapsed ? tagState.visibleTagCount : state.collection.size),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + (TAG_STYLES[scale].margin * 2)) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={\n classNames(\n styles,\n 'spectrum-Tags-fieldWrapper',\n {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n }\n )\n }>\n <div\n ref={containerRef}\n style={containerStyle}\n className={\n classNames(\n styles,\n 'spectrum-Tags-container',\n {\n 'spectrum-Tags-container--empty': isEmpty\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div\n ref={tagsRef}\n {...gridProps}\n className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag\n {...item.props}\n key={item.key}\n item={item}\n state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty &&\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed ?\n stringFormatter.format('showAllButtonLabel', {tagCount: state.collection.size}) :\n stringFormatter.format('hideButtonLabel')\n }\n </ActionButton>\n }\n {actionLabel && onAction &&\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n }\n </div>\n </Provider>\n }\n </div>\n </Field>\n </FocusScope>\n );\n}) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"TagGroup.main.js.map"}
|
package/dist/TagGroup.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import $jTkY3$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
-
import "./vars.
|
|
2
|
+
import "./vars.c220ab26.css";
|
|
3
3
|
import $jTkY3$tags_vars_cssmodulejs from "./tags_vars_css.mjs";
|
|
4
4
|
import {Tag as $b5f5ee35d3b6b95c$export$3288d34c523a1192} from "./Tag.mjs";
|
|
5
5
|
import {ActionButton as $jTkY3$ActionButton} from "@react-spectrum/button";
|
|
@@ -54,7 +54,7 @@ const $880d112c7a588209$var$TAG_STYLES = {
|
|
|
54
54
|
margin: 5
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
const $880d112c7a588209$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $jTkY3$react).forwardRef(function TagGroup(props, ref) {
|
|
58
58
|
props = (0, $jTkY3$useProviderProps)(props);
|
|
59
59
|
props = (0, $jTkY3$useFormProps)(props);
|
|
60
60
|
let { maxRows: maxRows, children: children, actionLabel: actionLabel, onAction: onAction, labelPosition: labelPosition, renderEmptyState: renderEmptyState = ()=>stringFormatter.format('noTags') } = props;
|
|
@@ -130,7 +130,7 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
130
130
|
let buttons = [
|
|
131
131
|
...currActionsRef.children
|
|
132
132
|
];
|
|
133
|
-
if (maxRows && buttons.length > 0 && rowCount >= maxRows) {
|
|
133
|
+
if (maxRows && buttons.length > 0 && rowCount >= maxRows && currContainerRef.parentElement) {
|
|
134
134
|
var _tags_;
|
|
135
135
|
let buttonsWidth = buttons.reduce((acc, curr)=>acc += curr.getBoundingClientRect().width, 0);
|
|
136
136
|
buttonsWidth += $880d112c7a588209$var$TAG_STYLES[scale].margin * 2 * buttons.length;
|
|
@@ -257,8 +257,7 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
257
257
|
onPress: ()=>onAction === null || onAction === void 0 ? void 0 : onAction(),
|
|
258
258
|
UNSAFE_className: (0, $jTkY3$classNames)((0, ($parcel$interopDefault($jTkY3$tags_vars_cssmodulejs))), 'spectrum-Tags-actionButton')
|
|
259
259
|
}, actionLabel))))));
|
|
260
|
-
}
|
|
261
|
-
/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */ const $880d112c7a588209$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $jTkY3$react).forwardRef($880d112c7a588209$var$TagGroup);
|
|
260
|
+
});
|
|
262
261
|
|
|
263
262
|
|
|
264
263
|
export {$880d112c7a588209$export$67ea30858aaf75e3 as TagGroup};
|
package/dist/TagGroup.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import $jTkY3$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
-
import "./vars.
|
|
2
|
+
import "./vars.c220ab26.css";
|
|
3
3
|
import $jTkY3$tags_vars_cssmodulejs from "./tags_vars_css.module.js";
|
|
4
4
|
import {Tag as $b5f5ee35d3b6b95c$export$3288d34c523a1192} from "./Tag.module.js";
|
|
5
5
|
import {ActionButton as $jTkY3$ActionButton} from "@react-spectrum/button";
|
|
@@ -54,7 +54,7 @@ const $880d112c7a588209$var$TAG_STYLES = {
|
|
|
54
54
|
margin: 5
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
const $880d112c7a588209$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $jTkY3$react).forwardRef(function TagGroup(props, ref) {
|
|
58
58
|
props = (0, $jTkY3$useProviderProps)(props);
|
|
59
59
|
props = (0, $jTkY3$useFormProps)(props);
|
|
60
60
|
let { maxRows: maxRows, children: children, actionLabel: actionLabel, onAction: onAction, labelPosition: labelPosition, renderEmptyState: renderEmptyState = ()=>stringFormatter.format('noTags') } = props;
|
|
@@ -130,7 +130,7 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
130
130
|
let buttons = [
|
|
131
131
|
...currActionsRef.children
|
|
132
132
|
];
|
|
133
|
-
if (maxRows && buttons.length > 0 && rowCount >= maxRows) {
|
|
133
|
+
if (maxRows && buttons.length > 0 && rowCount >= maxRows && currContainerRef.parentElement) {
|
|
134
134
|
var _tags_;
|
|
135
135
|
let buttonsWidth = buttons.reduce((acc, curr)=>acc += curr.getBoundingClientRect().width, 0);
|
|
136
136
|
buttonsWidth += $880d112c7a588209$var$TAG_STYLES[scale].margin * 2 * buttons.length;
|
|
@@ -257,8 +257,7 @@ function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
|
257
257
|
onPress: ()=>onAction === null || onAction === void 0 ? void 0 : onAction(),
|
|
258
258
|
UNSAFE_className: (0, $jTkY3$classNames)((0, ($parcel$interopDefault($jTkY3$tags_vars_cssmodulejs))), 'spectrum-Tags-actionButton')
|
|
259
259
|
}, actionLabel))))));
|
|
260
|
-
}
|
|
261
|
-
/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */ const $880d112c7a588209$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $jTkY3$react).forwardRef($880d112c7a588209$var$TagGroup);
|
|
260
|
+
});
|
|
262
261
|
|
|
263
262
|
|
|
264
263
|
export {$880d112c7a588209$export$67ea30858aaf75e3 as TagGroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAoBD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAaA,SAAS,+BAA2B,KAA+B,EAAE,GAA2B;IAC9F,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,IAAI,WACF,OAAO,YACP,QAAQ,eACR,WAAW,YACX,QAAQ,iBACR,aAAa,oBACb,mBAAmB,IAAM,gBAAgB,MAAM,CAAC,WACjD,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,UAAU,CAAA,GAAA,aAAK,EAAyB;IAC5C,IAAI,aAAC,SAAS,EAAC,GAAG,CAA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AA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OACpC,cACC,gBAAgB,MAAM,CAAC,sBAAsB;QAAC,UAAU,MAAM,UAAU,CAAC,IAAI;IAAA,KAC7E,gBAAgB,MAAM,CAAC,qBAI5B,eAAe,0BACd,gCAAC,CAAA,GAAA,mBAAW;QACV,SAAA;QACA,SAAS,IAAM,qBAAA,+BAAA;QACf,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OACpC;AAUrB;AAEA,4IAA4I,GAC5I,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/tag/src/TagGroup.tsx"],"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\nimport {ActionButton} from '@react-spectrum/button';\nimport {AriaTagGroupProps, useTagGroup} from '@react-aria/tag';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {Collection, DOMRef, Node, SpectrumLabelableProps, StyleProps, Validation} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing, FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListCollection, useListState} from '@react-stately/list';\nimport {ListKeyboardDelegate} from '@react-aria/selection';\nimport {Provider, useProvider, useProviderProps} from '@react-spectrum/provider';\nimport React, {JSX, ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useId, useLayoutEffect, useResizeObserver, useValueEffect} from '@react-aria/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T> extends Omit<AriaTagGroupProps<T>, 'selectionMode' | 'disallowEmptySelection' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'selectionBehavior' | 'disabledKeys'>, StyleProps, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void,\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number\n}\n\nfunction TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({visibleTagCount: state.collection.size, showCollapseButton: false});\n let keyboardDelegate = useMemo(() => {\n let collection = (isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: domRef,\n direction,\n orientation: 'horizontal'\n });\n }, [direction, isCollapsed, state.collection, tagState.visibleTagCount, domRef]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup({...props, keyboardDelegate}, state, tagsRef);\n let actionsId = useId();\n let actionsRef = useRef(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (maxRows && buttons.length > 0 && rowCount >= maxRows) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop();\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function *() {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(() =>\n [...state.collection].slice(0, isCollapsed ? tagState.visibleTagCount : state.collection.size),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + (TAG_STYLES[scale].margin * 2)) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={\n classNames(\n styles,\n 'spectrum-Tags-fieldWrapper',\n {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n }\n )\n }>\n <div\n ref={containerRef}\n style={containerStyle}\n className={\n classNames(\n styles,\n 'spectrum-Tags-container',\n {\n 'spectrum-Tags-container--empty': isEmpty\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div\n ref={tagsRef}\n {...gridProps}\n className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag\n {...item.props}\n key={item.key}\n item={item}\n state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty &&\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed ?\n stringFormatter.format('showAllButtonLabel', {tagCount: state.collection.size}) :\n stringFormatter.format('hideButtonLabel')\n }\n </ActionButton>\n }\n {actionLabel && onAction &&\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n }\n </div>\n </Provider>\n }\n </div>\n </Field>\n </FocusScope>\n );\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nconst _TagGroup = React.forwardRef(TagGroup) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_TagGroup as TagGroup};\n"],"names":[],"version":3,"file":"TagGroup.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAoBD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAcO,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAA2B,KAA+B,EAAE,GAA2B;IACvI,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA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A,GAAA,eAAO;QAAE,YAAY;qBACpB,gCAAC;QACC,MAAK;QACL,KAAK;QACL,IAAI;QACJ,cAAY,gBAAgB,MAAM,CAAC;QACnC,mBAAiB,GAAG,UAAU,EAAE,CAAC,CAAC,EAAE,WAAW;QAC/C,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OAC7B,SAAS,kBAAkB,kBAC1B,gCAAC,CAAA,GAAA,mBAAW;QACV,SAAA;QACA,SAAS;QACT,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OACpC,cACC,gBAAgB,MAAM,CAAC,sBAAsB;QAAC,UAAU,MAAM,UAAU,CAAC,IAAI;IAAA,KAC7E,gBAAgB,MAAM,CAAC,qBAI5B,eAAe,0BACd,gCAAC,CAAA,GAAA,mBAAW;QACV,SAAA;QACA,SAAS,IAAM,qBAAA,+BAAA;QACf,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OACpC;AAUrB","sources":["packages/@react-spectrum/tag/src/TagGroup.tsx"],"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\nimport {ActionButton} from '@react-spectrum/button';\nimport {AriaTagGroupProps, useTagGroup} from '@react-aria/tag';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport {Collection, DOMRef, Node, SpectrumLabelableProps, StyleProps, Validation} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing, FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListCollection, useListState} from '@react-stately/list';\nimport {ListKeyboardDelegate} from '@react-aria/selection';\nimport {Provider, useProvider, useProviderProps} from '@react-spectrum/provider';\nimport React, {JSX, ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useId, useLayoutEffect, useResizeObserver, useValueEffect} from '@react-aria/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T> extends Omit<AriaTagGroupProps<T>, 'selectionMode' | 'disallowEmptySelection' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'selectionBehavior' | 'disabledKeys'>, StyleProps, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void,\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nexport const TagGroup = React.forwardRef(function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef<HTMLDivElement>(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({visibleTagCount: state.collection.size, showCollapseButton: false});\n let keyboardDelegate = useMemo(() => {\n let collection = (isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: domRef,\n direction,\n orientation: 'horizontal'\n });\n }, [direction, isCollapsed, state.collection, tagState.visibleTagCount, domRef]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup({...props, keyboardDelegate}, state, tagsRef);\n let actionsId = useId();\n let actionsRef = useRef<HTMLDivElement>(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (maxRows && buttons.length > 0 && rowCount >= maxRows && currContainerRef.parentElement) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop()!;\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function *() {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(() =>\n [...state.collection].slice(0, isCollapsed ? tagState.visibleTagCount : state.collection.size),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + (TAG_STYLES[scale].margin * 2)) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={\n classNames(\n styles,\n 'spectrum-Tags-fieldWrapper',\n {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n }\n )\n }>\n <div\n ref={containerRef}\n style={containerStyle}\n className={\n classNames(\n styles,\n 'spectrum-Tags-container',\n {\n 'spectrum-Tags-container--empty': isEmpty\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div\n ref={tagsRef}\n {...gridProps}\n className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag\n {...item.props}\n key={item.key}\n item={item}\n state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty &&\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed ?\n stringFormatter.format('showAllButtonLabel', {tagCount: state.collection.size}) :\n stringFormatter.format('hideButtonLabel')\n }\n </ActionButton>\n }\n {actionLabel && onAction &&\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n }\n </div>\n </Provider>\n }\n </div>\n </Field>\n </FocusScope>\n );\n}) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"TagGroup.module.js.map"}
|
|
@@ -55,32 +55,32 @@ var $ed889f8f1f091fc8$export$a5e59d283417e02b;
|
|
|
55
55
|
var $ed889f8f1f091fc8$export$cd48f925394bb16;
|
|
56
56
|
var $ed889f8f1f091fc8$export$c9b7ca327d69b2b5;
|
|
57
57
|
var $ed889f8f1f091fc8$export$a7c11d4acc244e09;
|
|
58
|
-
$ed889f8f1f091fc8$export$31eb53bd5b582a97 = `
|
|
59
|
-
$ed889f8f1f091fc8$export$a7db06668cad9adb = `
|
|
60
|
-
$ed889f8f1f091fc8$export$3454f895b9105e06 = `
|
|
61
|
-
$ed889f8f1f091fc8$export$f39a09f249340e2a = `
|
|
62
|
-
$ed889f8f1f091fc8$export$8c4ee2c50c22c514 = `
|
|
63
|
-
$ed889f8f1f091fc8$export$d35bc1e505d1ebbf = `
|
|
64
|
-
$ed889f8f1f091fc8$export$e7dc768d35940237 = `
|
|
65
|
-
$ed889f8f1f091fc8$export$b8813cd5d7824ce7 = `
|
|
66
|
-
$ed889f8f1f091fc8$export$4109102f950813a6 = `
|
|
67
|
-
$ed889f8f1f091fc8$export$24c7f46a6e3605dd = `
|
|
68
|
-
$ed889f8f1f091fc8$export$2927016961429360 = `
|
|
69
|
-
$ed889f8f1f091fc8$export$6174bd1d20b4c022 = `
|
|
70
|
-
$ed889f8f1f091fc8$export$87165794583be111 = `
|
|
71
|
-
$ed889f8f1f091fc8$export$7b57f5221a1b5306 = `
|
|
72
|
-
$ed889f8f1f091fc8$export$9c4fd4d7faada408 = `
|
|
73
|
-
$ed889f8f1f091fc8$export$d281c967f4ee071e = `
|
|
74
|
-
$ed889f8f1f091fc8$export$21f5254139e14871 = `
|
|
75
|
-
$ed889f8f1f091fc8$export$23a76b996f0a6c1 = `
|
|
76
|
-
$ed889f8f1f091fc8$export$eb7e80013a1212da = `
|
|
77
|
-
$ed889f8f1f091fc8$export$e6882f8db018e3bd = `
|
|
78
|
-
$ed889f8f1f091fc8$export$8afaa02110915bbb = `
|
|
79
|
-
$ed889f8f1f091fc8$export$3300169c5d27fe96 = `
|
|
80
|
-
$ed889f8f1f091fc8$export$a5e59d283417e02b = `
|
|
81
|
-
$ed889f8f1f091fc8$export$cd48f925394bb16 = `
|
|
82
|
-
$ed889f8f1f091fc8$export$c9b7ca327d69b2b5 = `
|
|
83
|
-
$ed889f8f1f091fc8$export$a7c11d4acc244e09 = `
|
|
58
|
+
$ed889f8f1f091fc8$export$31eb53bd5b582a97 = `HpsDkq_action`;
|
|
59
|
+
$ed889f8f1f091fc8$export$a7db06668cad9adb = `HpsDkq_content`;
|
|
60
|
+
$ed889f8f1f091fc8$export$3454f895b9105e06 = `HpsDkq_decoration`;
|
|
61
|
+
$ed889f8f1f091fc8$export$f39a09f249340e2a = `HpsDkq_focus-ring`;
|
|
62
|
+
$ed889f8f1f091fc8$export$8c4ee2c50c22c514 = `HpsDkq_i18nFontFamily`;
|
|
63
|
+
$ed889f8f1f091fc8$export$d35bc1e505d1ebbf = `HpsDkq_is-disabled`;
|
|
64
|
+
$ed889f8f1f091fc8$export$e7dc768d35940237 = `HpsDkq_is-focused`;
|
|
65
|
+
$ed889f8f1f091fc8$export$b8813cd5d7824ce7 = `HpsDkq_is-hovered`;
|
|
66
|
+
$ed889f8f1f091fc8$export$4109102f950813a6 = `HpsDkq_spectrum-FocusRing-ring`;
|
|
67
|
+
$ed889f8f1f091fc8$export$24c7f46a6e3605dd = `HpsDkq_spectrum-FocusRing ${$ed889f8f1f091fc8$export$4109102f950813a6}`;
|
|
68
|
+
$ed889f8f1f091fc8$export$2927016961429360 = `HpsDkq_spectrum-FocusRing--quiet`;
|
|
69
|
+
$ed889f8f1f091fc8$export$6174bd1d20b4c022 = `HpsDkq_spectrum-Tag ${$ed889f8f1f091fc8$export$24c7f46a6e3605dd}`;
|
|
70
|
+
$ed889f8f1f091fc8$export$87165794583be111 = `HpsDkq_spectrum-Tag--removable`;
|
|
71
|
+
$ed889f8f1f091fc8$export$7b57f5221a1b5306 = `HpsDkq_spectrum-Tag-avatar`;
|
|
72
|
+
$ed889f8f1f091fc8$export$9c4fd4d7faada408 = `HpsDkq_spectrum-Tag-cell`;
|
|
73
|
+
$ed889f8f1f091fc8$export$d281c967f4ee071e = `HpsDkq_spectrum-Tag-content`;
|
|
74
|
+
$ed889f8f1f091fc8$export$21f5254139e14871 = `HpsDkq_spectrum-Tag-icon`;
|
|
75
|
+
$ed889f8f1f091fc8$export$23a76b996f0a6c1 = `HpsDkq_spectrum-Tag-removeButton`;
|
|
76
|
+
$ed889f8f1f091fc8$export$eb7e80013a1212da = `HpsDkq_spectrum-Tags`;
|
|
77
|
+
$ed889f8f1f091fc8$export$e6882f8db018e3bd = `HpsDkq_spectrum-Tags-actionButton`;
|
|
78
|
+
$ed889f8f1f091fc8$export$8afaa02110915bbb = `HpsDkq_spectrum-Tags-actions`;
|
|
79
|
+
$ed889f8f1f091fc8$export$3300169c5d27fe96 = `HpsDkq_spectrum-Tags-container`;
|
|
80
|
+
$ed889f8f1f091fc8$export$a5e59d283417e02b = `HpsDkq_spectrum-Tags-container--empty`;
|
|
81
|
+
$ed889f8f1f091fc8$export$cd48f925394bb16 = `HpsDkq_spectrum-Tags-empty-state`;
|
|
82
|
+
$ed889f8f1f091fc8$export$c9b7ca327d69b2b5 = `HpsDkq_spectrum-Tags-fieldWrapper`;
|
|
83
|
+
$ed889f8f1f091fc8$export$a7c11d4acc244e09 = `HpsDkq_spectrum-Tags-fieldWrapper--positionSide`;
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
//# sourceMappingURL=tags_vars_css.main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IA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,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAA6D,CAAC,+CAA+C,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/tags/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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"tags_vars_css.main.js.map"}
|
package/dist/tags_vars_css.mjs
CHANGED
|
@@ -56,32 +56,32 @@ var $c033a7c057e84ef1$export$a5e59d283417e02b;
|
|
|
56
56
|
var $c033a7c057e84ef1$export$cd48f925394bb16;
|
|
57
57
|
var $c033a7c057e84ef1$export$c9b7ca327d69b2b5;
|
|
58
58
|
var $c033a7c057e84ef1$export$a7c11d4acc244e09;
|
|
59
|
-
$c033a7c057e84ef1$export$31eb53bd5b582a97 = `
|
|
60
|
-
$c033a7c057e84ef1$export$a7db06668cad9adb = `
|
|
61
|
-
$c033a7c057e84ef1$export$3454f895b9105e06 = `
|
|
62
|
-
$c033a7c057e84ef1$export$f39a09f249340e2a = `
|
|
63
|
-
$c033a7c057e84ef1$export$8c4ee2c50c22c514 = `
|
|
64
|
-
$c033a7c057e84ef1$export$d35bc1e505d1ebbf = `
|
|
65
|
-
$c033a7c057e84ef1$export$e7dc768d35940237 = `
|
|
66
|
-
$c033a7c057e84ef1$export$b8813cd5d7824ce7 = `
|
|
67
|
-
$c033a7c057e84ef1$export$4109102f950813a6 = `
|
|
68
|
-
$c033a7c057e84ef1$export$24c7f46a6e3605dd = `
|
|
69
|
-
$c033a7c057e84ef1$export$2927016961429360 = `
|
|
70
|
-
$c033a7c057e84ef1$export$6174bd1d20b4c022 = `
|
|
71
|
-
$c033a7c057e84ef1$export$87165794583be111 = `
|
|
72
|
-
$c033a7c057e84ef1$export$7b57f5221a1b5306 = `
|
|
73
|
-
$c033a7c057e84ef1$export$9c4fd4d7faada408 = `
|
|
74
|
-
$c033a7c057e84ef1$export$d281c967f4ee071e = `
|
|
75
|
-
$c033a7c057e84ef1$export$21f5254139e14871 = `
|
|
76
|
-
$c033a7c057e84ef1$export$23a76b996f0a6c1 = `
|
|
77
|
-
$c033a7c057e84ef1$export$eb7e80013a1212da = `
|
|
78
|
-
$c033a7c057e84ef1$export$e6882f8db018e3bd = `
|
|
79
|
-
$c033a7c057e84ef1$export$8afaa02110915bbb = `
|
|
80
|
-
$c033a7c057e84ef1$export$3300169c5d27fe96 = `
|
|
81
|
-
$c033a7c057e84ef1$export$a5e59d283417e02b = `
|
|
82
|
-
$c033a7c057e84ef1$export$cd48f925394bb16 = `
|
|
83
|
-
$c033a7c057e84ef1$export$c9b7ca327d69b2b5 = `
|
|
84
|
-
$c033a7c057e84ef1$export$a7c11d4acc244e09 = `
|
|
59
|
+
$c033a7c057e84ef1$export$31eb53bd5b582a97 = `HpsDkq_action`;
|
|
60
|
+
$c033a7c057e84ef1$export$a7db06668cad9adb = `HpsDkq_content`;
|
|
61
|
+
$c033a7c057e84ef1$export$3454f895b9105e06 = `HpsDkq_decoration`;
|
|
62
|
+
$c033a7c057e84ef1$export$f39a09f249340e2a = `HpsDkq_focus-ring`;
|
|
63
|
+
$c033a7c057e84ef1$export$8c4ee2c50c22c514 = `HpsDkq_i18nFontFamily`;
|
|
64
|
+
$c033a7c057e84ef1$export$d35bc1e505d1ebbf = `HpsDkq_is-disabled`;
|
|
65
|
+
$c033a7c057e84ef1$export$e7dc768d35940237 = `HpsDkq_is-focused`;
|
|
66
|
+
$c033a7c057e84ef1$export$b8813cd5d7824ce7 = `HpsDkq_is-hovered`;
|
|
67
|
+
$c033a7c057e84ef1$export$4109102f950813a6 = `HpsDkq_spectrum-FocusRing-ring`;
|
|
68
|
+
$c033a7c057e84ef1$export$24c7f46a6e3605dd = `HpsDkq_spectrum-FocusRing ${$c033a7c057e84ef1$export$4109102f950813a6}`;
|
|
69
|
+
$c033a7c057e84ef1$export$2927016961429360 = `HpsDkq_spectrum-FocusRing--quiet`;
|
|
70
|
+
$c033a7c057e84ef1$export$6174bd1d20b4c022 = `HpsDkq_spectrum-Tag ${$c033a7c057e84ef1$export$24c7f46a6e3605dd}`;
|
|
71
|
+
$c033a7c057e84ef1$export$87165794583be111 = `HpsDkq_spectrum-Tag--removable`;
|
|
72
|
+
$c033a7c057e84ef1$export$7b57f5221a1b5306 = `HpsDkq_spectrum-Tag-avatar`;
|
|
73
|
+
$c033a7c057e84ef1$export$9c4fd4d7faada408 = `HpsDkq_spectrum-Tag-cell`;
|
|
74
|
+
$c033a7c057e84ef1$export$d281c967f4ee071e = `HpsDkq_spectrum-Tag-content`;
|
|
75
|
+
$c033a7c057e84ef1$export$21f5254139e14871 = `HpsDkq_spectrum-Tag-icon`;
|
|
76
|
+
$c033a7c057e84ef1$export$23a76b996f0a6c1 = `HpsDkq_spectrum-Tag-removeButton`;
|
|
77
|
+
$c033a7c057e84ef1$export$eb7e80013a1212da = `HpsDkq_spectrum-Tags`;
|
|
78
|
+
$c033a7c057e84ef1$export$e6882f8db018e3bd = `HpsDkq_spectrum-Tags-actionButton`;
|
|
79
|
+
$c033a7c057e84ef1$export$8afaa02110915bbb = `HpsDkq_spectrum-Tags-actions`;
|
|
80
|
+
$c033a7c057e84ef1$export$3300169c5d27fe96 = `HpsDkq_spectrum-Tags-container`;
|
|
81
|
+
$c033a7c057e84ef1$export$a5e59d283417e02b = `HpsDkq_spectrum-Tags-container--empty`;
|
|
82
|
+
$c033a7c057e84ef1$export$cd48f925394bb16 = `HpsDkq_spectrum-Tags-empty-state`;
|
|
83
|
+
$c033a7c057e84ef1$export$c9b7ca327d69b2b5 = `HpsDkq_spectrum-Tags-fieldWrapper`;
|
|
84
|
+
$c033a7c057e84ef1$export$a7c11d4acc244e09 = `HpsDkq_spectrum-Tags-fieldWrapper--positionSide`;
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
export {$c033a7c057e84ef1$exports as default};
|
|
@@ -56,32 +56,32 @@ var $c033a7c057e84ef1$export$a5e59d283417e02b;
|
|
|
56
56
|
var $c033a7c057e84ef1$export$cd48f925394bb16;
|
|
57
57
|
var $c033a7c057e84ef1$export$c9b7ca327d69b2b5;
|
|
58
58
|
var $c033a7c057e84ef1$export$a7c11d4acc244e09;
|
|
59
|
-
$c033a7c057e84ef1$export$31eb53bd5b582a97 = `
|
|
60
|
-
$c033a7c057e84ef1$export$a7db06668cad9adb = `
|
|
61
|
-
$c033a7c057e84ef1$export$3454f895b9105e06 = `
|
|
62
|
-
$c033a7c057e84ef1$export$f39a09f249340e2a = `
|
|
63
|
-
$c033a7c057e84ef1$export$8c4ee2c50c22c514 = `
|
|
64
|
-
$c033a7c057e84ef1$export$d35bc1e505d1ebbf = `
|
|
65
|
-
$c033a7c057e84ef1$export$e7dc768d35940237 = `
|
|
66
|
-
$c033a7c057e84ef1$export$b8813cd5d7824ce7 = `
|
|
67
|
-
$c033a7c057e84ef1$export$4109102f950813a6 = `
|
|
68
|
-
$c033a7c057e84ef1$export$24c7f46a6e3605dd = `
|
|
69
|
-
$c033a7c057e84ef1$export$2927016961429360 = `
|
|
70
|
-
$c033a7c057e84ef1$export$6174bd1d20b4c022 = `
|
|
71
|
-
$c033a7c057e84ef1$export$87165794583be111 = `
|
|
72
|
-
$c033a7c057e84ef1$export$7b57f5221a1b5306 = `
|
|
73
|
-
$c033a7c057e84ef1$export$9c4fd4d7faada408 = `
|
|
74
|
-
$c033a7c057e84ef1$export$d281c967f4ee071e = `
|
|
75
|
-
$c033a7c057e84ef1$export$21f5254139e14871 = `
|
|
76
|
-
$c033a7c057e84ef1$export$23a76b996f0a6c1 = `
|
|
77
|
-
$c033a7c057e84ef1$export$eb7e80013a1212da = `
|
|
78
|
-
$c033a7c057e84ef1$export$e6882f8db018e3bd = `
|
|
79
|
-
$c033a7c057e84ef1$export$8afaa02110915bbb = `
|
|
80
|
-
$c033a7c057e84ef1$export$3300169c5d27fe96 = `
|
|
81
|
-
$c033a7c057e84ef1$export$a5e59d283417e02b = `
|
|
82
|
-
$c033a7c057e84ef1$export$cd48f925394bb16 = `
|
|
83
|
-
$c033a7c057e84ef1$export$c9b7ca327d69b2b5 = `
|
|
84
|
-
$c033a7c057e84ef1$export$a7c11d4acc244e09 = `
|
|
59
|
+
$c033a7c057e84ef1$export$31eb53bd5b582a97 = `HpsDkq_action`;
|
|
60
|
+
$c033a7c057e84ef1$export$a7db06668cad9adb = `HpsDkq_content`;
|
|
61
|
+
$c033a7c057e84ef1$export$3454f895b9105e06 = `HpsDkq_decoration`;
|
|
62
|
+
$c033a7c057e84ef1$export$f39a09f249340e2a = `HpsDkq_focus-ring`;
|
|
63
|
+
$c033a7c057e84ef1$export$8c4ee2c50c22c514 = `HpsDkq_i18nFontFamily`;
|
|
64
|
+
$c033a7c057e84ef1$export$d35bc1e505d1ebbf = `HpsDkq_is-disabled`;
|
|
65
|
+
$c033a7c057e84ef1$export$e7dc768d35940237 = `HpsDkq_is-focused`;
|
|
66
|
+
$c033a7c057e84ef1$export$b8813cd5d7824ce7 = `HpsDkq_is-hovered`;
|
|
67
|
+
$c033a7c057e84ef1$export$4109102f950813a6 = `HpsDkq_spectrum-FocusRing-ring`;
|
|
68
|
+
$c033a7c057e84ef1$export$24c7f46a6e3605dd = `HpsDkq_spectrum-FocusRing ${$c033a7c057e84ef1$export$4109102f950813a6}`;
|
|
69
|
+
$c033a7c057e84ef1$export$2927016961429360 = `HpsDkq_spectrum-FocusRing--quiet`;
|
|
70
|
+
$c033a7c057e84ef1$export$6174bd1d20b4c022 = `HpsDkq_spectrum-Tag ${$c033a7c057e84ef1$export$24c7f46a6e3605dd}`;
|
|
71
|
+
$c033a7c057e84ef1$export$87165794583be111 = `HpsDkq_spectrum-Tag--removable`;
|
|
72
|
+
$c033a7c057e84ef1$export$7b57f5221a1b5306 = `HpsDkq_spectrum-Tag-avatar`;
|
|
73
|
+
$c033a7c057e84ef1$export$9c4fd4d7faada408 = `HpsDkq_spectrum-Tag-cell`;
|
|
74
|
+
$c033a7c057e84ef1$export$d281c967f4ee071e = `HpsDkq_spectrum-Tag-content`;
|
|
75
|
+
$c033a7c057e84ef1$export$21f5254139e14871 = `HpsDkq_spectrum-Tag-icon`;
|
|
76
|
+
$c033a7c057e84ef1$export$23a76b996f0a6c1 = `HpsDkq_spectrum-Tag-removeButton`;
|
|
77
|
+
$c033a7c057e84ef1$export$eb7e80013a1212da = `HpsDkq_spectrum-Tags`;
|
|
78
|
+
$c033a7c057e84ef1$export$e6882f8db018e3bd = `HpsDkq_spectrum-Tags-actionButton`;
|
|
79
|
+
$c033a7c057e84ef1$export$8afaa02110915bbb = `HpsDkq_spectrum-Tags-actions`;
|
|
80
|
+
$c033a7c057e84ef1$export$3300169c5d27fe96 = `HpsDkq_spectrum-Tags-container`;
|
|
81
|
+
$c033a7c057e84ef1$export$a5e59d283417e02b = `HpsDkq_spectrum-Tags-container--empty`;
|
|
82
|
+
$c033a7c057e84ef1$export$cd48f925394bb16 = `HpsDkq_spectrum-Tags-empty-state`;
|
|
83
|
+
$c033a7c057e84ef1$export$c9b7ca327d69b2b5 = `HpsDkq_spectrum-Tags-fieldWrapper`;
|
|
84
|
+
$c033a7c057e84ef1$export$a7c11d4acc244e09 = `HpsDkq_spectrum-Tags-fieldWrapper--positionSide`;
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
export {$c033a7c057e84ef1$exports as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA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CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAmD,CAAC,qCAAqC,CAAC;AAC1F,2CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAA6D,CAAC,+CAA+C,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/tags/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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"tags_vars_css.module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;ACyCA,uCAAuC,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,eAAe,GAAG,wBAAwB,GAAG,cAAc,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,oBAAoB,CAAC,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;IACnW,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IACrC,2HAA2H;IAC3H,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;
|
|
1
|
+
{"mappings":";;;ACyCA,uCAAuC,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,eAAe,GAAG,wBAAwB,GAAG,cAAc,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,oBAAoB,CAAC,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;IACnW,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IACrC,2HAA2H;IAC3H,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,8IAA8I;AAC9I,OAAO,MAAM,UAgOP,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,OAAO,cAAc,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACxQ5F,OAAO,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC","sources":["packages/@react-spectrum/tag/src/packages/@react-spectrum/tag/src/Tag.tsx","packages/@react-spectrum/tag/src/packages/@react-spectrum/tag/src/TagGroup.tsx","packages/@react-spectrum/tag/src/packages/@react-spectrum/tag/src/index.ts","packages/@react-spectrum/tag/src/index.ts"],"sourcesContent":[null,null,null,"/*\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\nexport {TagGroup} from './TagGroup';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTagGroupProps} from './TagGroup';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
.
|
|
1
|
+
.HpsDkq_i18nFontFamily {
|
|
2
2
|
font-synthesis: weight;
|
|
3
3
|
font-family: adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.
|
|
6
|
+
.HpsDkq_i18nFontFamily:lang(ar) {
|
|
7
7
|
font-family: myriad-arabic, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.
|
|
10
|
+
.HpsDkq_i18nFontFamily:lang(he) {
|
|
11
11
|
font-family: myriad-hebrew, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.
|
|
14
|
+
.HpsDkq_i18nFontFamily:lang(zh) {
|
|
15
15
|
font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Heiti TC Light, sans-serif;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.
|
|
18
|
+
.HpsDkq_i18nFontFamily:lang(zh-Hans) {
|
|
19
19
|
font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
22
|
+
.HpsDkq_i18nFontFamily:lang(zh-Hant) {
|
|
23
23
|
font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Microsoft JhengHei UI, Microsoft JhengHei, Heiti TC Light, sans-serif;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
26
|
+
.HpsDkq_i18nFontFamily:lang(zh-SG), .HpsDkq_i18nFontFamily:lang(zh-CN) {
|
|
27
27
|
font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.
|
|
30
|
+
.HpsDkq_i18nFontFamily:lang(ko) {
|
|
31
31
|
font-family: adobe-clean-han-korean, source-han-korean, Malgun Gothic, Apple Gothic, sans-serif;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.HpsDkq_i18nFontFamily:lang(ja) {
|
|
35
35
|
font-family: adobe-clean-han-japanese, Hiragino Kaku Gothic ProN, ヒラギノ角ゴ ProN W3, Osaka, YuGothic, Yu Gothic, メイリオ, Meiryo, MS Pゴシック, MS PGothic, sans-serif;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.HpsDkq_spectrum-FocusRing-ring {
|
|
39
39
|
--spectrum-focus-ring-border-radius: var(--spectrum-textfield-border-radius, var(--spectrum-alias-border-radius-regular));
|
|
40
40
|
--spectrum-focus-ring-gap: var(--spectrum-alias-input-focusring-gap);
|
|
41
41
|
--spectrum-focus-ring-size: var(--spectrum-alias-input-focusring-size);
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
--spectrum-focus-ring-color: var(--spectrum-high-contrast-focus-ring-color, var(--spectrum-alias-focus-ring-color, var(--spectrum-alias-focus-color)));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.
|
|
46
|
+
.HpsDkq_spectrum-FocusRing-ring:after {
|
|
47
47
|
border-radius: calc(var(--spectrum-focus-ring-border-radius) + var(--spectrum-focus-ring-gap));
|
|
48
48
|
content: "";
|
|
49
49
|
margin: calc(-1 * var(--spectrum-focus-ring-border-size));
|
|
@@ -54,48 +54,49 @@
|
|
|
54
54
|
inset: 0;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
.
|
|
57
|
+
.HpsDkq_spectrum-FocusRing.HpsDkq_focus-ring:after {
|
|
58
58
|
margin: calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size));
|
|
59
59
|
box-shadow: 0 0 0 var(--spectrum-focus-ring-size) var(--spectrum-focus-ring-color);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.
|
|
62
|
+
.HpsDkq_spectrum-FocusRing--quiet:after {
|
|
63
63
|
border-radius: 0;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.
|
|
66
|
+
.HpsDkq_spectrum-FocusRing--quiet.HpsDkq_focus-ring:after {
|
|
67
67
|
margin: 0 0 calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size)) 0;
|
|
68
68
|
box-shadow: 0 var(--spectrum-focus-ring-size) 0 var(--spectrum-focus-ring-color);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
@media (forced-colors: active) {
|
|
72
|
-
.
|
|
72
|
+
.HpsDkq_spectrum-FocusRing, .HpsDkq_spectrum-FocusRing-ring, .HpsDkq_spectrum-FocusRing--quiet {
|
|
73
73
|
--spectrum-high-contrast-focus-ring-color: Highlight;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
:is(.
|
|
76
|
+
:is(.HpsDkq_spectrum-FocusRing, .HpsDkq_spectrum-FocusRing-ring, .HpsDkq_spectrum-FocusRing--quiet):after {
|
|
77
77
|
forced-color-adjust: none;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
.
|
|
81
|
+
.HpsDkq_spectrum-Tags {
|
|
82
82
|
display: inline;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
.
|
|
85
|
+
.HpsDkq_spectrum-Tags.HpsDkq_focus-ring {
|
|
86
86
|
box-shadow: 0 0 0 2px var(--spectrum-tag-border-color-key-focus, var(--spectrum-alias-border-color-focus));
|
|
87
87
|
outline: none;
|
|
88
88
|
display: block;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
.
|
|
91
|
+
.HpsDkq_spectrum-Tags-container:not(.HpsDkq_spectrum-Tags-container--empty) {
|
|
92
92
|
margin-inline-start: calc(calc(var(--spectrum-taggroup-tag-gap-x, var(--spectrum-global-dimension-size-100)) / 2) * -1);
|
|
93
93
|
margin-inline-end: calc(var(--spectrum-taggroup-tag-gap-x, var(--spectrum-global-dimension-size-100)) / 2);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.
|
|
96
|
+
.HpsDkq_spectrum-Tag {
|
|
97
97
|
--spectrum-focus-ring-border-radius: var(--spectrum-tag-border-radius, var(--spectrum-alias-border-radius-regular));
|
|
98
98
|
--spectrum-focus-ring-border-size: var(--spectrum-tag-border-size, var(--spectrum-alias-border-size-thin));
|
|
99
|
+
vertical-align: middle;
|
|
99
100
|
box-sizing: border-box;
|
|
100
101
|
cursor: default;
|
|
101
102
|
margin: calc(var(--spectrum-taggroup-tag-gap-y, var(--spectrum-global-dimension-size-100)) / 2) calc(var(--spectrum-taggroup-tag-gap-x, var(--spectrum-global-dimension-size-100)) / 2);
|
|
@@ -104,146 +105,146 @@
|
|
|
104
105
|
border-radius: var(--spectrum-tag-border-radius, var(--spectrum-alias-border-radius-regular));
|
|
105
106
|
-webkit-user-select: none;
|
|
106
107
|
user-select: none;
|
|
108
|
+
max-inline-size: 100%;
|
|
107
109
|
transition: border-color var(--spectrum-global-animation-duration-100, .13s) ease-in-out, color var(--spectrum-global-animation-duration-100, .13s) ease-in-out, box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-in-out, background-color var(--spectrum-global-animation-duration-100, .13s) ease-in-out;
|
|
108
110
|
border-style: solid;
|
|
109
111
|
outline: none;
|
|
110
112
|
align-items: center;
|
|
111
|
-
max-inline-size: 100%;
|
|
112
113
|
padding-inline-start: calc(var(--spectrum-tag-padding-x, var(--spectrum-global-dimension-size-125)) - var(--spectrum-tag-border-size, var(--spectrum-alias-border-size-thin)));
|
|
113
114
|
display: inline-grid;
|
|
114
115
|
position: relative;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
.
|
|
118
|
+
.HpsDkq_spectrum-Tag[data-href] {
|
|
118
119
|
cursor: pointer;
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
.
|
|
122
|
+
.HpsDkq_spectrum-Tag.HpsDkq_is-disabled {
|
|
122
123
|
cursor: default;
|
|
123
124
|
pointer-events: none;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
.
|
|
127
|
+
.HpsDkq_spectrum-Tag .HpsDkq_spectrum-Tag-removeButton {
|
|
127
128
|
height: calc(var(--spectrum-tag-height, var(--spectrum-global-dimension-size-300)) - (2 * var(--spectrum-tag-border-size, var(--spectrum-alias-border-size-thin))));
|
|
128
129
|
width: var(--spectrum-global-dimension-size-300);
|
|
129
|
-
grid-area:
|
|
130
|
+
grid-area: HpsDkq_action;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
.
|
|
133
|
+
.HpsDkq_spectrum-Tag .HpsDkq_spectrum-Tag-cell {
|
|
133
134
|
text-overflow: ellipsis;
|
|
134
135
|
grid-template-columns: auto 1fr auto;
|
|
135
|
-
grid-template-areas: "
|
|
136
|
+
grid-template-areas: "HpsDkq_decoration HpsDkq_content HpsDkq_action";
|
|
136
137
|
align-items: center;
|
|
137
138
|
display: grid;
|
|
138
139
|
overflow: hidden;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
.
|
|
142
|
-
grid-area:
|
|
142
|
+
.HpsDkq_spectrum-Tag .HpsDkq_spectrum-Tag-icon, .HpsDkq_spectrum-Tag .HpsDkq_spectrum-Tag-avatar {
|
|
143
|
+
grid-area: HpsDkq_decoration;
|
|
143
144
|
margin-inline-end: var(--spectrum-global-dimension-size-100);
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
.
|
|
147
|
+
.HpsDkq_spectrum-Tag .HpsDkq_spectrum-Tag-content {
|
|
147
148
|
line-height: calc(var(--spectrum-tag-height, var(--spectrum-global-dimension-size-300)) - calc(var(--spectrum-tag-border-size, var(--spectrum-alias-border-size-thin)) * 2));
|
|
148
149
|
font-size: var(--spectrum-tag-text-size, var(--spectrum-global-dimension-font-size-75));
|
|
149
150
|
white-space: nowrap;
|
|
150
151
|
text-overflow: ellipsis;
|
|
151
152
|
outline: none;
|
|
152
153
|
flex: auto;
|
|
153
|
-
grid-area:
|
|
154
|
+
grid-area: HpsDkq_content;
|
|
154
155
|
margin-inline-end: var(--spectrum-tag-padding-x, var(--spectrum-global-dimension-size-125));
|
|
155
156
|
overflow: hidden;
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
.
|
|
159
|
+
.HpsDkq_spectrum-Tag.HpsDkq_spectrum-Tag--removable .HpsDkq_spectrum-Tag-content {
|
|
159
160
|
margin-inline-end: 0;
|
|
160
161
|
}
|
|
161
162
|
|
|
162
|
-
.
|
|
163
|
+
.HpsDkq_spectrum-Tags-actions {
|
|
163
164
|
display: inline;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
.
|
|
167
|
+
.HpsDkq_spectrum-Tags-actions .HpsDkq_spectrum-Tags-actionButton {
|
|
167
168
|
height: var(--spectrum-tag-height, var(--spectrum-global-dimension-size-300));
|
|
168
169
|
font-size: var(--spectrum-tag-text-size, var(--spectrum-global-dimension-font-size-75));
|
|
169
170
|
margin: calc(var(--spectrum-taggroup-tag-gap-y, var(--spectrum-global-dimension-size-100)) / 2) calc(var(--spectrum-taggroup-tag-gap-x, var(--spectrum-global-dimension-size-100)) / 2);
|
|
170
171
|
display: inline;
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
.
|
|
174
|
+
.HpsDkq_spectrum-Tags-actions .HpsDkq_spectrum-Tags-actionButton.HpsDkq_spectrum-Tags-actionButton > span {
|
|
174
175
|
padding-inline-start: var(--spectrum-tag-padding-x, var(--spectrum-global-dimension-size-125));
|
|
175
176
|
padding-inline-end: var(--spectrum-tag-padding-x, var(--spectrum-global-dimension-size-125));
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
.
|
|
179
|
+
.HpsDkq_spectrum-Tags-fieldWrapper.HpsDkq_spectrum-Tags-fieldWrapper {
|
|
179
180
|
width: unset;
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
.
|
|
183
|
+
.HpsDkq_spectrum-Tags-fieldWrapper.HpsDkq_spectrum-Tags-fieldWrapper:not(.HpsDkq_spectrum-Tags-fieldWrapper--positionSide) {
|
|
183
184
|
display: grid;
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
.
|
|
187
|
+
.HpsDkq_spectrum-Tags-empty-state {
|
|
187
188
|
min-height: var(--spectrum-tag-height, var(--spectrum-global-dimension-size-300));
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
.
|
|
191
|
+
.HpsDkq_spectrum-Tag {
|
|
191
192
|
color: var(--spectrum-tag-text-color, var(--spectrum-global-color-gray-700));
|
|
192
193
|
background-color: var(--spectrum-tag-background-color, var(--spectrum-global-color-gray-75));
|
|
193
194
|
border-color: var(--spectrum-tag-border-color, var(--spectrum-global-color-gray-600));
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
.
|
|
197
|
+
.HpsDkq_spectrum-Tag.HpsDkq_is-hovered {
|
|
197
198
|
background-color: var(--spectrum-tag-background-color-hover, var(--spectrum-global-color-gray-75));
|
|
198
199
|
color: var(--spectrum-tag-text-color-hover, var(--spectrum-global-color-gray-900));
|
|
199
200
|
border-color: var(--spectrum-tag-border-color-hover, var(--spectrum-global-color-gray-900));
|
|
200
201
|
}
|
|
201
202
|
|
|
202
|
-
.
|
|
203
|
+
.HpsDkq_spectrum-Tag.HpsDkq_focus-ring {
|
|
203
204
|
background-color: var(--spectrum-tag-background-color-key-focus, var(--spectrum-global-color-gray-75));
|
|
204
205
|
color: var(--spectrum-tag-text-color-key-focus, var(--spectrum-global-color-gray-900));
|
|
205
206
|
border-color: var(--spectrum-tag-border-color-key-focus, var(--spectrum-alias-border-color-focus));
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
.
|
|
209
|
+
.HpsDkq_spectrum-Tag.HpsDkq_focus-ring:after {
|
|
209
210
|
box-shadow: 0 0 0 var(--spectrum-focus-ring-border-size) var(--spectrum-tag-border-color-key-focus, var(--spectrum-alias-border-color-focus));
|
|
210
211
|
}
|
|
211
212
|
|
|
212
|
-
.
|
|
213
|
+
.HpsDkq_spectrum-Tag.HpsDkq_is-disabled {
|
|
213
214
|
color: var(--spectrum-tag-text-color-disabled, var(--spectrum-global-color-gray-500));
|
|
214
215
|
background-color: var(--spectrum-tag-background-color-disabled, var(--spectrum-global-color-gray-200));
|
|
215
216
|
border-color: var(--spectrum-tag-border-color-disabled, var(--spectrum-global-color-gray-200));
|
|
216
217
|
}
|
|
217
218
|
|
|
218
|
-
.
|
|
219
|
+
.HpsDkq_spectrum-Tag.HpsDkq_is-disabled .HpsDkq_spectrum-Tag-avatar {
|
|
219
220
|
opacity: var(--spectrum-avatar-small-opacity-disabled, .3);
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
.
|
|
223
|
+
.HpsDkq_spectrum-Tag.HpsDkq_spectrum-Tag--removable.HpsDkq_is-hovered {
|
|
223
224
|
color: var(--spectrum-tag-removable-text-color-hover, var(--spectrum-global-color-gray-900));
|
|
224
225
|
}
|
|
225
226
|
|
|
226
|
-
.
|
|
227
|
+
.HpsDkq_spectrum-Tag.HpsDkq_spectrum-Tag--removable:active {
|
|
227
228
|
color: var(--spectrum-tag-removable-text-color-down, var(--spectrum-global-color-gray-700));
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
.
|
|
231
|
+
.HpsDkq_spectrum-Tag.HpsDkq_spectrum-Tag--removable.HpsDkq_is-focused {
|
|
231
232
|
color: var(--spectrum-tag-removable-text-color-key-focus, var(--spectrum-global-color-gray-700));
|
|
232
233
|
}
|
|
233
234
|
|
|
234
|
-
.
|
|
235
|
+
.HpsDkq_spectrum-Tag.HpsDkq_spectrum-Tag--removable .HpsDkq_spectrum-Tag-removeButton.HpsDkq_is-focused {
|
|
235
236
|
border: 2px solid var(--spectrum-tag-removable-border-color-key-focus, var(--spectrum-alias-border-color-focus));
|
|
236
237
|
border-radius: var(--spectrum-alias-border-radius-regular, var(--spectrum-global-dimension-size-50));
|
|
237
238
|
background-color: var(--spectrum-tag-removable-button-background-color-key-focus, var(--spectrum-global-color-gray-600));
|
|
238
239
|
color: var(--spectrum-tag-removable-button-icon-color-key-focus, var(--spectrum-global-color-gray-900));
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
.
|
|
242
|
+
.HpsDkq_spectrum-Tag.HpsDkq_spectrum-Tag--removable .HpsDkq_spectrum-Tag-removeButton.HpsDkq_is-hovered {
|
|
242
243
|
color: var(--spectrum-tag-removable-button-icon-color-hover, var(--spectrum-global-color-gray-900));
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
@media (forced-colors: active) {
|
|
246
|
-
.
|
|
247
|
+
.HpsDkq_spectrum-Tag {
|
|
247
248
|
forced-color-adjust: none;
|
|
248
249
|
--spectrum-tag-background-color: ButtonFace;
|
|
249
250
|
--spectrum-tag-background-color-disabled: ButtonFace;
|
|
@@ -266,4 +267,4 @@
|
|
|
266
267
|
--spectrum-tag-text-color-key-focus: ButtonText;
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
|
-
/*# sourceMappingURL=vars.
|
|
270
|
+
/*# sourceMappingURL=vars.c220ab26.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;AAGE;;;;;;AAaA;;;;;AAOF;;;;;;;;;;;;;;;;;;;;;;AA4BE;;;;AAIA;;;;;AAKA;;;;;;AAMA;;;;;;;;;AASA;;;;;AAUA;;;;;;;;;;;;AAaE;;;;AAMJ;;;;AAGE;;;;;;;AAOI;;;;;AAQN;;;;AAGE;;;;AAKF;;;;AAgBA;;;;;;AAKE;;;;;;AAMA;;;;;;AAIE;;;;AAKF;;;;;;AAKE;;;;AAOA;;;;AAIA;;;;AAIA;;;;AAKE;;;;;;;AAMA;;;;AAON;EACE","sources":["packages/@adobe/spectrum-css-temp/components/tags/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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.c220ab26.css.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/tag",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.12",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/focus": "^3.
|
|
40
|
-
"@react-aria/i18n": "^3.12.
|
|
41
|
-
"@react-aria/interactions": "^3.
|
|
42
|
-
"@react-aria/selection": "^3.
|
|
43
|
-
"@react-aria/tag": "^3.4.
|
|
44
|
-
"@react-aria/utils": "^3.
|
|
45
|
-
"@react-spectrum/button": "^3.16.
|
|
46
|
-
"@react-spectrum/form": "^3.7.
|
|
47
|
-
"@react-spectrum/label": "^3.16.
|
|
48
|
-
"@react-spectrum/text": "^3.5.
|
|
49
|
-
"@react-spectrum/utils": "^3.
|
|
50
|
-
"@react-stately/collections": "^3.
|
|
51
|
-
"@react-stately/list": "^3.11.
|
|
52
|
-
"@react-types/shared": "^3.
|
|
39
|
+
"@react-aria/focus": "^3.19.1",
|
|
40
|
+
"@react-aria/i18n": "^3.12.5",
|
|
41
|
+
"@react-aria/interactions": "^3.23.0",
|
|
42
|
+
"@react-aria/selection": "^3.22.0",
|
|
43
|
+
"@react-aria/tag": "^3.4.9",
|
|
44
|
+
"@react-aria/utils": "^3.27.0",
|
|
45
|
+
"@react-spectrum/button": "^3.16.10",
|
|
46
|
+
"@react-spectrum/form": "^3.7.11",
|
|
47
|
+
"@react-spectrum/label": "^3.16.11",
|
|
48
|
+
"@react-spectrum/text": "^3.5.11",
|
|
49
|
+
"@react-spectrum/utils": "^3.12.1",
|
|
50
|
+
"@react-stately/collections": "^3.12.1",
|
|
51
|
+
"@react-stately/list": "^3.11.2",
|
|
52
|
+
"@react-types/shared": "^3.27.0",
|
|
53
53
|
"@swc/helpers": "^0.5.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@react-spectrum/provider": "^3.0.0",
|
|
60
|
-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
|
|
61
|
-
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
|
60
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
61
|
+
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
|
|
67
67
|
}
|
package/src/TagGroup.tsx
CHANGED
|
@@ -50,7 +50,8 @@ export interface SpectrumTagGroupProps<T> extends Omit<AriaTagGroupProps<T>, 'se
|
|
|
50
50
|
maxRows?: number
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */
|
|
54
|
+
export const TagGroup = React.forwardRef(function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {
|
|
54
55
|
props = useProviderProps(props);
|
|
55
56
|
props = useFormProps(props);
|
|
56
57
|
let {
|
|
@@ -62,7 +63,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
62
63
|
renderEmptyState = () => stringFormatter.format('noTags')
|
|
63
64
|
} = props;
|
|
64
65
|
let domRef = useDOMRef(ref);
|
|
65
|
-
let containerRef = useRef(null);
|
|
66
|
+
let containerRef = useRef<HTMLDivElement>(null);
|
|
66
67
|
let tagsRef = useRef<HTMLDivElement | null>(null);
|
|
67
68
|
let {direction} = useLocale();
|
|
68
69
|
let {scale} = useProvider();
|
|
@@ -85,7 +86,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
85
86
|
delete props.onAction;
|
|
86
87
|
let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup({...props, keyboardDelegate}, state, tagsRef);
|
|
87
88
|
let actionsId = useId();
|
|
88
|
-
let actionsRef = useRef(null);
|
|
89
|
+
let actionsRef = useRef<HTMLDivElement>(null);
|
|
89
90
|
|
|
90
91
|
let updateVisibleTagCount = useCallback(() => {
|
|
91
92
|
if (maxRows && maxRows > 0) {
|
|
@@ -124,7 +125,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
124
125
|
|
|
125
126
|
// Remove tags until there is space for the collapse button and action button (if present) on the last row.
|
|
126
127
|
let buttons = [...currActionsRef.children];
|
|
127
|
-
if (maxRows && buttons.length > 0 && rowCount >= maxRows) {
|
|
128
|
+
if (maxRows && buttons.length > 0 && rowCount >= maxRows && currContainerRef.parentElement) {
|
|
128
129
|
let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);
|
|
129
130
|
buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;
|
|
130
131
|
let end = direction === 'ltr' ? 'right' : 'left';
|
|
@@ -134,7 +135,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
134
135
|
let availableWidth = containerEnd - lastTagEnd;
|
|
135
136
|
|
|
136
137
|
while (availableWidth < buttonsWidth && index > 0) {
|
|
137
|
-
availableWidth += tagWidths.pop()
|
|
138
|
+
availableWidth += tagWidths.pop()!;
|
|
138
139
|
index--;
|
|
139
140
|
}
|
|
140
141
|
}
|
|
@@ -274,8 +275,4 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
274
275
|
</Field>
|
|
275
276
|
</FocusScope>
|
|
276
277
|
);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */
|
|
280
|
-
const _TagGroup = React.forwardRef(TagGroup) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
|
|
281
|
-
export {_TagGroup as TagGroup};
|
|
278
|
+
}) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;AAGE;;;;;;AAaA;;;;;AAOF;;;;;;;;;;;;;;;;;;;;;AA2BE;;;;AAIA;;;;;AAKA;;;;;;AAMA;;;;;;;;;AASA;;;;;AAUA;;;;;;;;;;;;AAaE;;;;AAMJ;;;;AAGE;;;;;;;AAOI;;;;;AAQN;;;;AAGE;;;;AAKF;;;;AAgBA;;;;;;AAKE;;;;;;AAMA;;;;;;AAIE;;;;AAKF;;;;;;AAKE;;;;AAOA;;;;AAIA;;;;AAIA;;;;AAKE;;;;;;;AAMA;;;;AAON;EACE","sources":["packages/@adobe/spectrum-css-temp/components/tags/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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.f5ba1a45.css.map"}
|