@react-native-aria/button 0.2.5 → 0.2.6

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,8 @@
1
+ # @react-native-aria/button
2
+
3
+ ## 0.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @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 _useButton = require("./useButton");
8
-
9
7
  Object.keys(_useButton).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _useButton[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_useButton).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _useToggleButton = require("./useToggleButton");
21
-
22
18
  Object.keys(_useToggleButton).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _useToggleButton[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 './useButton';\nexport * from './useToggleButton';\n"]}
1
+ {"version":3,"names":["_useButton","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useToggleButton"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,gBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,gBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,gBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,gBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _useButton = require("./useButton");
8
-
9
7
  Object.keys(_useButton).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _useButton[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_useButton).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _useToggleButton = require("./useToggleButton.web");
21
-
22
18
  Object.keys(_useToggleButton).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _useToggleButton[key]) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["index.web.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 \"./useButton\";\nexport * from \"./useToggleButton.web\";\n"]}
1
+ {"version":3,"names":["_useButton","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useToggleButton"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,gBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,gBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,gBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,gBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
@@ -4,17 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useButton = useButton;
7
-
8
7
  var _interactions = require("@react-native-aria/interactions");
9
-
10
8
  var _utils = require("@react-aria/utils");
11
-
12
9
  function useButton(props) {
13
10
  let {
14
11
  isDisabled,
12
+ // @ts-ignore
15
13
  onPress,
14
+ // @ts-ignore
16
15
  onPressStart,
16
+ // @ts-ignore
17
17
  onPressEnd,
18
+ // @ts-ignore
18
19
  onPressChange,
19
20
  ...rest
20
21
  } = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["useButton.ts"],"names":["useButton","props","isDisabled","onPress","onPressStart","onPressEnd","onPressChange","rest","pressProps","isPressed","mergedProps","buttonProps"],"mappings":";;;;;;;AACA;;AAEA;;AAkBO,SAASA,SAAT,CAAmBC,KAAnB,EAAyD;AAC9D,MAAI;AACFC,IAAAA,UADE;AAEFC,IAAAA,OAFE;AAGFC,IAAAA,YAHE;AAIFC,IAAAA,UAJE;AAKFC,IAAAA,aALE;AAMF,OAAGC;AAND,MAOAN,KAPJ;AASA,MAAI;AAAEO,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA4B,4BAAS;AACvCL,IAAAA,YADuC;AAEvCC,IAAAA,UAFuC;AAGvCC,IAAAA,aAHuC;AAIvCH,IAAAA,OAJuC;AAKvCD,IAAAA;AALuC,GAAT,CAAhC;AAQA,QAAMQ,WAAW,GAAG,uBAAWF,UAAX,EAAuBD,IAAvB,EAA6B;AAC/C,qBAAiBL,UAD8B;AAE/C,YAAQ,QAFuC;AAG/C,gBAAYA;AAHmC,GAA7B,CAApB;AAMA,SAAO;AACLO,IAAAA,SADK;AAELE,IAAAA,WAAW,EAAED;AAFR,GAAP;AAID","sourcesContent":["import { ReactNode } from 'react';\nimport { PressEvents, usePress } from '@react-native-aria/interactions';\nimport { AccessibilityProps, PressableProps } from 'react-native';\nimport { mergeProps } from '@react-aria/utils';\n\ninterface ButtonProps extends PressEvents {\n /** Whether the button is disabled. */\n isDisabled?: boolean;\n /** The content to display in the button. */\n children?: ReactNode;\n}\n\nexport interface RNAriaButtonProps extends AccessibilityProps, ButtonProps {}\n\nexport interface ButtonAria {\n /** Props for the button element. */\n buttonProps: PressableProps;\n /** Whether the button is currently pressed. */\n isPressed: boolean;\n}\n\nexport function useButton(props: RNAriaButtonProps): ButtonAria {\n let {\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n ...rest\n } = props;\n\n let { pressProps, isPressed } = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n isDisabled,\n });\n\n const mergedProps = mergeProps(pressProps, rest, {\n 'aria-disabled': isDisabled,\n 'role': 'button',\n 'disabled': isDisabled,\n });\n\n return {\n isPressed,\n buttonProps: mergedProps,\n };\n}\n"]}
1
+ {"version":3,"names":["_interactions","require","_utils","useButton","props","isDisabled","onPress","onPressStart","onPressEnd","onPressChange","rest","pressProps","isPressed","usePress","mergedProps","mergeProps","buttonProps"],"sourceRoot":"../../src","sources":["useButton.ts"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAkBO,SAASE,SAASA,CAACC,KAAwB,EAAc;EAC9D,IAAI;IACFC,UAAU;IACV;IACAC,OAAO;IACP;IACAC,YAAY;IACZ;IACAC,UAAU;IACV;IACAC,aAAa;IACb,GAAGC;EACL,CAAC,GAAGN,KAAK;EAET,IAAI;IAAEO,UAAU;IAAEC;EAAU,CAAC,GAAG,IAAAC,sBAAQ,EAAC;IACvCN,YAAY;IACZC,UAAU;IACVC,aAAa;IACbH,OAAO;IACPD;EACF,CAAC,CAAC;EAEF,MAAMS,WAAW,GAAG,IAAAC,iBAAU,EAACJ,UAAU,EAAED,IAAI,EAAE;IAC/C,eAAe,EAAEL,UAAU;IAC3B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAEA;EACd,CAAC,CAAC;EAEF,OAAO;IACLO,SAAS;IACTI,WAAW,EAAEF;EACf,CAAC;AACH"}
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useToggleButton = useToggleButton;
7
-
8
7
  var _useButton = require("./useButton");
9
-
10
8
  var _utils = require("@react-aria/utils");
9
+ // @ts-nocheck
11
10
 
12
11
  function useToggleButton(props, state) {
13
12
  const {
@@ -16,7 +15,8 @@ function useToggleButton(props, state) {
16
15
  const {
17
16
  isPressed,
18
17
  buttonProps
19
- } = (0, _useButton.useButton)({ ...props,
18
+ } = (0, _useButton.useButton)({
19
+ ...props,
20
20
  onPress: (0, _utils.chain)(state.toggle, props.onPress)
21
21
  });
22
22
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["useToggleButton.ts"],"names":["useToggleButton","props","state","isSelected","isPressed","buttonProps","onPress","toggle"],"mappings":";;;;;;;AAAA;;AAEA;;AAkBO,SAASA,eAAT,CACLC,KADK,EAELC,KAFK,EAGO;AACZ,QAAM;AAAEC,IAAAA;AAAF,MAAiBD,KAAvB;AACA,QAAM;AAAEE,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA6B,0BAAU,EAC3C,GAAGJ,KADwC;AAE3CK,IAAAA,OAAO,EAAE,kBAAMJ,KAAK,CAACK,MAAZ,EAAoBN,KAAK,CAACK,OAA1B;AAFkC,GAAV,CAAnC;AAKA,SAAO;AACLF,IAAAA,SADK;AAELC,IAAAA,WAAW,EAAE,uBAAWA,WAAX,EAAwB;AACnC,uBAAiBF;AADkB,KAAxB;AAFR,GAAP;AAMD","sourcesContent":["import { ButtonAria, useButton } from './useButton';\nimport type { ToggleState } from '@react-stately/toggle';\nimport { chain, mergeProps } from '@react-aria/utils';\nimport type { PressEvents } from '@react-native-aria/interactions';\nimport type { PressableProps } from 'react-native';\n\nexport type AriaButtonProps = PressableProps &\n PressEvents & {\n isDisabled: boolean;\n };\n\nexport interface AriaToggleButtonProps extends AriaButtonProps {\n /** Whether the element should be selected (controlled). */\n isSelected?: boolean;\n /** Whether the element should be selected (uncontrolled). */\n defaultSelected?: boolean;\n /** Handler that is called when the element's selection state changes. */\n onChange?: (isSelected: boolean) => void;\n}\n\nexport function useToggleButton(\n props: AriaToggleButtonProps,\n state: ToggleState\n): ButtonAria {\n const { isSelected } = state;\n const { isPressed, buttonProps } = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress),\n });\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-selected': isSelected,\n }),\n };\n}\n"]}
1
+ {"version":3,"names":["_useButton","require","_utils","useToggleButton","props","state","isSelected","isPressed","buttonProps","useButton","onPress","chain","toggle","mergeProps"],"sourceRoot":"../../src","sources":["useToggleButton.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAHA;;AAqBO,SAASE,eAAeA,CAC7BC,KAA4B,EAC5BC,KAAkB,EACN;EACZ,MAAM;IAAEC;EAAW,CAAC,GAAGD,KAAK;EAC5B,MAAM;IAAEE,SAAS;IAAEC;EAAY,CAAC,GAAG,IAAAC,oBAAS,EAAC;IAC3C,GAAGL,KAAK;IACRM,OAAO,EAAE,IAAAC,YAAK,EAACN,KAAK,CAACO,MAAM,EAAER,KAAK,CAACM,OAAO;EAC5C,CAAC,CAAC;EAEF,OAAO;IACLH,SAAS;IACTC,WAAW,EAAE,IAAAK,iBAAU,EAACL,WAAW,EAAE;MACnC,eAAe,EAAEF;IACnB,CAAC;EACH,CAAC;AACH"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useToggleButton = useToggleButton;
7
-
8
7
  var _useButton = require("./useButton");
9
-
10
8
  var _utils = require("@react-aria/utils");
11
-
12
9
  /*
13
10
  * Copyright 2020 Adobe. All rights reserved.
14
11
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -33,7 +30,11 @@ function useToggleButton(props, state) {
33
30
  const {
34
31
  isPressed,
35
32
  buttonProps
36
- } = (0, _useButton.useButton)({ ...props,
33
+ } = (0, _useButton.useButton)(
34
+ // @ts-ignore
35
+ {
36
+ ...props,
37
+ // @ts-ignore
37
38
  onPress: (0, _utils.chain)(state.toggle, props.onPress)
38
39
  });
39
40
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["useToggleButton.web.ts"],"names":["useToggleButton","props","state","isSelected","isPressed","buttonProps","onPress","toggle"],"mappings":";;;;;;;AAcA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACO,SAASA,eAAT,CACLC,KADK,EAELC,KAFK,EAGA;AACL;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiBD,KAAvB;AACA,QAAM;AAAEE,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA6B,0BAAU,EAC3C,GAAGJ,KADwC;AAE3CK,IAAAA,OAAO,EAAE,kBAAMJ,KAAK,CAACK,MAAZ,EAAoBN,KAAK,CAACK,OAA1B;AAFkC,GAAV,CAAnC;AAKA,SAAO;AACLF,IAAAA,SADK;AAELC,IAAAA,WAAW,EAAE,uBAAWA,WAAX,EAAwB;AACnC,sBAAgBF;AADmB,KAAxB;AAFR,GAAP;AAMD","sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { ElementType } from 'react';\nimport { AriaToggleButtonProps } from '@react-types/button';\nimport { useButton } from './useButton';\nimport { chain } from '@react-aria/utils';\nimport { mergeProps } from '@react-aria/utils';\nimport { ToggleState } from '@react-stately/toggle';\n\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.\n */\nexport function useToggleButton(\n props: AriaToggleButtonProps<ElementType>,\n state: ToggleState\n): any {\n /* eslint-enable no-redeclare */\n const { isSelected } = state;\n const { isPressed, buttonProps } = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress),\n });\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected,\n }),\n };\n}\n"]}
1
+ {"version":3,"names":["_useButton","require","_utils","useToggleButton","props","state","isSelected","isPressed","buttonProps","useButton","onPress","chain","toggle","mergeProps"],"sourceRoot":"../../src","sources":["useToggleButton.web.ts"],"mappings":";;;;;;AAcA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAC7BC,KAAyC,EACzCC,KAAkB,EACb;EACL;EACA,MAAM;IAAEC;EAAW,CAAC,GAAGD,KAAK;EAC5B,MAAM;IAAEE,SAAS;IAAEC;EAAY,CAAC,GAAG,IAAAC,oBAAS;EAC1C;EACA;IACE,GAAGL,KAAK;IACR;IACAM,OAAO,EAAE,IAAAC,YAAK,EAACN,KAAK,CAACO,MAAM,EAAER,KAAK,CAACM,OAAO;EAC5C,CACF,CAAC;EAED,OAAO;IACLH,SAAS;IACTC,WAAW,EAAE,IAAAK,iBAAU,EAACL,WAAW,EAAE;MACnC,cAAc,EAAEF;IAClB,CAAC;EACH,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAd;AACA,cAAc,mBAAd","sourcesContent":["export * from './useButton';\nexport * from './useToggleButton';\n"]}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.web.ts"],"names":[],"mappings":"AAAA,cAAc,aAAd;AACA,cAAc,uBAAd","sourcesContent":["export * from \"./useButton\";\nexport * from \"./useToggleButton.web\";\n"]}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,uBAAuB"}
@@ -3,9 +3,13 @@ import { mergeProps } from '@react-aria/utils';
3
3
  export function useButton(props) {
4
4
  let {
5
5
  isDisabled,
6
+ // @ts-ignore
6
7
  onPress,
8
+ // @ts-ignore
7
9
  onPressStart,
10
+ // @ts-ignore
8
11
  onPressEnd,
12
+ // @ts-ignore
9
13
  onPressChange,
10
14
  ...rest
11
15
  } = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["useButton.ts"],"names":["usePress","mergeProps","useButton","props","isDisabled","onPress","onPressStart","onPressEnd","onPressChange","rest","pressProps","isPressed","mergedProps","buttonProps"],"mappings":"AACA,SAAsBA,QAAtB,QAAsC,iCAAtC;AAEA,SAASC,UAAT,QAA2B,mBAA3B;AAkBA,OAAO,SAASC,SAAT,CAAmBC,KAAnB,EAAyD;AAC9D,MAAI;AACFC,IAAAA,UADE;AAEFC,IAAAA,OAFE;AAGFC,IAAAA,YAHE;AAIFC,IAAAA,UAJE;AAKFC,IAAAA,aALE;AAMF,OAAGC;AAND,MAOAN,KAPJ;AASA,MAAI;AAAEO,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA4BX,QAAQ,CAAC;AACvCM,IAAAA,YADuC;AAEvCC,IAAAA,UAFuC;AAGvCC,IAAAA,aAHuC;AAIvCH,IAAAA,OAJuC;AAKvCD,IAAAA;AALuC,GAAD,CAAxC;AAQA,QAAMQ,WAAW,GAAGX,UAAU,CAACS,UAAD,EAAaD,IAAb,EAAmB;AAC/C,qBAAiBL,UAD8B;AAE/C,YAAQ,QAFuC;AAG/C,gBAAYA;AAHmC,GAAnB,CAA9B;AAMA,SAAO;AACLO,IAAAA,SADK;AAELE,IAAAA,WAAW,EAAED;AAFR,GAAP;AAID","sourcesContent":["import { ReactNode } from 'react';\nimport { PressEvents, usePress } from '@react-native-aria/interactions';\nimport { AccessibilityProps, PressableProps } from 'react-native';\nimport { mergeProps } from '@react-aria/utils';\n\ninterface ButtonProps extends PressEvents {\n /** Whether the button is disabled. */\n isDisabled?: boolean;\n /** The content to display in the button. */\n children?: ReactNode;\n}\n\nexport interface RNAriaButtonProps extends AccessibilityProps, ButtonProps {}\n\nexport interface ButtonAria {\n /** Props for the button element. */\n buttonProps: PressableProps;\n /** Whether the button is currently pressed. */\n isPressed: boolean;\n}\n\nexport function useButton(props: RNAriaButtonProps): ButtonAria {\n let {\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n ...rest\n } = props;\n\n let { pressProps, isPressed } = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n isDisabled,\n });\n\n const mergedProps = mergeProps(pressProps, rest, {\n 'aria-disabled': isDisabled,\n 'role': 'button',\n 'disabled': isDisabled,\n });\n\n return {\n isPressed,\n buttonProps: mergedProps,\n };\n}\n"]}
1
+ {"version":3,"names":["usePress","mergeProps","useButton","props","isDisabled","onPress","onPressStart","onPressEnd","onPressChange","rest","pressProps","isPressed","mergedProps","buttonProps"],"sourceRoot":"../../src","sources":["useButton.ts"],"mappings":"AACA,SAAsBA,QAAQ,QAAQ,iCAAiC;AAEvE,SAASC,UAAU,QAAQ,mBAAmB;AAkB9C,OAAO,SAASC,SAASA,CAACC,KAAwB,EAAc;EAC9D,IAAI;IACFC,UAAU;IACV;IACAC,OAAO;IACP;IACAC,YAAY;IACZ;IACAC,UAAU;IACV;IACAC,aAAa;IACb,GAAGC;EACL,CAAC,GAAGN,KAAK;EAET,IAAI;IAAEO,UAAU;IAAEC;EAAU,CAAC,GAAGX,QAAQ,CAAC;IACvCM,YAAY;IACZC,UAAU;IACVC,aAAa;IACbH,OAAO;IACPD;EACF,CAAC,CAAC;EAEF,MAAMQ,WAAW,GAAGX,UAAU,CAACS,UAAU,EAAED,IAAI,EAAE;IAC/C,eAAe,EAAEL,UAAU;IAC3B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAEA;EACd,CAAC,CAAC;EAEF,OAAO;IACLO,SAAS;IACTE,WAAW,EAAED;EACf,CAAC;AACH"}
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import { useButton } from './useButton';
2
3
  import { chain, mergeProps } from '@react-aria/utils';
3
4
  export function useToggleButton(props, state) {
@@ -7,7 +8,8 @@ export function useToggleButton(props, state) {
7
8
  const {
8
9
  isPressed,
9
10
  buttonProps
10
- } = useButton({ ...props,
11
+ } = useButton({
12
+ ...props,
11
13
  onPress: chain(state.toggle, props.onPress)
12
14
  });
13
15
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["useToggleButton.ts"],"names":["useButton","chain","mergeProps","useToggleButton","props","state","isSelected","isPressed","buttonProps","onPress","toggle"],"mappings":"AAAA,SAAqBA,SAArB,QAAsC,aAAtC;AAEA,SAASC,KAAT,EAAgBC,UAAhB,QAAkC,mBAAlC;AAkBA,OAAO,SAASC,eAAT,CACLC,KADK,EAELC,KAFK,EAGO;AACZ,QAAM;AAAEC,IAAAA;AAAF,MAAiBD,KAAvB;AACA,QAAM;AAAEE,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA6BR,SAAS,CAAC,EAC3C,GAAGI,KADwC;AAE3CK,IAAAA,OAAO,EAAER,KAAK,CAACI,KAAK,CAACK,MAAP,EAAeN,KAAK,CAACK,OAArB;AAF6B,GAAD,CAA5C;AAKA,SAAO;AACLF,IAAAA,SADK;AAELC,IAAAA,WAAW,EAAEN,UAAU,CAACM,WAAD,EAAc;AACnC,uBAAiBF;AADkB,KAAd;AAFlB,GAAP;AAMD","sourcesContent":["import { ButtonAria, useButton } from './useButton';\nimport type { ToggleState } from '@react-stately/toggle';\nimport { chain, mergeProps } from '@react-aria/utils';\nimport type { PressEvents } from '@react-native-aria/interactions';\nimport type { PressableProps } from 'react-native';\n\nexport type AriaButtonProps = PressableProps &\n PressEvents & {\n isDisabled: boolean;\n };\n\nexport interface AriaToggleButtonProps extends AriaButtonProps {\n /** Whether the element should be selected (controlled). */\n isSelected?: boolean;\n /** Whether the element should be selected (uncontrolled). */\n defaultSelected?: boolean;\n /** Handler that is called when the element's selection state changes. */\n onChange?: (isSelected: boolean) => void;\n}\n\nexport function useToggleButton(\n props: AriaToggleButtonProps,\n state: ToggleState\n): ButtonAria {\n const { isSelected } = state;\n const { isPressed, buttonProps } = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress),\n });\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-selected': isSelected,\n }),\n };\n}\n"]}
1
+ {"version":3,"names":["useButton","chain","mergeProps","useToggleButton","props","state","isSelected","isPressed","buttonProps","onPress","toggle"],"sourceRoot":"../../src","sources":["useToggleButton.ts"],"mappings":"AAAA;AACA,SAAqBA,SAAS,QAAQ,aAAa;AAEnD,SAASC,KAAK,EAAEC,UAAU,QAAQ,mBAAmB;AAkBrD,OAAO,SAASC,eAAeA,CAC7BC,KAA4B,EAC5BC,KAAkB,EACN;EACZ,MAAM;IAAEC;EAAW,CAAC,GAAGD,KAAK;EAC5B,MAAM;IAAEE,SAAS;IAAEC;EAAY,CAAC,GAAGR,SAAS,CAAC;IAC3C,GAAGI,KAAK;IACRK,OAAO,EAAER,KAAK,CAACI,KAAK,CAACK,MAAM,EAAEN,KAAK,CAACK,OAAO;EAC5C,CAAC,CAAC;EAEF,OAAO;IACLF,SAAS;IACTC,WAAW,EAAEN,UAAU,CAACM,WAAW,EAAE;MACnC,eAAe,EAAEF;IACnB,CAAC;EACH,CAAC;AACH"}
@@ -9,10 +9,10 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
+
12
13
  import { useButton } from './useButton';
13
14
  import { chain } from '@react-aria/utils';
14
15
  import { mergeProps } from '@react-aria/utils';
15
-
16
16
  /**
17
17
  * Provides the behavior and accessibility implementation for a toggle button component.
18
18
  * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.
@@ -25,7 +25,11 @@ export function useToggleButton(props, state) {
25
25
  const {
26
26
  isPressed,
27
27
  buttonProps
28
- } = useButton({ ...props,
28
+ } = useButton(
29
+ // @ts-ignore
30
+ {
31
+ ...props,
32
+ // @ts-ignore
29
33
  onPress: chain(state.toggle, props.onPress)
30
34
  });
31
35
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["useToggleButton.web.ts"],"names":["useButton","chain","mergeProps","useToggleButton","props","state","isSelected","isPressed","buttonProps","onPress","toggle"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,SAAT,QAA0B,aAA1B;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAASC,UAAT,QAA2B,mBAA3B;;AAGA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAT,CACLC,KADK,EAELC,KAFK,EAGA;AACL;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiBD,KAAvB;AACA,QAAM;AAAEE,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA6BR,SAAS,CAAC,EAC3C,GAAGI,KADwC;AAE3CK,IAAAA,OAAO,EAAER,KAAK,CAACI,KAAK,CAACK,MAAP,EAAeN,KAAK,CAACK,OAArB;AAF6B,GAAD,CAA5C;AAKA,SAAO;AACLF,IAAAA,SADK;AAELC,IAAAA,WAAW,EAAEN,UAAU,CAACM,WAAD,EAAc;AACnC,sBAAgBF;AADmB,KAAd;AAFlB,GAAP;AAMD","sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { ElementType } from 'react';\nimport { AriaToggleButtonProps } from '@react-types/button';\nimport { useButton } from './useButton';\nimport { chain } from '@react-aria/utils';\nimport { mergeProps } from '@react-aria/utils';\nimport { ToggleState } from '@react-stately/toggle';\n\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.\n */\nexport function useToggleButton(\n props: AriaToggleButtonProps<ElementType>,\n state: ToggleState\n): any {\n /* eslint-enable no-redeclare */\n const { isSelected } = state;\n const { isPressed, buttonProps } = useButton({\n ...props,\n onPress: chain(state.toggle, props.onPress),\n });\n\n return {\n isPressed,\n buttonProps: mergeProps(buttonProps, {\n 'aria-pressed': isSelected,\n }),\n };\n}\n"]}
1
+ {"version":3,"names":["useButton","chain","mergeProps","useToggleButton","props","state","isSelected","isPressed","buttonProps","onPress","toggle"],"sourceRoot":"../../src","sources":["useToggleButton.web.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,SAAS,QAAQ,aAAa;AACvC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,UAAU,QAAQ,mBAAmB;AAG9C;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,KAAyC,EACzCC,KAAkB,EACb;EACL;EACA,MAAM;IAAEC;EAAW,CAAC,GAAGD,KAAK;EAC5B,MAAM;IAAEE,SAAS;IAAEC;EAAY,CAAC,GAAGR,SAAS;EAC1C;EACA;IACE,GAAGI,KAAK;IACR;IACAK,OAAO,EAAER,KAAK,CAACI,KAAK,CAACK,MAAM,EAAEN,KAAK,CAACK,OAAO;EAC5C,CACF,CAAC;EAED,OAAO;IACLF,SAAS;IACTC,WAAW,EAAEN,UAAU,CAACM,WAAW,EAAE;MACnC,cAAc,EAAEF;IAClB,CAAC;EACH,CAAC;AACH"}
@@ -1,2 +1,3 @@
1
1
  export * from './useButton';
2
2
  export * from './useToggleButton';
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,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./useButton";
2
2
  export * from "./useToggleButton.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,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC"}
@@ -17,3 +17,4 @@ export interface ButtonAria {
17
17
  }
18
18
  export declare function useButton(props: RNAriaButtonProps): ButtonAria;
19
19
  export {};
20
+ //# sourceMappingURL=useButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useButton.d.ts","sourceRoot":"","sources":["../../src/useButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,WAAW,EAAY,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGlE,UAAU,WAAY,SAAQ,WAAW;IACvC,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,EAAE,WAAW;CAAG;AAE7E,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,WAAW,EAAE,cAAc,CAAC;IAC5B,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,UAAU,CAgC9D"}
@@ -2,7 +2,7 @@ import { ButtonAria } from './useButton';
2
2
  import type { ToggleState } from '@react-stately/toggle';
3
3
  import type { PressEvents } from '@react-native-aria/interactions';
4
4
  import type { PressableProps } from 'react-native';
5
- export declare type AriaButtonProps = PressableProps & PressEvents & {
5
+ export type AriaButtonProps = PressableProps & PressEvents & {
6
6
  isDisabled: boolean;
7
7
  };
8
8
  export interface AriaToggleButtonProps extends AriaButtonProps {
@@ -14,3 +14,4 @@ export interface AriaToggleButtonProps extends AriaButtonProps {
14
14
  onChange?: (isSelected: boolean) => void;
15
15
  }
16
16
  export declare function useToggleButton(props: AriaToggleButtonProps, state: ToggleState): ButtonAria;
17
+ //# sourceMappingURL=useToggleButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToggleButton.d.ts","sourceRoot":"","sources":["../../src/useToggleButton.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAa,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,cAAc,GAC1C,WAAW,GAAG;IACZ,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEJ,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE,WAAW,GACjB,UAAU,CAaZ"}
@@ -6,3 +6,4 @@ import { ToggleState } from '@react-stately/toggle';
6
6
  * ToggleButtons allow users to toggle a selection on or off, for example switching between two states or modes.
7
7
  */
8
8
  export declare function useToggleButton(props: AriaToggleButtonProps<ElementType>, state: ToggleState): any;
9
+ //# sourceMappingURL=useToggleButton.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToggleButton.web.d.ts","sourceRoot":"","sources":["../../src/useToggleButton.web.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,qBAAqB,CAAC,WAAW,CAAC,EACzC,KAAK,EAAE,WAAW,GACjB,GAAG,CAkBL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-aria/button",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "mono repo setup with bob",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -26,6 +26,7 @@
26
26
  "typescript": "tsc --noEmit",
27
27
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
28
  "prepare": "bob build",
29
+ "build": "bob build",
29
30
  "release": "release-it",
30
31
  "example": "yarn --cwd example",
31
32
  "pods": "cd example && pod-install --quiet",
@@ -36,19 +37,22 @@
36
37
  "ios",
37
38
  "android"
38
39
  ],
39
- "repository": "https://github.com/intergalacticspacehighway/react-native-bob-mono",
40
+ "homepage": "https://github.com/gluestack/gluestack-ui/tree/main/packages/react-native-aria/button#readme",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/gluestack/gluestack-ui.git"
44
+ },
40
45
  "author": "nishan <nishanbende@gmail.com> (https://github.com/intergalacticspacehighway)",
41
46
  "license": "MIT",
42
47
  "bugs": {
43
48
  "url": "https://github.com/intergalacticspacehighway/react-native-bob-mono/issues"
44
49
  },
45
- "homepage": "https://github.com/intergalacticspacehighway/react-native-bob-mono#readme",
46
50
  "publishConfig": {
47
51
  "registry": "https://registry.npmjs.org/"
48
52
  },
49
53
  "dependencies": {
50
54
  "@react-aria/utils": "^3.6.0",
51
- "@react-native-aria/interactions": "^0.2.11",
55
+ "@react-native-aria/interactions": "0.2.12",
52
56
  "@react-stately/toggle": "^3.2.1",
53
57
  "@react-types/checkbox": "^3.2.1"
54
58
  },
package/src/useButton.ts CHANGED
@@ -22,9 +22,13 @@ export interface ButtonAria {
22
22
  export function useButton(props: RNAriaButtonProps): ButtonAria {
23
23
  let {
24
24
  isDisabled,
25
+ // @ts-ignore
25
26
  onPress,
27
+ // @ts-ignore
26
28
  onPressStart,
29
+ // @ts-ignore
27
30
  onPressEnd,
31
+ // @ts-ignore
28
32
  onPressChange,
29
33
  ...rest
30
34
  } = props;
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import { ButtonAria, useButton } from './useButton';
2
3
  import type { ToggleState } from '@react-stately/toggle';
3
4
  import { chain, mergeProps } from '@react-aria/utils';
@@ -27,10 +27,14 @@ export function useToggleButton(
27
27
  ): any {
28
28
  /* eslint-enable no-redeclare */
29
29
  const { isSelected } = state;
30
- const { isPressed, buttonProps } = useButton({
31
- ...props,
32
- onPress: chain(state.toggle, props.onPress),
33
- });
30
+ const { isPressed, buttonProps } = useButton(
31
+ // @ts-ignore
32
+ {
33
+ ...props,
34
+ // @ts-ignore
35
+ onPress: chain(state.toggle, props.onPress),
36
+ }
37
+ );
34
38
 
35
39
  return {
36
40
  isPressed,