Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More UI components and React icons #44

Merged
merged 9 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 26 additions & 1 deletion .figmaexportrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

// @ts-check

const { pascalCase } = require('@figma-export/utils')

module.exports = {
commands: [
[
Expand Down Expand Up @@ -37,7 +39,7 @@ module.exports = {
],
outputters: [
require('@figma-export/output-components-as-svg')({
output: './icons',
output: './icons/svg',
getDirname: () => '',
getBasename: ({ basename, dirname }) => {
// Special handing for the directional arrows which have an odd export naming convention
Expand All @@ -53,6 +55,29 @@ module.exports = {
return `${basename}.svg`
},
}),
require('@figma-export/output-components-as-svgr')({
output: './icons/react',
getFileExtension: () => '.tsx',
getDirname: () => '',
getComponentName: ({ componentName }) =>
pascalCase(
componentName
.split('/')
.map((n) => `${n[0].toUpperCase()}${n.slice(1)}`)
.reverse()
.join('') + 'Icon',
),
getSvgrConfig: () => {
return {
jsxRuntime: 'automatic',
typescript: true,
titleProp: true,
svgProps: {
role: 'img',
},
}
},
}),
],
},
],
Expand Down
8 changes: 8 additions & 0 deletions components/dist/asciidoc.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright Oxide Computer Company
*/

@layer components {
.asciidoc-body .line-through {
text-decoration: line-through;
Expand Down
8 changes: 8 additions & 0 deletions components/dist/button.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright Oxide Computer Company
*/

button,
a,
label {
Expand Down
53 changes: 49 additions & 4 deletions components/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as _asciidoctor_core_types from '@asciidoctor/core/types';
import * as react from 'react';
import { ReactNode } from 'react';
import { ReactNode, ReactElement } from 'react';
import { TabsProps, TabsTriggerProps, TabsListProps, TabsContentProps } from '@radix-ui/react-tabs';
import { SetRequired } from 'type-fest';

Expand Down Expand Up @@ -53,13 +53,13 @@ interface SpinnerProps {
variant?: SpinnerVariant;
}
declare const Spinner: ({ className, size, variant, }: SpinnerProps) => react_jsx_runtime.JSX.Element;
type Props = {
type Props$1 = {
isLoading: boolean;
children?: ReactNode;
minTime?: number;
};
/** Loading spinner that shows for a minimum of `minTime` */
declare const SpinnerLoader: ({ isLoading, children, minTime }: Props) => react_jsx_runtime.JSX.Element;
declare const SpinnerLoader: ({ isLoading, children, minTime }: Props$1) => react_jsx_runtime.JSX.Element;

type TabsRootProps = SetRequired<TabsProps, 'defaultValue'>;
declare const Tabs: {
Expand All @@ -69,4 +69,49 @@ declare const Tabs: {
Content: ({ className, ...props }: TabsContentProps) => react_jsx_runtime.JSX.Element;
};

export { AsciiDocBlocks, Badge, BadgeColor, BadgeProps, BadgeVariant, Button, ButtonProps, ButtonSize, Spinner, SpinnerLoader, SpinnerSize, SpinnerVariant, Tabs, TabsRootProps, Variant, badgeColors, buttonSizes, buttonStyle, spinnerSizes, spinnerVariants, variants };
type CheckboxProps = {
indeterminate?: boolean;
children?: React.ReactNode;
className?: string;
} & Omit<React.ComponentProps<'input'>, 'type'>;
/** Checkbox component that handles label, styling, and indeterminate state */
declare const Checkbox: ({ indeterminate, children, className, ...inputProps }: CheckboxProps) => react_jsx_runtime.JSX.Element;

type Props = {
icon?: ReactElement;
title: string;
body?: string;
} & ({
buttonText: string;
buttonTo: string;
} | {
buttonText: string;
onClick: () => void;
} | {
buttonText?: never;
});
declare function EmptyMessage(props: Props): react_jsx_runtime.JSX.Element;

type ListboxItem<Value extends string = string> = {
value: Value;
} & ({
label: string;
labelString?: never;
} | {
label: ReactNode;
labelString: string;
});
interface ListboxProps<Value extends string = string> {
selected: Value | null;
onChange: (value: Value) => void;
items: ListboxItem<Value>[];
placeholder?: string;
className?: string;
disabled?: boolean;
hasError?: boolean;
name?: string;
isLoading?: boolean;
}
declare const Listbox: <Value extends string = string>({ name, selected, items, placeholder, className, onChange, hasError, disabled, isLoading, ...props }: ListboxProps<Value>) => react_jsx_runtime.JSX.Element;

export { AsciiDocBlocks, Badge, BadgeColor, BadgeProps, BadgeVariant, Button, ButtonProps, ButtonSize, Checkbox, CheckboxProps, EmptyMessage, Listbox, ListboxItem, ListboxProps, Spinner, SpinnerLoader, SpinnerSize, SpinnerVariant, Tabs, TabsRootProps, Variant, badgeColors, buttonSizes, buttonStyle, spinnerSizes, spinnerVariants, variants };
Loading