npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fleet-ui/components

v0.1.0

Published

Cross-platform UI components for Fleet UI

Readme

@fleet-ui/components

Cross-platform UI components for React and React Native, built with React Native Unistyles.

Installation

npm install @my-sdk/components
# or
pnpm add @my-sdk/components

Peer Dependencies

Make sure you have these installed:

npm install react react-native react-native-unistyles

Usage

import { Button, Input } from '@my-sdk/components';

function MyApp() {
  return (
    <View>
      <Button onPress={() => console.log('pressed')}>
        Click me
      </Button>
      <Input placeholder="Enter text" />
    </View>
  );
}

Adding New Components

Follow this structure when adding a new component:

1. Create Component Directory

src/ComponentName/
├── ComponentName.tsx           # Shared types and logic
├── ComponentName.native.tsx    # React Native implementation
├── ComponentName.web.tsx       # Web implementation
├── ComponentName.test.tsx      # Unit tests
└── index.ts                    # Exports

2. Example Component Structure

ComponentName.tsx (Shared)

import type { ViewStyle } from 'react-native';
import type { BaseComponentProps } from '@my-sdk/shared';

export interface ComponentNameProps extends BaseComponentProps {
  variant?: 'primary' | 'secondary';
  size?: 'sm' | 'md' | 'lg';
  onPress?: () => void;
  children: React.ReactNode;
}

// Shared logic, utilities, or constants
export const COMPONENT_CONSTANTS = {
  // ...
};

ComponentName.native.tsx (React Native)

import React from 'react';
import { Pressable, Text } from 'react-native';
import { createStyleSheet, useStyles } from 'react-native-unistyles';
import type { ComponentNameProps } from './ComponentName';

export const ComponentName: React.FC<ComponentNameProps> = ({
  variant = 'primary',
  size = 'md',
  onPress,
  children,
  testID,
}) => {
  const { styles } = useStyles(stylesheet, { variant, size });

  return (
    <Pressable style={styles.container} onPress={onPress} testID={testID}>
      <Text style={styles.text}>{children}</Text>
    </Pressable>
  );
};

const stylesheet = createStyleSheet((theme) => ({
  container: {
    backgroundColor: theme.colors.primary,
    padding: theme.spacing.md,
    borderRadius: theme.borderRadius.md,
    variants: {
      variant: {
        primary: { backgroundColor: theme.colors.primary },
        secondary: { backgroundColor: theme.colors.secondary },
      },
      size: {
        sm: { padding: theme.spacing.sm },
        md: { padding: theme.spacing.md },
        lg: { padding: theme.spacing.lg },
      },
    },
  },
  text: {
    color: theme.colors.white,
  },
}));

ComponentName.web.tsx (Web)

import React from 'react';
import { createStyleSheet, useStyles } from 'react-native-unistyles';
import type { ComponentNameProps } from './ComponentName';

export const ComponentName: React.FC<ComponentNameProps> = ({
  variant = 'primary',
  size = 'md',
  onPress,
  children,
  testID,
}) => {
  const { styles } = useStyles(stylesheet, { variant, size });

  return (
    <button style={styles.container} onClick={onPress} data-testid={testID}>
      {children}
    </button>
  );
};

const stylesheet = createStyleSheet((theme) => ({
  container: {
    backgroundColor: theme.colors.primary,
    padding: theme.spacing.md,
    borderRadius: theme.borderRadius.md,
    border: 'none',
    cursor: 'pointer',
    variants: {
      variant: {
        primary: { backgroundColor: theme.colors.primary },
        secondary: { backgroundColor: theme.colors.secondary },
      },
      size: {
        sm: { padding: theme.spacing.sm },
        md: { padding: theme.spacing.md },
        lg: { padding: theme.spacing.lg },
      },
    },
  },
}));

ComponentName.test.tsx (Tests)

import React from 'react';
import { render, fireEvent } from '@testing-library/react-native';
import { ComponentName } from './ComponentName';

describe('ComponentName', () => {
  it('renders correctly', () => {
    const { getByText } = render(<ComponentName>Test</ComponentName>);
    expect(getByText('Test')).toBeTruthy();
  });

  it('handles press events', () => {
    const onPress = jest.fn();
    const { getByText } = render(
      <ComponentName onPress={onPress}>Press me</ComponentName>
    );
    
    fireEvent.press(getByText('Press me'));
    expect(onPress).toHaveBeenCalledTimes(1);
  });
});

Playground examples

Document all variants and states in the Playground app under apps/playground/app/components/.

index.ts (Exports)

export { ComponentName } from './ComponentName';
export type { ComponentNameProps } from './ComponentName';

3. Update Main Index

Add to src/index.ts:

export * from './ComponentName';

Platform Resolution

React Native automatically resolves platform-specific files:

  • On iOS/Android: ComponentName.native.tsx is used
  • On Web: ComponentName.web.tsx is used
  • Shared types/logic: ComponentName.tsx is used by both

Best Practices

  1. Use Unistyles for styling - Ensures consistency and theme support
  2. Write tests - Maintain 80%+ coverage
  3. Add Playground examples - Document all variants and states
  4. Export types - Enable type-safe usage
  5. Use tokens - Import from @my-sdk/tokens for colors, spacing, etc.
  6. Platform-specific code - Keep platform differences minimal and isolated

Available Components

Currently no components are available. Start adding components following the guide above!

License

MIT