@korsolutions/ui 0.0.85 → 0.0.86
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/AGENTS.md +3 -3
- package/dist/module/components/alert-dialog/components/alert-dialog-root.js +1 -1
- package/dist/module/components/alert-dialog/components/alert-dialog-root.js.map +1 -1
- package/dist/module/components/alert-dialog/variants/default.js +93 -85
- package/dist/module/components/alert-dialog/variants/default.js.map +1 -1
- package/dist/module/components/button/button.js +1 -1
- package/dist/module/components/button/button.js.map +1 -1
- package/dist/module/components/button/variants/default.js +48 -44
- package/dist/module/components/button/variants/default.js.map +1 -1
- package/dist/module/components/button/variants/ghost.js +64 -60
- package/dist/module/components/button/variants/ghost.js.map +1 -1
- package/dist/module/components/button/variants/secondary.js +66 -62
- package/dist/module/components/button/variants/secondary.js.map +1 -1
- package/dist/module/components/combobox/components/combobox-root.js +1 -1
- package/dist/module/components/combobox/components/combobox-root.js.map +1 -1
- package/dist/module/components/combobox/variants/default.js +91 -88
- package/dist/module/components/combobox/variants/default.js.map +1 -1
- package/dist/module/components/icon-button/icon-button.js +4 -5
- package/dist/module/components/icon-button/icon-button.js.map +1 -1
- package/dist/module/components/icon-button/variants/default.js +31 -24
- package/dist/module/components/icon-button/variants/default.js.map +1 -1
- package/dist/module/components/icon-button/variants/ghost.js +32 -25
- package/dist/module/components/icon-button/variants/ghost.js.map +1 -1
- package/dist/module/components/icon-button/variants/secondary.js +34 -27
- package/dist/module/components/icon-button/variants/secondary.js.map +1 -1
- package/dist/module/components/input/input.js +1 -1
- package/dist/module/components/input/input.js.map +1 -1
- package/dist/module/components/input/variants/default.js +39 -37
- package/dist/module/components/input/variants/default.js.map +1 -1
- package/dist/module/components/input/variants/secondary.js +39 -37
- package/dist/module/components/input/variants/secondary.js.map +1 -1
- package/dist/module/components/phone-input/components/phone-input-root.js +2 -1
- package/dist/module/components/phone-input/components/phone-input-root.js.map +1 -1
- package/dist/module/components/phone-input/variants/default.js +115 -112
- package/dist/module/components/phone-input/variants/default.js.map +1 -1
- package/dist/module/components/select/components/select-root.js +1 -1
- package/dist/module/components/select/components/select-root.js.map +1 -1
- package/dist/module/components/select/variants/default.js +75 -73
- package/dist/module/components/select/variants/default.js.map +1 -1
- package/dist/module/themes/default/index.js +1 -0
- package/dist/module/themes/default/index.js.map +1 -1
- package/dist/module/themes/provider.js +1 -0
- package/dist/module/themes/provider.js.map +1 -1
- package/dist/module/themes/utils.js +2 -1
- package/dist/module/themes/utils.js.map +1 -1
- package/dist/module/utils/size-scale.js +42 -0
- package/dist/module/utils/size-scale.js.map +1 -0
- package/dist/module/utils/use-themed-styles.js +4 -1
- package/dist/module/utils/use-themed-styles.js.map +1 -1
- package/dist/typescript/src/components/alert-dialog/components/alert-dialog-root.d.ts +2 -0
- package/dist/typescript/src/components/alert-dialog/components/alert-dialog-root.d.ts.map +1 -1
- package/dist/typescript/src/components/alert-dialog/variants/default.d.ts +3 -2
- package/dist/typescript/src/components/alert-dialog/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/alert-dialog/variants/index.d.ts +1 -1
- package/dist/typescript/src/components/button/button.d.ts +2 -0
- package/dist/typescript/src/components/button/button.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/button/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/ghost.d.ts +2 -1
- package/dist/typescript/src/components/button/variants/ghost.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/index.d.ts +3 -3
- package/dist/typescript/src/components/button/variants/secondary.d.ts +2 -1
- package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/combobox/components/combobox-root.d.ts +2 -0
- package/dist/typescript/src/components/combobox/components/combobox-root.d.ts.map +1 -1
- package/dist/typescript/src/components/combobox/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/combobox/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/icon-button.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/variants/ghost.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/variants/ghost.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/variants/index.d.ts +3 -3
- package/dist/typescript/src/components/icon-button/variants/secondary.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/input/input.d.ts +2 -0
- package/dist/typescript/src/components/input/input.d.ts.map +1 -1
- package/dist/typescript/src/components/input/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/input/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/input/variants/secondary.d.ts +3 -2
- package/dist/typescript/src/components/input/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/phone-input/components/phone-input-root.d.ts +3 -1
- package/dist/typescript/src/components/phone-input/components/phone-input-root.d.ts.map +1 -1
- package/dist/typescript/src/components/phone-input/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/phone-input/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/select/components/select-root.d.ts +2 -0
- package/dist/typescript/src/components/select/components/select-root.d.ts.map +1 -1
- package/dist/typescript/src/components/select/variants/default.d.ts +3 -2
- package/dist/typescript/src/components/select/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/index.d.ts +2 -0
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/themes/default/index.d.ts.map +1 -1
- package/dist/typescript/src/themes/provider.d.ts +1 -0
- package/dist/typescript/src/themes/provider.d.ts.map +1 -1
- package/dist/typescript/src/themes/types.d.ts +1 -0
- package/dist/typescript/src/themes/types.d.ts.map +1 -1
- package/dist/typescript/src/themes/utils.d.ts.map +1 -1
- package/dist/typescript/src/utils/size-scale.d.ts +20 -0
- package/dist/typescript/src/utils/size-scale.d.ts.map +1 -0
- package/dist/typescript/src/utils/use-themed-styles.d.ts +5 -0
- package/dist/typescript/src/utils/use-themed-styles.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/alert-dialog/components/alert-dialog-root.tsx +3 -1
- package/src/components/alert-dialog/variants/default.tsx +88 -79
- package/src/components/button/button.tsx +3 -1
- package/src/components/button/variants/default.tsx +14 -10
- package/src/components/button/variants/ghost.tsx +14 -10
- package/src/components/button/variants/secondary.tsx +14 -10
- package/src/components/combobox/components/combobox-root.tsx +3 -1
- package/src/components/combobox/variants/default.tsx +17 -14
- package/src/components/icon-button/icon-button.tsx +6 -6
- package/src/components/icon-button/variants/default.tsx +12 -6
- package/src/components/icon-button/variants/ghost.tsx +12 -6
- package/src/components/icon-button/variants/secondary.tsx +12 -6
- package/src/components/input/input.tsx +3 -1
- package/src/components/input/variants/default.tsx +11 -9
- package/src/components/input/variants/secondary.tsx +12 -10
- package/src/components/phone-input/components/phone-input-root.tsx +4 -1
- package/src/components/phone-input/variants/default.tsx +21 -18
- package/src/components/select/components/select-root.tsx +3 -1
- package/src/components/select/variants/default.tsx +16 -14
- package/src/index.tsx +2 -0
- package/src/themes/default/index.ts +1 -0
- package/src/themes/provider.tsx +2 -0
- package/src/themes/types.ts +1 -0
- package/src/themes/utils.ts +1 -0
- package/src/utils/size-scale.ts +45 -0
- package/src/utils/use-themed-styles.ts +8 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Size } from "../../../utils/size-scale";
|
|
1
2
|
import type { PhoneInputStyles } from "../types";
|
|
2
|
-
export declare function usePhoneInputVariantDefault(): PhoneInputStyles;
|
|
3
|
+
export declare function usePhoneInputVariantDefault(size: Size): PhoneInputStyles;
|
|
3
4
|
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/phone-input/variants/default.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/phone-input/variants/default.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB,CAyHxE"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import type { Size } from "../../../utils/size-scale";
|
|
3
4
|
import { SelectVariants } from "../variants";
|
|
4
5
|
interface SelectRootInjectedProps {
|
|
5
6
|
style?: StyleProp<ViewStyle>;
|
|
6
7
|
}
|
|
7
8
|
export interface SelectRootBaseProps {
|
|
8
9
|
variant?: keyof typeof SelectVariants;
|
|
10
|
+
size?: Size;
|
|
9
11
|
value?: string;
|
|
10
12
|
onChange?: (value: string) => void;
|
|
11
13
|
isDisabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-root.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/components/select-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAwB,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"select-root.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/components/select-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAwB,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACtC,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,KAAK,CAAC,YAAY,CAAC;IAEhE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AASD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAmChD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Size } from "../../../utils/size-scale";
|
|
2
|
+
import { type SelectStyles } from "../types";
|
|
3
|
+
export declare function useSelectVariantDefault(size: Size): SelectStyles;
|
|
3
4
|
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/variants/default.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/select/variants/default.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CAkFhE"}
|
|
@@ -17,4 +17,6 @@ export { useTheme } from "./themes/provider";
|
|
|
17
17
|
export * from "./themes/types";
|
|
18
18
|
export * from "./components";
|
|
19
19
|
export * from "./safe-area";
|
|
20
|
+
export type { Size } from "./utils/size-scale";
|
|
21
|
+
export type { SvgProps } from "./types/props.types";
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,eAAO,MAAM,UAAU,GAAI,mEAMxB,aAAa,gCAef,CAAC;AAEF,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,eAAO,MAAM,UAAU,GAAI,mEAMxB,aAAa,gCAef,CAAC;AAEF,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/themes/default/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/themes/default/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,eAAO,MAAM,kBAAkB,EAAE,WAUhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/themes/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,aAAa,EACb,MAAM,EACN,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,QAAA,MAAM,YAAY,8CAA2C,CAAC;AAE9D,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,KAAK,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/themes/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,aAAa,EACb,MAAM,EACN,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,M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W,CAAC,WAAW,CAAC,GACjC,WAAW,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/themes/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,WAAW,CAAC,WAAW,CAAC,GACjC,WAAW,CAYb"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Size = "sm" | "md" | "lg";
|
|
2
|
+
interface SizeScaleValues {
|
|
3
|
+
/** spacing * 1 | 1.5 | 2 */
|
|
4
|
+
paddingVertical: number;
|
|
5
|
+
/** spacing * 1.5 | 2 | 3 */
|
|
6
|
+
paddingHorizontal: number;
|
|
7
|
+
/** spacing * 0.75 | 1 | 1.25 */
|
|
8
|
+
gap: number;
|
|
9
|
+
/** fontSize * 0.875 | 1 | 1.125 */
|
|
10
|
+
fontSize: number;
|
|
11
|
+
/** fontSize * 0.875 | 1 | 1.125 (alias for icon sizing) */
|
|
12
|
+
iconSize: number;
|
|
13
|
+
/** 1.75 | 2 | 2.25 */
|
|
14
|
+
strokeWidth: number;
|
|
15
|
+
/** spacing * 4.5 | 6 | 7.5 */
|
|
16
|
+
height: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function getSizeScale(size: Size | undefined, spacing: number, fontSize: number): SizeScaleValues;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=size-scale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size-scale.d.ts","sourceRoot":"","sources":["../../../../src/utils/size-scale.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtC,UAAU,eAAe;IACvB,4BAA4B;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAWD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,YAAO,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,eAAe,CAYjB"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { Colors, FontFamily, FontSize, LetterSpacing, Radius } from "../themes/types";
|
|
2
|
+
import { getSizeScale, type Size } from "./size-scale";
|
|
3
|
+
type SizeScale = ReturnType<typeof getSizeScale>;
|
|
2
4
|
interface CallbackProps {
|
|
3
5
|
colors: Colors;
|
|
4
6
|
radius: Radius;
|
|
5
7
|
fontFamily: FontFamily;
|
|
6
8
|
letterSpacing: LetterSpacing;
|
|
7
9
|
fontSize: FontSize;
|
|
10
|
+
spacing: number;
|
|
11
|
+
/** Compute spacing-based size dimensions from a Size token */
|
|
12
|
+
sizeScale: (size: Size) => SizeScale;
|
|
8
13
|
}
|
|
9
14
|
export declare const useThemedStyles: <T>(callback: (props: CallbackProps) => T) => T;
|
|
10
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-themed-styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/use-themed-styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-themed-styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/use-themed-styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAEvD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAEjD,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC;CACtC;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,UAAU,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,KAAG,CAW1E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React, { useMemo, useState } from "react";
|
|
2
2
|
import { useComponentConfig } from "../../../themes/provider";
|
|
3
3
|
import { mergeStyles } from "../../../utils/calculate-styles";
|
|
4
|
+
import type { Size } from "../../../utils/size-scale";
|
|
4
5
|
import { AlertDialogContext, type AlertDialogContextValue } from "../context";
|
|
5
6
|
import { AlertDialogVariants } from "../variants";
|
|
6
7
|
|
|
7
8
|
export interface AlertDialogRootProps {
|
|
8
9
|
variant?: keyof typeof AlertDialogVariants;
|
|
10
|
+
size?: Size;
|
|
9
11
|
children: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export function AlertDialogRoot(props: AlertDialogRootProps) {
|
|
13
15
|
const { children } = props;
|
|
14
|
-
const variantStyles = AlertDialogVariants[props.variant || "default"]();
|
|
16
|
+
const variantStyles = AlertDialogVariants[props.variant || "default"](props.size ?? "md");
|
|
15
17
|
const componentConfig = useComponentConfig("alertDialog");
|
|
16
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
19
|
|
|
@@ -1,84 +1,93 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Size } from "../../../utils/size-scale";
|
|
2
2
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
3
|
+
import { type AlertDialogStyles } from "../types";
|
|
3
4
|
|
|
4
|
-
export const useAlertDialogVariantDefault = (): AlertDialogStyles => {
|
|
5
|
+
export const useAlertDialogVariantDefault = (size: Size): AlertDialogStyles => {
|
|
5
6
|
return useThemedStyles(
|
|
6
|
-
({ colors, radius, fontFamily, fontSize }): AlertDialogStyles =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
7
|
+
({ colors, radius, fontFamily, fontSize, sizeScale }): AlertDialogStyles => {
|
|
8
|
+
const s = sizeScale(size);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
overlay: {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
top: 0,
|
|
14
|
+
left: 0,
|
|
15
|
+
right: 0,
|
|
16
|
+
bottom: 0,
|
|
17
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
zIndex: 999,
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
backgroundColor: colors.background,
|
|
24
|
+
borderRadius: radius,
|
|
25
|
+
padding: 24,
|
|
26
|
+
maxWidth: 400,
|
|
27
|
+
width: "90%",
|
|
28
|
+
shadowColor: "#000",
|
|
29
|
+
shadowOffset: { width: 0, height: 2 },
|
|
30
|
+
shadowOpacity: 0.25,
|
|
31
|
+
shadowRadius: 8,
|
|
32
|
+
elevation: 5,
|
|
33
|
+
position: "absolute",
|
|
34
|
+
top: "50%",
|
|
35
|
+
left: "50%",
|
|
36
|
+
transform: [{ translateX: "-50%" }, { translateY: "-50%" }],
|
|
37
|
+
borderWidth: 1,
|
|
38
|
+
borderColor: colors.border,
|
|
39
|
+
zIndex: 1000,
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
fontSize: fontSize * 1.25,
|
|
43
|
+
fontWeight: "600",
|
|
44
|
+
color: colors.foreground,
|
|
45
|
+
fontFamily,
|
|
46
|
+
marginBottom: 8,
|
|
47
|
+
},
|
|
48
|
+
description: {
|
|
49
|
+
fontSize,
|
|
50
|
+
color: colors.mutedForeground,
|
|
51
|
+
fontFamily,
|
|
52
|
+
lineHeight: fontSize * 1.5,
|
|
53
|
+
},
|
|
54
|
+
footer: {
|
|
55
|
+
flexDirection: "row",
|
|
56
|
+
justifyContent: "flex-end",
|
|
57
|
+
gap: s.gap,
|
|
58
|
+
marginTop: 24,
|
|
59
|
+
},
|
|
60
|
+
cancel: {
|
|
61
|
+
height: s.height,
|
|
62
|
+
paddingHorizontal: s.paddingHorizontal,
|
|
63
|
+
borderRadius: radius,
|
|
64
|
+
borderWidth: 1,
|
|
65
|
+
borderColor: colors.border,
|
|
66
|
+
backgroundColor: colors.background,
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
},
|
|
70
|
+
cancelText: {
|
|
71
|
+
color: colors.foreground,
|
|
72
|
+
fontSize: s.fontSize,
|
|
73
|
+
fontWeight: "500",
|
|
74
|
+
fontFamily,
|
|
75
|
+
},
|
|
76
|
+
action: {
|
|
77
|
+
height: s.height,
|
|
78
|
+
paddingHorizontal: s.paddingHorizontal,
|
|
79
|
+
borderRadius: radius,
|
|
80
|
+
backgroundColor: colors.primary,
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
},
|
|
84
|
+
actionText: {
|
|
85
|
+
color: colors.primaryForeground,
|
|
86
|
+
fontSize: s.fontSize,
|
|
87
|
+
fontWeight: "500",
|
|
88
|
+
fontFamily,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
},
|
|
83
92
|
);
|
|
84
93
|
};
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
import { useOrganizedChildren } from "../../hooks/use-organized-children";
|
|
11
11
|
import { useComponentConfig } from "../../themes/provider";
|
|
12
12
|
import { mergeStyles } from "../../utils/calculate-styles";
|
|
13
|
+
import type { Size } from "../../utils/size-scale";
|
|
13
14
|
import type { ButtonState } from "./types";
|
|
14
15
|
import { ButtonVariants } from "./variants";
|
|
15
16
|
|
|
16
17
|
export interface ButtonProps extends Omit<PressableProps, "disabled"> {
|
|
17
18
|
variant?: keyof typeof ButtonVariants;
|
|
19
|
+
size?: Size;
|
|
18
20
|
children?: React.ReactNode;
|
|
19
21
|
|
|
20
22
|
isDisabled?: boolean;
|
|
@@ -31,7 +33,7 @@ const calculateState = (props: ButtonProps, isHovered: boolean): ButtonState =>
|
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export function Button(props: ButtonProps) {
|
|
34
|
-
const variantStyles = ButtonVariants[props.variant ?? "default"]();
|
|
36
|
+
const variantStyles = ButtonVariants[props.variant ?? "default"](props.size ?? "md");
|
|
35
37
|
const componentConfig = useComponentConfig("button");
|
|
36
38
|
const [isHovered, setIsHovered] = useState(false);
|
|
37
39
|
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
|
+
import type { Size } from "../../../utils/size-scale";
|
|
3
4
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
5
|
import type { ButtonStyles } from "../types";
|
|
5
6
|
|
|
6
|
-
export const useButtonVariantDefault = (): ButtonStyles => {
|
|
7
|
-
return useThemedStyles(
|
|
8
|
-
|
|
7
|
+
export const useButtonVariantDefault = (size: Size): ButtonStyles => {
|
|
8
|
+
return useThemedStyles(({ colors, radius, fontFamily, sizeScale }): ButtonStyles => {
|
|
9
|
+
const sizeStyles = sizeScale(size);
|
|
10
|
+
|
|
11
|
+
return {
|
|
9
12
|
root: {
|
|
10
13
|
default: {
|
|
11
14
|
flexDirection: "row",
|
|
12
|
-
|
|
13
|
-
paddingHorizontal:
|
|
15
|
+
height: sizeStyles.height,
|
|
16
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
14
17
|
borderRadius: radius,
|
|
15
|
-
gap:
|
|
18
|
+
gap: sizeStyles.gap,
|
|
16
19
|
alignItems: "center",
|
|
17
20
|
justifyContent: "center",
|
|
18
21
|
backgroundColor: colors.primary,
|
|
@@ -35,14 +38,15 @@ export const useButtonVariantDefault = (): ButtonStyles => {
|
|
|
35
38
|
text: {
|
|
36
39
|
default: {
|
|
37
40
|
color: colors.primaryForeground,
|
|
38
|
-
fontSize,
|
|
41
|
+
fontSize: sizeStyles.fontSize,
|
|
39
42
|
fontFamily,
|
|
40
43
|
},
|
|
41
44
|
},
|
|
42
45
|
icon: {
|
|
43
46
|
default: {
|
|
44
47
|
color: colors.primaryForeground,
|
|
45
|
-
size:
|
|
48
|
+
size: sizeStyles.iconSize,
|
|
49
|
+
strokeWidth: sizeStyles.strokeWidth,
|
|
46
50
|
},
|
|
47
51
|
},
|
|
48
52
|
spinner: {
|
|
@@ -50,6 +54,6 @@ export const useButtonVariantDefault = (): ButtonStyles => {
|
|
|
50
54
|
color: colors.primaryForeground,
|
|
51
55
|
},
|
|
52
56
|
},
|
|
53
|
-
}
|
|
54
|
-
);
|
|
57
|
+
};
|
|
58
|
+
});
|
|
55
59
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
|
+
import type { Size } from "../../../utils/size-scale";
|
|
3
4
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
5
|
import type { ButtonStyles } from "../types";
|
|
5
6
|
|
|
6
|
-
export const useButtonVariantGhost = (): ButtonStyles => {
|
|
7
|
-
return useThemedStyles(
|
|
8
|
-
|
|
7
|
+
export const useButtonVariantGhost = (size: Size): ButtonStyles => {
|
|
8
|
+
return useThemedStyles(({ colors, radius, fontFamily, sizeScale }): ButtonStyles => {
|
|
9
|
+
const sizeStyles = sizeScale(size);
|
|
10
|
+
|
|
11
|
+
return {
|
|
9
12
|
root: {
|
|
10
13
|
default: {
|
|
11
14
|
flexDirection: "row",
|
|
12
|
-
|
|
13
|
-
paddingHorizontal:
|
|
15
|
+
height: sizeStyles.height,
|
|
16
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
14
17
|
borderRadius: radius,
|
|
15
|
-
gap:
|
|
18
|
+
gap: sizeStyles.gap,
|
|
16
19
|
alignItems: "center",
|
|
17
20
|
justifyContent: "center",
|
|
18
21
|
backgroundColor: "transparent",
|
|
@@ -33,7 +36,7 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
33
36
|
text: {
|
|
34
37
|
default: {
|
|
35
38
|
color: colors.foreground,
|
|
36
|
-
fontSize,
|
|
39
|
+
fontSize: sizeStyles.fontSize,
|
|
37
40
|
fontFamily,
|
|
38
41
|
},
|
|
39
42
|
disabled: {
|
|
@@ -46,7 +49,8 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
46
49
|
icon: {
|
|
47
50
|
default: {
|
|
48
51
|
color: colors.foreground,
|
|
49
|
-
size:
|
|
52
|
+
size: sizeStyles.iconSize,
|
|
53
|
+
strokeWidth: sizeStyles.strokeWidth,
|
|
50
54
|
},
|
|
51
55
|
disabled: {
|
|
52
56
|
color: colors.mutedForeground,
|
|
@@ -66,6 +70,6 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
66
70
|
color: colors.mutedForeground,
|
|
67
71
|
},
|
|
68
72
|
},
|
|
69
|
-
}
|
|
70
|
-
);
|
|
73
|
+
};
|
|
74
|
+
});
|
|
71
75
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
|
+
import type { Size } from "../../../utils/size-scale";
|
|
3
4
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
5
|
import type { ButtonStyles } from "../types";
|
|
5
6
|
|
|
6
|
-
export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
7
|
-
return useThemedStyles(
|
|
8
|
-
|
|
7
|
+
export const useButtonVariantSecondary = (size: Size): ButtonStyles => {
|
|
8
|
+
return useThemedStyles(({ colors, radius, fontFamily, sizeScale }): ButtonStyles => {
|
|
9
|
+
const sizeStyles = sizeScale(size);
|
|
10
|
+
|
|
11
|
+
return {
|
|
9
12
|
root: {
|
|
10
13
|
default: {
|
|
11
14
|
flexDirection: "row",
|
|
12
|
-
|
|
13
|
-
paddingHorizontal:
|
|
15
|
+
height: sizeStyles.height,
|
|
16
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
14
17
|
borderRadius: radius,
|
|
15
|
-
gap:
|
|
18
|
+
gap: sizeStyles.gap,
|
|
16
19
|
alignItems: "center",
|
|
17
20
|
justifyContent: "center",
|
|
18
21
|
borderWidth: 1,
|
|
@@ -35,7 +38,7 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
35
38
|
text: {
|
|
36
39
|
default: {
|
|
37
40
|
color: colors.secondaryForeground,
|
|
38
|
-
fontSize,
|
|
41
|
+
fontSize: sizeStyles.fontSize,
|
|
39
42
|
fontFamily,
|
|
40
43
|
},
|
|
41
44
|
disabled: {
|
|
@@ -48,7 +51,8 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
48
51
|
icon: {
|
|
49
52
|
default: {
|
|
50
53
|
color: colors.secondaryForeground,
|
|
51
|
-
size:
|
|
54
|
+
size: sizeStyles.iconSize,
|
|
55
|
+
strokeWidth: sizeStyles.strokeWidth,
|
|
52
56
|
},
|
|
53
57
|
disabled: {
|
|
54
58
|
color: colors.mutedForeground,
|
|
@@ -68,6 +72,6 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
68
72
|
color: colors.mutedForeground,
|
|
69
73
|
},
|
|
70
74
|
},
|
|
71
|
-
}
|
|
72
|
-
);
|
|
75
|
+
};
|
|
76
|
+
});
|
|
73
77
|
};
|
|
@@ -9,12 +9,14 @@ import {
|
|
|
9
9
|
import { DEFAULT_LAYOUT, DEFAULT_POSITION, type LayoutPosition } from "../../../hooks";
|
|
10
10
|
import { useComponentConfig } from "../../../themes/provider";
|
|
11
11
|
import { mergeStyles } from "../../../utils/calculate-styles";
|
|
12
|
+
import type { Size } from "../../../utils/size-scale";
|
|
12
13
|
import { ComboboxContext } from "../context";
|
|
13
14
|
import type { ComboboxState } from "../types";
|
|
14
15
|
import { ComboboxVariants } from "../variants";
|
|
15
16
|
|
|
16
17
|
export interface ComboboxRootProps {
|
|
17
18
|
variant?: keyof typeof ComboboxVariants;
|
|
19
|
+
size?: Size;
|
|
18
20
|
|
|
19
21
|
value?: string;
|
|
20
22
|
onChange?: (value: string) => void;
|
|
@@ -36,7 +38,7 @@ const calculateState = (props: ComboboxRootProps): ComboboxState => {
|
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export function ComboboxRoot(props: ComboboxRootProps) {
|
|
39
|
-
const variantStyles = ComboboxVariants[props.variant ?? "default"]();
|
|
41
|
+
const variantStyles = ComboboxVariants[props.variant ?? "default"](props.size ?? "md");
|
|
40
42
|
const globalStyles = useComponentConfig("combobox");
|
|
41
43
|
const mergedStyles = mergeStyles(variantStyles, globalStyles?.styles);
|
|
42
44
|
|