@cellarnode/ui 0.17.3 → 0.17.4
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/dist/components/__tests__/countdown-pill.test.d.ts +2 -0
- package/dist/components/__tests__/countdown-pill.test.d.ts.map +1 -0
- package/dist/components/__tests__/countdown-pill.test.js +28 -0
- package/dist/components/__tests__/countdown-pill.test.js.map +1 -0
- package/dist/components/__tests__/country-flag.test.d.ts +2 -0
- package/dist/components/__tests__/country-flag.test.d.ts.map +1 -0
- package/dist/components/__tests__/country-flag.test.js +20 -0
- package/dist/components/__tests__/country-flag.test.js.map +1 -0
- package/dist/components/__tests__/status-pill.test.d.ts +2 -0
- package/dist/components/__tests__/status-pill.test.d.ts.map +1 -0
- package/dist/components/__tests__/status-pill.test.js +24 -0
- package/dist/components/__tests__/status-pill.test.js.map +1 -0
- package/dist/components/confirmation-dialog.stories.d.ts +26 -0
- package/dist/components/confirmation-dialog.stories.d.ts.map +1 -0
- package/dist/components/confirmation-dialog.stories.js +94 -0
- package/dist/components/confirmation-dialog.stories.js.map +1 -0
- package/dist/components/countdown-pill.d.ts +7 -0
- package/dist/components/countdown-pill.d.ts.map +1 -0
- package/dist/components/countdown-pill.js +27 -0
- package/dist/components/countdown-pill.js.map +1 -0
- package/dist/components/countdown-pill.stories.d.ts +15 -0
- package/dist/components/countdown-pill.stories.d.ts.map +1 -0
- package/dist/components/countdown-pill.stories.js +14 -0
- package/dist/components/countdown-pill.stories.js.map +1 -0
- package/dist/components/country-flag.d.ts +6 -0
- package/dist/components/country-flag.d.ts.map +1 -0
- package/dist/components/country-flag.js +31 -0
- package/dist/components/country-flag.js.map +1 -0
- package/dist/components/country-flag.stories.d.ts +14 -0
- package/dist/components/country-flag.stories.d.ts.map +1 -0
- package/dist/components/country-flag.stories.js +16 -0
- package/dist/components/country-flag.stories.js.map +1 -0
- package/dist/components/period-select.stories.d.ts +29 -0
- package/dist/components/period-select.stories.d.ts.map +1 -0
- package/dist/components/period-select.stories.js +65 -0
- package/dist/components/period-select.stories.js.map +1 -0
- package/dist/components/sidebar/context.d.ts +24 -0
- package/dist/components/sidebar/context.d.ts.map +1 -0
- package/dist/components/sidebar/context.js +73 -0
- package/dist/components/sidebar/context.js.map +1 -0
- package/dist/components/sidebar/index.d.ts +9 -0
- package/dist/components/sidebar/index.d.ts.map +1 -0
- package/dist/components/sidebar/index.js +9 -0
- package/dist/components/sidebar/index.js.map +1 -0
- package/dist/components/sidebar/sidebar-group.d.ts +10 -0
- package/dist/components/sidebar/sidebar-group.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar-group.js +21 -0
- package/dist/components/sidebar/sidebar-group.js.map +1 -0
- package/dist/components/sidebar/sidebar-inset.d.ts +3 -0
- package/dist/components/sidebar/sidebar-inset.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar-inset.js +7 -0
- package/dist/components/sidebar/sidebar-inset.js.map +1 -0
- package/dist/components/sidebar/sidebar-menu-sub.d.ts +9 -0
- package/dist/components/sidebar/sidebar-menu-sub.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar-menu-sub.js +15 -0
- package/dist/components/sidebar/sidebar-menu-sub.js.map +1 -0
- package/dist/components/sidebar/sidebar-menu.d.ts +23 -0
- package/dist/components/sidebar/sidebar-menu.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar-menu.js +63 -0
- package/dist/components/sidebar/sidebar-menu.js.map +1 -0
- package/dist/components/sidebar/sidebar-sections.d.ts +8 -0
- package/dist/components/sidebar/sidebar-sections.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar-sections.js +20 -0
- package/dist/components/sidebar/sidebar-sections.js.map +1 -0
- package/dist/components/sidebar/sidebar-trigger.d.ts +4 -0
- package/dist/components/sidebar/sidebar-trigger.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar-trigger.js +17 -0
- package/dist/components/sidebar/sidebar-trigger.js.map +1 -0
- package/dist/components/sidebar/sidebar.d.ts +7 -0
- package/dist/components/sidebar/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar.js +26 -0
- package/dist/components/sidebar/sidebar.js.map +1 -0
- package/dist/components/status-pill.d.ts +7 -0
- package/dist/components/status-pill.d.ts.map +1 -0
- package/dist/components/status-pill.js +14 -0
- package/dist/components/status-pill.js.map +1 -0
- package/dist/components/status-pill.stories.d.ts +21 -0
- package/dist/components/status-pill.stories.d.ts.map +1 -0
- package/dist/components/status-pill.stories.js +18 -0
- package/dist/components/status-pill.stories.js.map +1 -0
- package/dist/components/toast.stories.d.ts +25 -0
- package/dist/components/toast.stories.d.ts.map +1 -0
- package/dist/components/toast.stories.js +38 -0
- package/dist/components/toast.stories.js.map +1 -0
- package/dist/components/toaster.stories.d.ts +19 -0
- package/dist/components/toaster.stories.d.ts.map +1 -0
- package/dist/components/toaster.stories.js +27 -0
- package/dist/components/toaster.stories.js.map +1 -0
- package/dist/globe/globe-scene-camera.d.ts +25 -0
- package/dist/globe/globe-scene-camera.d.ts.map +1 -0
- package/dist/globe/globe-scene-camera.js +59 -0
- package/dist/globe/globe-scene-camera.js.map +1 -0
- package/dist/globe/globe-scene-channel.d.ts +27 -0
- package/dist/globe/globe-scene-channel.d.ts.map +1 -0
- package/dist/globe/globe-scene-channel.js +60 -0
- package/dist/globe/globe-scene-channel.js.map +1 -0
- package/dist/globe/globe-scene-controls.d.ts +38 -0
- package/dist/globe/globe-scene-controls.d.ts.map +1 -0
- package/dist/globe/globe-scene-controls.js +62 -0
- package/dist/globe/globe-scene-controls.js.map +1 -0
- package/dist/globe/globe-scene-data.d.ts +16 -0
- package/dist/globe/globe-scene-data.d.ts.map +1 -0
- package/dist/globe/globe-scene-data.js +51 -0
- package/dist/globe/globe-scene-data.js.map +1 -0
- package/dist/globe/globe-scene-interactions.d.ts +11 -0
- package/dist/globe/globe-scene-interactions.d.ts.map +1 -0
- package/dist/globe/globe-scene-interactions.js +54 -0
- package/dist/globe/globe-scene-interactions.js.map +1 -0
- package/dist/globe/globe-scene-layers.d.ts +22 -0
- package/dist/globe/globe-scene-layers.d.ts.map +1 -0
- package/dist/globe/globe-scene-layers.js +170 -0
- package/dist/globe/globe-scene-layers.js.map +1 -0
- package/dist/globe/globe-scene-props.d.ts +32 -0
- package/dist/globe/globe-scene-props.d.ts.map +1 -0
- package/dist/globe/globe-scene-props.js +8 -0
- package/dist/globe/globe-scene-props.js.map +1 -0
- package/dist/globe/globe-scene-types.d.ts +34 -0
- package/dist/globe/globe-scene-types.d.ts.map +1 -0
- package/dist/globe/globe-scene-types.js +14 -0
- package/dist/globe/globe-scene-types.js.map +1 -0
- package/dist/globe/globe-scene.d.ts +10 -25
- package/dist/globe/globe-scene.d.ts.map +1 -1
- package/dist/globe/globe-scene.js +54 -349
- package/dist/globe/globe-scene.js.map +1 -1
- package/dist/hooks/__tests__/use-animated-number.test.d.ts +2 -0
- package/dist/hooks/__tests__/use-animated-number.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/use-animated-number.test.js +58 -0
- package/dist/hooks/__tests__/use-animated-number.test.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-animated-number.d.ts +6 -0
- package/dist/hooks/use-animated-number.d.ts.map +1 -0
- package/dist/hooks/use-animated-number.js +56 -0
- package/dist/hooks/use-animated-number.js.map +1 -0
- package/dist/notifications/notification-badge.stories.d.ts +42 -0
- package/dist/notifications/notification-badge.stories.d.ts.map +1 -0
- package/dist/notifications/notification-badge.stories.js +42 -0
- package/dist/notifications/notification-badge.stories.js.map +1 -0
- package/dist/notifications/notification-empty-state.stories.d.ts +16 -0
- package/dist/notifications/notification-empty-state.stories.d.ts.map +1 -0
- package/dist/notifications/notification-empty-state.stories.js +22 -0
- package/dist/notifications/notification-empty-state.stories.js.map +1 -0
- package/dist/notifications/notification-item.stories.d.ts +41 -0
- package/dist/notifications/notification-item.stories.d.ts.map +1 -0
- package/dist/notifications/notification-item.stories.js +110 -0
- package/dist/notifications/notification-item.stories.js.map +1 -0
- package/dist/notifications/notification-list.stories.d.ts +25 -0
- package/dist/notifications/notification-list.stories.d.ts.map +1 -0
- package/dist/notifications/notification-list.stories.js +148 -0
- package/dist/notifications/notification-list.stories.js.map +1 -0
- package/dist/notifications/notification-page.stories.d.ts +20 -0
- package/dist/notifications/notification-page.stories.d.ts.map +1 -0
- package/dist/notifications/notification-page.stories.js +140 -0
- package/dist/notifications/notification-page.stories.js.map +1 -0
- package/dist/notifications/notification-tray.stories.d.ts +21 -0
- package/dist/notifications/notification-tray.stories.d.ts.map +1 -0
- package/dist/notifications/notification-tray.stories.js +123 -0
- package/dist/notifications/notification-tray.stories.js.map +1 -0
- package/dist/notifications/push-prompt-banner.stories.d.ts +27 -0
- package/dist/notifications/push-prompt-banner.stories.d.ts.map +1 -0
- package/dist/notifications/push-prompt-banner.stories.js +33 -0
- package/dist/notifications/push-prompt-banner.stories.js.map +1 -0
- package/dist/offer/__tests__/opportunity-requirements.test.d.ts +2 -0
- package/dist/offer/__tests__/opportunity-requirements.test.d.ts.map +1 -0
- package/dist/offer/__tests__/opportunity-requirements.test.js +33 -0
- package/dist/offer/__tests__/opportunity-requirements.test.js.map +1 -0
- package/dist/offer/offer-detail-header.stories.d.ts +19 -0
- package/dist/offer/offer-detail-header.stories.d.ts.map +1 -0
- package/dist/offer/offer-detail-header.stories.js +59 -0
- package/dist/offer/offer-detail-header.stories.js.map +1 -0
- package/dist/offer/offer-detail-shell.stories.d.ts +17 -0
- package/dist/offer/offer-detail-shell.stories.d.ts.map +1 -0
- package/dist/offer/offer-detail-shell.stories.js +69 -0
- package/dist/offer/offer-detail-shell.stories.js.map +1 -0
- package/dist/offer/offer-detail-tabs.stories.d.ts +17 -0
- package/dist/offer/offer-detail-tabs.stories.d.ts.map +1 -0
- package/dist/offer/offer-detail-tabs.stories.js +66 -0
- package/dist/offer/offer-detail-tabs.stories.js.map +1 -0
- package/dist/offer/opportunity-requirements.d.ts.map +1 -1
- package/dist/offer/opportunity-requirements.js +4 -0
- package/dist/offer/opportunity-requirements.js.map +1 -1
- package/dist/opportunities/__tests__/opportunity-channel-badge.test.d.ts +2 -0
- package/dist/opportunities/__tests__/opportunity-channel-badge.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/opportunity-channel-badge.test.js +23 -0
- package/dist/opportunities/__tests__/opportunity-channel-badge.test.js.map +1 -0
- package/dist/opportunities/__tests__/opportunity-detail-panel.test.d.ts +2 -0
- package/dist/opportunities/__tests__/opportunity-detail-panel.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/opportunity-detail-panel.test.js +50 -0
- package/dist/opportunities/__tests__/opportunity-detail-panel.test.js.map +1 -0
- package/dist/opportunities/__tests__/opportunity-empty-state.test.d.ts +2 -0
- package/dist/opportunities/__tests__/opportunity-empty-state.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/opportunity-empty-state.test.js +19 -0
- package/dist/opportunities/__tests__/opportunity-empty-state.test.js.map +1 -0
- package/dist/opportunities/__tests__/opportunity-offers-count-chip.test.d.ts +2 -0
- package/dist/opportunities/__tests__/opportunity-offers-count-chip.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/opportunity-offers-count-chip.test.js +25 -0
- package/dist/opportunities/__tests__/opportunity-offers-count-chip.test.js.map +1 -0
- package/dist/opportunities/__tests__/opportunity-stacked-card.test.d.ts +2 -0
- package/dist/opportunities/__tests__/opportunity-stacked-card.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/opportunity-stacked-card.test.js +99 -0
- package/dist/opportunities/__tests__/opportunity-stacked-card.test.js.map +1 -0
- package/dist/opportunities/__tests__/opportunity-stacked-list.test.d.ts +2 -0
- package/dist/opportunities/__tests__/opportunity-stacked-list.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/opportunity-stacked-list.test.js +98 -0
- package/dist/opportunities/__tests__/opportunity-stacked-list.test.js.map +1 -0
- package/dist/opportunities/__tests__/section-field.test.d.ts +2 -0
- package/dist/opportunities/__tests__/section-field.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/section-field.test.js +28 -0
- package/dist/opportunities/__tests__/section-field.test.js.map +1 -0
- package/dist/opportunities/__tests__/two-column-section.test.d.ts +2 -0
- package/dist/opportunities/__tests__/two-column-section.test.d.ts.map +1 -0
- package/dist/opportunities/__tests__/two-column-section.test.js +25 -0
- package/dist/opportunities/__tests__/two-column-section.test.js.map +1 -0
- package/dist/opportunities/opportunity-channel-badge.d.ts +7 -0
- package/dist/opportunities/opportunity-channel-badge.d.ts.map +1 -0
- package/dist/opportunities/opportunity-channel-badge.js +13 -0
- package/dist/opportunities/opportunity-channel-badge.js.map +1 -0
- package/dist/opportunities/opportunity-channel-badge.stories.d.ts +13 -0
- package/dist/opportunities/opportunity-channel-badge.stories.d.ts.map +1 -0
- package/dist/opportunities/opportunity-channel-badge.stories.js +11 -0
- package/dist/opportunities/opportunity-channel-badge.stories.js.map +1 -0
- package/dist/opportunities/opportunity-detail-panel.d.ts +13 -0
- package/dist/opportunities/opportunity-detail-panel.d.ts.map +1 -0
- package/dist/opportunities/opportunity-detail-panel.js +19 -0
- package/dist/opportunities/opportunity-detail-panel.js.map +1 -0
- package/dist/opportunities/opportunity-detail-panel.stories.d.ts +14 -0
- package/dist/opportunities/opportunity-detail-panel.stories.d.ts.map +1 -0
- package/dist/opportunities/opportunity-detail-panel.stories.js +53 -0
- package/dist/opportunities/opportunity-detail-panel.stories.js.map +1 -0
- package/dist/opportunities/opportunity-empty-state.d.ts +10 -0
- package/dist/opportunities/opportunity-empty-state.d.ts.map +1 -0
- package/dist/opportunities/opportunity-empty-state.js +6 -0
- package/dist/opportunities/opportunity-empty-state.js.map +1 -0
- package/dist/opportunities/opportunity-empty-state.stories.d.ts +13 -0
- package/dist/opportunities/opportunity-empty-state.stories.d.ts.map +1 -0
- package/dist/opportunities/opportunity-empty-state.stories.js +13 -0
- package/dist/opportunities/opportunity-empty-state.stories.js.map +1 -0
- package/dist/opportunities/opportunity-offers-count-chip.d.ts +6 -0
- package/dist/opportunities/opportunity-offers-count-chip.d.ts.map +1 -0
- package/dist/opportunities/opportunity-offers-count-chip.js +8 -0
- package/dist/opportunities/opportunity-offers-count-chip.js.map +1 -0
- package/dist/opportunities/opportunity-offers-count-chip.stories.d.ts +13 -0
- package/dist/opportunities/opportunity-offers-count-chip.stories.d.ts.map +1 -0
- package/dist/opportunities/opportunity-offers-count-chip.stories.js +11 -0
- package/dist/opportunities/opportunity-offers-count-chip.stories.js.map +1 -0
- package/dist/opportunities/opportunity-stacked-card.d.ts +20 -0
- package/dist/opportunities/opportunity-stacked-card.d.ts.map +1 -0
- package/dist/opportunities/opportunity-stacked-card.js +48 -0
- package/dist/opportunities/opportunity-stacked-card.js.map +1 -0
- package/dist/opportunities/opportunity-stacked-card.stories.d.ts +23 -0
- package/dist/opportunities/opportunity-stacked-card.stories.d.ts.map +1 -0
- package/dist/opportunities/opportunity-stacked-card.stories.js +143 -0
- package/dist/opportunities/opportunity-stacked-card.stories.js.map +1 -0
- package/dist/opportunities/opportunity-stacked-list.d.ts +28 -0
- package/dist/opportunities/opportunity-stacked-list.d.ts.map +1 -0
- package/dist/opportunities/opportunity-stacked-list.js +49 -0
- package/dist/opportunities/opportunity-stacked-list.js.map +1 -0
- package/dist/opportunities/opportunity-stacked-list.stories.d.ts +16 -0
- package/dist/opportunities/opportunity-stacked-list.stories.d.ts.map +1 -0
- package/dist/opportunities/opportunity-stacked-list.stories.js +38 -0
- package/dist/opportunities/opportunity-stacked-list.stories.js.map +1 -0
- package/dist/opportunities/section-field.d.ts +8 -0
- package/dist/opportunities/section-field.d.ts.map +1 -0
- package/dist/opportunities/section-field.js +9 -0
- package/dist/opportunities/section-field.js.map +1 -0
- package/dist/opportunities/section-field.stories.d.ts +13 -0
- package/dist/opportunities/section-field.stories.d.ts.map +1 -0
- package/dist/opportunities/section-field.stories.js +15 -0
- package/dist/opportunities/section-field.stories.js.map +1 -0
- package/dist/opportunities/two-column-section.d.ts +10 -0
- package/dist/opportunities/two-column-section.d.ts.map +1 -0
- package/dist/opportunities/two-column-section.js +21 -0
- package/dist/opportunities/two-column-section.js.map +1 -0
- package/dist/opportunities/two-column-section.stories.d.ts +12 -0
- package/dist/opportunities/two-column-section.stories.d.ts.map +1 -0
- package/dist/opportunities/two-column-section.stories.js +26 -0
- package/dist/opportunities/two-column-section.stories.js.map +1 -0
- package/dist/opportunities/types.d.ts +76 -0
- package/dist/opportunities/types.d.ts.map +1 -0
- package/dist/opportunities/types.js +2 -0
- package/dist/opportunities/types.js.map +1 -0
- package/dist/org/invite-member-dialog.stories.d.ts +24 -0
- package/dist/org/invite-member-dialog.stories.d.ts.map +1 -0
- package/dist/org/invite-member-dialog.stories.js +34 -0
- package/dist/org/invite-member-dialog.stories.js.map +1 -0
- package/dist/org/team-hero-banner.stories.d.ts +25 -0
- package/dist/org/team-hero-banner.stories.d.ts.map +1 -0
- package/dist/org/team-hero-banner.stories.js +53 -0
- package/dist/org/team-hero-banner.stories.js.map +1 -0
- package/dist/org/team-member-menu.stories.d.ts +19 -0
- package/dist/org/team-member-menu.stories.d.ts.map +1 -0
- package/dist/org/team-member-menu.stories.js +27 -0
- package/dist/org/team-member-menu.stories.js.map +1 -0
- package/dist/org/team-member-row.stories.d.ts +26 -0
- package/dist/org/team-member-row.stories.d.ts.map +1 -0
- package/dist/org/team-member-row.stories.js +61 -0
- package/dist/org/team-member-row.stories.js.map +1 -0
- package/dist/org/team-pending-row.stories.d.ts +23 -0
- package/dist/org/team-pending-row.stories.d.ts.map +1 -0
- package/dist/org/team-pending-row.stories.js +45 -0
- package/dist/org/team-pending-row.stories.js.map +1 -0
- package/package.json +1 -1
- package/src/theme/tokens.css +78 -0
- package/dist/components/sidebar.d.ts +0 -68
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/sidebar.js +0 -208
- package/dist/components/sidebar.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-pill.test.d.ts","sourceRoot":"","sources":["../../../src/components/__tests__/countdown-pill.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
|
3
|
+
import { render, screen } from "@testing-library/react";
|
|
4
|
+
import { CountdownPill } from "../countdown-pill";
|
|
5
|
+
describe("CountdownPill", () => {
|
|
6
|
+
beforeEach(() => { vi.useFakeTimers(); vi.setSystemTime(new Date("2026-04-21T12:00:00Z")); });
|
|
7
|
+
afterEach(() => { vi.useRealTimers(); });
|
|
8
|
+
it("renders 'Expired' when deadline is in the past", () => {
|
|
9
|
+
render(_jsx(CountdownPill, { date: new Date("2026-04-20T12:00:00Z") }));
|
|
10
|
+
expect(screen.getByText(/expired/i)).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
it("renders 'N days left' with calm tint when deadline is far away", () => {
|
|
13
|
+
const { container } = render(_jsx(CountdownPill, { date: new Date("2026-05-01T12:00:00Z") }));
|
|
14
|
+
expect(screen.getByText(/10 days left/i)).toBeInTheDocument();
|
|
15
|
+
expect(container.querySelector('[data-urgency="calm"]')).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
it("renders amber tint inside 7 days and includes 'deadline approaching' in aria-label", () => {
|
|
18
|
+
const { container } = render(_jsx(CountdownPill, { date: new Date("2026-04-26T12:00:00Z") }));
|
|
19
|
+
expect(container.querySelector('[data-urgency="urgent"]')).toBeTruthy();
|
|
20
|
+
const pill = screen.getByRole("status");
|
|
21
|
+
expect(pill).toHaveAttribute("aria-label", expect.stringContaining("deadline approaching"));
|
|
22
|
+
});
|
|
23
|
+
it("renders 'No deadline' when date is null", () => {
|
|
24
|
+
render(_jsx(CountdownPill, { date: null }));
|
|
25
|
+
expect(screen.getByText(/no deadline/i)).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=countdown-pill.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-pill.test.js","sourceRoot":"","sources":["../../../src/components/__tests__/countdown-pill.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9F,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,CAAC,GAAI,CAAC,CAAC;QAClE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACxE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,CAAC,GAAI,CAAC,CAAC;QACxF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAC9D,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oFAAoF,EAAE,GAAG,EAAE;QAC5F,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,CAAC,GAAI,CAAC,CAAC;QACxF,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACxE,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAC;QACtC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-flag.test.d.ts","sourceRoot":"","sources":["../../../src/components/__tests__/country-flag.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { render, screen } from "@testing-library/react";
|
|
4
|
+
import { CountryFlag } from "../country-flag";
|
|
5
|
+
describe("CountryFlag", () => {
|
|
6
|
+
it("renders a flag image with country aria-label for a valid ISO-3166 code", () => {
|
|
7
|
+
render(_jsx(CountryFlag, { code: "SE" }));
|
|
8
|
+
const el = screen.getByRole("img", { name: /sweden/i });
|
|
9
|
+
expect(el).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
it("normalises lowercase input", () => {
|
|
12
|
+
render(_jsx(CountryFlag, { code: "se" }));
|
|
13
|
+
expect(screen.getByRole("img", { name: /sweden/i })).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
it("falls back to a globe icon + 'Unknown country' label for unrecognised codes", () => {
|
|
16
|
+
render(_jsx(CountryFlag, { code: "ZZ" }));
|
|
17
|
+
expect(screen.getByRole("img", { name: /unknown country/i })).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=country-flag.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-flag.test.js","sourceRoot":"","sources":["../../../src/components/__tests__/country-flag.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,MAAM,CAAC,KAAC,WAAW,IAAC,IAAI,EAAC,IAAI,GAAG,CAAC,CAAC;QAClC,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,KAAC,WAAW,IAAC,IAAI,EAAC,IAAI,GAAG,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6EAA6E,EAAE,GAAG,EAAE;QACrF,MAAM,CAAC,KAAC,WAAW,IAAC,IAAI,EAAC,IAAI,GAAG,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-pill.test.d.ts","sourceRoot":"","sources":["../../../src/components/__tests__/status-pill.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { render, screen } from "@testing-library/react";
|
|
4
|
+
import { StatusPill } from "../status-pill";
|
|
5
|
+
describe("StatusPill", () => {
|
|
6
|
+
it.each([
|
|
7
|
+
["open", "Open"],
|
|
8
|
+
["closed", "Closed"],
|
|
9
|
+
["expired", "Expired"],
|
|
10
|
+
["draft", "Draft"],
|
|
11
|
+
])("renders %s variant with label %s", (status, expectedLabel) => {
|
|
12
|
+
render(_jsx(StatusPill, { status: status }));
|
|
13
|
+
expect(screen.getByText(expectedLabel)).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
it("attaches data-status attribute matching prop for CSS selectors", () => {
|
|
16
|
+
const { container } = render(_jsx(StatusPill, { status: "expired" }));
|
|
17
|
+
expect(container.querySelector('[data-status="expired"]')).toBeTruthy();
|
|
18
|
+
});
|
|
19
|
+
it("decorates icons as aria-hidden", () => {
|
|
20
|
+
const { container } = render(_jsx(StatusPill, { status: "open" }));
|
|
21
|
+
expect(container.querySelector("svg[aria-hidden='true']")).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=status-pill.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-pill.test.js","sourceRoot":"","sources":["../../../src/components/__tests__/status-pill.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,IAAI,CAAC;QACN,CAAC,MAAM,EAAE,MAAM,CAAC;QAChB,CAAC,QAAQ,EAAE,QAAQ,CAAC;QACpB,CAAC,SAAS,EAAE,SAAS,CAAC;QACtB,CAAC,OAAO,EAAE,OAAO,CAAC;KACV,CAAC,CAAC,kCAAkC,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE;QACxE,MAAM,CAAC,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACxE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,SAAS,GAAG,CAAC,CAAC;QAC9D,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG,CAAC,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { ConfirmationDialog } from "./confirmation-dialog";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof ConfirmationDialog;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
argTypes: {
|
|
11
|
+
tone: {
|
|
12
|
+
control: {
|
|
13
|
+
type: "select";
|
|
14
|
+
};
|
|
15
|
+
options: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const DangerDelete: Story;
|
|
22
|
+
export declare const WarningWithdraw: Story;
|
|
23
|
+
export declare const InfoConfirm: Story;
|
|
24
|
+
export declare const Pending: Story;
|
|
25
|
+
export declare const WithChildren: Story;
|
|
26
|
+
//# sourceMappingURL=confirmation-dialog.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-dialog.stories.d.ts","sourceRoot":"","sources":["../../src/components/confirmation-dialog.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;CAWiC,CAAC;AAE5C,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AA8BnC,eAAO,MAAM,YAAY,EAAE,KAc1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAY7B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAYzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAmB1B,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { ConfirmationDialog } from "./confirmation-dialog";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Components/ConfirmationDialog",
|
|
7
|
+
component: ConfirmationDialog,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
parameters: { layout: "centered" },
|
|
10
|
+
argTypes: {
|
|
11
|
+
tone: {
|
|
12
|
+
control: { type: "select" },
|
|
13
|
+
options: ["danger", "warning", "info"],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
function Wrapper(props) {
|
|
19
|
+
const { triggerLabel = "Open dialog", onClose, onConfirm, ...rest } = props;
|
|
20
|
+
const [open, setOpen] = useState(rest.open ?? true);
|
|
21
|
+
const handleClose = () => {
|
|
22
|
+
setOpen(false);
|
|
23
|
+
onClose?.();
|
|
24
|
+
};
|
|
25
|
+
const handleConfirm = async () => {
|
|
26
|
+
await onConfirm();
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsx(Button, { onClick: () => setOpen(true), children: triggerLabel }), _jsx(ConfirmationDialog, { ...rest, open: open, onClose: handleClose, onConfirm: handleConfirm })] }));
|
|
29
|
+
}
|
|
30
|
+
export const DangerDelete = {
|
|
31
|
+
args: {
|
|
32
|
+
open: true,
|
|
33
|
+
onClose: () => { },
|
|
34
|
+
onConfirm: () => { },
|
|
35
|
+
title: "Delete Solera Brandy Reserva?",
|
|
36
|
+
description: "This product and its 3 variants will be removed from your portfolio.",
|
|
37
|
+
warning: "Active offers tied to this product will be archived and buyers notified.",
|
|
38
|
+
tone: "danger",
|
|
39
|
+
confirmLabel: "Delete product",
|
|
40
|
+
},
|
|
41
|
+
render: (args) => _jsx(Wrapper, { ...args, triggerLabel: "Delete product" }),
|
|
42
|
+
};
|
|
43
|
+
export const WarningWithdraw = {
|
|
44
|
+
args: {
|
|
45
|
+
open: true,
|
|
46
|
+
onClose: () => { },
|
|
47
|
+
onConfirm: () => { },
|
|
48
|
+
title: "Withdraw offer to Systembolaget?",
|
|
49
|
+
description: "The buyer will be notified immediately. You can resend a new offer later.",
|
|
50
|
+
tone: "warning",
|
|
51
|
+
confirmLabel: "Withdraw offer",
|
|
52
|
+
},
|
|
53
|
+
render: (args) => _jsx(Wrapper, { ...args, triggerLabel: "Withdraw offer" }),
|
|
54
|
+
};
|
|
55
|
+
export const InfoConfirm = {
|
|
56
|
+
args: {
|
|
57
|
+
open: true,
|
|
58
|
+
onClose: () => { },
|
|
59
|
+
onConfirm: () => { },
|
|
60
|
+
title: "Mark opportunity as reviewed?",
|
|
61
|
+
description: "You will stop receiving reminders for the Monopol Norge winter allocation.",
|
|
62
|
+
tone: "info",
|
|
63
|
+
confirmLabel: "Mark reviewed",
|
|
64
|
+
},
|
|
65
|
+
render: (args) => _jsx(Wrapper, { ...args, triggerLabel: "Mark reviewed" }),
|
|
66
|
+
};
|
|
67
|
+
export const Pending = {
|
|
68
|
+
args: {
|
|
69
|
+
open: true,
|
|
70
|
+
onClose: () => { },
|
|
71
|
+
onConfirm: () => new Promise((resolve) => setTimeout(resolve, 60_000)),
|
|
72
|
+
title: "Archiving offer…",
|
|
73
|
+
description: "Please wait while we archive the conversation.",
|
|
74
|
+
tone: "info",
|
|
75
|
+
isPending: true,
|
|
76
|
+
confirmLabel: "Archive",
|
|
77
|
+
},
|
|
78
|
+
render: (args) => _jsx(Wrapper, { ...args, triggerLabel: "Archive offer" }),
|
|
79
|
+
};
|
|
80
|
+
export const WithChildren = {
|
|
81
|
+
args: {
|
|
82
|
+
open: true,
|
|
83
|
+
onClose: () => { },
|
|
84
|
+
onConfirm: () => { },
|
|
85
|
+
title: "Share portfolio with importer?",
|
|
86
|
+
description: "Grant read access to Cellar Imports Ltd.",
|
|
87
|
+
warning: "Importers with access can view all variant specs, pricing, and certificates.",
|
|
88
|
+
tone: "warning",
|
|
89
|
+
confirmLabel: "Grant access",
|
|
90
|
+
children: (_jsxs("label", { className: "flex items-center gap-2 text-sm text-foreground", children: [_jsx("input", { type: "checkbox", className: "size-4", defaultChecked: true }), "Notify the importer by email"] })),
|
|
91
|
+
},
|
|
92
|
+
render: (args) => _jsx(Wrapper, { ...args, triggerLabel: "Share portfolio" }),
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=confirmation-dialog.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-dialog.stories.js","sourceRoot":"","sources":["../../src/components/confirmation-dialog.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,+BAA+B;IACtC,SAAS,EAAE,kBAAkB;IAC7B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;IAClC,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC;SACvC;KACF;CACwC,CAAC;AAE5C,eAAe,IAAI,CAAC;AAGpB,SAAS,OAAO,CACd,KAAkF;IAElF,MAAM,EAAE,YAAY,GAAG,aAAa,EAAE,OAAO,EA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GAAE,CAAC;QACnB,KAAK,EAAE,gCAAgC;QACvC,WAAW,EAAE,0CAA0C;QACvD,OAAO,EACL,8EAA8E;QAChF,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,cAAc;QAC5B,QAAQ,EAAE,CACR,iBAAO,SAAS,EAAC,iDAAiD,aAChE,gBAAO,IAAI,EAAC,UAAU,EAAC,SAAS,EAAC,QAAQ,EAAC,cAAc,SAAG,oCAErD,CACT;KACF;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAC,OAAO,OAAK,IAAI,EAAE,YAAY,EAAC,iBAAiB,GAAG;CACvE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface CountdownPillProps {
|
|
2
|
+
date: Date | null;
|
|
3
|
+
now?: Date;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function CountdownPill({ date, now, className }: CountdownPillProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=countdown-pill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-pill.d.ts","sourceRoot":"","sources":["../../src/components/countdown-pill.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,kBAAkB,2CAkDzE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Clock } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
function daysBetween(a, b) {
|
|
6
|
+
const msPerDay = 24 * 60 * 60 * 1000;
|
|
7
|
+
return Math.floor((a.getTime() - b.getTime()) / msPerDay);
|
|
8
|
+
}
|
|
9
|
+
export function CountdownPill({ date, now, className }) {
|
|
10
|
+
// `now` defaults to the mount time — captured once via lazy state initializer
|
|
11
|
+
// so the component stays pure during render. Callers needing a live clock
|
|
12
|
+
// should pass a ticking `now` prop themselves.
|
|
13
|
+
const [mountTime] = React.useState(() => new Date());
|
|
14
|
+
const currentTime = now ?? mountTime;
|
|
15
|
+
if (!date) {
|
|
16
|
+
return (_jsx("span", { "data-urgency": "none", className: cn("inline-flex items-center gap-1 text-xs text-muted-foreground", className), children: "No deadline" }));
|
|
17
|
+
}
|
|
18
|
+
const days = daysBetween(date, currentTime);
|
|
19
|
+
if (days < 0) {
|
|
20
|
+
return (_jsxs("span", { role: "status", "aria-label": "Deadline has passed", "data-urgency": "expired", className: cn("inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-900", className), children: [_jsx(Clock, { "aria-hidden": true, className: "size-3" }), "Expired"] }));
|
|
21
|
+
}
|
|
22
|
+
const urgent = days <= 7;
|
|
23
|
+
const label = `${days} day${days === 1 ? "" : "s"} left`;
|
|
24
|
+
const ariaLabel = urgent ? `${label}, deadline approaching` : label;
|
|
25
|
+
return (_jsxs("span", { role: "status", "aria-label": ariaLabel, "data-urgency": urgent ? "urgent" : "calm", className: cn("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium", urgent ? "bg-amber-100 text-amber-900" : "bg-emerald-50 text-emerald-800", className), children: [_jsx(Clock, { "aria-hidden": true, className: "size-3" }), label] }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=countdown-pill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-pill.js","sourceRoot":"","sources":["../../src/components/countdown-pill.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,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AAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,wBAAwB,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpE,OAAO,CACL,gBACE,IAAI,EAAC,QAAQ,gBACD,SAAS,kBACP,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EACxC,SAAS,EAAE,EAAE,CACX,6EAA6E,EAC7E,MAAM,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,gCAAgC,EACzE,SAAS,CACV,aAED,KAAC,KAAK,yBAAa,SAAS,EAAC,QAAQ,GAAG,EACvC,KAAK,IACD,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { CountdownPill } from "./countdown-pill";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof CountdownPill;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const FarFuture: Story;
|
|
11
|
+
export declare const EightDays: Story;
|
|
12
|
+
export declare const InsideSevenDays: Story;
|
|
13
|
+
export declare const Expired: Story;
|
|
14
|
+
export declare const NoDeadline: Story;
|
|
15
|
+
//# sourceMappingURL=countdown-pill.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-pill.stories.d.ts","sourceRoot":"","sources":["../../src/components/countdown-pill.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,QAAA,MAAM,IAAI;;;;CAI4B,CAAC;AAEvC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAInC,eAAO,MAAM,SAAS,EAAE,KAAiE,CAAC;AAC1F,eAAO,MAAM,SAAS,EAAE,KAAiE,CAAC;AAC1F,eAAO,MAAM,eAAe,EAAE,KAAiE,CAAC;AAChG,eAAO,MAAM,OAAO,EAAE,KAAiE,CAAC;AACxF,eAAO,MAAM,UAAU,EAAE,KAAqC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CountdownPill } from "./countdown-pill";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "Components/CountdownPill",
|
|
4
|
+
component: CountdownPill,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
const now = new Date("2026-04-21T12:00:00Z");
|
|
9
|
+
export const FarFuture = { args: { date: new Date("2026-06-01T12:00:00Z"), now } };
|
|
10
|
+
export const EightDays = { args: { date: new Date("2026-04-29T12:00:00Z"), now } };
|
|
11
|
+
export const InsideSevenDays = { args: { date: new Date("2026-04-25T12:00:00Z"), now } };
|
|
12
|
+
export const Expired = { args: { date: new Date("2026-04-10T12:00:00Z"), now } };
|
|
13
|
+
export const NoDeadline = { args: { date: null, now } };
|
|
14
|
+
//# sourceMappingURL=countdown-pill.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown-pill.stories.js","sourceRoot":"","sources":["../../src/components/countdown-pill.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,0BAA0B;IACjC,SAAS,EAAE,aAAa;IACxB,IAAI,EAAE,CAAC,UAAU,CAAC;CACkB,CAAC;AAEvC,eAAe,IAAI,CAAC;AAGpB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;AAC1F,MAAM,CAAC,MAAM,eAAe,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;AAChG,MAAM,CAAC,MAAM,OAAO,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;AACxF,MAAM,CAAC,MAAM,UAAU,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-flag.d.ts","sourceRoot":"","sources":["../../src/components/country-flag.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsBD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,gBAAgB,2CAgBhE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Globe } from "lucide-react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
const COUNTRY_NAMES = {
|
|
5
|
+
SE: "Sweden", NO: "Norway", FI: "Finland", DK: "Denmark", IS: "Iceland",
|
|
6
|
+
DE: "Germany", FR: "France", IT: "Italy", ES: "Spain", PT: "Portugal",
|
|
7
|
+
NL: "Netherlands", BE: "Belgium", LU: "Luxembourg", AT: "Austria", CH: "Switzerland",
|
|
8
|
+
IE: "Ireland", GB: "United Kingdom", UK: "United Kingdom",
|
|
9
|
+
PL: "Poland", CZ: "Czech Republic", SK: "Slovakia", HU: "Hungary",
|
|
10
|
+
EE: "Estonia", LV: "Latvia", LT: "Lithuania",
|
|
11
|
+
US: "United States", CA: "Canada", MX: "Mexico",
|
|
12
|
+
CL: "Chile", AR: "Argentina", BR: "Brazil", UY: "Uruguay", PE: "Peru",
|
|
13
|
+
ZA: "South Africa", AU: "Australia", NZ: "New Zealand",
|
|
14
|
+
JP: "Japan", CN: "China", HK: "Hong Kong", KR: "South Korea",
|
|
15
|
+
};
|
|
16
|
+
function codeToFlagChar(code) {
|
|
17
|
+
const up = code.toUpperCase();
|
|
18
|
+
if (up.length !== 2)
|
|
19
|
+
return "";
|
|
20
|
+
const A = 0x1f1e6;
|
|
21
|
+
return String.fromCodePoint(A + (up.charCodeAt(0) - 65)) + String.fromCodePoint(A + (up.charCodeAt(1) - 65));
|
|
22
|
+
}
|
|
23
|
+
export function CountryFlag({ code, className }) {
|
|
24
|
+
const up = code?.toUpperCase() ?? "";
|
|
25
|
+
const name = COUNTRY_NAMES[up];
|
|
26
|
+
if (!name) {
|
|
27
|
+
return (_jsx("span", { role: "img", "aria-label": "Unknown country", className: cn("inline-flex items-center text-muted-foreground", className), children: _jsx(Globe, { "aria-hidden": true, className: "size-4" }) }));
|
|
28
|
+
}
|
|
29
|
+
return (_jsx("span", { role: "img", "aria-label": name, className: cn("inline-block", className), children: codeToFlagChar(up) }));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=country-flag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-flag.js","sourceRoot":"","sources":["../../src/components/country-flag.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAOlC,MAAM,aAAa,GAA2B;IAC5C,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ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AAE,CAAC,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC/G,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAoB;IAC/D,MAAM,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IAE/B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CACL,eAAM,IAAI,EAAC,KAAK,gBAAY,iBAAiB,EAAC,SAAS,EAAE,EAAE,CAAC,gDAAgD,EAAE,SAAS,CAAC,YACtH,KAAC,KAAK,yBAAa,SAAS,EAAC,QAAQ,GAAG,GACnC,CACR,CAAC;IACJ,CAAC;IACD,OAAO,CACL,eAAM,IAAI,EAAC,KAAK,gBAAa,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,YACxE,cAAc,CAAC,EAAE,CAAC,GACd,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { CountryFlag } from "./country-flag";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof CountryFlag;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const Sweden: Story;
|
|
11
|
+
export declare const UnitedStates: Story;
|
|
12
|
+
export declare const UnknownFallback: Story;
|
|
13
|
+
export declare const Many: Story;
|
|
14
|
+
//# sourceMappingURL=country-flag.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-flag.stories.d.ts","sourceRoot":"","sources":["../../src/components/country-flag.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAA,MAAM,IAAI;;;;CAI0B,CAAC;AAErC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,MAAM,EAAE,KAAgC,CAAC;AACtD,eAAO,MAAM,YAAY,EAAE,KAAgC,CAAC;AAC5D,eAAO,MAAM,eAAe,EAAE,KAAgC,CAAC;AAC/D,eAAO,MAAM,IAAI,EAAE,KAOlB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CountryFlag } from "./country-flag";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/CountryFlag",
|
|
5
|
+
component: CountryFlag,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
export const Sweden = { args: { code: "SE" } };
|
|
10
|
+
export const UnitedStates = { args: { code: "US" } };
|
|
11
|
+
export const UnknownFallback = { args: { code: "ZZ" } };
|
|
12
|
+
export const Many = {
|
|
13
|
+
args: { code: "SE" },
|
|
14
|
+
render: () => (_jsx("div", { className: "flex flex-wrap gap-2 text-2xl", children: ["SE", "NO", "FI", "DK", "IS", "DE", "FR", "IT", "ES", "US", "CL", "AU"].map(c => _jsx(CountryFlag, { code: c }, c)) })),
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=country-flag.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-flag.stories.js","sourceRoot":"","sources":["../../src/components/country-flag.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,wBAAwB;IAC/B,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,CAAC,UAAU,CAAC;CACgB,CAAC;AAErC,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,MAAM,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AACtD,MAAM,CAAC,MAAM,YAAY,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AAC/D,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACpB,MAAM,EAAE,GAAG,EAAE,CAAC,CACZ,cAAK,SAAS,EAAC,+BAA+B,YAC3C,CAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAC,WAAW,IAAS,IAAI,EAAE,CAAC,IAAV,CAAC,CAAa,CAAC,GACrG,CACP;CACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { PeriodSelect } from "./period-select";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof PeriodSelect;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
argTypes: {
|
|
11
|
+
value: {
|
|
12
|
+
control: {
|
|
13
|
+
type: "select";
|
|
14
|
+
};
|
|
15
|
+
options: ("30d" | "60d" | "90d" | "180d" | "1y")[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const Default: Story;
|
|
22
|
+
export declare const NinetyDays: Story;
|
|
23
|
+
export declare const OneYear: Story;
|
|
24
|
+
/**
|
|
25
|
+
* Pass a `t` function to translate the option labels. Here we simulate a
|
|
26
|
+
* Swedish translation to demonstrate label customisation.
|
|
27
|
+
*/
|
|
28
|
+
export declare const WithTranslation: Story;
|
|
29
|
+
//# sourceMappingURL=period-select.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"period-select.stories.d.ts","sourceRoot":"","sources":["../../src/components/period-select.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAwB,MAAM,iBAAiB,CAAC;AAErE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;CAW2B,CAAC;AAEtC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAUnC,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAkB7B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { PeriodSelect } from "./period-select";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/PeriodSelect",
|
|
6
|
+
component: PeriodSelect,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
parameters: { layout: "centered" },
|
|
9
|
+
argTypes: {
|
|
10
|
+
value: {
|
|
11
|
+
control: { type: "select" },
|
|
12
|
+
options: ["30d", "60d", "90d", "180d", "1y"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
function StatefulPeriodSelect(props) {
|
|
18
|
+
const [value, setValue] = useState(props.initialValue ?? "30d");
|
|
19
|
+
return _jsx(PeriodSelect, { value: value, onChange: setValue, t: props.t });
|
|
20
|
+
}
|
|
21
|
+
export const Default = {
|
|
22
|
+
args: {
|
|
23
|
+
value: "30d",
|
|
24
|
+
onChange: () => { },
|
|
25
|
+
},
|
|
26
|
+
render: () => _jsx(StatefulPeriodSelect, { initialValue: "30d" }),
|
|
27
|
+
};
|
|
28
|
+
export const NinetyDays = {
|
|
29
|
+
args: {
|
|
30
|
+
value: "90d",
|
|
31
|
+
onChange: () => { },
|
|
32
|
+
},
|
|
33
|
+
render: () => _jsx(StatefulPeriodSelect, { initialValue: "90d" }),
|
|
34
|
+
};
|
|
35
|
+
export const OneYear = {
|
|
36
|
+
args: {
|
|
37
|
+
value: "1y",
|
|
38
|
+
onChange: () => { },
|
|
39
|
+
},
|
|
40
|
+
render: () => _jsx(StatefulPeriodSelect, { initialValue: "1y" }),
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Pass a `t` function to translate the option labels. Here we simulate a
|
|
44
|
+
* Swedish translation to demonstrate label customisation.
|
|
45
|
+
*/
|
|
46
|
+
export const WithTranslation = {
|
|
47
|
+
args: {
|
|
48
|
+
value: "60d",
|
|
49
|
+
onChange: () => { },
|
|
50
|
+
},
|
|
51
|
+
render: () => {
|
|
52
|
+
const sv = (_key, fallback) => {
|
|
53
|
+
const map = {
|
|
54
|
+
"30 days": "30 dagar",
|
|
55
|
+
"60 days": "60 dagar",
|
|
56
|
+
"90 days": "90 dagar",
|
|
57
|
+
"6 months": "6 månader",
|
|
58
|
+
"1 year": "1 år",
|
|
59
|
+
};
|
|
60
|
+
return map[fallback] ?? fallback;
|
|
61
|
+
};
|
|
62
|
+
return _jsx(StatefulPeriodSelect, { initialValue: "60d", t: sv });
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=period-select.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"period-select.stories.js","sourceRoot":"","sources":["../../src/components/period-select.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAwB,MAAM,iBAAiB,CAAC;AAErE,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,YAAY;IACvB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;IAClC,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAA6B;SACzE;KACF;CACkC,CAAC;AAEtC,eAAe,IAAI,CAAC;AAGpB,SAAS,oBAAoB,CAAC,KAG7B;IACC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAkB,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,CAAC;IACjF,OAAO,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAI,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB;IACD,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,oBAAoB,IAAC,YAAY,EAAC,KAAK,GAAG;CAC1D,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE;QACJ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB;IACD,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,oBAAoB,IAAC,YAAY,EAAC,KAAK,GAAG;CAC1D,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB;IACD,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,oBAAoB,IAAC,YAAY,EAAC,IAAI,GAAG;CACzD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAU;IACpC,IAAI,EAAE;QACJ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB;IACD,MAAM,EAAE,GAAG,EAAE;QACX,MAAM,EAAE,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAE;YAC5C,MAAM,GAAG,GAA2B;gBAClC,SAAS,EAAE,UAAU;gBACrB,SAAS,EAAE,UAAU;gBACrB,SAAS,EAAE,UAAU;gBACrB,UAAU,EAAE,WAAW;gBACvB,QAAQ,EAAE,MAAM;aACjB,CAAC;YACF,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;QACnC,CAAC,CAAC;QACF,OAAO,KAAC,oBAAoB,IAAC,YAAY,EAAC,KAAK,EAAC,CAAC,EAAE,EAAE,GAAI,CAAC;IAC5D,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
3
|
+
export declare const SIDEBAR_COOKIE_MAX_AGE: number;
|
|
4
|
+
export declare const SIDEBAR_WIDTH = "16rem";
|
|
5
|
+
export declare const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
6
|
+
export declare const SIDEBAR_WIDTH_ICON = "3rem";
|
|
7
|
+
export declare const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
8
|
+
export type SidebarContextProps = {
|
|
9
|
+
state: "expanded" | "collapsed";
|
|
10
|
+
open: boolean;
|
|
11
|
+
setOpen: (open: boolean) => void;
|
|
12
|
+
openMobile: boolean;
|
|
13
|
+
setOpenMobile: (open: boolean) => void;
|
|
14
|
+
isMobile: boolean;
|
|
15
|
+
toggleSidebar: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const SidebarContext: React.Context<SidebarContextProps | null>;
|
|
18
|
+
export declare function useSidebar(): SidebarContextProps;
|
|
19
|
+
export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<"div"> & {
|
|
20
|
+
defaultOpen?: boolean;
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,eAAO,MAAM,mBAAmB,kBAAkB,CAAA;AAClD,eAAO,MAAM,sBAAsB,QAAmB,CAAA;AACtD,eAAO,MAAM,aAAa,UAAU,CAAA;AACpC,eAAO,MAAM,oBAAoB,UAAU,CAAA;AAC3C,eAAO,MAAM,kBAAkB,SAAS,CAAA;AACxC,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,UAAU,GAAG,WAAW,CAAA;IAC/B,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAChC,UAAU,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,cAAc,2CAAwD,CAAA;AAEnF,wBAAgB,UAAU,wBAOzB;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAkB,EAClB,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,WAAW,EACzB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACvC,2CAoFA"}
|