iryx-ui 0.8.0 → 0.9.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
@@ -199,21 +199,20 @@ For a static re-brand, plain CSS works too — tokens are just variables:
199
199
 
200
200
  ### Typeface
201
201
 
202
- The library ships **no webfont** — that would put font files, a licence and a
203
- network request into every app whether it wanted them or not. It reads one
204
- variable, defaulting to the system stack. Point it at your own family and
205
- everything follows, including Tailwind's `font-sans`:
202
+ Set `--iryx-font-sans` and everything follows, including Tailwind's
203
+ `font-sans`. Load the family however you like a package, a `<link>`, or
204
+ self-hosted:
206
205
 
207
206
  ```css
208
- @import "@fontsource-variable/instrument-sans"; /* or a <link>, or self-hosted */
207
+ @import "@fontsource-variable/instrument-sans";
209
208
 
210
209
  :root {
211
210
  --iryx-font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
212
211
  }
213
212
  ```
214
213
 
215
- Unlike the colour tokens, this one is not mode-specific — there is no `.dark`
216
- counterpart to keep in sync.
214
+ Leave it unset to use the system stack. There is no `.dark` counterpart for
215
+ this one.
217
216
 
218
217
  Available tokens, each usable as a Tailwind color (`bg-primary`,
219
218
  `text-muted-foreground`, …):
@@ -290,6 +289,8 @@ app.use(createIryxUi({ unstyled: true }))
290
289
  | `IFormField` | Label, description, hint, help and error text around a control |
291
290
  | `IInput` | Text field with `sm`/`md`/`lg` sizes, `invalid` state, `v-model`, `leading`/`trailing` slots, `clearable`, `loading`, `debounce` |
292
291
  | `INumberInput` | Decimal-safe numeric field — the model is a **string**, with `min`/`max`/`step`, `precision` and locale-aware display |
292
+ | `ISparkline` | Tiny inline trend chart — pure SVG, no charting dependency |
293
+ | `IBarChart` | Categorical bar chart with a round-number axis, hover tooltip and a table view |
293
294
  | `IFileUpload` | Drag-and-drop file field with `accept` / `maxSize` / `maxFiles`, thumbnails and a remove action |
294
295
  | `IDatePicker` | Calendar in a popover; the model is an ISO `YYYY-MM-DD` **string** |
295
296
  | `IDateRangePicker` | Two-month range calendar; the model is `{ start, end }` ISO strings |
@@ -481,6 +482,102 @@ chrome; use `ui` to reach the parts (`root`, `input`, `leading`, `trailing`,
481
482
  forwarded to the `<input>` itself. `ref` exposes the element as `.input` for
482
483
  focus management.
483
484
 
485
+ #### Bar charts
486
+
487
+ ```vue
488
+ <IBarChart
489
+ :data="[
490
+ { label: 'Jan', value: 4200 },
491
+ { label: 'Feb', value: 5600 },
492
+ { label: 'Mar', value: null },
493
+ ]"
494
+ label="Revenue by month"
495
+ locale="de-DE"
496
+ :format="{ style: 'currency', currency: 'EUR', maximumFractionDigits: 0 }"
497
+ />
498
+ ```
499
+
500
+ | Prop | Effect |
501
+ | --- | --- |
502
+ | `data` | `{ label, value }[]`. `value: null` is a **missing reading** — no bar, which is not a zero |
503
+ | `height` | Rendered height in px (default 240). Width fills the container |
504
+ | `ticks` | Target tick count. A hint — the axis lands on round numbers first |
505
+ | `axis` | Set `false` to drop the value axis and gridlines |
506
+ | `locale` / `format` | `Intl.NumberFormat` settings, applied to ticks and tooltip alike |
507
+ | `label` | Accessible name for the figure |
508
+
509
+ **The axis picks the domain, not the data.** Values are snapped outwards to a
510
+ 1/2/5 step, so an axis reads `0 / 2,000 / 4,000` rather than `0 / 1,726.8`.
511
+ Zero is always included, because bars are compared by length and a truncated
512
+ baseline makes that comparison a lie.
513
+
514
+ Bars are capped at 24px and never fill their slot — the gap between them is
515
+ what separates them. They're rounded at the data end and square at the
516
+ baseline, so the rounding reads as the tip of the value.
517
+
518
+ Hovering a bar dims the rest and shows a tooltip; hit targets span the full
519
+ band and plot height, so a short bar is no harder to hit than a tall one.
520
+
521
+ **Accessibility:** the SVG is `aria-hidden` and the data is exposed as a
522
+ visually-hidden table instead, so a screen reader gets the actual numbers
523
+ rather than a blank graphic. That table renders even before the container has
524
+ been measured — the data is never gated behind layout.
525
+
526
+ Long category labels thin out to every *n*th rather than rotating or
527
+ colliding. For many categories or long names, that's the honest limit of this
528
+ chart — reach for a table.
529
+
530
+ #### Sparklines
531
+
532
+ A trend at a glance, for a stat tile or a table cell. Plain SVG — no charting
533
+ library, no canvas, nothing to install.
534
+
535
+ ```vue
536
+ <ISparkline
537
+ :data="[4200, 4600, 4100, 5200, 5800, 6300]"
538
+ variant="area"
539
+ end-dot
540
+ label="Revenue over six months, trending up"
541
+ />
542
+ ```
543
+
544
+ Because it is SVG, colour comes from `currentColor`: recolour it with a text
545
+ utility, and it follows your theme preset and light/dark automatically with no
546
+ JavaScript. A canvas chart cannot read CSS variables, so it would need a
547
+ re-render on every theme change.
548
+
549
+ | Prop | Effect |
550
+ | --- | --- |
551
+ | `data` | Values, oldest first. `null` is a **gap**, not a zero — the line breaks |
552
+ | `variant` | `line` (default) or `area`, which adds a wash beneath the line |
553
+ | `endDot` | Marks the most recent point |
554
+ | `baseline` | Lower edge of the `area` wash: `min` (default) or `zero` |
555
+ | `min` / `max` | Pin the domain — set both to put several sparklines on one scale |
556
+ | `muted` | Draw in muted ink, for a de-emphasised trend |
557
+ | `height` | Rendered height in px (default 32). Width always fills the container |
558
+
559
+ Width is fluid and the stroke never distorts: the drawing stretches via
560
+ `preserveAspectRatio="none"`, while every stroke carries
561
+ `vector-effect="non-scaling-stroke"`, so a 2px line stays 2px and the end dot
562
+ stays circular at any aspect ratio.
563
+
564
+ `label` sets an accessible description. **Without one the sparkline is hidden
565
+ from assistive tech as decorative** — which is correct when it sits beside a
566
+ value that already states the number, and wrong if it is the only thing
567
+ carrying the information.
568
+
569
+ Edge cases behave: an empty series draws nothing, a flat series draws through
570
+ the middle rather than collapsing to an edge, and a single reading is a dot.
571
+
572
+ The scale helpers are exported for building your own marks:
573
+
574
+ ```ts
575
+ import { extent, linearScale } from 'iryx-ui'
576
+
577
+ extent([3, null, 9, 1]) // [1, 9] — gaps ignored
578
+ linearScale([0, 10], [100, 0])(10) // 0 — ranges may be inverted for SVG's y-axis
579
+ ```
580
+
484
581
  #### Files
485
582
 
486
583
  ```vue
@@ -3,5 +3,5 @@
3
3
  * Consumed by the Vue plugin (global registration) and the Nuxt module
4
4
  * (auto-imports). Keep in sync with `src/components/index.ts`.
5
5
  */
6
- export declare const componentNames: readonly ["Alert", "App", "Badge", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Card", "Checkbox", "Combobox", "ConfirmDialog", "DatePicker", "DateRangePicker", "Dialog", "DropdownMenu", "EmptyState", "FileUpload", "Form", "FormField", "Input", "Label", "NumberInput", "Pagination", "PasswordInput", "Progress", "RadioGroup", "Select", "Separator", "Skeleton", "Stat", "Stepper", "Switch", "Table", "Tabs", "Textarea", "Toaster", "Tooltip"];
6
+ export declare const componentNames: readonly ["Alert", "App", "Badge", "BarChart", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Card", "Checkbox", "Combobox", "ConfirmDialog", "DatePicker", "DateRangePicker", "Dialog", "DropdownMenu", "EmptyState", "FileUpload", "Form", "FormField", "Input", "Label", "NumberInput", "Pagination", "PasswordInput", "Progress", "RadioGroup", "Select", "Separator", "Skeleton", "Sparkline", "Stat", "Stepper", "Switch", "Table", "Tabs", "Textarea", "Toaster", "Tooltip"];
7
7
  export type ComponentName = (typeof componentNames)[number];
@@ -0,0 +1,36 @@
1
+ import type { SparseValue } from '../composables/scale';
2
+ export interface BarChartDatum {
3
+ label: string;
4
+ /** `null` is a missing reading — no bar is drawn, which is not the same as 0. */
5
+ value: SparseValue;
6
+ }
7
+ export interface BarChartProps {
8
+ data?: readonly BarChartDatum[];
9
+ /** Rendered height in px. Width always fills the container. */
10
+ height?: number;
11
+ /** Target tick count. The axis lands on round numbers, so this is a hint. */
12
+ ticks?: number;
13
+ /** Drop the value axis and its gridlines. */
14
+ axis?: boolean;
15
+ /** Locale and options for every number shown — ticks and tooltip alike. */
16
+ locale?: string;
17
+ format?: Intl.NumberFormatOptions;
18
+ /**
19
+ * Accessible name for the figure. The bars are hidden from assistive tech
20
+ * and the data is exposed as a table instead, so this names what that is.
21
+ */
22
+ label?: string;
23
+ /** Skip built-in classes; you take over styling entirely. */
24
+ unstyled?: boolean;
25
+ class?: string;
26
+ ui?: Partial<Record<'root' | 'svg' | 'grid' | 'tick' | 'category' | 'bar' | 'tooltip' | 'tooltipLabel' | 'tooltipValue' | 'table', string>>;
27
+ }
28
+ declare const __VLS_export: import("vue").DefineComponent<BarChartProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BarChartProps> & Readonly<{}>, {
29
+ unstyled: boolean;
30
+ data: readonly BarChartDatum[];
31
+ height: number;
32
+ ticks: number;
33
+ axis: boolean;
34
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
+ declare const _default: typeof __VLS_export;
36
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import type { SparseValue } from '../composables/scale';
2
+ export interface SparklineProps {
3
+ /** Values, oldest first. `null` is a gap in the series, not a zero. */
4
+ data?: readonly SparseValue[];
5
+ /** `area` adds a wash beneath the same line. */
6
+ variant?: 'line' | 'area';
7
+ /** Mark the most recent point with a dot. */
8
+ endDot?: boolean;
9
+ /** Lower edge of the `area` wash. */
10
+ baseline?: 'min' | 'zero';
11
+ /** Pin the domain — set both to put several sparklines on one scale. */
12
+ min?: number;
13
+ max?: number;
14
+ /** Draw in muted ink, for the de-emphasised trend inside a stat tile. */
15
+ muted?: boolean;
16
+ /**
17
+ * Accessible description of the trend. Without one the sparkline is treated
18
+ * as decorative and hidden from assistive tech — which is correct when it
19
+ * sits beside a value that already states the number.
20
+ */
21
+ label?: string;
22
+ /** Rendered height in px. Width always fills the container. */
23
+ height?: number;
24
+ /** Skip built-in classes; you take over styling entirely. */
25
+ unstyled?: boolean;
26
+ class?: string;
27
+ /** Override classes per slot, e.g. `{ line: 'stroke-[3]' }`. */
28
+ ui?: Partial<Record<'root' | 'plot' | 'line' | 'area' | 'dot' | 'ring', string>>;
29
+ }
30
+ declare const __VLS_export: import("vue").DefineComponent<SparklineProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SparklineProps> & Readonly<{}>, {
31
+ variant: "line" | "area";
32
+ unstyled: boolean;
33
+ data: readonly SparseValue[];
34
+ height: number;
35
+ baseline: "min" | "zero";
36
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
@@ -2,6 +2,7 @@ export { default as Alert } from './Alert.vue';
2
2
  export { default as App } from './App.vue';
3
3
  export { default as Badge } from './Badge.vue';
4
4
  export { default as Banner } from './Banner.vue';
5
+ export { default as BarChart } from './BarChart.vue';
5
6
  export { default as Breadcrumb } from './Breadcrumb.vue';
6
7
  export { default as Button } from './Button.vue';
7
8
  export { default as ButtonGroup } from './ButtonGroup.vue';
@@ -27,6 +28,7 @@ export { default as RadioGroup } from './RadioGroup.vue';
27
28
  export { default as Select } from './Select.vue';
28
29
  export { default as Separator } from './Separator.vue';
29
30
  export { default as Skeleton } from './Skeleton.vue';
31
+ export { default as Sparkline } from './Sparkline.vue';
30
32
  export { default as Stat } from './Stat.vue';
31
33
  export { default as Stepper } from './Stepper.vue';
32
34
  export { default as Switch } from './Switch.vue';
@@ -0,0 +1,15 @@
1
+ import type { Ref } from 'vue';
2
+ /**
3
+ * Track an element's rendered width.
4
+ *
5
+ * A sparkline can stretch a fixed box because strokes opt out of the scaling.
6
+ * A chart with axes cannot: text stretched by `preserveAspectRatio="none"`
7
+ * comes out distorted, so the drawing has to happen in real pixels and the
8
+ * width has to be measured.
9
+ *
10
+ * One observer per chart, not per mark — cheap enough at that granularity.
11
+ */
12
+ export declare function useElementSize(target: Ref<HTMLElement | undefined>): {
13
+ width: Ref<number, number>;
14
+ height: Ref<number, number>;
15
+ };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The arithmetic every chart shares: find a domain, map it onto a range, and
3
+ * choose the numbers an axis is allowed to show.
4
+ *
5
+ * Deliberately not a charting engine — no band scales or stacking yet. Those
6
+ * arrive with the components that need them rather than being guessed at now.
7
+ */
8
+ /** A gap in a series. `null` reads as "no reading", not as zero. */
9
+ export type SparseValue = number | null | undefined;
10
+ /** Finite values only, so gaps and stray `NaN` cannot poison a domain. */
11
+ export declare function finiteValues(values: readonly SparseValue[]): number[];
12
+ /** Smallest and largest finite value, or `undefined` when there are none. */
13
+ export declare function extent(values: readonly SparseValue[]): [number, number] | undefined;
14
+ /**
15
+ * Map `domain` onto `range`.
16
+ *
17
+ * A zero-width domain — every value identical, or a single point — maps to the
18
+ * middle of the range instead of dividing by zero. A flat series should draw a
19
+ * flat line through the centre, not vanish or spike to an edge.
20
+ */
21
+ export declare function linearScale(domain: readonly [number, number], range: readonly [number, number]): (value: number) => number;
22
+ /**
23
+ * Axis values a person would actually write down.
24
+ *
25
+ * The difference between an axis reading `0 / 1,000 / 2,000` and one reading
26
+ * `0 / 863.4 / 1,726.8` is the single clearest tell of a hand-rolled chart, so
27
+ * the step is snapped to a 1/2/5 multiple of a power of ten and the domain is
28
+ * widened outwards to land on it. The returned bounds are therefore usually
29
+ * wider than the data — that is the point, and the caller should scale to the
30
+ * first and last tick rather than to its own min and max.
31
+ */
32
+ export declare function niceTicks(min: number, max: number, count?: number): {
33
+ ticks: number[];
34
+ min: number;
35
+ max: number;
36
+ };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export type { AlertProps } from './components/Alert.vue';
5
5
  export type { AppProps } from './components/App.vue';
6
6
  export type { BadgeProps } from './components/Badge.vue';
7
7
  export type { BannerProps } from './components/Banner.vue';
8
+ export type { BarChartDatum, BarChartProps } from './components/BarChart.vue';
8
9
  export type { BreadcrumbItem, BreadcrumbProps } from './components/Breadcrumb.vue';
9
10
  export type { ButtonProps } from './components/Button.vue';
10
11
  export type { ButtonGroupProps } from './components/ButtonGroup.vue';
@@ -30,6 +31,7 @@ export type { RadioGroupItemOption, RadioGroupProps } from './components/RadioGr
30
31
  export type { SelectItemGroup, SelectItemOption, SelectItems, SelectProps } from './components/Select.vue';
31
32
  export type { SeparatorProps } from './components/Separator.vue';
32
33
  export type { SkeletonProps } from './components/Skeleton.vue';
34
+ export type { SparklineProps } from './components/Sparkline.vue';
33
35
  export type { StatProps } from './components/Stat.vue';
34
36
  export type { StepperItemOption, StepperProps } from './components/Stepper.vue';
35
37
  export type { SwitchProps } from './components/Switch.vue';
@@ -45,7 +47,9 @@ export * from './composables/data-table';
45
47
  export * from './composables/date';
46
48
  export * from './composables/decimal';
47
49
  export * from './composables/dropdown-menu';
50
+ export * from './composables/element-size';
48
51
  export * from './composables/form';
52
+ export * from './composables/scale';
49
53
  export * from './composables/toast';
50
54
  export { defaultConfig, iryxUiConfigKey, useIryxUiConfig } from './config';
51
55
  export type { IryxUiConfig } from './config';
package/dist/index.js CHANGED
@@ -9,75 +9,81 @@ import { badgeTheme as f } from "./packages/iryx-ui/src/theme/badge.js";
9
9
  import p from "./packages/iryx-ui/src/components/Badge.js";
10
10
  import { bannerTheme as m } from "./packages/iryx-ui/src/theme/banner.js";
11
11
  import h from "./packages/iryx-ui/src/components/Banner.js";
12
- import { breadcrumbTheme as g } from "./packages/iryx-ui/src/theme/breadcrumb.js";
13
- import _ from "./packages/iryx-ui/src/components/Breadcrumb.js";
14
- import { buttonGroupContextKey as v, useButtonGroup as y } from "./packages/iryx-ui/src/composables/button-group.js";
15
- import { buttonTheme as b } from "./packages/iryx-ui/src/theme/button.js";
16
- import x from "./packages/iryx-ui/src/components/Button.js";
17
- import { buttonGroupTheme as S } from "./packages/iryx-ui/src/theme/button-group.js";
18
- import C from "./packages/iryx-ui/src/components/ButtonGroup.js";
19
- import { cardTheme as w } from "./packages/iryx-ui/src/theme/card.js";
20
- import T from "./packages/iryx-ui/src/components/Card.js";
21
- import { checkboxTheme as E } from "./packages/iryx-ui/src/theme/checkbox.js";
22
- import D from "./packages/iryx-ui/src/components/Checkbox.js";
23
- import { formContextKey as O, formFieldContextKey as k, getByPath as A, isStandardSchema as j, issuePath as M, useForm as N, useFormField as P } from "./packages/iryx-ui/src/composables/form.js";
24
- import { fieldBase as F, inputTheme as I, textareaTheme as L } from "./packages/iryx-ui/src/theme/input.js";
25
- import { comboboxTheme as R } from "./packages/iryx-ui/src/theme/combobox.js";
26
- import z from "./packages/iryx-ui/src/components/Combobox.js";
27
- import { resolveConfirm as B, useConfirm as V, useConfirmState as H } from "./packages/iryx-ui/src/composables/confirm.js";
28
- import { dialogTheme as U } from "./packages/iryx-ui/src/theme/dialog.js";
29
- import W from "./packages/iryx-ui/src/components/Dialog.js";
30
- import G from "./packages/iryx-ui/src/components/ConfirmDialog.js";
31
- import { $2aaf608024c21ca1$export$99faa760c7908e4f as K } from "./node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/CalendarDate.js";
32
- import { formatIsoDate as q, isoToday as J, toCalendarDate as Y, toIsoDate as X } from "./packages/iryx-ui/src/composables/date.js";
33
- import { datePickerTheme as Z } from "./packages/iryx-ui/src/theme/date-picker.js";
34
- import Q from "./packages/iryx-ui/src/components/DatePicker.js";
35
- import $ from "./packages/iryx-ui/src/components/DateRangePicker.js";
36
- import { dropdownMenuTheme as ee } from "./packages/iryx-ui/src/theme/dropdown-menu.js";
37
- import { isSeparator as te, isSubmenu as ne } from "./packages/iryx-ui/src/composables/dropdown-menu.js";
38
- import re from "./packages/iryx-ui/src/components/DropdownMenu.js";
39
- import { emptyStateTheme as ie } from "./packages/iryx-ui/src/theme/empty-state.js";
40
- import ae from "./packages/iryx-ui/src/components/EmptyState.js";
41
- import { fileUploadTheme as oe } from "./packages/iryx-ui/src/theme/file-upload.js";
42
- import se from "./packages/iryx-ui/src/components/FileUpload.js";
43
- import ce from "./packages/iryx-ui/src/components/Form.js";
44
- import { labelTheme as le } from "./packages/iryx-ui/src/theme/label.js";
45
- import ue from "./packages/iryx-ui/src/components/Label.js";
46
- import de from "./packages/iryx-ui/src/components/FormField.js";
47
- import fe from "./packages/iryx-ui/src/components/Input.js";
48
- import { addDecimals as pe, clampDecimal as me, compareDecimals as he, formatDecimal as ge, formatForLocale as _e, isDecimal as ve, localeSeparators as ye, parseDecimal as be, parseFromLocale as xe, roundDecimal as Se, toEditable as Ce } from "./packages/iryx-ui/src/composables/decimal.js";
49
- import { numberInputTheme as we } from "./packages/iryx-ui/src/theme/number-input.js";
50
- import Te from "./packages/iryx-ui/src/components/NumberInput.js";
51
- import { paginationTheme as Ee } from "./packages/iryx-ui/src/theme/pagination.js";
52
- import De from "./packages/iryx-ui/src/components/Pagination.js";
53
- import { passwordInputTheme as Oe } from "./packages/iryx-ui/src/theme/password-input.js";
54
- import ke from "./packages/iryx-ui/src/components/PasswordInput.js";
55
- import { progressTheme as Ae } from "./packages/iryx-ui/src/theme/progress.js";
56
- import je from "./packages/iryx-ui/src/components/Progress.js";
57
- import { radioGroupTheme as Me } from "./packages/iryx-ui/src/theme/radio-group.js";
58
- import Ne from "./packages/iryx-ui/src/components/RadioGroup.js";
59
- import { selectTheme as Pe } from "./packages/iryx-ui/src/theme/select.js";
60
- import Fe from "./packages/iryx-ui/src/components/Select.js";
61
- import { separatorTheme as Ie } from "./packages/iryx-ui/src/theme/separator.js";
62
- import Le from "./packages/iryx-ui/src/components/Separator.js";
63
- import { skeletonTheme as Re } from "./packages/iryx-ui/src/theme/skeleton.js";
64
- import ze from "./packages/iryx-ui/src/components/Skeleton.js";
65
- import { statTheme as Be } from "./packages/iryx-ui/src/theme/stat.js";
66
- import Ve from "./packages/iryx-ui/src/components/Stat.js";
67
- import { stepperTheme as He } from "./packages/iryx-ui/src/theme/stepper.js";
68
- import Ue from "./packages/iryx-ui/src/components/Stepper.js";
69
- import { switchTheme as We } from "./packages/iryx-ui/src/theme/switch.js";
70
- import Ge from "./packages/iryx-ui/src/components/Switch.js";
71
- import { getRowValue as Ke, useDataTable as qe } from "./packages/iryx-ui/src/composables/data-table.js";
72
- import { tableTheme as Je } from "./packages/iryx-ui/src/theme/table.js";
73
- import Ye from "./packages/iryx-ui/src/components/Table.js";
74
- import { tabsTheme as Xe } from "./packages/iryx-ui/src/theme/tabs.js";
75
- import Ze from "./packages/iryx-ui/src/components/Tabs.js";
76
- import Qe from "./packages/iryx-ui/src/components/Textarea.js";
77
- import { useToast as $e, useToastState as et } from "./packages/iryx-ui/src/composables/toast.js";
78
- import { toastTheme as tt } from "./packages/iryx-ui/src/theme/toast.js";
79
- import nt from "./packages/iryx-ui/src/components/Toaster.js";
80
- import { tooltipTheme as rt } from "./packages/iryx-ui/src/theme/tooltip.js";
81
- import it from "./packages/iryx-ui/src/components/Tooltip.js";
82
- import { IryxUi as at, createIryxUi as ot } from "./packages/iryx-ui/src/plugin.js";
83
- export { a as Alert, d as App, p as Badge, h as Banner, _ as Breadcrumb, x as Button, C as ButtonGroup, K as CalendarDate, T as Card, D as Checkbox, z as Combobox, G as ConfirmDialog, Q as DatePicker, $ as DateRangePicker, W as Dialog, re as DropdownMenu, ae as EmptyState, se as FileUpload, ce as Form, de as FormField, fe as Input, at as IryxUi, ue as Label, Te as NumberInput, De as Pagination, ke as PasswordInput, je as Progress, Ne as RadioGroup, Fe as Select, Le as Separator, ze as Skeleton, Ve as Stat, Ue as Stepper, Ge as Switch, Ye as Table, Ze as Tabs, Qe as Textarea, nt as Toaster, it as Tooltip, pe as addDecimals, i as alertTheme, c as applyTheme, f as badgeTheme, m as bannerTheme, g as breadcrumbTheme, v as buttonGroupContextKey, S as buttonGroupTheme, b as buttonTheme, w as cardTheme, E as checkboxTheme, me as clampDecimal, l as clearTheme, R as comboboxTheme, he as compareDecimals, e as componentNames, ot as createIryxUi, Z as datePickerTheme, t as defaultConfig, U as dialogTheme, ee as dropdownMenuTheme, ie as emptyStateTheme, F as fieldBase, oe as fileUploadTheme, O as formContextKey, k as formFieldContextKey, ge as formatDecimal, _e as formatForLocale, q as formatIsoDate, A as getByPath, Ke as getRowValue, o as initAppearance, I as inputTheme, n as iryxUiConfigKey, ve as isDecimal, te as isSeparator, j as isStandardSchema, ne as isSubmenu, J as isoToday, M as issuePath, le as labelTheme, ye as localeSeparators, we as numberInputTheme, Ee as paginationTheme, be as parseDecimal, xe as parseFromLocale, Oe as passwordInputTheme, Ae as progressTheme, Me as radioGroupTheme, B as resolveConfirm, Se as roundDecimal, Pe as selectTheme, Ie as separatorTheme, Re as skeletonTheme, Be as statTheme, He as stepperTheme, We as switchTheme, Je as tableTheme, Xe as tabsTheme, L as textareaTheme, u as themes, Y as toCalendarDate, Ce as toEditable, X as toIsoDate, tt as toastTheme, rt as tooltipTheme, s as useAppearance, y as useButtonGroup, V as useConfirm, H as useConfirmState, qe as useDataTable, N as useForm, P as useFormField, r as useIryxUiConfig, $e as useToast, et as useToastState };
12
+ import { useElementSize as g } from "./packages/iryx-ui/src/composables/element-size.js";
13
+ import { extent as _, finiteValues as v, linearScale as y, niceTicks as b } from "./packages/iryx-ui/src/composables/scale.js";
14
+ import { barChartTheme as x } from "./packages/iryx-ui/src/theme/bar-chart.js";
15
+ import S from "./packages/iryx-ui/src/components/BarChart.js";
16
+ import { breadcrumbTheme as C } from "./packages/iryx-ui/src/theme/breadcrumb.js";
17
+ import w from "./packages/iryx-ui/src/components/Breadcrumb.js";
18
+ import { buttonGroupContextKey as T, useButtonGroup as E } from "./packages/iryx-ui/src/composables/button-group.js";
19
+ import { buttonTheme as D } from "./packages/iryx-ui/src/theme/button.js";
20
+ import O from "./packages/iryx-ui/src/components/Button.js";
21
+ import { buttonGroupTheme as k } from "./packages/iryx-ui/src/theme/button-group.js";
22
+ import A from "./packages/iryx-ui/src/components/ButtonGroup.js";
23
+ import { cardTheme as j } from "./packages/iryx-ui/src/theme/card.js";
24
+ import M from "./packages/iryx-ui/src/components/Card.js";
25
+ import { checkboxTheme as N } from "./packages/iryx-ui/src/theme/checkbox.js";
26
+ import P from "./packages/iryx-ui/src/components/Checkbox.js";
27
+ import { formContextKey as F, formFieldContextKey as I, getByPath as L, isStandardSchema as R, issuePath as z, useForm as B, useFormField as V } from "./packages/iryx-ui/src/composables/form.js";
28
+ import { fieldBase as H, inputTheme as U, textareaTheme as W } from "./packages/iryx-ui/src/theme/input.js";
29
+ import { comboboxTheme as G } from "./packages/iryx-ui/src/theme/combobox.js";
30
+ import K from "./packages/iryx-ui/src/components/Combobox.js";
31
+ import { resolveConfirm as q, useConfirm as J, useConfirmState as Y } from "./packages/iryx-ui/src/composables/confirm.js";
32
+ import { dialogTheme as X } from "./packages/iryx-ui/src/theme/dialog.js";
33
+ import Z from "./packages/iryx-ui/src/components/Dialog.js";
34
+ import Q from "./packages/iryx-ui/src/components/ConfirmDialog.js";
35
+ import { $2aaf608024c21ca1$export$99faa760c7908e4f as $ } from "./node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/CalendarDate.js";
36
+ import { formatIsoDate as ee, isoToday as te, toCalendarDate as ne, toIsoDate as re } from "./packages/iryx-ui/src/composables/date.js";
37
+ import { datePickerTheme as ie } from "./packages/iryx-ui/src/theme/date-picker.js";
38
+ import ae from "./packages/iryx-ui/src/components/DatePicker.js";
39
+ import oe from "./packages/iryx-ui/src/components/DateRangePicker.js";
40
+ import { dropdownMenuTheme as se } from "./packages/iryx-ui/src/theme/dropdown-menu.js";
41
+ import { isSeparator as ce, isSubmenu as le } from "./packages/iryx-ui/src/composables/dropdown-menu.js";
42
+ import ue from "./packages/iryx-ui/src/components/DropdownMenu.js";
43
+ import { emptyStateTheme as de } from "./packages/iryx-ui/src/theme/empty-state.js";
44
+ import fe from "./packages/iryx-ui/src/components/EmptyState.js";
45
+ import { fileUploadTheme as pe } from "./packages/iryx-ui/src/theme/file-upload.js";
46
+ import me from "./packages/iryx-ui/src/components/FileUpload.js";
47
+ import he from "./packages/iryx-ui/src/components/Form.js";
48
+ import { labelTheme as ge } from "./packages/iryx-ui/src/theme/label.js";
49
+ import _e from "./packages/iryx-ui/src/components/Label.js";
50
+ import ve from "./packages/iryx-ui/src/components/FormField.js";
51
+ import ye from "./packages/iryx-ui/src/components/Input.js";
52
+ import { addDecimals as be, clampDecimal as xe, compareDecimals as Se, formatDecimal as Ce, formatForLocale as we, isDecimal as Te, localeSeparators as Ee, parseDecimal as De, parseFromLocale as Oe, roundDecimal as ke, toEditable as Ae } from "./packages/iryx-ui/src/composables/decimal.js";
53
+ import { numberInputTheme as je } from "./packages/iryx-ui/src/theme/number-input.js";
54
+ import Me from "./packages/iryx-ui/src/components/NumberInput.js";
55
+ import { paginationTheme as Ne } from "./packages/iryx-ui/src/theme/pagination.js";
56
+ import Pe from "./packages/iryx-ui/src/components/Pagination.js";
57
+ import { passwordInputTheme as Fe } from "./packages/iryx-ui/src/theme/password-input.js";
58
+ import Ie from "./packages/iryx-ui/src/components/PasswordInput.js";
59
+ import { progressTheme as Le } from "./packages/iryx-ui/src/theme/progress.js";
60
+ import Re from "./packages/iryx-ui/src/components/Progress.js";
61
+ import { radioGroupTheme as ze } from "./packages/iryx-ui/src/theme/radio-group.js";
62
+ import Be from "./packages/iryx-ui/src/components/RadioGroup.js";
63
+ import { selectTheme as Ve } from "./packages/iryx-ui/src/theme/select.js";
64
+ import He from "./packages/iryx-ui/src/components/Select.js";
65
+ import { separatorTheme as Ue } from "./packages/iryx-ui/src/theme/separator.js";
66
+ import We from "./packages/iryx-ui/src/components/Separator.js";
67
+ import { skeletonTheme as Ge } from "./packages/iryx-ui/src/theme/skeleton.js";
68
+ import Ke from "./packages/iryx-ui/src/components/Skeleton.js";
69
+ import { sparklineTheme as qe } from "./packages/iryx-ui/src/theme/sparkline.js";
70
+ import Je from "./packages/iryx-ui/src/components/Sparkline.js";
71
+ import { statTheme as Ye } from "./packages/iryx-ui/src/theme/stat.js";
72
+ import Xe from "./packages/iryx-ui/src/components/Stat.js";
73
+ import { stepperTheme as Ze } from "./packages/iryx-ui/src/theme/stepper.js";
74
+ import Qe from "./packages/iryx-ui/src/components/Stepper.js";
75
+ import { switchTheme as $e } from "./packages/iryx-ui/src/theme/switch.js";
76
+ import et from "./packages/iryx-ui/src/components/Switch.js";
77
+ import { getRowValue as tt, useDataTable as nt } from "./packages/iryx-ui/src/composables/data-table.js";
78
+ import { tableTheme as rt } from "./packages/iryx-ui/src/theme/table.js";
79
+ import it from "./packages/iryx-ui/src/components/Table.js";
80
+ import { tabsTheme as at } from "./packages/iryx-ui/src/theme/tabs.js";
81
+ import ot from "./packages/iryx-ui/src/components/Tabs.js";
82
+ import st from "./packages/iryx-ui/src/components/Textarea.js";
83
+ import { useToast as ct, useToastState as lt } from "./packages/iryx-ui/src/composables/toast.js";
84
+ import { toastTheme as ut } from "./packages/iryx-ui/src/theme/toast.js";
85
+ import dt from "./packages/iryx-ui/src/components/Toaster.js";
86
+ import { tooltipTheme as ft } from "./packages/iryx-ui/src/theme/tooltip.js";
87
+ import pt from "./packages/iryx-ui/src/components/Tooltip.js";
88
+ import { IryxUi as mt, createIryxUi as ht } from "./packages/iryx-ui/src/plugin.js";
89
+ export { a as Alert, d as App, p as Badge, h as Banner, S as BarChart, w as Breadcrumb, O as Button, A as ButtonGroup, $ as CalendarDate, M as Card, P as Checkbox, K as Combobox, Q as ConfirmDialog, ae as DatePicker, oe as DateRangePicker, Z as Dialog, ue as DropdownMenu, fe as EmptyState, me as FileUpload, he as Form, ve as FormField, ye as Input, mt as IryxUi, _e as Label, Me as NumberInput, Pe as Pagination, Ie as PasswordInput, Re as Progress, Be as RadioGroup, He as Select, We as Separator, Ke as Skeleton, Je as Sparkline, Xe as Stat, Qe as Stepper, et as Switch, it as Table, ot as Tabs, st as Textarea, dt as Toaster, pt as Tooltip, be as addDecimals, i as alertTheme, c as applyTheme, f as badgeTheme, m as bannerTheme, x as barChartTheme, C as breadcrumbTheme, T as buttonGroupContextKey, k as buttonGroupTheme, D as buttonTheme, j as cardTheme, N as checkboxTheme, xe as clampDecimal, l as clearTheme, G as comboboxTheme, Se as compareDecimals, e as componentNames, ht as createIryxUi, ie as datePickerTheme, t as defaultConfig, X as dialogTheme, se as dropdownMenuTheme, de as emptyStateTheme, _ as extent, H as fieldBase, pe as fileUploadTheme, v as finiteValues, F as formContextKey, I as formFieldContextKey, Ce as formatDecimal, we as formatForLocale, ee as formatIsoDate, L as getByPath, tt as getRowValue, o as initAppearance, U as inputTheme, n as iryxUiConfigKey, Te as isDecimal, ce as isSeparator, R as isStandardSchema, le as isSubmenu, te as isoToday, z as issuePath, ge as labelTheme, y as linearScale, Ee as localeSeparators, b as niceTicks, je as numberInputTheme, Ne as paginationTheme, De as parseDecimal, Oe as parseFromLocale, Fe as passwordInputTheme, Le as progressTheme, ze as radioGroupTheme, q as resolveConfirm, ke as roundDecimal, Ve as selectTheme, Ue as separatorTheme, Ge as skeletonTheme, qe as sparklineTheme, Ye as statTheme, Ze as stepperTheme, $e as switchTheme, rt as tableTheme, at as tabsTheme, W as textareaTheme, u as themes, ne as toCalendarDate, Ae as toEditable, re as toIsoDate, ut as toastTheme, ft as tooltipTheme, s as useAppearance, E as useButtonGroup, J as useConfirm, Y as useConfirmState, nt as useDataTable, g as useElementSize, B as useForm, V as useFormField, r as useIryxUiConfig, ct as useToast, lt as useToastState };
@@ -1,4 +1,4 @@
1
1
  //#region src/component-names.ts
2
- var e = /* @__PURE__ */ "Alert.App.Badge.Banner.Breadcrumb.Button.ButtonGroup.Card.Checkbox.Combobox.ConfirmDialog.DatePicker.DateRangePicker.Dialog.DropdownMenu.EmptyState.FileUpload.Form.FormField.Input.Label.NumberInput.Pagination.PasswordInput.Progress.RadioGroup.Select.Separator.Skeleton.Stat.Stepper.Switch.Table.Tabs.Textarea.Toaster.Tooltip".split(".");
2
+ var e = /* @__PURE__ */ "Alert.App.Badge.BarChart.Banner.Breadcrumb.Button.ButtonGroup.Card.Checkbox.Combobox.ConfirmDialog.DatePicker.DateRangePicker.Dialog.DropdownMenu.EmptyState.FileUpload.Form.FormField.Input.Label.NumberInput.Pagination.PasswordInput.Progress.RadioGroup.Select.Separator.Skeleton.Sparkline.Stat.Stepper.Switch.Table.Tabs.Textarea.Toaster.Tooltip".split(".");
3
3
  //#endregion
4
4
  export { e as componentNames };
@@ -0,0 +1,5 @@
1
+ import e from "./BarChart.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/BarChart.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,178 @@
1
+ import { useIryxUiConfig as e } from "../config.js";
2
+ import { useElementSize as t } from "../composables/element-size.js";
3
+ import { extent as n, linearScale as r, niceTicks as i } from "../composables/scale.js";
4
+ import { barChartTheme as a } from "../theme/bar-chart.js";
5
+ import { Fragment as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, normalizeClass as f, normalizeStyle as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v } from "vue";
6
+ //#region src/components/BarChart.vue?vue&type=script&setup=true&lang.ts
7
+ var y = ["role", "aria-label"], b = [
8
+ "width",
9
+ "height",
10
+ "viewBox"
11
+ ], x = [
12
+ "x1",
13
+ "y1",
14
+ "x2",
15
+ "y2"
16
+ ], S = ["x", "y"], C = ["d"], w = ["x", "y"], T = [
17
+ "x",
18
+ "y",
19
+ "width",
20
+ "height",
21
+ "onPointerenter"
22
+ ], E = { scope: "row" }, D = 6.5, O = 8, k = 20, A = 8, j = .7, M = /*@__PURE__*/ d({
23
+ __name: "BarChart",
24
+ props: {
25
+ data: { default: () => [] },
26
+ height: { default: 240 },
27
+ ticks: { default: 5 },
28
+ axis: {
29
+ type: Boolean,
30
+ default: !0
31
+ },
32
+ locale: {},
33
+ format: {},
34
+ label: {},
35
+ unstyled: {
36
+ type: Boolean,
37
+ default: void 0
38
+ },
39
+ class: {},
40
+ ui: {}
41
+ },
42
+ setup(d) {
43
+ let M = d, N = e(), P = s(() => M.unstyled ?? N.unstyled), F = h(), { width: I } = t(F), L = s(() => new Intl.NumberFormat(M.locale, M.format));
44
+ function R(e) {
45
+ return L.value.format(e);
46
+ }
47
+ let z = s(() => {
48
+ let e = n(M.data.map((e) => e.value));
49
+ return e ? i(Math.min(0, e[0]), Math.max(0, e[1]), M.ticks) : i(0, 1, M.ticks);
50
+ }), B = s(() => {
51
+ if (!M.axis) return 0;
52
+ let e = Math.max(...z.value.ticks.map((e) => R(e).length), 1);
53
+ return Math.ceil(e * D) + O;
54
+ }), V = s(() => ({
55
+ left: B.value,
56
+ top: A,
57
+ width: Math.max(I.value - B.value, 0),
58
+ height: Math.max(M.height - A - k, 0)
59
+ })), H = s(() => r([z.value.min, z.value.max], [V.value.top + V.value.height, V.value.top])), U = s(() => M.data.length ? V.value.width / M.data.length : 0), W = s(() => Math.max(2, Math.min(24, U.value * j))), G = s(() => {
60
+ if (!I.value || !M.data.length) return [];
61
+ let e = H.value(0);
62
+ return M.data.flatMap((t, n) => {
63
+ let r = t.value;
64
+ if (typeof r != "number" || !Number.isFinite(r)) return [];
65
+ let i = H.value(r);
66
+ return [{
67
+ x: V.value.left + U.value * (n + .5) - W.value / 2,
68
+ y: Math.min(i, e),
69
+ width: W.value,
70
+ height: Math.abs(e - i),
71
+ up: r >= 0,
72
+ datum: t
73
+ }];
74
+ });
75
+ });
76
+ function K(e) {
77
+ let t = Math.min(4, e.width / 2, e.height), { x: n, width: r } = e, i = n + r;
78
+ if (e.up) {
79
+ let r = e.y, a = e.y + e.height;
80
+ return `M${n} ${a} L${n} ${r + t} Q${n} ${r} ${n + t} ${r} L${i - t} ${r} Q${i} ${r} ${i} ${r + t} L${i} ${a} Z`;
81
+ }
82
+ let a = e.y, o = e.y + e.height;
83
+ return `M${n} ${a} L${n} ${o - t} Q${n} ${o} ${n + t} ${o} L${i - t} ${o} Q${i} ${o} ${i} ${o - t} L${i} ${a} Z`;
84
+ }
85
+ let q = s(() => {
86
+ if (!U.value || !M.data.length) return 1;
87
+ let e = Math.max(...M.data.map((e) => e.label.length), 1);
88
+ return Math.max(1, Math.ceil((e * D + 8) / U.value));
89
+ }), J = h(), Y = s(() => {
90
+ if (J.value == null) return;
91
+ let e = M.data[J.value];
92
+ if (!e || typeof e.value != "number") return;
93
+ let t = e.label, n = R(e.value), r = ((t.length + n.length) * D + 28) / 2, i = V.value.left + U.value * (J.value + .5);
94
+ return {
95
+ label: t,
96
+ value: n,
97
+ x: Math.min(Math.max(i, r), Math.max(I.value - r, r)),
98
+ y: Math.min(H.value(e.value), H.value(0))
99
+ };
100
+ }), X = s(() => a());
101
+ function Z(e, t) {
102
+ let n = M.ui?.[e];
103
+ return P.value ? [n, t] : X.value[e]({ class: [n, t] });
104
+ }
105
+ function Q(e) {
106
+ let t = J.value != null && J.value !== e;
107
+ return P.value ? [M.ui?.bar] : X.value.bar({ class: [M.ui?.bar, t ? X.value.faded() : void 0] });
108
+ }
109
+ return (e, t) => (m(), l("div", {
110
+ ref_key: "root",
111
+ ref: F,
112
+ role: M.label ? "figure" : void 0,
113
+ "aria-label": M.label,
114
+ class: f(Z("root", M.class))
115
+ }, [
116
+ (m(), l("svg", {
117
+ width: v(I),
118
+ height: M.height,
119
+ viewBox: `0 0 ${v(I)} ${M.height}`,
120
+ "aria-hidden": "true",
121
+ class: f(Z("svg"))
122
+ }, [
123
+ M.axis ? (m(!0), l(o, { key: 0 }, g(z.value.ticks, (e) => (m(), l("g", { key: `tick-${e}` }, [u("line", {
124
+ x1: V.value.left,
125
+ y1: H.value(e),
126
+ x2: V.value.left + V.value.width,
127
+ y2: H.value(e),
128
+ "stroke-width": "1",
129
+ class: f(Z("grid"))
130
+ }, null, 10, x), u("text", {
131
+ x: V.value.left - O,
132
+ y: H.value(e),
133
+ "text-anchor": "end",
134
+ "dominant-baseline": "middle",
135
+ class: f(Z("tick"))
136
+ }, _(R(e)), 11, S)]))), 128)) : c("", !0),
137
+ (m(!0), l(o, null, g(G.value, (e, t) => (m(), l("path", {
138
+ key: `bar-${e.datum.label}-${t}`,
139
+ d: K(e),
140
+ class: f(Q(t))
141
+ }, null, 10, C))), 128)),
142
+ (m(!0), l(o, null, g(M.data, (e, t) => (m(), l(o, { key: `label-${e.label}-${t}` }, [t % q.value === 0 ? (m(), l("text", {
143
+ key: 0,
144
+ x: V.value.left + U.value * (t + .5),
145
+ y: V.value.top + V.value.height + 14,
146
+ "text-anchor": "middle",
147
+ class: f(Z("category"))
148
+ }, _(e.label), 11, w)) : c("", !0)], 64))), 128)),
149
+ (m(!0), l(o, null, g(M.data, (e, n) => (m(), l("rect", {
150
+ key: `hit-${e.label}-${n}`,
151
+ x: V.value.left + U.value * n,
152
+ y: V.value.top,
153
+ width: U.value,
154
+ height: V.value.height,
155
+ class: f(P.value ? void 0 : X.value.hit()),
156
+ onPointerenter: (e) => J.value = n,
157
+ onPointerleave: t[0] ||= (e) => J.value = void 0
158
+ }, null, 42, T))), 128))
159
+ ], 10, b)),
160
+ Y.value ? (m(), l("div", {
161
+ key: 0,
162
+ class: f(Z("tooltip")),
163
+ style: p({
164
+ left: `${Y.value.x}px`,
165
+ top: `${Y.value.y}px`,
166
+ transform: "translate(-50%, -100%) translateY(-8px)"
167
+ })
168
+ }, [u("span", { class: f(Z("tooltipLabel")) }, _(Y.value.label), 3), u("span", { class: f(Z("tooltipValue")) }, _(Y.value.value), 3)], 6)) : c("", !0),
169
+ u("table", { class: f(Z("table")) }, [
170
+ u("caption", null, _(M.label), 1),
171
+ t[1] ||= u("thead", null, [u("tr", null, [u("th", { scope: "col" }, " Category "), u("th", { scope: "col" }, " Value ")])], -1),
172
+ u("tbody", null, [(m(!0), l(o, null, g(M.data, (e, t) => (m(), l("tr", { key: `row-${e.label}-${t}` }, [u("th", E, _(e.label), 1), u("td", null, _(typeof e.value == "number" ? R(e.value) : "—"), 1)]))), 128))])
173
+ ], 2)
174
+ ], 10, y));
175
+ }
176
+ });
177
+ //#endregion
178
+ export { M as default };
@@ -0,0 +1,5 @@
1
+ import e from "./Sparkline.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/Sparkline.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,110 @@
1
+ import { useIryxUiConfig as e } from "../config.js";
2
+ import { extent as t, linearScale as n } from "../composables/scale.js";
3
+ import { sparklineTheme as r } from "../theme/sparkline.js";
4
+ import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, openBlock as f, renderList as p } from "vue";
5
+ //#region src/components/Sparkline.vue?vue&type=script&setup=true&lang.ts
6
+ var m = [
7
+ "viewBox",
8
+ "height",
9
+ "role",
10
+ "aria-label",
11
+ "aria-hidden"
12
+ ], h = ["d"], g = ["d"], _ = ["d"], v = ["d"], y = 100, b = /*@__PURE__*/ l({
13
+ __name: "Sparkline",
14
+ props: {
15
+ data: { default: () => [] },
16
+ variant: { default: "line" },
17
+ endDot: { type: Boolean },
18
+ baseline: { default: "min" },
19
+ min: {},
20
+ max: {},
21
+ muted: { type: Boolean },
22
+ label: {},
23
+ height: { default: 32 },
24
+ unstyled: {
25
+ type: Boolean,
26
+ default: void 0
27
+ },
28
+ class: {},
29
+ ui: {}
30
+ },
31
+ setup(l) {
32
+ let b = l, x = e(), S = a(() => b.unstyled ?? x.unstyled), C = a(() => b.endDot ? 6 : 1), w = a(() => Math.max(b.height - C.value * 2, 1)), T = a(() => {
33
+ let e = b.data, r = t(e);
34
+ if (!r) return [];
35
+ let [i, a] = r, o = b.min ?? i, s = b.max ?? a, c = n([0, Math.max(e.length - 1, 0)], [0, y]), l = n([o, s], [y, 0]), u = [], d = [];
36
+ return e.forEach((e, t) => {
37
+ if (typeof e != "number" || !Number.isFinite(e)) {
38
+ d.length && u.push(d), d = [];
39
+ return;
40
+ }
41
+ d.push({
42
+ x: E(c(t)),
43
+ y: E(l(e))
44
+ });
45
+ }), d.length && u.push(d), u;
46
+ });
47
+ function E(e) {
48
+ return Math.round(e * 100) / 100;
49
+ }
50
+ function D(e) {
51
+ return e.map((e, t) => `${t === 0 ? "M" : "L"}${e.x} ${e.y}`).join(" ");
52
+ }
53
+ let O = a(() => {
54
+ let e = t(b.data);
55
+ if (!e) return y;
56
+ let r = b.min ?? e[0], i = b.max ?? e[1];
57
+ return b.baseline === "zero" && r <= 0 && i >= 0 ? E(n([r, i], [y, 0])(0)) : y;
58
+ });
59
+ function k(e) {
60
+ let t = e[0], n = e[e.length - 1];
61
+ return `${D(e)} L${n.x} ${O.value} L${t.x} ${O.value} Z`;
62
+ }
63
+ let A = a(() => {
64
+ let e = T.value[T.value.length - 1];
65
+ return e?.[e.length - 1];
66
+ }), j = a(() => r({ muted: b.muted }));
67
+ function M(e, t) {
68
+ let n = b.ui?.[e];
69
+ return S.value ? [n, t] : j.value[e]({ class: [n, t] });
70
+ }
71
+ return (e, t) => (f(), s("span", {
72
+ class: u(M("root", b.class)),
73
+ style: d({ padding: `${C.value}px` })
74
+ }, [(f(), s("svg", {
75
+ viewBox: `0 0 ${y} ${y}`,
76
+ preserveAspectRatio: "none",
77
+ height: w.value,
78
+ style: d({ height: `${w.value}px` }),
79
+ role: b.label ? "img" : void 0,
80
+ "aria-label": b.label,
81
+ "aria-hidden": b.label ? void 0 : !0,
82
+ class: u(M("plot"))
83
+ }, [
84
+ b.variant === "area" ? (f(!0), s(i, { key: 0 }, p(T.value, (e, t) => (f(), s("path", {
85
+ key: `area-${t}`,
86
+ d: k(e),
87
+ class: u(M("area"))
88
+ }, null, 10, h))), 128)) : o("", !0),
89
+ (f(!0), s(i, null, p(T.value, (e, t) => (f(), s("path", {
90
+ key: `line-${t}`,
91
+ d: D(e),
92
+ "vector-effect": "non-scaling-stroke",
93
+ class: u(M("line"))
94
+ }, null, 10, g))), 128)),
95
+ b.endDot && A.value ? (f(), s(i, { key: 1 }, [c("path", {
96
+ d: `M${A.value.x} ${A.value.y} L${A.value.x} ${A.value.y}`,
97
+ "stroke-width": "12",
98
+ "vector-effect": "non-scaling-stroke",
99
+ class: u(M("ring"))
100
+ }, null, 10, _), c("path", {
101
+ d: `M${A.value.x} ${A.value.y} L${A.value.x} ${A.value.y}`,
102
+ "stroke-width": "8",
103
+ "vector-effect": "non-scaling-stroke",
104
+ class: u(M("dot"))
105
+ }, null, 10, v)], 64)) : o("", !0)
106
+ ], 14, m))], 6));
107
+ }
108
+ });
109
+ //#endregion
110
+ export { b as default };
@@ -3,78 +3,82 @@ import t from "./Alert.js";
3
3
  import n from "./App.js";
4
4
  import r from "./Badge.js";
5
5
  import i from "./Banner.js";
6
- import a from "./Breadcrumb.js";
7
- import o from "./Button.js";
8
- import s from "./ButtonGroup.js";
9
- import c from "./Card.js";
10
- import l from "./Checkbox.js";
11
- import u from "./Combobox.js";
12
- import d from "./Dialog.js";
13
- import f from "./ConfirmDialog.js";
14
- import p from "./DatePicker.js";
15
- import m from "./DateRangePicker.js";
16
- import h from "./DropdownMenu.js";
17
- import g from "./EmptyState.js";
18
- import _ from "./FileUpload.js";
19
- import v from "./Form.js";
20
- import y from "./Label.js";
21
- import b from "./FormField.js";
22
- import x from "./Input.js";
23
- import S from "./NumberInput.js";
24
- import C from "./Pagination.js";
25
- import w from "./PasswordInput.js";
26
- import T from "./Progress.js";
27
- import E from "./RadioGroup.js";
28
- import D from "./Select.js";
29
- import O from "./Separator.js";
30
- import k from "./Skeleton.js";
31
- import A from "./Stat.js";
32
- import j from "./Stepper.js";
33
- import M from "./Switch.js";
34
- import N from "./Table.js";
35
- import P from "./Tabs.js";
36
- import F from "./Textarea.js";
37
- import I from "./Toaster.js";
38
- import L from "./Tooltip.js";
6
+ import a from "./BarChart.js";
7
+ import o from "./Breadcrumb.js";
8
+ import s from "./Button.js";
9
+ import c from "./ButtonGroup.js";
10
+ import l from "./Card.js";
11
+ import u from "./Checkbox.js";
12
+ import d from "./Combobox.js";
13
+ import f from "./Dialog.js";
14
+ import p from "./ConfirmDialog.js";
15
+ import m from "./DatePicker.js";
16
+ import h from "./DateRangePicker.js";
17
+ import g from "./DropdownMenu.js";
18
+ import _ from "./EmptyState.js";
19
+ import v from "./FileUpload.js";
20
+ import y from "./Form.js";
21
+ import b from "./Label.js";
22
+ import x from "./FormField.js";
23
+ import S from "./Input.js";
24
+ import C from "./NumberInput.js";
25
+ import w from "./Pagination.js";
26
+ import T from "./PasswordInput.js";
27
+ import E from "./Progress.js";
28
+ import D from "./RadioGroup.js";
29
+ import O from "./Select.js";
30
+ import k from "./Separator.js";
31
+ import A from "./Skeleton.js";
32
+ import j from "./Sparkline.js";
33
+ import M from "./Stat.js";
34
+ import N from "./Stepper.js";
35
+ import P from "./Switch.js";
36
+ import F from "./Table.js";
37
+ import I from "./Tabs.js";
38
+ import L from "./Textarea.js";
39
+ import R from "./Toaster.js";
40
+ import z from "./Tooltip.js";
39
41
  //#region src/components/index.ts
40
- var R = /* @__PURE__ */ e({
42
+ var B = /* @__PURE__ */ e({
41
43
  Alert: () => t,
42
44
  App: () => n,
43
45
  Badge: () => r,
44
46
  Banner: () => i,
45
- Breadcrumb: () => a,
46
- Button: () => o,
47
- ButtonGroup: () => s,
48
- Card: () => c,
49
- Checkbox: () => l,
50
- Combobox: () => u,
51
- ConfirmDialog: () => f,
52
- DatePicker: () => p,
53
- DateRangePicker: () => m,
54
- Dialog: () => d,
55
- DropdownMenu: () => h,
56
- EmptyState: () => g,
57
- FileUpload: () => _,
58
- Form: () => v,
59
- FormField: () => b,
60
- Input: () => x,
61
- Label: () => y,
62
- NumberInput: () => S,
63
- Pagination: () => C,
64
- PasswordInput: () => w,
65
- Progress: () => T,
66
- RadioGroup: () => E,
67
- Select: () => D,
68
- Separator: () => O,
69
- Skeleton: () => k,
70
- Stat: () => A,
71
- Stepper: () => j,
72
- Switch: () => M,
73
- Table: () => N,
74
- Tabs: () => P,
75
- Textarea: () => F,
76
- Toaster: () => I,
77
- Tooltip: () => L
47
+ BarChart: () => a,
48
+ Breadcrumb: () => o,
49
+ Button: () => s,
50
+ ButtonGroup: () => c,
51
+ Card: () => l,
52
+ Checkbox: () => u,
53
+ Combobox: () => d,
54
+ ConfirmDialog: () => p,
55
+ DatePicker: () => m,
56
+ DateRangePicker: () => h,
57
+ Dialog: () => f,
58
+ DropdownMenu: () => g,
59
+ EmptyState: () => _,
60
+ FileUpload: () => v,
61
+ Form: () => y,
62
+ FormField: () => x,
63
+ Input: () => S,
64
+ Label: () => b,
65
+ NumberInput: () => C,
66
+ Pagination: () => w,
67
+ PasswordInput: () => T,
68
+ Progress: () => E,
69
+ RadioGroup: () => D,
70
+ Select: () => O,
71
+ Separator: () => k,
72
+ Skeleton: () => A,
73
+ Sparkline: () => j,
74
+ Stat: () => M,
75
+ Stepper: () => N,
76
+ Switch: () => P,
77
+ Table: () => F,
78
+ Tabs: () => I,
79
+ Textarea: () => L,
80
+ Toaster: () => R,
81
+ Tooltip: () => z
78
82
  });
79
83
  //#endregion
80
- export { R as components_exports };
84
+ export { B as components_exports };
@@ -0,0 +1,22 @@
1
+ import { onBeforeUnmount as e, ref as t, watch as n } from "vue";
2
+ //#region src/composables/element-size.ts
3
+ function r(r) {
4
+ let i = t(0), a = t(0), o;
5
+ function s() {
6
+ o?.disconnect(), o = void 0;
7
+ }
8
+ return n(r, (e) => {
9
+ s(), e && (i.value = e.clientWidth, a.value = e.clientHeight, !(typeof ResizeObserver > "u") && (o = new ResizeObserver((e) => {
10
+ let t = e[0];
11
+ t && (i.value = t.contentRect.width, a.value = t.contentRect.height);
12
+ }), o.observe(e)));
13
+ }, {
14
+ immediate: !0,
15
+ flush: "post"
16
+ }), e(s), {
17
+ width: i,
18
+ height: a
19
+ };
20
+ }
21
+ //#endregion
22
+ export { r as useElementSize };
@@ -0,0 +1,43 @@
1
+ //#region src/composables/scale.ts
2
+ function e(e) {
3
+ return e.filter((e) => typeof e == "number" && Number.isFinite(e));
4
+ }
5
+ function t(t) {
6
+ let n = e(t);
7
+ if (n.length) return [Math.min(...n), Math.max(...n)];
8
+ }
9
+ function n(e, t) {
10
+ let [n, r] = e, [i, a] = t, o = r - n;
11
+ if (o === 0) return () => (i + a) / 2;
12
+ let s = (a - i) / o;
13
+ return (e) => i + (e - n) * s;
14
+ }
15
+ function r(e, t) {
16
+ let n = 10 ** Math.floor(Math.log10(e)), r = e / n, i;
17
+ return i = t ? r < 1.5 ? 1 : r < 3 ? 2 : r < 7 ? 5 : 10 : r <= 1 ? 1 : r <= 2 ? 2 : r <= 5 ? 5 : 10, i * n;
18
+ }
19
+ function i(e, t, n = 5) {
20
+ if (!Number.isFinite(e) || !Number.isFinite(t)) return {
21
+ ticks: [0, 1],
22
+ min: 0,
23
+ max: 1
24
+ };
25
+ if (e === t) {
26
+ if (e === 0) return {
27
+ ticks: [0, 1],
28
+ min: 0,
29
+ max: 1
30
+ };
31
+ let n = Math.abs(e);
32
+ e -= n / 2, t += n / 2;
33
+ }
34
+ let i = r(r(t - e, !1) / Math.max(n - 1, 1), !0), a = Math.floor(e / i) * i, o = Math.ceil(t / i) * i, s = Math.max(0, -Math.floor(Math.log10(i))), c = [], l = Math.round((o - a) / i);
35
+ for (let e = 0; e <= l; e++) c.push(Number((a + e * i).toFixed(s)));
36
+ return {
37
+ ticks: c,
38
+ min: c[0],
39
+ max: c[c.length - 1]
40
+ };
41
+ }
42
+ //#endregion
43
+ export { t as extent, e as finiteValues, n as linearScale, i as niceTicks };
@@ -0,0 +1,18 @@
1
+ import { tv as e } from "tailwind-variants";
2
+ //#region src/theme/bar-chart.ts
3
+ var t = e({ slots: {
4
+ root: "relative w-full text-primary",
5
+ svg: "block w-full overflow-visible",
6
+ grid: "stroke-border",
7
+ tick: "fill-muted-foreground text-xs [font-variant-numeric:tabular-nums]",
8
+ category: "fill-muted-foreground text-xs",
9
+ bar: "fill-current transition-opacity",
10
+ hit: "fill-transparent",
11
+ faded: "opacity-30",
12
+ tooltip: "pointer-events-none absolute z-10 flex items-baseline gap-1.5 rounded-lg border border-border bg-background px-2 py-1 text-xs whitespace-nowrap text-foreground shadow-md",
13
+ tooltipLabel: "text-muted-foreground",
14
+ tooltipValue: "font-medium [font-variant-numeric:tabular-nums]",
15
+ table: "sr-only"
16
+ } });
17
+ //#endregion
18
+ export { t as barChartTheme };
@@ -0,0 +1,15 @@
1
+ import { tv as e } from "tailwind-variants";
2
+ //#region src/theme/sparkline.ts
3
+ var t = e({
4
+ slots: {
5
+ root: "block w-full text-primary",
6
+ plot: "block w-full overflow-visible",
7
+ line: "fill-none stroke-current stroke-2 [stroke-linecap:round] [stroke-linejoin:round]",
8
+ area: "fill-current stroke-none opacity-10",
9
+ dot: "stroke-current [stroke-linecap:round]",
10
+ ring: "[stroke:var(--iryx-background)] [stroke-linecap:round]"
11
+ },
12
+ variants: { muted: { true: { root: "text-muted-foreground" } } }
13
+ });
14
+ //#endregion
15
+ export { t as sparklineTheme };
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Everything recessive except the bars. Grid and axis text sit one step off
3
+ * the surface; the data is the only thing allowed to be loud.
4
+ */
5
+ export declare const barChartTheme: import("tailwind-variants").TVReturnType<{
6
+ [key: string]: {
7
+ [key: string]: import("tailwind-variants").ClassValue | {
8
+ root?: import("tailwind-variants").ClassValue;
9
+ svg?: import("tailwind-variants").ClassValue;
10
+ table?: import("tailwind-variants").ClassValue;
11
+ grid?: import("tailwind-variants").ClassValue;
12
+ tick?: import("tailwind-variants").ClassValue;
13
+ category?: import("tailwind-variants").ClassValue;
14
+ bar?: import("tailwind-variants").ClassValue;
15
+ hit?: import("tailwind-variants").ClassValue;
16
+ faded?: import("tailwind-variants").ClassValue;
17
+ tooltip?: import("tailwind-variants").ClassValue;
18
+ tooltipLabel?: import("tailwind-variants").ClassValue;
19
+ tooltipValue?: import("tailwind-variants").ClassValue;
20
+ };
21
+ };
22
+ } | {
23
+ [x: string]: {
24
+ [x: string]: import("tailwind-variants").ClassValue | {
25
+ root?: import("tailwind-variants").ClassValue;
26
+ svg?: import("tailwind-variants").ClassValue;
27
+ table?: import("tailwind-variants").ClassValue;
28
+ grid?: import("tailwind-variants").ClassValue;
29
+ tick?: import("tailwind-variants").ClassValue;
30
+ category?: import("tailwind-variants").ClassValue;
31
+ bar?: import("tailwind-variants").ClassValue;
32
+ hit?: import("tailwind-variants").ClassValue;
33
+ faded?: import("tailwind-variants").ClassValue;
34
+ tooltip?: import("tailwind-variants").ClassValue;
35
+ tooltipLabel?: import("tailwind-variants").ClassValue;
36
+ tooltipValue?: import("tailwind-variants").ClassValue;
37
+ };
38
+ };
39
+ } | {}, {
40
+ root: string;
41
+ svg: string;
42
+ /** Hairline and solid — a dashed grid competes with the marks. */
43
+ grid: string;
44
+ /** Text never wears the series colour; identity comes from the mark. */
45
+ tick: string;
46
+ category: string;
47
+ bar: string;
48
+ /** Hit target, deliberately wider than the mark it selects. */
49
+ hit: string;
50
+ /** Dims the rest of the series so the hovered bar reads as selected. */
51
+ faded: string;
52
+ tooltip: string;
53
+ tooltipLabel: string;
54
+ tooltipValue: string;
55
+ /** Reachable by screen readers and by nobody's eyes. */
56
+ table: string;
57
+ }, undefined, {
58
+ [key: string]: {
59
+ [key: string]: import("tailwind-variants").ClassValue | {
60
+ root?: import("tailwind-variants").ClassValue;
61
+ svg?: import("tailwind-variants").ClassValue;
62
+ table?: import("tailwind-variants").ClassValue;
63
+ grid?: import("tailwind-variants").ClassValue;
64
+ tick?: import("tailwind-variants").ClassValue;
65
+ category?: import("tailwind-variants").ClassValue;
66
+ bar?: import("tailwind-variants").ClassValue;
67
+ hit?: import("tailwind-variants").ClassValue;
68
+ faded?: import("tailwind-variants").ClassValue;
69
+ tooltip?: import("tailwind-variants").ClassValue;
70
+ tooltipLabel?: import("tailwind-variants").ClassValue;
71
+ tooltipValue?: import("tailwind-variants").ClassValue;
72
+ };
73
+ };
74
+ } | {}, {
75
+ root: string;
76
+ svg: string;
77
+ /** Hairline and solid — a dashed grid competes with the marks. */
78
+ grid: string;
79
+ /** Text never wears the series colour; identity comes from the mark. */
80
+ tick: string;
81
+ category: string;
82
+ bar: string;
83
+ /** Hit target, deliberately wider than the mark it selects. */
84
+ hit: string;
85
+ /** Dims the rest of the series so the hovered bar reads as selected. */
86
+ faded: string;
87
+ tooltip: string;
88
+ tooltipLabel: string;
89
+ tooltipValue: string;
90
+ /** Reachable by screen readers and by nobody's eyes. */
91
+ table: string;
92
+ }, import("tailwind-variants").TVReturnType<unknown, {
93
+ root: string;
94
+ svg: string;
95
+ /** Hairline and solid — a dashed grid competes with the marks. */
96
+ grid: string;
97
+ /** Text never wears the series colour; identity comes from the mark. */
98
+ tick: string;
99
+ category: string;
100
+ bar: string;
101
+ /** Hit target, deliberately wider than the mark it selects. */
102
+ hit: string;
103
+ /** Dims the rest of the series so the hovered bar reads as selected. */
104
+ faded: string;
105
+ tooltip: string;
106
+ tooltipLabel: string;
107
+ tooltipValue: string;
108
+ /** Reachable by screen readers and by nobody's eyes. */
109
+ table: string;
110
+ }, undefined, unknown, unknown, undefined>>;
111
+ export type BarChartSlots = keyof ReturnType<typeof barChartTheme>;
@@ -1,6 +1,7 @@
1
1
  export * from './alert';
2
2
  export * from './badge';
3
3
  export * from './banner';
4
+ export * from './bar-chart';
4
5
  export * from './breadcrumb';
5
6
  export * from './button';
6
7
  export * from './button-group';
@@ -23,6 +24,7 @@ export * from './radio-group';
23
24
  export * from './select';
24
25
  export * from './separator';
25
26
  export * from './skeleton';
27
+ export * from './sparkline';
26
28
  export * from './stat';
27
29
  export * from './stepper';
28
30
  export * from './switch';
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Colour comes from `currentColor`, so a sparkline recolours with a text
3
+ * utility and follows the theme and appearance without any JS. That is the
4
+ * whole reason these are SVG rather than canvas.
5
+ */
6
+ export declare const sparklineTheme: import("tailwind-variants").TVReturnType<{
7
+ muted: {
8
+ true: {
9
+ root: string;
10
+ };
11
+ };
12
+ }, {
13
+ /** Carries the inset that keeps every mark inside the component's box. */
14
+ root: string;
15
+ plot: string;
16
+ /** 2px, round join and cap, per the shared line-mark spec. */
17
+ line: string;
18
+ /** A wash at ~10%, never a saturated block competing with the line. */
19
+ area: string;
20
+ dot: string;
21
+ /** Keeps the end dot legible where it sits on top of the line. */
22
+ ring: string;
23
+ }, undefined, {
24
+ muted: {
25
+ true: {
26
+ root: string;
27
+ };
28
+ };
29
+ }, {
30
+ /** Carries the inset that keeps every mark inside the component's box. */
31
+ root: string;
32
+ plot: string;
33
+ /** 2px, round join and cap, per the shared line-mark spec. */
34
+ line: string;
35
+ /** A wash at ~10%, never a saturated block competing with the line. */
36
+ area: string;
37
+ dot: string;
38
+ /** Keeps the end dot legible where it sits on top of the line. */
39
+ ring: string;
40
+ }, import("tailwind-variants").TVReturnType<{
41
+ muted: {
42
+ true: {
43
+ root: string;
44
+ };
45
+ };
46
+ }, {
47
+ /** Carries the inset that keeps every mark inside the component's box. */
48
+ root: string;
49
+ plot: string;
50
+ /** 2px, round join and cap, per the shared line-mark spec. */
51
+ line: string;
52
+ /** A wash at ~10%, never a saturated block competing with the line. */
53
+ area: string;
54
+ dot: string;
55
+ /** Keeps the end dot legible where it sits on top of the line. */
56
+ ring: string;
57
+ }, undefined, unknown, unknown, undefined>>;
58
+ export type SparklineSlots = keyof ReturnType<typeof sparklineTheme>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iryx-ui",
3
3
  "type": "module",
4
- "version": "0.8.0",
4
+ "version": "0.9.0",
5
5
  "description": "A Vue 3 component library built on Reka UI and Tailwind CSS v4.",
6
6
  "author": "therok1",
7
7
  "license": "MIT",