@react-native-aria/disclosure 0.2.4 → 0.2.6-alpha.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.
@@ -9,13 +9,11 @@ var _utils = require("@react-aria/utils");
9
9
 
10
10
  function useDisclosureButton(props, state) {
11
11
  const onPress = state.toggle;
12
- const accessibilityState = props.accessibilityState || {};
13
- accessibilityState.expanded = state.isSelected;
14
12
  return {
15
13
  buttonProps: (0, _utils.mergeProps)(props, {
16
14
  onPress,
17
- accessibilityState,
18
- accessibilityRole: 'button'
15
+ 'aria-expanded': state.isSelected,
16
+ 'role': 'button'
19
17
  })
20
18
  };
21
19
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useDisclosureButton.ts"],"names":["useDisclosureButton","props","state","onPress","toggle","accessibilityState","expanded","isSelected","buttonProps","accessibilityRole"],"mappings":";;;;;;;AACA;;AAGO,SAASA,mBAAT,CACLC,KADK,EAELC,KAFK,EAGL;AACA,QAAMC,OAAO,GAAGD,KAAK,CAACE,MAAtB;AAEA,QAAMC,kBAAkB,GAAGJ,KAAK,CAACI,kBAAN,IAA4B,EAAvD;AAEAA,EAAAA,kBAAkB,CAACC,QAAnB,GAA8BJ,KAAK,CAACK,UAApC;AAEA,SAAO;AACLC,IAAAA,WAAW,EAAE,uBAAWP,KAAX,EAAkB;AAC7BE,MAAAA,OAD6B;AAE7BE,MAAAA,kBAF6B;AAG7BI,MAAAA,iBAAiB,EAAE;AAHU,KAAlB;AADR,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { mergeProps } from '@react-aria/utils';\nimport { PressableProps } from 'react-native';\n\nexport function useDisclosureButton(\n props: Partial<PressableProps>,\n state: ToggleState\n) {\n const onPress = state.toggle;\n\n const accessibilityState = props.accessibilityState || {};\n\n accessibilityState.expanded = state.isSelected;\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n accessibilityState,\n accessibilityRole: 'button',\n }),\n };\n}\n"]}
1
+ {"version":3,"sources":["useDisclosureButton.ts"],"names":["useDisclosureButton","props","state","onPress","toggle","buttonProps","isSelected"],"mappings":";;;;;;;AACA;;AAGO,SAASA,mBAAT,CACLC,KADK,EAELC,KAFK,EAGL;AACA,QAAMC,OAAO,GAAGD,KAAK,CAACE,MAAtB;AAEA,SAAO;AACLC,IAAAA,WAAW,EAAE,uBAAWJ,KAAX,EAAkB;AAC7BE,MAAAA,OAD6B;AAE7B,uBAAiBD,KAAK,CAACI,UAFM;AAG7B,cAAQ;AAHqB,KAAlB;AADR,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { mergeProps } from '@react-aria/utils';\nimport { PressableProps } from 'react-native';\n\nexport function useDisclosureButton(\n props: Partial<PressableProps>,\n state: ToggleState\n) {\n const onPress = state.toggle;\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n 'aria-expanded': state.isSelected,\n 'role': 'button',\n }),\n };\n}\n"]}
@@ -25,7 +25,7 @@ function useDisclosureButton(props, state) {
25
25
  buttonProps: (0, _utils.mergeProps)(props, {
26
26
  onPress,
27
27
  ...ariaProps,
28
- accessibilityRole: 'button'
28
+ role: 'button'
29
29
  })
30
30
  };
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useDisclosureButton.web.ts"],"names":["useDisclosureButton","props","state","id","disclosureIds","set","onPress","toggle","ariaProps","isSelected","undefined","buttonProps","accessibilityRole"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;AAEO,SAASA,mBAAT,CAA6BC,KAA7B,EAAoDC,KAApD,EAAwE;AAC7E,QAAMC,EAAE,GAAG,mBAAX;;AAEAC,wBAAcC,GAAd,CAAkBH,KAAlB,EAAyBC,EAAzB;;AAEA,QAAMG,OAAO,GAAGJ,KAAK,CAACK,MAAtB;AAEA,QAAMC,SAAS,GAAG,6BAAgB;AAChC,qBAAiBN,KAAK,CAACO,UADS;AAEhC,qBAAiBP,KAAK,CAACO,UAAN,GAAmBN,EAAnB,GAAwBO;AAFT,GAAhB,CAAlB;AAKA,SAAO;AACLC,IAAAA,WAAW,EAAE,uBAAWV,KAAX,EAAkB;AAC7BK,MAAAA,OAD6B;AAE7B,SAAGE,SAF0B;AAG7BI,MAAAA,iBAAiB,EAAE;AAHU,KAAlB;AADR,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { useId, mergeProps } from '@react-aria/utils';\nimport { mapDomPropsToRN } from '@react-native-aria/utils';\nimport { PressableProps } from 'react-native';\nimport { disclosureIds } from './utils';\n\nexport function useDisclosureButton(props: PressableProps, state: ToggleState) {\n const id = useId();\n\n disclosureIds.set(state, id);\n\n const onPress = state.toggle;\n\n const ariaProps = mapDomPropsToRN({\n 'aria-expanded': state.isSelected,\n 'aria-controls': state.isSelected ? id : undefined,\n });\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n ...ariaProps,\n accessibilityRole: 'button',\n }),\n };\n}\n"]}
1
+ {"version":3,"sources":["useDisclosureButton.web.ts"],"names":["useDisclosureButton","props","state","id","disclosureIds","set","onPress","toggle","ariaProps","isSelected","undefined","buttonProps","role"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;AAEO,SAASA,mBAAT,CAA6BC,KAA7B,EAAoDC,KAApD,EAAwE;AAC7E,QAAMC,EAAE,GAAG,mBAAX;;AAEAC,wBAAcC,GAAd,CAAkBH,KAAlB,EAAyBC,EAAzB;;AAEA,QAAMG,OAAO,GAAGJ,KAAK,CAACK,MAAtB;AAEA,QAAMC,SAAS,GAAG,6BAAgB;AAChC,qBAAiBN,KAAK,CAACO,UADS;AAEhC,qBAAiBP,KAAK,CAACO,UAAN,GAAmBN,EAAnB,GAAwBO;AAFT,GAAhB,CAAlB;AAKA,SAAO;AACLC,IAAAA,WAAW,EAAE,uBAAWV,KAAX,EAAkB;AAC7BK,MAAAA,OAD6B;AAE7B,SAAGE,SAF0B;AAG7BI,MAAAA,IAAI,EAAE;AAHuB,KAAlB;AADR,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { useId, mergeProps } from '@react-aria/utils';\nimport { mapDomPropsToRN } from '@react-native-aria/utils';\nimport { PressableProps } from 'react-native';\nimport { disclosureIds } from './utils';\n\nexport function useDisclosureButton(props: PressableProps, state: ToggleState) {\n const id = useId();\n\n disclosureIds.set(state, id);\n\n const onPress = state.toggle;\n\n const ariaProps = mapDomPropsToRN({\n 'aria-expanded': state.isSelected,\n 'aria-controls': state.isSelected ? id : undefined,\n });\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n ...ariaProps,\n role: 'button',\n }),\n };\n}\n"]}
@@ -1,13 +1,11 @@
1
1
  import { mergeProps } from '@react-aria/utils';
2
2
  export function useDisclosureButton(props, state) {
3
3
  const onPress = state.toggle;
4
- const accessibilityState = props.accessibilityState || {};
5
- accessibilityState.expanded = state.isSelected;
6
4
  return {
7
5
  buttonProps: mergeProps(props, {
8
6
  onPress,
9
- accessibilityState,
10
- accessibilityRole: 'button'
7
+ 'aria-expanded': state.isSelected,
8
+ 'role': 'button'
11
9
  })
12
10
  };
13
11
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useDisclosureButton.ts"],"names":["mergeProps","useDisclosureButton","props","state","onPress","toggle","accessibilityState","expanded","isSelected","buttonProps","accessibilityRole"],"mappings":"AACA,SAASA,UAAT,QAA2B,mBAA3B;AAGA,OAAO,SAASC,mBAAT,CACLC,KADK,EAELC,KAFK,EAGL;AACA,QAAMC,OAAO,GAAGD,KAAK,CAACE,MAAtB;AAEA,QAAMC,kBAAkB,GAAGJ,KAAK,CAACI,kBAAN,IAA4B,EAAvD;AAEAA,EAAAA,kBAAkB,CAACC,QAAnB,GAA8BJ,KAAK,CAACK,UAApC;AAEA,SAAO;AACLC,IAAAA,WAAW,EAAET,UAAU,CAACE,KAAD,EAAQ;AAC7BE,MAAAA,OAD6B;AAE7BE,MAAAA,kBAF6B;AAG7BI,MAAAA,iBAAiB,EAAE;AAHU,KAAR;AADlB,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { mergeProps } from '@react-aria/utils';\nimport { PressableProps } from 'react-native';\n\nexport function useDisclosureButton(\n props: Partial<PressableProps>,\n state: ToggleState\n) {\n const onPress = state.toggle;\n\n const accessibilityState = props.accessibilityState || {};\n\n accessibilityState.expanded = state.isSelected;\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n accessibilityState,\n accessibilityRole: 'button',\n }),\n };\n}\n"]}
1
+ {"version":3,"sources":["useDisclosureButton.ts"],"names":["mergeProps","useDisclosureButton","props","state","onPress","toggle","buttonProps","isSelected"],"mappings":"AACA,SAASA,UAAT,QAA2B,mBAA3B;AAGA,OAAO,SAASC,mBAAT,CACLC,KADK,EAELC,KAFK,EAGL;AACA,QAAMC,OAAO,GAAGD,KAAK,CAACE,MAAtB;AAEA,SAAO;AACLC,IAAAA,WAAW,EAAEN,UAAU,CAACE,KAAD,EAAQ;AAC7BE,MAAAA,OAD6B;AAE7B,uBAAiBD,KAAK,CAACI,UAFM;AAG7B,cAAQ;AAHqB,KAAR;AADlB,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { mergeProps } from '@react-aria/utils';\nimport { PressableProps } from 'react-native';\n\nexport function useDisclosureButton(\n props: Partial<PressableProps>,\n state: ToggleState\n) {\n const onPress = state.toggle;\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n 'aria-expanded': state.isSelected,\n 'role': 'button',\n }),\n };\n}\n"]}
@@ -13,7 +13,7 @@ export function useDisclosureButton(props, state) {
13
13
  buttonProps: mergeProps(props, {
14
14
  onPress,
15
15
  ...ariaProps,
16
- accessibilityRole: 'button'
16
+ role: 'button'
17
17
  })
18
18
  };
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useDisclosureButton.web.ts"],"names":["useId","mergeProps","mapDomPropsToRN","disclosureIds","useDisclosureButton","props","state","id","set","onPress","toggle","ariaProps","isSelected","undefined","buttonProps","accessibilityRole"],"mappings":"AACA,SAASA,KAAT,EAAgBC,UAAhB,QAAkC,mBAAlC;AACA,SAASC,eAAT,QAAgC,0BAAhC;AAEA,SAASC,aAAT,QAA8B,SAA9B;AAEA,OAAO,SAASC,mBAAT,CAA6BC,KAA7B,EAAoDC,KAApD,EAAwE;AAC7E,QAAMC,EAAE,GAAGP,KAAK,EAAhB;AAEAG,EAAAA,aAAa,CAACK,GAAd,CAAkBF,KAAlB,EAAyBC,EAAzB;AAEA,QAAME,OAAO,GAAGH,KAAK,CAACI,MAAtB;AAEA,QAAMC,SAAS,GAAGT,eAAe,CAAC;AAChC,qBAAiBI,KAAK,CAACM,UADS;AAEhC,qBAAiBN,KAAK,CAACM,UAAN,GAAmBL,EAAnB,GAAwBM;AAFT,GAAD,CAAjC;AAKA,SAAO;AACLC,IAAAA,WAAW,EAAEb,UAAU,CAACI,KAAD,EAAQ;AAC7BI,MAAAA,OAD6B;AAE7B,SAAGE,SAF0B;AAG7BI,MAAAA,iBAAiB,EAAE;AAHU,KAAR;AADlB,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { useId, mergeProps } from '@react-aria/utils';\nimport { mapDomPropsToRN } from '@react-native-aria/utils';\nimport { PressableProps } from 'react-native';\nimport { disclosureIds } from './utils';\n\nexport function useDisclosureButton(props: PressableProps, state: ToggleState) {\n const id = useId();\n\n disclosureIds.set(state, id);\n\n const onPress = state.toggle;\n\n const ariaProps = mapDomPropsToRN({\n 'aria-expanded': state.isSelected,\n 'aria-controls': state.isSelected ? id : undefined,\n });\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n ...ariaProps,\n accessibilityRole: 'button',\n }),\n };\n}\n"]}
1
+ {"version":3,"sources":["useDisclosureButton.web.ts"],"names":["useId","mergeProps","mapDomPropsToRN","disclosureIds","useDisclosureButton","props","state","id","set","onPress","toggle","ariaProps","isSelected","undefined","buttonProps","role"],"mappings":"AACA,SAASA,KAAT,EAAgBC,UAAhB,QAAkC,mBAAlC;AACA,SAASC,eAAT,QAAgC,0BAAhC;AAEA,SAASC,aAAT,QAA8B,SAA9B;AAEA,OAAO,SAASC,mBAAT,CAA6BC,KAA7B,EAAoDC,KAApD,EAAwE;AAC7E,QAAMC,EAAE,GAAGP,KAAK,EAAhB;AAEAG,EAAAA,aAAa,CAACK,GAAd,CAAkBF,KAAlB,EAAyBC,EAAzB;AAEA,QAAME,OAAO,GAAGH,KAAK,CAACI,MAAtB;AAEA,QAAMC,SAAS,GAAGT,eAAe,CAAC;AAChC,qBAAiBI,KAAK,CAACM,UADS;AAEhC,qBAAiBN,KAAK,CAACM,UAAN,GAAmBL,EAAnB,GAAwBM;AAFT,GAAD,CAAjC;AAKA,SAAO;AACLC,IAAAA,WAAW,EAAEb,UAAU,CAACI,KAAD,EAAQ;AAC7BI,MAAAA,OAD6B;AAE7B,SAAGE,SAF0B;AAG7BI,MAAAA,IAAI,EAAE;AAHuB,KAAR;AADlB,GAAP;AAOD","sourcesContent":["import { ToggleState } from '@react-stately/toggle';\nimport { useId, mergeProps } from '@react-aria/utils';\nimport { mapDomPropsToRN } from '@react-native-aria/utils';\nimport { PressableProps } from 'react-native';\nimport { disclosureIds } from './utils';\n\nexport function useDisclosureButton(props: PressableProps, state: ToggleState) {\n const id = useId();\n\n disclosureIds.set(state, id);\n\n const onPress = state.toggle;\n\n const ariaProps = mapDomPropsToRN({\n 'aria-expanded': state.isSelected,\n 'aria-controls': state.isSelected ? id : undefined,\n });\n\n return {\n buttonProps: mergeProps(props, {\n onPress,\n ...ariaProps,\n role: 'button',\n }),\n };\n}\n"]}
@@ -2,6 +2,6 @@ import { ToggleState } from '@react-stately/toggle';
2
2
  import { ViewProps } from 'react-native';
3
3
  export declare function useDisclosure(props: ViewProps, state: ToggleState): {
4
4
  disclosureProps: ViewProps & {
5
- nativeID: string | undefined;
5
+ nativeID: string;
6
6
  };
7
7
  };
@@ -3,7 +3,7 @@ import { PressableProps } from 'react-native';
3
3
  export declare function useDisclosureButton(props: Partial<PressableProps>, state: ToggleState): {
4
4
  buttonProps: Partial<PressableProps> & {
5
5
  onPress: () => void;
6
- accessibilityState: import("react-native").AccessibilityState;
7
- accessibilityRole: string;
6
+ 'aria-expanded': boolean;
7
+ role: string;
8
8
  };
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-aria/disclosure",
3
- "version": "0.2.4",
3
+ "version": "0.2.6-alpha.0",
4
4
  "description": "mono repo setup with bob",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -48,13 +48,13 @@
48
48
  "registry": "https://registry.npmjs.org/"
49
49
  },
50
50
  "peerDependencies": {
51
+ "@react-stately/toggle": "*",
51
52
  "react": "*",
52
- "react-native": "*",
53
- "@react-stately/toggle":"*"
53
+ "react-native": "*"
54
54
  },
55
55
  "dependencies": {
56
- "@react-aria/utils":"^3.6.0",
57
- "@react-native-aria/utils":"^0.2.4"
56
+ "@react-aria/utils": "^3.6.0",
57
+ "@react-native-aria/utils": "^0.2.6"
58
58
  },
59
59
  "jest": {
60
60
  "preset": "react-native",
@@ -8,15 +8,11 @@ export function useDisclosureButton(
8
8
  ) {
9
9
  const onPress = state.toggle;
10
10
 
11
- const accessibilityState = props.accessibilityState || {};
12
-
13
- accessibilityState.expanded = state.isSelected;
14
-
15
11
  return {
16
12
  buttonProps: mergeProps(props, {
17
13
  onPress,
18
- accessibilityState,
19
- accessibilityRole: 'button',
14
+ 'aria-expanded': state.isSelected,
15
+ 'role': 'button',
20
16
  }),
21
17
  };
22
18
  }
@@ -20,7 +20,7 @@ export function useDisclosureButton(props: PressableProps, state: ToggleState) {
20
20
  buttonProps: mergeProps(props, {
21
21
  onPress,
22
22
  ...ariaProps,
23
- accessibilityRole: 'button',
23
+ role: 'button',
24
24
  }),
25
25
  };
26
26
  }
package/.DS_Store DELETED
Binary file
package/src/.DS_Store DELETED
Binary file