@korsolutions/ui 0.0.4 → 0.0.5

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.
Files changed (75) hide show
  1. package/dist/components/index.d.mts +84 -0
  2. package/dist/components/index.mjs +288 -0
  3. package/dist/index-Dafk8ZGv.d.mts +265 -0
  4. package/dist/index.d.mts +45 -0
  5. package/dist/index.mjs +11 -0
  6. package/dist/portal-DoPaAohb.mjs +61 -0
  7. package/dist/primitives/index.d.mts +2 -0
  8. package/dist/primitives/index.mjs +4 -0
  9. package/dist/primitives-BYUlEz2_.mjs +442 -0
  10. package/dist/themes-BrLbh9h6.mjs +86 -0
  11. package/package.json +20 -8
  12. package/src/components/button/button.tsx +24 -0
  13. package/src/components/button/variants/default.tsx +52 -0
  14. package/src/components/button/variants/index.ts +5 -0
  15. package/src/components/card/card.tsx +26 -0
  16. package/src/components/card/variants/default.tsx +38 -0
  17. package/src/components/card/variants/index.ts +5 -0
  18. package/src/components/field/field.tsx +27 -0
  19. package/src/components/field/variants/default.tsx +29 -0
  20. package/src/components/field/variants/index.ts +5 -0
  21. package/src/components/index.ts +5 -0
  22. package/src/components/input/input.tsx +14 -0
  23. package/src/components/input/variants/default.tsx +34 -0
  24. package/src/components/input/variants/index.ts +5 -0
  25. package/src/components/select/select.tsx +35 -0
  26. package/src/components/select/variants/default.tsx +81 -0
  27. package/src/components/select/variants/index.ts +5 -0
  28. package/src/index.tsx +13 -0
  29. package/src/primitives/button/button-context.tsx +5 -5
  30. package/src/primitives/button/button-label.tsx +7 -5
  31. package/src/primitives/button/button-root.tsx +12 -8
  32. package/src/primitives/button/button-spinner.tsx +14 -0
  33. package/src/primitives/button/index.ts +5 -3
  34. package/src/primitives/button/types.ts +6 -5
  35. package/src/primitives/card/card-body.tsx +1 -1
  36. package/src/primitives/card/card-footer.tsx +1 -1
  37. package/src/primitives/card/card-header.tsx +1 -1
  38. package/src/primitives/card/card-root.tsx +1 -1
  39. package/src/primitives/card/card-title.tsx +1 -1
  40. package/src/primitives/card/index.ts +1 -1
  41. package/src/primitives/field/context.ts +5 -19
  42. package/src/primitives/field/field-description.tsx +17 -0
  43. package/src/primitives/field/field-error.tsx +17 -0
  44. package/src/primitives/field/field-label.tsx +7 -3
  45. package/src/primitives/field/field-root.tsx +13 -59
  46. package/src/primitives/field/index.ts +9 -6
  47. package/src/primitives/field/types.ts +8 -7
  48. package/src/primitives/index.ts +0 -2
  49. package/src/primitives/input/index.ts +1 -1
  50. package/src/primitives/input/input.tsx +48 -13
  51. package/src/primitives/input/types.ts +2 -4
  52. package/src/primitives/select/context.ts +3 -3
  53. package/src/primitives/select/index.ts +2 -2
  54. package/src/primitives/select/select-content.tsx +2 -2
  55. package/src/primitives/select/select-option.tsx +27 -4
  56. package/src/primitives/select/select-overlay.tsx +1 -1
  57. package/src/primitives/select/select-root.tsx +13 -11
  58. package/src/primitives/select/select-trigger.tsx +3 -2
  59. package/src/primitives/select/select-value.tsx +4 -1
  60. package/src/primitives/select/types.ts +3 -1
  61. package/src/themes/default/colors.ts +45 -0
  62. package/src/themes/default/index.ts +11 -0
  63. package/src/themes/index.ts +2 -0
  64. package/src/themes/provider.tsx +56 -0
  65. package/src/themes/themes.ts +6 -0
  66. package/src/themes/types.ts +30 -0
  67. package/src/utils/hsla-utils.ts +10 -0
  68. package/src/utils/use-themed-styles.ts +13 -0
  69. package/tsconfig.json +8 -0
  70. package/tsdown.config.ts +8 -0
  71. package/src/composites/card.tsx +0 -23
  72. package/src/composites/index.ts +0 -1
  73. package/src/index.ts +0 -1
  74. package/src/primitives/field/field-control.tsx +0 -29
  75. package/src/primitives/provider.tsx +0 -10
@@ -0,0 +1,13 @@
1
+ import { useTheme } from "@/themes";
2
+ import { Colors, FontFamily, Radius } from "@/themes/types";
3
+
4
+ interface CallbackProps {
5
+ colors: Colors;
6
+ radius: Radius;
7
+ fontFamily: FontFamily;
8
+ }
9
+
10
+ export const useThemedStyles = <T>(callback: (props: CallbackProps) => T): T => {
11
+ const theme = useTheme();
12
+ return callback({ colors: theme.colors, radius: theme.radius, fontFamily: theme.fontFamily });
13
+ };
package/tsconfig.json CHANGED
@@ -1,4 +1,12 @@
1
1
  {
2
2
  "extends": "expo/tsconfig.base",
3
+ "compilerOptions": {
4
+ "strict": true,
5
+ "noUnusedLocals": true,
6
+ "noUnusedParameters": true,
7
+ "paths": {
8
+ "@/*": ["./src/*"]
9
+ }
10
+ },
3
11
  "include": ["src/**/*"]
4
12
  }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ entry: ["./src/index.tsx", "./src/primitives/index.ts", "./src/components/index.ts"],
5
+ onSuccess() {
6
+ console.info("🙏 Build succeeded!");
7
+ },
8
+ });
@@ -1,23 +0,0 @@
1
- import React from "react";
2
- import { Card as CardPrimitive, CardStyles } from "../primitives/card";
3
-
4
- export interface CompositeCardProps {
5
- title?: string;
6
- footer?: React.ReactNode;
7
- children: React.ReactNode;
8
- styles?: CardStyles;
9
- }
10
-
11
- export function Card({ title, footer, children, styles }: CompositeCardProps) {
12
- return (
13
- <CardPrimitive.Root styles={styles}>
14
- {title && (
15
- <CardPrimitive.Header>
16
- <CardPrimitive.Title>{title}</CardPrimitive.Title>
17
- </CardPrimitive.Header>
18
- )}
19
- <CardPrimitive.Body>{children}</CardPrimitive.Body>
20
- {footer && <CardPrimitive.Footer>{footer}</CardPrimitive.Footer>}
21
- </CardPrimitive.Root>
22
- );
23
- }
@@ -1 +0,0 @@
1
- export * from "./card";
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./primitives";
@@ -1,29 +0,0 @@
1
- import React from "react";
2
- import { useField } from "./context";
3
- import { FieldRootProps } from "./field-root";
4
-
5
- interface FieldControlInjectedProps<TControlStyles> {
6
- value: FieldRootProps["value"];
7
- onChange: FieldRootProps["onChange"];
8
-
9
- onFocus?: () => void;
10
- onBlur?: () => void;
11
-
12
- styles?: TControlStyles;
13
- }
14
-
15
- export type FieldControlProps<T> = {
16
- render: (props: FieldControlInjectedProps<T>) => React.ReactElement;
17
- };
18
-
19
- export function FieldControl<T>(props: FieldControlProps<T>) {
20
- const { value, onChange, setFocused, state, styles } = useField<T>();
21
-
22
- const controlStyles = styles?.control;
23
- const composedStyles = controlStyles ? { ...controlStyles.default, ...controlStyles[state] } : undefined;
24
-
25
- const Component = props.render;
26
- return (
27
- <Component value={value} onChange={onChange} onBlur={() => setFocused(false)} onFocus={() => setFocused(true)} styles={composedStyles as T} />
28
- );
29
- }
@@ -1,10 +0,0 @@
1
- import { PortalHost } from "./portal";
2
-
3
- export const UniversalUIProvider = ({ children }: { children: React.ReactNode }) => {
4
- return (
5
- <>
6
- {children}
7
- <PortalHost />
8
- </>
9
- );
10
- };