@react-native-aria/radio 0.2.8 → 0.2.10

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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # @react-native-aria/radio
2
+
3
+ ## 0.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @react-native-aria/utils@0.2.11
9
+ - @react-native-aria/interactions@0.2.13
10
+
11
+ ## 0.2.9
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+ - @react-native-aria/interactions@0.2.12
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _useRadio = require("./useRadio");
8
-
9
7
  Object.keys(_useRadio).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _useRadio[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_useRadio).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _useRadioGroup = require("./useRadioGroup");
21
-
22
18
  Object.keys(_useRadioGroup).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _useRadioGroup[key]) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './useRadio';\nexport * from './useRadioGroup';\n"]}
1
+ {"version":3,"names":["_useRadio","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useRadioGroup"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,cAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,cAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,cAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
@@ -15,8 +15,6 @@ Object.defineProperty(exports, "useRadioGroup", {
15
15
  return _useRadioGroup.useRadioGroup;
16
16
  }
17
17
  });
18
-
19
18
  var _radio = require("@react-aria/radio");
20
-
21
19
  var _useRadioGroup = require("./useRadioGroup.web");
22
20
  //# sourceMappingURL=index.web.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.web.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { useRadio } from \"@react-aria/radio\";\nexport { useRadioGroup } from \"./useRadioGroup.web\";\n"]}
1
+ {"version":3,"names":["_radio","require","_useRadioGroup"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA"}
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useRadio = useRadio;
7
-
8
7
  var _utils = require("@react-aria/utils");
9
-
10
8
  var _interactions = require("@react-native-aria/interactions");
11
-
12
9
  var _utils2 = require("@react-native-aria/utils");
13
-
14
10
  /**
15
11
  * Provides the behavior and accessibility implementation for an individual
16
12
  * radio button in a radio group.
@@ -19,8 +15,6 @@ var _utils2 = require("@react-native-aria/utils");
19
15
  * @param ref - Ref to the HTML input element.
20
16
  */
21
17
  function useRadio(props, state, _ref) {
22
- var _preventChanges;
23
-
24
18
  let {
25
19
  value,
26
20
  isReadOnly,
@@ -29,19 +23,15 @@ function useRadio(props, state, _ref) {
29
23
  } = props;
30
24
  let hasChildren = children != null;
31
25
  const label = (0, _utils2.getLabel)(props);
32
-
33
26
  if (!hasChildren && !label) {
34
27
  console.warn('If you do not provide children, you must specify an aria-label for accessibility');
35
28
  }
36
-
37
29
  let preventChanges = isDisabled || isReadOnly;
38
- preventChanges = (_preventChanges = preventChanges) !== null && _preventChanges !== void 0 ? _preventChanges : false;
30
+ preventChanges = preventChanges ?? false;
39
31
  let checked = state.selectedValue === value;
40
-
41
32
  let onPress = () => {
42
33
  state.setSelectedValue(value);
43
34
  };
44
-
45
35
  let {
46
36
  pressProps
47
37
  } = (0, _interactions.usePress)({
@@ -49,7 +39,8 @@ function useRadio(props, state, _ref) {
49
39
  onPress
50
40
  });
51
41
  return {
52
- inputProps: (0, _utils.mergeProps)(props, { ...pressProps,
42
+ inputProps: (0, _utils.mergeProps)(props, {
43
+ ...pressProps,
53
44
  checked,
54
45
  'disabled': preventChanges,
55
46
  value,
@@ -1 +1 @@
1
- {"version":3,"sources":["useRadio.ts"],"names":["useRadio","props","state","_ref","value","isReadOnly","isDisabled","children","hasChildren","label","console","warn","preventChanges","checked","selectedValue","onPress","setSelectedValue","pressProps","inputProps"],"mappings":";;;;;;;AACA;;AAGA;;AAEA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,QAAT,CACLC,KADK,EAELC,KAFK,EAGLC,IAHK,EAIM;AAAA;;AACX,MAAI;AAAEC,IAAAA,KAAF;AAASC,IAAAA,UAAT;AAAqBC,IAAAA,UAArB;AAAiCC,IAAAA;AAAjC,MAA8CN,KAAlD;AAEA,MAAIO,WAAW,GAAGD,QAAQ,IAAI,IAA9B;AACA,QAAME,KAAK,GAAG,sBAASR,KAAT,CAAd;;AAEA,MAAI,CAACO,WAAD,IAAgB,CAACC,KAArB,EAA4B;AAC1BC,IAAAA,OAAO,CAACC,IAAR,CACE,kFADF;AAGD;;AAED,MAAIC,cAAc,GAAGN,UAAU,IAAID,UAAnC;AACAO,EAAAA,cAAc,sBAAGA,cAAH,6DAAqB,KAAnC;AAEA,MAAIC,OAAO,GAAGX,KAAK,CAACY,aAAN,KAAwBV,KAAtC;;AAEA,MAAIW,OAAO,GAAG,MAAM;AAClBb,IAAAA,KAAK,CAACc,gBAAN,CAAuBZ,KAAvB;AACD,GAFD;;AAIA,MAAI;AAAEa,IAAAA;AAAF,MAAiB,4BAAS;AAC5BX,IAAAA,UAAU,EAAEM,cADgB;AAE5BG,IAAAA;AAF4B,GAAT,CAArB;AAKA,SAAO;AACLG,IAAAA,UAAU,EAAE,uBAAWjB,KAAX,EAAkB,EAC5B,GAAGgB,UADyB;AAE5BJ,MAAAA,OAF4B;AAG5B,kBAAYD,cAHgB;AAI5BR,MAAAA,KAJ4B;AAK5B,oBAAcK,KALc;AAM5B,cAAQ,OANoB;AAO5B,uBAAiBG,cAPW;AAQ5B,sBAAgBC;AARY,KAAlB;AADP,GAAP;AAYD","sourcesContent":["import type { AriaRadioProps } from '@react-types/radio';\nimport { mergeProps } from '@react-aria/utils';\nimport type { RefObject } from 'react';\nimport type { RadioGroupState } from '@react-stately/radio';\nimport { usePress } from '@react-native-aria/interactions';\nimport type { AccessibilityProps } from 'react-native';\nimport { getLabel } from '@react-native-aria/utils';\n\nexport interface RadioAriaProps extends AriaRadioProps, AccessibilityProps {\n /**\n * Whether the Radio is required. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required).\n */\n isRequired?: boolean;\n /**\n * Whether the Radio can be interacted with but cannot have its selection state changed.\n */\n isReadOnly?: boolean;\n}\n\nexport interface RadioAria extends AccessibilityProps {\n /** Props for the input or Pressable/Touchable element. */\n inputProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n * @param props - Props for the radio.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useRadio(\n props: RadioAriaProps,\n state: RadioGroupState,\n _ref: RefObject<HTMLElement>\n): RadioAria {\n let { value, isReadOnly, isDisabled, children } = props;\n\n let hasChildren = children != null;\n const label = getLabel(props);\n\n if (!hasChildren && !label) {\n console.warn(\n 'If you do not provide children, you must specify an aria-label for accessibility'\n );\n }\n\n let preventChanges = isDisabled || isReadOnly;\n preventChanges = preventChanges ?? false;\n\n let checked = state.selectedValue === value;\n\n let onPress = () => {\n state.setSelectedValue(value);\n };\n\n let { pressProps } = usePress({\n isDisabled: preventChanges,\n onPress,\n });\n\n return {\n inputProps: mergeProps(props, {\n ...pressProps,\n checked,\n 'disabled': preventChanges,\n value,\n 'aria-label': label,\n 'role': 'radio',\n 'aria-disabled': preventChanges,\n 'aria-checked': checked,\n }),\n };\n}\n"]}
1
+ {"version":3,"names":["_utils","require","_interactions","_utils2","useRadio","props","state","_ref","value","isReadOnly","isDisabled","children","hasChildren","label","getLabel","console","warn","preventChanges","checked","selectedValue","onPress","setSelectedValue","pressProps","usePress","inputProps","mergeProps"],"sourceRoot":"../../src","sources":["useRadio.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,QAAQA,CACtBC,KAAqB,EACrBC,KAAsB,EACtBC,IAA4B,EACjB;EACX,IAAI;IAAEC,KAAK;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAEvD,IAAIO,WAAW,GAAGD,QAAQ,IAAI,IAAI;EAClC,MAAME,KAAK,GAAG,IAAAC,gBAAQ,EAACT,KAAK,CAAC;EAE7B,IAAI,CAACO,WAAW,IAAI,CAACC,KAAK,EAAE;IAC1BE,OAAO,CAACC,IAAI,CACV,kFACF,CAAC;EACH;EAEA,IAAIC,cAAc,GAAGP,UAAU,IAAID,UAAU;EAC7CQ,cAAc,GAAGA,cAAc,IAAI,KAAK;EAExC,IAAIC,OAAO,GAAGZ,KAAK,CAACa,aAAa,KAAKX,KAAK;EAE3C,IAAIY,OAAO,GAAGA,CAAA,KAAM;IAClBd,KAAK,CAACe,gBAAgB,CAACb,KAAK,CAAC;EAC/B,CAAC;EAED,IAAI;IAAEc;EAAW,CAAC,GAAG,IAAAC,sBAAQ,EAAC;IAC5Bb,UAAU,EAAEO,cAAc;IAC1BG;EACF,CAAC,CAAC;EAEF,OAAO;IACLI,UAAU,EAAE,IAAAC,iBAAU,EAACpB,KAAK,EAAE;MAC5B,GAAGiB,UAAU;MACbJ,OAAO;MACP,UAAU,EAAED,cAAc;MAC1BT,KAAK;MACL,YAAY,EAAEK,KAAK;MACnB,MAAM,EAAE,OAAO;MACf,eAAe,EAAEI,cAAc;MAC/B,cAAc,EAAEC;IAClB,CAAC;EACH,CAAC;AACH"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useRadioGroup = useRadioGroup;
7
-
8
7
  var _utils = require("@react-native-aria/utils");
9
-
10
8
  /**
11
9
  * Provides the behavior and accessibility implementation for a radio group component.
12
10
  * Radio groups allow users to select a single item from a list of mutually exclusive options.
@@ -1 +1 @@
1
- {"version":3,"sources":["useRadioGroup.ts"],"names":["useRadioGroup","props","_state","isDisabled","radioGroupProps","labelProps"],"mappings":";;;;;;;AAEA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CACLC,KADK,EAELC,MAFK,EAGW;AAChB,MAAI;AAAEC,IAAAA;AAAF,MAAiBF,KAArB;AAEA,SAAO;AACLG,IAAAA,eAAe,EAAE;AACf,oBAAc,qBAASH,KAAT,CADC;AAEf,cAAQ,YAFO;AAGf,uBAAiBE;AAHF,KADZ;AAMLE,IAAAA,UAAU,EAAE;AANP,GAAP;AAQD","sourcesContent":["import type { AriaRadioGroupProps } from '@react-types/radio';\nimport type { RadioGroupState } from '@react-stately/radio';\nimport { getLabel } from '@react-native-aria/utils';\n\nexport interface RNAriaRadioGroupProps extends AriaRadioGroupProps {\n children?: React.ReactNode;\n}\n\nexport interface RadioGroupAria {\n /** Props for the radio group wrapper element. */\n radioGroupProps: any;\n /** Props for the radio group's visible label (if any). */\n labelProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n * @param props - Props for the radio group.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n */\nexport function useRadioGroup(\n props: RNAriaRadioGroupProps,\n _state: RadioGroupState\n): RadioGroupAria {\n let { isDisabled } = props;\n\n return {\n radioGroupProps: {\n 'aria-label': getLabel(props),\n 'role': 'radiogroup',\n 'aria-disabled': isDisabled,\n },\n labelProps: {},\n };\n}\n"]}
1
+ {"version":3,"names":["_utils","require","useRadioGroup","props","_state","isDisabled","radioGroupProps","getLabel","labelProps"],"sourceRoot":"../../src","sources":["useRadioGroup.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAaA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAC3BC,KAA4B,EAC5BC,MAAuB,EACP;EAChB,IAAI;IAAEC;EAAW,CAAC,GAAGF,KAAK;EAE1B,OAAO;IACLG,eAAe,EAAE;MACf,YAAY,EAAE,IAAAC,eAAQ,EAACJ,KAAK,CAAC;MAC7B,MAAM,EAAE,YAAY;MACpB,eAAe,EAAEE;IACnB,CAAC;IACDG,UAAU,EAAE,CAAC;EACf,CAAC;AACH"}
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useRadioGroup = useRadioGroup;
7
-
8
7
  var _radio = require("@react-aria/radio");
9
-
10
8
  var _utils = require("@react-aria/utils");
11
-
12
9
  var _utils2 = require("@react-native-aria/utils");
13
-
14
10
  /**
15
11
  * Provides the behavior and accessibility implementation for a radio group component.
16
12
  * Radio groups allow users to select a single item from a list of mutually exclusive options.
@@ -1 +1 @@
1
- {"version":3,"sources":["useRadioGroup.web.ts"],"names":["useRadioGroup","props","state","params","newParams","radioGroupProps","labelProps"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AASA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CACLC,KADK,EAELC,KAFK,EAGW;AAChB,QAAMC,MAAM,GAAG,0BAAiBF,KAAjB,EAAwBC,KAAxB,CAAf;AAEA,QAAME,SAAS,GAAG;AAChBC,IAAAA,eAAe,EAAE,uBACfF,MAAM,CAACE,eADQ,EAEf,6BAAgBF,MAAM,CAACE,eAAvB,CAFe,CADD;AAKhBC,IAAAA,UAAU,EAAE,uBACVH,MAAM,CAACG,UADG,EAEV,6BAAgBH,MAAM,CAACG,UAAvB,CAFU;AALI,GAAlB;AAWA,SAAOF,SAAP;AACD","sourcesContent":["import { useRadioGroup as useRadioGroupWeb } from '@react-aria/radio';\nimport { RadioGroupState } from '@react-stately/radio';\nimport { mergeProps } from '@react-aria/utils';\nimport { AriaRadioGroupProps } from '@react-types/radio';\nimport { mapDomPropsToRN } from '@react-native-aria/utils';\n\ninterface RadioGroupAria {\n /** Props for the radio group wrapper element. */\n radioGroupProps: any;\n /** Props for the radio group's visible label (if any). */\n labelProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n * @param props - Props for the radio group.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n */\nexport function useRadioGroup(\n props: AriaRadioGroupProps,\n state: RadioGroupState\n): RadioGroupAria {\n const params = useRadioGroupWeb(props, state);\n\n const newParams = {\n radioGroupProps: mergeProps(\n params.radioGroupProps,\n mapDomPropsToRN(params.radioGroupProps)\n ),\n labelProps: mergeProps(\n params.labelProps,\n mapDomPropsToRN(params.labelProps)\n ),\n };\n\n return newParams;\n}\n"]}
1
+ {"version":3,"names":["_radio","require","_utils","_utils2","useRadioGroup","props","state","params","useRadioGroupWeb","newParams","radioGroupProps","mergeProps","mapDomPropsToRN","labelProps"],"sourceRoot":"../../src","sources":["useRadioGroup.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AASA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,aAAaA,CAC3BC,KAA0B,EAC1BC,KAAsB,EACN;EAChB,MAAMC,MAAM,GAAG,IAAAC,oBAAgB,EAACH,KAAK,EAAEC,KAAK,CAAC;EAE7C,MAAMG,SAAS,GAAG;IAChBC,eAAe,EAAE,IAAAC,iBAAU,EACzBJ,MAAM,CAACG,eAAe,EACtB,IAAAE,uBAAe,EAACL,MAAM,CAACG,eAAe,CACxC,CAAC;IACDG,UAAU,EAAE,IAAAF,iBAAU,EACpBJ,MAAM,CAACM,UAAU,EACjB,IAAAD,uBAAe,EAACL,MAAM,CAACM,UAAU,CACnC;EACF,CAAC;EAED,OAAOJ,SAAS;AAClB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAd;AACA,cAAc,iBAAd","sourcesContent":["export * from './useRadio';\nexport * from './useRadioGroup';\n"]}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.web.ts"],"names":["useRadio","useRadioGroup"],"mappings":"AAAA,SAASA,QAAT,QAAyB,mBAAzB;AACA,SAASC,aAAT,QAA8B,qBAA9B","sourcesContent":["export { useRadio } from \"@react-aria/radio\";\nexport { useRadioGroup } from \"./useRadioGroup.web\";\n"]}
1
+ {"version":3,"names":["useRadio","useRadioGroup"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,aAAa,QAAQ,qBAAqB"}
@@ -1,7 +1,6 @@
1
1
  import { mergeProps } from '@react-aria/utils';
2
2
  import { usePress } from '@react-native-aria/interactions';
3
3
  import { getLabel } from '@react-native-aria/utils';
4
-
5
4
  /**
6
5
  * Provides the behavior and accessibility implementation for an individual
7
6
  * radio button in a radio group.
@@ -10,8 +9,6 @@ import { getLabel } from '@react-native-aria/utils';
10
9
  * @param ref - Ref to the HTML input element.
11
10
  */
12
11
  export function useRadio(props, state, _ref) {
13
- var _preventChanges;
14
-
15
12
  let {
16
13
  value,
17
14
  isReadOnly,
@@ -20,19 +17,15 @@ export function useRadio(props, state, _ref) {
20
17
  } = props;
21
18
  let hasChildren = children != null;
22
19
  const label = getLabel(props);
23
-
24
20
  if (!hasChildren && !label) {
25
21
  console.warn('If you do not provide children, you must specify an aria-label for accessibility');
26
22
  }
27
-
28
23
  let preventChanges = isDisabled || isReadOnly;
29
- preventChanges = (_preventChanges = preventChanges) !== null && _preventChanges !== void 0 ? _preventChanges : false;
24
+ preventChanges = preventChanges ?? false;
30
25
  let checked = state.selectedValue === value;
31
-
32
26
  let onPress = () => {
33
27
  state.setSelectedValue(value);
34
28
  };
35
-
36
29
  let {
37
30
  pressProps
38
31
  } = usePress({
@@ -40,7 +33,8 @@ export function useRadio(props, state, _ref) {
40
33
  onPress
41
34
  });
42
35
  return {
43
- inputProps: mergeProps(props, { ...pressProps,
36
+ inputProps: mergeProps(props, {
37
+ ...pressProps,
44
38
  checked,
45
39
  'disabled': preventChanges,
46
40
  value,
@@ -1 +1 @@
1
- {"version":3,"sources":["useRadio.ts"],"names":["mergeProps","usePress","getLabel","useRadio","props","state","_ref","value","isReadOnly","isDisabled","children","hasChildren","label","console","warn","preventChanges","checked","selectedValue","onPress","setSelectedValue","pressProps","inputProps"],"mappings":"AACA,SAASA,UAAT,QAA2B,mBAA3B;AAGA,SAASC,QAAT,QAAyB,iCAAzB;AAEA,SAASC,QAAT,QAAyB,0BAAzB;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,QAAT,CACLC,KADK,EAELC,KAFK,EAGLC,IAHK,EAIM;AAAA;;AACX,MAAI;AAAEC,IAAAA,KAAF;AAASC,IAAAA,UAAT;AAAqBC,IAAAA,UAArB;AAAiCC,IAAAA;AAAjC,MAA8CN,KAAlD;AAEA,MAAIO,WAAW,GAAGD,QAAQ,IAAI,IAA9B;AACA,QAAME,KAAK,GAAGV,QAAQ,CAACE,KAAD,CAAtB;;AAEA,MAAI,CAACO,WAAD,IAAgB,CAACC,KAArB,EAA4B;AAC1BC,IAAAA,OAAO,CAACC,IAAR,CACE,kFADF;AAGD;;AAED,MAAIC,cAAc,GAAGN,UAAU,IAAID,UAAnC;AACAO,EAAAA,cAAc,sBAAGA,cAAH,6DAAqB,KAAnC;AAEA,MAAIC,OAAO,GAAGX,KAAK,CAACY,aAAN,KAAwBV,KAAtC;;AAEA,MAAIW,OAAO,GAAG,MAAM;AAClBb,IAAAA,KAAK,CAACc,gBAAN,CAAuBZ,KAAvB;AACD,GAFD;;AAIA,MAAI;AAAEa,IAAAA;AAAF,MAAiBnB,QAAQ,CAAC;AAC5BQ,IAAAA,UAAU,EAAEM,cADgB;AAE5BG,IAAAA;AAF4B,GAAD,CAA7B;AAKA,SAAO;AACLG,IAAAA,UAAU,EAAErB,UAAU,CAACI,KAAD,EAAQ,EAC5B,GAAGgB,UADyB;AAE5BJ,MAAAA,OAF4B;AAG5B,kBAAYD,cAHgB;AAI5BR,MAAAA,KAJ4B;AAK5B,oBAAcK,KALc;AAM5B,cAAQ,OANoB;AAO5B,uBAAiBG,cAPW;AAQ5B,sBAAgBC;AARY,KAAR;AADjB,GAAP;AAYD","sourcesContent":["import type { AriaRadioProps } from '@react-types/radio';\nimport { mergeProps } from '@react-aria/utils';\nimport type { RefObject } from 'react';\nimport type { RadioGroupState } from '@react-stately/radio';\nimport { usePress } from '@react-native-aria/interactions';\nimport type { AccessibilityProps } from 'react-native';\nimport { getLabel } from '@react-native-aria/utils';\n\nexport interface RadioAriaProps extends AriaRadioProps, AccessibilityProps {\n /**\n * Whether the Radio is required. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required).\n */\n isRequired?: boolean;\n /**\n * Whether the Radio can be interacted with but cannot have its selection state changed.\n */\n isReadOnly?: boolean;\n}\n\nexport interface RadioAria extends AccessibilityProps {\n /** Props for the input or Pressable/Touchable element. */\n inputProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n * @param props - Props for the radio.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useRadio(\n props: RadioAriaProps,\n state: RadioGroupState,\n _ref: RefObject<HTMLElement>\n): RadioAria {\n let { value, isReadOnly, isDisabled, children } = props;\n\n let hasChildren = children != null;\n const label = getLabel(props);\n\n if (!hasChildren && !label) {\n console.warn(\n 'If you do not provide children, you must specify an aria-label for accessibility'\n );\n }\n\n let preventChanges = isDisabled || isReadOnly;\n preventChanges = preventChanges ?? false;\n\n let checked = state.selectedValue === value;\n\n let onPress = () => {\n state.setSelectedValue(value);\n };\n\n let { pressProps } = usePress({\n isDisabled: preventChanges,\n onPress,\n });\n\n return {\n inputProps: mergeProps(props, {\n ...pressProps,\n checked,\n 'disabled': preventChanges,\n value,\n 'aria-label': label,\n 'role': 'radio',\n 'aria-disabled': preventChanges,\n 'aria-checked': checked,\n }),\n };\n}\n"]}
1
+ {"version":3,"names":["mergeProps","usePress","getLabel","useRadio","props","state","_ref","value","isReadOnly","isDisabled","children","hasChildren","label","console","warn","preventChanges","checked","selectedValue","onPress","setSelectedValue","pressProps","inputProps"],"sourceRoot":"../../src","sources":["useRadio.ts"],"mappings":"AACA,SAASA,UAAU,QAAQ,mBAAmB;AAG9C,SAASC,QAAQ,QAAQ,iCAAiC;AAE1D,SAASC,QAAQ,QAAQ,0BAA0B;AAkBnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,QAAQA,CACtBC,KAAqB,EACrBC,KAAsB,EACtBC,IAA4B,EACjB;EACX,IAAI;IAAEC,KAAK;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAEvD,IAAIO,WAAW,GAAGD,QAAQ,IAAI,IAAI;EAClC,MAAME,KAAK,GAAGV,QAAQ,CAACE,KAAK,CAAC;EAE7B,IAAI,CAACO,WAAW,IAAI,CAACC,KAAK,EAAE;IAC1BC,OAAO,CAACC,IAAI,CACV,kFACF,CAAC;EACH;EAEA,IAAIC,cAAc,GAAGN,UAAU,IAAID,UAAU;EAC7CO,cAAc,GAAGA,cAAc,IAAI,KAAK;EAExC,IAAIC,OAAO,GAAGX,KAAK,CAACY,aAAa,KAAKV,KAAK;EAE3C,IAAIW,OAAO,GAAGA,CAAA,KAAM;IAClBb,KAAK,CAACc,gBAAgB,CAACZ,KAAK,CAAC;EAC/B,CAAC;EAED,IAAI;IAAEa;EAAW,CAAC,GAAGnB,QAAQ,CAAC;IAC5BQ,UAAU,EAAEM,cAAc;IAC1BG;EACF,CAAC,CAAC;EAEF,OAAO;IACLG,UAAU,EAAErB,UAAU,CAACI,KAAK,EAAE;MAC5B,GAAGgB,UAAU;MACbJ,OAAO;MACP,UAAU,EAAED,cAAc;MAC1BR,KAAK;MACL,YAAY,EAAEK,KAAK;MACnB,MAAM,EAAE,OAAO;MACf,eAAe,EAAEG,cAAc;MAC/B,cAAc,EAAEC;IAClB,CAAC;EACH,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  import { getLabel } from '@react-native-aria/utils';
2
-
3
2
  /**
4
3
  * Provides the behavior and accessibility implementation for a radio group component.
5
4
  * Radio groups allow users to select a single item from a list of mutually exclusive options.
@@ -1 +1 @@
1
- {"version":3,"sources":["useRadioGroup.ts"],"names":["getLabel","useRadioGroup","props","_state","isDisabled","radioGroupProps","labelProps"],"mappings":"AAEA,SAASA,QAAT,QAAyB,0BAAzB;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAT,CACLC,KADK,EAELC,MAFK,EAGW;AAChB,MAAI;AAAEC,IAAAA;AAAF,MAAiBF,KAArB;AAEA,SAAO;AACLG,IAAAA,eAAe,EAAE;AACf,oBAAcL,QAAQ,CAACE,KAAD,CADP;AAEf,cAAQ,YAFO;AAGf,uBAAiBE;AAHF,KADZ;AAMLE,IAAAA,UAAU,EAAE;AANP,GAAP;AAQD","sourcesContent":["import type { AriaRadioGroupProps } from '@react-types/radio';\nimport type { RadioGroupState } from '@react-stately/radio';\nimport { getLabel } from '@react-native-aria/utils';\n\nexport interface RNAriaRadioGroupProps extends AriaRadioGroupProps {\n children?: React.ReactNode;\n}\n\nexport interface RadioGroupAria {\n /** Props for the radio group wrapper element. */\n radioGroupProps: any;\n /** Props for the radio group's visible label (if any). */\n labelProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n * @param props - Props for the radio group.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n */\nexport function useRadioGroup(\n props: RNAriaRadioGroupProps,\n _state: RadioGroupState\n): RadioGroupAria {\n let { isDisabled } = props;\n\n return {\n radioGroupProps: {\n 'aria-label': getLabel(props),\n 'role': 'radiogroup',\n 'aria-disabled': isDisabled,\n },\n labelProps: {},\n };\n}\n"]}
1
+ {"version":3,"names":["getLabel","useRadioGroup","props","_state","isDisabled","radioGroupProps","labelProps"],"sourceRoot":"../../src","sources":["useRadioGroup.ts"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,0BAA0B;AAanD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAC3BC,KAA4B,EAC5BC,MAAuB,EACP;EAChB,IAAI;IAAEC;EAAW,CAAC,GAAGF,KAAK;EAE1B,OAAO;IACLG,eAAe,EAAE;MACf,YAAY,EAAEL,QAAQ,CAACE,KAAK,CAAC;MAC7B,MAAM,EAAE,YAAY;MACpB,eAAe,EAAEE;IACnB,CAAC;IACDE,UAAU,EAAE,CAAC;EACf,CAAC;AACH"}
@@ -1,7 +1,6 @@
1
1
  import { useRadioGroup as useRadioGroupWeb } from '@react-aria/radio';
2
2
  import { mergeProps } from '@react-aria/utils';
3
3
  import { mapDomPropsToRN } from '@react-native-aria/utils';
4
-
5
4
  /**
6
5
  * Provides the behavior and accessibility implementation for a radio group component.
7
6
  * Radio groups allow users to select a single item from a list of mutually exclusive options.
@@ -1 +1 @@
1
- {"version":3,"sources":["useRadioGroup.web.ts"],"names":["useRadioGroup","useRadioGroupWeb","mergeProps","mapDomPropsToRN","props","state","params","newParams","radioGroupProps","labelProps"],"mappings":"AAAA,SAASA,aAAa,IAAIC,gBAA1B,QAAkD,mBAAlD;AAEA,SAASC,UAAT,QAA2B,mBAA3B;AAEA,SAASC,eAAT,QAAgC,0BAAhC;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASH,aAAT,CACLI,KADK,EAELC,KAFK,EAGW;AAChB,QAAMC,MAAM,GAAGL,gBAAgB,CAACG,KAAD,EAAQC,KAAR,CAA/B;AAEA,QAAME,SAAS,GAAG;AAChBC,IAAAA,eAAe,EAAEN,UAAU,CACzBI,MAAM,CAACE,eADkB,EAEzBL,eAAe,CAACG,MAAM,CAACE,eAAR,CAFU,CADX;AAKhBC,IAAAA,UAAU,EAAEP,UAAU,CACpBI,MAAM,CAACG,UADa,EAEpBN,eAAe,CAACG,MAAM,CAACG,UAAR,CAFK;AALN,GAAlB;AAWA,SAAOF,SAAP;AACD","sourcesContent":["import { useRadioGroup as useRadioGroupWeb } from '@react-aria/radio';\nimport { RadioGroupState } from '@react-stately/radio';\nimport { mergeProps } from '@react-aria/utils';\nimport { AriaRadioGroupProps } from '@react-types/radio';\nimport { mapDomPropsToRN } from '@react-native-aria/utils';\n\ninterface RadioGroupAria {\n /** Props for the radio group wrapper element. */\n radioGroupProps: any;\n /** Props for the radio group's visible label (if any). */\n labelProps: any;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n * @param props - Props for the radio group.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n */\nexport function useRadioGroup(\n props: AriaRadioGroupProps,\n state: RadioGroupState\n): RadioGroupAria {\n const params = useRadioGroupWeb(props, state);\n\n const newParams = {\n radioGroupProps: mergeProps(\n params.radioGroupProps,\n mapDomPropsToRN(params.radioGroupProps)\n ),\n labelProps: mergeProps(\n params.labelProps,\n mapDomPropsToRN(params.labelProps)\n ),\n };\n\n return newParams;\n}\n"]}
1
+ {"version":3,"names":["useRadioGroup","useRadioGroupWeb","mergeProps","mapDomPropsToRN","props","state","params","newParams","radioGroupProps","labelProps"],"sourceRoot":"../../src","sources":["useRadioGroup.web.ts"],"mappings":"AAAA,SAASA,aAAa,IAAIC,gBAAgB,QAAQ,mBAAmB;AAErE,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,SAASC,eAAe,QAAQ,0BAA0B;AAS1D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASH,aAAaA,CAC3BI,KAA0B,EAC1BC,KAAsB,EACN;EAChB,MAAMC,MAAM,GAAGL,gBAAgB,CAACG,KAAK,EAAEC,KAAK,CAAC;EAE7C,MAAME,SAAS,GAAG;IAChBC,eAAe,EAAEN,UAAU,CACzBI,MAAM,CAACE,eAAe,EACtBL,eAAe,CAACG,MAAM,CAACE,eAAe,CACxC,CAAC;IACDC,UAAU,EAAEP,UAAU,CACpBI,MAAM,CAACG,UAAU,EACjBN,eAAe,CAACG,MAAM,CAACG,UAAU,CACnC;EACF,CAAC;EAED,OAAOF,SAAS;AAClB"}
@@ -1,2 +1,3 @@
1
1
  export * from './useRadio';
2
2
  export * from './useRadioGroup';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { useRadio } from "@react-aria/radio";
2
2
  export { useRadioGroup } from "./useRadioGroup.web";
3
+ //# sourceMappingURL=index.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -24,3 +24,4 @@ export interface RadioAria extends AccessibilityProps {
24
24
  * @param ref - Ref to the HTML input element.
25
25
  */
26
26
  export declare function useRadio(props: RadioAriaProps, state: RadioGroupState, _ref: RefObject<HTMLElement>): RadioAria;
27
+ //# sourceMappingURL=useRadio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRadio.d.ts","sourceRoot":"","sources":["../../src/useRadio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,WAAW,cAAe,SAAQ,cAAc,EAAE,kBAAkB;IACxE;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD,0DAA0D;IAC1D,UAAU,EAAE,GAAG,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC,GAC3B,SAAS,CAsCX"}
@@ -17,3 +17,4 @@ export interface RadioGroupAria {
17
17
  * @param state - State for the radio group, as returned by `useRadioGroupState`.
18
18
  */
19
19
  export declare function useRadioGroup(props: RNAriaRadioGroupProps, _state: RadioGroupState): RadioGroupAria;
20
+ //# sourceMappingURL=useRadioGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRadioGroup.d.ts","sourceRoot":"","sources":["../../src/useRadioGroup.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,iDAAiD;IACjD,eAAe,EAAE,GAAG,CAAC;IACrB,0DAA0D;IAC1D,UAAU,EAAE,GAAG,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,qBAAqB,EAC5B,MAAM,EAAE,eAAe,GACtB,cAAc,CAWhB"}
@@ -14,3 +14,4 @@ interface RadioGroupAria {
14
14
  */
15
15
  export declare function useRadioGroup(props: AriaRadioGroupProps, state: RadioGroupState): RadioGroupAria;
16
16
  export {};
17
+ //# sourceMappingURL=useRadioGroup.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRadioGroup.web.d.ts","sourceRoot":"","sources":["../../src/useRadioGroup.web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,UAAU,cAAc;IACtB,iDAAiD;IACjD,eAAe,EAAE,GAAG,CAAC;IACrB,0DAA0D;IAC1D,UAAU,EAAE,GAAG,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,eAAe,GACrB,cAAc,CAehB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-aria/radio",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "mono repo setup with bob",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -24,8 +24,8 @@
24
24
  "dependencies": {
25
25
  "@react-aria/radio": "^3.1.2",
26
26
  "@react-aria/utils": "^3.6.0",
27
- "@react-native-aria/interactions": "^0.2.11",
28
- "@react-native-aria/utils": "^0.2.10",
27
+ "@react-native-aria/interactions": "0.2.13",
28
+ "@react-native-aria/utils": "0.2.11",
29
29
  "@react-stately/radio": "^3.2.1",
30
30
  "@react-types/radio": "^3.1.1"
31
31
  },
@@ -33,6 +33,7 @@
33
33
  "test": "jest",
34
34
  "typescript": "tsc --noEmit",
35
35
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
36
+ "build": "bob build",
36
37
  "prepare": "bob build",
37
38
  "release": "release-it",
38
39
  "example": "yarn --cwd example",
@@ -44,13 +45,16 @@
44
45
  "ios",
45
46
  "android"
46
47
  ],
47
- "repository": "https://github.com/intergalacticspacehighway/react-native-bob-mono",
48
+ "homepage": "https://github.com/gluestack/gluestack-ui/tree/main/packages/react-native-aria/radio#readme",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/gluestack/gluestack-ui.git"
52
+ },
48
53
  "author": "nishan <nishanbende@gmail.com> (https://github.com/intergalacticspacehighway)",
49
54
  "license": "MIT",
50
55
  "bugs": {
51
56
  "url": "https://github.com/intergalacticspacehighway/react-native-bob-mono/issues"
52
57
  },
53
- "homepage": "https://github.com/intergalacticspacehighway/react-native-bob-mono#readme",
54
58
  "publishConfig": {
55
59
  "registry": "https://registry.npmjs.org/"
56
60
  },