@react-spectrum/radio 3.7.23 → 3.8.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.
Files changed (42) hide show
  1. package/dist/import.mjs +2 -4
  2. package/dist/main.js +3 -5
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +2 -4
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +2 -0
  7. package/package.json +12 -33
  8. package/src/index.ts +3 -4
  9. package/dist/Radio.main.js +0 -79
  10. package/dist/Radio.main.js.map +0 -1
  11. package/dist/Radio.mjs +0 -74
  12. package/dist/Radio.module.js +0 -74
  13. package/dist/Radio.module.js.map +0 -1
  14. package/dist/RadioGroup.main.js +0 -68
  15. package/dist/RadioGroup.main.js.map +0 -1
  16. package/dist/RadioGroup.mjs +0 -63
  17. package/dist/RadioGroup.module.js +0 -63
  18. package/dist/RadioGroup.module.js.map +0 -1
  19. package/dist/context.main.js +0 -31
  20. package/dist/context.main.js.map +0 -1
  21. package/dist/context.mjs +0 -21
  22. package/dist/context.module.js +0 -21
  23. package/dist/context.module.js.map +0 -1
  24. package/dist/fieldgroup_vars_css.main.js +0 -32
  25. package/dist/fieldgroup_vars_css.main.js.map +0 -1
  26. package/dist/fieldgroup_vars_css.mjs +0 -34
  27. package/dist/fieldgroup_vars_css.module.js +0 -34
  28. package/dist/fieldgroup_vars_css.module.js.map +0 -1
  29. package/dist/radio.3c5c8b59.css +0 -94
  30. package/dist/radio.3c5c8b59.css.map +0 -1
  31. package/dist/radio.85390755.css +0 -370
  32. package/dist/radio.85390755.css.map +0 -1
  33. package/dist/radio_vars_css.main.js +0 -47
  34. package/dist/radio_vars_css.main.js.map +0 -1
  35. package/dist/radio_vars_css.mjs +0 -49
  36. package/dist/radio_vars_css.module.js +0 -49
  37. package/dist/radio_vars_css.module.js.map +0 -1
  38. package/dist/types.d.ts +0 -17
  39. package/dist/types.d.ts.map +0 -1
  40. package/src/Radio.tsx +0 -86
  41. package/src/RadioGroup.tsx +0 -70
  42. package/src/context.ts +0 -26
@@ -1,70 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {classNames, useDOMRef} from '@react-spectrum/utils';
14
- import {DOMRef} from '@react-types/shared';
15
- import {Field} from '@react-spectrum/label';
16
- import {RadioContext} from './context';
17
- import React from 'react';
18
- import {SpectrumRadioGroupProps} from '@react-types/radio';
19
- import styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';
20
- import {useFormProps} from '@react-spectrum/form';
21
- import {useProviderProps} from '@react-spectrum/provider';
22
- import {useRadioGroup} from '@react-aria/radio';
23
- import {useRadioGroupState} from '@react-stately/radio';
24
-
25
- /**
26
- * Radio groups allow users to select a single option from a list of mutually exclusive options.
27
- * All possible options are exposed up front for users to compare.
28
- */
29
- export const RadioGroup = React.forwardRef(function RadioGroup(props: SpectrumRadioGroupProps, ref: DOMRef<HTMLElement>) {
30
- props = useProviderProps(props);
31
- props = useFormProps(props);
32
- let {
33
- isEmphasized,
34
- children,
35
- orientation = 'vertical'
36
- } = props;
37
-
38
- let domRef = useDOMRef(ref);
39
- let state = useRadioGroupState(props);
40
- let {radioGroupProps, ...otherProps} = useRadioGroup(props, state);
41
-
42
- return (
43
- <Field
44
- {...props}
45
- {...otherProps}
46
- ref={domRef}
47
- wrapperClassName={classNames(styles, 'spectrum-FieldGroup')}
48
- elementType="span">
49
- <div
50
- {...radioGroupProps}
51
- className={
52
- classNames(
53
- styles,
54
- 'spectrum-FieldGroup-group',
55
- {
56
- 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'
57
- }
58
- )
59
- }>
60
- <RadioContext.Provider
61
- value={{
62
- isEmphasized,
63
- state
64
- }}>
65
- {children}
66
- </RadioContext.Provider>
67
- </div>
68
- </Field>
69
- );
70
- });
package/src/context.ts DELETED
@@ -1,26 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {RadioGroupState} from '@react-stately/radio';
14
- import React, {useContext} from 'react';
15
-
16
- interface RadioGroupContext {
17
- isEmphasized?: boolean,
18
- name?: string,
19
- state: RadioGroupState
20
- }
21
-
22
- export const RadioContext = React.createContext<RadioGroupContext | null>(null);
23
-
24
- export function useRadioProvider(): RadioGroupContext {
25
- return useContext(RadioContext) || {} as RadioGroupContext;
26
- }