node_modules ignore

This commit is contained in:
oier committed 2025-05-08 23:43:47 +02:00
1 parent e19d52f172
commit 4574544c9f
65041 files changed
+10593536

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
interface RadioProps extends PrimitiveButtonProps {
checked?: boolean;
required?: boolean;
onCheck?(): void;
}
declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLButtonElement>>;
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
interface RadioIndicatorProps extends PrimitiveSpanProps {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
declare const RadioIndicator: React.ForwardRefExoticComponent<RadioIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export const createRadioGroupScope: import("@radix-ui/react-context").CreateScope;
type RadioGroupContextValue = {
name?: string;
required: boolean;
disabled: boolean;
value?: string;
onValueChange(value: string): void;
};
type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
export interface RadioGroupProps extends PrimitiveDivProps {
name?: RadioGroupContextValue['name'];
required?: Radix.ComponentPropsWithoutRef<typeof Radio>['required'];
disabled?: Radix.ComponentPropsWithoutRef<typeof Radio>['disabled'];
dir?: RovingFocusGroupProps['dir'];
orientation?: RovingFocusGroupProps['orientation'];
loop?: RovingFocusGroupProps['loop'];
defaultValue?: string;
value?: RadioGroupContextValue['value'];
onValueChange?: RadioGroupContextValue['onValueChange'];
}
export const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
type _RadioProps1 = Radix.ComponentPropsWithoutRef<typeof Radio>;
export interface RadioGroupItemProps extends Omit<_RadioProps1, 'onCheck' | 'name'> {
value: string;
}
export const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
type _RadioIndicatorProps1 = Radix.ComponentPropsWithoutRef<typeof RadioIndicator>;
export interface RadioGroupIndicatorProps extends _RadioIndicatorProps1 {
}
export const RadioGroupIndicator: React.ForwardRefExoticComponent<RadioGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export const Root: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
export const Item: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
export const Indicator: React.ForwardRefExoticComponent<RadioGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
//# sourceMappingURL=index.d.ts.map
+56
View File
@@ -0,0 +1,56 @@
import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
interface RadioProps extends PrimitiveButtonProps {
checked?: boolean;
required?: boolean;
onCheck?(): void;
}
declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLButtonElement>>;
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
interface RadioIndicatorProps extends PrimitiveSpanProps {
/**
* Used to force mounting when more control is needed. Useful when
* controlling animation with React animation libraries.
*/
forceMount?: true;
}
declare const RadioIndicator: React.ForwardRefExoticComponent<RadioIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export const createRadioGroupScope: import("@radix-ui/react-context").CreateScope;
type RadioGroupContextValue = {
name?: string;
required: boolean;
disabled: boolean;
value?: string;
onValueChange(value: string): void;
};
type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
export interface RadioGroupProps extends PrimitiveDivProps {
name?: RadioGroupContextValue['name'];
required?: Radix.ComponentPropsWithoutRef<typeof Radio>['required'];
disabled?: Radix.ComponentPropsWithoutRef<typeof Radio>['disabled'];
dir?: RovingFocusGroupProps['dir'];
orientation?: RovingFocusGroupProps['orientation'];
loop?: RovingFocusGroupProps['loop'];
defaultValue?: string;
value?: RadioGroupContextValue['value'];
onValueChange?: RadioGroupContextValue['onValueChange'];
}
export const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
type _RadioProps1 = Radix.ComponentPropsWithoutRef<typeof Radio>;
export interface RadioGroupItemProps extends Omit<_RadioProps1, 'onCheck' | 'name'> {
value: string;
}
export const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
type _RadioIndicatorProps1 = Radix.ComponentPropsWithoutRef<typeof RadioIndicator>;
export interface RadioGroupIndicatorProps extends _RadioIndicatorProps1 {
}
export const RadioGroupIndicator: React.ForwardRefExoticComponent<RadioGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
export const Root: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
export const Item: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
export const Indicator: React.ForwardRefExoticComponent<RadioGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"mappings":";;;;AAyBA,4BAA4B,MAAM,wBAAwB,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC;AACpF,oBAAqB,SAAQ,oBAAoB;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB;AAED,QAAA,MAAM,2FA4DL,CAAC;AAWF,0BAA0B,MAAM,wB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U,EAAE,SAAS,GAAG,MAAM,CAAC;IACxE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,OAAA,MAAM,6GA2DL,CAAC;AAWF,6BAA2B,MAAM,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;AACjF,yCAAmC,SAAQ,qBAAmB;CAAG;AAEjE,OAAA,MAAM,qHAML,CAAC;AAMF,OAAA,MAAM,4FAAiB,CAAC;AACxB,OAAA,MAAM,mGAAqB,CAAC;AAC5B,OAAA,MAAM,2GAA+B,CAAC","sources":["packages/react/radio-group/src/packages/react/radio-group/src/Radio.tsx","packages/react/radio-group/src/packages/react/radio-group/src/RadioGroup.tsx","packages/react/radio-group/src/packages/react/radio-group/src/index.ts","packages/react/radio-group/src/index.ts"],"sourcesContent":[null,null,null,"export {\n createRadioGroupScope,\n //\n RadioGroup,\n RadioGroupItem,\n RadioGroupIndicator,\n //\n Root,\n Item,\n Indicator,\n} from './RadioGroup';\nexport type { RadioGroupProps, RadioGroupItemProps, RadioGroupIndicatorProps } from './RadioGroup';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
+290
View File
@@ -0,0 +1,290 @@
var $9yYIj$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $9yYIj$react = require("react");
var $9yYIj$radixuiprimitive = require("@radix-ui/primitive");
var $9yYIj$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
var $9yYIj$radixuireactcontext = require("@radix-ui/react-context");
var $9yYIj$radixuireactprimitive = require("@radix-ui/react-primitive");
var $9yYIj$radixuireactrovingfocus = require("@radix-ui/react-roving-focus");
var $9yYIj$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
var $9yYIj$radixuireactdirection = require("@radix-ui/react-direction");
var $9yYIj$radixuireactusesize = require("@radix-ui/react-use-size");
var $9yYIj$radixuireactuseprevious = require("@radix-ui/react-use-previous");
var $9yYIj$radixuireactpresence = require("@radix-ui/react-presence");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createRadioGroupScope", () => $240483839a8a76fd$export$c547093f11b76da2);
$parcel$export(module.exports, "RadioGroup", () => $240483839a8a76fd$export$a98f0dcb43a68a25);
$parcel$export(module.exports, "RadioGroupItem", () => $240483839a8a76fd$export$9f866c100ef519e4);
$parcel$export(module.exports, "RadioGroupIndicator", () => $240483839a8a76fd$export$5fb54c671a65c88);
$parcel$export(module.exports, "Root", () => $240483839a8a76fd$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Item", () => $240483839a8a76fd$export$6d08773d2e66f8f2);
$parcel$export(module.exports, "Indicator", () => $240483839a8a76fd$export$adb584737d712b70);
/* -------------------------------------------------------------------------------------------------
* Radio
* -----------------------------------------------------------------------------------------------*/ const $ce74a64c62457efb$var$RADIO_NAME = 'Radio';
const [$ce74a64c62457efb$var$createRadioContext, $ce74a64c62457efb$export$67d2296460f1b002] = $9yYIj$radixuireactcontext.createContextScope($ce74a64c62457efb$var$RADIO_NAME);
const [$ce74a64c62457efb$var$RadioProvider, $ce74a64c62457efb$var$useRadioContext] = $ce74a64c62457efb$var$createRadioContext($ce74a64c62457efb$var$RADIO_NAME);
const $ce74a64c62457efb$export$d7b12c4107be0d61 = /*#__PURE__*/ $9yYIj$react.forwardRef((props, forwardedRef)=>{
const { __scopeRadio: __scopeRadio , name: name , checked: checked = false , required: required , disabled: disabled , value: value = 'on' , onCheck: onCheck , ...radioProps } = props;
const [button, setButton] = $9yYIj$react.useState(null);
const composedRefs = $9yYIj$radixuireactcomposerefs.useComposedRefs(forwardedRef, (node)=>setButton(node)
);
const hasConsumerStoppedPropagationRef = $9yYIj$react.useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
const isFormControl = button ? Boolean(button.closest('form')) : true;
return /*#__PURE__*/ $9yYIj$react.createElement($ce74a64c62457efb$var$RadioProvider, {
scope: __scopeRadio,
checked: checked,
disabled: disabled
}, /*#__PURE__*/ $9yYIj$react.createElement($9yYIj$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({
type: "button",
role: "radio",
"aria-checked": checked,
"data-state": $ce74a64c62457efb$var$getState(checked),
"data-disabled": disabled ? '' : undefined,
disabled: disabled,
value: value
}, radioProps, {
ref: composedRefs,
onClick: $9yYIj$radixuiprimitive.composeEventHandlers(props.onClick, (event)=>{
// radios cannot be unchecked so we only communicate a checked state
if (!checked) onCheck === null || onCheck === void 0 || onCheck();
if (isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(); // if radio is in a form, stop propagation from the button so that we only propagate
// one click event (from the input). We propagate changes from an input so that native
// form validation works and form events reflect radio updates.
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
})), isFormControl && /*#__PURE__*/ $9yYIj$react.createElement($ce74a64c62457efb$var$BubbleInput, {
control: button,
bubbles: !hasConsumerStoppedPropagationRef.current,
name: name,
value: value,
checked: checked,
required: required,
disabled: disabled // We transform because the input is absolutely positioned but we have
,
style: {
transform: 'translateX(-100%)'
}
}));
});
/*#__PURE__*/ Object.assign($ce74a64c62457efb$export$d7b12c4107be0d61, {
displayName: $ce74a64c62457efb$var$RADIO_NAME
});
/* -------------------------------------------------------------------------------------------------
* RadioIndicator
* -----------------------------------------------------------------------------------------------*/ const $ce74a64c62457efb$var$INDICATOR_NAME = 'RadioIndicator';
const $ce74a64c62457efb$export$d35a9ffa9a04f9e7 = /*#__PURE__*/ $9yYIj$react.forwardRef((props, forwardedRef)=>{
const { __scopeRadio: __scopeRadio , forceMount: forceMount , ...indicatorProps } = props;
const context = $ce74a64c62457efb$var$useRadioContext($ce74a64c62457efb$var$INDICATOR_NAME, __scopeRadio);
return /*#__PURE__*/ $9yYIj$react.createElement($9yYIj$radixuireactpresence.Presence, {
present: forceMount || context.checked
}, /*#__PURE__*/ $9yYIj$react.createElement($9yYIj$radixuireactprimitive.Primitive.span, ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({
"data-state": $ce74a64c62457efb$var$getState(context.checked),
"data-disabled": context.disabled ? '' : undefined
}, indicatorProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($ce74a64c62457efb$export$d35a9ffa9a04f9e7, {
displayName: $ce74a64c62457efb$var$INDICATOR_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $ce74a64c62457efb$var$BubbleInput = (props)=>{
const { control: control , checked: checked , bubbles: bubbles = true , ...inputProps } = props;
const ref = $9yYIj$react.useRef(null);
const prevChecked = $9yYIj$radixuireactuseprevious.usePrevious(checked);
const controlSize = $9yYIj$radixuireactusesize.useSize(control); // Bubble checked change to parents (e.g form change event)
$9yYIj$react.useEffect(()=>{
const input = ref.current;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
const setChecked = descriptor.set;
if (prevChecked !== checked && setChecked) {
const event = new Event('click', {
bubbles: bubbles
});
setChecked.call(input, checked);
input.dispatchEvent(event);
}
}, [
prevChecked,
checked,
bubbles
]);
return /*#__PURE__*/ $9yYIj$react.createElement("input", ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({
type: "radio",
"aria-hidden": true,
defaultChecked: checked
}, inputProps, {
tabIndex: -1,
ref: ref,
style: {
...props.style,
...controlSize,
position: 'absolute',
pointerEvents: 'none',
opacity: 0,
margin: 0
}
}));
};
function $ce74a64c62457efb$var$getState(checked) {
return checked ? 'checked' : 'unchecked';
}
const $240483839a8a76fd$var$ARROW_KEYS = [
'ArrowUp',
'ArrowDown',
'ArrowLeft',
'ArrowRight'
];
/* -------------------------------------------------------------------------------------------------
* RadioGroup
* -----------------------------------------------------------------------------------------------*/ const $240483839a8a76fd$var$RADIO_GROUP_NAME = 'RadioGroup';
const [$240483839a8a76fd$var$createRadioGroupContext, $240483839a8a76fd$export$c547093f11b76da2] = $9yYIj$radixuireactcontext.createContextScope($240483839a8a76fd$var$RADIO_GROUP_NAME, [
$9yYIj$radixuireactrovingfocus.createRovingFocusGroupScope,
$ce74a64c62457efb$export$67d2296460f1b002
]);
const $240483839a8a76fd$var$useRovingFocusGroupScope = $9yYIj$radixuireactrovingfocus.createRovingFocusGroupScope();
const $240483839a8a76fd$var$useRadioScope = $ce74a64c62457efb$export$67d2296460f1b002();
const [$240483839a8a76fd$var$RadioGroupProvider, $240483839a8a76fd$var$useRadioGroupContext] = $240483839a8a76fd$var$createRadioGroupContext($240483839a8a76fd$var$RADIO_GROUP_NAME);
const $240483839a8a76fd$export$a98f0dcb43a68a25 = /*#__PURE__*/ $9yYIj$react.forwardRef((props, forwardedRef)=>{
const { __scopeRadioGroup: __scopeRadioGroup , name: name , defaultValue: defaultValue , value: valueProp , required: required = false , disabled: disabled = false , orientation: orientation , dir: dir , loop: loop = true , onValueChange: onValueChange , ...groupProps } = props;
const rovingFocusGroupScope = $240483839a8a76fd$var$useRovingFocusGroupScope(__scopeRadioGroup);
const direction = $9yYIj$radixuireactdirection.useDirection(dir);
const [value, setValue] = $9yYIj$radixuireactusecontrollablestate.useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
return /*#__PURE__*/ $9yYIj$react.createElement($240483839a8a76fd$var$RadioGroupProvider, {
scope: __scopeRadioGroup,
name: name,
required: required,
disabled: disabled,
value: value,
onValueChange: setValue
}, /*#__PURE__*/ $9yYIj$react.createElement($9yYIj$radixuireactrovingfocus.Root, ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({
asChild: true
}, rovingFocusGroupScope, {
orientation: orientation,
dir: direction,
loop: loop
}), /*#__PURE__*/ $9yYIj$react.createElement($9yYIj$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({
role: "radiogroup",
"aria-required": required,
"aria-orientation": orientation,
"data-disabled": disabled ? '' : undefined,
dir: direction
}, groupProps, {
ref: forwardedRef
}))));
});
/*#__PURE__*/ Object.assign($240483839a8a76fd$export$a98f0dcb43a68a25, {
displayName: $240483839a8a76fd$var$RADIO_GROUP_NAME
});
/* -------------------------------------------------------------------------------------------------
* RadioGroupItem
* -----------------------------------------------------------------------------------------------*/ const $240483839a8a76fd$var$ITEM_NAME = 'RadioGroupItem';
const $240483839a8a76fd$export$9f866c100ef519e4 = /*#__PURE__*/ $9yYIj$react.forwardRef((props, forwardedRef)=>{
const { __scopeRadioGroup: __scopeRadioGroup , disabled: disabled , ...itemProps } = props;
const context = $240483839a8a76fd$var$useRadioGroupContext($240483839a8a76fd$var$ITEM_NAME, __scopeRadioGroup);
const isDisabled = context.disabled || disabled;
const rovingFocusGroupScope = $240483839a8a76fd$var$useRovingFocusGroupScope(__scopeRadioGroup);
const radioScope = $240483839a8a76fd$var$useRadioScope(__scopeRadioGroup);
const ref = $9yYIj$react.useRef(null);
const composedRefs = $9yYIj$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const checked = context.value === itemProps.value;
const isArrowKeyPressedRef = $9yYIj$react.useRef(false);
$9yYIj$react.useEffect(()=>{
const handleKeyDown = (event)=>{
if ($240483839a8a76fd$var$ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
};
const handleKeyUp = ()=>isArrowKeyPressedRef.current = false
;
document.addEventListener('keydown', handleKeyDown);
document.addEventListener('keyup', handleKeyUp);
return ()=>{
document.removeEventListener('keydown', handleKeyDown);
document.removeEventListener('keyup', handleKeyUp);
};
}, []);
return /*#__PURE__*/ $9yYIj$react.createElement($9yYIj$radixuireactrovingfocus.Item, ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({
asChild: true
}, rovingFocusGroupScope, {
focusable: !isDisabled,
active: checked
}), /*#__PURE__*/ $9yYIj$react.createElement($ce74a64c62457efb$export$d7b12c4107be0d61, ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({
disabled: isDisabled,
required: context.required,
checked: checked
}, radioScope, itemProps, {
name: context.name,
ref: composedRefs,
onCheck: ()=>context.onValueChange(itemProps.value)
,
onKeyDown: $9yYIj$radixuiprimitive.composeEventHandlers((event)=>{
// According to WAI ARIA, radio groups don't activate items on enter keypress
if (event.key === 'Enter') event.preventDefault();
}),
onFocus: $9yYIj$radixuiprimitive.composeEventHandlers(itemProps.onFocus, ()=>{
var _ref$current;
/**
* Our `RovingFocusGroup` will focus the radio when navigating with arrow keys
* and we need to "check" it in that case. We click it to "check" it (instead
* of updating `context.value`) so that the radio change event fires.
*/ if (isArrowKeyPressedRef.current) (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.click();
})
})));
});
/*#__PURE__*/ Object.assign($240483839a8a76fd$export$9f866c100ef519e4, {
displayName: $240483839a8a76fd$var$ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* RadioGroupIndicator
* -----------------------------------------------------------------------------------------------*/ const $240483839a8a76fd$var$INDICATOR_NAME = 'RadioGroupIndicator';
const $240483839a8a76fd$export$5fb54c671a65c88 = /*#__PURE__*/ $9yYIj$react.forwardRef((props, forwardedRef)=>{
const { __scopeRadioGroup: __scopeRadioGroup , ...indicatorProps } = props;
const radioScope = $240483839a8a76fd$var$useRadioScope(__scopeRadioGroup);
return /*#__PURE__*/ $9yYIj$react.createElement($ce74a64c62457efb$export$d35a9ffa9a04f9e7, ($parcel$interopDefault($9yYIj$babelruntimehelpersextends))({}, radioScope, indicatorProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($240483839a8a76fd$export$5fb54c671a65c88, {
displayName: $240483839a8a76fd$var$INDICATOR_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $240483839a8a76fd$export$be92b6f5f03c0fe9 = $240483839a8a76fd$export$a98f0dcb43a68a25;
const $240483839a8a76fd$export$6d08773d2e66f8f2 = $240483839a8a76fd$export$9f866c100ef519e4;
const $240483839a8a76fd$export$adb584737d712b70 = $240483839a8a76fd$export$5fb54c671a65c88;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;A;;;;;;;;;AEYA;;oGA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AGA,MAAM,CAACC,6CAAD,EAA0BrB,yCAA1B,CAAA,GAAmDU,6CAAkB,CAACU,sCAAD,EAAmB;IAC5FP,0DAD4F;IAE5FK,yCAF4F;CAAnB,CAA3E,AAAA;AAIA,MAAMI,8CAAwB,GAAGT,0DAA2B,EAA5D,AAAA;AACA,MAAMU,mCAAa,GAAGL,yCAAgB,EAAtC,AAAA;AAUA,MAAM,CAACM,wCAAD,EAAqBC,0CAArB,CAAA,GACJJ,6CAAuB,CAAyBD,sCAAzB,CADzB,AAAA;AAkBA,MAAMnB,yCAAU,GAAA,aAAGM,CAAAA,uBAAA,CACjB,CAACoB,KAAD,EAAsCC,YAAtC,GAAuD;IACrD,MAAM,E,mBACJC,iBADI,CAAA,E,MAEJC,IAFI,CAAA,E,cAGJC,YAHI,CAAA,EAIJC,KAAK,EAAEC,SAJH,CAAA,YAKJC,QAAQ,GAAG,KALP,aAMJC,QAAQ,GAAG,KANP,G,aAOJC,WAPI,CAAA,E,KAQJC,GARI,CAAA,QASJC,IAAI,GAAG,IATH,G,eAUJC,aAVI,CAAA,EAWJ,GAAGC,UAAH,EAXI,GAYFb,KAZJ,AAAM;IAaN,MAAMc,qBAAqB,GAAGnB,8CAAwB,CAACO,iBAAD,CAAtD,AAAA;IACA,MAAMa,SAAS,GAAG3B,yCAAY,CAACsB,GAAD,CAA9B,AAAA;IACA,MAAM,CLine truncated
+277
View File
@@ -0,0 +1,277 @@
import $8Wolv$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
import {forwardRef as $8Wolv$forwardRef, createElement as $8Wolv$createElement, useRef as $8Wolv$useRef, useEffect as $8Wolv$useEffect, useState as $8Wolv$useState} from "react";
import {composeEventHandlers as $8Wolv$composeEventHandlers} from "@radix-ui/primitive";
import {useComposedRefs as $8Wolv$useComposedRefs} from "@radix-ui/react-compose-refs";
import {createContextScope as $8Wolv$createContextScope} from "@radix-ui/react-context";
import {Primitive as $8Wolv$Primitive} from "@radix-ui/react-primitive";
import {createRovingFocusGroupScope as $8Wolv$createRovingFocusGroupScope, Root as $8Wolv$Root, Item as $8Wolv$Item} from "@radix-ui/react-roving-focus";
import {useControllableState as $8Wolv$useControllableState} from "@radix-ui/react-use-controllable-state";
import {useDirection as $8Wolv$useDirection} from "@radix-ui/react-direction";
import {useSize as $8Wolv$useSize} from "@radix-ui/react-use-size";
import {usePrevious as $8Wolv$usePrevious} from "@radix-ui/react-use-previous";
import {Presence as $8Wolv$Presence} from "@radix-ui/react-presence";
/* -------------------------------------------------------------------------------------------------
* Radio
* -----------------------------------------------------------------------------------------------*/ const $ce77a8961b41be9e$var$RADIO_NAME = 'Radio';
const [$ce77a8961b41be9e$var$createRadioContext, $ce77a8961b41be9e$export$67d2296460f1b002] = $8Wolv$createContextScope($ce77a8961b41be9e$var$RADIO_NAME);
const [$ce77a8961b41be9e$var$RadioProvider, $ce77a8961b41be9e$var$useRadioContext] = $ce77a8961b41be9e$var$createRadioContext($ce77a8961b41be9e$var$RADIO_NAME);
const $ce77a8961b41be9e$export$d7b12c4107be0d61 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
const { __scopeRadio: __scopeRadio , name: name , checked: checked = false , required: required , disabled: disabled , value: value = 'on' , onCheck: onCheck , ...radioProps } = props;
const [button, setButton] = $8Wolv$useState(null);
const composedRefs = $8Wolv$useComposedRefs(forwardedRef, (node)=>setButton(node)
);
const hasConsumerStoppedPropagationRef = $8Wolv$useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
const isFormControl = button ? Boolean(button.closest('form')) : true;
return /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$var$RadioProvider, {
scope: __scopeRadio,
checked: checked,
disabled: disabled
}, /*#__PURE__*/ $8Wolv$createElement($8Wolv$Primitive.button, $8Wolv$babelruntimehelpersesmextends({
type: "button",
role: "radio",
"aria-checked": checked,
"data-state": $ce77a8961b41be9e$var$getState(checked),
"data-disabled": disabled ? '' : undefined,
disabled: disabled,
value: value
}, radioProps, {
ref: composedRefs,
onClick: $8Wolv$composeEventHandlers(props.onClick, (event)=>{
// radios cannot be unchecked so we only communicate a checked state
if (!checked) onCheck === null || onCheck === void 0 || onCheck();
if (isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(); // if radio is in a form, stop propagation from the button so that we only propagate
// one click event (from the input). We propagate changes from an input so that native
// form validation works and form events reflect radio updates.
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
})), isFormControl && /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$var$BubbleInput, {
control: button,
bubbles: !hasConsumerStoppedPropagationRef.current,
name: name,
value: value,
checked: checked,
required: required,
disabled: disabled // We transform because the input is absolutely positioned but we have
,
style: {
transform: 'translateX(-100%)'
}
}));
});
/*#__PURE__*/ Object.assign($ce77a8961b41be9e$export$d7b12c4107be0d61, {
displayName: $ce77a8961b41be9e$var$RADIO_NAME
});
/* -------------------------------------------------------------------------------------------------
* RadioIndicator
* -----------------------------------------------------------------------------------------------*/ const $ce77a8961b41be9e$var$INDICATOR_NAME = 'RadioIndicator';
const $ce77a8961b41be9e$export$d35a9ffa9a04f9e7 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
const { __scopeRadio: __scopeRadio , forceMount: forceMount , ...indicatorProps } = props;
const context = $ce77a8961b41be9e$var$useRadioContext($ce77a8961b41be9e$var$INDICATOR_NAME, __scopeRadio);
return /*#__PURE__*/ $8Wolv$createElement($8Wolv$Presence, {
present: forceMount || context.checked
}, /*#__PURE__*/ $8Wolv$createElement($8Wolv$Primitive.span, $8Wolv$babelruntimehelpersesmextends({
"data-state": $ce77a8961b41be9e$var$getState(context.checked),
"data-disabled": context.disabled ? '' : undefined
}, indicatorProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($ce77a8961b41be9e$export$d35a9ffa9a04f9e7, {
displayName: $ce77a8961b41be9e$var$INDICATOR_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $ce77a8961b41be9e$var$BubbleInput = (props)=>{
const { control: control , checked: checked , bubbles: bubbles = true , ...inputProps } = props;
const ref = $8Wolv$useRef(null);
const prevChecked = $8Wolv$usePrevious(checked);
const controlSize = $8Wolv$useSize(control); // Bubble checked change to parents (e.g form change event)
$8Wolv$useEffect(()=>{
const input = ref.current;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
const setChecked = descriptor.set;
if (prevChecked !== checked && setChecked) {
const event = new Event('click', {
bubbles: bubbles
});
setChecked.call(input, checked);
input.dispatchEvent(event);
}
}, [
prevChecked,
checked,
bubbles
]);
return /*#__PURE__*/ $8Wolv$createElement("input", $8Wolv$babelruntimehelpersesmextends({
type: "radio",
"aria-hidden": true,
defaultChecked: checked
}, inputProps, {
tabIndex: -1,
ref: ref,
style: {
...props.style,
...controlSize,
position: 'absolute',
pointerEvents: 'none',
opacity: 0,
margin: 0
}
}));
};
function $ce77a8961b41be9e$var$getState(checked) {
return checked ? 'checked' : 'unchecked';
}
const $f99a8c78507165f7$var$ARROW_KEYS = [
'ArrowUp',
'ArrowDown',
'ArrowLeft',
'ArrowRight'
];
/* -------------------------------------------------------------------------------------------------
* RadioGroup
* -----------------------------------------------------------------------------------------------*/ const $f99a8c78507165f7$var$RADIO_GROUP_NAME = 'RadioGroup';
const [$f99a8c78507165f7$var$createRadioGroupContext, $f99a8c78507165f7$export$c547093f11b76da2] = $8Wolv$createContextScope($f99a8c78507165f7$var$RADIO_GROUP_NAME, [
$8Wolv$createRovingFocusGroupScope,
$ce77a8961b41be9e$export$67d2296460f1b002
]);
const $f99a8c78507165f7$var$useRovingFocusGroupScope = $8Wolv$createRovingFocusGroupScope();
const $f99a8c78507165f7$var$useRadioScope = $ce77a8961b41be9e$export$67d2296460f1b002();
const [$f99a8c78507165f7$var$RadioGroupProvider, $f99a8c78507165f7$var$useRadioGroupContext] = $f99a8c78507165f7$var$createRadioGroupContext($f99a8c78507165f7$var$RADIO_GROUP_NAME);
const $f99a8c78507165f7$export$a98f0dcb43a68a25 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
const { __scopeRadioGroup: __scopeRadioGroup , name: name , defaultValue: defaultValue , value: valueProp , required: required = false , disabled: disabled = false , orientation: orientation , dir: dir , loop: loop = true , onValueChange: onValueChange , ...groupProps } = props;
const rovingFocusGroupScope = $f99a8c78507165f7$var$useRovingFocusGroupScope(__scopeRadioGroup);
const direction = $8Wolv$useDirection(dir);
const [value, setValue] = $8Wolv$useControllableState({
prop: valueProp,
defaultProp: defaultValue,
onChange: onValueChange
});
return /*#__PURE__*/ $8Wolv$createElement($f99a8c78507165f7$var$RadioGroupProvider, {
scope: __scopeRadioGroup,
name: name,
required: required,
disabled: disabled,
value: value,
onValueChange: setValue
}, /*#__PURE__*/ $8Wolv$createElement($8Wolv$Root, $8Wolv$babelruntimehelpersesmextends({
asChild: true
}, rovingFocusGroupScope, {
orientation: orientation,
dir: direction,
loop: loop
}), /*#__PURE__*/ $8Wolv$createElement($8Wolv$Primitive.div, $8Wolv$babelruntimehelpersesmextends({
role: "radiogroup",
"aria-required": required,
"aria-orientation": orientation,
"data-disabled": disabled ? '' : undefined,
dir: direction
}, groupProps, {
ref: forwardedRef
}))));
});
/*#__PURE__*/ Object.assign($f99a8c78507165f7$export$a98f0dcb43a68a25, {
displayName: $f99a8c78507165f7$var$RADIO_GROUP_NAME
});
/* -------------------------------------------------------------------------------------------------
* RadioGroupItem
* -----------------------------------------------------------------------------------------------*/ const $f99a8c78507165f7$var$ITEM_NAME = 'RadioGroupItem';
const $f99a8c78507165f7$export$9f866c100ef519e4 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
const { __scopeRadioGroup: __scopeRadioGroup , disabled: disabled , ...itemProps } = props;
const context = $f99a8c78507165f7$var$useRadioGroupContext($f99a8c78507165f7$var$ITEM_NAME, __scopeRadioGroup);
const isDisabled = context.disabled || disabled;
const rovingFocusGroupScope = $f99a8c78507165f7$var$useRovingFocusGroupScope(__scopeRadioGroup);
const radioScope = $f99a8c78507165f7$var$useRadioScope(__scopeRadioGroup);
const ref = $8Wolv$useRef(null);
const composedRefs = $8Wolv$useComposedRefs(forwardedRef, ref);
const checked = context.value === itemProps.value;
const isArrowKeyPressedRef = $8Wolv$useRef(false);
$8Wolv$useEffect(()=>{
const handleKeyDown = (event)=>{
if ($f99a8c78507165f7$var$ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
};
const handleKeyUp = ()=>isArrowKeyPressedRef.current = false
;
document.addEventListener('keydown', handleKeyDown);
document.addEventListener('keyup', handleKeyUp);
return ()=>{
document.removeEventListener('keydown', handleKeyDown);
document.removeEventListener('keyup', handleKeyUp);
};
}, []);
return /*#__PURE__*/ $8Wolv$createElement($8Wolv$Item, $8Wolv$babelruntimehelpersesmextends({
asChild: true
}, rovingFocusGroupScope, {
focusable: !isDisabled,
active: checked
}), /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$export$d7b12c4107be0d61, $8Wolv$babelruntimehelpersesmextends({
disabled: isDisabled,
required: context.required,
checked: checked
}, radioScope, itemProps, {
name: context.name,
ref: composedRefs,
onCheck: ()=>context.onValueChange(itemProps.value)
,
onKeyDown: $8Wolv$composeEventHandlers((event)=>{
// According to WAI ARIA, radio groups don't activate items on enter keypress
if (event.key === 'Enter') event.preventDefault();
}),
onFocus: $8Wolv$composeEventHandlers(itemProps.onFocus, ()=>{
var _ref$current;
/**
* Our `RovingFocusGroup` will focus the radio when navigating with arrow keys
* and we need to "check" it in that case. We click it to "check" it (instead
* of updating `context.value`) so that the radio change event fires.
*/ if (isArrowKeyPressedRef.current) (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.click();
})
})));
});
/*#__PURE__*/ Object.assign($f99a8c78507165f7$export$9f866c100ef519e4, {
displayName: $f99a8c78507165f7$var$ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* RadioGroupIndicator
* -----------------------------------------------------------------------------------------------*/ const $f99a8c78507165f7$var$INDICATOR_NAME = 'RadioGroupIndicator';
const $f99a8c78507165f7$export$5fb54c671a65c88 = /*#__PURE__*/ $8Wolv$forwardRef((props, forwardedRef)=>{
const { __scopeRadioGroup: __scopeRadioGroup , ...indicatorProps } = props;
const radioScope = $f99a8c78507165f7$var$useRadioScope(__scopeRadioGroup);
return /*#__PURE__*/ $8Wolv$createElement($ce77a8961b41be9e$export$d35a9ffa9a04f9e7, $8Wolv$babelruntimehelpersesmextends({}, radioScope, indicatorProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($f99a8c78507165f7$export$5fb54c671a65c88, {
displayName: $f99a8c78507165f7$var$INDICATOR_NAME
});
/* ---------------------------------------------------------------------------------------------- */ const $f99a8c78507165f7$export$be92b6f5f03c0fe9 = $f99a8c78507165f7$export$a98f0dcb43a68a25;
const $f99a8c78507165f7$export$6d08773d2e66f8f2 = $f99a8c78507165f7$export$9f866c100ef519e4;
const $f99a8c78507165f7$export$adb584737d712b70 = $f99a8c78507165f7$export$5fb54c671a65c88;
export {$f99a8c78507165f7$export$c547093f11b76da2 as createRadioGroupScope, $f99a8c78507165f7$export$a98f0dcb43a68a25 as RadioGroup, $f99a8c78507165f7$export$9f866c100ef519e4 as RadioGroupItem, $f99a8c78507165f7$export$5fb54c671a65c88 as RadioGroupIndicator, $f99a8c78507165f7$export$be92b6f5f03c0fe9 as Root, $f99a8c78507165f7$export$6d08773d2e66f8f2 as Item, $f99a8c78507165f7$export$adb584737d712b70 as Indicator};
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;A;;;;;;;;;;A;;;;;;;;;AEYA;;oGAEA,CAEA,MAAM4E,gCAAU,GAAG,OAAnB,AAAA;AAGA,MAAM,CAACC,wCAAD,EAAqB3D,yCAArB,CAAA,GAAyCR,yBAAkB,CAACkE,gCAAD,CAAjE,AAAA;AAGA,MAAM,CAACE,mCAAD,EAAgBC,qCAAhB,CAAA,GAAmCF,wCAAkB,C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