@sharedex/ui 0.9.0 → 0.10.0
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/README.md +37 -2
- package/dist/backgrounds/hosts/CssHost.d.ts +2 -6
- package/dist/backgrounds/hosts/CssHost.js +3 -17
- package/dist/backgrounds/hosts/styleHref.d.ts +6 -0
- package/dist/backgrounds/hosts/styleHref.js +20 -0
- package/dist/buttons/pick.d.ts +9 -3
- package/dist/buttons/pick.js +4 -1
- package/dist/forms/base.d.ts +1 -0
- package/dist/forms/base.js +224 -0
- package/dist/forms/buddy.d.ts +6 -0
- package/dist/forms/buddy.js +150 -0
- package/dist/forms/chips.d.ts +1 -0
- package/dist/forms/chips.js +140 -0
- package/dist/forms/choice.d.ts +1 -0
- package/dist/forms/choice.js +208 -0
- package/dist/forms/controls/CheckGroup.d.ts +65 -0
- package/dist/forms/controls/CheckGroup.js +99 -0
- package/dist/forms/controls/Checkbox.d.ts +43 -0
- package/dist/forms/controls/Checkbox.js +67 -0
- package/dist/forms/controls/ChipGroup.d.ts +50 -0
- package/dist/forms/controls/ChipGroup.js +56 -0
- package/dist/forms/controls/Combobox.d.ts +75 -0
- package/dist/forms/controls/Combobox.js +249 -0
- package/dist/forms/controls/ErrorSummary.d.ts +29 -0
- package/dist/forms/controls/ErrorSummary.js +79 -0
- package/dist/forms/controls/Field.d.ts +92 -0
- package/dist/forms/controls/Field.js +219 -0
- package/dist/forms/controls/FileDrop.d.ts +81 -0
- package/dist/forms/controls/FileDrop.js +328 -0
- package/dist/forms/controls/FormBuddy.d.ts +22 -0
- package/dist/forms/controls/FormBuddy.js +143 -0
- package/dist/forms/controls/FormReveal.d.ts +21 -0
- package/dist/forms/controls/FormReveal.js +19 -0
- package/dist/forms/controls/FormSteps.d.ts +75 -0
- package/dist/forms/controls/FormSteps.js +205 -0
- package/dist/forms/controls/FormSwap.d.ts +27 -0
- package/dist/forms/controls/FormSwap.js +38 -0
- package/dist/forms/controls/InlineEdit.d.ts +50 -0
- package/dist/forms/controls/InlineEdit.js +136 -0
- package/dist/forms/controls/NumberField.d.ts +43 -0
- package/dist/forms/controls/NumberField.js +205 -0
- package/dist/forms/controls/OtpField.d.ts +46 -0
- package/dist/forms/controls/OtpField.js +195 -0
- package/dist/forms/controls/PasswordRules.d.ts +31 -0
- package/dist/forms/controls/PasswordRules.js +85 -0
- package/dist/forms/controls/RadioGroup.d.ts +69 -0
- package/dist/forms/controls/RadioGroup.js +95 -0
- package/dist/forms/controls/Range.d.ts +60 -0
- package/dist/forms/controls/Range.js +169 -0
- package/dist/forms/controls/SaveStatus.d.ts +25 -0
- package/dist/forms/controls/SaveStatus.js +88 -0
- package/dist/forms/controls/Select.d.ts +46 -0
- package/dist/forms/controls/Select.js +35 -0
- package/dist/forms/controls/Switch.d.ts +54 -0
- package/dist/forms/controls/Switch.js +91 -0
- package/dist/forms/controls/TagsField.d.ts +68 -0
- package/dist/forms/controls/TagsField.js +0 -0
- package/dist/forms/controls/choiceChecks.d.ts +11 -0
- package/dist/forms/controls/choiceChecks.js +19 -0
- package/dist/forms/controls/choiceParts.d.ts +40 -0
- package/dist/forms/controls/choiceParts.js +49 -0
- package/dist/forms/controls/fieldChecks.d.ts +17 -0
- package/dist/forms/controls/fieldChecks.js +34 -0
- package/dist/forms/controls/fieldTools.d.ts +62 -0
- package/dist/forms/controls/fieldTools.js +54 -0
- package/dist/forms/controls/pickerChecks.d.ts +10 -0
- package/dist/forms/controls/pickerChecks.js +27 -0
- package/dist/forms/controls/rangeChecks.d.ts +11 -0
- package/dist/forms/controls/rangeChecks.js +23 -0
- package/dist/forms/controls/shared.d.ts +8 -0
- package/dist/forms/controls/shared.js +18 -0
- package/dist/forms/effects/cards.d.ts +11 -0
- package/dist/forms/effects/cards.js +52 -0
- package/dist/forms/effects/check/checkCard.d.ts +10 -0
- package/dist/forms/effects/check/checkCard.js +15 -0
- package/dist/forms/effects/check/checkCard.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkCard.schema.js +9 -0
- package/dist/forms/effects/check/checkConfetti.d.ts +18 -0
- package/dist/forms/effects/check/checkConfetti.js +38 -0
- package/dist/forms/effects/check/checkConfetti.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkConfetti.schema.js +13 -0
- package/dist/forms/effects/check/checkDraw.d.ts +7 -0
- package/dist/forms/effects/check/checkDraw.js +12 -0
- package/dist/forms/effects/check/checkDraw.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkDraw.schema.js +9 -0
- package/dist/forms/effects/check/checkHeart.d.ts +9 -0
- package/dist/forms/effects/check/checkHeart.js +84 -0
- package/dist/forms/effects/check/checkHeart.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkHeart.schema.js +10 -0
- package/dist/forms/effects/check/checkJelly.d.ts +9 -0
- package/dist/forms/effects/check/checkJelly.js +23 -0
- package/dist/forms/effects/check/checkJelly.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkJelly.schema.js +10 -0
- package/dist/forms/effects/check/checkMerge.d.ts +9 -0
- package/dist/forms/effects/check/checkMerge.js +37 -0
- package/dist/forms/effects/check/checkMerge.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkMerge.schema.js +10 -0
- package/dist/forms/effects/check/checkMixed.d.ts +7 -0
- package/dist/forms/effects/check/checkMixed.js +25 -0
- package/dist/forms/effects/check/checkMixed.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkMixed.schema.js +9 -0
- package/dist/forms/effects/check/checkMorph.d.ts +9 -0
- package/dist/forms/effects/check/checkMorph.js +53 -0
- package/dist/forms/effects/check/checkMorph.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkMorph.schema.js +10 -0
- package/dist/forms/effects/check/checkPop.d.ts +9 -0
- package/dist/forms/effects/check/checkPop.js +27 -0
- package/dist/forms/effects/check/checkPop.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkPop.schema.js +10 -0
- package/dist/forms/effects/check/checkRipple.d.ts +7 -0
- package/dist/forms/effects/check/checkRipple.js +33 -0
- package/dist/forms/effects/check/checkRipple.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkRipple.schema.js +9 -0
- package/dist/forms/effects/check/checkScribble.d.ts +11 -0
- package/dist/forms/effects/check/checkScribble.js +42 -0
- package/dist/forms/effects/check/checkScribble.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkScribble.schema.js +11 -0
- package/dist/forms/effects/check/checkStrike.d.ts +9 -0
- package/dist/forms/effects/check/checkStrike.js +54 -0
- package/dist/forms/effects/check/checkStrike.schema.d.ts +1 -0
- package/dist/forms/effects/check/checkStrike.schema.js +10 -0
- package/dist/forms/effects/chip/chipCheck.d.ts +7 -0
- package/dist/forms/effects/chip/chipCheck.js +26 -0
- package/dist/forms/effects/chip/chipCheck.schema.d.ts +1 -0
- package/dist/forms/effects/chip/chipCheck.schema.js +9 -0
- package/dist/forms/effects/chip/chipMerge.d.ts +9 -0
- package/dist/forms/effects/chip/chipMerge.js +63 -0
- package/dist/forms/effects/chip/chipMerge.schema.d.ts +1 -0
- package/dist/forms/effects/chip/chipMerge.schema.js +10 -0
- package/dist/forms/effects/file/fileButton.d.ts +7 -0
- package/dist/forms/effects/file/fileButton.js +28 -0
- package/dist/forms/effects/file/fileButton.schema.d.ts +1 -0
- package/dist/forms/effects/file/fileButton.schema.js +9 -0
- package/dist/forms/effects/file/fileCards.d.ts +7 -0
- package/dist/forms/effects/file/fileCards.js +38 -0
- package/dist/forms/effects/file/fileCards.schema.d.ts +1 -0
- package/dist/forms/effects/file/fileCards.schema.js +9 -0
- package/dist/forms/effects/file/fileDrag.d.ts +9 -0
- package/dist/forms/effects/file/fileDrag.js +45 -0
- package/dist/forms/effects/file/fileDrag.schema.d.ts +1 -0
- package/dist/forms/effects/file/fileDrag.schema.js +10 -0
- package/dist/forms/effects/file/filePage.d.ts +7 -0
- package/dist/forms/effects/file/filePage.js +46 -0
- package/dist/forms/effects/file/filePage.schema.d.ts +1 -0
- package/dist/forms/effects/file/filePage.schema.js +9 -0
- package/dist/forms/effects/file/filePreview.d.ts +7 -0
- package/dist/forms/effects/file/filePreview.js +17 -0
- package/dist/forms/effects/file/filePreview.schema.d.ts +1 -0
- package/dist/forms/effects/file/filePreview.schema.js +9 -0
- package/dist/forms/effects/file/fileProgress.d.ts +9 -0
- package/dist/forms/effects/file/fileProgress.js +92 -0
- package/dist/forms/effects/file/fileProgress.schema.d.ts +1 -0
- package/dist/forms/effects/file/fileProgress.schema.js +10 -0
- package/dist/forms/effects/file/fileReject.d.ts +7 -0
- package/dist/forms/effects/file/fileReject.js +24 -0
- package/dist/forms/effects/file/fileReject.schema.d.ts +1 -0
- package/dist/forms/effects/file/fileReject.schema.js +9 -0
- package/dist/forms/effects/input/inputAside.d.ts +11 -0
- package/dist/forms/effects/input/inputAside.js +42 -0
- package/dist/forms/effects/input/inputAside.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputAside.schema.js +11 -0
- package/dist/forms/effects/input/inputBeam.d.ts +14 -0
- package/dist/forms/effects/input/inputBeam.js +51 -0
- package/dist/forms/effects/input/inputBeam.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputBeam.schema.js +18 -0
- package/dist/forms/effects/input/inputCaret.d.ts +13 -0
- package/dist/forms/effects/input/inputCaret.js +33 -0
- package/dist/forms/effects/input/inputCaret.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputCaret.schema.js +26 -0
- package/dist/forms/effects/input/inputCounter.d.ts +16 -0
- package/dist/forms/effects/input/inputCounter.js +84 -0
- package/dist/forms/effects/input/inputCounter.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputCounter.schema.js +12 -0
- package/dist/forms/effects/input/inputCycle.d.ts +19 -0
- package/dist/forms/effects/input/inputCycle.js +93 -0
- package/dist/forms/effects/input/inputCycle.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputCycle.schema.js +11 -0
- package/dist/forms/effects/input/inputDepth.d.ts +11 -0
- package/dist/forms/effects/input/inputDepth.js +31 -0
- package/dist/forms/effects/input/inputDepth.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputDepth.schema.js +11 -0
- package/dist/forms/effects/input/inputDraw.d.ts +13 -0
- package/dist/forms/effects/input/inputDraw.js +27 -0
- package/dist/forms/effects/input/inputDraw.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputDraw.schema.js +12 -0
- package/dist/forms/effects/input/inputFlap.d.ts +9 -0
- package/dist/forms/effects/input/inputFlap.js +24 -0
- package/dist/forms/effects/input/inputFlap.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputFlap.schema.js +10 -0
- package/dist/forms/effects/input/inputFloat.d.ts +12 -0
- package/dist/forms/effects/input/inputFloat.js +46 -0
- package/dist/forms/effects/input/inputFloat.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputFloat.schema.js +10 -0
- package/dist/forms/effects/input/inputFlood.d.ts +11 -0
- package/dist/forms/effects/input/inputFlood.js +30 -0
- package/dist/forms/effects/input/inputFlood.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputFlood.schema.js +11 -0
- package/dist/forms/effects/input/inputFrame.d.ts +18 -0
- package/dist/forms/effects/input/inputFrame.js +77 -0
- package/dist/forms/effects/input/inputFrame.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputFrame.schema.js +13 -0
- package/dist/forms/effects/input/inputIcon.d.ts +11 -0
- package/dist/forms/effects/input/inputIcon.js +18 -0
- package/dist/forms/effects/input/inputIcon.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputIcon.schema.js +11 -0
- package/dist/forms/effects/input/inputNotch.d.ts +9 -0
- package/dist/forms/effects/input/inputNotch.js +70 -0
- package/dist/forms/effects/input/inputNotch.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputNotch.schema.js +10 -0
- package/dist/forms/effects/input/inputReveal.d.ts +15 -0
- package/dist/forms/effects/input/inputReveal.js +56 -0
- package/dist/forms/effects/input/inputReveal.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputReveal.schema.js +16 -0
- package/dist/forms/effects/input/inputRing.d.ts +13 -0
- package/dist/forms/effects/input/inputRing.js +27 -0
- package/dist/forms/effects/input/inputRing.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputRing.schema.js +12 -0
- package/dist/forms/effects/input/inputRise.d.ts +9 -0
- package/dist/forms/effects/input/inputRise.js +22 -0
- package/dist/forms/effects/input/inputRise.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputRise.schema.js +10 -0
- package/dist/forms/effects/input/inputSearch.d.ts +9 -0
- package/dist/forms/effects/input/inputSearch.js +37 -0
- package/dist/forms/effects/input/inputSearch.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputSearch.schema.js +10 -0
- package/dist/forms/effects/input/inputSkeleton.d.ts +7 -0
- package/dist/forms/effects/input/inputSkeleton.js +41 -0
- package/dist/forms/effects/input/inputSkeleton.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputSkeleton.schema.js +9 -0
- package/dist/forms/effects/input/inputSpotlight.d.ts +9 -0
- package/dist/forms/effects/input/inputSpotlight.js +20 -0
- package/dist/forms/effects/input/inputSpotlight.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputSpotlight.schema.js +10 -0
- package/dist/forms/effects/input/inputStrength.d.ts +9 -0
- package/dist/forms/effects/input/inputStrength.js +29 -0
- package/dist/forms/effects/input/inputStrength.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputStrength.schema.js +10 -0
- package/dist/forms/effects/input/inputSwap.d.ts +11 -0
- package/dist/forms/effects/input/inputSwap.js +39 -0
- package/dist/forms/effects/input/inputSwap.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputSwap.schema.js +11 -0
- package/dist/forms/effects/input/inputUnderline.d.ts +13 -0
- package/dist/forms/effects/input/inputUnderline.js +36 -0
- package/dist/forms/effects/input/inputUnderline.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputUnderline.schema.js +18 -0
- package/dist/forms/effects/input/inputWave.d.ts +11 -0
- package/dist/forms/effects/input/inputWave.js +23 -0
- package/dist/forms/effects/input/inputWave.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputWave.schema.js +11 -0
- package/dist/forms/effects/input/inputWavy.d.ts +11 -0
- package/dist/forms/effects/input/inputWavy.js +53 -0
- package/dist/forms/effects/input/inputWavy.schema.d.ts +1 -0
- package/dist/forms/effects/input/inputWavy.schema.js +11 -0
- package/dist/forms/effects/kit.d.ts +213 -0
- package/dist/forms/effects/kit.js +226 -0
- package/dist/forms/effects/picker/chipPop.d.ts +7 -0
- package/dist/forms/effects/picker/chipPop.js +28 -0
- package/dist/forms/effects/picker/chipPop.schema.d.ts +1 -0
- package/dist/forms/effects/picker/chipPop.schema.js +9 -0
- package/dist/forms/effects/picker/listHighlight.d.ts +9 -0
- package/dist/forms/effects/picker/listHighlight.js +42 -0
- package/dist/forms/effects/picker/listHighlight.schema.d.ts +1 -0
- package/dist/forms/effects/picker/listHighlight.schema.js +10 -0
- package/dist/forms/effects/picker/listMatch.d.ts +7 -0
- package/dist/forms/effects/picker/listMatch.js +21 -0
- package/dist/forms/effects/picker/listMatch.schema.d.ts +1 -0
- package/dist/forms/effects/picker/listMatch.schema.js +9 -0
- package/dist/forms/effects/picker/pickerArrow.d.ts +9 -0
- package/dist/forms/effects/picker/pickerArrow.js +17 -0
- package/dist/forms/effects/picker/pickerArrow.schema.d.ts +1 -0
- package/dist/forms/effects/picker/pickerArrow.schema.js +10 -0
- package/dist/forms/effects/picker/pickerCheck.d.ts +7 -0
- package/dist/forms/effects/picker/pickerCheck.js +31 -0
- package/dist/forms/effects/picker/pickerCheck.schema.d.ts +1 -0
- package/dist/forms/effects/picker/pickerCheck.schema.js +9 -0
- package/dist/forms/effects/picker/pickerOpen.d.ts +12 -0
- package/dist/forms/effects/picker/pickerOpen.js +34 -0
- package/dist/forms/effects/picker/pickerOpen.schema.d.ts +1 -0
- package/dist/forms/effects/picker/pickerOpen.schema.js +16 -0
- package/dist/forms/effects/picker/pickerSheet.d.ts +9 -0
- package/dist/forms/effects/picker/pickerSheet.js +47 -0
- package/dist/forms/effects/picker/pickerSheet.schema.d.ts +1 -0
- package/dist/forms/effects/picker/pickerSheet.schema.js +10 -0
- package/dist/forms/effects/picker/pickerStagger.d.ts +9 -0
- package/dist/forms/effects/picker/pickerStagger.js +31 -0
- package/dist/forms/effects/picker/pickerStagger.schema.d.ts +1 -0
- package/dist/forms/effects/picker/pickerStagger.schema.js +10 -0
- package/dist/forms/effects/radio/radioCard.d.ts +10 -0
- package/dist/forms/effects/radio/radioCard.js +15 -0
- package/dist/forms/effects/radio/radioCard.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioCard.schema.js +9 -0
- package/dist/forms/effects/radio/radioCircle.d.ts +9 -0
- package/dist/forms/effects/radio/radioCircle.js +49 -0
- package/dist/forms/effects/radio/radioCircle.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioCircle.schema.js +10 -0
- package/dist/forms/effects/radio/radioDot.d.ts +7 -0
- package/dist/forms/effects/radio/radioDot.js +10 -0
- package/dist/forms/effects/radio/radioDot.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioDot.schema.js +9 -0
- package/dist/forms/effects/radio/radioEmoji.d.ts +9 -0
- package/dist/forms/effects/radio/radioEmoji.js +94 -0
- package/dist/forms/effects/radio/radioEmoji.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioEmoji.schema.js +10 -0
- package/dist/forms/effects/radio/radioPulse.d.ts +9 -0
- package/dist/forms/effects/radio/radioPulse.js +24 -0
- package/dist/forms/effects/radio/radioPulse.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioPulse.schema.js +10 -0
- package/dist/forms/effects/radio/radioScale.d.ts +9 -0
- package/dist/forms/effects/radio/radioScale.js +73 -0
- package/dist/forms/effects/radio/radioScale.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioScale.schema.js +10 -0
- package/dist/forms/effects/radio/radioSegment.d.ts +7 -0
- package/dist/forms/effects/radio/radioSegment.js +52 -0
- package/dist/forms/effects/radio/radioSegment.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioSegment.schema.js +9 -0
- package/dist/forms/effects/radio/radioStars.d.ts +15 -0
- package/dist/forms/effects/radio/radioStars.js +125 -0
- package/dist/forms/effects/radio/radioStars.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioStars.schema.js +13 -0
- package/dist/forms/effects/radio/radioTravel.d.ts +9 -0
- package/dist/forms/effects/radio/radioTravel.js +49 -0
- package/dist/forms/effects/radio/radioTravel.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioTravel.schema.js +10 -0
- package/dist/forms/effects/radio/radioUnderline.d.ts +9 -0
- package/dist/forms/effects/radio/radioUnderline.js +61 -0
- package/dist/forms/effects/radio/radioUnderline.schema.d.ts +1 -0
- package/dist/forms/effects/radio/radioUnderline.schema.js +10 -0
- package/dist/forms/effects/radio/shape.d.ts +13 -0
- package/dist/forms/effects/radio/shape.js +61 -0
- package/dist/forms/effects/range/rangeBubble.d.ts +9 -0
- package/dist/forms/effects/range/rangeBubble.js +54 -0
- package/dist/forms/effects/range/rangeBubble.schema.d.ts +1 -0
- package/dist/forms/effects/range/rangeBubble.schema.js +10 -0
- package/dist/forms/effects/range/rangeElastic.d.ts +9 -0
- package/dist/forms/effects/range/rangeElastic.js +101 -0
- package/dist/forms/effects/range/rangeElastic.schema.d.ts +1 -0
- package/dist/forms/effects/range/rangeElastic.schema.js +10 -0
- package/dist/forms/effects/range/rangeFace.d.ts +11 -0
- package/dist/forms/effects/range/rangeFace.js +68 -0
- package/dist/forms/effects/range/rangeFace.schema.d.ts +1 -0
- package/dist/forms/effects/range/rangeFace.schema.js +11 -0
- package/dist/forms/effects/range/rangeFill.d.ts +7 -0
- package/dist/forms/effects/range/rangeFill.js +29 -0
- package/dist/forms/effects/range/rangeFill.schema.d.ts +1 -0
- package/dist/forms/effects/range/rangeFill.schema.js +9 -0
- package/dist/forms/effects/range/rangeHistogram.d.ts +14 -0
- package/dist/forms/effects/range/rangeHistogram.js +65 -0
- package/dist/forms/effects/range/rangeHistogram.schema.d.ts +1 -0
- package/dist/forms/effects/range/rangeHistogram.schema.js +11 -0
- package/dist/forms/effects/range/rangeThumb.d.ts +9 -0
- package/dist/forms/effects/range/rangeThumb.js +39 -0
- package/dist/forms/effects/range/rangeThumb.schema.d.ts +1 -0
- package/dist/forms/effects/range/rangeThumb.schema.js +10 -0
- package/dist/forms/effects/range/rangeTicks.d.ts +9 -0
- package/dist/forms/effects/range/rangeTicks.js +44 -0
- package/dist/forms/effects/range/rangeTicks.schema.d.ts +1 -0
- package/dist/forms/effects/range/rangeTicks.schema.js +18 -0
- package/dist/forms/effects/ring.d.ts +5 -0
- package/dist/forms/effects/ring.js +12 -0
- package/dist/forms/effects/step/stepProgress.d.ts +9 -0
- package/dist/forms/effects/step/stepProgress.js +35 -0
- package/dist/forms/effects/step/stepProgress.schema.d.ts +1 -0
- package/dist/forms/effects/step/stepProgress.schema.js +10 -0
- package/dist/forms/effects/step/stepSlide.d.ts +9 -0
- package/dist/forms/effects/step/stepSlide.js +50 -0
- package/dist/forms/effects/step/stepSlide.schema.d.ts +1 -0
- package/dist/forms/effects/step/stepSlide.schema.js +10 -0
- package/dist/forms/effects/switch/switchBulb.d.ts +9 -0
- package/dist/forms/effects/switch/switchBulb.js +70 -0
- package/dist/forms/effects/switch/switchBulb.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchBulb.schema.js +10 -0
- package/dist/forms/effects/switch/switchDayNight.d.ts +15 -0
- package/dist/forms/effects/switch/switchDayNight.js +96 -0
- package/dist/forms/effects/switch/switchDayNight.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchDayNight.schema.js +13 -0
- package/dist/forms/effects/switch/switchFace.d.ts +7 -0
- package/dist/forms/effects/switch/switchFace.js +75 -0
- package/dist/forms/effects/switch/switchFace.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchFace.schema.js +9 -0
- package/dist/forms/effects/switch/switchFlip.d.ts +7 -0
- package/dist/forms/effects/switch/switchFlip.js +45 -0
- package/dist/forms/effects/switch/switchFlip.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchFlip.schema.js +9 -0
- package/dist/forms/effects/switch/switchGoo.d.ts +7 -0
- package/dist/forms/effects/switch/switchGoo.js +95 -0
- package/dist/forms/effects/switch/switchGoo.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchGoo.schema.js +9 -0
- package/dist/forms/effects/switch/switchIcon.d.ts +9 -0
- package/dist/forms/effects/switch/switchIcon.js +63 -0
- package/dist/forms/effects/switch/switchIcon.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchIcon.schema.js +10 -0
- package/dist/forms/effects/switch/switchLabels.d.ts +11 -0
- package/dist/forms/effects/switch/switchLabels.js +55 -0
- package/dist/forms/effects/switch/switchLabels.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchLabels.schema.js +11 -0
- package/dist/forms/effects/switch/switchMorph.d.ts +9 -0
- package/dist/forms/effects/switch/switchMorph.js +22 -0
- package/dist/forms/effects/switch/switchMorph.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchMorph.schema.js +10 -0
- package/dist/forms/effects/switch/switchNeon.d.ts +11 -0
- package/dist/forms/effects/switch/switchNeon.js +53 -0
- package/dist/forms/effects/switch/switchNeon.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchNeon.schema.js +11 -0
- package/dist/forms/effects/switch/switchSlide.d.ts +7 -0
- package/dist/forms/effects/switch/switchSlide.js +11 -0
- package/dist/forms/effects/switch/switchSlide.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchSlide.schema.js +9 -0
- package/dist/forms/effects/switch/switchStretch.d.ts +9 -0
- package/dist/forms/effects/switch/switchStretch.js +21 -0
- package/dist/forms/effects/switch/switchStretch.schema.d.ts +1 -0
- package/dist/forms/effects/switch/switchStretch.schema.js +10 -0
- package/dist/forms/effects/valid/validAsync.d.ts +7 -0
- package/dist/forms/effects/valid/validAsync.js +36 -0
- package/dist/forms/effects/valid/validAsync.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validAsync.schema.js +9 -0
- package/dist/forms/effects/valid/validBubble.d.ts +7 -0
- package/dist/forms/effects/valid/validBubble.js +61 -0
- package/dist/forms/effects/valid/validBubble.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validBubble.schema.js +9 -0
- package/dist/forms/effects/valid/validCheck.d.ts +9 -0
- package/dist/forms/effects/valid/validCheck.js +50 -0
- package/dist/forms/effects/valid/validCheck.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validCheck.schema.js +10 -0
- package/dist/forms/effects/valid/validColor.d.ts +11 -0
- package/dist/forms/effects/valid/validColor.js +28 -0
- package/dist/forms/effects/valid/validColor.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validColor.schema.js +11 -0
- package/dist/forms/effects/valid/validFlash.d.ts +9 -0
- package/dist/forms/effects/valid/validFlash.js +36 -0
- package/dist/forms/effects/valid/validFlash.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validFlash.schema.js +10 -0
- package/dist/forms/effects/valid/validMessage.d.ts +7 -0
- package/dist/forms/effects/valid/validMessage.js +24 -0
- package/dist/forms/effects/valid/validMessage.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validMessage.schema.js +9 -0
- package/dist/forms/effects/valid/validShake.d.ts +9 -0
- package/dist/forms/effects/valid/validShake.js +37 -0
- package/dist/forms/effects/valid/validShake.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validShake.schema.js +10 -0
- package/dist/forms/effects/valid/validSwap.d.ts +7 -0
- package/dist/forms/effects/valid/validSwap.js +33 -0
- package/dist/forms/effects/valid/validSwap.schema.d.ts +1 -0
- package/dist/forms/effects/valid/validSwap.schema.js +9 -0
- package/dist/forms/errors.d.ts +12 -0
- package/dist/forms/errors.js +20 -0
- package/dist/forms/file.d.ts +1 -0
- package/dist/forms/file.js +268 -0
- package/dist/forms/files.d.ts +7 -0
- package/dist/forms/files.js +29 -0
- package/dist/forms/formSteps.d.ts +9 -0
- package/dist/forms/formSteps.js +6 -0
- package/dist/forms/ids.d.ts +17 -0
- package/dist/forms/ids.js +13 -0
- package/dist/forms/inline.d.ts +3 -0
- package/dist/forms/inline.js +128 -0
- package/dist/forms/number.d.ts +1 -0
- package/dist/forms/number.js +67 -0
- package/dist/forms/otp.d.ts +4 -0
- package/dist/forms/otp.js +171 -0
- package/dist/forms/picker.d.ts +1 -0
- package/dist/forms/picker.js +303 -0
- package/dist/forms/range.d.ts +3 -0
- package/dist/forms/range.js +223 -0
- package/dist/forms/registry.d.ts +4 -0
- package/dist/forms/registry.js +133 -0
- package/dist/forms/reveal.d.ts +6 -0
- package/dist/forms/reveal.js +51 -0
- package/dist/forms/runtime/focus.d.ts +16 -0
- package/dist/forms/runtime/focus.js +55 -0
- package/dist/forms/runtime/listMatch.d.ts +2 -0
- package/dist/forms/runtime/listMatch.js +33 -0
- package/dist/forms/runtime/origin.d.ts +10 -0
- package/dist/forms/runtime/origin.js +25 -0
- package/dist/forms/runtime/placePopup.d.ts +10 -0
- package/dist/forms/runtime/placePopup.js +55 -0
- package/dist/forms/runtime/useFlip.d.ts +7 -0
- package/dist/forms/runtime/useFlip.js +38 -0
- package/dist/forms/runtime/useMorph.d.ts +8 -0
- package/dist/forms/runtime/useMorph.js +56 -0
- package/dist/forms/runtime/useOffScreen.d.ts +3 -0
- package/dist/forms/runtime/useOffScreen.js +16 -0
- package/dist/forms/runtime/useSwitchDrag.d.ts +8 -0
- package/dist/forms/runtime/useSwitchDrag.js +83 -0
- package/dist/forms/runtime/vanish.d.ts +6 -0
- package/dist/forms/runtime/vanish.js +185 -0
- package/dist/forms/steps.d.ts +1 -0
- package/dist/forms/steps.js +149 -0
- package/dist/forms/swap.d.ts +7 -0
- package/dist/forms/swap.js +149 -0
- package/dist/forms/switch.d.ts +1 -0
- package/dist/forms/switch.js +99 -0
- package/dist/forms/tools.d.ts +3 -0
- package/dist/forms/tools.js +248 -0
- package/dist/forms/types.d.ts +161 -0
- package/dist/forms/types.js +5 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.js +119 -0
- package/dist/schema/forms.d.ts +3 -0
- package/dist/schema/forms.js +194 -0
- package/dist/schema/index.d.ts +2 -1
- package/dist/schema/index.js +3 -1
- package/dist/schema/types.d.ts +2 -2
- package/dist/schema/types.js +1 -0
- package/guides/README.md +62 -61
- package/guides/contact.md +100 -77
- package/guides/forms.md +105 -0
- package/package.json +1 -1
- package/styles/form.css +594 -0
- package/theme.css +6 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/** Moves under this many pixels are a tap, not a drag. */
|
|
4
|
+
const TAP = 4;
|
|
5
|
+
/**
|
|
6
|
+
* Drag a switch's thumb with a finger or the mouse; let go past halfway and it toggles, short of it and it snaps back.
|
|
7
|
+
* A tap still toggles as always, and the value still commits on the click, never on the press: the drag only decides
|
|
8
|
+
* whether that click goes through. While dragging, the root carries `data-sx-dragging` and `--sx-switch-drag` (0-1),
|
|
9
|
+
* which the base sheet turns into the thumb's place.
|
|
10
|
+
*/
|
|
11
|
+
export function useSwitchDrag(root, enabled) {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const el = root.current;
|
|
14
|
+
const input = el?.querySelector("[data-sx-choice-control]");
|
|
15
|
+
if (!enabled || !el || !input)
|
|
16
|
+
return;
|
|
17
|
+
let start = null;
|
|
18
|
+
let moved = false;
|
|
19
|
+
let at = 0;
|
|
20
|
+
/** What the click that ends a drag must leave the switch at; undefined after a tap. */
|
|
21
|
+
let aim;
|
|
22
|
+
const down = (e) => {
|
|
23
|
+
if (e.button !== 0 || input.disabled || el.hasAttribute("data-sx-pending"))
|
|
24
|
+
return;
|
|
25
|
+
const box = el.querySelector("[data-sx-choice-box]")?.getBoundingClientRect();
|
|
26
|
+
if (!box)
|
|
27
|
+
return;
|
|
28
|
+
start = { x: e.clientX, at: input.checked ? 1 : 0, travel: Math.max(1, box.width - box.height), dir: getComputedStyle(el).direction === "rtl" ? -1 : 1 };
|
|
29
|
+
moved = false;
|
|
30
|
+
aim = undefined;
|
|
31
|
+
input.setPointerCapture(e.pointerId);
|
|
32
|
+
};
|
|
33
|
+
const move = (e) => {
|
|
34
|
+
if (!start)
|
|
35
|
+
return;
|
|
36
|
+
const dx = (e.clientX - start.x) * start.dir;
|
|
37
|
+
if (!moved && Math.abs(dx) < TAP)
|
|
38
|
+
return;
|
|
39
|
+
moved = true;
|
|
40
|
+
at = Math.min(1, Math.max(0, start.at + dx / start.travel));
|
|
41
|
+
el.style.setProperty("--sx-switch-drag", String(at));
|
|
42
|
+
el.setAttribute("data-sx-dragging", "");
|
|
43
|
+
};
|
|
44
|
+
const up = () => {
|
|
45
|
+
if (!start)
|
|
46
|
+
return;
|
|
47
|
+
start = null;
|
|
48
|
+
el.removeAttribute("data-sx-dragging");
|
|
49
|
+
el.style.removeProperty("--sx-switch-drag");
|
|
50
|
+
if (!moved)
|
|
51
|
+
return;
|
|
52
|
+
aim = at > 0.5;
|
|
53
|
+
// an engine that sends no click after a long drag: click for it, so the drag still counts (once)
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
if (aim !== undefined && input.checked !== aim)
|
|
56
|
+
input.click();
|
|
57
|
+
aim = undefined;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
// the click that follows the release: let it toggle only when the drag ended on the other side. A checkbox has
|
|
61
|
+
// already flipped when its click listeners run (preventing the click flips it back), so `checked` here is the
|
|
62
|
+
// state the click would leave.
|
|
63
|
+
const click = (e) => {
|
|
64
|
+
if (aim === undefined)
|
|
65
|
+
return;
|
|
66
|
+
if (input.checked !== aim)
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
aim = undefined;
|
|
69
|
+
};
|
|
70
|
+
input.addEventListener("pointerdown", down);
|
|
71
|
+
input.addEventListener("pointermove", move);
|
|
72
|
+
input.addEventListener("pointerup", up);
|
|
73
|
+
input.addEventListener("pointercancel", up);
|
|
74
|
+
input.addEventListener("click", click);
|
|
75
|
+
return () => {
|
|
76
|
+
input.removeEventListener("pointerdown", down);
|
|
77
|
+
input.removeEventListener("pointermove", move);
|
|
78
|
+
input.removeEventListener("pointerup", up);
|
|
79
|
+
input.removeEventListener("pointercancel", up);
|
|
80
|
+
input.removeEventListener("click", click);
|
|
81
|
+
};
|
|
82
|
+
}, [root, enabled]);
|
|
83
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* On the form's submit (or Enter in a field with no form): reads the text where it is, waits a moment for a form that
|
|
3
|
+
* checks itself after the submit (React Hook Form with Zod) to flag its fields, and unless one is flagged, empties the
|
|
4
|
+
* field and turns the text it had to dust. Under reduced motion it only empties the field.
|
|
5
|
+
*/
|
|
6
|
+
export declare function attachVanish(root: HTMLElement): () => void;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// inputCycle's vanish: the text you send breaks into dust and the field empties. A short-lived canvas of its own over
|
|
2
|
+
// the field (the text's pixels are far more than the page's shared burst canvas holds), removed when the dust settles.
|
|
3
|
+
// Only inputCycle imports it.
|
|
4
|
+
import { stillMotion } from "../../buttons/runtime/press.js";
|
|
5
|
+
import { setNativeValue } from "../controls/fieldTools.js";
|
|
6
|
+
/** Room around the field for the dust to drift into. */
|
|
7
|
+
const PAD = 48;
|
|
8
|
+
/** At most this many motes: a long line samples more sparsely. */
|
|
9
|
+
const MOST = 2600;
|
|
10
|
+
const LIFT = 0.45;
|
|
11
|
+
const FLY = 0.5;
|
|
12
|
+
/** The text's pixels, read now, while it sits where it is. */
|
|
13
|
+
function snapshot(el, box, text) {
|
|
14
|
+
const cs = getComputedStyle(el);
|
|
15
|
+
const color = cs.color;
|
|
16
|
+
const b = box.getBoundingClientRect();
|
|
17
|
+
const r = el.getBoundingClientRect();
|
|
18
|
+
// room for the drift, but never past the window's sides or the page's end: a canvas sticking out would make the page
|
|
19
|
+
// scroll for a second
|
|
20
|
+
const left = Math.max(0, Math.min(PAD, b.left));
|
|
21
|
+
const right = Math.max(0, Math.min(PAD, document.documentElement.clientWidth - b.right));
|
|
22
|
+
const top = PAD;
|
|
23
|
+
const bottom = Math.max(0, Math.min(PAD, document.documentElement.scrollHeight - (b.bottom + window.scrollY)));
|
|
24
|
+
const w = Math.ceil(b.width + left + right);
|
|
25
|
+
const h = Math.ceil(b.height + top + bottom);
|
|
26
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
27
|
+
const canvas = document.createElement("canvas");
|
|
28
|
+
canvas.width = Math.ceil(w * dpr);
|
|
29
|
+
canvas.height = Math.ceil(h * dpr);
|
|
30
|
+
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
31
|
+
if (!ctx)
|
|
32
|
+
return null;
|
|
33
|
+
ctx.scale(dpr, dpr);
|
|
34
|
+
ctx.font = `${cs.fontStyle} ${cs.fontWeight} ${cs.fontSize} ${cs.fontFamily}`;
|
|
35
|
+
if ("letterSpacing" in ctx && cs.letterSpacing !== "normal")
|
|
36
|
+
ctx.letterSpacing = cs.letterSpacing;
|
|
37
|
+
ctx.fillStyle = "#000";
|
|
38
|
+
const rtl = cs.direction === "rtl";
|
|
39
|
+
ctx.direction = rtl ? "rtl" : "ltr";
|
|
40
|
+
ctx.textAlign = rtl ? "right" : "left";
|
|
41
|
+
ctx.textBaseline = "middle";
|
|
42
|
+
const x = rtl ? r.right - parseFloat(cs.paddingRight) + el.scrollLeft : r.left + parseFloat(cs.paddingLeft) - el.scrollLeft;
|
|
43
|
+
const shown = el instanceof HTMLInputElement && el.type === "password" ? "•".repeat([...text].length) : text;
|
|
44
|
+
const lines = el instanceof HTMLTextAreaElement ? shown.split("\n") : [shown];
|
|
45
|
+
const line = parseFloat(cs.lineHeight) || parseFloat(cs.fontSize) * 1.5;
|
|
46
|
+
lines.forEach((t, i) => {
|
|
47
|
+
const y = el instanceof HTMLTextAreaElement ? r.top + parseFloat(cs.paddingTop) + line * (i + 0.5) - el.scrollTop : r.top + r.height / 2;
|
|
48
|
+
ctx.fillText(t, x - b.left + left, y - b.top + top);
|
|
49
|
+
});
|
|
50
|
+
const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
|
|
51
|
+
let inked = 0;
|
|
52
|
+
for (let i = 3; i < data.length; i += 4)
|
|
53
|
+
if (data[i] > 96)
|
|
54
|
+
inked++;
|
|
55
|
+
const step = Math.max(Math.round(2 * dpr), Math.ceil(Math.sqrt(inked / MOST)));
|
|
56
|
+
const found = [];
|
|
57
|
+
let lo = Infinity;
|
|
58
|
+
let hi = -Infinity;
|
|
59
|
+
for (let py = 0; py < canvas.height; py += step) {
|
|
60
|
+
for (let px = 0; px < canvas.width; px += step) {
|
|
61
|
+
const a = data[(py * canvas.width + px) * 4 + 3];
|
|
62
|
+
if (a <= 96)
|
|
63
|
+
continue;
|
|
64
|
+
const mx = px / dpr;
|
|
65
|
+
found.push({ x: mx, y: py / dpr, a: a / 255 });
|
|
66
|
+
lo = Math.min(lo, mx);
|
|
67
|
+
hi = Math.max(hi, mx);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (found.length === 0)
|
|
71
|
+
return null;
|
|
72
|
+
const span = hi - lo || 1;
|
|
73
|
+
const ahead = rtl ? -1 : 1;
|
|
74
|
+
const motes = found.map((m) => ({
|
|
75
|
+
...m,
|
|
76
|
+
wait: ((rtl ? m.x - lo : hi - m.x) / span) * LIFT,
|
|
77
|
+
vx: ahead * (18 + Math.random() * 70),
|
|
78
|
+
vy: (Math.random() - 0.6) * 70,
|
|
79
|
+
}));
|
|
80
|
+
return { motes, color, x: -left - box.clientLeft, y: -top - box.clientTop, w, h };
|
|
81
|
+
}
|
|
82
|
+
/** Plays the dust on a canvas over the box; calls `done` once it has settled. */
|
|
83
|
+
function play(box, shot, done) {
|
|
84
|
+
const canvas = document.createElement("canvas");
|
|
85
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
86
|
+
canvas.width = Math.ceil(shot.w * dpr);
|
|
87
|
+
canvas.height = Math.ceil(shot.h * dpr);
|
|
88
|
+
canvas.setAttribute("aria-hidden", "true");
|
|
89
|
+
canvas.setAttribute("data-sx-field-vanish", "");
|
|
90
|
+
Object.assign(canvas.style, {
|
|
91
|
+
position: "absolute",
|
|
92
|
+
left: `${shot.x}px`,
|
|
93
|
+
top: `${shot.y}px`,
|
|
94
|
+
width: `${shot.w}px`,
|
|
95
|
+
height: `${shot.h}px`,
|
|
96
|
+
pointerEvents: "none",
|
|
97
|
+
zIndex: "2",
|
|
98
|
+
});
|
|
99
|
+
const ctx = canvas.getContext("2d");
|
|
100
|
+
if (!ctx) {
|
|
101
|
+
done();
|
|
102
|
+
return () => { };
|
|
103
|
+
}
|
|
104
|
+
box.appendChild(canvas);
|
|
105
|
+
ctx.scale(dpr, dpr);
|
|
106
|
+
ctx.fillStyle = shot.color;
|
|
107
|
+
const start = performance.now();
|
|
108
|
+
let frame = 0;
|
|
109
|
+
const tick = (now) => {
|
|
110
|
+
const t = (now - start) / 1000;
|
|
111
|
+
ctx.clearRect(0, 0, shot.w, shot.h);
|
|
112
|
+
let alive = false;
|
|
113
|
+
for (const m of shot.motes) {
|
|
114
|
+
const age = t - m.wait;
|
|
115
|
+
if (age >= FLY)
|
|
116
|
+
continue;
|
|
117
|
+
alive = true;
|
|
118
|
+
const k = Math.max(0, age) / FLY;
|
|
119
|
+
const size = 1.4 * (1 - 0.6 * k);
|
|
120
|
+
ctx.globalAlpha = m.a * (1 - k * k);
|
|
121
|
+
const lift = Math.max(0, age);
|
|
122
|
+
ctx.fillRect(m.x + m.vx * lift - size / 2, m.y + m.vy * lift - size / 2, size, size);
|
|
123
|
+
}
|
|
124
|
+
if (alive)
|
|
125
|
+
frame = requestAnimationFrame(tick);
|
|
126
|
+
else
|
|
127
|
+
stop();
|
|
128
|
+
};
|
|
129
|
+
const stop = () => {
|
|
130
|
+
cancelAnimationFrame(frame);
|
|
131
|
+
canvas.remove();
|
|
132
|
+
done();
|
|
133
|
+
};
|
|
134
|
+
frame = requestAnimationFrame(tick);
|
|
135
|
+
return stop;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* On the form's submit (or Enter in a field with no form): reads the text where it is, waits a moment for a form that
|
|
139
|
+
* checks itself after the submit (React Hook Form with Zod) to flag its fields, and unless one is flagged, empties the
|
|
140
|
+
* field and turns the text it had to dust. Under reduced motion it only empties the field.
|
|
141
|
+
*/
|
|
142
|
+
export function attachVanish(root) {
|
|
143
|
+
const el = root.querySelector("[data-sx-field-control]");
|
|
144
|
+
const box = root.querySelector("[data-sx-field-box]");
|
|
145
|
+
if (!el || !box)
|
|
146
|
+
return () => { };
|
|
147
|
+
let wait = 0;
|
|
148
|
+
let stop = null;
|
|
149
|
+
const go = () => {
|
|
150
|
+
const text = el.value;
|
|
151
|
+
if (!text.trim())
|
|
152
|
+
return;
|
|
153
|
+
const shot = stillMotion() ? null : snapshot(el, box, text);
|
|
154
|
+
window.clearTimeout(wait);
|
|
155
|
+
wait = window.setTimeout(() => {
|
|
156
|
+
if ((el.form ?? root).querySelector('[aria-invalid="true"]'))
|
|
157
|
+
return;
|
|
158
|
+
stop?.();
|
|
159
|
+
// the app may have emptied it already (a form reset): then there is nothing to clear
|
|
160
|
+
if (el.value === text)
|
|
161
|
+
setNativeValue(el, "");
|
|
162
|
+
if (!shot)
|
|
163
|
+
return;
|
|
164
|
+
root.setAttribute("data-sx-vanishing", "");
|
|
165
|
+
stop = play(box, shot, () => {
|
|
166
|
+
root.removeAttribute("data-sx-vanishing");
|
|
167
|
+
stop = null;
|
|
168
|
+
});
|
|
169
|
+
}, 80);
|
|
170
|
+
};
|
|
171
|
+
const enter = (e) => {
|
|
172
|
+
const k = e;
|
|
173
|
+
if (k.key === "Enter" && !k.isComposing && !el.form && el instanceof HTMLInputElement)
|
|
174
|
+
go();
|
|
175
|
+
};
|
|
176
|
+
const form = el.form;
|
|
177
|
+
form?.addEventListener("submit", go);
|
|
178
|
+
el.addEventListener("keydown", enter);
|
|
179
|
+
return () => {
|
|
180
|
+
window.clearTimeout(wait);
|
|
181
|
+
stop?.();
|
|
182
|
+
form?.removeEventListener("submit", go);
|
|
183
|
+
el.removeEventListener("keydown", enter);
|
|
184
|
+
};
|
|
185
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const STEPS_CSS = "@layer theme, base, components, utilities;\n@layer components {\n :where([data-sx-steps]) {\n --sx-form-dir: 1;\n --sx-steps-way: 1;\n display: grid;\n gap: 1.25rem;\n min-inline-size: 0;\n }\n :where([data-sx-steps]:dir(rtl)) {\n --sx-form-dir: -1;\n }\n :where([data-sx-steps-view]) {\n position: relative;\n display: grid;\n min-inline-size: 0;\n }\n :where([data-sx-step]) {\n grid-area: 1 / 1;\n display: grid;\n gap: 1rem;\n align-content: start;\n min-inline-size: 0;\n }\n :where([data-sx-step]:not([data-sx-active], [data-sx-leaving])) {\n display: none;\n }\n :where([data-sx-step][data-sx-leaving]) {\n position: absolute;\n inset-block-start: 0;\n inset-inline: 0;\n pointer-events: none;\n }\n :where([data-sx-steps][data-sx-mode=\"focus\"]) {\n --sx-field-label-size: 1.25rem;\n font-size: 1.125rem;\n }\n :where([data-sx-steps-progress]) {\n position: relative;\n isolation: isolate;\n }\n :where([data-sx-steps-progress] > ol) {\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: minmax(0, 1fr);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n :where([data-sx-step-mark]) {\n display: grid;\n justify-items: center;\n gap: 0.375rem;\n min-inline-size: 0;\n text-align: center;\n }\n :where([data-sx-step-dot]) {\n display: grid;\n place-items: center;\n inline-size: 2rem;\n block-size: 2rem;\n box-sizing: border-box;\n border-radius: 50%;\n font-size: 0.875rem;\n font-variant-numeric: tabular-nums;\n line-height: 1;\n }\n :where([data-sx-step-dot] > *) {\n grid-area: 1 / 1;\n }\n :where([data-sx-step-dot] > svg) {\n inline-size: 1rem;\n block-size: 1rem;\n overflow: visible;\n fill: none;\n stroke: currentColor;\n stroke-width: 2.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n :where([data-sx-step-dot] path) {\n stroke-dasharray: 1 2;\n stroke-dashoffset: 1.01;\n }\n :where([data-sx-step-mark][data-sx-done] [data-sx-step-dot] path) {\n stroke-dashoffset: 0;\n }\n :where([data-sx-step-mark][data-sx-done] [data-sx-step-number]) {\n opacity: 0;\n }\n :where([data-sx-step-name]) {\n font-size: 0.8125rem;\n overflow-wrap: anywhere;\n }\n :where([data-sx-steps-rail]) {\n position: absolute;\n z-index: -1;\n inset-block-start: 1rem;\n inset-inline: calc(50% / var(--sx-steps-count, 1));\n block-size: 2px;\n translate: 0 -50%;\n }\n :where([data-sx-steps-fill]) {\n display: block;\n block-size: 100%;\n transform-origin: calc(50% - 50% * var(--sx-form-dir)) 50%;\n scale: var(--sx-steps-fill, 0) 1;\n background: currentColor;\n }\n :where([data-sx-steps-rail] > [data-sx-steps-layer]) {\n position: absolute;\n inset: 0;\n pointer-events: none;\n }\n :where([data-sx-steps-back][hidden]) {\n display: none;\n }\n :where([data-sx-steps-sr]) {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n @media (prefers-reduced-motion: reduce) {\n :where([data-sx-steps] [data-sx-steps-layer]:not([data-sx-steps-keep])) {\n display: none;\n }\n }\n @media (forced-colors: active) {\n :where([data-sx-step-dot]) {\n border: 2px solid CanvasText;\n }\n :where([data-sx-step-mark][aria-current=\"step\"] [data-sx-step-dot]) {\n border-color: Highlight;\n }\n :where([data-sx-steps-fill]) {\n forced-color-adjust: none;\n background: Highlight;\n }\n }\n}";
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// The structural sheet of FormSteps: the steps stacked in one cell (only the current one shown; the one leaving lies
|
|
2
|
+
// over it, out of the flow, while it plays its way out), the progress (numbered marks on a rail that fills, a check on
|
|
3
|
+
// each step done), the status line for screen readers, and the one-question-at-a-time mode. Positioning and states
|
|
4
|
+
// only; the look is styles/form.css. Pure string. See ./CLAUDE.md.
|
|
5
|
+
import { LAYER_ORDER } from "../backgrounds/runtime/rootCss.js";
|
|
6
|
+
const MARK = "[data-sx-step-mark]";
|
|
7
|
+
export const STEPS_CSS = `${LAYER_ORDER}
|
|
8
|
+
@layer components {
|
|
9
|
+
:where([data-sx-steps]) {
|
|
10
|
+
--sx-form-dir: 1;
|
|
11
|
+
--sx-steps-way: 1;
|
|
12
|
+
display: grid;
|
|
13
|
+
gap: 1.25rem;
|
|
14
|
+
min-inline-size: 0;
|
|
15
|
+
}
|
|
16
|
+
:where([data-sx-steps]:dir(rtl)) {
|
|
17
|
+
--sx-form-dir: -1;
|
|
18
|
+
}
|
|
19
|
+
:where([data-sx-steps-view]) {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: grid;
|
|
22
|
+
min-inline-size: 0;
|
|
23
|
+
}
|
|
24
|
+
:where([data-sx-step]) {
|
|
25
|
+
grid-area: 1 / 1;
|
|
26
|
+
display: grid;
|
|
27
|
+
gap: 1rem;
|
|
28
|
+
align-content: start;
|
|
29
|
+
min-inline-size: 0;
|
|
30
|
+
}
|
|
31
|
+
:where([data-sx-step]:not([data-sx-active], [data-sx-leaving])) {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
:where([data-sx-step][data-sx-leaving]) {
|
|
35
|
+
position: absolute;
|
|
36
|
+
inset-block-start: 0;
|
|
37
|
+
inset-inline: 0;
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
:where([data-sx-steps][data-sx-mode="focus"]) {
|
|
41
|
+
--sx-field-label-size: 1.25rem;
|
|
42
|
+
font-size: 1.125rem;
|
|
43
|
+
}
|
|
44
|
+
:where([data-sx-steps-progress]) {
|
|
45
|
+
position: relative;
|
|
46
|
+
isolation: isolate;
|
|
47
|
+
}
|
|
48
|
+
:where([data-sx-steps-progress] > ol) {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-auto-flow: column;
|
|
51
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
52
|
+
margin: 0;
|
|
53
|
+
padding: 0;
|
|
54
|
+
list-style: none;
|
|
55
|
+
}
|
|
56
|
+
:where(${MARK}) {
|
|
57
|
+
display: grid;
|
|
58
|
+
justify-items: center;
|
|
59
|
+
gap: 0.375rem;
|
|
60
|
+
min-inline-size: 0;
|
|
61
|
+
text-align: center;
|
|
62
|
+
}
|
|
63
|
+
:where([data-sx-step-dot]) {
|
|
64
|
+
display: grid;
|
|
65
|
+
place-items: center;
|
|
66
|
+
inline-size: 2rem;
|
|
67
|
+
block-size: 2rem;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
font-size: 0.875rem;
|
|
71
|
+
font-variant-numeric: tabular-nums;
|
|
72
|
+
line-height: 1;
|
|
73
|
+
}
|
|
74
|
+
:where([data-sx-step-dot] > *) {
|
|
75
|
+
grid-area: 1 / 1;
|
|
76
|
+
}
|
|
77
|
+
:where([data-sx-step-dot] > svg) {
|
|
78
|
+
inline-size: 1rem;
|
|
79
|
+
block-size: 1rem;
|
|
80
|
+
overflow: visible;
|
|
81
|
+
fill: none;
|
|
82
|
+
stroke: currentColor;
|
|
83
|
+
stroke-width: 2.5;
|
|
84
|
+
stroke-linecap: round;
|
|
85
|
+
stroke-linejoin: round;
|
|
86
|
+
}
|
|
87
|
+
:where([data-sx-step-dot] path) {
|
|
88
|
+
stroke-dasharray: 1 2;
|
|
89
|
+
stroke-dashoffset: 1.01;
|
|
90
|
+
}
|
|
91
|
+
:where(${MARK}[data-sx-done] [data-sx-step-dot] path) {
|
|
92
|
+
stroke-dashoffset: 0;
|
|
93
|
+
}
|
|
94
|
+
:where(${MARK}[data-sx-done] [data-sx-step-number]) {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
}
|
|
97
|
+
:where([data-sx-step-name]) {
|
|
98
|
+
font-size: 0.8125rem;
|
|
99
|
+
overflow-wrap: anywhere;
|
|
100
|
+
}
|
|
101
|
+
:where([data-sx-steps-rail]) {
|
|
102
|
+
position: absolute;
|
|
103
|
+
z-index: -1;
|
|
104
|
+
inset-block-start: 1rem;
|
|
105
|
+
inset-inline: calc(50% / var(--sx-steps-count, 1));
|
|
106
|
+
block-size: 2px;
|
|
107
|
+
translate: 0 -50%;
|
|
108
|
+
}
|
|
109
|
+
:where([data-sx-steps-fill]) {
|
|
110
|
+
display: block;
|
|
111
|
+
block-size: 100%;
|
|
112
|
+
transform-origin: calc(50% - 50% * var(--sx-form-dir)) 50%;
|
|
113
|
+
scale: var(--sx-steps-fill, 0) 1;
|
|
114
|
+
background: currentColor;
|
|
115
|
+
}
|
|
116
|
+
:where([data-sx-steps-rail] > [data-sx-steps-layer]) {
|
|
117
|
+
position: absolute;
|
|
118
|
+
inset: 0;
|
|
119
|
+
pointer-events: none;
|
|
120
|
+
}
|
|
121
|
+
:where([data-sx-steps-back][hidden]) {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
:where([data-sx-steps-sr]) {
|
|
125
|
+
position: absolute;
|
|
126
|
+
inline-size: 1px;
|
|
127
|
+
block-size: 1px;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
clip-path: inset(50%);
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
}
|
|
132
|
+
@media (prefers-reduced-motion: reduce) {
|
|
133
|
+
:where([data-sx-steps] [data-sx-steps-layer]:not([data-sx-steps-keep])) {
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
@media (forced-colors: active) {
|
|
138
|
+
:where([data-sx-step-dot]) {
|
|
139
|
+
border: 2px solid CanvasText;
|
|
140
|
+
}
|
|
141
|
+
:where(${MARK}[aria-current="step"] [data-sx-step-dot]) {
|
|
142
|
+
border-color: Highlight;
|
|
143
|
+
}
|
|
144
|
+
:where([data-sx-steps-fill]) {
|
|
145
|
+
forced-color-adjust: none;
|
|
146
|
+
background: Highlight;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const SWAP_CSS: string;
|
|
2
|
+
/**
|
|
3
|
+
* What moves: success fades the form out and the message in, settling, its check drawing; panel slides the panel across;
|
|
4
|
+
* flip turns the card. Views hide only once their way out has played (visibility after a delay). The box's height
|
|
5
|
+
* eases between views (FormSwap's own morph). Dropped under reduced motion: the views just change.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SWAP_MOTION: string;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// The sheets of FormSwap: two views in one place, the other one unseen and inert. Three looks: success (the form gives
|
|
2
|
+
// way to a message with a check), panel (two forms side by side, a coloured panel sliding over the one not in use;
|
|
3
|
+
// stacked in a narrow box) and flip (a card turned over). Pure strings.
|
|
4
|
+
import { LAYER_ORDER } from "../backgrounds/runtime/rootCss.js";
|
|
5
|
+
const VIEW = "[data-sx-swap-view]";
|
|
6
|
+
const OFF = `${VIEW}:not([data-sx-active])`;
|
|
7
|
+
const LOOK = (look) => `[data-sx-swap][data-sx-look="${look}"]`;
|
|
8
|
+
const SWAPPED = "[data-sx-swap][data-sx-swapped]";
|
|
9
|
+
export const SWAP_CSS = `${LAYER_ORDER}
|
|
10
|
+
@layer components {
|
|
11
|
+
:where([data-sx-swap]) {
|
|
12
|
+
--sx-form-dir: 1;
|
|
13
|
+
position: relative;
|
|
14
|
+
min-inline-size: 0;
|
|
15
|
+
container-type: inline-size;
|
|
16
|
+
}
|
|
17
|
+
:where([data-sx-swap]:dir(rtl)) {
|
|
18
|
+
--sx-form-dir: -1;
|
|
19
|
+
}
|
|
20
|
+
:where([data-sx-swap-stage]) {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: grid;
|
|
23
|
+
min-inline-size: 0;
|
|
24
|
+
}
|
|
25
|
+
:where(${VIEW}) {
|
|
26
|
+
grid-area: 1 / 1;
|
|
27
|
+
min-inline-size: 0;
|
|
28
|
+
outline: none;
|
|
29
|
+
}
|
|
30
|
+
:where(${OFF}) {
|
|
31
|
+
position: absolute;
|
|
32
|
+
inset-block-start: 0;
|
|
33
|
+
inset-inline: 0;
|
|
34
|
+
visibility: hidden;
|
|
35
|
+
}
|
|
36
|
+
:where([data-sx-swap-check]) {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
:where(${LOOK("success")} [data-sx-swap-check]) {
|
|
40
|
+
display: grid;
|
|
41
|
+
justify-items: center;
|
|
42
|
+
margin-block-end: 0.75rem;
|
|
43
|
+
}
|
|
44
|
+
:where([data-sx-swap-check] > svg) {
|
|
45
|
+
inline-size: 3rem;
|
|
46
|
+
block-size: 3rem;
|
|
47
|
+
overflow: visible;
|
|
48
|
+
fill: none;
|
|
49
|
+
stroke: currentColor;
|
|
50
|
+
stroke-width: 2;
|
|
51
|
+
stroke-linecap: round;
|
|
52
|
+
stroke-linejoin: round;
|
|
53
|
+
}
|
|
54
|
+
:where(${LOOK("flip")}) {
|
|
55
|
+
perspective: 1400px;
|
|
56
|
+
}
|
|
57
|
+
:where(${LOOK("flip")} [data-sx-swap-stage]) {
|
|
58
|
+
transform-style: preserve-3d;
|
|
59
|
+
}
|
|
60
|
+
:where(${SWAPPED}${LOOK("flip")} [data-sx-swap-stage]) {
|
|
61
|
+
rotate: y calc(180deg * var(--sx-form-dir));
|
|
62
|
+
}
|
|
63
|
+
:where(${LOOK("flip")} ${VIEW}) {
|
|
64
|
+
position: relative;
|
|
65
|
+
visibility: visible;
|
|
66
|
+
backface-visibility: hidden;
|
|
67
|
+
}
|
|
68
|
+
:where(${LOOK("flip")} ${VIEW}[data-sx-swap-view="second"]) {
|
|
69
|
+
rotate: y 180deg;
|
|
70
|
+
}
|
|
71
|
+
:where([data-sx-swap-panel]) {
|
|
72
|
+
display: grid;
|
|
73
|
+
margin-block-start: 1rem;
|
|
74
|
+
}
|
|
75
|
+
:where([data-sx-swap-face]) {
|
|
76
|
+
grid-area: 1 / 1;
|
|
77
|
+
display: grid;
|
|
78
|
+
place-content: center;
|
|
79
|
+
gap: 0.75rem;
|
|
80
|
+
padding: 1.5rem;
|
|
81
|
+
text-align: center;
|
|
82
|
+
}
|
|
83
|
+
:where([data-sx-swap-face]:not([data-sx-active])) {
|
|
84
|
+
visibility: hidden;
|
|
85
|
+
}
|
|
86
|
+
@container (min-width: 36rem) {
|
|
87
|
+
:where(${LOOK("panel")} [data-sx-swap-stage]) {
|
|
88
|
+
grid-template-columns: 1fr 1fr;
|
|
89
|
+
overflow: clip;
|
|
90
|
+
}
|
|
91
|
+
:where(${LOOK("panel")} ${VIEW}) {
|
|
92
|
+
position: relative;
|
|
93
|
+
visibility: visible;
|
|
94
|
+
padding: 1.5rem;
|
|
95
|
+
}
|
|
96
|
+
:where(${LOOK("panel")} ${VIEW}[data-sx-swap-view="second"]) {
|
|
97
|
+
grid-area: 1 / 2;
|
|
98
|
+
}
|
|
99
|
+
:where(${LOOK("panel")} [data-sx-swap-panel]) {
|
|
100
|
+
position: absolute;
|
|
101
|
+
z-index: 1;
|
|
102
|
+
inset-block: 0;
|
|
103
|
+
inset-inline-start: 0;
|
|
104
|
+
inline-size: 50%;
|
|
105
|
+
margin: 0;
|
|
106
|
+
translate: calc(100% * var(--sx-form-dir)) 0;
|
|
107
|
+
}
|
|
108
|
+
:where(${SWAPPED}${LOOK("panel")} [data-sx-swap-panel]) {
|
|
109
|
+
translate: 0 0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}`;
|
|
113
|
+
/**
|
|
114
|
+
* What moves: success fades the form out and the message in, settling, its check drawing; panel slides the panel across;
|
|
115
|
+
* flip turns the card. Views hide only once their way out has played (visibility after a delay). The box's height
|
|
116
|
+
* eases between views (FormSwap's own morph). Dropped under reduced motion: the views just change.
|
|
117
|
+
*/
|
|
118
|
+
export const SWAP_MOTION = `@layer components {
|
|
119
|
+
:where(${VIEW}, [data-sx-swap-face]) {
|
|
120
|
+
transition: opacity 0.3s ease-out, scale 0.3s var(--ease-sx-out, ease-out), visibility 0s;
|
|
121
|
+
}
|
|
122
|
+
:where(${OFF}, [data-sx-swap-face]:not([data-sx-active])) {
|
|
123
|
+
opacity: 0;
|
|
124
|
+
transition-delay: 0s, 0s, 0.3s;
|
|
125
|
+
}
|
|
126
|
+
:where(${LOOK("success")} ${OFF}) {
|
|
127
|
+
scale: 0.97;
|
|
128
|
+
}
|
|
129
|
+
:where(${SWAPPED}[data-sx-moved] [data-sx-swap-check] path) {
|
|
130
|
+
stroke-dasharray: 1 2;
|
|
131
|
+
stroke-dashoffset: 1.01;
|
|
132
|
+
animation: sx-form-swap-check 0.45s var(--ease-sx-out, ease-out) 0.2s forwards;
|
|
133
|
+
}
|
|
134
|
+
:where(${LOOK("flip")} [data-sx-swap-stage]) {
|
|
135
|
+
transition: rotate 0.6s cubic-bezier(0.4, 0.1, 0.2, 1);
|
|
136
|
+
}
|
|
137
|
+
:where(${LOOK("flip")} ${VIEW}) {
|
|
138
|
+
opacity: 1;
|
|
139
|
+
transition: none;
|
|
140
|
+
}
|
|
141
|
+
:where([data-sx-swap-panel]) {
|
|
142
|
+
transition: translate 0.6s cubic-bezier(0.65, 0, 0.35, 1);
|
|
143
|
+
}
|
|
144
|
+
@keyframes sx-form-swap-check {
|
|
145
|
+
to {
|
|
146
|
+
stroke-dashoffset: 0;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SWITCH_BASE_CSS = "@layer components {\n :where([data-sx-kind=\"switch\"]) {\n --sx-switch-w: 2.75em;\n --sx-switch-h: 1.5em;\n --sx-switch-pad: 0.1875em;\n --sx-switch-at: 0;\n }\n :where([data-sx-kind=\"switch\"]:has([data-sx-choice-control]:checked)) {\n --sx-switch-at: 1;\n }\n :where([data-sx-kind=\"switch\"][data-sx-dragging]) {\n --sx-switch-at: var(--sx-switch-drag, 0);\n }\n :where([data-sx-kind=\"switch\"] > [data-sx-choice-row]) {\n grid-template-columns: var(--sx-switch-w) minmax(0, 1fr);\n }\n :where([data-sx-kind=\"switch\"] :is([data-sx-choice-box], [data-sx-choice-control])) {\n inline-size: var(--sx-switch-w);\n block-size: var(--sx-switch-h);\n margin: calc((1.5em - var(--sx-switch-h)) / 2) 0 0;\n }\n :where([data-sx-kind=\"switch\"][data-sx-label-first] > [data-sx-choice-row]) {\n grid-template-columns: minmax(0, 1fr) var(--sx-switch-w);\n }\n :where([data-sx-kind=\"switch\"][data-sx-label-first] > [data-sx-choice-row] > :is([data-sx-choice-box], [data-sx-choice-control])) {\n grid-area: 1 / 2;\n }\n :where([data-sx-kind=\"switch\"][data-sx-label-first] [data-sx-choice-text]) {\n grid-area: 1 / 1;\n }\n :where([data-sx-kind=\"switch\"][data-sx-label-first] [data-sx-choice-description]) {\n grid-area: 2 / 1;\n }\n :where([data-sx-kind=\"switch\"][data-sx-label-first] > [data-sx-choice-message]) {\n padding-inline-start: 0;\n }\n :where([data-sx-kind=\"switch\"] > [data-sx-choice-message]) {\n padding-inline-start: calc(var(--sx-switch-w) + var(--sx-choice-gap));\n }\n :where([data-sx-switch-thumb]) {\n position: absolute;\n inset-block: var(--sx-switch-pad);\n inset-inline-start: var(--sx-switch-pad);\n aspect-ratio: 1;\n display: grid;\n place-items: center;\n border-radius: 50%;\n translate: calc(var(--sx-switch-at) * (var(--sx-switch-w) - var(--sx-switch-h)) * var(--sx-form-dir)) 0;\n }\n :where([data-sx-switch-thumb] > [data-sx-choice-layer]) {\n border-radius: inherit;\n }\n :where([data-sx-switch-spinner]) {\n inline-size: 62%;\n block-size: 62%;\n box-sizing: border-box;\n border: 2px solid currentColor;\n border-block-start-color: transparent;\n border-radius: 50%;\n }\n :where([data-sx-kind=\"switch\"][data-sx-pending] [data-sx-choice-row]) {\n cursor: progress;\n }\n :where([data-sx-kind=\"switch\"][data-sx-drag] [data-sx-choice-control]) {\n touch-action: pan-y;\n }\n :where([data-sx-kind=\"switch\"][data-sx-native] [data-sx-choice-control], [data-sx-kind=\"switch\"][data-sx-native] > [data-sx-choice-row]) {\n inline-size: auto;\n block-size: auto;\n }\n :where([data-sx-kind=\"switch\"][data-sx-native] > [data-sx-choice-row]) {\n grid-template-columns: auto minmax(0, 1fr);\n }\n @media (forced-colors: active) {\n :where([data-sx-kind=\"switch\"] [data-sx-choice-control]) {\n inline-size: auto;\n block-size: auto;\n }\n :where([data-sx-kind=\"switch\"] > [data-sx-choice-row]) {\n grid-template-columns: auto minmax(0, 1fr);\n }\n }\n @media (prefers-reduced-motion: no-preference) {\n :where([data-sx-switch-spinner]) {\n animation: sx-form-switch-spin 0.8s linear infinite;\n }\n :where(html[data-sx-loops-paused] [data-sx-switch-spinner]) {\n animation-play-state: paused;\n }\n @keyframes sx-form-switch-spin {\n to { rotate: 1turn; }\n }\n }\n}";
|