@raystack/apsara 0.31.1 → 0.32.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/dist/command/command.cjs +3 -0
- package/dist/command/command.cjs.map +1 -1
- package/dist/command/command.d.ts.map +1 -1
- package/dist/command/command.js +3 -0
- package/dist/command/command.js.map +1 -1
- package/dist/dialog/dialog.cjs +12 -0
- package/dist/dialog/dialog.cjs.map +1 -1
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/dialog/dialog.js +12 -0
- package/dist/dialog/dialog.js.map +1 -1
- package/dist/select/select.cjs +3 -0
- package/dist/select/select.cjs.map +1 -1
- package/dist/select/select.d.ts.map +1 -1
- package/dist/select/select.js +3 -0
- package/dist/select/select.js.map +1 -1
- package/dist/sheet/sheet.cjs +9 -0
- package/dist/sheet/sheet.cjs.map +1 -1
- package/dist/sheet/sheet.d.ts +12 -0
- package/dist/sheet/sheet.d.ts.map +1 -1
- package/dist/sheet/sheet.js +9 -0
- package/dist/sheet/sheet.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/table/table.cjs +24 -0
- package/dist/table/table.cjs.map +1 -1
- package/dist/table/table.d.ts.map +1 -1
- package/dist/table/table.js +24 -0
- package/dist/table/table.js.map +1 -1
- package/dist/toggle-group/togglegroup.cjs +9 -0
- package/dist/toggle-group/togglegroup.cjs.map +1 -1
- package/dist/toggle-group/togglegroup.d.ts.map +1 -1
- package/dist/toggle-group/togglegroup.js +9 -0
- package/dist/toggle-group/togglegroup.js.map +1 -1
- package/dist/v1/components/calendar/range-picker.cjs +2 -2
- package/dist/v1/components/calendar/range-picker.cjs.map +1 -1
- package/dist/v1/components/calendar/range-picker.d.ts +5 -1
- package/dist/v1/components/calendar/range-picker.d.ts.map +1 -1
- package/dist/v1/components/calendar/range-picker.js +2 -2
- package/dist/v1/components/calendar/range-picker.js.map +1 -1
- package/dist/v1/components/chip/chip.cjs +6 -6
- package/dist/v1/components/chip/chip.cjs.map +1 -1
- package/dist/v1/components/chip/chip.d.ts +3 -3
- package/dist/v1/components/chip/chip.d.ts.map +1 -1
- package/dist/v1/components/chip/chip.js +6 -6
- package/dist/v1/components/chip/chip.js.map +1 -1
- package/dist/v1/components/chip/chip.module.css.cjs +1 -1
- package/dist/v1/components/chip/chip.module.css.js +1 -1
- package/dist/v1/components/command/command.cjs +52 -0
- package/dist/v1/components/command/command.cjs.map +1 -0
- package/dist/v1/components/command/command.d.ts +2 -0
- package/dist/v1/components/command/command.d.ts.map +1 -0
- package/dist/v1/components/command/command.js +50 -0
- package/dist/v1/components/command/command.js.map +1 -0
- package/dist/v1/components/command/command.module.css.cjs +8 -0
- package/dist/v1/components/command/command.module.css.cjs.map +1 -0
- package/dist/v1/components/command/command.module.css.js +4 -0
- package/dist/v1/components/command/command.module.css.js.map +1 -0
- package/dist/v1/components/command/index.d.ts +2 -0
- package/dist/v1/components/command/index.d.ts.map +1 -0
- package/dist/v1/components/dialog/dialog.cjs +32 -0
- package/dist/v1/components/dialog/dialog.cjs.map +1 -0
- package/dist/v1/components/dialog/dialog.d.ts +26 -0
- package/dist/v1/components/dialog/dialog.d.ts.map +1 -0
- package/dist/v1/components/dialog/dialog.js +29 -0
- package/dist/v1/components/dialog/dialog.js.map +1 -0
- package/dist/v1/components/dialog/dialog.module.css.cjs +8 -0
- package/dist/v1/components/dialog/dialog.module.css.cjs.map +1 -0
- package/dist/v1/components/dialog/dialog.module.css.js +4 -0
- package/dist/v1/components/dialog/dialog.module.css.js.map +1 -0
- package/dist/v1/components/dialog/index.d.ts +2 -0
- package/dist/v1/components/dialog/index.d.ts.map +1 -0
- package/dist/v1/components/flex/flex.cjs +9 -0
- package/dist/v1/components/flex/flex.cjs.map +1 -1
- package/dist/v1/components/flex/flex.d.ts +1 -1
- package/dist/v1/components/flex/flex.d.ts.map +1 -1
- package/dist/v1/components/flex/flex.js +9 -0
- package/dist/v1/components/flex/flex.js.map +1 -1
- package/dist/v1/components/flex/flex.module.css.cjs +1 -1
- package/dist/v1/components/flex/flex.module.css.js +1 -1
- package/dist/v1/components/icon-button/icon-button.cjs +1 -1
- package/dist/v1/components/icon-button/icon-button.cjs.map +1 -1
- package/dist/v1/components/icon-button/icon-button.d.ts +1 -2
- package/dist/v1/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/v1/components/icon-button/icon-button.js +1 -1
- package/dist/v1/components/icon-button/icon-button.js.map +1 -1
- package/dist/v1/components/input-field/input-field.module.css.cjs +1 -1
- package/dist/v1/components/input-field/input-field.module.css.js +1 -1
- package/dist/v1/components/select/select.cjs +5 -5
- package/dist/v1/components/select/select.cjs.map +1 -1
- package/dist/v1/components/select/select.d.ts +12 -1
- package/dist/v1/components/select/select.d.ts.map +1 -1
- package/dist/v1/components/select/select.js +5 -5
- package/dist/v1/components/select/select.js.map +1 -1
- package/dist/v1/components/select/select.module.css.cjs +1 -1
- package/dist/v1/components/select/select.module.css.js +1 -1
- package/dist/v1/components/sheet/index.d.ts +2 -0
- package/dist/v1/components/sheet/index.d.ts.map +1 -0
- package/dist/v1/components/sheet/sheet.cjs +48 -0
- package/dist/v1/components/sheet/sheet.cjs.map +1 -0
- package/dist/v1/components/sheet/sheet.d.ts +35 -0
- package/dist/v1/components/sheet/sheet.d.ts.map +1 -0
- package/dist/v1/components/sheet/sheet.js +43 -0
- package/dist/v1/components/sheet/sheet.js.map +1 -0
- package/dist/v1/components/sheet/sheet.module.css.cjs +8 -0
- package/dist/v1/components/sheet/sheet.module.css.cjs.map +1 -0
- package/dist/v1/components/sheet/sheet.module.css.js +4 -0
- package/dist/v1/components/sheet/sheet.module.css.js.map +1 -0
- package/dist/v1/components/table/index.d.ts +2 -0
- package/dist/v1/components/table/index.d.ts.map +1 -0
- package/dist/v1/components/table/table.cjs +44 -0
- package/dist/v1/components/table/table.cjs.map +1 -0
- package/dist/v1/components/table/table.d.ts +30 -0
- package/dist/v1/components/table/table.d.ts.map +1 -0
- package/dist/v1/components/table/table.js +42 -0
- package/dist/v1/components/table/table.js.map +1 -0
- package/dist/v1/components/table/table.module.css.cjs +8 -0
- package/dist/v1/components/table/table.module.css.cjs.map +1 -0
- package/dist/v1/components/table/table.module.css.js +4 -0
- package/dist/v1/components/table/table.module.css.js.map +1 -0
- package/dist/v1/components/tooltip/tooltip.cjs +3 -2
- package/dist/v1/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/v1/components/tooltip/tooltip.d.ts +8 -2
- package/dist/v1/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/v1/components/tooltip/tooltip.js +3 -2
- package/dist/v1/components/tooltip/tooltip.js.map +1 -1
- package/dist/v1/index.cjs +10 -0
- package/dist/v1/index.cjs.map +1 -1
- package/dist/v1/index.d.ts +5 -0
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +5 -0
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/node_modules/.pnpm/@radix-ui_primitive@1.0.0/node_modules/@radix-ui/primitive/dist/index.module.cjs +11 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_primitive@1.0.0/node_modules/@radix-ui/primitive/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_primitive@1.0.0/node_modules/@radix-ui/primitive/dist/index.module.js +9 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_primitive@1.0.0/node_modules/@radix-ui/primitive/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-compose-refs@1.0.0_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.module.cjs +30 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-compose-refs@1.0.0_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-compose-refs@1.0.0_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.module.js +27 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-compose-refs@1.0.0_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-context@1.0.0_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.module.cjs +103 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-context@1.0.0_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-context@1.0.0_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.module.js +101 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-context@1.0.0_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.module.cjs +224 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.module.js +214 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.cjs +298 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.js +280 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dialog@1.0.4_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.cjs +235 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.js +233 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-guards@1.0.0_react@18.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.module.cjs +32 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-guards@1.0.0_react@18.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-guards@1.0.0_react@18.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.module.js +30 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-guards@1.0.0_react@18.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-scope@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-focus-scope/dist/index.module.cjs +254 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-scope@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-focus-scope/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-scope@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-focus-scope/dist/index.module.js +252 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-focus-scope@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-focus-scope/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-id@1.0.0_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.module.cjs +40 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-id@1.0.0_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-id@1.0.0_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.module.js +19 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-id@1.0.0_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-menu@2.0.5_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-menu/dist/index.js +2 -2
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-popover@1.0.6_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-popover/dist/index.js +2 -2
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-popover@1.0.6_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-popover/dist/index.js.map +1 -1
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-portal@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-portal/dist/index.module.cjs +17 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-portal@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-portal/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-portal@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-portal/dist/index.module.js +15 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-portal@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-portal/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-presence@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.module.cjs +133 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-presence@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-presence@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.module.js +131 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-presence@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-primitive@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.module.cjs +88 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-primitive@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-primitive@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.module.js +85 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-primitive@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-slot@1.0.0_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.module.cjs +82 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-slot@1.0.0_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-slot@1.0.0_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.module.js +79 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-slot@1.0.0_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.cjs +21 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js +19 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.module.cjs +50 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.module.js +48 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.cjs +23 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.js +21 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.module.cjs +14 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.module.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.module.js +12 -0
- package/dist/v1/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.module.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/cmdk@0.2.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/cmdk/dist/index.cjs +39 -0
- package/dist/v1/node_modules/.pnpm/cmdk@0.2.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/cmdk/dist/index.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/cmdk@0.2.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/cmdk/dist/index.js +8 -0
- package/dist/v1/node_modules/.pnpm/cmdk@0.2.0_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/cmdk/dist/index.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/command-score@0.1.2/node_modules/command-score/index.cjs +146 -0
- package/dist/v1/node_modules/.pnpm/command-score@0.1.2/node_modules/command-score/index.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/command-score@0.1.2/node_modules/command-score/index.js +142 -0
- package/dist/v1/node_modules/.pnpm/command-score@0.1.2/node_modules/command-score/index.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +34 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +169 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +146 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/UI.cjs +60 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/UI.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/UI.js +39 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs +24 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +22 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +100 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +97 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/medium.cjs +8 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/medium.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/medium.js +6 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +12 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js +8 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.4_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -0
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +2 -2
- package/dist/v1/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.2.12_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.js +2 -2
- package/dist/v1/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
|
|
4
|
+
/**
|
|
5
|
+
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
6
|
+
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
7
|
+
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
8
|
+
useEffect(()=>{
|
|
9
|
+
var _edgeGuards$, _edgeGuards$2;
|
|
10
|
+
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
11
|
+
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
12
|
+
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
13
|
+
$3db38b7d1fb3fe6a$var$count++;
|
|
14
|
+
return ()=>{
|
|
15
|
+
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
|
|
16
|
+
);
|
|
17
|
+
$3db38b7d1fb3fe6a$var$count--;
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
}
|
|
21
|
+
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
|
|
22
|
+
const element = document.createElement('span');
|
|
23
|
+
element.setAttribute('data-radix-focus-guard', '');
|
|
24
|
+
element.tabIndex = 0;
|
|
25
|
+
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
|
|
26
|
+
return element;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c as useFocusGuards };
|
|
30
|
+
//# sourceMappingURL=index.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.js","sources":["../../../../../../../../../../../node_modules/.pnpm/@radix-ui+react-focus-guards@1.0.0_react@18.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.module.js"],"sourcesContent":["import {useEffect as $1wErz$useEffect} from \"react\";\n\n\n/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;\nfunction $3db38b7d1fb3fe6a$export$ac5b58043b79449b(props) {\n $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();\n return props.children;\n}\n/**\n * Injects a pair of focus guards at the edges of the whole DOM tree\n * to ensure `focusin` & `focusout` events can be caught consistently.\n */ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {\n $1wErz$useEffect(()=>{\n var _edgeGuards$, _edgeGuards$2;\n const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');\n document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());\n document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());\n $3db38b7d1fb3fe6a$var$count++;\n return ()=>{\n if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()\n );\n $3db38b7d1fb3fe6a$var$count--;\n };\n }, []);\n}\nfunction $3db38b7d1fb3fe6a$var$createFocusGuard() {\n const element = document.createElement('span');\n element.setAttribute('data-radix-focus-guard', '');\n element.tabIndex = 0;\n element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';\n return element;\n}\nconst $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9 = $3db38b7d1fb3fe6a$export$ac5b58043b79449b;\n\n\n\n\nexport {$3db38b7d1fb3fe6a$export$ac5b58043b79449b as FocusGuards, $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9 as Root, $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c as useFocusGuards};\n//# sourceMappingURL=index.module.js.map\n"],"names":["$1wErz$useEffect"],"mappings":";;AAGA,+EAA+E,IAAI,2BAA2B,GAAG,CAAC,CAAC;AAKnH;AACA;AACA;AACA,IAAI,SAAS,yCAAyC,GAAG;AACzD,IAAIA,SAAgB,CAAC,IAAI;AACzB,QAAQ,IAAI,YAAY,EAAE,aAAa,CAAC;AACxC,QAAQ,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;AACjF,QAAQ,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,YAAY,EAAE,CAAC,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,YAAY,KAAK,KAAK,CAAC,GAAG,YAAY,GAAG,sCAAsC,EAAE,CAAC,CAAC;AACxL,QAAQ,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,CAAC,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,aAAa,KAAK,KAAK,CAAC,GAAG,aAAa,GAAG,sCAAsC,EAAE,CAAC,CAAC;AAC1L,QAAQ,2BAA2B,EAAE,CAAC;AACtC,QAAQ,OAAO,IAAI;AACnB,YAAY,IAAI,2BAA2B,KAAK,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE;AACtI,aAAa,CAAC;AACd,YAAY,2BAA2B,EAAE,CAAC;AAC1C,SAAS,CAAC;AACV,KAAK,EAAE,EAAE,CAAC,CAAC;AACX,CAAC;AACD,SAAS,sCAAsC,GAAG;AAClD,IAAI,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AACnD,IAAI,OAAO,CAAC,YAAY,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;AACvD,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,kEAAkE,CAAC;AAC/F,IAAI,OAAO,OAAO,CAAC;AACnB;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _extends = require('../../../../../@babel_runtime@7.24.8/node_modules/@babel/runtime/helpers/esm/extends.cjs');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var index_module$1 = require('../../../../../@radix-ui_react-compose-refs@1.0.0_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.module.cjs');
|
|
6
|
+
var index_module$2 = require('../../../../../@radix-ui_react-primitive@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.module.cjs');
|
|
7
|
+
var index_module = require('../../../../../@radix-ui_react-use-callback-ref@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.cjs');
|
|
8
|
+
|
|
9
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
|
|
10
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
|
|
11
|
+
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
12
|
+
bubbles: false,
|
|
13
|
+
cancelable: true
|
|
14
|
+
};
|
|
15
|
+
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
16
|
+
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
17
|
+
const [container1, setContainer] = React.useState(null);
|
|
18
|
+
const onMountAutoFocus = index_module.useCallbackRef(onMountAutoFocusProp);
|
|
19
|
+
const onUnmountAutoFocus = index_module.useCallbackRef(onUnmountAutoFocusProp);
|
|
20
|
+
const lastFocusedElementRef = React.useRef(null);
|
|
21
|
+
const composedRefs = index_module$1.useComposedRefs(forwardedRef, (node)=>setContainer(node)
|
|
22
|
+
);
|
|
23
|
+
const focusScope = React.useRef({
|
|
24
|
+
paused: false,
|
|
25
|
+
pause () {
|
|
26
|
+
this.paused = true;
|
|
27
|
+
},
|
|
28
|
+
resume () {
|
|
29
|
+
this.paused = false;
|
|
30
|
+
}
|
|
31
|
+
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
32
|
+
React.useEffect(()=>{
|
|
33
|
+
if (trapped) {
|
|
34
|
+
function handleFocusIn(event) {
|
|
35
|
+
if (focusScope.paused || !container1) return;
|
|
36
|
+
const target = event.target;
|
|
37
|
+
if (container1.contains(target)) lastFocusedElementRef.current = target;
|
|
38
|
+
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
39
|
+
select: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function handleFocusOut(event) {
|
|
43
|
+
if (focusScope.paused || !container1) return;
|
|
44
|
+
if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
45
|
+
select: true
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
document.addEventListener('focusin', handleFocusIn);
|
|
49
|
+
document.addEventListener('focusout', handleFocusOut);
|
|
50
|
+
return ()=>{
|
|
51
|
+
document.removeEventListener('focusin', handleFocusIn);
|
|
52
|
+
document.removeEventListener('focusout', handleFocusOut);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}, [
|
|
56
|
+
trapped,
|
|
57
|
+
container1,
|
|
58
|
+
focusScope.paused
|
|
59
|
+
]);
|
|
60
|
+
React.useEffect(()=>{
|
|
61
|
+
if (container1) {
|
|
62
|
+
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
63
|
+
const previouslyFocusedElement = document.activeElement;
|
|
64
|
+
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
|
|
65
|
+
if (!hasFocusedCandidate) {
|
|
66
|
+
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
67
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
68
|
+
container1.dispatchEvent(mountEvent);
|
|
69
|
+
if (!mountEvent.defaultPrevented) {
|
|
70
|
+
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
|
|
71
|
+
select: true
|
|
72
|
+
});
|
|
73
|
+
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return ()=>{
|
|
77
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
|
|
78
|
+
// We need to delay the focus a little to get around it for now.
|
|
79
|
+
// See: https://github.com/facebook/react/issues/17894
|
|
80
|
+
setTimeout(()=>{
|
|
81
|
+
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
82
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
83
|
+
container1.dispatchEvent(unmountEvent);
|
|
84
|
+
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
|
|
85
|
+
select: true
|
|
86
|
+
});
|
|
87
|
+
// we need to remove the listener after we `dispatchEvent`
|
|
88
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
89
|
+
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
|
|
90
|
+
}, 0);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}, [
|
|
94
|
+
container1,
|
|
95
|
+
onMountAutoFocus,
|
|
96
|
+
onUnmountAutoFocus,
|
|
97
|
+
focusScope
|
|
98
|
+
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
99
|
+
const handleKeyDown = React.useCallback((event)=>{
|
|
100
|
+
if (!loop && !trapped) return;
|
|
101
|
+
if (focusScope.paused) return;
|
|
102
|
+
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
103
|
+
const focusedElement = document.activeElement;
|
|
104
|
+
if (isTabKey && focusedElement) {
|
|
105
|
+
const container = event.currentTarget;
|
|
106
|
+
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
|
|
107
|
+
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
|
|
108
|
+
if (!hasTabbableElementsInside) {
|
|
109
|
+
if (focusedElement === container) event.preventDefault();
|
|
110
|
+
} else {
|
|
111
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
if (loop) $d3863c46a17e8a28$var$focus(first, {
|
|
114
|
+
select: true
|
|
115
|
+
});
|
|
116
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
if (loop) $d3863c46a17e8a28$var$focus(last, {
|
|
119
|
+
select: true
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, [
|
|
125
|
+
loop,
|
|
126
|
+
trapped,
|
|
127
|
+
focusScope.paused
|
|
128
|
+
]);
|
|
129
|
+
return /*#__PURE__*/ React.createElement(index_module$2.Primitive.div, _extends.default({
|
|
130
|
+
tabIndex: -1
|
|
131
|
+
}, scopeProps, {
|
|
132
|
+
ref: composedRefs,
|
|
133
|
+
onKeyDown: handleKeyDown
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
136
|
+
/* -------------------------------------------------------------------------------------------------
|
|
137
|
+
* Utils
|
|
138
|
+
* -----------------------------------------------------------------------------------------------*/ /**
|
|
139
|
+
* Attempts focusing the first element in a list of candidates.
|
|
140
|
+
* Stops when focus has actually moved.
|
|
141
|
+
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
|
|
142
|
+
const previouslyFocusedElement = document.activeElement;
|
|
143
|
+
for (const candidate of candidates){
|
|
144
|
+
$d3863c46a17e8a28$var$focus(candidate, {
|
|
145
|
+
select: select
|
|
146
|
+
});
|
|
147
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns the first and last tabbable elements inside a container.
|
|
152
|
+
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
|
|
153
|
+
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
|
|
154
|
+
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
|
|
155
|
+
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
|
|
156
|
+
return [
|
|
157
|
+
first,
|
|
158
|
+
last
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Returns a list of potential tabbable candidates.
|
|
163
|
+
*
|
|
164
|
+
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
|
|
165
|
+
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
|
|
166
|
+
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
|
|
167
|
+
*
|
|
168
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
|
|
169
|
+
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
|
|
170
|
+
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
|
|
171
|
+
const nodes = [];
|
|
172
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
173
|
+
acceptNode: (node)=>{
|
|
174
|
+
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
|
|
175
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
|
|
176
|
+
// runtime's understanding of tabbability, so this automatically accounts
|
|
177
|
+
// for any kind of element that could be tabbed to.
|
|
178
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
|
|
182
|
+
// hinders accessibility to have tab order different from visual order.
|
|
183
|
+
return nodes;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Returns the first visible element in a list.
|
|
187
|
+
* NOTE: Only checks visibility up to the `container`.
|
|
188
|
+
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
|
|
189
|
+
for (const element of elements){
|
|
190
|
+
// we stop checking if it's hidden at the `container` level (excluding)
|
|
191
|
+
if (!$d3863c46a17e8a28$var$isHidden(element, {
|
|
192
|
+
upTo: container
|
|
193
|
+
})) return element;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
|
|
197
|
+
if (getComputedStyle(node).visibility === 'hidden') return true;
|
|
198
|
+
while(node){
|
|
199
|
+
// we stop at `upTo` (excluding it)
|
|
200
|
+
if (upTo !== undefined && node === upTo) return false;
|
|
201
|
+
if (getComputedStyle(node).display === 'none') return true;
|
|
202
|
+
node = node.parentElement;
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
function $d3863c46a17e8a28$var$isSelectableInput(element) {
|
|
207
|
+
return element instanceof HTMLInputElement && 'select' in element;
|
|
208
|
+
}
|
|
209
|
+
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
|
|
210
|
+
// only focus if that element is focusable
|
|
211
|
+
if (element && element.focus) {
|
|
212
|
+
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
|
|
213
|
+
element.focus({
|
|
214
|
+
preventScroll: true
|
|
215
|
+
}); // only select if its not the same element, it supports selection and we need to select
|
|
216
|
+
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/* -------------------------------------------------------------------------------------------------
|
|
220
|
+
* FocusScope stack
|
|
221
|
+
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
|
|
222
|
+
function $d3863c46a17e8a28$var$createFocusScopesStack() {
|
|
223
|
+
/** A stack of focus scopes, with the active one at the top */ let stack = [];
|
|
224
|
+
return {
|
|
225
|
+
add (focusScope) {
|
|
226
|
+
// pause the currently active focus scope (at the top of the stack)
|
|
227
|
+
const activeFocusScope = stack[0];
|
|
228
|
+
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
|
|
229
|
+
// remove in case it already exists (because we'll re-add it at the top of the stack)
|
|
230
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
231
|
+
stack.unshift(focusScope);
|
|
232
|
+
},
|
|
233
|
+
remove (focusScope) {
|
|
234
|
+
var _stack$;
|
|
235
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
236
|
+
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
|
|
241
|
+
const updatedArray = [
|
|
242
|
+
...array
|
|
243
|
+
];
|
|
244
|
+
const index = updatedArray.indexOf(item);
|
|
245
|
+
if (index !== -1) updatedArray.splice(index, 1);
|
|
246
|
+
return updatedArray;
|
|
247
|
+
}
|
|
248
|
+
function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
249
|
+
return items.filter((item)=>item.tagName !== 'A'
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
exports.FocusScope = $d3863c46a17e8a28$export$20e40289641fbbb6;
|
|
254
|
+
//# sourceMappingURL=index.module.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.cjs","sources":["../../../../../../../../../../../node_modules/.pnpm/@radix-ui+react-focus-scope@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-focus-scope/dist/index.module.js"],"sourcesContent":["import $45QHv$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $45QHv$forwardRef, useState as $45QHv$useState, useRef as $45QHv$useRef, useEffect as $45QHv$useEffect, useCallback as $45QHv$useCallback, createElement as $45QHv$createElement} from \"react\";\nimport {useComposedRefs as $45QHv$useComposedRefs} from \"@radix-ui/react-compose-refs\";\nimport {Primitive as $45QHv$Primitive} from \"@radix-ui/react-primitive\";\nimport {useCallbackRef as $45QHv$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\n\n\n\n\n\n\nconst $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';\nconst $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';\nconst $d3863c46a17e8a28$var$EVENT_OPTIONS = {\n bubbles: false,\n cancelable: true\n};\n/* -------------------------------------------------------------------------------------------------\n * FocusScope\n * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME = 'FocusScope';\nconst $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ $45QHv$forwardRef((props, forwardedRef)=>{\n const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;\n const [container1, setContainer] = $45QHv$useState(null);\n const onMountAutoFocus = $45QHv$useCallbackRef(onMountAutoFocusProp);\n const onUnmountAutoFocus = $45QHv$useCallbackRef(onUnmountAutoFocusProp);\n const lastFocusedElementRef = $45QHv$useRef(null);\n const composedRefs = $45QHv$useComposedRefs(forwardedRef, (node)=>setContainer(node)\n );\n const focusScope = $45QHv$useRef({\n paused: false,\n pause () {\n this.paused = true;\n },\n resume () {\n this.paused = false;\n }\n }).current; // Takes care of trapping focus if focus is moved outside programmatically for example\n $45QHv$useEffect(()=>{\n if (trapped) {\n function handleFocusIn(event) {\n if (focusScope.paused || !container1) return;\n const target = event.target;\n if (container1.contains(target)) lastFocusedElementRef.current = target;\n else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {\n select: true\n });\n }\n function handleFocusOut(event) {\n if (focusScope.paused || !container1) return;\n if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {\n select: true\n });\n }\n document.addEventListener('focusin', handleFocusIn);\n document.addEventListener('focusout', handleFocusOut);\n return ()=>{\n document.removeEventListener('focusin', handleFocusIn);\n document.removeEventListener('focusout', handleFocusOut);\n };\n }\n }, [\n trapped,\n container1,\n focusScope.paused\n ]);\n $45QHv$useEffect(()=>{\n if (container1) {\n $d3863c46a17e8a28$var$focusScopesStack.add(focusScope);\n const previouslyFocusedElement = document.activeElement;\n const hasFocusedCandidate = container1.contains(previouslyFocusedElement);\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);\n container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n container1.dispatchEvent(mountEvent);\n if (!mountEvent.defaultPrevented) {\n $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {\n select: true\n });\n if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);\n }\n }\n return ()=>{\n container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.\n // We need to delay the focus a little to get around it for now.\n // See: https://github.com/facebook/react/issues/17894\n setTimeout(()=>{\n const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);\n container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n container1.dispatchEvent(unmountEvent);\n if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {\n select: true\n });\n // we need to remove the listener after we `dispatchEvent`\n container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);\n }, 0);\n };\n }\n }, [\n container1,\n onMountAutoFocus,\n onUnmountAutoFocus,\n focusScope\n ]); // Takes care of looping focus (when tabbing whilst at the edges)\n const handleKeyDown = $45QHv$useCallback((event)=>{\n if (!loop && !trapped) return;\n if (focusScope.paused) return;\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement;\n if (isTabKey && focusedElement) {\n const container = event.currentTarget;\n const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);\n const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (loop) $d3863c46a17e8a28$var$focus(first, {\n select: true\n });\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (loop) $d3863c46a17e8a28$var$focus(last, {\n select: true\n });\n }\n }\n }\n }, [\n loop,\n trapped,\n focusScope.paused\n ]);\n return /*#__PURE__*/ $45QHv$createElement($45QHv$Primitive.div, $45QHv$babelruntimehelpersesmextends({\n tabIndex: -1\n }, scopeProps, {\n ref: composedRefs,\n onKeyDown: handleKeyDown\n }));\n});\n/*#__PURE__*/ Object.assign($d3863c46a17e8a28$export$20e40289641fbbb6, {\n displayName: $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME\n});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Attempts focusing the first element in a list of candidates.\n * Stops when focus has actually moved.\n */ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {\n const previouslyFocusedElement = document.activeElement;\n for (const candidate of candidates){\n $d3863c46a17e8a28$var$focus(candidate, {\n select: select\n });\n if (document.activeElement !== previouslyFocusedElement) return;\n }\n}\n/**\n * Returns the first and last tabbable elements inside a container.\n */ function $d3863c46a17e8a28$var$getTabbableEdges(container) {\n const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);\n const first = $d3863c46a17e8a28$var$findVisible(candidates, container);\n const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);\n return [\n first,\n last\n ];\n}\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {\n const nodes = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node)=>{\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n/**\n * Returns the first visible element in a list.\n * NOTE: Only checks visibility up to the `container`.\n */ function $d3863c46a17e8a28$var$findVisible(elements, container) {\n for (const element of elements){\n // we stop checking if it's hidden at the `container` level (excluding)\n if (!$d3863c46a17e8a28$var$isHidden(element, {\n upTo: container\n })) return element;\n }\n}\nfunction $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {\n if (getComputedStyle(node).visibility === 'hidden') return true;\n while(node){\n // we stop at `upTo` (excluding it)\n if (upTo !== undefined && node === upTo) return false;\n if (getComputedStyle(node).display === 'none') return true;\n node = node.parentElement;\n }\n return false;\n}\nfunction $d3863c46a17e8a28$var$isSelectableInput(element) {\n return element instanceof HTMLInputElement && 'select' in element;\n}\nfunction $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {\n // only focus if that element is focusable\n if (element && element.focus) {\n const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users\n element.focus({\n preventScroll: true\n }); // only select if its not the same element, it supports selection and we need to select\n if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();\n }\n}\n/* -------------------------------------------------------------------------------------------------\n * FocusScope stack\n * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();\nfunction $d3863c46a17e8a28$var$createFocusScopesStack() {\n /** A stack of focus scopes, with the active one at the top */ let stack = [];\n return {\n add (focusScope) {\n // pause the currently active focus scope (at the top of the stack)\n const activeFocusScope = stack[0];\n if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();\n // remove in case it already exists (because we'll re-add it at the top of the stack)\n stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);\n stack.unshift(focusScope);\n },\n remove (focusScope) {\n var _stack$;\n stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);\n (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();\n }\n };\n}\nfunction $d3863c46a17e8a28$var$arrayRemove(array, item) {\n const updatedArray = [\n ...array\n ];\n const index = updatedArray.indexOf(item);\n if (index !== -1) updatedArray.splice(index, 1);\n return updatedArray;\n}\nfunction $d3863c46a17e8a28$var$removeLinks(items) {\n return items.filter((item)=>item.tagName !== 'A'\n );\n}\nconst $d3863c46a17e8a28$export$be92b6f5f03c0fe9 = $d3863c46a17e8a28$export$20e40289641fbbb6;\n\n\n\n\nexport {$d3863c46a17e8a28$export$20e40289641fbbb6 as FocusScope, $d3863c46a17e8a28$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.module.js.map\n"],"names":["$45QHv$forwardRef","$45QHv$useState","$45QHv$useCallbackRef","$45QHv$useRef","$45QHv$useComposedRefs","$45QHv$useEffect","$45QHv$useCallback","$45QHv$createElement","$45QHv$Primitive","$45QHv$babelruntimehelpersesmextends"],"mappings":";;;;;;;;AAWA,MAAM,wCAAwC,GAAG,6BAA6B,CAAC;AAC/E,MAAM,0CAA0C,GAAG,+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AAC,IAAI,GAAG,IAAI,CAAC,OAAO,KAAK,GAAG;AACpD,KAAK,CAAC;AACN;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import _extends from '../../../../../@babel_runtime@7.24.8/node_modules/@babel/runtime/helpers/esm/extends.js';
|
|
2
|
+
import { forwardRef, useState, useRef, useEffect, useCallback, createElement } from 'react';
|
|
3
|
+
import { useComposedRefs as $6ed0406888f73fc4$export$c7b2cbe3552a0d05 } from '../../../../../@radix-ui_react-compose-refs@1.0.0_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.module.js';
|
|
4
|
+
import { Primitive as $8927f6f2acc4f386$export$250ffa63cdc0d034 } from '../../../../../@radix-ui_react-primitive@1.0.0_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.module.js';
|
|
5
|
+
import { useCallbackRef as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a } from '../../../../../@radix-ui_react-use-callback-ref@1.0.0_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js';
|
|
6
|
+
|
|
7
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
|
|
8
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
|
|
9
|
+
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
10
|
+
bubbles: false,
|
|
11
|
+
cancelable: true
|
|
12
|
+
};
|
|
13
|
+
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
14
|
+
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
15
|
+
const [container1, setContainer] = useState(null);
|
|
16
|
+
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
17
|
+
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
18
|
+
const lastFocusedElementRef = useRef(null);
|
|
19
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
20
|
+
);
|
|
21
|
+
const focusScope = useRef({
|
|
22
|
+
paused: false,
|
|
23
|
+
pause () {
|
|
24
|
+
this.paused = true;
|
|
25
|
+
},
|
|
26
|
+
resume () {
|
|
27
|
+
this.paused = false;
|
|
28
|
+
}
|
|
29
|
+
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
30
|
+
useEffect(()=>{
|
|
31
|
+
if (trapped) {
|
|
32
|
+
function handleFocusIn(event) {
|
|
33
|
+
if (focusScope.paused || !container1) return;
|
|
34
|
+
const target = event.target;
|
|
35
|
+
if (container1.contains(target)) lastFocusedElementRef.current = target;
|
|
36
|
+
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
37
|
+
select: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function handleFocusOut(event) {
|
|
41
|
+
if (focusScope.paused || !container1) return;
|
|
42
|
+
if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
43
|
+
select: true
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
document.addEventListener('focusin', handleFocusIn);
|
|
47
|
+
document.addEventListener('focusout', handleFocusOut);
|
|
48
|
+
return ()=>{
|
|
49
|
+
document.removeEventListener('focusin', handleFocusIn);
|
|
50
|
+
document.removeEventListener('focusout', handleFocusOut);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}, [
|
|
54
|
+
trapped,
|
|
55
|
+
container1,
|
|
56
|
+
focusScope.paused
|
|
57
|
+
]);
|
|
58
|
+
useEffect(()=>{
|
|
59
|
+
if (container1) {
|
|
60
|
+
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
61
|
+
const previouslyFocusedElement = document.activeElement;
|
|
62
|
+
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
|
|
63
|
+
if (!hasFocusedCandidate) {
|
|
64
|
+
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
65
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
66
|
+
container1.dispatchEvent(mountEvent);
|
|
67
|
+
if (!mountEvent.defaultPrevented) {
|
|
68
|
+
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
|
|
69
|
+
select: true
|
|
70
|
+
});
|
|
71
|
+
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return ()=>{
|
|
75
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
|
|
76
|
+
// We need to delay the focus a little to get around it for now.
|
|
77
|
+
// See: https://github.com/facebook/react/issues/17894
|
|
78
|
+
setTimeout(()=>{
|
|
79
|
+
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
80
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
81
|
+
container1.dispatchEvent(unmountEvent);
|
|
82
|
+
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
|
|
83
|
+
select: true
|
|
84
|
+
});
|
|
85
|
+
// we need to remove the listener after we `dispatchEvent`
|
|
86
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
87
|
+
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
|
|
88
|
+
}, 0);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}, [
|
|
92
|
+
container1,
|
|
93
|
+
onMountAutoFocus,
|
|
94
|
+
onUnmountAutoFocus,
|
|
95
|
+
focusScope
|
|
96
|
+
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
97
|
+
const handleKeyDown = useCallback((event)=>{
|
|
98
|
+
if (!loop && !trapped) return;
|
|
99
|
+
if (focusScope.paused) return;
|
|
100
|
+
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
101
|
+
const focusedElement = document.activeElement;
|
|
102
|
+
if (isTabKey && focusedElement) {
|
|
103
|
+
const container = event.currentTarget;
|
|
104
|
+
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
|
|
105
|
+
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
|
|
106
|
+
if (!hasTabbableElementsInside) {
|
|
107
|
+
if (focusedElement === container) event.preventDefault();
|
|
108
|
+
} else {
|
|
109
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
if (loop) $d3863c46a17e8a28$var$focus(first, {
|
|
112
|
+
select: true
|
|
113
|
+
});
|
|
114
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
if (loop) $d3863c46a17e8a28$var$focus(last, {
|
|
117
|
+
select: true
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, [
|
|
123
|
+
loop,
|
|
124
|
+
trapped,
|
|
125
|
+
focusScope.paused
|
|
126
|
+
]);
|
|
127
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
128
|
+
tabIndex: -1
|
|
129
|
+
}, scopeProps, {
|
|
130
|
+
ref: composedRefs,
|
|
131
|
+
onKeyDown: handleKeyDown
|
|
132
|
+
}));
|
|
133
|
+
});
|
|
134
|
+
/* -------------------------------------------------------------------------------------------------
|
|
135
|
+
* Utils
|
|
136
|
+
* -----------------------------------------------------------------------------------------------*/ /**
|
|
137
|
+
* Attempts focusing the first element in a list of candidates.
|
|
138
|
+
* Stops when focus has actually moved.
|
|
139
|
+
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
|
|
140
|
+
const previouslyFocusedElement = document.activeElement;
|
|
141
|
+
for (const candidate of candidates){
|
|
142
|
+
$d3863c46a17e8a28$var$focus(candidate, {
|
|
143
|
+
select: select
|
|
144
|
+
});
|
|
145
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Returns the first and last tabbable elements inside a container.
|
|
150
|
+
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
|
|
151
|
+
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
|
|
152
|
+
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
|
|
153
|
+
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
|
|
154
|
+
return [
|
|
155
|
+
first,
|
|
156
|
+
last
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns a list of potential tabbable candidates.
|
|
161
|
+
*
|
|
162
|
+
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
|
|
163
|
+
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
|
|
164
|
+
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
|
|
165
|
+
*
|
|
166
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
|
|
167
|
+
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
|
|
168
|
+
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
|
|
169
|
+
const nodes = [];
|
|
170
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
171
|
+
acceptNode: (node)=>{
|
|
172
|
+
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
|
|
173
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
|
|
174
|
+
// runtime's understanding of tabbability, so this automatically accounts
|
|
175
|
+
// for any kind of element that could be tabbed to.
|
|
176
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
|
|
180
|
+
// hinders accessibility to have tab order different from visual order.
|
|
181
|
+
return nodes;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Returns the first visible element in a list.
|
|
185
|
+
* NOTE: Only checks visibility up to the `container`.
|
|
186
|
+
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
|
|
187
|
+
for (const element of elements){
|
|
188
|
+
// we stop checking if it's hidden at the `container` level (excluding)
|
|
189
|
+
if (!$d3863c46a17e8a28$var$isHidden(element, {
|
|
190
|
+
upTo: container
|
|
191
|
+
})) return element;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
|
|
195
|
+
if (getComputedStyle(node).visibility === 'hidden') return true;
|
|
196
|
+
while(node){
|
|
197
|
+
// we stop at `upTo` (excluding it)
|
|
198
|
+
if (upTo !== undefined && node === upTo) return false;
|
|
199
|
+
if (getComputedStyle(node).display === 'none') return true;
|
|
200
|
+
node = node.parentElement;
|
|
201
|
+
}
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
function $d3863c46a17e8a28$var$isSelectableInput(element) {
|
|
205
|
+
return element instanceof HTMLInputElement && 'select' in element;
|
|
206
|
+
}
|
|
207
|
+
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
|
|
208
|
+
// only focus if that element is focusable
|
|
209
|
+
if (element && element.focus) {
|
|
210
|
+
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
|
|
211
|
+
element.focus({
|
|
212
|
+
preventScroll: true
|
|
213
|
+
}); // only select if its not the same element, it supports selection and we need to select
|
|
214
|
+
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/* -------------------------------------------------------------------------------------------------
|
|
218
|
+
* FocusScope stack
|
|
219
|
+
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
|
|
220
|
+
function $d3863c46a17e8a28$var$createFocusScopesStack() {
|
|
221
|
+
/** A stack of focus scopes, with the active one at the top */ let stack = [];
|
|
222
|
+
return {
|
|
223
|
+
add (focusScope) {
|
|
224
|
+
// pause the currently active focus scope (at the top of the stack)
|
|
225
|
+
const activeFocusScope = stack[0];
|
|
226
|
+
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
|
|
227
|
+
// remove in case it already exists (because we'll re-add it at the top of the stack)
|
|
228
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
229
|
+
stack.unshift(focusScope);
|
|
230
|
+
},
|
|
231
|
+
remove (focusScope) {
|
|
232
|
+
var _stack$;
|
|
233
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
234
|
+
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
|
|
239
|
+
const updatedArray = [
|
|
240
|
+
...array
|
|
241
|
+
];
|
|
242
|
+
const index = updatedArray.indexOf(item);
|
|
243
|
+
if (index !== -1) updatedArray.splice(index, 1);
|
|
244
|
+
return updatedArray;
|
|
245
|
+
}
|
|
246
|
+
function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
247
|
+
return items.filter((item)=>item.tagName !== 'A'
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export { $d3863c46a17e8a28$export$20e40289641fbbb6 as FocusScope };
|
|
252
|
+
//# sourceMappingURL=index.module.js.map
|