Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/www/src/app/examples/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,6 @@ const Page = () => {
<Dialog.Content width='500px'>
<Dialog.Header>
<Dialog.Title>Dialog Title</Dialog.Title>
<Dialog.CloseButton />
</Dialog.Header>
<Dialog.Body>
<Text>This is the dialog content. </Text>
Expand Down
6 changes: 5 additions & 1 deletion apps/www/src/components/demo/demo-playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export default function DemoPlayground({
<>
<DemoPreview type='code' code={previewCode} scope={scope} />
<Dialog open={openPlayground} onOpenChange={setOpenPlayground}>
<Dialog.Content className={styles.playgroundDialog}>
<Dialog.Content
className={styles.playgroundDialog}
showCloseButton={false}
showNestedAnimation={false}
>
<Dialog.Header className={styles.playgroundHeader}>
<DemoTitle className={styles.playgroundTitle} />
<Flex gap={3} align='center'>
Expand Down
12 changes: 5 additions & 7 deletions apps/www/src/components/docs/search.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use client';
import { getFileFromUrl, getFolderFromUrl } from '@/lib/utils';
import {
Cross1Icon,
ExclamationTriangleIcon,
Expand All @@ -15,13 +14,14 @@ import {
} from '@raystack/apsara';
import { cx } from 'class-variance-authority';
import {
flattenTree,
type Item as PageItem,
Root,
flattenTree
Root
} from 'fumadocs-core/page-tree';
import { useDocsSearch } from 'fumadocs-core/search/client';
import { useRouter } from 'next/navigation';
import { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
import { getFileFromUrl, getFolderFromUrl } from '@/lib/utils';
import styles from './search.module.css';

type Item = Omit<PageItem, 'type'> & {
Expand Down Expand Up @@ -134,10 +134,8 @@ export default function DocsSearch({ pageTree }: { pageTree: Root }) {

return (
<Dialog open={open} onOpenChange={setOpen}>
<Dialog.Trigger asChild>
<IconButton size={3} aria-label='Search docs'>
<MagnifyingGlassIcon />
</IconButton>
<Dialog.Trigger render={<IconButton size={3} aria-label='Search docs' />}>
<MagnifyingGlassIcon />
</Dialog.Trigger>
<Dialog.Content width={512} className={styles.searchContainer}>
<Command className={styles.searchCommand} filter={() => 1}>
Expand Down
9 changes: 3 additions & 6 deletions apps/www/src/components/playground/code-block-examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function CodeBlockExamples() {
</CodeBlock.Header>
<CodeBlock.Content>
<CodeBlock.Code language='jsx'>{`<Dialog>
<Dialog.Trigger asChild>
<Button>Basic Dialog</Button>
<Dialog.Trigger render={<Button />}>
Basic Dialog
</Dialog.Trigger>
<Dialog.Content
width={300}
Expand All @@ -35,7 +35,6 @@ export function CodeBlockExamples() {
>
<Dialog.Header>
<Dialog.Title>A simple dialog example</Dialog.Title>
<Dialog.CloseButton />
</Dialog.Header>
<Dialog.Body>
<Dialog.Description>
Expand All @@ -44,9 +43,7 @@ export function CodeBlockExamples() {
</Dialog.Body>
<Dialog.Footer>
<Button>OK</Button>
<Dialog.Close asChild>
<Button color="neutral">Cancel</Button>
</Dialog.Close>
<Dialog.Close render={<Button color="neutral">Cancel</Button>} />
</Dialog.Footer>
</Dialog.Content>
</Dialog>`}</CodeBlock.Code>
Expand Down
18 changes: 9 additions & 9 deletions apps/www/src/components/playground/dialog-examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export function DialogExamples() {
<PlaygroundLayout title='Dialog'>
<Flex gap='medium'>
<Dialog>
<Dialog.Trigger asChild>
<Button> Dialog</Button>
</Dialog.Trigger>
<Dialog.Trigger render={<Button />}>Dialog</Dialog.Trigger>
<Dialog.Content
width='400px'
overlayBlur
overlayClassName='custom-overlay'
overlayStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.5)' }}
overlay={{
blur: true,
className: 'custom-overlay',
style: { backgroundColor: 'rgba(0, 0, 0, 0.5)' }
}}
>
<Dialog.Title>Custom Styled Dialog</Dialog.Title>
<Dialog.Description className='custom-description'>
Expand All @@ -25,10 +25,10 @@ export function DialogExamples() {
</Dialog.Content>
</Dialog>
<Dialog>
<Dialog.Trigger asChild>
<Button variant='outline'>Open Dialog</Button>
<Dialog.Trigger render={<Button variant='outline' />}>
Open Dialog
</Dialog.Trigger>
<Dialog.Content width={600} close={false}>
<Dialog.Content width={600} showCloseButton={false}>
<Dialog.Title>No Close Button</Dialog.Title>
<Dialog.Description>
This dialog doesn't show the close button.
Expand Down
5 changes: 5 additions & 0 deletions apps/www/src/components/typetable/typetable.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@
flex-wrap: wrap;
gap: var(--rs-space-1);
}
.required {
color: var(--rs-color-foreground-danger-primary);
position: relative;
top: -4px;
}
12 changes: 9 additions & 3 deletions apps/www/src/components/typetable/typetable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export interface TypeNode {
export function TypeTable({
type,
className
}: { type: Record<string, TypeNode>; className?: string }) {
}: {
type: Record<string, TypeNode>;
className?: string;
}) {
const entries = Object.entries(type);

return (
Expand Down Expand Up @@ -87,7 +90,7 @@ function Item({
className={deprecated ? styles.propNameDeprecated : styles.propName}
>
{name}
{!required && '?'}
{required ? <span className={styles.required}>*</span> : ''}
</code>
<span className={styles.fieldValue}>
{typeDescriptionLink ? (
Expand Down Expand Up @@ -130,7 +133,10 @@ function Item({
language='tsx'
className={cx(styles.fieldCode, styles.fieldValue)}
>
{String(typeDescription ?? type)}
{String(type) +
(!required && !String(type).includes('undefined')
? ' | undefined'
: '')}
</CodeBlock.Code>
</CodeBlock>
</Flex>
Expand Down
1 change: 1 addition & 0 deletions apps/www/src/content/docs/components/avatar/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Avatar
description: An image element with a fallback for representing the user.
source: packages/raystack/components/avatar
tag: new
---

import {
Expand Down
10 changes: 8 additions & 2 deletions apps/www/src/content/docs/components/avatar/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ export interface AvatarProps {
| 'crimson'
| 'gold';

/** Boolean to merge props onto child element */
asChild?: boolean;
/**
* Allows you to replace the component's HTML element with a different tag,
* or compose it with another component. Accepts a ReactElement or a function
* that returns the element to render.
*
* @remarks `ReactElement | function`
*/
render?: React.ReactElement;

/** Additional CSS class names */
className?: string;
Expand Down
15 changes: 10 additions & 5 deletions apps/www/src/content/docs/components/checkbox/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ export const playground = {
type: 'playground',
controls: {
checked: {
type: 'select',
options: ['true', 'false', 'indeterminate'],
initialValue: 'true'
type: 'checkbox',
initialValue: false,
defaultValue: false
},
indeterminate: {
type: 'checkbox',
initialValue: false,
defaultValue: false
},
disabled: {
type: 'checkbox',
Expand All @@ -34,11 +39,11 @@ export const statesExamples = {
},
{
name: 'Checked',
code: `<Checkbox checked={true} />`
code: `<Checkbox checked/>`
},
{
name: 'Indeterminate',
code: `<Checkbox checked="indeterminate" />`
code: `<Checkbox indeterminate />`
},
{
name: 'Disabled',
Expand Down
11 changes: 8 additions & 3 deletions apps/www/src/content/docs/components/checkbox/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ export interface CheckboxProps {
/**
* The controlled state of the checkbox
*/
checked?: boolean | 'indeterminate';
checked?: boolean;

/**
* The default state when initially rendered
*/
defaultChecked?: boolean | 'indeterminate';
defaultChecked?: boolean;

/**
* Event handler called when the state changes
*/
onCheckedChange?: (checked: boolean | 'indeterminate') => void;
onCheckedChange?: (checked: boolean) => void;

/**
* When true, the checkbox is in an indeterminate state
*/
indeterminate?: boolean;

/**
* When true, prevents the user from interacting with the checkbox
Expand Down
9 changes: 3 additions & 6 deletions apps/www/src/content/docs/components/code-block/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const tsxCode = `{\`function add(a: number, b: number): number {
}\`}`;

const longCode = `{\`<Dialog>
<Dialog.Trigger asChild>
<Button>Basic Dialog</Button>
<Dialog.Trigger render={<Button />}>
Basic Dialog
</Dialog.Trigger>
<Dialog.Content
width={300}
Expand All @@ -21,7 +21,6 @@ const longCode = `{\`<Dialog>
>
<Dialog.Header>
<Dialog.Title>A simple dialog example</Dialog.Title>
<Dialog.CloseButton />
</Dialog.Header>
<Dialog.Body>
<Dialog.Description>
Expand All @@ -30,9 +29,7 @@ const longCode = `{\`<Dialog>
</Dialog.Body>
<Dialog.Footer>
<Button>OK</Button>
<Dialog.Close asChild>
<Button color="neutral">Cancel</Button>
</Dialog.Close>
<Dialog.Close render={<Button color="neutral">Cancel</Button>} />
</Dialog.Footer>
</Dialog.Content>
</Dialog>\`}`;
Expand Down
Loading