Skip to content

Commit

Permalink
delete EmptyMessage and uninstall react-router-dom
Browse files Browse the repository at this point in the history
  • Loading branch information
david-crespo committed Oct 30, 2024
1 parent c130922 commit 067ab78
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 176 deletions.
23 changes: 4 additions & 19 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, ReactElement } from 'react';
import { ReactNode } from 'react';
import { TabsProps, TabsTriggerProps, TabsListProps, TabsContentProps } from '@radix-ui/react-tabs';
import { SetRequired } from 'type-fest';

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

type TabsRootProps = SetRequired<TabsProps, 'defaultValue'>;
declare const Tabs: {
Expand All @@ -80,21 +80,6 @@ type CheckboxProps = {
/** 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;
} & ({
Expand All @@ -117,4 +102,4 @@ interface ListboxProps<Value extends string = string> {
}
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 };
export { AsciiDocBlocks, Badge, BadgeColor, BadgeProps, BadgeVariant, Button, ButtonProps, ButtonSize, Checkbox, CheckboxProps, Listbox, ListboxItem, ListboxProps, Spinner, SpinnerLoader, SpinnerSize, SpinnerVariant, Tabs, TabsRootProps, Variant, badgeColors, buttonSizes, buttonStyle, spinnerSizes, spinnerVariants, variants };
52 changes: 15 additions & 37 deletions components/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56437,7 +56437,6 @@ __export(src_exports, {
Badge: () => Badge,
Button: () => Button,
Checkbox: () => Checkbox,
EmptyMessage: () => EmptyMessage,
Listbox: () => Listbox,
Spinner: () => Spinner,
SpinnerLoader: () => SpinnerLoader,
Expand Down Expand Up @@ -57480,31 +57479,11 @@ var Checkbox = ({
children && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "ml-2.5 text-sans-md text-secondary", children })
] });

// components/src/ui/empty-message/EmptyMessage.tsx
var import_classnames8 = __toESM(require_classnames());
var import_react_router_dom = require("react-router-dom");
var import_jsx_runtime169 = require("react/jsx-runtime");
var buttonStyleProps = { variant: "ghost", size: "sm", color: "secondary" };
function EmptyMessage(props) {
let button = null;
if (props.buttonText && "buttonTo" in props) {
button = /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(import_react_router_dom.Link, { className: (0, import_classnames8.default)("mt-6", buttonStyle(buttonStyleProps)), to: props.buttonTo, children: props.buttonText });
} else if (props.buttonText && "onClick" in props) {
button = /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(Button, { ...buttonStyleProps, className: "mt-6", onClick: props.onClick, children: props.buttonText });
}
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "m-4 flex max-w-[14rem] flex-col items-center text-center", children: [
props.icon && /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "mb-4 rounded p-1 leading-[0] text-accent bg-accent-secondary", children: props.icon }),
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)("h3", { className: "text-sans-semi-lg", children: props.title }),
props.body && /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("p", { className: "mt-1 text-sans-md text-secondary", children: props.body }),
button
] });
}

// components/src/ui/listbox/Listbox.tsx
var import_react7 = require("@floating-ui/react");
var import_react8 = require("@headlessui/react");
var import_classnames9 = __toESM(require_classnames());
var import_jsx_runtime170 = require("react/jsx-runtime");
var import_classnames8 = __toESM(require_classnames());
var import_jsx_runtime169 = require("react/jsx-runtime");
var Listbox = ({
name,
selected,
Expand Down Expand Up @@ -57533,19 +57512,19 @@ var Listbox = ({
const selectedItem = selected && items.find((i) => i.value === selected);
const noItems = !isLoading && items.length === 0;
const isDisabled = disabled || noItems;
return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("div", { className: (0, import_classnames9.default)("relative", className), children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: (0, import_classnames8.default)("relative", className), children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
import_react8.Listbox,
{
value: selected,
onChange: (val) => val !== null && onChange(val),
disabled: isDisabled || isLoading,
children: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(import_jsx_runtime170.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(
children: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(import_jsx_runtime169.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
import_react8.Listbox.Button,
{
name,
ref: refs.setReference,
className: (0, import_classnames9.default)(
className: (0, import_classnames8.default)(
`flex h-10 w-full items-center justify-between
rounded border text-sans-md`,
hasError ? "focus-error border-error-secondary hover:border-error" : "border-default hover:border-hover",
Expand All @@ -57556,37 +57535,37 @@ var Listbox = ({
),
...props,
children: [
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)("div", { className: "w-full px-3 text-left", children: selectedItem ? (
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "w-full px-3 text-left", children: selectedItem ? (
// labelString is one line, which is what we need when label is a ReactNode
selectedItem.labelString || selectedItem.label
) : /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "text-quaternary", children: noItems ? "No items" : placeholder }) }),
!isDisabled && /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(SpinnerLoader, { isLoading }),
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
) : /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("span", { className: "text-quaternary", children: noItems ? "No items" : placeholder }) }),
!isDisabled && /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(SpinnerLoader, { isLoading }),
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
"div",
{
className: "ml-3 flex h-[calc(100%-12px)] items-center border-l px-3 border-secondary",
"aria-hidden": true,
children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(SelectArrows6Icon_default, { className: "h-[14px] w-2 text-tertiary" })
children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(SelectArrows6Icon_default, { className: "h-[14px] w-2 text-tertiary" })
}
)
]
}
),
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_react7.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(import_react7.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
import_react8.Listbox.Options,
{
ref: refs.setFloating,
style: floatingStyles,
className: "ox-menu pointer-events-auto z-50 overflow-y-auto !outline-none",
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
import_react8.Listbox.Option,
{
value: item.value,
className: "relative border-b border-secondary last:border-0",
children: ({ active, selected: selected2 }) => /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
children: ({ active, selected: selected2 }) => /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
"div",
{
className: (0, import_classnames9.default)(
className: (0, import_classnames8.default)(
"ox-menu-item text-secondary",
selected2 && "is-selected",
active && "is-highlighted"
Expand All @@ -57609,7 +57588,6 @@ var Listbox = ({
Badge,
Button,
Checkbox,
EmptyMessage,
Listbox,
Spinner,
SpinnerLoader,
Expand Down
2 changes: 1 addition & 1 deletion components/dist/index.js.map

Large diffs are not rendered by default.

53 changes: 0 additions & 53 deletions components/src/ui/empty-message/EmptyMessage.tsx

This file was deleted.

1 change: 0 additions & 1 deletion components/src/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ export * from './button/Button'
export * from './spinner/Spinner'
export * from './tabs/Tabs'
export * from './checkbox/Checkbox'
export * from './empty-message/EmptyMessage'
export * from './listbox/Listbox'
63 changes: 1 addition & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"@floating-ui/react": "^0.25.1",
"@headlessui/react": "^1.7.17",
"@radix-ui/react-tabs": "^1.0.4",
"html-entities": "^2.4.0",
"react-router-dom": "^6.15.0"
"html-entities": "^2.4.0"
}
}
2 changes: 1 addition & 1 deletion styles/src/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -2461,4 +2461,4 @@
"main"
]
}
}
}

0 comments on commit 067ab78

Please sign in to comment.