@radix-ui/react-switch 1.1.0-rc.2 → 1.1.0-rc.4
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/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +164 -156
- package/dist/index.js.map +3 -3
- package/dist/index.mjs.map +2 -2
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as Radix from '@radix-ui/react-primitive';
|
|
3
2
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
type Scope<C = any> = {
|
|
6
5
|
[scopeName: string]: React.Context<C>[];
|
|
7
6
|
} | undefined;
|
|
8
|
-
|
|
7
|
+
type ScopeHook = (scope: Scope) => {
|
|
9
8
|
[__scopeProp: string]: Scope;
|
|
10
9
|
};
|
|
11
10
|
interface CreateScope {
|
|
@@ -14,7 +13,7 @@ interface CreateScope {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
declare const createSwitchScope: CreateScope;
|
|
17
|
-
|
|
16
|
+
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
18
17
|
interface SwitchProps extends PrimitiveButtonProps {
|
|
19
18
|
checked?: boolean;
|
|
20
19
|
defaultChecked?: boolean;
|
|
@@ -22,7 +21,7 @@ interface SwitchProps extends PrimitiveButtonProps {
|
|
|
22
21
|
onCheckedChange?(checked: boolean): void;
|
|
23
22
|
}
|
|
24
23
|
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
25
|
-
|
|
24
|
+
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
26
25
|
interface SwitchThumbProps extends PrimitiveSpanProps {
|
|
27
26
|
}
|
|
28
27
|
declare const SwitchThumb: React.ForwardRefExoticComponent<SwitchThumbProps & React.RefAttributes<HTMLSpanElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as Radix from '@radix-ui/react-primitive';
|
|
3
2
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
type Scope<C = any> = {
|
|
6
5
|
[scopeName: string]: React.Context<C>[];
|
|
7
6
|
} | undefined;
|
|
8
|
-
|
|
7
|
+
type ScopeHook = (scope: Scope) => {
|
|
9
8
|
[__scopeProp: string]: Scope;
|
|
10
9
|
};
|
|
11
10
|
interface CreateScope {
|
|
@@ -14,7 +13,7 @@ interface CreateScope {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
declare const createSwitchScope: CreateScope;
|
|
17
|
-
|
|
16
|
+
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
18
17
|
interface SwitchProps extends PrimitiveButtonProps {
|
|
19
18
|
checked?: boolean;
|
|
20
19
|
defaultChecked?: boolean;
|
|
@@ -22,7 +21,7 @@ interface SwitchProps extends PrimitiveButtonProps {
|
|
|
22
21
|
onCheckedChange?(checked: boolean): void;
|
|
23
22
|
}
|
|
24
23
|
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
25
|
-
|
|
24
|
+
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
26
25
|
interface SwitchThumbProps extends PrimitiveSpanProps {
|
|
27
26
|
}
|
|
28
27
|
declare const SwitchThumb: React.ForwardRefExoticComponent<SwitchThumbProps & React.RefAttributes<HTMLSpanElement>>;
|
package/dist/index.js
CHANGED
|
@@ -1,167 +1,175 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, (event) => {
|
|
83
|
-
setChecked((prevChecked) => !prevChecked);
|
|
84
|
-
if (isFormControl) {
|
|
85
|
-
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
86
|
-
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
),
|
|
91
|
-
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
-
BubbleInput,
|
|
93
|
-
{
|
|
94
|
-
control: button,
|
|
95
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
96
|
-
name,
|
|
97
|
-
value,
|
|
98
|
-
checked,
|
|
99
|
-
required,
|
|
100
|
-
disabled,
|
|
101
|
-
style: { transform: "translateX(-100%)" }
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
] });
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
Switch.displayName = SWITCH_NAME;
|
|
108
|
-
var THUMB_NAME = "SwitchThumb";
|
|
109
|
-
var SwitchThumb = React.forwardRef(
|
|
110
|
-
(props, forwardedRef) => {
|
|
111
|
-
const { __scopeSwitch, ...thumbProps } = props;
|
|
112
|
-
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
|
|
113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
-
import_react_primitive.Primitive.span,
|
|
31
|
+
// packages/react/switch/src/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
Root: () => Root,
|
|
35
|
+
Switch: () => Switch,
|
|
36
|
+
SwitchThumb: () => SwitchThumb,
|
|
37
|
+
Thumb: () => Thumb,
|
|
38
|
+
createSwitchScope: () => createSwitchScope
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(src_exports);
|
|
41
|
+
|
|
42
|
+
// packages/react/switch/src/Switch.tsx
|
|
43
|
+
var React = __toESM(require("react"));
|
|
44
|
+
var import_primitive = require("@radix-ui/primitive");
|
|
45
|
+
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
46
|
+
var import_react_context = require("@radix-ui/react-context");
|
|
47
|
+
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
|
|
48
|
+
var import_react_use_previous = require("@radix-ui/react-use-previous");
|
|
49
|
+
var import_react_use_size = require("@radix-ui/react-use-size");
|
|
50
|
+
var import_react_primitive = require("@radix-ui/react-primitive");
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
var SWITCH_NAME = "Switch";
|
|
53
|
+
var [createSwitchContext, createSwitchScope] = (0, import_react_context.createContextScope)(SWITCH_NAME);
|
|
54
|
+
var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
|
|
55
|
+
var Switch = React.forwardRef(
|
|
56
|
+
(props, forwardedRef) => {
|
|
57
|
+
const {
|
|
58
|
+
__scopeSwitch,
|
|
59
|
+
name,
|
|
60
|
+
checked: checkedProp,
|
|
61
|
+
defaultChecked,
|
|
62
|
+
required,
|
|
63
|
+
disabled,
|
|
64
|
+
value = "on",
|
|
65
|
+
onCheckedChange,
|
|
66
|
+
...switchProps
|
|
67
|
+
} = props;
|
|
68
|
+
const [button, setButton] = React.useState(null);
|
|
69
|
+
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setButton(node));
|
|
70
|
+
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
71
|
+
const isFormControl = button ? Boolean(button.closest("form")) : true;
|
|
72
|
+
const [checked = false, setChecked] = (0, import_react_use_controllable_state.useControllableState)({
|
|
73
|
+
prop: checkedProp,
|
|
74
|
+
defaultProp: defaultChecked,
|
|
75
|
+
onChange: onCheckedChange
|
|
76
|
+
});
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
+
import_react_primitive.Primitive.button,
|
|
115
80
|
{
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
81
|
+
type: "button",
|
|
82
|
+
role: "switch",
|
|
83
|
+
"aria-checked": checked,
|
|
84
|
+
"aria-required": required,
|
|
85
|
+
"data-state": getState(checked),
|
|
86
|
+
"data-disabled": disabled ? "" : void 0,
|
|
87
|
+
disabled,
|
|
88
|
+
value,
|
|
89
|
+
...switchProps,
|
|
90
|
+
ref: composedRefs,
|
|
91
|
+
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, (event) => {
|
|
92
|
+
setChecked((prevChecked) => !prevChecked);
|
|
93
|
+
if (isFormControl) {
|
|
94
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
95
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
96
|
+
}
|
|
97
|
+
})
|
|
120
98
|
}
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
99
|
+
),
|
|
100
|
+
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
101
|
+
BubbleInput,
|
|
102
|
+
{
|
|
103
|
+
control: button,
|
|
104
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
105
|
+
name,
|
|
106
|
+
value,
|
|
107
|
+
checked,
|
|
108
|
+
required,
|
|
109
|
+
disabled,
|
|
110
|
+
style: { transform: "translateX(-100%)" }
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
Switch.displayName = SWITCH_NAME;
|
|
117
|
+
var THUMB_NAME = "SwitchThumb";
|
|
118
|
+
var SwitchThumb = React.forwardRef(
|
|
119
|
+
(props, forwardedRef) => {
|
|
120
|
+
const { __scopeSwitch, ...thumbProps } = props;
|
|
121
|
+
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
|
|
141
122
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
142
|
-
|
|
123
|
+
import_react_primitive.Primitive.span,
|
|
143
124
|
{
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
tabIndex: -1,
|
|
149
|
-
ref,
|
|
150
|
-
style: {
|
|
151
|
-
...props.style,
|
|
152
|
-
...controlSize,
|
|
153
|
-
position: "absolute",
|
|
154
|
-
pointerEvents: "none",
|
|
155
|
-
opacity: 0,
|
|
156
|
-
margin: 0
|
|
157
|
-
}
|
|
125
|
+
"data-state": getState(context.checked),
|
|
126
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
127
|
+
...thumbProps,
|
|
128
|
+
ref: forwardedRef
|
|
158
129
|
}
|
|
159
130
|
);
|
|
160
|
-
};
|
|
161
|
-
function getState(checked) {
|
|
162
|
-
return checked ? "checked" : "unchecked";
|
|
163
131
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
132
|
+
);
|
|
133
|
+
SwitchThumb.displayName = THUMB_NAME;
|
|
134
|
+
var BubbleInput = (props) => {
|
|
135
|
+
const { control, checked, bubbles = true, ...inputProps } = props;
|
|
136
|
+
const ref = React.useRef(null);
|
|
137
|
+
const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
|
|
138
|
+
const controlSize = (0, import_react_use_size.useSize)(control);
|
|
139
|
+
React.useEffect(() => {
|
|
140
|
+
const input = ref.current;
|
|
141
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
142
|
+
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
143
|
+
const setChecked = descriptor.set;
|
|
144
|
+
if (prevChecked !== checked && setChecked) {
|
|
145
|
+
const event = new Event("click", { bubbles });
|
|
146
|
+
setChecked.call(input, checked);
|
|
147
|
+
input.dispatchEvent(event);
|
|
148
|
+
}
|
|
149
|
+
}, [prevChecked, checked, bubbles]);
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
151
|
+
"input",
|
|
152
|
+
{
|
|
153
|
+
type: "checkbox",
|
|
154
|
+
"aria-hidden": true,
|
|
155
|
+
defaultChecked: checked,
|
|
156
|
+
...inputProps,
|
|
157
|
+
tabIndex: -1,
|
|
158
|
+
ref,
|
|
159
|
+
style: {
|
|
160
|
+
...props.style,
|
|
161
|
+
...controlSize,
|
|
162
|
+
position: "absolute",
|
|
163
|
+
pointerEvents: "none",
|
|
164
|
+
opacity: 0,
|
|
165
|
+
margin: 0
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
|
+
function getState(checked) {
|
|
171
|
+
return checked ? "checked" : "unchecked";
|
|
172
|
+
}
|
|
173
|
+
var Root = Switch;
|
|
174
|
+
var Thumb = SwitchThumb;
|
|
167
175
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/Switch.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": ["../src/index.ts", "../src/Switch.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\nexport {\n createSwitchScope,\n //\n Switch,\n SwitchThumb,\n //\n Root,\n Thumb,\n} from './Switch';\nexport type { SwitchProps, SwitchThumbProps } from './Switch';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Switch\n * -----------------------------------------------------------------------------------------------*/\n\nconst SWITCH_NAME = 'Switch';\n\ntype ScopedProps<P> = P & { __scopeSwitch?: Scope };\nconst [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);\n\ntype SwitchContextValue = { checked: boolean; disabled?: boolean };\nconst [SwitchProvider, useSwitchContext] = createSwitchContext<SwitchContextValue>(SWITCH_NAME);\n\ntype SwitchElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface SwitchProps extends PrimitiveButtonProps {\n checked?: boolean;\n defaultChecked?: boolean;\n required?: boolean;\n onCheckedChange?(checked: boolean): void;\n}\n\nconst Switch = React.forwardRef<SwitchElement, SwitchProps>(\n (props: ScopedProps<SwitchProps>, forwardedRef) => {\n const {\n __scopeSwitch,\n name,\n checked: checkedProp,\n defaultChecked,\n required,\n disabled,\n value = 'on',\n onCheckedChange,\n ...switchProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? Boolean(button.closest('form')) : true;\n const [checked = false, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked,\n onChange: onCheckedChange,\n });\n\n return (\n <SwitchProvider scope={__scopeSwitch} checked={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...switchProps}\n ref={composedRefs}\n onClick={composeEventHandlers(props.onClick, (event) => {\n setChecked((prevChecked) => !prevChecked);\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if switch is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect switch updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </SwitchProvider>\n );\n }\n);\n\nSwitch.displayName = SWITCH_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SwitchThumb\n * -----------------------------------------------------------------------------------------------*/\n\nconst THUMB_NAME = 'SwitchThumb';\n\ntype SwitchThumbElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface SwitchThumbProps extends PrimitiveSpanProps {}\n\nconst SwitchThumb = React.forwardRef<SwitchThumbElement, SwitchThumbProps>(\n (props: ScopedProps<SwitchThumbProps>, forwardedRef) => {\n const { __scopeSwitch, ...thumbProps } = props;\n const context = useSwitchContext(THUMB_NAME, __scopeSwitch);\n return (\n <Primitive.span\n data-state={getState(context.checked)}\n data-disabled={context.disabled ? '' : undefined}\n {...thumbProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nSwitchThumb.displayName = THUMB_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype InputProps = React.ComponentPropsWithoutRef<'input'>;\ninterface BubbleInputProps extends Omit<InputProps, 'checked'> {\n checked: boolean;\n control: HTMLElement | null;\n bubbles: boolean;\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { control, checked, bubbles = true, ...inputProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const prevChecked = usePrevious(checked);\n const controlSize = useSize(control);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n\n return (\n <input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }}\n />\n );\n};\n\nfunction getState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nconst Root = Switch;\nconst Thumb = SwitchThumb;\n\nexport {\n createSwitchScope,\n //\n Switch,\n SwitchThumb,\n //\n Root,\n Thumb,\n};\nexport type { SwitchProps, SwitchThumbProps };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,0CAAqC;AACrC,gCAA4B;AAC5B,4BAAwB;AACxB,6BAA0B;AAkDpB;AA1CN,IAAM,cAAc;AAGpB,IAAM,CAAC,qBAAqB,iBAAiB,QAAI,yCAAmB,WAAW;AAG/E,IAAM,CAAC,gBAAgB,gBAAgB,IAAI,oBAAwC,WAAW;AAW9F,IAAM,SAAe;AAAA,EACnB,CAAC,OAAiC,iBAAiB;AACjD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AACJ,UAAM,CAAC,QAAQ,SAAS,IAAU,eAAmC,IAAI;AACzE,UAAM,mBAAe,2CAAgB,cAAc,CAAC,SAAS,UAAU,IAAI,CAAC;AAC5E,UAAM,mCAAyC,aAAO,KAAK;AAE3D,UAAM,gBAAgB,SAAS,QAAQ,OAAO,QAAQ,MAAM,CAAC,IAAI;AACjE,UAAM,CAAC,UAAU,OAAO,UAAU,QAAI,0DAAqB;AAAA,MACzD,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ,CAAC;AAED,WACE,6C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AI;AAC/C,QAAM,kBAAc,uCAAY,OAAO;AACvC,QAAM,kBAAc,+BAAQ,OAAO;AAGnC,EAAM,gBAAU,MAAM;AACpB,UAAM,QAAQ,IAAI;AAClB,UAAM,aAAa,OAAO,iBAAiB;AAC3C,UAAM,aAAa,OAAO,yBAAyB,YAAY,SAAS;AACxE,UAAM,aAAa,WAAW;AAC9B,QAAI,gBAAgB,WAAW,YAAY;AACzC,YAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,QAAQ,CAAC;AAC5C,iBAAW,KAAK,OAAO,OAAO;AAC9B,YAAM,cAAc,KAAK;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,aAAa,SAAS,OAAO,CAAC;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAW;AAAA,MACX,gBAAgB;AAAA,MACf,GAAG;AAAA,MACJ,UAAU;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,GAAG,MAAM;AAAA,QACT,GAAG;AAAA,QACH,UAAU;AAAA,QACV,eAAe;AAAA,QACf,SAAS;AAAA,QACT,QAAQ;AAAA,MACV;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,SAAS,SAAkB;AAClC,SAAO,UAAU,YAAY;AAC/B;AAEA,IAAM,OAAO;AACb,IAAM,QAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/Switch.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type
|
|
5
|
-
"mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,iBAAiB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Switch\n * -----------------------------------------------------------------------------------------------*/\n\nconst SWITCH_NAME = 'Switch';\n\ntype ScopedProps<P> = P & { __scopeSwitch?: Scope };\nconst [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);\n\ntype SwitchContextValue = { checked: boolean; disabled?: boolean };\nconst [SwitchProvider, useSwitchContext] = createSwitchContext<SwitchContextValue>(SWITCH_NAME);\n\ntype SwitchElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface SwitchProps extends PrimitiveButtonProps {\n checked?: boolean;\n defaultChecked?: boolean;\n required?: boolean;\n onCheckedChange?(checked: boolean): void;\n}\n\nconst Switch = React.forwardRef<SwitchElement, SwitchProps>(\n (props: ScopedProps<SwitchProps>, forwardedRef) => {\n const {\n __scopeSwitch,\n name,\n checked: checkedProp,\n defaultChecked,\n required,\n disabled,\n value = 'on',\n onCheckedChange,\n ...switchProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? Boolean(button.closest('form')) : true;\n const [checked = false, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked,\n onChange: onCheckedChange,\n });\n\n return (\n <SwitchProvider scope={__scopeSwitch} checked={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...switchProps}\n ref={composedRefs}\n onClick={composeEventHandlers(props.onClick, (event) => {\n setChecked((prevChecked) => !prevChecked);\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if switch is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect switch updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </SwitchProvider>\n );\n }\n);\n\nSwitch.displayName = SWITCH_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SwitchThumb\n * -----------------------------------------------------------------------------------------------*/\n\nconst THUMB_NAME = 'SwitchThumb';\n\ntype SwitchThumbElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface SwitchThumbProps extends PrimitiveSpanProps {}\n\nconst SwitchThumb = React.forwardRef<SwitchThumbElement, SwitchThumbProps>(\n (props: ScopedProps<SwitchThumbProps>, forwardedRef) => {\n const { __scopeSwitch, ...thumbProps } = props;\n const context = useSwitchContext(THUMB_NAME, __scopeSwitch);\n return (\n <Primitive.span\n data-state={getState(context.checked)}\n data-disabled={context.disabled ? '' : undefined}\n {...thumbProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nSwitchThumb.displayName = THUMB_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype InputProps = React.ComponentPropsWithoutRef<'input'>;\ninterface BubbleInputProps extends Omit<InputProps, 'checked'> {\n checked: boolean;\n control: HTMLElement | null;\n bubbles: boolean;\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { control, checked, bubbles = true, ...inputProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const prevChecked = usePrevious(checked);\n const controlSize = useSize(control);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor;\n const setChecked = descriptor.set;\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n\n return (\n <input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }}\n />\n );\n};\n\nfunction getState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nconst Root = Switch;\nconst Thumb = SwitchThumb;\n\nexport {\n createSwitchScope,\n //\n Switch,\n SwitchThumb,\n //\n Root,\n Thumb,\n};\nexport type { SwitchProps, SwitchThumbProps };\n"],
|
|
5
|
+
"mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAkDpB,SACE,KADF;AA1CN,IAAM,cAAc;AAGpB,IA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AG,MAAM;AAAA,QACT,GAAG;AAAA,QACH,UAAU;AAAA,QACV,eAAe;AAAA,QACf,SAAS;AAAA,QACT,QAAQ;AAAA,MACV;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,SAAS,SAAkB;AAClC,SAAO,UAAU,YAAY;AAC/B;AAEA,IAAM,OAAO;AACb,IAAM,QAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-switch",
|
|
3
|
-
"version": "1.1.0-rc.
|
|
3
|
+
"version": "1.1.0-rc.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"version": "yarn version"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@radix-ui/primitive": "1.1.0-rc.
|
|
32
|
-
"@radix-ui/react-compose-refs": "1.1.0-rc.
|
|
33
|
-
"@radix-ui/react-context": "1.1.0-rc.
|
|
34
|
-
"@radix-ui/react-primitive": "
|
|
35
|
-
"@radix-ui/react-use-controllable-state": "1.1.0-rc.
|
|
36
|
-
"@radix-ui/react-use-previous": "1.1.0-rc.
|
|
37
|
-
"@radix-ui/react-use-size": "1.1.0-rc.
|
|
31
|
+
"@radix-ui/primitive": "1.1.0-rc.4",
|
|
32
|
+
"@radix-ui/react-compose-refs": "1.1.0-rc.4",
|
|
33
|
+
"@radix-ui/react-context": "1.1.0-rc.4",
|
|
34
|
+
"@radix-ui/react-primitive": "2.0.0-rc.1",
|
|
35
|
+
"@radix-ui/react-use-controllable-state": "1.1.0-rc.4",
|
|
36
|
+
"@radix-ui/react-use-previous": "1.1.0-rc.4",
|
|
37
|
+
"@radix-ui/react-use-size": "1.1.0-rc.4"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@types/react": "*",
|
|
41
41
|
"@types/react-dom": "*",
|
|
42
|
-
"react": "^16.8 || ^17.0 || ^18.0",
|
|
43
|
-
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
42
|
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0",
|
|
43
|
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"@types/react": {
|