@react-spectrum/s2 3.0.0-nightly-412a51816-250219 → 3.0.0-nightly-a792c1ad5-250222
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/Breadcrumbs.cjs +3 -3
- package/dist/Breadcrumbs.cjs.map +1 -1
- package/dist/Breadcrumbs.css.map +1 -1
- package/dist/Breadcrumbs.mjs +4 -4
- package/dist/Breadcrumbs.mjs.map +1 -1
- package/dist/CardView.cjs +2 -258
- package/dist/CardView.cjs.map +1 -1
- package/dist/CardView.css.map +1 -1
- package/dist/CardView.mjs +5 -261
- package/dist/CardView.mjs.map +1 -1
- package/dist/Picker.cjs +91 -68
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs +92 -69
- package/dist/Picker.mjs.map +1 -1
- package/dist/SegmentedControl.cjs +4 -4
- package/dist/SegmentedControl.cjs.map +1 -1
- package/dist/SegmentedControl.css.map +1 -1
- package/dist/SegmentedControl.mjs +5 -5
- package/dist/SegmentedControl.mjs.map +1 -1
- package/dist/TableView.cjs +61 -77
- package/dist/TableView.cjs.map +1 -1
- package/dist/TableView.css +10 -2
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +63 -79
- package/dist/TableView.mjs.map +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs +1 -1
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/TreeView.cjs +12 -16
- package/dist/TreeView.cjs.map +1 -1
- package/dist/TreeView.css +4 -4
- package/dist/TreeView.css.map +1 -1
- package/dist/TreeView.mjs +14 -18
- package/dist/TreeView.mjs.map +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +2 -2
- package/dist/module.mjs.map +1 -1
- package/dist/types.d.ts +5 -3
- package/dist/types.d.ts.map +1 -1
- package/icons/3DMaterial.cjs.map +1 -1
- package/icons/3DMaterial.mjs.map +1 -1
- package/icons/ABC.cjs +36 -0
- package/icons/ABC.cjs.map +1 -0
- package/icons/ABC.mjs +25 -0
- package/icons/ABC.mjs.map +1 -0
- package/icons/AlertDiamond.cjs.map +1 -1
- package/icons/AlertDiamond.mjs.map +1 -1
- package/icons/Animation.cjs.map +1 -1
- package/icons/Animation.mjs.map +1 -1
- package/icons/AnimationNo.cjs.map +1 -1
- package/icons/AnimationNo.mjs.map +1 -1
- package/icons/App.cjs +42 -0
- package/icons/App.cjs.map +1 -0
- package/icons/App.mjs +31 -0
- package/icons/App.mjs.map +1 -0
- package/icons/AspectRatio.cjs.map +1 -1
- package/icons/AspectRatio.mjs.map +1 -1
- package/icons/Asset.cjs +1 -5
- package/icons/Asset.cjs.map +1 -1
- package/icons/Asset.mjs +1 -5
- package/icons/Asset.mjs.map +1 -1
- package/icons/AudioWave.cjs.map +1 -1
- package/icons/AudioWave.mjs.map +1 -1
- package/icons/BadgeVerified.cjs.map +1 -1
- package/icons/BadgeVerified.mjs.map +1 -1
- package/icons/Bell.cjs.map +1 -1
- package/icons/Bell.mjs.map +1 -1
- package/icons/Bookmark.cjs +36 -0
- package/icons/Bookmark.cjs.map +1 -0
- package/icons/Bookmark.mjs +25 -0
- package/icons/Bookmark.mjs.map +1 -0
- package/icons/Brand.cjs.map +1 -1
- package/icons/Brand.mjs.map +1 -1
- package/icons/Building.cjs +62 -0
- package/icons/Building.cjs.map +1 -0
- package/icons/Building.mjs +51 -0
- package/icons/Building.mjs.map +1 -0
- package/icons/CalendarEdit.cjs.map +1 -1
- package/icons/CalendarEdit.mjs.map +1 -1
- package/icons/CallCenter.cjs +36 -0
- package/icons/CallCenter.cjs.map +1 -0
- package/icons/CallCenter.mjs +25 -0
- package/icons/CallCenter.mjs.map +1 -0
- package/icons/CameraProperties.cjs.map +1 -1
- package/icons/CameraProperties.mjs.map +1 -1
- package/icons/Channel.cjs.map +1 -1
- package/icons/Channel.mjs.map +1 -1
- package/icons/ChartBarVert.cjs +36 -0
- package/icons/ChartBarVert.cjs.map +1 -0
- package/icons/ChartBarVert.mjs +25 -0
- package/icons/ChartBarVert.mjs.map +1 -0
- package/icons/ChartPie.cjs +36 -0
- package/icons/ChartPie.cjs.map +1 -0
- package/icons/ChartPie.mjs +25 -0
- package/icons/ChartPie.mjs.map +1 -0
- package/icons/ChartTrend.cjs +36 -0
- package/icons/ChartTrend.cjs.map +1 -0
- package/icons/ChartTrend.mjs +25 -0
- package/icons/ChartTrend.mjs.map +1 -0
- package/icons/Chat.cjs +36 -0
- package/icons/Chat.cjs.map +1 -0
- package/icons/Chat.mjs +25 -0
- package/icons/Chat.mjs.map +1 -0
- package/icons/CheckBox.cjs.map +1 -1
- package/icons/CheckBox.mjs.map +1 -1
- package/icons/Checkmark.cjs +8 -8
- package/icons/Checkmark.cjs.map +1 -1
- package/icons/Checkmark.mjs +8 -8
- package/icons/Checkmark.mjs.map +1 -1
- package/icons/ChevronDoubleLeft.cjs +42 -0
- package/icons/ChevronDoubleLeft.cjs.map +1 -0
- package/icons/ChevronDoubleLeft.d.ts +5 -0
- package/icons/ChevronDoubleLeft.mjs +31 -0
- package/icons/ChevronDoubleLeft.mjs.map +1 -0
- package/icons/ChevronDoubleRight.cjs +42 -0
- package/icons/ChevronDoubleRight.cjs.map +1 -0
- package/icons/ChevronDoubleRight.d.ts +5 -0
- package/icons/ChevronDoubleRight.mjs +31 -0
- package/icons/ChevronDoubleRight.mjs.map +1 -0
- package/icons/ChevronDown.cjs +8 -8
- package/icons/ChevronDown.cjs.map +1 -1
- package/icons/ChevronDown.mjs +8 -8
- package/icons/ChevronDown.mjs.map +1 -1
- package/icons/ChevronLeft.cjs.map +1 -1
- package/icons/ChevronLeft.mjs.map +1 -1
- package/icons/ChevronRight.cjs.map +1 -1
- package/icons/ChevronRight.mjs.map +1 -1
- package/icons/ChevronUp.cjs +36 -0
- package/icons/ChevronUp.cjs.map +1 -0
- package/icons/ChevronUp.d.ts +5 -0
- package/icons/ChevronUp.mjs +25 -0
- package/icons/ChevronUp.mjs.map +1 -0
- package/icons/Circle.cjs.map +1 -1
- package/icons/Circle.mjs.map +1 -1
- package/icons/Close.cjs.map +1 -1
- package/icons/Close.mjs.map +1 -1
- package/icons/CloseCaptions.cjs.map +1 -1
- package/icons/CloseCaptions.mjs.map +1 -1
- package/icons/Code.cjs +36 -0
- package/icons/Code.cjs.map +1 -0
- package/icons/Code.d.ts +5 -0
- package/icons/Code.mjs +25 -0
- package/icons/Code.mjs.map +1 -0
- package/icons/Collection.cjs.map +1 -1
- package/icons/Collection.mjs.map +1 -1
- package/icons/ColorHarmony.cjs.map +1 -1
- package/icons/ColorHarmony.mjs.map +1 -1
- package/icons/CommentCheckmark.cjs.map +1 -1
- package/icons/CommentCheckmark.mjs.map +1 -1
- package/icons/CommentHide.cjs.map +1 -1
- package/icons/CommentHide.mjs.map +1 -1
- package/icons/CommentRemove.cjs.map +1 -1
- package/icons/CommentRemove.mjs.map +1 -1
- package/icons/Compare.cjs +42 -0
- package/icons/Compare.cjs.map +1 -0
- package/icons/Compare.d.ts +5 -0
- package/icons/Compare.mjs +31 -0
- package/icons/Compare.mjs.map +1 -0
- package/icons/ContextualTaskBar.cjs.map +1 -1
- package/icons/ContextualTaskBar.mjs.map +1 -1
- package/icons/CornerRadiusBottomLeft.cjs.map +1 -1
- package/icons/CornerRadiusBottomLeft.mjs.map +1 -1
- package/icons/CornerRadiusBottomRight.cjs.map +1 -1
- package/icons/CornerRadiusBottomRight.mjs.map +1 -1
- package/icons/CornerRadiusTopLeft.cjs.map +1 -1
- package/icons/CornerRadiusTopLeft.mjs.map +1 -1
- package/icons/CornerRadiusTopRight.cjs.map +1 -1
- package/icons/CornerRadiusTopRight.mjs.map +1 -1
- package/icons/CursorClick.cjs.map +1 -1
- package/icons/CursorClick.mjs.map +1 -1
- package/icons/Data.cjs +1 -1
- package/icons/Data.cjs.map +1 -1
- package/icons/Data.mjs +1 -1
- package/icons/Data.mjs.map +1 -1
- package/icons/DataAdd.cjs.map +1 -1
- package/icons/DataAdd.mjs.map +1 -1
- package/icons/DataRefresh.cjs +42 -0
- package/icons/DataRefresh.cjs.map +1 -0
- package/icons/DataRefresh.d.ts +5 -0
- package/icons/DataRefresh.mjs +31 -0
- package/icons/DataRefresh.mjs.map +1 -0
- package/icons/DataSettings.cjs +2 -2
- package/icons/DataSettings.cjs.map +1 -1
- package/icons/DataSettings.mjs +2 -2
- package/icons/DataSettings.mjs.map +1 -1
- package/icons/DataUpload.cjs +2 -2
- package/icons/DataUpload.cjs.map +1 -1
- package/icons/DataUpload.mjs +2 -2
- package/icons/DataUpload.mjs.map +1 -1
- package/icons/DeviceTablet.cjs.map +1 -1
- package/icons/DeviceTablet.mjs.map +1 -1
- package/icons/Draw.cjs.map +1 -1
- package/icons/Draw.mjs.map +1 -1
- package/icons/Edit.cjs.map +1 -1
- package/icons/Edit.mjs.map +1 -1
- package/icons/EditNo.cjs.map +1 -1
- package/icons/EditNo.mjs.map +1 -1
- package/icons/Email.cjs.map +1 -1
- package/icons/Email.mjs.map +1 -1
- package/icons/Enterprise.cjs +46 -0
- package/icons/Enterprise.cjs.map +1 -0
- package/icons/Enterprise.d.ts +5 -0
- package/icons/Enterprise.mjs +35 -0
- package/icons/Enterprise.mjs.map +1 -0
- package/icons/Export.cjs +42 -0
- package/icons/Export.cjs.map +1 -0
- package/icons/Export.d.ts +5 -0
- package/icons/Export.mjs +31 -0
- package/icons/Export.mjs.map +1 -0
- package/icons/Filter.cjs.map +1 -1
- package/icons/Filter.mjs.map +1 -1
- package/icons/FlipHorizontal.cjs +1 -21
- package/icons/FlipHorizontal.cjs.map +1 -1
- package/icons/FlipHorizontal.mjs +1 -21
- package/icons/FlipHorizontal.mjs.map +1 -1
- package/icons/FlipVertical.cjs +1 -21
- package/icons/FlipVertical.cjs.map +1 -1
- package/icons/FlipVertical.mjs +1 -21
- package/icons/FlipVertical.mjs.map +1 -1
- package/icons/FolderMoveTo.cjs.map +1 -1
- package/icons/FolderMoveTo.mjs.map +1 -1
- package/icons/FolderSearch.cjs +42 -0
- package/icons/FolderSearch.cjs.map +1 -0
- package/icons/FolderSearch.d.ts +5 -0
- package/icons/FolderSearch.mjs +31 -0
- package/icons/FolderSearch.mjs.map +1 -0
- package/icons/FontPicker.cjs.map +1 -1
- package/icons/FontPicker.mjs.map +1 -1
- package/icons/GlobeGrid.cjs.map +1 -1
- package/icons/GlobeGrid.mjs.map +1 -1
- package/icons/GradientHorizontal.cjs.map +1 -1
- package/icons/GradientHorizontal.mjs.map +1 -1
- package/icons/GridsAndRulers.cjs.map +1 -1
- package/icons/GridsAndRulers.mjs.map +1 -1
- package/icons/Image.cjs.map +1 -1
- package/icons/Image.mjs.map +1 -1
- package/icons/ImageAdd.cjs +1 -5
- package/icons/ImageAdd.cjs.map +1 -1
- package/icons/ImageAdd.mjs +1 -5
- package/icons/ImageAdd.mjs.map +1 -1
- package/icons/ImageBackgroundRemove.cjs.map +1 -1
- package/icons/ImageBackgroundRemove.mjs.map +1 -1
- package/icons/Images.cjs.map +1 -1
- package/icons/Images.mjs.map +1 -1
- package/icons/Import.cjs +42 -0
- package/icons/Import.cjs.map +1 -0
- package/icons/Import.d.ts +5 -0
- package/icons/Import.mjs +31 -0
- package/icons/Import.mjs.map +1 -0
- package/icons/Key.cjs +36 -0
- package/icons/Key.cjs.map +1 -0
- package/icons/Key.d.ts +5 -0
- package/icons/Key.mjs +25 -0
- package/icons/Key.mjs.map +1 -0
- package/icons/ListMultiSelect.cjs.map +1 -1
- package/icons/ListMultiSelect.mjs.map +1 -1
- package/icons/ListNumbered.cjs.map +1 -1
- package/icons/ListNumbered.mjs.map +1 -1
- package/icons/Logo.cjs.map +1 -1
- package/icons/Logo.mjs.map +1 -1
- package/icons/Market.cjs.map +1 -1
- package/icons/Market.mjs.map +1 -1
- package/icons/Microphone.cjs.map +1 -1
- package/icons/Microphone.mjs.map +1 -1
- package/icons/MicrophoneOff.cjs.map +1 -1
- package/icons/MicrophoneOff.mjs.map +1 -1
- package/icons/MusicNote.cjs.map +1 -1
- package/icons/MusicNote.mjs.map +1 -1
- package/icons/OrientationPortrait.cjs.map +1 -1
- package/icons/OrientationPortrait.mjs.map +1 -1
- package/icons/Pause.cjs.map +1 -1
- package/icons/Pause.mjs.map +1 -1
- package/icons/PauseCircle.cjs.map +1 -1
- package/icons/PauseCircle.mjs.map +1 -1
- package/icons/PeopleGroup.cjs +36 -0
- package/icons/PeopleGroup.cjs.map +1 -0
- package/icons/PeopleGroup.d.ts +5 -0
- package/icons/PeopleGroup.mjs +25 -0
- package/icons/PeopleGroup.mjs.map +1 -0
- package/icons/Percentage.cjs.map +1 -1
- package/icons/Percentage.mjs.map +1 -1
- package/icons/PinOff.cjs.map +1 -1
- package/icons/PinOff.mjs.map +1 -1
- package/icons/PinOn.cjs.map +1 -1
- package/icons/PinOn.mjs.map +1 -1
- package/icons/Play.cjs.map +1 -1
- package/icons/Play.mjs.map +1 -1
- package/icons/PluginGear.cjs.map +1 -1
- package/icons/PluginGear.mjs.map +1 -1
- package/icons/Polygon6.cjs.map +1 -1
- package/icons/Polygon6.mjs.map +1 -1
- package/icons/Publish.cjs.map +1 -1
- package/icons/Publish.mjs.map +1 -1
- package/icons/PublishNo.cjs.map +1 -1
- package/icons/PublishNo.mjs.map +1 -1
- package/icons/RadioButton.cjs.map +1 -1
- package/icons/RadioButton.mjs.map +1 -1
- package/icons/RectangleHoriz.cjs.map +1 -1
- package/icons/RectangleHoriz.mjs.map +1 -1
- package/icons/RocketQuickActions.cjs.map +1 -1
- package/icons/RocketQuickActions.mjs.map +1 -1
- package/icons/RotateCW.cjs.map +1 -1
- package/icons/RotateCW.mjs.map +1 -1
- package/icons/Ruler.cjs.map +1 -1
- package/icons/Ruler.mjs.map +1 -1
- package/icons/SaveFloppy.cjs +36 -0
- package/icons/SaveFloppy.cjs.map +1 -0
- package/icons/SaveFloppy.d.ts +5 -0
- package/icons/SaveFloppy.mjs +25 -0
- package/icons/SaveFloppy.mjs.map +1 -0
- package/icons/Select.cjs.map +1 -1
- package/icons/Select.mjs.map +1 -1
- package/icons/Send.cjs.map +1 -1
- package/icons/Send.mjs.map +1 -1
- package/icons/Shuffle.cjs.map +1 -1
- package/icons/Shuffle.mjs.map +1 -1
- package/icons/Skeleton.cjs +4 -2
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css.map +1 -1
- package/icons/Skeleton.mjs +4 -2
- package/icons/Skeleton.mjs.map +1 -1
- package/icons/SlowConnectionCircle.cjs.map +1 -1
- package/icons/SlowConnectionCircle.mjs.map +1 -1
- package/icons/SpeedFast.cjs +36 -0
- package/icons/SpeedFast.cjs.map +1 -0
- package/icons/SpeedFast.d.ts +5 -0
- package/icons/SpeedFast.mjs +25 -0
- package/icons/SpeedFast.mjs.map +1 -0
- package/icons/StepBackward.cjs.map +1 -1
- package/icons/StepBackward.mjs.map +1 -1
- package/icons/StepForward.cjs.map +1 -1
- package/icons/StepForward.mjs.map +1 -1
- package/icons/Table.cjs.map +1 -1
- package/icons/Table.mjs.map +1 -1
- package/icons/Tag.cjs.map +1 -1
- package/icons/Tag.mjs.map +1 -1
- package/icons/Target.cjs.map +1 -1
- package/icons/Target.mjs.map +1 -1
- package/icons/TextBold.cjs.map +1 -1
- package/icons/TextBold.mjs.map +1 -1
- package/icons/TextHighlight.cjs.map +1 -1
- package/icons/TextHighlight.mjs.map +1 -1
- package/icons/TextIncrease.cjs.map +1 -1
- package/icons/TextIncrease.mjs.map +1 -1
- package/icons/TextNumbers.cjs.map +1 -1
- package/icons/TextNumbers.mjs.map +1 -1
- package/icons/TextParagraph.cjs.map +1 -1
- package/icons/TextParagraph.mjs.map +1 -1
- package/icons/TextReplaceComment.cjs.map +1 -1
- package/icons/TextReplaceComment.mjs.map +1 -1
- package/icons/Tools.cjs.map +1 -1
- package/icons/Tools.mjs.map +1 -1
- package/icons/TouchOneFingerSwipeLeftRight.cjs.map +1 -1
- package/icons/TouchOneFingerSwipeLeftRight.mjs.map +1 -1
- package/icons/Transcript.cjs.map +1 -1
- package/icons/Transcript.mjs.map +1 -1
- package/icons/Translate.cjs.map +1 -1
- package/icons/Translate.mjs.map +1 -1
- package/icons/UserAvatarCursor.cjs.map +1 -1
- package/icons/UserAvatarCursor.mjs.map +1 -1
- package/icons/UserEdit.cjs.map +1 -1
- package/icons/UserEdit.mjs.map +1 -1
- package/icons/UserGroup.cjs.map +1 -1
- package/icons/UserGroup.mjs.map +1 -1
- package/icons/UserSettings.cjs +44 -0
- package/icons/UserSettings.cjs.map +1 -0
- package/icons/UserSettings.d.ts +5 -0
- package/icons/UserSettings.mjs +33 -0
- package/icons/UserSettings.mjs.map +1 -0
- package/icons/VectorDraw.cjs.map +1 -1
- package/icons/VectorDraw.mjs.map +1 -1
- package/icons/ViewGridFluid.cjs +36 -0
- package/icons/ViewGridFluid.cjs.map +1 -0
- package/icons/ViewGridFluid.d.ts +5 -0
- package/icons/ViewGridFluid.mjs +25 -0
- package/icons/ViewGridFluid.mjs.map +1 -0
- package/icons/ZoomIn.cjs.map +1 -1
- package/icons/ZoomIn.mjs.map +1 -1
- package/icons/ZoomOut.cjs.map +1 -1
- package/icons/ZoomOut.mjs.map +1 -1
- package/package.json +21 -21
- package/src/Breadcrumbs.tsx +7 -7
- package/src/CardView.tsx +8 -362
- package/src/Picker.tsx +78 -59
- package/src/SegmentedControl.tsx +4 -7
- package/src/Skeleton.tsx +2 -4
- package/src/TableView.tsx +64 -69
- package/src/Tooltip.tsx +1 -1
- package/src/TreeView.tsx +26 -25
- package/src/index.ts +2 -2
- package/src/style-utils.ts +0 -1
- package/icons/CloudStateDefault.cjs +0 -36
- package/icons/CloudStateDefault.cjs.map +0 -1
- package/icons/CloudStateDefault.mjs +0 -25
- package/icons/CloudStateDefault.mjs.map +0 -1
- package/icons/CloudStateDisconnected.cjs +0 -36
- package/icons/CloudStateDisconnected.cjs.map +0 -1
- package/icons/CloudStateDisconnected.mjs +0 -25
- package/icons/CloudStateDisconnected.mjs.map +0 -1
- package/icons/CloudStateError.cjs +0 -36
- package/icons/CloudStateError.cjs.map +0 -1
- package/icons/CloudStateError.mjs +0 -25
- package/icons/CloudStateError.mjs.map +0 -1
- package/icons/CloudStateErrorRed.cjs +0 -46
- package/icons/CloudStateErrorRed.cjs.map +0 -1
- package/icons/CloudStateErrorRed.mjs +0 -35
- package/icons/CloudStateErrorRed.mjs.map +0 -1
- package/icons/CloudStateInProgress.cjs +0 -36
- package/icons/CloudStateInProgress.cjs.map +0 -1
- package/icons/CloudStateInProgress.mjs +0 -25
- package/icons/CloudStateInProgress.mjs.map +0 -1
- package/icons/CloudStateOnline.cjs +0 -50
- package/icons/CloudStateOnline.cjs.map +0 -1
- package/icons/CloudStateOnline.mjs +0 -39
- package/icons/CloudStateOnline.mjs.map +0 -1
- package/icons/CloudStatePaused.cjs +0 -36
- package/icons/CloudStatePaused.cjs.map +0 -1
- package/icons/CloudStatePaused.mjs +0 -25
- package/icons/CloudStatePaused.mjs.map +0 -1
- package/icons/CloudStatePending.cjs +0 -42
- package/icons/CloudStatePending.cjs.map +0 -1
- package/icons/CloudStatePending.mjs +0 -31
- package/icons/CloudStatePending.mjs.map +0 -1
- package/icons/CloudStateSlowConnection.cjs +0 -36
- package/icons/CloudStateSlowConnection.cjs.map +0 -1
- package/icons/CloudStateSlowConnection.mjs +0 -25
- package/icons/CloudStateSlowConnection.mjs.map +0 -1
- /package/icons/{CloudStateDefault.d.ts → ABC.d.ts} +0 -0
- /package/icons/{CloudStateDisconnected.d.ts → App.d.ts} +0 -0
- /package/icons/{CloudStateError.d.ts → Bookmark.d.ts} +0 -0
- /package/icons/{CloudStateErrorRed.d.ts → Building.d.ts} +0 -0
- /package/icons/{CloudStateInProgress.d.ts → CallCenter.d.ts} +0 -0
- /package/icons/{CloudStateOnline.d.ts → ChartBarVert.d.ts} +0 -0
- /package/icons/{CloudStatePaused.d.ts → ChartPie.d.ts} +0 -0
- /package/icons/{CloudStatePending.d.ts → ChartTrend.d.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C,CAAA,GAAA,uCAAW,EAAE,EAAE,CAAC;oCAAC;gCAAC;6BAAE;4BAC/C;gCAAC,CAAA,GAAA,qCAAU;gCAAG;oCAAC,MAAM;gCAAmC;6BAAE;yBAC3D;kCACD,cAAA,gCAAC;4BAAI,KAAK;4BAAQ,OAAO,CAAA,GAAA,oCAAS,EAAE,QAAQ;2CAAC;4BAAS;4BAAI,SAAS;sCAChE,OAAO,MAAM,QAAQ,KAAK,yBAAW,gCAAC,CAAA,GAAA,8BAAG;0CAAG,MAAM,QAAQ;iCAAW,MAAM,QAAQ;;;;;;AAQlG","sources":["packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<Partial<SegmentedControlProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let isReduced = false;\n if (window?.matchMedia) {\n isReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !isReduced) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );\n});\n"],"names":[],"version":3,"file":"SegmentedControl.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AA4CM,MAAM,0DAA0B,CAAA,GAAA,0BAAY,EAA6E;AAEhI,MAAM;;;;;;;;;;;;;;;;;AAQN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AA0CN,MAAM,sEAAkC,CAAA,GAAA,0BAAY,EAAwC,CAAC;AAKtF,MAAM,4CAAmB,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,iBAAiB,KAA4B,EAAE,GAA2B;IAC1I,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,sBACF,kBAAkB,eAClB,WAAW,qBACX,iBAAiB,EAClB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,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AAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,kCAAY;gBAAC,GAAG,WAAW;6BAAE;YAAW,GAAG,MAAM,MAAM;kBACjH,CAAC,cAAC,UAAU,aAAE,SAAS,cAAE,UAAU,EAAC,iBACnC;;oBACG,4BAAc,gCAAC;wBAAI,WAAW,6BAAO;wCAAC;wBAAU;wBAAI,KAAK;;kCAC1D,gCAAC,CAAA,GAAA,mCAAO;wBACN,QAAQ;4BACN;gCAAC,CAAA,GAAA,qCAAU;gCAAG;oCACZ,QAAQ,CAAA,GAAA,wCAAa,EAAE;wCAAC,MAAM;wCAAQ,MAAM;oCAAkC;gCAChF;6BAAE;4BACF;gCAAC,CAAA,GAAA,sCAAa;gCAAG;oCAAC,OAAO;wCAAC,CAAC,CAAA,GAAA,uCAAW,EAAE,EAAE,CAAC;oCAAC;gCAAC;6BAAE;4BAC/C;gCAAC,CAAA,GAAA,qCAAU;gCAAG;oCAAC,MAAM;gCAAmC;6BAAE;yBAC3D;kCACD,cAAA,gCAAC;4BAAI,KAAK;4BAAQ,OAAO,CAAA,GAAA,oCAAS,EAAE,QAAQ;2CAAC;4BAAS;4BAAI,SAAS;sCAChE,OAAO,MAAM,QAAQ,KAAK,yBAAW,gCAAC,CAAA,GAAA,8BAAG;0CAAG,MAAM,QAAQ;iCAAW,MAAM,QAAQ;;;;;;AAQlG","sources":["packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef, useMediaQuery} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<Partial<SegmentedControlProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !reduceMotion) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected, reduceMotion]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );\n});\n"],"names":[],"version":3,"file":"SegmentedControl.cjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACwDyB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6CL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkK+C;;;;EAAA;;;;EAGzB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAE4C;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA5NxD;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IA6CL;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AA7CK;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAoN6D;;;;IAAA","sources":["90909571be522c78","packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["@import \"3076f581d900045a\";\n@import \"37c2fdb040131115\";\n@import \"d075b97bae773d34\";\n@import \"6903fca31535b056\";\n@import \"a6b79b4602e6c53c\";\n@import \"c3f3a2eb3541e76f\";\n","/*\n * Copyright 2024 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 {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<Partial<SegmentedControlProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let isReduced = false;\n if (window?.matchMedia) {\n isReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !isReduced) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );\n});\n"],"names":[],"version":3,"file":"SegmentedControl.css.map"}
|
|
1
|
+
{"mappings":"ACwDyB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6CL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA+J+C;;;;EAAA;;;;EAGzB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAE4C;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAzNxD;EAQL;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IA6CL;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AA7CK;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAiN6D;;;;IAAA","sources":["90909571be522c78","packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["@import \"3076f581d900045a\";\n@import \"37c2fdb040131115\";\n@import \"d075b97bae773d34\";\n@import \"6903fca31535b056\";\n@import \"a6b79b4602e6c53c\";\n@import \"c3f3a2eb3541e76f\";\n","/*\n * Copyright 2024 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 {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef, useMediaQuery} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<Partial<SegmentedControlProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !reduceMotion) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected, reduceMotion]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );\n});\n"],"names":[],"version":3,"file":"SegmentedControl.css.map"}
|
|
@@ -7,7 +7,7 @@ import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} fr
|
|
|
7
7
|
import {jsx as $ae3Tm$jsx, jsxs as $ae3Tm$jsxs, Fragment as $ae3Tm$Fragment} from "react/jsx-runtime";
|
|
8
8
|
import {ToggleButtonGroup as $ae3Tm$ToggleButtonGroup, ToggleGroupStateContext as $ae3Tm$ToggleGroupStateContext, Provider as $ae3Tm$Provider, ToggleButton as $ae3Tm$ToggleButton, TextContext as $ae3Tm$TextContext, DEFAULT_SLOT as $ae3Tm$DEFAULT_SLOT} from "react-aria-components";
|
|
9
9
|
import {createContext as $ae3Tm$createContext, forwardRef as $ae3Tm$forwardRef, useRef as $ae3Tm$useRef, useContext as $ae3Tm$useContext, useCallback as $ae3Tm$useCallback} from "react";
|
|
10
|
-
import {useDOMRef as $ae3Tm$useDOMRef, useFocusableRef as $ae3Tm$useFocusableRef} from "@react-spectrum/utils";
|
|
10
|
+
import {useDOMRef as $ae3Tm$useDOMRef, useFocusableRef as $ae3Tm$useFocusableRef, useMediaQuery as $ae3Tm$useMediaQuery} from "@react-spectrum/utils";
|
|
11
11
|
import {useLayoutEffect as $ae3Tm$useLayoutEffect} from "@react-aria/utils";
|
|
12
12
|
|
|
13
13
|
/*
|
|
@@ -236,13 +236,12 @@ const $c679c2152e03f8bf$export$4fc12f2742e8cf3f = /*#__PURE__*/ (0, $ae3Tm$forwa
|
|
|
236
236
|
let state = (0, $ae3Tm$useContext)((0, $ae3Tm$ToggleGroupStateContext));
|
|
237
237
|
let isSelected = state?.selectedKeys.has(props.id);
|
|
238
238
|
// do not apply animation if a user has the prefers-reduced-motion setting
|
|
239
|
-
let
|
|
240
|
-
if (window?.matchMedia) isReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
239
|
+
let reduceMotion = (0, $ae3Tm$useMediaQuery)('(prefers-reduced-motion: reduce)');
|
|
241
240
|
(0, $ae3Tm$useLayoutEffect)(()=>{
|
|
242
241
|
register?.(props.id);
|
|
243
242
|
}, []);
|
|
244
243
|
(0, $ae3Tm$useLayoutEffect)(()=>{
|
|
245
|
-
if (isSelected && prevRef?.current && currentSelectedRef?.current && !
|
|
244
|
+
if (isSelected && prevRef?.current && currentSelectedRef?.current && !reduceMotion) {
|
|
246
245
|
let currentItem = currentSelectedRef?.current.getBoundingClientRect();
|
|
247
246
|
let deltaX = prevRef?.current.left - currentItem?.left;
|
|
248
247
|
currentSelectedRef.current.animate([
|
|
@@ -261,7 +260,8 @@ const $c679c2152e03f8bf$export$4fc12f2742e8cf3f = /*#__PURE__*/ (0, $ae3Tm$forwa
|
|
|
261
260
|
prevRef.current = null;
|
|
262
261
|
}
|
|
263
262
|
}, [
|
|
264
|
-
isSelected
|
|
263
|
+
isSelected,
|
|
264
|
+
reduceMotion
|
|
265
265
|
]);
|
|
266
266
|
return /*#__PURE__*/ (0, $ae3Tm$jsx)((0, $ae3Tm$ToggleButton), {
|
|
267
267
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AA4CM,MAAM,0DAA0B,CAAA,GAAA,oBAAY,EAA6E;AAEhI,MAAM;;;;;;;;;;;;;;;;;AAQN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AA0CN,MAAM,sEAAkC,CAAA,GAAA,oBAAY,EAAwC,CAAC;AAKtF,MAAM,4CAAmB,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE,SAAS,iBAAiB,KAA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AAA;aAC/D,EACD;gBACE,UAAU;gBACV,QAAQ;YACV;YAGF,QAAQ,OAAO,GAAG;QACpB;IACF,GAAG;QAAC;KAAW;IAEf,qBACE,gBAAC,CAAA,GAAA,mBAAW;QACT,GAAG,KAAK;QACT,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,kCAAY;gBAAC,GAAG,WAAW;6BAAE;YAAW,GAAG,MAAM,MAAM;kBACjH,CAAC,cAAC,UAAU,aAAE,SAAS,cAAE,UAAU,EAAC,iBACnC;;oBACG,4BAAc,gBAAC;wBAAI,WAAW,6BAAO;wCAAC;wBAAU;wBAAI,KAAK;;kCAC1D,gBAAC,CAAA,GAAA,eAAO;wBACN,QAAQ;4BACN;gCAAC,CAAA,GAAA,yCAAU;gCAAG;oCACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;wCAAC,MAAM;wCAAQ,MAAM;oCAAkC;gCAChF;6BAAE;4BACF;gCAAC,CAAA,GAAA,kBAAa;gCAAG;oCAAC,OAAO;wCAAC,CAAC,CAAA,GAAA,mBAAW,EAAE,EAAE,CAAC;oCAAC;gCAAC;6BAAE;4BAC/C;gCAAC,CAAA,GAAA,yCAAU;gCAAG;oCAAC,MAAM;gCAAmC;6BAAE;yBAC3D;kCACD,cAAA,gBAAC;4BAAI,KAAK;4BAAQ,OAAO,CAAA,GAAA,yCAAS,EAAE,QAAQ;2CAAC;4BAAS;4BAAI,SAAS;sCAChE,OAAO,MAAM,QAAQ,KAAK,yBAAW,gBAAC,CAAA,GAAA,yCAAG;0CAAG,MAAM,QAAQ;iCAAW,MAAM,QAAQ;;;;;;AAQlG","sources":["packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<Partial<SegmentedControlProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let isReduced = false;\n if (window?.matchMedia) {\n isReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !isReduced) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );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,GAAA,yCAAU;gCAAG;oCAAC,MAAM;gCAAmC;6BAAE;yBAC3D;kCACD,cAAA,gBAAC;4BAAI,KAAK;4BAAQ,OAAO,CAAA,GAAA,yCAAS,EAAE,QAAQ;2CAAC;4BAAS;4BAAI,SAAS;sCAChE,OAAO,MAAM,QAAQ,KAAK,yBAAW,gBAAC,CAAA,GAAA,yCAAG;0CAAG,MAAM,QAAQ;iCAAW,MAAM,QAAQ;;;;;;AAQlG","sources":["packages/@react-spectrum/s2/src/SegmentedControl.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaLabelingProps, DOMRef, DOMRefValue, FocusableRef, Key} from '@react-types/shared';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, DEFAULT_SLOT, Provider, TextContext as RACTextContext, SlotProps, ToggleButton, ToggleButtonGroup, ToggleGroupStateContext} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, RefObject, useCallback, useContext, useRef} from 'react';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef, useFocusableRef, useMediaQuery} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface SegmentedControlProps extends AriaLabelingProps, StyleProps, SlotProps {\n /**\n * The content to display in the segmented control.\n */\n children: ReactNode,\n /**\n * Whether the segmented control is disabled.\n */\n isDisabled?: boolean,\n /** Whether the items should divide the container width equally. */\n isJustified?: boolean,\n /** The id of the currently selected item (controlled). */\n selectedKey?: Key | null,\n /** The id of the initial selected item (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (id: Key) => void\n}\nexport interface SegmentedControlItemProps extends AriaLabelingProps, StyleProps {\n /**\n * The content to display in the segmented control item.\n */\n children: ReactNode,\n /** The id of the item, matching the value used in SegmentedControl's `selectedKey` prop. */\n id: Key,\n /** Whether the item is disabled or not. */\n isDisabled?: boolean\n}\n\nexport const SegmentedControlContext = createContext<ContextValue<Partial<SegmentedControlProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst segmentedControl = style({\n display: 'flex',\n gap: 4,\n backgroundColor: 'gray-100',\n borderRadius: 'default',\n width: 'fit'\n}, getAllowedOverrides());\n\nconst controlItem = style({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n forcedColorAdjust: 'none',\n font: 'control',\n color: {\n default: 'gray-700',\n isHovered: 'neutral-subdued',\n isSelected: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isDisabled: 'GrayText',\n isSelected: 'HighlightText'\n }\n },\n // TODO: update this padding for icon-only items when we introduce the non-track style back\n paddingX: {\n default: 'edge-to-text',\n ':has([slot=icon]):not(:has([data-rsp-slot=text]))': space(6)\n },\n height: 32,\n alignItems: 'center',\n flexGrow: {\n isJustified: 1\n },\n flexBasis: {\n isJustified: 0\n },\n flexShrink: 0,\n minWidth: 0,\n justifyContent: 'center',\n whiteSpace: 'nowrap',\n disableTapHighlight: true,\n userSelect: 'none',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n borderRadius: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n}, getAllowedOverrides());\n\nconst slider = style({\n backgroundColor: {\n default: 'gray-25',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n left: 0,\n width: 'full',\n height: 'full',\n position: 'absolute',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'gray-900',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'lg'\n});\n\ninterface InternalSegmentedControlContextProps {\n register?: (value: Key, isDisabled?: boolean) => void,\n prevRef?: RefObject<DOMRect | null>,\n currentSelectedRef?: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\ninterface DefaultSelectionTrackProps {\n defaultValue?: Key | null,\n value?: Key | null,\n children: ReactNode,\n prevRef: RefObject<DOMRect | null>,\n currentSelectedRef: RefObject<HTMLDivElement | null>,\n isJustified?: boolean\n}\n\nconst InternalSegmentedControlContext = createContext<InternalSegmentedControlContextProps>({});\n\n/**\n * A SegmentedControl is a mutually exclusive group of buttons used for view switching.\n */\nexport const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedControl(props: SegmentedControlProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, SegmentedControlContext);\n let {\n defaultSelectedKey,\n selectedKey,\n onSelectionChange\n } = props;\n let domRef = useDOMRef(ref);\n\n let prevRef = useRef<DOMRect>(null);\n let currentSelectedRef = useRef<HTMLDivElement>(null);\n\n let onChange = (values: Set<Key>) => {\n if (currentSelectedRef.current) {\n prevRef.current = currentSelectedRef?.current.getBoundingClientRect();\n }\n \n if (onSelectionChange) {\n onSelectionChange(values.values().next().value);\n }\n };\n\n return (\n <ToggleButtonGroup \n {...props}\n selectedKeys={selectedKey != null ? [selectedKey] : undefined}\n defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}\n disallowEmptySelection\n ref={domRef}\n orientation=\"horizontal\"\n style={props.UNSAFE_style}\n onSelectionChange={onChange}\n className={(props.UNSAFE_className || '') + segmentedControl(null, props.styles)}\n aria-label={props['aria-label']}>\n <DefaultSelectionTracker defaultValue={defaultSelectedKey} value={selectedKey} prevRef={prevRef} currentSelectedRef={currentSelectedRef} isJustified={props.isJustified}>\n {props.children}\n </DefaultSelectionTracker>\n </ToggleButtonGroup>\n );\n});\n\nfunction DefaultSelectionTracker(props: DefaultSelectionTrackProps) {\n let state = useContext(ToggleGroupStateContext);\n let isRegistered = useRef(!(props.defaultValue == null && props.value == null));\n\n // default select the first available item\n let register = useCallback((value: Key) => {\n if (state && !isRegistered.current) {\n isRegistered.current = true;\n state.toggleKey(value);\n }\n }, []);\n\n return (\n <Provider\n values={[\n [InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]\n ]}> \n {props.children}\n </Provider>\n );\n}\n\n/**\n * A SegmentedControlItem represents an option within a SegmentedControl.\n */\nexport const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRef<HTMLButtonElement>) {\n let domRef = useFocusableRef(ref);\n let divRef = useRef<HTMLDivElement>(null);\n let {register, prevRef, currentSelectedRef, isJustified} = useContext(InternalSegmentedControlContext);\n let state = useContext(ToggleGroupStateContext);\n let isSelected = state?.selectedKeys.has(props.id);\n // do not apply animation if a user has the prefers-reduced-motion setting\n let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n\n useLayoutEffect(() => {\n register?.(props.id);\n }, []);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && currentSelectedRef?.current && !reduceMotion) {\n let currentItem = currentSelectedRef?.current.getBoundingClientRect();\n\n let deltaX = prevRef?.current.left - currentItem?.left;\n\n currentSelectedRef.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef?.current.width}px`},\n {transform: 'translateX(0px)', width: `${currentItem.width}px`}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n\n prevRef.current = null;\n }\n }, [isSelected, reduceMotion]);\n\n return (\n <ToggleButton \n {...props}\n ref={domRef} \n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >\n {({isSelected, isPressed, isDisabled}) => (\n <>\n {isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}\n <Provider \n values={[\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})\n }],\n [RACTextContext, {slots: {[DEFAULT_SLOT]: {}}}],\n [TextContext, {styles: style({order: 1, truncate: true})}]\n ]}>\n <div ref={divRef} style={pressScale(divRef)({isPressed})} className={style({display: 'flex', gap: 'text-to-visual', transition: 'default', alignItems: 'center', minWidth: 0})}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </div>\n </Provider>\n </>\n )\n }\n </ToggleButton>\n );\n});\n"],"names":[],"version":3,"file":"SegmentedControl.mjs.map"}
|
package/dist/TableView.cjs
CHANGED
|
@@ -147,13 +147,7 @@ const $bed37377ec7a3a9e$var$ROW_HEIGHTS = {
|
|
|
147
147
|
large: 60
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
class $bed37377ec7a3a9e$export$4e03bdf0174fd602 extends (0, $iLVc8$reactariacomponents.
|
|
151
|
-
constructor(options){
|
|
152
|
-
super({
|
|
153
|
-
...options,
|
|
154
|
-
loaderHeight: 60
|
|
155
|
-
});
|
|
156
|
-
}
|
|
150
|
+
class $bed37377ec7a3a9e$export$4e03bdf0174fd602 extends (0, $iLVc8$reactariacomponents.TableLayout) {
|
|
157
151
|
isStickyColumn(node) {
|
|
158
152
|
return node.props.isSticky;
|
|
159
153
|
}
|
|
@@ -216,18 +210,6 @@ const $bed37377ec7a3a9e$export$b3c27e869d856b7 = /*#__PURE__*/ (0, $iLVc8$react.
|
|
|
216
210
|
let { UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className, isQuiet: isQuiet = false, density: density = 'regular', overflowMode: overflowMode = 'truncate', styles: styles, loadingState: loadingState, onLoadMore: onLoadMore, onResize: propsOnResize, onResizeStart: propsOnResizeStart, onResizeEnd: propsOnResizeEnd, onAction: onAction, ...otherProps } = props;
|
|
217
211
|
let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
|
|
218
212
|
let scale = (0, $ee7b4c497f520c08$exports.useScale)();
|
|
219
|
-
let layout = (0, $iLVc8$react.useMemo)(()=>{
|
|
220
|
-
return new $bed37377ec7a3a9e$export$4e03bdf0174fd602({
|
|
221
|
-
rowHeight: overflowMode === 'wrap' ? undefined : $bed37377ec7a3a9e$var$ROW_HEIGHTS[density][scale],
|
|
222
|
-
estimatedRowHeight: overflowMode === 'wrap' ? $bed37377ec7a3a9e$var$ROW_HEIGHTS[density][scale] : undefined,
|
|
223
|
-
// No need for estimated headingHeight since the headers aren't affected by overflow mode: wrap
|
|
224
|
-
headingHeight: $bed37377ec7a3a9e$var$DEFAULT_HEADER_HEIGHT[scale]
|
|
225
|
-
});
|
|
226
|
-
}, [
|
|
227
|
-
overflowMode,
|
|
228
|
-
density,
|
|
229
|
-
scale
|
|
230
|
-
]);
|
|
231
213
|
// Starts when the user selects resize from the menu, ends when resizing ends
|
|
232
214
|
// used to control the visibility of the resizer Nubbin
|
|
233
215
|
let [isInResizeMode, setIsInResizeMode] = (0, $iLVc8$react.useState)(false);
|
|
@@ -282,8 +264,15 @@ const $bed37377ec7a3a9e$export$b3c27e869d856b7 = /*#__PURE__*/ (0, $iLVc8$react.
|
|
|
282
264
|
className: (UNSAFE_className || '') + (0, $308b180f49d82d28$exports.mergeStyles)($bed37377ec7a3a9e$var$tableWrapper, styles),
|
|
283
265
|
style: UNSAFE_style,
|
|
284
266
|
children: [
|
|
285
|
-
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.
|
|
286
|
-
layout:
|
|
267
|
+
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Virtualizer), {
|
|
268
|
+
layout: $bed37377ec7a3a9e$export$4e03bdf0174fd602,
|
|
269
|
+
layoutOptions: {
|
|
270
|
+
rowHeight: overflowMode === 'wrap' ? undefined : $bed37377ec7a3a9e$var$ROW_HEIGHTS[density][scale],
|
|
271
|
+
estimatedRowHeight: overflowMode === 'wrap' ? $bed37377ec7a3a9e$var$ROW_HEIGHTS[density][scale] : undefined,
|
|
272
|
+
// No need for estimated headingHeight since the headers aren't affected by overflow mode: wrap
|
|
273
|
+
headingHeight: $bed37377ec7a3a9e$var$DEFAULT_HEADER_HEIGHT[scale],
|
|
274
|
+
loaderHeight: 60
|
|
275
|
+
},
|
|
287
276
|
children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$InternalTableContext.Provider, {
|
|
288
277
|
value: context,
|
|
289
278
|
children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Table), {
|
|
@@ -467,7 +456,6 @@ const $bed37377ec7a3a9e$var$columnStyles = function anonymous(props) {
|
|
|
467
456
|
return rules;
|
|
468
457
|
};
|
|
469
458
|
const $bed37377ec7a3a9e$export$816b5d811295e6bc = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function Column(props, ref) {
|
|
470
|
-
let { isHeaderRowHovered: isHeaderRowHovered } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableHeaderContext);
|
|
471
459
|
let { isQuiet: isQuiet } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
|
|
472
460
|
let { allowsResizing: allowsResizing, children: children, align: align = 'start' } = props;
|
|
473
461
|
let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
|
|
@@ -484,7 +472,7 @@ const $bed37377ec7a3a9e$export$816b5d811295e6bc = /*#__PURE__*/ (0, $iLVc8$react
|
|
|
484
472
|
align: align,
|
|
485
473
|
isQuiet: isQuiet
|
|
486
474
|
}),
|
|
487
|
-
children: ({ allowsSorting: allowsSorting, sortDirection: sortDirection, isFocusVisible: isFocusVisible, sort: sort, startResize: startResize
|
|
475
|
+
children: ({ allowsSorting: allowsSorting, sortDirection: sortDirection, isFocusVisible: isFocusVisible, sort: sort, startResize: startResize })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
|
|
488
476
|
children: [
|
|
489
477
|
isFocusVisible && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$CellFocusRing, {}),
|
|
490
478
|
isColumnResizable ? /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$ResizableColumnContents, {
|
|
@@ -492,7 +480,6 @@ const $bed37377ec7a3a9e$export$816b5d811295e6bc = /*#__PURE__*/ (0, $iLVc8$react
|
|
|
492
480
|
sortDirection: sortDirection,
|
|
493
481
|
sort: sort,
|
|
494
482
|
startResize: startResize,
|
|
495
|
-
isHovered: isHeaderRowHovered || isHovered,
|
|
496
483
|
align: align,
|
|
497
484
|
children: children
|
|
498
485
|
}) : /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$ColumnContents, {
|
|
@@ -595,9 +582,9 @@ const $bed37377ec7a3a9e$var$resizableMenuButtonWrapper = function anonymous(prop
|
|
|
595
582
|
};
|
|
596
583
|
const $bed37377ec7a3a9e$var$resizerHandleContainer = function anonymous(props) {
|
|
597
584
|
let rules = " .";
|
|
598
|
-
if (props.
|
|
585
|
+
if (props.isInResizeMode) rules += ' _0a';
|
|
599
586
|
else if (props.isResizing) rules += ' _0a';
|
|
600
|
-
else rules += '
|
|
587
|
+
else rules += ' _0-zw4ipl';
|
|
601
588
|
rules += ' lA';
|
|
602
589
|
rules += ' kb';
|
|
603
590
|
rules += ' Va';
|
|
@@ -617,8 +604,7 @@ const $bed37377ec7a3a9e$var$resizerHandle = function anonymous(props) {
|
|
|
617
604
|
else rules += ' ba_____H';
|
|
618
605
|
if (props.isResizing) rules += ' b-14crvkh';
|
|
619
606
|
else if (props.isFocusVisible) rules += ' b-14crvkh';
|
|
620
|
-
else
|
|
621
|
-
else rules += ' ba';
|
|
607
|
+
else rules += ' bi';
|
|
622
608
|
if (props.isResizing) rules += ' kn';
|
|
623
609
|
else rules += ' kb';
|
|
624
610
|
if (props.isResizing) rules += ' lq';
|
|
@@ -631,7 +617,7 @@ const $bed37377ec7a3a9e$var$columnHeaderText = " __wb __xb _na _qb q-1wikn8b __a
|
|
|
631
617
|
const $bed37377ec7a3a9e$var$chevronIcon = " R-3hn0u yG ybH q-1wikn8b _9-3t1x -rwx0fg_e-b";
|
|
632
618
|
const $bed37377ec7a3a9e$var$nubbin = " Va Ya W-avx9c1 l-1wikn8b k-1wikn8b e-14crvkh ea______a -rwx0fg_e-A -rwx0fg_e-a______b";
|
|
633
619
|
function $bed37377ec7a3a9e$var$ResizableColumnContents(props) {
|
|
634
|
-
let { allowsSorting: allowsSorting, sortDirection: sortDirection, sort: sort, startResize: startResize, children: children,
|
|
620
|
+
let { allowsSorting: allowsSorting, sortDirection: sortDirection, sort: sort, startResize: startResize, children: children, align: align } = props;
|
|
635
621
|
let { setIsInResizeMode: setIsInResizeMode, isInResizeMode: isInResizeMode } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
|
|
636
622
|
let stringFormatter = (0, $iLVc8$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
|
|
637
623
|
const onMenuSelect = (key)=>{
|
|
@@ -729,14 +715,13 @@ function $bed37377ec7a3a9e$var$ResizableColumnContents(props) {
|
|
|
729
715
|
className: ({ resizableDirection: resizableDirection, isResizing: isResizing })=>$bed37377ec7a3a9e$var$resizerHandleContainer({
|
|
730
716
|
resizableDirection: resizableDirection,
|
|
731
717
|
isResizing: isResizing,
|
|
732
|
-
|
|
718
|
+
isInResizeMode: isInResizeMode
|
|
733
719
|
}),
|
|
734
720
|
children: ({ isFocusVisible: isFocusVisible, isResizing: isResizing })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
|
|
735
721
|
children: [
|
|
736
722
|
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$ResizerIndicator, {
|
|
737
723
|
isInResizeMode: isInResizeMode,
|
|
738
724
|
isFocusVisible: isFocusVisible,
|
|
739
|
-
isHovered: isHovered,
|
|
740
725
|
isResizing: isResizing
|
|
741
726
|
}),
|
|
742
727
|
(isFocusVisible || isInResizeMode) && isResizing && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
|
|
@@ -750,16 +735,25 @@ function $bed37377ec7a3a9e$var$ResizableColumnContents(props) {
|
|
|
750
735
|
]
|
|
751
736
|
});
|
|
752
737
|
}
|
|
753
|
-
function $bed37377ec7a3a9e$var$ResizerIndicator({ isFocusVisible: isFocusVisible,
|
|
738
|
+
function $bed37377ec7a3a9e$var$ResizerIndicator({ isFocusVisible: isFocusVisible, isResizing: isResizing, isInResizeMode: isInResizeMode }) {
|
|
754
739
|
return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
|
|
755
740
|
className: $bed37377ec7a3a9e$var$resizerHandle({
|
|
756
741
|
isFocusVisible: isFocusVisible,
|
|
757
|
-
|
|
742
|
+
isInResizeMode: isInResizeMode,
|
|
758
743
|
isResizing: isResizing
|
|
759
744
|
})
|
|
760
745
|
});
|
|
761
746
|
}
|
|
762
|
-
const $bed37377ec7a3a9e$var$tableHeader =
|
|
747
|
+
const $bed37377ec7a3a9e$var$tableHeader = function anonymous(props) {
|
|
748
|
+
let rules = " .";
|
|
749
|
+
rules += ' kb';
|
|
750
|
+
rules += ' lb';
|
|
751
|
+
rules += ' bf';
|
|
752
|
+
rules += ' A-yj899n';
|
|
753
|
+
if (props.isHovered) rules += ' -zw4ipl__0-a';
|
|
754
|
+
else rules += ' -zw4ipl__0-j';
|
|
755
|
+
return rules;
|
|
756
|
+
};
|
|
763
757
|
const $bed37377ec7a3a9e$var$selectAllCheckbox = " yf";
|
|
764
758
|
const $bed37377ec7a3a9e$var$selectAllCheckboxColumn = function anonymous(props) {
|
|
765
759
|
let rules = " .";
|
|
@@ -783,56 +777,46 @@ const $bed37377ec7a3a9e$var$selectAllCheckboxColumn = function anonymous(props)
|
|
|
783
777
|
rules += ' bf';
|
|
784
778
|
return rules;
|
|
785
779
|
};
|
|
786
|
-
let $bed37377ec7a3a9e$var$InternalTableHeaderContext = /*#__PURE__*/ (0, $iLVc8$react.createContext)({
|
|
787
|
-
isHeaderRowHovered: false
|
|
788
|
-
});
|
|
789
780
|
const $bed37377ec7a3a9e$export$f850895b287ef28e = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function TableHeader({ columns: columns, children: children }, ref) {
|
|
790
781
|
let scale = (0, $ee7b4c497f520c08$exports.useScale)();
|
|
791
782
|
let { selectionBehavior: selectionBehavior, selectionMode: selectionMode } = (0, $iLVc8$reactariacomponents.useTableOptions)();
|
|
792
783
|
let { isQuiet: isQuiet } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
|
|
793
|
-
let [isHeaderRowHovered, setHeaderRowHovered] = (0, $iLVc8$react.useState)(false);
|
|
794
784
|
let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
|
|
795
|
-
return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
children:
|
|
785
|
+
return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.TableHeader), {
|
|
786
|
+
// @ts-ignore
|
|
787
|
+
ref: domRef,
|
|
788
|
+
className: $bed37377ec7a3a9e$var$tableHeader,
|
|
789
|
+
children: [
|
|
790
|
+
selectionBehavior === 'toggle' && // Also isSticky prop is applied just for the layout, will decide what the RAC api should be later
|
|
800
791
|
// @ts-ignore
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Column), {
|
|
808
|
-
isSticky: true,
|
|
809
|
-
width: scale === 'medium' ? 40 : 52,
|
|
810
|
-
minWidth: scale === 'medium' ? 40 : 52,
|
|
811
|
-
className: $bed37377ec7a3a9e$var$selectAllCheckboxColumn({
|
|
812
|
-
isQuiet: isQuiet
|
|
813
|
-
}),
|
|
814
|
-
children: ({ isFocusVisible: isFocusVisible })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
|
|
815
|
-
children: [
|
|
816
|
-
selectionMode === 'single' && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
|
|
817
|
-
children: [
|
|
818
|
-
isFocusVisible && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$CellFocusRing, {}),
|
|
819
|
-
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$VisuallyHiddenSelectAllLabel, {})
|
|
820
|
-
]
|
|
821
|
-
}),
|
|
822
|
-
selectionMode === 'multiple' && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $af04e099a53d3e85$exports.Checkbox), {
|
|
823
|
-
isEmphasized: true,
|
|
824
|
-
styles: $bed37377ec7a3a9e$var$selectAllCheckbox,
|
|
825
|
-
slot: "selection"
|
|
826
|
-
})
|
|
827
|
-
]
|
|
828
|
-
})
|
|
792
|
+
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Column), {
|
|
793
|
+
isSticky: true,
|
|
794
|
+
width: scale === 'medium' ? 40 : 52,
|
|
795
|
+
minWidth: scale === 'medium' ? 40 : 52,
|
|
796
|
+
className: $bed37377ec7a3a9e$var$selectAllCheckboxColumn({
|
|
797
|
+
isQuiet: isQuiet
|
|
829
798
|
}),
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
799
|
+
children: ({ isFocusVisible: isFocusVisible })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
|
|
800
|
+
children: [
|
|
801
|
+
selectionMode === 'single' && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
|
|
802
|
+
children: [
|
|
803
|
+
isFocusVisible && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$CellFocusRing, {}),
|
|
804
|
+
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$VisuallyHiddenSelectAllLabel, {})
|
|
805
|
+
]
|
|
806
|
+
}),
|
|
807
|
+
selectionMode === 'multiple' && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $af04e099a53d3e85$exports.Checkbox), {
|
|
808
|
+
isEmphasized: true,
|
|
809
|
+
styles: $bed37377ec7a3a9e$var$selectAllCheckbox,
|
|
810
|
+
slot: "selection"
|
|
811
|
+
})
|
|
812
|
+
]
|
|
813
|
+
})
|
|
814
|
+
}),
|
|
815
|
+
/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Collection), {
|
|
816
|
+
items: columns,
|
|
817
|
+
children: children
|
|
818
|
+
})
|
|
819
|
+
]
|
|
836
820
|
});
|
|
837
821
|
});
|
|
838
822
|
function $bed37377ec7a3a9e$var$VisuallyHiddenSelectAllLabel() {
|