@journ/nude 0.1.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.
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/accordion-parts.d.ts +15 -0
- package/dist/accordion-parts.js +19 -0
- package/dist/accordion.d.ts +10 -0
- package/dist/accordion.js +10 -0
- package/dist/alert-dialog-parts.d.ts +13 -0
- package/dist/alert-dialog-parts.js +15 -0
- package/dist/alert-dialog.d.ts +14 -0
- package/dist/alert-dialog.js +15 -0
- package/dist/alert.d.ts +11 -0
- package/dist/alert.js +12 -0
- package/dist/animated-size.d.ts +18 -0
- package/dist/animated-size.js +55 -0
- package/dist/avatar-parts.d.ts +10 -0
- package/dist/avatar-parts.js +14 -0
- package/dist/avatar.d.ts +9 -0
- package/dist/avatar.js +9 -0
- package/dist/badge.d.ts +4 -0
- package/dist/badge.js +5 -0
- package/dist/breadcrumbs.d.ts +11 -0
- package/dist/breadcrumbs.js +15 -0
- package/dist/bulk-bar.d.ts +8 -0
- package/dist/bulk-bar.js +9 -0
- package/dist/button.d.ts +13 -0
- package/dist/button.js +21 -0
- package/dist/calendar-parts.d.ts +81 -0
- package/dist/calendar-parts.js +213 -0
- package/dist/calendar.d.ts +17 -0
- package/dist/calendar.js +17 -0
- package/dist/card.d.ts +12 -0
- package/dist/card.js +13 -0
- package/dist/carousel-parts.d.ts +29 -0
- package/dist/carousel-parts.js +98 -0
- package/dist/carousel.d.ts +11 -0
- package/dist/carousel.js +11 -0
- package/dist/checkbox-parts.d.ts +7 -0
- package/dist/checkbox-parts.js +9 -0
- package/dist/checkbox.d.ts +7 -0
- package/dist/checkbox.js +8 -0
- package/dist/chip.d.ts +22 -0
- package/dist/chip.js +29 -0
- package/dist/collapsible-parts.d.ts +7 -0
- package/dist/collapsible-parts.js +9 -0
- package/dist/collapsible.d.ts +8 -0
- package/dist/collapsible.js +9 -0
- package/dist/combobox-parts.d.ts +85 -0
- package/dist/combobox-parts.js +61 -0
- package/dist/combobox.d.ts +84 -0
- package/dist/combobox.js +21 -0
- package/dist/command-palette-parts.d.ts +22 -0
- package/dist/command-palette-parts.js +56 -0
- package/dist/command-palette.d.ts +64 -0
- package/dist/command-palette.js +18 -0
- package/dist/composer.d.ts +7 -0
- package/dist/composer.js +8 -0
- package/dist/context-menu-parts.d.ts +8 -0
- package/dist/context-menu-parts.js +10 -0
- package/dist/context-menu.d.ts +12 -0
- package/dist/context-menu.js +13 -0
- package/dist/currency-input-parts.d.ts +22 -0
- package/dist/currency-input-parts.js +57 -0
- package/dist/currency-input.d.ts +8 -0
- package/dist/currency-input.js +8 -0
- package/dist/data-table-parts.d.ts +101 -0
- package/dist/data-table-parts.js +220 -0
- package/dist/data-table.d.ts +12 -0
- package/dist/data-table.js +12 -0
- package/dist/date-input-parts.d.ts +15 -0
- package/dist/date-input-parts.js +54 -0
- package/dist/date-input.d.ts +8 -0
- package/dist/date-input.js +8 -0
- package/dist/date-picker-parts.d.ts +29 -0
- package/dist/date-picker-parts.js +33 -0
- package/dist/date-picker.d.ts +29 -0
- package/dist/date-picker.js +15 -0
- package/dist/date-range-picker-parts.d.ts +37 -0
- package/dist/date-range-picker-parts.js +63 -0
- package/dist/date-range-picker.d.ts +29 -0
- package/dist/date-range-picker.js +15 -0
- package/dist/description-list.d.ts +8 -0
- package/dist/description-list.js +9 -0
- package/dist/dialog-parts.d.ts +12 -0
- package/dist/dialog-parts.js +14 -0
- package/dist/dialog.d.ts +14 -0
- package/dist/dialog.js +15 -0
- package/dist/divider.d.ts +5 -0
- package/dist/divider.js +9 -0
- package/dist/drawer-parts.d.ts +24 -0
- package/dist/drawer-parts.js +14 -0
- package/dist/drawer.d.ts +27 -0
- package/dist/drawer.js +15 -0
- package/dist/dropdown-menu-parts.d.ts +8 -0
- package/dist/dropdown-menu-parts.js +10 -0
- package/dist/dropdown-menu.d.ts +12 -0
- package/dist/dropdown-menu.js +13 -0
- package/dist/empty-state.d.ts +10 -0
- package/dist/empty-state.js +11 -0
- package/dist/field-parts.d.ts +15 -0
- package/dist/field-parts.js +63 -0
- package/dist/field.d.ts +11 -0
- package/dist/field.js +11 -0
- package/dist/file-dropzone-parts.d.ts +34 -0
- package/dist/file-dropzone-parts.js +108 -0
- package/dist/file-dropzone.d.ts +10 -0
- package/dist/file-dropzone.js +10 -0
- package/dist/heading.d.ts +9 -0
- package/dist/heading.js +12 -0
- package/dist/hover-card-parts.d.ts +8 -0
- package/dist/hover-card-parts.js +12 -0
- package/dist/hover-card.d.ts +9 -0
- package/dist/hover-card.js +9 -0
- package/dist/icon-button.d.ts +6 -0
- package/dist/icon-button.js +5 -0
- package/dist/icon.d.ts +7 -0
- package/dist/icon.js +12 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.js +87 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.js +5 -0
- package/dist/lib/commit-on.d.ts +15 -0
- package/dist/lib/commit-on.js +17 -0
- package/dist/lib/menu-parts.d.ts +21 -0
- package/dist/lib/menu-parts.js +23 -0
- package/dist/lib/modal-content.d.ts +17 -0
- package/dist/lib/modal-content.js +17 -0
- package/dist/lib/modal-parts.d.ts +6 -0
- package/dist/lib/modal-parts.js +7 -0
- package/dist/lib/part.d.ts +6 -0
- package/dist/lib/part.js +13 -0
- package/dist/lib/picker.d.ts +44 -0
- package/dist/lib/picker.js +75 -0
- package/dist/lib/visually-hidden.d.ts +6 -0
- package/dist/lib/visually-hidden.js +15 -0
- package/dist/link.d.ts +9 -0
- package/dist/link.js +12 -0
- package/dist/markdown.d.ts +10 -0
- package/dist/markdown.js +10 -0
- package/dist/message.d.ts +13 -0
- package/dist/message.js +15 -0
- package/dist/month-picker-parts.d.ts +19 -0
- package/dist/month-picker-parts.js +38 -0
- package/dist/month-picker.d.ts +15 -0
- package/dist/month-picker.js +15 -0
- package/dist/month-stepper-parts.d.ts +16 -0
- package/dist/month-stepper-parts.js +52 -0
- package/dist/month-stepper.d.ts +10 -0
- package/dist/month-stepper.js +10 -0
- package/dist/multiple-selector-parts.d.ts +39 -0
- package/dist/multiple-selector-parts.js +118 -0
- package/dist/multiple-selector.d.ts +76 -0
- package/dist/multiple-selector.js +23 -0
- package/dist/nav-bar.d.ts +7 -0
- package/dist/nav-bar.js +8 -0
- package/dist/navigation-menu-parts.d.ts +18 -0
- package/dist/navigation-menu-parts.js +25 -0
- package/dist/navigation-menu.d.ts +12 -0
- package/dist/navigation-menu.js +12 -0
- package/dist/otp-input-parts.d.ts +9 -0
- package/dist/otp-input-parts.js +11 -0
- package/dist/otp-input.d.ts +8 -0
- package/dist/otp-input.js +9 -0
- package/dist/page-header.d.ts +8 -0
- package/dist/page-header.js +9 -0
- package/dist/page.d.ts +8 -0
- package/dist/page.js +9 -0
- package/dist/pagination.d.ts +13 -0
- package/dist/pagination.js +24 -0
- package/dist/pill-select.d.ts +4 -0
- package/dist/pill-select.js +5 -0
- package/dist/popover-parts.d.ts +9 -0
- package/dist/popover-parts.js +13 -0
- package/dist/popover.d.ts +10 -0
- package/dist/popover.js +10 -0
- package/dist/portal.d.ts +15 -0
- package/dist/portal.js +20 -0
- package/dist/progress-parts.d.ts +11 -0
- package/dist/progress-parts.js +32 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +8 -0
- package/dist/quantity-input-parts.d.ts +21 -0
- package/dist/quantity-input-parts.js +86 -0
- package/dist/quantity-input.d.ts +10 -0
- package/dist/quantity-input.js +10 -0
- package/dist/radio-parts.d.ts +13 -0
- package/dist/radio-parts.js +17 -0
- package/dist/radio.d.ts +8 -0
- package/dist/radio.js +8 -0
- package/dist/scroll-area-parts.d.ts +17 -0
- package/dist/scroll-area-parts.js +21 -0
- package/dist/scroll-area.d.ts +10 -0
- package/dist/scroll-area.js +10 -0
- package/dist/select-parts.d.ts +26 -0
- package/dist/select-parts.js +38 -0
- package/dist/select.d.ts +14 -0
- package/dist/select.js +14 -0
- package/dist/sheet-parts.d.ts +15 -0
- package/dist/sheet-parts.js +15 -0
- package/dist/sheet.d.ts +14 -0
- package/dist/sheet.js +16 -0
- package/dist/sidebar.d.ts +14 -0
- package/dist/sidebar.js +17 -0
- package/dist/skeleton.d.ts +4 -0
- package/dist/skeleton.js +5 -0
- package/dist/slider-parts.d.ts +9 -0
- package/dist/slider-parts.js +11 -0
- package/dist/slider.d.ts +9 -0
- package/dist/slider.js +10 -0
- package/dist/spinner.d.ts +6 -0
- package/dist/spinner.js +23 -0
- package/dist/stack-parts.d.ts +22 -0
- package/dist/stack-parts.js +125 -0
- package/dist/stack.d.ts +10 -0
- package/dist/stack.js +10 -0
- package/dist/stat.d.ts +9 -0
- package/dist/stat.js +10 -0
- package/dist/step-button.d.ts +11 -0
- package/dist/step-button.js +13 -0
- package/dist/stepper-parts.d.ts +19 -0
- package/dist/stepper-parts.js +44 -0
- package/dist/stepper.d.ts +11 -0
- package/dist/stepper.js +11 -0
- package/dist/switch-parts.d.ts +6 -0
- package/dist/switch-parts.js +8 -0
- package/dist/switch.d.ts +7 -0
- package/dist/switch.js +8 -0
- package/dist/table.d.ts +12 -0
- package/dist/table.js +13 -0
- package/dist/tabs-parts.d.ts +8 -0
- package/dist/tabs-parts.js +10 -0
- package/dist/tabs.d.ts +9 -0
- package/dist/tabs.js +10 -0
- package/dist/tag-input-parts.d.ts +30 -0
- package/dist/tag-input-parts.js +99 -0
- package/dist/tag-input.d.ts +10 -0
- package/dist/tag-input.js +10 -0
- package/dist/text-morph.d.ts +17 -0
- package/dist/text-morph.js +62 -0
- package/dist/text-shimmer.d.ts +9 -0
- package/dist/text-shimmer.js +8 -0
- package/dist/text.d.ts +4 -0
- package/dist/text.js +5 -0
- package/dist/textarea.d.ts +4 -0
- package/dist/textarea.js +5 -0
- package/dist/time-range-parts.d.ts +22 -0
- package/dist/time-range-parts.js +56 -0
- package/dist/time-range.d.ts +10 -0
- package/dist/time-range.js +10 -0
- package/dist/toast-parts.d.ts +12 -0
- package/dist/toast-parts.js +21 -0
- package/dist/toast.d.ts +13 -0
- package/dist/toast.js +12 -0
- package/dist/toggle-group-parts.d.ts +6 -0
- package/dist/toggle-group-parts.js +8 -0
- package/dist/toggle-group.d.ts +7 -0
- package/dist/toggle-group.js +8 -0
- package/dist/tooltip-parts.d.ts +10 -0
- package/dist/tooltip-parts.js +17 -0
- package/dist/tooltip.d.ts +10 -0
- package/dist/tooltip.js +10 -0
- package/dist/touch-target.d.ts +6 -0
- package/dist/touch-target.js +10 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Journ
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @journ/nude
|
|
2
|
+
|
|
3
|
+
Unstyled, accessible React primitives for the web. They own behavior, state, focus and ARIA, and leave every visual decision to you.
|
|
4
|
+
|
|
5
|
+
Built on Radix UI, vaul, cmdk, sonner, Embla and TanStack Table. Nothing here sets a class, a color or a size. `@journ/lotus` and `@journ/bloom` are style layers over these parts.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @journ/nude react react-dom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Button } from '@journ/nude/button'
|
|
17
|
+
import { Dialog } from '@journ/nude/dialog'
|
|
18
|
+
|
|
19
|
+
function Example() {
|
|
20
|
+
return (
|
|
21
|
+
<Dialog.Root>
|
|
22
|
+
<Dialog.Trigger asChild>
|
|
23
|
+
<Button>Delete</Button>
|
|
24
|
+
</Dialog.Trigger>
|
|
25
|
+
<Dialog.Content>
|
|
26
|
+
<Dialog.Title>Delete file</Dialog.Title>
|
|
27
|
+
<Dialog.Description>This cannot be undone.</Dialog.Description>
|
|
28
|
+
<Dialog.Close>Cancel</Dialog.Close>
|
|
29
|
+
</Dialog.Content>
|
|
30
|
+
</Dialog.Root>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Every component has its own entry (`@journ/nude/button`, `@journ/nude/dialog`, ...). `@journ/nude` exports all of them. The individual parts behind a namespace live in `@journ/nude/<name>-parts`.
|
|
36
|
+
|
|
37
|
+
## Styling contract
|
|
38
|
+
|
|
39
|
+
- Every part sets a `data-slot` and passes `className`, `style` and `ref` to its element. State is exposed as `data-*` and `aria-*` attributes (`data-state`, `data-active`, `data-status`, `aria-pressed`, ...).
|
|
40
|
+
- A part that renders inner elements takes `classNames`, one key per inner element. State-dependent keys are functions:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Calendar.Days className='grid' classNames={{ day: state => (state === 'selected' ? 'on' : 'off') }} />
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- A composite that renders other components takes `components` and defaults to the nude ones. `DataTable.Root` takes `components`, `classNames` and `icons` once for all of its parts; `MultipleSelector.Tags` and `TagInput.Tags` take `components={{ Tag }}`.
|
|
47
|
+
- Nude renders no icons. Parts that usually hold one (`Select.Trigger`, `Select.Item`, step buttons, indicators) take it as `icon`, `indicator` or `children`.
|
|
48
|
+
- The only inline styles are the ones a behavior needs: clipping in `AnimatedSize`, the transform in `Progress.Indicator`, `order` and `z-index` in `Stack.Item`, and visually hidden labels.
|
|
49
|
+
|
|
50
|
+
## Composition rules
|
|
51
|
+
|
|
52
|
+
- Compound components: `Card.Root`, `Card.Header`, `Card.Title`. Consumers pick the parts they need.
|
|
53
|
+
- Pass `children`, not `renderX` props. No boolean props like `showFooter`.
|
|
54
|
+
- React 19 style: `ref` is a regular prop, no `forwardRef`.
|
|
55
|
+
- Shared state lives in a provider only when parts truly share it. Context is `{ state, actions, meta }`: `X.Provider` takes all three, so the state can come from anywhere, and `X.Root` is the default provider that owns local state with `value`, `defaultValue` and `onValueChange`. Neither renders DOM.
|
|
56
|
+
- A `useX` hook is exported next to the namespace (`useCalendar`, `useCombobox`, `useDataTable`, ...), so custom UI inside the provider can read state and call actions.
|
|
57
|
+
- Parts that must live inside a root throw a clear error when used alone (`createRequiredContext` from `@journ/lift`).
|
|
58
|
+
- Client-only parts live in `*-parts.tsx` with `'use client'`. The sibling file without the directive builds the namespace object.
|
|
59
|
+
- `src/lib/part.tsx`: `part(element, slot, defaults)` builds a part that only tags its element. Use it for every part without logic.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as RadixAccordion from "@radix-ui/react-accordion";
|
|
2
|
+
import { ComponentPropsWithRef } from "react";
|
|
3
|
+
//#region src/accordion-parts.d.ts
|
|
4
|
+
declare const Root: import("react").ForwardRefExoticComponent<(RadixAccordion.AccordionMultipleProps | RadixAccordion.AccordionSingleProps) & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const Item: (props: RadixAccordion.AccordionItemProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
6
|
+
declare const Content: (props: RadixAccordion.AccordionContentProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
7
|
+
type TriggerProps = ComponentPropsWithRef<typeof RadixAccordion.Trigger> & {
|
|
8
|
+
classNames?: {
|
|
9
|
+
header?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** Wrapped in a heading, as the accordion pattern requires. */
|
|
13
|
+
declare const Trigger: ({ classNames, ...props }: TriggerProps) => import("react").JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Content, Item, Root, Trigger };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { part } from "./lib/part.js";
|
|
3
|
+
import * as RadixAccordion from "@radix-ui/react-accordion";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/accordion-parts.tsx
|
|
6
|
+
const Root = RadixAccordion.Root;
|
|
7
|
+
const Item = part(RadixAccordion.Item, "accordion-item");
|
|
8
|
+
const Content = part(RadixAccordion.Content, "accordion-content");
|
|
9
|
+
/** Wrapped in a heading, as the accordion pattern requires. */
|
|
10
|
+
const Trigger = ({ classNames, ...props }) => /* @__PURE__ */ jsx(RadixAccordion.Header, {
|
|
11
|
+
"data-slot": "accordion-header",
|
|
12
|
+
className: classNames?.header,
|
|
13
|
+
children: /* @__PURE__ */ jsx(RadixAccordion.Trigger, {
|
|
14
|
+
"data-slot": "accordion-trigger",
|
|
15
|
+
...props
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Content, Item, Root, Trigger };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Trigger } from "./accordion-parts.js";
|
|
2
|
+
//#region src/accordion.d.ts
|
|
3
|
+
declare const Accordion: {
|
|
4
|
+
Root: import("react").ForwardRefExoticComponent<(import("@radix-ui/react-accordion").AccordionMultipleProps | import("@radix-ui/react-accordion").AccordionSingleProps) & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
Item: (props: import("@radix-ui/react-accordion").AccordionItemProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
6
|
+
Trigger: typeof Trigger;
|
|
7
|
+
Content: (props: import("@radix-ui/react-accordion").AccordionContentProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Accordion };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModalContentProps } from "./lib/modal-content.js";
|
|
2
|
+
import { Actions } from "./lib/modal-parts.js";
|
|
3
|
+
import * as RadixAlertDialog from "@radix-ui/react-alert-dialog";
|
|
4
|
+
//#region src/alert-dialog-parts.d.ts
|
|
5
|
+
declare const Root: import("react").FC<RadixAlertDialog.AlertDialogProps>;
|
|
6
|
+
declare const Trigger: import("react").ForwardRefExoticComponent<RadixAlertDialog.AlertDialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const Cancel: import("react").ForwardRefExoticComponent<RadixAlertDialog.AlertDialogCancelProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const Action: import("react").ForwardRefExoticComponent<RadixAlertDialog.AlertDialogActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
declare const Content: ({ classNames, overlayRef, ...props }: ModalContentProps<typeof RadixAlertDialog>) => import("react").JSX.Element;
|
|
10
|
+
declare const Title: (props: RadixAlertDialog.AlertDialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>) => import("react").ReactNode;
|
|
11
|
+
declare const Description: (props: RadixAlertDialog.AlertDialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>) => import("react").ReactNode;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Action, Actions, Cancel, Content, Description, Root, Title, Trigger };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { part } from "./lib/part.js";
|
|
3
|
+
import { createModalContent } from "./lib/modal-content.js";
|
|
4
|
+
import { Actions } from "./lib/modal-parts.js";
|
|
5
|
+
import * as RadixAlertDialog from "@radix-ui/react-alert-dialog";
|
|
6
|
+
//#region src/alert-dialog-parts.tsx
|
|
7
|
+
const Root = RadixAlertDialog.Root;
|
|
8
|
+
const Trigger = RadixAlertDialog.Trigger;
|
|
9
|
+
const Cancel = RadixAlertDialog.Cancel;
|
|
10
|
+
const Action = RadixAlertDialog.Action;
|
|
11
|
+
const Content = createModalContent(RadixAlertDialog, "alert-dialog");
|
|
12
|
+
const Title = part(RadixAlertDialog.Title, "alert-dialog-title");
|
|
13
|
+
const Description = part(RadixAlertDialog.Description, "alert-dialog-description");
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Action, Actions, Cancel, Content, Description, Root, Title, Trigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ModalContentProps } from "./lib/modal-content.js";
|
|
2
|
+
//#region src/alert-dialog.d.ts
|
|
3
|
+
declare const AlertDialog: {
|
|
4
|
+
Root: import("react").FC<import("@radix-ui/react-alert-dialog").AlertDialogProps>;
|
|
5
|
+
Trigger: import("react").ForwardRefExoticComponent<import("@radix-ui/react-alert-dialog").AlertDialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
Content: ({ classNames, overlayRef, ...props }: ModalContentProps<typeof import("@radix-ui/react-alert-dialog")>) => import("react").JSX.Element;
|
|
7
|
+
Title: (props: import("@radix-ui/react-alert-dialog").AlertDialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>) => import("react").ReactNode;
|
|
8
|
+
Description: (props: import("@radix-ui/react-alert-dialog").AlertDialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>) => import("react").ReactNode;
|
|
9
|
+
Actions: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").ReactNode;
|
|
10
|
+
Cancel: import("react").ForwardRefExoticComponent<import("@radix-ui/react-alert-dialog").AlertDialogCancelProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
Action: import("react").ForwardRefExoticComponent<import("@radix-ui/react-alert-dialog").AlertDialogActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { AlertDialog };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Actions } from "./lib/modal-parts.js";
|
|
2
|
+
import { Action, Cancel, Content, Description, Root, Title, Trigger } from "./alert-dialog-parts.js";
|
|
3
|
+
//#region src/alert-dialog.tsx
|
|
4
|
+
const AlertDialog = {
|
|
5
|
+
Root,
|
|
6
|
+
Trigger,
|
|
7
|
+
Content,
|
|
8
|
+
Title,
|
|
9
|
+
Description,
|
|
10
|
+
Actions,
|
|
11
|
+
Cancel,
|
|
12
|
+
Action
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AlertDialog };
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/alert.d.ts
|
|
2
|
+
declare const Alert: {
|
|
3
|
+
Root: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").ReactNode;
|
|
4
|
+
Icon: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>) => import("react").ReactNode;
|
|
5
|
+
Body: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").ReactNode;
|
|
6
|
+
Title: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>) => import("react").ReactNode;
|
|
7
|
+
Description: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>) => import("react").ReactNode;
|
|
8
|
+
Actions: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").ReactNode;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Alert };
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { part } from "./lib/part.js";
|
|
2
|
+
//#region src/alert.tsx
|
|
3
|
+
const Alert = {
|
|
4
|
+
Root: part("div", "alert", { role: "alert" }),
|
|
5
|
+
Icon: part("span", "alert-icon", { "aria-hidden": true }),
|
|
6
|
+
Body: part("div", "alert-body"),
|
|
7
|
+
Title: part("p", "alert-title"),
|
|
8
|
+
Description: part("p", "alert-description"),
|
|
9
|
+
Actions: part("div", "alert-actions")
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Alert };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from "react";
|
|
2
|
+
//#region src/animated-size.d.ts
|
|
3
|
+
type AnimatedSizeProps = ComponentPropsWithRef<'div'> & {
|
|
4
|
+
/** Animate the width as the content's width changes. */
|
|
5
|
+
width?: boolean;
|
|
6
|
+
/** Animate the height as the content's height changes. */
|
|
7
|
+
height?: boolean;
|
|
8
|
+
classNames?: {
|
|
9
|
+
content?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Follows the size of its content: when the children grow or shrink, the box
|
|
14
|
+
* glides to the new size. The first measure and reduced motion jump straight there.
|
|
15
|
+
*/
|
|
16
|
+
declare const AnimatedSize: ({ width, height, classNames, style, children, ...props }: AnimatedSizeProps) => import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { AnimatedSize, type AnimatedSizeProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { prefersReducedMotion } from "@journ/lift";
|
|
5
|
+
import { animate } from "animejs";
|
|
6
|
+
//#region src/animated-size.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Follows the size of its content: when the children grow or shrink, the box
|
|
9
|
+
* glides to the new size. The first measure and reduced motion jump straight there.
|
|
10
|
+
*/
|
|
11
|
+
const AnimatedSize = ({ width = false, height = true, classNames, style, children, ...props }) => {
|
|
12
|
+
const outer = useRef(null);
|
|
13
|
+
const inner = useRef(null);
|
|
14
|
+
const measured = useRef(false);
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
const box = outer.current;
|
|
17
|
+
const content = inner.current;
|
|
18
|
+
if (!box || !content) return;
|
|
19
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
20
|
+
if (!entry) return;
|
|
21
|
+
const sizes = {};
|
|
22
|
+
if (width) sizes.width = [box.offsetWidth, entry.contentRect.width];
|
|
23
|
+
if (height) sizes.height = [box.offsetHeight, entry.contentRect.height];
|
|
24
|
+
if (!measured.current || prefersReducedMotion()) {
|
|
25
|
+
measured.current = true;
|
|
26
|
+
for (const [key, [, to]] of Object.entries(sizes)) box.style[key] = `${to}px`;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
animate(box, {
|
|
30
|
+
...sizes,
|
|
31
|
+
duration: 250,
|
|
32
|
+
ease: "outExpo"
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
observer.observe(content);
|
|
36
|
+
return () => observer.disconnect();
|
|
37
|
+
}, [width, height]);
|
|
38
|
+
return /* @__PURE__ */ jsx("div", {
|
|
39
|
+
ref: outer,
|
|
40
|
+
"data-slot": "animated-size",
|
|
41
|
+
...props,
|
|
42
|
+
style: {
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
...style
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
47
|
+
ref: inner,
|
|
48
|
+
className: classNames?.content,
|
|
49
|
+
style: width ? { width: "fit-content" } : void 0,
|
|
50
|
+
children
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { AnimatedSize };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from "react";
|
|
2
|
+
import * as RadixAvatar from "@radix-ui/react-avatar";
|
|
3
|
+
//#region src/avatar-parts.d.ts
|
|
4
|
+
declare const Root: (props: RadixAvatar.AvatarProps & import("react").RefAttributes<HTMLSpanElement>) => import("react").ReactNode;
|
|
5
|
+
declare const Fallback: (props: RadixAvatar.AvatarFallbackProps & import("react").RefAttributes<HTMLSpanElement>) => import("react").ReactNode;
|
|
6
|
+
declare const Image: ({ alt, ...props }: ComponentPropsWithRef<typeof RadixAvatar.Image> & {
|
|
7
|
+
alt: string;
|
|
8
|
+
}) => import("react").JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Fallback, Image, Root };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { part } from "./lib/part.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as RadixAvatar from "@radix-ui/react-avatar";
|
|
5
|
+
//#region src/avatar-parts.tsx
|
|
6
|
+
const Root = part(RadixAvatar.Root, "avatar");
|
|
7
|
+
const Fallback = part(RadixAvatar.Fallback, "avatar-fallback");
|
|
8
|
+
const Image = ({ alt, ...props }) => /* @__PURE__ */ jsx(RadixAvatar.Image, {
|
|
9
|
+
"data-slot": "avatar-image",
|
|
10
|
+
alt,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Fallback, Image, Root };
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Image } from "./avatar-parts.js";
|
|
2
|
+
//#region src/avatar.d.ts
|
|
3
|
+
declare const Avatar: {
|
|
4
|
+
Root: (props: import("@radix-ui/react-avatar").AvatarProps & import("react").RefAttributes<HTMLSpanElement>) => import("react").ReactNode;
|
|
5
|
+
Image: typeof Image;
|
|
6
|
+
Fallback: (props: import("@radix-ui/react-avatar").AvatarFallbackProps & import("react").RefAttributes<HTMLSpanElement>) => import("react").ReactNode;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Avatar };
|
package/dist/avatar.js
ADDED
package/dist/badge.d.ts
ADDED
package/dist/badge.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/breadcrumbs.d.ts
|
|
2
|
+
declare const Breadcrumbs: {
|
|
3
|
+
Root: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>) => import("react").ReactNode;
|
|
4
|
+
List: (props: import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>) => import("react").ReactNode;
|
|
5
|
+
Item: (props: import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>) => import("react").ReactNode;
|
|
6
|
+
Link: (props: import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => import("react").ReactNode;
|
|
7
|
+
Page: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>) => import("react").ReactNode;
|
|
8
|
+
Separator: (props: import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>) => import("react").ReactNode;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Breadcrumbs };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { part } from "./lib/part.js";
|
|
2
|
+
//#region src/breadcrumbs.tsx
|
|
3
|
+
const Breadcrumbs = {
|
|
4
|
+
Root: part("nav", "breadcrumbs", { "aria-label": "Breadcrumb" }),
|
|
5
|
+
List: part("ol", "breadcrumbs-list"),
|
|
6
|
+
Item: part("li", "breadcrumbs-item"),
|
|
7
|
+
Link: part("a", "breadcrumbs-link"),
|
|
8
|
+
Page: part("span", "breadcrumbs-page", { "aria-current": "page" }),
|
|
9
|
+
Separator: part("li", "breadcrumbs-separator", {
|
|
10
|
+
role: "presentation",
|
|
11
|
+
"aria-hidden": true
|
|
12
|
+
})
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Breadcrumbs };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/bulk-bar.d.ts
|
|
2
|
+
declare const BulkBar: {
|
|
3
|
+
Root: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").ReactNode;
|
|
4
|
+
Count: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>) => import("react").ReactNode;
|
|
5
|
+
Actions: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").ReactNode;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { BulkBar };
|
package/dist/bulk-bar.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { part } from "./lib/part.js";
|
|
2
|
+
//#region src/bulk-bar.tsx
|
|
3
|
+
const BulkBar = {
|
|
4
|
+
Root: part("div", "bulk-bar", { role: "toolbar" }),
|
|
5
|
+
Count: part("p", "bulk-bar-count", { "aria-live": "polite" }),
|
|
6
|
+
Actions: part("div", "bulk-bar-actions")
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { BulkBar };
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from "react";
|
|
2
|
+
//#region src/button.d.ts
|
|
3
|
+
type ButtonProps = {
|
|
4
|
+
/** Marks the button busy and ignores presses until the work is done. */
|
|
5
|
+
pending?: boolean;
|
|
6
|
+
} & (({
|
|
7
|
+
href?: never;
|
|
8
|
+
} & ComponentPropsWithRef<'button'>) | ({
|
|
9
|
+
href: string;
|
|
10
|
+
} & ComponentPropsWithRef<'a'>));
|
|
11
|
+
declare const Button: ({ pending, ...props }: ButtonProps) => import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Button, type ButtonProps };
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
//#region src/button.tsx
|
|
3
|
+
const Button = ({ pending = false, ...props }) => {
|
|
4
|
+
const busy = {
|
|
5
|
+
"aria-busy": pending || void 0,
|
|
6
|
+
"data-pending": pending || void 0,
|
|
7
|
+
onClick: pending ? (event) => event.preventDefault() : props.onClick
|
|
8
|
+
};
|
|
9
|
+
return typeof props.href === "string" ? /* @__PURE__ */ jsx("a", {
|
|
10
|
+
"data-slot": "button",
|
|
11
|
+
...props,
|
|
12
|
+
...busy
|
|
13
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
14
|
+
"data-slot": "button",
|
|
15
|
+
type: "button",
|
|
16
|
+
...props,
|
|
17
|
+
...busy
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Button };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { IconButtonProps } from "./icon-button.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
//#region src/calendar-parts.d.ts
|
|
4
|
+
type CalendarView = 'days' | 'months' | 'years';
|
|
5
|
+
type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
|
+
/** A range being picked: `to` stays null until the second click. */
|
|
7
|
+
type CalendarRange = {
|
|
8
|
+
from: Date;
|
|
9
|
+
to: Date | null;
|
|
10
|
+
};
|
|
11
|
+
type CalendarState = {
|
|
12
|
+
selected: Date | null;
|
|
13
|
+
/** When set, days show as a range instead of a single selection. */
|
|
14
|
+
range?: CalendarRange | null;
|
|
15
|
+
month: Date;
|
|
16
|
+
view: CalendarView;
|
|
17
|
+
};
|
|
18
|
+
type CalendarActions = {
|
|
19
|
+
select: (date: Date) => void;
|
|
20
|
+
showMonth: (month: Date) => void;
|
|
21
|
+
showView: (view: CalendarView) => void;
|
|
22
|
+
previous: () => void;
|
|
23
|
+
next: () => void;
|
|
24
|
+
};
|
|
25
|
+
type CalendarMeta = {
|
|
26
|
+
locale?: string;
|
|
27
|
+
weekStartsOn: Weekday;
|
|
28
|
+
};
|
|
29
|
+
type CalendarContextValue = {
|
|
30
|
+
state: CalendarState;
|
|
31
|
+
actions: CalendarActions;
|
|
32
|
+
meta: CalendarMeta;
|
|
33
|
+
};
|
|
34
|
+
/** What a day, month or year cell is right now. Also set as its `data-state`. */
|
|
35
|
+
type CalendarCellState = 'idle' | 'today' | 'selected' | 'inRange';
|
|
36
|
+
declare const YEAR_PAGE_SIZE = 12;
|
|
37
|
+
declare const useCalendar: any;
|
|
38
|
+
type ProviderProps = CalendarContextValue & {
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
declare const Provider: ({ state, actions, meta, children }: ProviderProps) => import("react").JSX.Element;
|
|
42
|
+
/** Month, view and paging shared by every calendar-based picker. */
|
|
43
|
+
declare const useCalendarNavigation: (initialMonth: Date, initialView?: CalendarView) => {
|
|
44
|
+
month: any;
|
|
45
|
+
view: CalendarView;
|
|
46
|
+
navigation: {
|
|
47
|
+
showMonth: (next: Date) => void;
|
|
48
|
+
showView: import("react").Dispatch<import("react").SetStateAction<CalendarView>>;
|
|
49
|
+
previous: () => void;
|
|
50
|
+
next: () => void;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
type RootProps = {
|
|
54
|
+
value?: Date | null;
|
|
55
|
+
defaultValue?: Date | null;
|
|
56
|
+
onValueChange?: (date: Date) => void;
|
|
57
|
+
defaultMonth?: Date;
|
|
58
|
+
locale?: string;
|
|
59
|
+
weekStartsOn?: Weekday;
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
};
|
|
62
|
+
declare const Root: ({ value, defaultValue, onValueChange, defaultMonth, locale, weekStartsOn, children }: RootProps) => import("react").JSX.Element;
|
|
63
|
+
declare const Frame: (props: ComponentPropsWithRef<'div'>) => import("react").JSX.Element;
|
|
64
|
+
declare const Header: (props: ComponentPropsWithRef<'div'>) => import("react").JSX.Element;
|
|
65
|
+
declare const Heading: ({ onClick, ...props }: Omit<ComponentPropsWithRef<'button'>, 'children'>) => import("react").JSX.Element;
|
|
66
|
+
declare const Previous: (props: IconButtonProps) => import("react").JSX.Element;
|
|
67
|
+
declare const Next: (props: IconButtonProps) => import("react").JSX.Element;
|
|
68
|
+
type GridProps<Slot extends string> = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
|
|
69
|
+
classNames?: Partial<Record<Slot, (state: CalendarCellState) => string>>;
|
|
70
|
+
};
|
|
71
|
+
type WeekdaysProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
|
|
72
|
+
classNames?: {
|
|
73
|
+
weekday?: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
declare const Weekdays: ({ classNames, ...props }: WeekdaysProps) => import("react").JSX.Element | null;
|
|
77
|
+
declare const Days: ({ classNames, ...props }: GridProps<'day'>) => import("react").JSX.Element | null;
|
|
78
|
+
declare const Months: ({ classNames, ...props }: GridProps<'month'>) => import("react").JSX.Element | null;
|
|
79
|
+
declare const Years: ({ classNames, ...props }: GridProps<'year'>) => import("react").JSX.Element | null;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { type CalendarActions, type CalendarCellState, type CalendarContextValue, type CalendarMeta, type CalendarRange, type CalendarState, type CalendarView, Days, Frame, Header, Heading, Months, Next, Previous, Provider, Root, type RootProps, type Weekday, Weekdays, YEAR_PAGE_SIZE, Years, useCalendar, useCalendarNavigation };
|