@gnome-ui/react 1.25.0 → 1.27.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/README.md CHANGED
@@ -72,6 +72,7 @@ export default function App() {
72
72
  | [`Blockquote`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-blockquote--docs) | Styled pull-quote with left-border accent; default, info, warning, error, success variants; optional icon and attribution |
73
73
  | [`Spinner`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-spinner--docs) | Indeterminate loading indicator; sm/md/lg sizes |
74
74
  | [`ProgressBar`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-progressbar--docs) | Determinate (0–1) and indeterminate progress indicator |
75
+ | [`CountDownTimer`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-countdowntimer--docs) | Countdown timer showing remaining time until a specified date; `date`, `time`, or `datetime` formats; executes callback on completion |
75
76
  | [`StatusPage`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-statuspage--docs) | Empty-state page with icon, title, description, and optional actions; `compact` prop for sidebars/popovers |
76
77
  | [`Separator`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-separator--docs) | Horizontal/vertical dividing line between content groups |
77
78
  | [`Chip`](https://eljijuna.github.io/gnome-ui/?path=/docs/components-chip--docs) | Compact pill-shaped label for tags, filters, and multi-select; static, removable, and selectable modes |
@@ -0,0 +1,20 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export type CountDownVariant = "accent" | "destructive" | "success" | "warning";
3
+ export interface CountDownTimerProps extends HTMLAttributes<HTMLDivElement> {
4
+ /** Start date for the countdown */
5
+ start: Date;
6
+ /** End date for the countdown */
7
+ end: Date;
8
+ /** Format to display: "date", "time", or "datetime" */
9
+ format?: "date" | "time" | "datetime";
10
+ /** Visual style variant. Defaults to `"accent"`. */
11
+ variant?: CountDownVariant;
12
+ /** Callback action to execute when countdown reaches zero */
13
+ action?: () => void;
14
+ }
15
+ /**
16
+ * CountDown timer component that displays remaining time and executes an action when time runs out.
17
+ *
18
+ * @see https://developer.gnome.org/hig/patterns/
19
+ */
20
+ export declare function CountDownTimer({ start, end, format, variant, action, className, ...props }: CountDownTimerProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ export { CountDownTimer } from './CountDownTimer';
2
+ export type { CountDownTimerProps, CountDownVariant } from './CountDownTimer';
@@ -1,32 +1,38 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
+ import { IconDefinition } from '@gnome-ui/icons';
3
+ export interface SidebarSectionHandle {
4
+ expand: () => void;
5
+ collapse: () => void;
6
+ toggle: () => void;
7
+ }
2
8
  export interface SidebarSectionProps extends HTMLAttributes<HTMLElement> {
3
9
  /**
4
10
  * Section heading. Rendered in small caps above the items.
5
11
  * Omit for an untitled section (e.g. the first group in a sidebar).
6
12
  */
7
13
  title?: string;
14
+ /** Icon rendered left of the title. Same type as `SidebarItem.icon`. */
15
+ icon?: IconDefinition;
16
+ /** Whether the section body can be toggled open/closed. Defaults to `false`. */
17
+ collapsible?: boolean;
18
+ /** Initial open state when `collapsible` is true. Defaults to `true`. */
19
+ defaultOpen?: boolean;
20
+ /** Controlled open state. */
21
+ open?: boolean;
22
+ /** Called when open state changes. */
23
+ onOpenChange?: (open: boolean) => void;
8
24
  children?: ReactNode;
9
25
  }
10
26
  /**
11
27
  * Named group of `SidebarItem` entries inside a `Sidebar`.
12
28
  *
13
- * Sections are separated by a thin divider. The title is optional
14
- * omit it for the primary section when the grouping is self-evident.
29
+ * Sections are separated by a thin divider. The title and icon are optional.
30
+ * When `collapsible` is true the body can be toggled via the header button or
31
+ * imperatively via a `ref` (`expand`, `collapse`, `toggle`).
15
32
  *
16
- * Mirrors the `AdwSidebar` section model (libadwaita 1.9 / GNOME 50).
33
+ * In rail (icon-only) mode the body is always visible regardless of open state.
34
+ * When a sidebar filter is active and no children match, the section is hidden.
17
35
  *
18
- * @example
19
- * ```tsx
20
- * <Sidebar>
21
- * <SidebarSection title="Mailboxes">
22
- * <SidebarItem label="Inbox" icon={GoHome} active />
23
- * <SidebarItem label="Sent" icon={Share} />
24
- * </SidebarSection>
25
- * <SidebarSection title="Tags">
26
- * <SidebarItem label="Work" icon={Star} />
27
- * <SidebarItem label="Personal" icon={Star} />
28
- * </SidebarSection>
29
- * </Sidebar>
30
- * ```
36
+ * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Sidebar.html
31
37
  */
32
- export declare function SidebarSection({ title, children, className, ...props }: SidebarSectionProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare const SidebarSection: import('react').ForwardRefExoticComponent<SidebarSectionProps & import('react').RefAttributes<SidebarSectionHandle>>;
@@ -1,6 +1,6 @@
1
1
  export { Sidebar, SidebarCollapsedContext, useSidebarCollapsed } from './Sidebar';
2
2
  export type { SidebarProps } from './Sidebar';
3
3
  export { SidebarSection } from './SidebarSection';
4
- export type { SidebarSectionProps } from './SidebarSection';
4
+ export type { SidebarSectionProps, SidebarSectionHandle } from './SidebarSection';
5
5
  export { SidebarItem } from './SidebarItem';
6
6
  export type { SidebarItemProps, SidebarMenuEntry } from './SidebarItem';