@pickle-ui/react-native 0.0.0-stage → 0.0.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.
Files changed (80) hide show
  1. package/README.md +92 -2
  2. package/dist/components/Badge.d.ts +11 -0
  3. package/dist/components/Badge.d.ts.map +1 -0
  4. package/dist/components/Badge.js +33 -0
  5. package/dist/components/Badge.js.map +1 -0
  6. package/dist/components/Button.d.ts +13 -0
  7. package/dist/components/Button.d.ts.map +1 -0
  8. package/dist/components/Button.js +39 -0
  9. package/dist/components/Button.js.map +1 -0
  10. package/dist/components/Card.d.ts +20 -0
  11. package/dist/components/Card.d.ts.map +1 -0
  12. package/dist/components/Card.js +29 -0
  13. package/dist/components/Card.js.map +1 -0
  14. package/dist/components/Text.d.ts +10 -0
  15. package/dist/components/Text.d.ts.map +1 -0
  16. package/dist/components/Text.js +28 -0
  17. package/dist/components/Text.js.map +1 -0
  18. package/dist/entries/badge.d.ts +3 -0
  19. package/dist/entries/badge.d.ts.map +1 -0
  20. package/dist/entries/badge.js +2 -0
  21. package/dist/entries/badge.js.map +1 -0
  22. package/dist/entries/button.d.ts +3 -0
  23. package/dist/entries/button.d.ts.map +1 -0
  24. package/dist/entries/button.js +2 -0
  25. package/dist/entries/button.js.map +1 -0
  26. package/dist/entries/card.d.ts +3 -0
  27. package/dist/entries/card.d.ts.map +1 -0
  28. package/dist/entries/card.js +2 -0
  29. package/dist/entries/card.js.map +1 -0
  30. package/dist/entries/cn.d.ts +2 -0
  31. package/dist/entries/cn.d.ts.map +1 -0
  32. package/dist/entries/cn.js +2 -0
  33. package/dist/entries/cn.js.map +1 -0
  34. package/dist/entries/text.d.ts +3 -0
  35. package/dist/entries/text.d.ts.map +1 -0
  36. package/dist/entries/text.js +2 -0
  37. package/dist/entries/text.js.map +1 -0
  38. package/dist/entries/use-color-token.d.ts +2 -0
  39. package/dist/entries/use-color-token.d.ts.map +1 -0
  40. package/dist/entries/use-color-token.js +2 -0
  41. package/dist/entries/use-color-token.js.map +1 -0
  42. package/dist/hooks/useColorToken.d.ts +9 -0
  43. package/dist/hooks/useColorToken.d.ts.map +1 -0
  44. package/dist/hooks/useColorToken.js +13 -0
  45. package/dist/hooks/useColorToken.js.map +1 -0
  46. package/dist/index.d.ts +7 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +9 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/lib/cn.d.ts +3 -0
  51. package/dist/lib/cn.d.ts.map +1 -0
  52. package/dist/lib/cn.js +6 -0
  53. package/dist/lib/cn.js.map +1 -0
  54. package/package.json +91 -3
  55. package/src/base.css +6 -0
  56. package/src/components/Badge.stories.tsx +47 -0
  57. package/src/components/Badge.test.tsx +11 -0
  58. package/src/components/Badge.tsx +42 -0
  59. package/src/components/Button.stories.tsx +87 -0
  60. package/src/components/Button.test.tsx +34 -0
  61. package/src/components/Button.tsx +70 -0
  62. package/src/components/Card.stories.tsx +55 -0
  63. package/src/components/Card.test.tsx +23 -0
  64. package/src/components/Card.tsx +55 -0
  65. package/src/components/Text.stories.tsx +60 -0
  66. package/src/components/Text.test.tsx +15 -0
  67. package/src/components/Text.tsx +37 -0
  68. package/src/components/_internal/Story.tsx +148 -0
  69. package/src/entries/badge.ts +2 -0
  70. package/src/entries/button.ts +2 -0
  71. package/src/entries/card.ts +8 -0
  72. package/src/entries/cn.ts +1 -0
  73. package/src/entries/text.ts +2 -0
  74. package/src/entries/use-color-token.ts +1 -0
  75. package/src/hooks/useColorToken.ts +13 -0
  76. package/src/index.ts +8 -0
  77. package/src/lib/cn.test.ts +9 -0
  78. package/src/lib/cn.ts +6 -0
  79. package/src/styles.css +12 -0
  80. package/src/uniwind-types.d.ts +10 -0
@@ -0,0 +1,2 @@
1
+ export { Badge } from '../components/Badge';
2
+ export type { BadgeProps } from '../components/Badge';
@@ -0,0 +1,2 @@
1
+ export { Button } from '../components/Button';
2
+ export type { ButtonProps } from '../components/Button';
@@ -0,0 +1,8 @@
1
+ export { Card } from '../components/Card';
2
+ export type {
3
+ CardContentProps,
4
+ CardDescriptionProps,
5
+ CardHeaderProps,
6
+ CardProps,
7
+ CardTitleProps,
8
+ } from '../components/Card';
@@ -0,0 +1 @@
1
+ export { cn } from '../lib/cn';
@@ -0,0 +1,2 @@
1
+ export { Text } from '../components/Text';
2
+ export type { TextProps } from '../components/Text';
@@ -0,0 +1 @@
1
+ export { useColorToken } from '../hooks/useColorToken';
@@ -0,0 +1,13 @@
1
+ import { useCSSVariable } from 'uniwind';
2
+
3
+ /**
4
+ * Reads a token as a color string, for props that take a color instead of a
5
+ * className (navigation options, `Switch`, `placeholderTextColor`).
6
+ * `useColorToken('primary')` returns the value behind `bg-primary`, or
7
+ * `undefined` when the token doesn't exist, so a typo never turns into the
8
+ * color `"undefined"`.
9
+ */
10
+ export function useColorToken(name: string): string | undefined {
11
+ const value = useCSSVariable(`--${name}`);
12
+ return typeof value === 'string' ? value : undefined;
13
+ }
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ // The public API is the union of the subpath entries in ./entries: add a
2
+ // component there and re-export it here (see "Public API" in AGENTS.md).
3
+ export * from './entries/badge';
4
+ export * from './entries/button';
5
+ export * from './entries/card';
6
+ export * from './entries/cn';
7
+ export * from './entries/text';
8
+ export * from './entries/use-color-token';
@@ -0,0 +1,9 @@
1
+ import { cn } from './cn';
2
+
3
+ describe('cn', () => {
4
+ it('drops falsy values and lets later classes win', () => {
5
+ expect(cn('px-2 text-sm', false, null, undefined, 'px-4')).toBe(
6
+ 'text-sm px-4',
7
+ );
8
+ });
9
+ });
package/src/lib/cn.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { twMerge } from 'tailwind-merge';
2
+
3
+ /** Joins class names; later classes win, like `@pickle-ui/react/cn`. */
4
+ export function cn(...classes: Array<false | null | string | undefined>) {
5
+ return twMerge(classes.filter(Boolean).join(' '));
6
+ }
package/src/styles.css ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Pickle for React Native: Tailwind, Uniwind, the tokens as Uniwind themes
3
+ * and the components' classes. Apps import this file alone.
4
+ *
5
+ * Tailwind and Uniwind come from here, not from the app: Uniwind compiles
6
+ * each imported stylesheet on its own to find themes, and the tokens'
7
+ * `@variant light` / `@variant dark` blocks only compile after both.
8
+ */
9
+ @import 'tailwindcss';
10
+ @import 'uniwind';
11
+ @import '@pickle-ui/tokens/native.css';
12
+ @import './base.css';
@@ -0,0 +1,10 @@
1
+ // NOTE: This file is generated by uniwind and it should not be edited manually.
2
+ /// <reference types="uniwind/types" />
3
+
4
+ declare module 'uniwind' {
5
+ export interface UniwindConfig {
6
+ themes: readonly ['light', 'dark']
7
+ }
8
+ }
9
+
10
+ export {}