@korsolutions/ui 0.0.34 → 0.0.36
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/dist/module/components/checkbox/checkbox.js +36 -0
- package/dist/module/components/checkbox/checkbox.js.map +1 -0
- package/dist/module/components/checkbox/index.js +5 -0
- package/dist/module/components/checkbox/index.js.map +1 -0
- package/dist/module/components/checkbox/variants/default.js +70 -0
- package/dist/module/components/checkbox/variants/default.js.map +1 -0
- package/dist/module/components/checkbox/variants/index.js +9 -0
- package/dist/module/components/checkbox/variants/index.js.map +1 -0
- package/dist/module/components/checkbox/variants/outlined.js +85 -0
- package/dist/module/components/checkbox/variants/outlined.js.map +1 -0
- package/dist/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/tabs/tabs.js +7 -7
- package/dist/module/components/tabs/tabs.js.map +1 -1
- package/dist/module/primitives/checkbox/checkbox-context.js +12 -0
- package/dist/module/primitives/checkbox/checkbox-context.js.map +1 -0
- package/dist/module/primitives/checkbox/checkbox-description.js +24 -0
- package/dist/module/primitives/checkbox/checkbox-description.js.map +1 -0
- package/dist/module/primitives/checkbox/checkbox-indicator.js +38 -0
- package/dist/module/primitives/checkbox/checkbox-indicator.js.map +1 -0
- package/dist/module/primitives/checkbox/checkbox-root.js +56 -0
- package/dist/module/primitives/checkbox/checkbox-root.js.map +1 -0
- package/dist/module/primitives/checkbox/checkbox-title.js +24 -0
- package/dist/module/primitives/checkbox/checkbox-title.js.map +1 -0
- package/dist/module/primitives/checkbox/index.js +14 -0
- package/dist/module/primitives/checkbox/index.js.map +1 -0
- package/dist/module/primitives/checkbox/types.js +4 -0
- package/dist/module/primitives/checkbox/types.js.map +1 -0
- package/dist/module/primitives/index.js +1 -0
- package/dist/module/primitives/index.js.map +1 -1
- package/dist/module/primitives/tabs/index.js +1 -1
- package/dist/module/primitives/tabs/index.js.map +1 -1
- package/dist/module/primitives/tabs/tabs-context.js +2 -2
- package/dist/module/primitives/tabs/tabs-context.js.map +1 -1
- package/dist/module/primitives/tabs/tabs-root.js +5 -5
- package/dist/module/primitives/tabs/tabs-root.js.map +1 -1
- package/dist/module/primitives/tabs/tabs-trigger-text.js.map +1 -1
- package/dist/module/primitives/tabs/tabs-trigger.js +2 -2
- package/dist/module/primitives/tabs/tabs-trigger.js.map +1 -1
- package/dist/typescript/src/components/checkbox/checkbox.d.ts +13 -0
- package/dist/typescript/src/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/typescript/src/components/checkbox/index.d.ts +3 -0
- package/dist/typescript/src/components/checkbox/index.d.ts.map +1 -0
- package/dist/typescript/src/components/checkbox/variants/default.d.ts +3 -0
- package/dist/typescript/src/components/checkbox/variants/default.d.ts.map +1 -0
- package/dist/typescript/src/components/checkbox/variants/index.d.ts +5 -0
- package/dist/typescript/src/components/checkbox/variants/index.d.ts.map +1 -0
- package/dist/typescript/src/components/checkbox/variants/outlined.d.ts +3 -0
- package/dist/typescript/src/components/checkbox/variants/outlined.d.ts.map +1 -0
- package/dist/typescript/src/components/index.d.ts +1 -0
- package/dist/typescript/src/components/index.d.ts.map +1 -1
- package/dist/typescript/src/components/tabs/tabs.d.ts +8 -8
- package/dist/typescript/src/components/tabs/tabs.d.ts.map +1 -1
- package/dist/typescript/src/primitives/checkbox/checkbox-context.d.ts +11 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-context.d.ts.map +1 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-description.d.ts +8 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-description.d.ts.map +1 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-indicator.d.ts +7 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-indicator.d.ts.map +1 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-root.d.ts +13 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-root.d.ts.map +1 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-title.d.ts +8 -0
- package/dist/typescript/src/primitives/checkbox/checkbox-title.d.ts.map +1 -0
- package/dist/typescript/src/primitives/checkbox/index.d.ts +16 -0
- package/dist/typescript/src/primitives/checkbox/index.d.ts.map +1 -0
- package/dist/typescript/src/primitives/checkbox/types.d.ts +10 -0
- package/dist/typescript/src/primitives/checkbox/types.d.ts.map +1 -0
- package/dist/typescript/src/primitives/index.d.ts +1 -0
- package/dist/typescript/src/primitives/index.d.ts.map +1 -1
- package/dist/typescript/src/primitives/tabs/index.d.ts +2 -2
- package/dist/typescript/src/primitives/tabs/tabs-context.d.ts +1 -1
- package/dist/typescript/src/primitives/tabs/tabs-context.d.ts.map +1 -1
- package/dist/typescript/src/primitives/tabs/tabs-list.d.ts +1 -1
- package/dist/typescript/src/primitives/tabs/tabs-root.d.ts +2 -2
- package/dist/typescript/src/primitives/tabs/tabs-root.d.ts.map +1 -1
- package/dist/typescript/src/primitives/tabs/tabs-trigger-text.d.ts +1 -1
- package/dist/typescript/src/primitives/tabs/tabs-trigger-text.d.ts.map +1 -1
- package/dist/typescript/src/primitives/tabs/tabs-trigger.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/checkbox/checkbox.tsx +32 -0
- package/src/components/checkbox/index.ts +2 -0
- package/src/components/checkbox/variants/default.tsx +66 -0
- package/src/components/checkbox/variants/index.ts +7 -0
- package/src/components/checkbox/variants/outlined.tsx +82 -0
- package/src/components/index.ts +1 -0
- package/src/components/tabs/tabs.tsx +15 -15
- package/src/primitives/checkbox/checkbox-context.tsx +19 -0
- package/src/primitives/checkbox/checkbox-description.tsx +21 -0
- package/src/primitives/checkbox/checkbox-indicator.tsx +34 -0
- package/src/primitives/checkbox/checkbox-root.tsx +66 -0
- package/src/primitives/checkbox/checkbox-title.tsx +21 -0
- package/src/primitives/checkbox/index.ts +17 -0
- package/src/primitives/checkbox/types.ts +11 -0
- package/src/primitives/index.ts +1 -0
- package/src/primitives/tabs/index.ts +2 -2
- package/src/primitives/tabs/tabs-context.tsx +3 -3
- package/src/primitives/tabs/tabs-list.tsx +1 -1
- package/src/primitives/tabs/tabs-root.tsx +7 -7
- package/src/primitives/tabs/tabs-trigger-text.tsx +2 -6
- package/src/primitives/tabs/tabs-trigger.tsx +5 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Pressable","useTabsContext","jsx","_jsx","calculateState","isActive","isDisabled","TabsTrigger","props","children","value","triggerValue","style","pressableProps","
|
|
1
|
+
{"version":3,"names":["React","Pressable","useTabsContext","jsx","_jsx","calculateState","isActive","isDisabled","TabsTrigger","props","children","value","triggerValue","style","pressableProps","onChange","styles","state","handlePress","calculatedStyle","trigger","default","disabled","onPress"],"sourceRoot":"../../../../src","sources":["primitives/tabs/tabs-trigger.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAA6D,cAAc;AAC7F,SAASC,cAAc;AAAyB,SAAAC,GAAA,IAAAC,IAAA;AAUhD,MAAMC,cAAc,GAAGA,CAACC,QAAiB,EAAEC,UAA+B,KAAgB;EACxF,IAAIA,UAAU,EAAE;IACd,OAAO,UAAU;EACnB;EACA,IAAID,QAAQ,EAAE;IACZ,OAAO,QAAQ;EACjB;EACA,OAAO,SAAS;AAClB,CAAC;AAED,OAAO,SAASE,WAAWA,CAACC,KAAgC,EAAE;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,KAAK,EAAEC,YAAY;IAAEL,UAAU;IAAEM,KAAK;IAAE,GAAGC;EAAe,CAAC,GAAGL,KAAK;EACrF,MAAM;IAAEE,KAAK;IAAEI,QAAQ;IAAEC;EAAO,CAAC,GAAGd,cAAc,CAAC,CAAC;EAEpD,MAAMI,QAAQ,GAAGK,KAAK,KAAKC,YAAY;EACvC,MAAMK,KAAK,GAAGZ,cAAc,CAACC,QAAQ,EAAEC,UAAU,CAAC;EAElD,MAAMW,WAAW,GAAGA,CAAA,KAAM;IACxB,IAAI,CAACX,UAAU,EAAE;MACfQ,QAAQ,CAACH,YAAY,CAAC;IACxB;EACF,CAAC;EAED,MAAMO,eAAe,GAAG,CAACH,MAAM,EAAEI,OAAO,EAAEC,OAAO,EAAEL,MAAM,EAAEI,OAAO,GAAGH,KAAK,CAAC,EAAEJ,KAAK,CAAC;EAEnF,oBACET,IAAA,CAACH,SAAS;IAAA,GAAKa,cAAc;IAAEQ,QAAQ,EAAEf,UAAW;IAACgB,OAAO,EAAEL,WAAY;IAACL,KAAK,EAAEM,eAAgB;IAAAT,QAAA,EAC/FA;EAAQ,CACA,CAAC;AAEhB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CheckboxVariants } from "./variants";
|
|
3
|
+
interface CheckboxProps {
|
|
4
|
+
checked: boolean;
|
|
5
|
+
onChange: (checked: boolean) => void;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
variant?: keyof typeof CheckboxVariants;
|
|
10
|
+
}
|
|
11
|
+
export declare function Checkbox(props: CheckboxProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,UAAU,aAAa;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,OAAO,gBAAgB,CAAC;CACzC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAiB5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/checkbox/variants/default.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,yBAAyB,QAAO,cA8D5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/checkbox/variants/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlined.d.ts","sourceRoot":"","sources":["../../../../../../src/components/checkbox/variants/outlined.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,0BAA0B,QAAO,cA8E7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TabsVariants } from "./variants";
|
|
3
|
-
export interface Tab {
|
|
4
|
-
value:
|
|
3
|
+
export interface Tab<T> {
|
|
4
|
+
value: T;
|
|
5
5
|
label: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
}
|
|
8
|
-
interface TabsProps {
|
|
9
|
-
tabs: Tab[];
|
|
10
|
-
defaultValue?:
|
|
11
|
-
value?:
|
|
12
|
-
|
|
8
|
+
interface TabsProps<T> {
|
|
9
|
+
tabs: Tab<T>[];
|
|
10
|
+
defaultValue?: T;
|
|
11
|
+
value?: T;
|
|
12
|
+
onChange?: (value: T) => void;
|
|
13
13
|
variant?: keyof typeof TabsVariants;
|
|
14
14
|
}
|
|
15
|
-
export declare function Tabs(props: TabsProps): React.JSX.Element;
|
|
15
|
+
export declare function Tabs<T>(props: TabsProps<T>): React.JSX.Element;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../../src/components/tabs/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../../src/components/tabs/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,SAAS,CAAC,CAAC;IACnB,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC;CACrC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,qBA8B1C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CheckboxStyles, CheckboxState } from "./types";
|
|
3
|
+
export interface CheckboxPrimitiveContextValue {
|
|
4
|
+
checked: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
state: CheckboxState;
|
|
7
|
+
styles?: CheckboxStyles;
|
|
8
|
+
}
|
|
9
|
+
export declare const CheckboxPrimitiveContext: React.Context<CheckboxPrimitiveContextValue | null>;
|
|
10
|
+
export declare const useCheckboxContext: () => CheckboxPrimitiveContextValue;
|
|
11
|
+
//# sourceMappingURL=checkbox-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-context.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/checkbox/checkbox-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,eAAO,MAAM,wBAAwB,qDAAkE,CAAC;AAExG,eAAO,MAAM,kBAAkB,qCAM9B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type TextProps, type StyleProp, type TextStyle } from "react-native";
|
|
3
|
+
export interface CheckboxPrimitiveDescriptionProps extends TextProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
style?: StyleProp<TextStyle>;
|
|
6
|
+
}
|
|
7
|
+
export declare function CheckboxDescription(props: CheckboxPrimitiveDescriptionProps): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=checkbox-description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-description.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/checkbox/checkbox-description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpF,MAAM,WAAW,iCAAkC,SAAQ,SAAS;IAClE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iCAAiC,qBAW3E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StyleProp, type ViewProps, type ViewStyle } from "react-native";
|
|
3
|
+
export interface CheckboxPrimitiveIndicatorProps extends ViewProps {
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
|
+
}
|
|
6
|
+
export declare function CheckboxIndicator(props: CheckboxPrimitiveIndicatorProps): React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=checkbox-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-indicator.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/checkbox/checkbox-indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1F,MAAM,WAAW,+BAAgC,SAAQ,SAAS;IAChE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAYD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,+BAA+B,qBAcvE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type PressableProps, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import type { CheckboxStyles } from "./types";
|
|
4
|
+
export interface CheckboxPrimitiveRootProps extends Omit<PressableProps, "children"> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
onChange: (checked: boolean) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
styles?: CheckboxStyles;
|
|
11
|
+
}
|
|
12
|
+
export declare function CheckboxRoot(props: CheckboxPrimitiveRootProps): React.JSX.Element;
|
|
13
|
+
//# sourceMappingURL=checkbox-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-root.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/checkbox/checkbox-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9F,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC;IAClF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAeD,wBAAgB,YAAY,CAAC,KAAK,EAAE,0BAA0B,qBAsC7D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type TextProps, type StyleProp, type TextStyle } from "react-native";
|
|
3
|
+
export interface CheckboxPrimitiveTitleProps extends TextProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
style?: StyleProp<TextStyle>;
|
|
6
|
+
}
|
|
7
|
+
export declare function CheckboxTitle(props: CheckboxPrimitiveTitleProps): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=checkbox-title.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-title.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/checkbox/checkbox-title.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpF,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,2BAA2B,qBAW/D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CheckboxRoot } from "./checkbox-root";
|
|
2
|
+
import { CheckboxIndicator } from "./checkbox-indicator";
|
|
3
|
+
import { CheckboxTitle } from "./checkbox-title";
|
|
4
|
+
import { CheckboxDescription } from "./checkbox-description";
|
|
5
|
+
export declare const CheckboxPrimitive: {
|
|
6
|
+
Root: typeof CheckboxRoot;
|
|
7
|
+
Indicator: typeof CheckboxIndicator;
|
|
8
|
+
Title: typeof CheckboxTitle;
|
|
9
|
+
Description: typeof CheckboxDescription;
|
|
10
|
+
};
|
|
11
|
+
export type { CheckboxPrimitiveRootProps } from "./checkbox-root";
|
|
12
|
+
export type { CheckboxPrimitiveIndicatorProps } from "./checkbox-indicator";
|
|
13
|
+
export type { CheckboxPrimitiveTitleProps } from "./checkbox-title";
|
|
14
|
+
export type { CheckboxPrimitiveDescriptionProps } from "./checkbox-description";
|
|
15
|
+
export * from "./types";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,eAAO,MAAM,iBAAiB;;;;;CAK7B,CAAC;AAEF,YAAY,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAClE,YAAY,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAC5E,YAAY,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AACpE,YAAY,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAChF,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
export type CheckboxState = "default" | "checked" | "disabled" | "hovered";
|
|
3
|
+
export interface CheckboxStyles {
|
|
4
|
+
root?: Partial<Record<CheckboxState, StyleProp<ViewStyle>>>;
|
|
5
|
+
indicator?: Partial<Record<CheckboxState, StyleProp<ViewStyle>>>;
|
|
6
|
+
checkmark?: Partial<Record<CheckboxState, StyleProp<TextStyle>>>;
|
|
7
|
+
title?: Partial<Record<CheckboxState, StyleProp<TextStyle>>>;
|
|
8
|
+
description?: Partial<Record<CheckboxState, StyleProp<TextStyle>>>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TabsRoot } from "./tabs-root";
|
|
2
1
|
import { TabsList } from "./tabs-list";
|
|
2
|
+
import { TabsRoot } from "./tabs-root";
|
|
3
3
|
import { TabsTrigger } from "./tabs-trigger";
|
|
4
4
|
import { TabsTriggerText } from "./tabs-trigger-text";
|
|
5
5
|
export declare const TabsPrimitive: {
|
|
@@ -8,8 +8,8 @@ export declare const TabsPrimitive: {
|
|
|
8
8
|
Trigger: typeof TabsTrigger;
|
|
9
9
|
TriggerText: typeof TabsTriggerText;
|
|
10
10
|
};
|
|
11
|
-
export type { TabsPrimitiveRootProps } from "./tabs-root";
|
|
12
11
|
export type { TabsPrimitiveListProps } from "./tabs-list";
|
|
12
|
+
export type { TabsPrimitiveRootProps } from "./tabs-root";
|
|
13
13
|
export type { TabsPrimitiveTriggerProps } from "./tabs-trigger";
|
|
14
14
|
export type { TabsPrimitiveTriggerTextProps } from "./tabs-trigger-text";
|
|
15
15
|
export * from "./types";
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import type { TabsStyles } from "./types";
|
|
3
3
|
export interface TabsPrimitiveContextValue {
|
|
4
4
|
value: string;
|
|
5
|
-
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
6
|
styles?: TabsStyles;
|
|
7
7
|
}
|
|
8
8
|
export declare const TabsPrimitiveContext: React.Context<TabsPrimitiveContextValue | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-context.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-context.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tabs-context.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,iDAA8D,CAAC;AAEhG,eAAO,MAAM,cAAc,iCAM1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type StyleProp, type ViewProps, type ViewStyle } from "react-native";
|
|
3
3
|
export interface TabsPrimitiveListProps extends ViewProps {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
style?: StyleProp<ViewStyle>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type StyleProp, type ViewProps, type ViewStyle } from "react-native";
|
|
3
3
|
import type { TabsStyles } from "./types";
|
|
4
4
|
export interface TabsPrimitiveRootProps extends Omit<ViewProps, "children"> {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
value: string;
|
|
7
|
-
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
8
|
style?: StyleProp<ViewStyle>;
|
|
9
9
|
styles?: TabsStyles;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-root.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-root.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tabs-root.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACzE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,sBAAsB,qBAmBrD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type StyleProp, type TextProps, type TextStyle } from "react-native";
|
|
3
3
|
export interface TabsPrimitiveTriggerTextProps extends TextProps {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-trigger-text.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-trigger-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpF,MAAM,WAAW,6BAA8B,SAAQ,SAAS;IAC9D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"tabs-trigger-text.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-trigger-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpF,MAAM,WAAW,6BAA8B,SAAQ,SAAS;IAC9D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,6BAA6B,qBAcnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-trigger.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9F,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"tabs-trigger.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/tabs/tabs-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9F,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAYD,wBAAgB,WAAW,CAAC,KAAK,EAAE,yBAAyB,qBAoB3D"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CheckboxPrimitive } from "@/primitives";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { CheckboxVariants } from "./variants";
|
|
5
|
+
|
|
6
|
+
interface CheckboxProps {
|
|
7
|
+
checked: boolean;
|
|
8
|
+
onChange: (checked: boolean) => void;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
variant?: keyof typeof CheckboxVariants;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Checkbox(props: CheckboxProps) {
|
|
16
|
+
const { checked, onChange, title, description, disabled, variant = "default" } = props;
|
|
17
|
+
|
|
18
|
+
const useVariantStyles = CheckboxVariants[variant];
|
|
19
|
+
const variantStyles = useVariantStyles();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<CheckboxPrimitive.Root checked={checked} onChange={onChange} disabled={disabled} styles={variantStyles}>
|
|
23
|
+
<CheckboxPrimitive.Indicator />
|
|
24
|
+
{(title || description) && (
|
|
25
|
+
<View style={{ flex: 1 }}>
|
|
26
|
+
{title && <CheckboxPrimitive.Title>{title}</CheckboxPrimitive.Title>}
|
|
27
|
+
{description && <CheckboxPrimitive.Description>{description}</CheckboxPrimitive.Description>}
|
|
28
|
+
</View>
|
|
29
|
+
)}
|
|
30
|
+
</CheckboxPrimitive.Root>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type CheckboxStyles } from "@/primitives";
|
|
2
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
3
|
+
|
|
4
|
+
export const useCheckboxVariantDefault = (): CheckboxStyles => {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): CheckboxStyles => ({
|
|
7
|
+
root: {
|
|
8
|
+
default: {
|
|
9
|
+
flexDirection: "row",
|
|
10
|
+
alignItems: "flex-start",
|
|
11
|
+
gap: 12,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
indicator: {
|
|
15
|
+
default: {
|
|
16
|
+
width: 20,
|
|
17
|
+
height: 20,
|
|
18
|
+
borderRadius: radius / 2,
|
|
19
|
+
borderWidth: 2,
|
|
20
|
+
borderColor: colors.border,
|
|
21
|
+
backgroundColor: colors.background,
|
|
22
|
+
marginTop: 2,
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
},
|
|
26
|
+
checked: {
|
|
27
|
+
backgroundColor: colors.primary,
|
|
28
|
+
borderColor: colors.primary,
|
|
29
|
+
},
|
|
30
|
+
disabled: {
|
|
31
|
+
opacity: 0.5,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
checkmark: {
|
|
35
|
+
default: {
|
|
36
|
+
color: colors.primaryForeground,
|
|
37
|
+
fontSize: 14,
|
|
38
|
+
fontWeight: "bold",
|
|
39
|
+
lineHeight: 16,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
title: {
|
|
43
|
+
default: {
|
|
44
|
+
color: colors.foreground,
|
|
45
|
+
fontSize,
|
|
46
|
+
fontFamily,
|
|
47
|
+
fontWeight: "500",
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
color: colors.mutedForeground,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
description: {
|
|
54
|
+
default: {
|
|
55
|
+
color: colors.mutedForeground,
|
|
56
|
+
fontSize: fontSize * 0.875,
|
|
57
|
+
fontFamily,
|
|
58
|
+
marginTop: 2,
|
|
59
|
+
},
|
|
60
|
+
disabled: {
|
|
61
|
+
opacity: 0.7,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type CheckboxStyles } from "@/primitives";
|
|
2
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
3
|
+
|
|
4
|
+
export const useCheckboxVariantOutlined = (): CheckboxStyles => {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): CheckboxStyles => ({
|
|
7
|
+
root: {
|
|
8
|
+
default: {
|
|
9
|
+
flexDirection: "row",
|
|
10
|
+
alignItems: "flex-start",
|
|
11
|
+
gap: 12,
|
|
12
|
+
borderWidth: 1,
|
|
13
|
+
borderColor: colors.border,
|
|
14
|
+
borderRadius: radius,
|
|
15
|
+
padding: 16,
|
|
16
|
+
backgroundColor: colors.background,
|
|
17
|
+
},
|
|
18
|
+
hovered: {
|
|
19
|
+
backgroundColor: colors.muted,
|
|
20
|
+
borderColor: colors.primary,
|
|
21
|
+
},
|
|
22
|
+
checked: {
|
|
23
|
+
borderColor: colors.primary,
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
opacity: 0.5,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
indicator: {
|
|
30
|
+
default: {
|
|
31
|
+
width: 20,
|
|
32
|
+
height: 20,
|
|
33
|
+
borderRadius: radius / 2,
|
|
34
|
+
borderWidth: 2,
|
|
35
|
+
borderColor: colors.border,
|
|
36
|
+
backgroundColor: colors.background,
|
|
37
|
+
marginTop: 2,
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
},
|
|
41
|
+
checked: {
|
|
42
|
+
backgroundColor: colors.primary,
|
|
43
|
+
borderColor: colors.primary,
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
disabled: {
|
|
47
|
+
opacity: 0.5,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
checkmark: {
|
|
51
|
+
default: {
|
|
52
|
+
color: colors.primaryForeground,
|
|
53
|
+
fontSize: 14,
|
|
54
|
+
fontWeight: "bold",
|
|
55
|
+
lineHeight: 16,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
title: {
|
|
59
|
+
default: {
|
|
60
|
+
color: colors.foreground,
|
|
61
|
+
fontSize,
|
|
62
|
+
fontFamily,
|
|
63
|
+
fontWeight: "500",
|
|
64
|
+
},
|
|
65
|
+
disabled: {
|
|
66
|
+
color: colors.mutedForeground,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
description: {
|
|
70
|
+
default: {
|
|
71
|
+
color: colors.mutedForeground,
|
|
72
|
+
fontSize: fontSize * 0.875,
|
|
73
|
+
fontFamily,
|
|
74
|
+
marginTop: 2,
|
|
75
|
+
},
|
|
76
|
+
disabled: {
|
|
77
|
+
opacity: 0.7,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -2,43 +2,43 @@ import { TabsPrimitive } from "@/primitives";
|
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { TabsVariants } from "./variants";
|
|
4
4
|
|
|
5
|
-
export interface Tab {
|
|
6
|
-
value:
|
|
5
|
+
export interface Tab<T> {
|
|
6
|
+
value: T;
|
|
7
7
|
label: string;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
interface TabsProps {
|
|
12
|
-
tabs: Tab[];
|
|
13
|
-
defaultValue?:
|
|
14
|
-
value?:
|
|
15
|
-
|
|
11
|
+
interface TabsProps<T> {
|
|
12
|
+
tabs: Tab<T>[];
|
|
13
|
+
defaultValue?: T;
|
|
14
|
+
value?: T;
|
|
15
|
+
onChange?: (value: T) => void;
|
|
16
16
|
variant?: keyof typeof TabsVariants;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function Tabs(props: TabsProps) {
|
|
20
|
-
const { tabs, defaultValue, value: controlledValue,
|
|
19
|
+
export function Tabs<T>(props: TabsProps<T>) {
|
|
20
|
+
const { tabs, defaultValue, value: controlledValue, onChange, variant = "default" } = props;
|
|
21
21
|
|
|
22
|
-
const initialValue = defaultValue ?? tabs[0]?.value ?? "";
|
|
22
|
+
const initialValue = defaultValue ?? tabs[0]?.value ?? ("" as T);
|
|
23
23
|
const [uncontrolledValue, setUncontrolledValue] = useState(initialValue);
|
|
24
24
|
const value = controlledValue ?? uncontrolledValue;
|
|
25
25
|
|
|
26
|
-
const handleValueChange = (newValue:
|
|
26
|
+
const handleValueChange = (newValue: T) => {
|
|
27
27
|
if (controlledValue === undefined) {
|
|
28
28
|
setUncontrolledValue(newValue);
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
onChange?.(newValue);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const useVariantStyles = TabsVariants[variant];
|
|
34
34
|
const variantStyles = useVariantStyles();
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
|
-
<TabsPrimitive.Root value={value}
|
|
37
|
+
<TabsPrimitive.Root value={String(value)} onChange={(newValue) => handleValueChange(newValue as T)} styles={variantStyles}>
|
|
38
38
|
<TabsPrimitive.List>
|
|
39
39
|
{tabs.map((tab) => (
|
|
40
|
-
<TabsPrimitive.Trigger key={tab.value} value={tab.value} isDisabled={tab.disabled}>
|
|
41
|
-
<TabsPrimitive.TriggerText value={tab.value} isDisabled={tab.disabled}>
|
|
40
|
+
<TabsPrimitive.Trigger key={String(tab.value)} value={String(tab.value)} isDisabled={tab.disabled}>
|
|
41
|
+
<TabsPrimitive.TriggerText value={String(tab.value)} isDisabled={tab.disabled}>
|
|
42
42
|
{tab.label}
|
|
43
43
|
</TabsPrimitive.TriggerText>
|
|
44
44
|
</TabsPrimitive.Trigger>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CheckboxStyles, CheckboxState } from "./types";
|
|
3
|
+
|
|
4
|
+
export interface CheckboxPrimitiveContextValue {
|
|
5
|
+
checked: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
state: CheckboxState;
|
|
8
|
+
styles?: CheckboxStyles;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const CheckboxPrimitiveContext = React.createContext<CheckboxPrimitiveContextValue | null>(null);
|
|
12
|
+
|
|
13
|
+
export const useCheckboxContext = () => {
|
|
14
|
+
const context = React.useContext(CheckboxPrimitiveContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error("Checkbox compound components must be used within CheckboxPrimitive.Root");
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
};
|