@lumx/core 4.1.1-alpha.6 → 4.2.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.
@@ -1,3 +1,3 @@
1
1
  import type React from 'react';
2
- export type JSXElement = boolean | number | string | React.JSX.Element | Iterable<JSXElement> | undefined | null;
2
+ export type JSXElement = boolean | number | string | React.JSX.Element | React.ReactNode | Iterable<JSXElement> | undefined | null;
3
3
  export type ElementType = React.ElementType;
@@ -0,0 +1,22 @@
1
+ /** Disable state */
2
+ export type DisabledStateContextValue = {
3
+ state: 'disabled';
4
+ } | {
5
+ state: undefined | null;
6
+ };
7
+ export type GenericProps = {
8
+ disabled?: boolean;
9
+ isDisabled?: boolean;
10
+ 'aria-disabled'?: boolean | 'true' | 'false';
11
+ onClick?: any;
12
+ onChange?: any;
13
+ [key: string]: any;
14
+ };
15
+ export type DisabledState = {
16
+ disabled: boolean;
17
+ 'aria-disabled': boolean;
18
+ };
19
+ /**
20
+ * Calculate the disabled state based on context and props.
21
+ */
22
+ export declare function getDisabledState(context: DisabledStateContextValue | undefined, props: GenericProps): DisabledState;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Calculate the disabled state based on context and props.
3
+ */
4
+ function getDisabledState(context, props) {
5
+ const { disabled, isDisabled = disabled, 'aria-disabled': ariaDisabled } = props;
6
+ return {
7
+ disabled: context?.state === 'disabled' || !!isDisabled,
8
+ 'aria-disabled': ariaDisabled === true || ariaDisabled === 'true',
9
+ };
10
+ }
11
+
12
+ export { getDisabledState };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/icons": "^4.1.1-alpha.6",
9
+ "@lumx/icons": "^4.2.0",
10
10
  "classnames": "^2.3.2",
11
11
  "focus-visible": "^5.0.2",
12
12
  "lodash": "4.17.23",
@@ -37,7 +37,7 @@
37
37
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
38
38
  },
39
39
  "sideEffects": false,
40
- "version": "4.1.1-alpha.6",
40
+ "version": "4.2.0",
41
41
  "devDependencies": {
42
42
  "@rollup/plugin-typescript": "^12.3.0",
43
43
  "@testing-library/dom": "^10.4.1",
@@ -60,6 +60,5 @@
60
60
  "vite": "^7.3.1",
61
61
  "vite-tsconfig-paths": "^5.1.4",
62
62
  "vitest": "^4.0.18"
63
- },
64
- "stableVersion": "4.1.0"
63
+ }
65
64
  }