@lynx-js/lynx-ui-button 3.135.3 → 3.136.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @lynx-js/lynx-ui-button
2
2
 
3
+ ## 3.136.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`0257f8b`](https://github.com/lynx-family/lynx-ui/commit/0257f8bc9fbe6b8a51df00663c7860827ce468b2)]:
8
+ - @lynx-js/lynx-ui-common@3.136.0
9
+
10
+ ## 3.135.4
11
+
12
+ ### Patch Changes
13
+
14
+ - Upgrade the Lynx and Rsbuild toolchain dependencies used to build lynx-ui packages. ([#233](https://github.com/lynx-family/lynx-ui/pull/233))
15
+
16
+ - Updated dependencies [[`753556b`](https://github.com/lynx-family/lynx-ui/commit/753556bc1acb77e05567aba3b8b5ab057b9f670b)]:
17
+ - @lynx-js/lynx-ui-common@3.135.4
18
+
3
19
  ## 3.135.3
4
20
 
5
21
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"Button.jsx","sources":["webpack://@lynx-js/lynx-ui-button/./src/Button.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { createContext, useContext, useMemo, useState } from '@lynx-js/react'\n\nimport { useMemoizedFn } from '@lynx-js/lynx-ui-common'\nimport { useTouchEmulation } from '@lynx-js/react-use'\nimport { clsx } from 'clsx'\n\nimport type { ButtonProps } from './types'\n\nexport const ButtonContext = createContext<{\n active: boolean\n disabled: boolean\n}>({\n active: false,\n disabled: false,\n})\n\nexport const useButtonContext = () => useContext(ButtonContext)\n\nexport const Button = (prop: ButtonProps) => {\n const {\n children,\n onClick,\n disabled = false,\n style,\n className,\n buttonProps,\n } = prop\n const [active, setActive] = useState(false)\n\n // Only when the button is active and not disabled, the active style will be applied\n const isEffectiveActive = active && !disabled\n\n const renderedChildren = typeof children === 'function'\n ? children({ active: isEffectiveActive, disabled })\n : children\n\n const handleTouchStart = useMemoizedFn(() => {\n if (disabled) return\n setActive(true)\n })\n\n const handleTouchEnd = useMemoizedFn(() => {\n setActive(false)\n if (disabled) return\n })\n\n const handleTap = useMemoizedFn(() => {\n if (disabled) return\n onClick?.()\n })\n\n const touchHandlers = useTouchEmulation({\n onTouchStart: handleTouchStart,\n onTouchEnd: handleTouchEnd,\n onTouchCancel: handleTouchEnd,\n })\n\n const contextValue = useMemo(\n () => ({ active: isEffectiveActive, disabled }),\n [isEffectiveActive, disabled],\n )\n\n return (\n <ButtonContext.Provider value={contextValue}>\n <view\n bindtap={handleTap}\n {...touchHandlers}\n event-through={false}\n style={style}\n className={clsx(className, {\n 'ui-active': isEffectiveActive,\n 'ui-disabled': disabled,\n })}\n {...buttonProps}\n >\n {renderedChildren}\n </view>\n </ButtonContext.Provider>\n )\n}\n"],"names":["ButtonContext","createContext","useButtonContext","useContext","Button","prop","children","onClick","disabled","style","className","buttonProps","active","setActive","useState","isEffectiveActive","renderedChildren","handleTouchStart","useMemoizedFn","handleTouchEnd","handleTap","touchHandlers","useTouchEmulation","contextValue","useMemo","view","clsx"],"mappings":";;;;AAYO,MAAMA,gBAAgBC,cAG1B;IACD,QAAQ;IACR,UAAU;AACZ;AAEO,MAAMC,mBAAmB,IAAMC,WAAWH;AAE1C,MAAMI,SAAS,CAACC;IACrB,MAAM,EACJC,QAAQ,EACRC,OAAO,EACPC,WAAW,KAAK,EAChBC,KAAK,EACLC,SAAS,EACTC,WAAW,EACZ,GAAGN;IACJ,MAAM,CAACO,QAAQC,UAAU,GAAGC,SAAS;IAGrC,MAAMC,oBAAoBH,UAAU,CAACJ;IAErC,MAAMQ,mBAAmB,AAAoB,cAApB,OAAOV,WAC5BA,SAAS;QAAE,QAAQS;QAAmBP;IAAS,KAC/CF;IAEJ,MAAMW,mBAAmBC,cAAc;QACrC,IAAIV,UAAU;QACdK,UAAU;IACZ;IAEA,MAAMM,iBAAiBD,cAAc;QACnCL,UAAU;QACV,IAAIL,UAAU;IAChB;IAEA,MAAMY,YAAYF,cAAc;QAC9B,IAAIV,UAAU;QACdD;IACF;IAEA,MAAMc,gBAAgBC,kBAAkB;QACtC,cAAcL;QACd,YAAYE;QACZ,eAAeA;IACjB;IAEA,MAAMI,eAAeC,QACnB,IAAO;YAAE,QAAQT;YAAmBP;QAAS,IAC7C;QAACO;QAAmBP;KAAS;IAG/B,QACGR,cAAc,SAAS,OAAOuB,cAAc;MAC3C,CAACE,KACC,SAASL,YACR,GAAGC,aAAa,EACjB,eAAe,OACf,OAAOZ,OACP,WAAWiB,KAAKhB,WAAW;QACzB,aAAaK;QACb,eAAeP;IACjB,KACC,GAAGG,WAAW,EAChB;QACC,CAACK,iBAAiB;MACpB,EAAES,KAAK;IACT,EAAEzB,cAAc;AAEpB"}
1
+ {"version":3,"file":"Button.jsx","sources":["../src/Button.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { createContext, useContext, useMemo, useState } from '@lynx-js/react'\n\nimport { useMemoizedFn } from '@lynx-js/lynx-ui-common'\nimport { useTouchEmulation } from '@lynx-js/react-use'\nimport { clsx } from 'clsx'\n\nimport type { ButtonProps } from './types'\n\nexport const ButtonContext = createContext<{\n active: boolean\n disabled: boolean\n}>({\n active: false,\n disabled: false,\n})\n\nexport const useButtonContext = () => useContext(ButtonContext)\n\nexport const Button = (prop: ButtonProps) => {\n const {\n children,\n onClick,\n disabled = false,\n style,\n className,\n buttonProps,\n } = prop\n const [active, setActive] = useState(false)\n\n // Only when the button is active and not disabled, the active style will be applied\n const isEffectiveActive = active && !disabled\n\n const renderedChildren = typeof children === 'function'\n ? children({ active: isEffectiveActive, disabled })\n : children\n\n const handleTouchStart = useMemoizedFn(() => {\n if (disabled) return\n setActive(true)\n })\n\n const handleTouchEnd = useMemoizedFn(() => {\n setActive(false)\n if (disabled) return\n })\n\n const handleTap = useMemoizedFn(() => {\n if (disabled) return\n onClick?.()\n })\n\n const touchHandlers = useTouchEmulation({\n onTouchStart: handleTouchStart,\n onTouchEnd: handleTouchEnd,\n onTouchCancel: handleTouchEnd,\n })\n\n const contextValue = useMemo(\n () => ({ active: isEffectiveActive, disabled }),\n [isEffectiveActive, disabled],\n )\n\n return (\n <ButtonContext.Provider value={contextValue}>\n <view\n bindtap={handleTap}\n {...touchHandlers}\n event-through={false}\n style={style}\n className={clsx(className, {\n 'ui-active': isEffectiveActive,\n 'ui-disabled': disabled,\n })}\n {...buttonProps}\n >\n {renderedChildren}\n </view>\n </ButtonContext.Provider>\n )\n}\n"],"names":["ButtonContext","createContext","useButtonContext","useContext","Button","prop","children","onClick","disabled","style","className","buttonProps","active","setActive","useState","isEffectiveActive","renderedChildren","handleTouchStart","useMemoizedFn","handleTouchEnd","handleTap","touchHandlers","useTouchEmulation","contextValue","useMemo","view","clsx"],"mappings":";;;;AAYO,MAAMA,gBAAgBC,cAG1B;IACD,QAAQ;IACR,UAAU;AACZ;AAEO,MAAMC,mBAAmB,IAAMC,WAAWH;AAE1C,MAAMI,SAAS,CAACC;IACrB,MAAM,EACJC,QAAQ,EACRC,OAAO,EACPC,WAAW,KAAK,EAChBC,KAAK,EACLC,SAAS,EACTC,WAAW,EACZ,GAAGN;IACJ,MAAM,CAACO,QAAQC,UAAU,GAAGC,SAAS;IAGrC,MAAMC,oBAAoBH,UAAU,CAACJ;IAErC,MAAMQ,mBAAmB,AAAoB,cAApB,OAAOV,WAC5BA,SAAS;QAAE,QAAQS;QAAmBP;IAAS,KAC/CF;IAEJ,MAAMW,mBAAmBC,cAAc;QACrC,IAAIV,UAAU;QACdK,UAAU;IACZ;IAEA,MAAMM,iBAAiBD,cAAc;QACnCL,UAAU;QACV,IAAIL,UAAU;IAChB;IAEA,MAAMY,YAAYF,cAAc;QAC9B,IAAIV,UAAU;QACdD;IACF;IAEA,MAAMc,gBAAgBC,kBAAkB;QACtC,cAAcL;QACd,YAAYE;QACZ,eAAeA;IACjB;IAEA,MAAMI,eAAeC,QACnB,IAAO;YAAE,QAAQT;YAAmBP;QAAS,IAC7C;QAACO;QAAmBP;KAAS;IAG/B,QACGR,cAAc,SAAS,OAAOuB,cAAc;MAC3C,CAACE,KACC,SAASL,YACR,GAAGC,aAAa,EACjB,eAAe,OACf,OAAOZ,OACP,WAAWiB,KAAKhB,WAAW;QACzB,aAAaK;QACb,eAAeP;IACjB,KACC,GAAGG,WAAW,EAChB;QACC,CAACK,iBAAiB;MACpB,EAAES,KAAK;IACT,EAAEzB,cAAc;AAEpB"}
package/dist/index.jsx CHANGED
@@ -1,2 +1 @@
1
- import { Button, ButtonContext } from "./Button.jsx";
2
- export { Button, ButtonContext };
1
+ export { Button, ButtonContext } from "./Button.jsx";
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/lynx-ui-button",
3
- "version": "3.135.3",
3
+ "version": "3.136.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lynx-family/lynx-ui.git",
@@ -27,14 +27,14 @@
27
27
  "dependencies": {
28
28
  "@lynx-js/react-use": "0.2.2",
29
29
  "clsx": "^2.1.1",
30
- "@lynx-js/lynx-ui-common": "3.135.3"
30
+ "@lynx-js/lynx-ui-common": "3.136.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@lynx-js/react": "0.114.0",
34
- "@lynx-js/types": "3.6.0",
35
- "@rslib/core": "^0.16.0",
33
+ "@lynx-js/react": "0.123.1",
34
+ "@lynx-js/types": "4.1.0",
35
+ "@rslib/core": "0.23.2",
36
36
  "@types/react": "^18.3.8",
37
- "typescript": "^5.5.3"
37
+ "typescript": "^5.8.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@lynx-js/react": ">=0.100.0",
package/tsconfig.json CHANGED
@@ -6,4 +6,9 @@
6
6
  "include": [
7
7
  "src",
8
8
  ],
9
+ "exclude": [
10
+ "**/*.test.ts",
11
+ "**/*.test.tsx",
12
+ "**/__tests__/**",
13
+ ],
9
14
  }