@ember-joinery/chart 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/LICENSE.md +9 -0
  3. package/NOTICE +532 -0
  4. package/README.md +69 -2
  5. package/addon-main.cjs +4 -0
  6. package/declarations/-private/cartesian-chart.d.ts +413 -0
  7. package/declarations/-private/cartesian-chart.d.ts.map +1 -0
  8. package/declarations/-private/cartesian.d.ts +236 -0
  9. package/declarations/-private/cartesian.d.ts.map +1 -0
  10. package/declarations/-private/config.d.ts +13 -0
  11. package/declarations/-private/config.d.ts.map +1 -0
  12. package/declarations/-private/dots.d.ts +27 -0
  13. package/declarations/-private/dots.d.ts.map +1 -0
  14. package/declarations/-private/nice-ticks.d.ts +17 -0
  15. package/declarations/-private/nice-ticks.d.ts.map +1 -0
  16. package/declarations/-private/parts.d.ts +596 -0
  17. package/declarations/-private/parts.d.ts.map +1 -0
  18. package/declarations/-private/paths.d.ts +26 -0
  19. package/declarations/-private/paths.d.ts.map +1 -0
  20. package/declarations/-private/pie-chart.d.ts +244 -0
  21. package/declarations/-private/pie-chart.d.ts.map +1 -0
  22. package/declarations/-private/polar-chart.d.ts +423 -0
  23. package/declarations/-private/polar-chart.d.ts.map +1 -0
  24. package/declarations/-private/polar-geometry.d.ts +230 -0
  25. package/declarations/-private/polar-geometry.d.ts.map +1 -0
  26. package/declarations/-private/polar-parts.d.ts +315 -0
  27. package/declarations/-private/polar-parts.d.ts.map +1 -0
  28. package/declarations/-private/polar.d.ts +156 -0
  29. package/declarations/-private/polar.d.ts.map +1 -0
  30. package/declarations/-private/registry.d.ts +9 -0
  31. package/declarations/-private/registry.d.ts.map +1 -0
  32. package/declarations/-private/text-size.d.ts +13 -0
  33. package/declarations/-private/text-size.d.ts.map +1 -0
  34. package/declarations/-private/tick-interval.d.ts +35 -0
  35. package/declarations/-private/tick-interval.d.ts.map +1 -0
  36. package/declarations/components/area-chart.d.ts +16 -0
  37. package/declarations/components/area-chart.d.ts.map +1 -0
  38. package/declarations/components/bar-chart.d.ts +16 -0
  39. package/declarations/components/bar-chart.d.ts.map +1 -0
  40. package/declarations/components/chart-container.d.ts +66 -0
  41. package/declarations/components/chart-container.d.ts.map +1 -0
  42. package/declarations/components/chart-legend-content.d.ts +42 -0
  43. package/declarations/components/chart-legend-content.d.ts.map +1 -0
  44. package/declarations/components/chart-style.d.ts +19 -0
  45. package/declarations/components/chart-style.d.ts.map +1 -0
  46. package/declarations/components/chart-tooltip-content.d.ts +94 -0
  47. package/declarations/components/chart-tooltip-content.d.ts.map +1 -0
  48. package/declarations/components/dot.d.ts +22 -0
  49. package/declarations/components/dot.d.ts.map +1 -0
  50. package/declarations/components/line-chart.d.ts +16 -0
  51. package/declarations/components/line-chart.d.ts.map +1 -0
  52. package/declarations/components/pie-chart.d.ts +13 -0
  53. package/declarations/components/pie-chart.d.ts.map +1 -0
  54. package/declarations/components/radar-chart.d.ts +21 -0
  55. package/declarations/components/radar-chart.d.ts.map +1 -0
  56. package/declarations/components/radial-bar-chart.d.ts +17 -0
  57. package/declarations/components/radial-bar-chart.d.ts.map +1 -0
  58. package/declarations/components/rectangle.d.ts +32 -0
  59. package/declarations/components/rectangle.d.ts.map +1 -0
  60. package/declarations/components/sector.d.ts +47 -0
  61. package/declarations/components/sector.d.ts.map +1 -0
  62. package/declarations/index.d.ts +24 -0
  63. package/declarations/index.d.ts.map +1 -0
  64. package/declarations/test-support/chart.d.ts +162 -0
  65. package/declarations/test-support/chart.d.ts.map +1 -0
  66. package/declarations/test-support/index.d.ts +3 -0
  67. package/declarations/test-support/index.d.ts.map +1 -0
  68. package/declarations/test-support/polar-chart.d.ts +62 -0
  69. package/declarations/test-support/polar-chart.d.ts.map +1 -0
  70. package/declarations/test-support.d.ts +2 -0
  71. package/declarations/types.d.ts +138 -0
  72. package/declarations/types.d.ts.map +1 -0
  73. package/dist/cartesian-D9hWDamz.js +1217 -0
  74. package/dist/cartesian-D9hWDamz.js.map +1 -0
  75. package/dist/cartesian-chart-BLj6Q_OB.js +1123 -0
  76. package/dist/cartesian-chart-BLj6Q_OB.js.map +1 -0
  77. package/dist/components/area-chart.js +20 -0
  78. package/dist/components/area-chart.js.map +1 -0
  79. package/dist/components/bar-chart.js +20 -0
  80. package/dist/components/bar-chart.js.map +1 -0
  81. package/dist/components/chart-container.js +54 -0
  82. package/dist/components/chart-container.js.map +1 -0
  83. package/dist/components/chart-legend-content.js +48 -0
  84. package/dist/components/chart-legend-content.js.map +1 -0
  85. package/dist/components/chart-style.js +35 -0
  86. package/dist/components/chart-style.js.map +1 -0
  87. package/dist/components/chart-tooltip-content.js +131 -0
  88. package/dist/components/chart-tooltip-content.js.map +1 -0
  89. package/dist/components/dot.js +18 -0
  90. package/dist/components/dot.js.map +1 -0
  91. package/dist/components/line-chart.js +20 -0
  92. package/dist/components/line-chart.js.map +1 -0
  93. package/dist/components/pie-chart.js +6 -0
  94. package/dist/components/pie-chart.js.map +1 -0
  95. package/dist/components/radar-chart.js +22 -0
  96. package/dist/components/radar-chart.js.map +1 -0
  97. package/dist/components/radial-bar-chart.js +20 -0
  98. package/dist/components/radial-bar-chart.js.map +1 -0
  99. package/dist/components/rectangle.js +5 -0
  100. package/dist/components/rectangle.js.map +1 -0
  101. package/dist/components/sector.js +5 -0
  102. package/dist/components/sector.js.map +1 -0
  103. package/dist/config-DnsUmxOT.js +35 -0
  104. package/dist/config-DnsUmxOT.js.map +1 -0
  105. package/dist/index.js +15 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/parts-BWLhFFjB.js +355 -0
  108. package/dist/parts-BWLhFFjB.js.map +1 -0
  109. package/dist/pie-chart-CmDtW_Ge.js +646 -0
  110. package/dist/pie-chart-CmDtW_Ge.js.map +1 -0
  111. package/dist/polar-chart-GhgOSsH9.js +2242 -0
  112. package/dist/polar-chart-GhgOSsH9.js.map +1 -0
  113. package/dist/rectangle-Cl7tbXuZ.js +166 -0
  114. package/dist/rectangle-Cl7tbXuZ.js.map +1 -0
  115. package/dist/sector-7shQPJuQ.js +565 -0
  116. package/dist/sector-7shQPJuQ.js.map +1 -0
  117. package/dist/test-support.js +470 -0
  118. package/dist/test-support.js.map +1 -0
  119. package/dist/types.js +56 -0
  120. package/dist/types.js.map +1 -0
  121. package/package.json +117 -3
@@ -0,0 +1,131 @@
1
+ import { isFunction, isString, isNumber } from '@sindresorhus/is';
2
+ import Component from '@glimmer/component';
3
+ import { setComponentTemplate, getComponentTemplate } from '@ember/component';
4
+ import { htmlSafe } from '@ember/template';
5
+ import Icon from '@ember-joinery/ember/components/icon';
6
+ import { p as payloadConfig, c as cssValue } from '../config-DnsUmxOT.js';
7
+ import { precompileTemplate } from '@ember/template-compilation';
8
+
9
+ function text(value) {
10
+ return isNumber(value) ? value.toLocaleString() : String(value);
11
+ }
12
+ /**
13
+ * Whether a formatter is a component rather than a function: a `<template>` or a curried
14
+ * `(component …)` is not a function at all, and a class component has a template.
15
+ */
16
+ function isFormatterComponent(formatter) {
17
+ return !isFunction(formatter) || getComponentTemplate(formatter) !== undefined || /^class[\s{]/.test(Function.prototype.toString.call(formatter));
18
+ }
19
+ /**
20
+ * A chart tooltip's box: the active row's label, then each series with its colour, name and
21
+ * value. shadcn's `ChartTooltipContent`; give it to a chart's tooltip as its content, with any
22
+ * of its arguments curried in:
23
+ *
24
+ * <c.ChartTooltip @content={{component ChartTooltipContent indicator="line"}} />
25
+ *
26
+ * It draws nothing while the tooltip is inactive or empty. It also renders on its own, given
27
+ * `@active`, `@payload` and `@label`.
28
+ */
29
+ class ChartTooltipContent extends Component {
30
+ get indicator() {
31
+ return this.args.indicator ?? 'dot';
32
+ }
33
+ get visible() {
34
+ return Boolean(this.args.active && this.args.payload?.length);
35
+ }
36
+ get labelFormatter() {
37
+ return this.args.tooltip?.labelFormatter ?? this.args.labelFormatter;
38
+ }
39
+ get labelClassName() {
40
+ return this.args.tooltip?.labelClassName ?? this.args.labelClassName;
41
+ }
42
+ get formatter() {
43
+ return this.args.tooltip?.formatter ?? this.args.formatter;
44
+ }
45
+ /** The formatter, when it is a component. */
46
+ get formatterComponent() {
47
+ const formatter = this.formatter;
48
+ return formatter && isFormatterComponent(formatter) ? formatter : undefined;
49
+ }
50
+ get config() {
51
+ return this.args.config ?? {};
52
+ }
53
+ get nestLabel() {
54
+ return (this.args.payload?.length ?? 0) === 1 && this.indicator !== 'dot';
55
+ }
56
+ /** The label's text, or null for none. */
57
+ get label() {
58
+ const {
59
+ hideLabel,
60
+ payload,
61
+ labelKey,
62
+ label
63
+ } = this.args;
64
+ const labelFormatter = this.labelFormatter;
65
+ const config = this.args.config ?? {};
66
+ if (hideLabel || !payload?.length) return null;
67
+ const [item] = payload;
68
+ const key = `${labelKey ?? (isFunction(item?.dataKey) ? undefined : item?.dataKey) ?? item?.name ?? 'value'}`;
69
+ const itemConfig = payloadConfig(config, item, key);
70
+ const value = !labelKey && isString(label) ? config[label]?.label ?? label : itemConfig?.label;
71
+ if (labelFormatter) return {
72
+ text: String(labelFormatter(value, payload) ?? '')
73
+ };
74
+ if (!value) return null;
75
+ return {
76
+ text: String(value)
77
+ };
78
+ }
79
+ get entries() {
80
+ const {
81
+ payload,
82
+ nameKey,
83
+ color
84
+ } = this.args;
85
+ const formatter = this.formatter;
86
+ const config = this.args.config ?? {};
87
+ return (payload ?? []).filter(item => item.type !== 'none').map((item, index) => {
88
+ const key = `${nameKey ?? item.name ?? (isFunction(item.dataKey) ? undefined : item.dataKey) ?? 'value'}`;
89
+ const itemConfig = payloadConfig(config, item, key);
90
+ const indicatorColor = cssValue(color ?? item.payload?.['fill'] ?? item.color);
91
+ const icon = itemConfig?.icon;
92
+ const entry = {
93
+ key,
94
+ name: String(itemConfig?.label ?? item.name ?? ''),
95
+ value: item.value !== null && item.value !== undefined ? text(item.value) : null,
96
+ icon,
97
+ iconNode: Array.isArray(icon) ? icon : undefined,
98
+ iconComponent: icon && !Array.isArray(icon) ? icon : undefined,
99
+ indicatorStyle: htmlSafe(indicatorColor ? `--color-bg: ${indicatorColor}; --color-border: ${indicatorColor};` : '')
100
+ };
101
+ if (formatter && item.value !== undefined && item.name) {
102
+ if (isFormatterComponent(formatter)) {
103
+ entry.custom = {
104
+ value: item.value,
105
+ name: item.name,
106
+ item,
107
+ index,
108
+ payload: item.payload
109
+ };
110
+ } else {
111
+ // Its result stands in for the entry whatever it is, an empty string included, as
112
+ // upstream renders the formatter's result whenever it calls it.
113
+ entry.isFormatted = true;
114
+ entry.formatted = String(formatter(item.value, item.name, item, index, item.payload) ?? '');
115
+ }
116
+ }
117
+ return entry;
118
+ });
119
+ }
120
+ static {
121
+ setComponentTemplate(precompileTemplate("{{#if this.visible}}\n {{!-- Upstream's box has no data-slot; Joinery's gives it one, so the share of Tailwind's\n preflight Joinery's parts get (border-box sizing) applies outside a chart too. --}}\n <div class=\"jn-chart-tooltip {{@class}}\" data-slot=\"chart-tooltip\" data-test-jn=\"chart-tooltip\" data-indicator={{this.indicator}} ...attributes>\n {{#unless this.nestLabel}}\n {{#if this.label}}\n <div class=\"jn-chart-tooltip-label {{this.labelClassName}}\" data-test-jn-part=\"label\">\n {{this.label.text}}\n </div>\n {{/if}}\n {{/unless}}\n <div class=\"jn-chart-tooltip-items\">\n {{#each this.entries as |entry|}}\n <div class=\"jn-chart-tooltip-item\" data-indicator={{this.indicator}} data-test-jn-part=\"item\" data-test-jn-value={{entry.key}}>\n {{#if entry.custom}}\n {{#if this.formatterComponent}}\n <this.formatterComponent @value={{entry.custom.value}} @name={{entry.custom.name}} @item={{entry.custom.item}} @index={{entry.custom.index}} @payload={{entry.custom.payload}} @config={{this.config}} />\n {{/if}}\n {{else if entry.isFormatted}}\n {{entry.formatted}}\n {{else}}\n {{#if entry.iconNode}}\n <Icon @icon={{entry.iconNode}} />\n {{else if entry.iconComponent}}\n <entry.iconComponent />\n {{else}}\n {{#unless @hideIndicator}}\n <div class=\"jn-chart-tooltip-indicator\" data-indicator={{this.indicator}} data-nested={{if this.nestLabel \"true\"}} style={{entry.indicatorStyle}} data-test-jn-part=\"indicator\"></div>\n {{/unless}}\n {{/if}}\n <div class=\"jn-chart-tooltip-body\" data-nested={{if this.nestLabel \"true\" \"false\"}}>\n <div class=\"jn-chart-tooltip-names\">\n {{#if this.nestLabel}}\n {{#if this.label}}\n <div class=\"jn-chart-tooltip-label {{this.labelClassName}}\" data-test-jn-part=\"label\">\n {{this.label.text}}\n </div>\n {{/if}}\n {{/if}}\n <span class=\"jn-chart-tooltip-name\" data-test-jn-part=\"name\">{{entry.name}}</span>\n </div>\n {{#if entry.value}}\n <span class=\"jn-chart-tooltip-value\" data-test-jn-part=\"value\">{{entry.value}}</span>\n {{/if}}\n </div>\n {{/if}}\n </div>\n {{/each}}\n </div>\n </div>\n{{/if}}", {
122
+ strictMode: true,
123
+ scope: () => ({
124
+ Icon
125
+ })
126
+ }), this);
127
+ }
128
+ }
129
+
130
+ export { ChartTooltipContent as default };
131
+ //# sourceMappingURL=chart-tooltip-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-tooltip-content.js","sources":["../../src/components/chart-tooltip-content.gts"],"sourcesContent":["import { isFunction, isNumber, isString } from '@sindresorhus/is'\nimport Component from '@glimmer/component'\nimport { getComponentTemplate } from '@ember/component'\nimport { htmlSafe, type SafeString } from '@ember/template'\nimport type { ComponentLike } from '@glint/template'\nimport Icon, { type IconNode } from '@ember-joinery/ember/components/icon'\nimport { cssValue, payloadConfig } from '../-private/config.ts'\nimport type {\n ChartConfig,\n ChartIcon,\n ChartTooltipContentArgs,\n LabelFormatter,\n TooltipFormatter,\n TooltipFormatterSignature,\n TooltipPayloadItem,\n ValueFormatter,\n} from '../types.ts'\n\n/** How a tooltip marks each series: a square `dot`, a `line`, or a `dashed` line. */\nexport type ChartTooltipIndicator = 'dot' | 'line' | 'dashed'\n\nexport interface ChartTooltipContentSignature {\n Args: {\n /** Whether the tooltip is showing; the chart passes it. */\n active?: boolean\n /** The entries at the active row; the chart passes them. */\n payload?: readonly TooltipPayloadItem[]\n /** The active row's category; the chart passes it. */\n label?: unknown\n /** The chart's config; the chart passes the container's. */\n config?: ChartConfig\n /** Where the tooltip points; the chart passes it. Unused. */\n coordinate?: { x: number; y: number }\n /** The chart tooltip's own label class and formatters; the chart passes them. */\n tooltip?: ChartTooltipContentArgs['tooltip']\n /** Hides the label. */\n hideLabel?: boolean\n /** Hides each entry's indicator. */\n hideIndicator?: boolean\n /** `dot` (default), `line` or `dashed`. */\n indicator?: ChartTooltipIndicator\n /** The config or row key to name the entries by. Default each entry's name. */\n nameKey?: string\n /** The config or data key to label the tooltip by. Default the active row's category. */\n labelKey?: string\n /** Formats the label. */\n labelFormatter?: LabelFormatter\n /** Classes for the label. */\n labelClassName?: string\n /**\n * Formats each entry, in place of its indicator, name and value: a function returning its\n * text, or a component that draws it (for markup, as recharts' formatter can return).\n */\n formatter?: TooltipFormatter\n /** One indicator colour for every entry. Default each entry's `fill` (in its row) or colour. */\n color?: string\n /** Classes for the tooltip box, for use in a curried `@content`: `class=\"w-[150px]\"`. */\n class?: string\n }\n Element: HTMLDivElement\n}\n\ninterface Entry {\n key: string\n name: string\n value: string | null\n icon?: ChartIcon\n iconNode?: IconNode\n iconComponent?: ComponentLike<{ Element: Element }>\n indicatorStyle: SafeString\n /** Whether a formatter function drew the entry, and its text (which may be empty). */\n isFormatted?: boolean\n formatted?: string\n /** What the formatter component is handed. */\n custom?: Omit<TooltipFormatterSignature['Args'], 'config'>\n}\n\nfunction text(value: unknown): string {\n return isNumber(value) ? value.toLocaleString() : String(value)\n}\n\n/**\n * Whether a formatter is a component rather than a function: a `<template>` or a curried\n * `(component …)` is not a function at all, and a class component has a template.\n */\nfunction isFormatterComponent(\n formatter: TooltipFormatter,\n): formatter is ComponentLike<TooltipFormatterSignature> {\n return (\n !isFunction(formatter) ||\n getComponentTemplate(formatter) !== undefined ||\n /^class[\\s{]/.test(Function.prototype.toString.call(formatter))\n )\n}\n\n/**\n * A chart tooltip's box: the active row's label, then each series with its colour, name and\n * value. shadcn's `ChartTooltipContent`; give it to a chart's tooltip as its content, with any\n * of its arguments curried in:\n *\n * <c.ChartTooltip @content={{component ChartTooltipContent indicator=\"line\"}} />\n *\n * It draws nothing while the tooltip is inactive or empty. It also renders on its own, given\n * `@active`, `@payload` and `@label`.\n */\nexport default class ChartTooltipContent extends Component<ChartTooltipContentSignature> {\n get indicator(): ChartTooltipIndicator {\n return this.args.indicator ?? 'dot'\n }\n\n get visible(): boolean {\n return Boolean(this.args.active && this.args.payload?.length)\n }\n\n get labelFormatter(): LabelFormatter | undefined {\n return this.args.tooltip?.labelFormatter ?? this.args.labelFormatter\n }\n\n get labelClassName(): string | undefined {\n return this.args.tooltip?.labelClassName ?? this.args.labelClassName\n }\n\n get formatter(): TooltipFormatter | undefined {\n return this.args.tooltip?.formatter ?? this.args.formatter\n }\n\n /** The formatter, when it is a component. */\n get formatterComponent(): ComponentLike<TooltipFormatterSignature> | undefined {\n const formatter = this.formatter\n return formatter && isFormatterComponent(formatter) ? formatter : undefined\n }\n\n get config(): ChartConfig {\n return this.args.config ?? {}\n }\n\n get nestLabel(): boolean {\n return (this.args.payload?.length ?? 0) === 1 && this.indicator !== 'dot'\n }\n\n /** The label's text, or null for none. */\n get label(): { text: string } | null {\n const { hideLabel, payload, labelKey, label } = this.args\n const labelFormatter = this.labelFormatter\n const config = this.args.config ?? {}\n if (hideLabel || !payload?.length) return null\n const [item] = payload\n const key = `${labelKey ?? (isFunction(item?.dataKey) ? undefined : item?.dataKey) ?? item?.name ?? 'value'}`\n const itemConfig = payloadConfig(config, item, key)\n const value = !labelKey && isString(label) ? (config[label]?.label ?? label) : itemConfig?.label\n if (labelFormatter) return { text: String(labelFormatter(value, payload) ?? '') }\n if (!value) return null\n return { text: String(value) }\n }\n\n get entries(): Entry[] {\n const { payload, nameKey, color } = this.args\n const formatter = this.formatter\n const config = this.args.config ?? {}\n return (payload ?? [])\n .filter(item => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? (isFunction(item.dataKey) ? undefined : item.dataKey) ?? 'value'}`\n const itemConfig = payloadConfig(config, item, key)\n const indicatorColor = cssValue(color ?? item.payload?.['fill'] ?? item.color)\n const icon = itemConfig?.icon\n const entry: Entry = {\n key,\n name: String(itemConfig?.label ?? item.name ?? ''),\n value: item.value !== null && item.value !== undefined ? text(item.value) : null,\n icon,\n iconNode: Array.isArray(icon) ? (icon as IconNode) : undefined,\n iconComponent:\n icon && !Array.isArray(icon)\n ? (icon as ComponentLike<{ Element: Element }>)\n : undefined,\n indicatorStyle: htmlSafe(\n indicatorColor\n ? `--color-bg: ${indicatorColor}; --color-border: ${indicatorColor};`\n : '',\n ),\n }\n if (formatter && item.value !== undefined && item.name) {\n if (isFormatterComponent(formatter)) {\n entry.custom = {\n value: item.value as number | string,\n name: item.name,\n item,\n index,\n payload: item.payload,\n }\n } else {\n // Its result stands in for the entry whatever it is, an empty string included, as\n // upstream renders the formatter's result whenever it calls it.\n entry.isFormatted = true\n entry.formatted = String(\n (formatter as ValueFormatter)(item.value, item.name, item, index, item.payload) ?? '',\n )\n }\n }\n return entry\n })\n }\n\n <template>\n {{#if this.visible}}\n {{! Upstream's box has no data-slot; Joinery's gives it one, so the share of Tailwind's\n preflight Joinery's parts get (border-box sizing) applies outside a chart too. }}\n <div\n class=\"jn-chart-tooltip {{@class}}\"\n data-slot=\"chart-tooltip\"\n data-test-jn=\"chart-tooltip\"\n data-indicator={{this.indicator}}\n ...attributes\n >\n {{#unless this.nestLabel}}\n {{#if this.label}}\n <div class=\"jn-chart-tooltip-label {{this.labelClassName}}\" data-test-jn-part=\"label\">\n {{this.label.text}}\n </div>\n {{/if}}\n {{/unless}}\n <div class=\"jn-chart-tooltip-items\">\n {{#each this.entries as |entry|}}\n <div\n class=\"jn-chart-tooltip-item\"\n data-indicator={{this.indicator}}\n data-test-jn-part=\"item\"\n data-test-jn-value={{entry.key}}\n >\n {{#if entry.custom}}\n {{#if this.formatterComponent}}\n <this.formatterComponent\n @value={{entry.custom.value}}\n @name={{entry.custom.name}}\n @item={{entry.custom.item}}\n @index={{entry.custom.index}}\n @payload={{entry.custom.payload}}\n @config={{this.config}}\n />\n {{/if}}\n {{else if entry.isFormatted}}\n {{entry.formatted}}\n {{else}}\n {{#if entry.iconNode}}\n <Icon @icon={{entry.iconNode}} />\n {{else if entry.iconComponent}}\n <entry.iconComponent />\n {{else}}\n {{#unless @hideIndicator}}\n <div\n class=\"jn-chart-tooltip-indicator\"\n data-indicator={{this.indicator}}\n data-nested={{if this.nestLabel \"true\"}}\n style={{entry.indicatorStyle}}\n data-test-jn-part=\"indicator\"\n ></div>\n {{/unless}}\n {{/if}}\n <div class=\"jn-chart-tooltip-body\" data-nested={{if this.nestLabel \"true\" \"false\"}}>\n <div class=\"jn-chart-tooltip-names\">\n {{#if this.nestLabel}}\n {{#if this.label}}\n <div\n class=\"jn-chart-tooltip-label {{this.labelClassName}}\"\n data-test-jn-part=\"label\"\n >\n {{this.label.text}}\n </div>\n {{/if}}\n {{/if}}\n <span\n class=\"jn-chart-tooltip-name\"\n data-test-jn-part=\"name\"\n >{{entry.name}}</span>\n </div>\n {{#if entry.value}}\n <span\n class=\"jn-chart-tooltip-value\"\n data-test-jn-part=\"value\"\n >{{entry.value}}</span>\n {{/if}}\n </div>\n {{/if}}\n </div>\n {{/each}}\n </div>\n </div>\n {{/if}}\n </template>\n}\n"],"names":["text","value","isNumber","toLocaleString","String","isFormatterComponent","formatter","isFunction","getComponentTemplate","undefined","test","Function","prototype","toString","call","ChartTooltipContent","Component","indicator","args","visible","Boolean","active","payload","length","labelFormatter","tooltip","labelClassName","formatterComponent","config","nestLabel","label","hideLabel","labelKey","item","key","dataKey","name","itemConfig","payloadConfig","isString","entries","nameKey","color","filter","type","map","index","indicatorColor","cssValue","icon","entry","iconNode","Array","isArray","iconComponent","indicatorStyle","htmlSafe","custom","isFormatted","formatted","setComponentTemplate","precompileTemplate","strictMode","scope","Icon"],"mappings":";;;;;;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,IAAA;QACAE,QAAA,EAAUC,MAAMC,OAAO,CAACJ,QAASA,IAAA,GAAoBxC,SAAA;AACrD6C,QAAAA,aAAA,EACEL,QAAQ,CAACG,KAAA,CAAMC,OAAO,CAACJ,IAAA,CAAA,GAClBA,IAAA,GACDxC,SAAA;QACN8C,cAAA,EAAgBC,QAAA,CACdT,cAAA,GACI,CAAA,YAAA,EAAeA,cAAA,CAAA,kBAAA,EAAmCA,cAAA,CAAA,CAAA,CAAiB,GACnE,EAAA;OAER;MACA,IAAIzC,aAAa2B,IAAA,CAAKhC,KAAK,KAAKQ,SAAA,IAAawB,IAAA,CAAKG,IAAI,EAAE;AACtD,QAAA,IAAI/B,qBAAqBC,SAAA,CAAA,EAAY;UACnC4C,KAAA,CAAMO,MAAM,GAAG;YACbxD,KAAA,EAAOgC,IAAA,CAAKhC,KAAwB;YACpCmC,IAAA,EAAMH,KAAKG,IAAI;YACfH,IAAA;YACAa,KAAA;YACAxB,OAAA,EAASW,KAAKX;WAChB;AACF,QAAA,CAAA,MAAO;AACL;AACA;UACA4B,KAAA,CAAMQ,WAAW,GAAG,IAAA;UACpBR,KAAA,CAAMS,SAAS,GAAGvD,MAAA,CACfE,SAAA,CAA6B2B,IAAA,CAAKhC,KAAK,EAAEgC,KAAKG,IAAI,EAAEH,MAAMa,KAAA,EAAOb,IAAA,CAAKX,OAAO,CAAA,IAAK,EAAA,CAAA;AAEvF,QAAA;AACF,MAAA;AACA,MAAA,OAAO4B,KAAA;AACT,IAAA,CAAA,CAAA;AACJ,EAAA;AAEA,EAAA;IAAAU,oBAAA,CAAAC,kBAAA,CAAA,whFAAA,EAqFA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -0,0 +1,18 @@
1
+ import { precompileTemplate } from '@ember/template-compilation';
2
+ import { setComponentTemplate } from '@ember/component';
3
+ import templateOnly from '@ember/component/template-only';
4
+
5
+ /**
6
+ * A circle at a point: recharts' `Dot`, for a series' custom `@dot`. Give it `fill`, `stroke`
7
+ * and any other attribute:
8
+ *
9
+ * const ColoredDot = <template>
10
+ * <Dot @cx={{@cx}} @cy={{@cy}} @r={{5}} fill={{@payload.fill}} stroke={{@payload.fill}} />
11
+ * </template>
12
+ */
13
+ const Dot = setComponentTemplate(precompileTemplate("<circle class=\"recharts-dot\" cx={{@cx}} cy={{@cy}} r={{@r}} ...attributes></circle>", {
14
+ strictMode: true
15
+ }), templateOnly());
16
+
17
+ export { Dot as default };
18
+ //# sourceMappingURL=dot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot.js","sources":["../../src/components/dot.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only'\n\nexport interface DotSignature {\n Args: {\n /** The centre. */\n cx: number\n cy: number\n /** The radius. */\n r: number\n }\n Element: Element\n}\n\n/**\n * A circle at a point: recharts' `Dot`, for a series' custom `@dot`. Give it `fill`, `stroke`\n * and any other attribute:\n *\n * const ColoredDot = <template>\n * <Dot @cx={{@cx}} @cy={{@cy}} @r={{5}} fill={{@payload.fill}} stroke={{@payload.fill}} />\n * </template>\n */\nconst Dot: TOC<DotSignature> = <template>\n <circle class=\"recharts-dot\" cx={{@cx}} cy={{@cy}} r={{@r}} ...attributes></circle>\n</template>\n\nexport default Dot\n"],"names":["Dot","setComponentTemplate","precompileTemplate","strictMode","templateOnly"],"mappings":";;;;AAaA;;;;;;;;AAQA,MAAMA,GAAS,GAAAC,oBAAA,CAAgBC,kBAAA,CAAA,uFAAA,EAE/B;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;"}
@@ -0,0 +1,20 @@
1
+ import { C as CartesianChart } from '../cartesian-chart-BLj6Q_OB.js';
2
+
3
+ /**
4
+ * recharts' `LineChart`, as Glimmer SVG. It yields its parts (axes, grid, series, tooltip and
5
+ * legend); inside a `ChartContainer`, take it from the container's yield (`chart.LineChart`), which
6
+ * gives it the container's config and size.
7
+ *
8
+ * <chart.LineChart @data={{chartData}} as |c|>
9
+ * <c.CartesianGrid @vertical={{false}} />
10
+ * <c.XAxis @dataKey="month" />
11
+ * </chart.LineChart>
12
+ */
13
+ class LineChart extends CartesianChart {
14
+ get chartName() {
15
+ return 'LineChart';
16
+ }
17
+ }
18
+
19
+ export { LineChart as default };
20
+ //# sourceMappingURL=line-chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-chart.js","sources":["../../src/components/line-chart.gts"],"sourcesContent":["import CartesianChart from '../-private/cartesian-chart.gts'\nimport type { ChartName } from '../-private/cartesian.ts'\n\n/**\n * recharts' `LineChart`, as Glimmer SVG. It yields its parts (axes, grid, series, tooltip and\n * legend); inside a `ChartContainer`, take it from the container's yield (`chart.LineChart`), which\n * gives it the container's config and size.\n *\n * <chart.LineChart @data={{chartData}} as |c|>\n * <c.CartesianGrid @vertical={{false}} />\n * <c.XAxis @dataKey=\"month\" />\n * </chart.LineChart>\n */\nexport default class LineChart extends CartesianChart {\n override get chartName(): ChartName {\n return 'LineChart'\n }\n}\n"],"names":["LineChart","CartesianChart","chartName"],"mappings":";;AAGA;;;;;;;;;;AAUe,MAAMA,SAAA,SAAkBC,cAAA,CAAA;EACrC,IAAaC,YAAuB;AAClC,IAAA,OAAO,WAAA;AACT,EAAA;AACF;;"}
@@ -0,0 +1,6 @@
1
+ import { P as PieChart } from '../pie-chart-CmDtW_Ge.js';
2
+
3
+
4
+
5
+ export { PieChart as default };
6
+ //# sourceMappingURL=pie-chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pie-chart.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,22 @@
1
+ import { P as PolarChart } from '../polar-chart-GhgOSsH9.js';
2
+
3
+ /**
4
+ * recharts' `RadarChart`, as Glimmer SVG: a polygon per series, round the chart's categories
5
+ * from 12 o'clock. It yields its parts (grid, axes, series, tooltip and legend); inside a
6
+ * `ChartContainer`, take it from the container's yield (`chart.RadarChart`), which gives it the
7
+ * container's config and size.
8
+ *
9
+ * <chart.RadarChart @data={{chartData}} as |c|>
10
+ * <c.PolarAngleAxis @dataKey="month" />
11
+ * <c.PolarGrid />
12
+ * <c.Radar @dataKey="desktop" @fill="var(--color-desktop)" @fillOpacity={{0.6}} />
13
+ * </chart.RadarChart>
14
+ */
15
+ class RadarChart extends PolarChart {
16
+ get chartName() {
17
+ return 'RadarChart';
18
+ }
19
+ }
20
+
21
+ export { RadarChart as default };
22
+ //# sourceMappingURL=radar-chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radar-chart.js","sources":["../../src/components/radar-chart.gts"],"sourcesContent":["import PolarChart from '../-private/polar-chart.gts'\nimport type { PolarChartName } from '../-private/polar-geometry.ts'\n\nexport type { PolarChartParts, PolarChartSignature } from '../-private/polar-chart.gts'\nexport type {\n PolarAngleAxisSignature,\n PolarAngleAxisTickArgs,\n PolarAxisArgs,\n PolarGridSignature,\n PolarLabelContentSignature,\n PolarRadiusAxisParts,\n PolarRadiusAxisSignature,\n PolarSeriesArgs,\n RadarDotOption,\n RadarSignature,\n RadiusAxisLabelSignature,\n} from '../-private/polar-parts.gts'\nexport type { PolarPosition, PolarTick } from '../-private/polar-geometry.ts'\n\n/**\n * recharts' `RadarChart`, as Glimmer SVG: a polygon per series, round the chart's categories\n * from 12 o'clock. It yields its parts (grid, axes, series, tooltip and legend); inside a\n * `ChartContainer`, take it from the container's yield (`chart.RadarChart`), which gives it the\n * container's config and size.\n *\n * <chart.RadarChart @data={{chartData}} as |c|>\n * <c.PolarAngleAxis @dataKey=\"month\" />\n * <c.PolarGrid />\n * <c.Radar @dataKey=\"desktop\" @fill=\"var(--color-desktop)\" @fillOpacity={{0.6}} />\n * </chart.RadarChart>\n */\nexport default class RadarChart extends PolarChart {\n override get chartName(): PolarChartName {\n return 'RadarChart'\n }\n}\n"],"names":["RadarChart","PolarChart","chartName"],"mappings":";;AAmBA;;;;;;;;;;;;AAYe,MAAMA,UAAA,SAAmBC,UAAA,CAAA;EACtC,IAAaC,YAA4B;AACvC,IAAA,OAAO,YAAA;AACT,EAAA;AACF;;"}
@@ -0,0 +1,20 @@
1
+ import { P as PolarChart } from '../polar-chart-GhgOSsH9.js';
2
+
3
+ /**
4
+ * recharts' `RadialBarChart`, as Glimmer SVG: a bar round the chart for each row, its rows out
5
+ * from the centre. It yields its parts (grid, axes, series, tooltip and legend); inside a
6
+ * `ChartContainer`, take it from the container's yield (`chart.RadialBarChart`), which gives it
7
+ * the container's config and size.
8
+ *
9
+ * <chart.RadialBarChart @data={{chartData}} @innerRadius={{30}} @outerRadius={{110}} as |c|>
10
+ * <c.RadialBar @dataKey="visitors" @background={{true}} />
11
+ * </chart.RadialBarChart>
12
+ */
13
+ class RadialBarChart extends PolarChart {
14
+ get chartName() {
15
+ return 'RadialBarChart';
16
+ }
17
+ }
18
+
19
+ export { RadialBarChart as default };
20
+ //# sourceMappingURL=radial-bar-chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radial-bar-chart.js","sources":["../../src/components/radial-bar-chart.gts"],"sourcesContent":["import PolarChart from '../-private/polar-chart.gts'\nimport type { PolarChartName } from '../-private/polar-geometry.ts'\n\nexport type {\n PolarLabelListSignature,\n RadialBarBackground,\n RadialBarParts,\n RadialBarSignature,\n} from '../-private/polar-parts.gts'\n\n/**\n * recharts' `RadialBarChart`, as Glimmer SVG: a bar round the chart for each row, its rows out\n * from the centre. It yields its parts (grid, axes, series, tooltip and legend); inside a\n * `ChartContainer`, take it from the container's yield (`chart.RadialBarChart`), which gives it\n * the container's config and size.\n *\n * <chart.RadialBarChart @data={{chartData}} @innerRadius={{30}} @outerRadius={{110}} as |c|>\n * <c.RadialBar @dataKey=\"visitors\" @background={{true}} />\n * </chart.RadialBarChart>\n */\nexport default class RadialBarChart extends PolarChart {\n override get chartName(): PolarChartName {\n return 'RadialBarChart'\n }\n}\n"],"names":["RadialBarChart","PolarChart","chartName"],"mappings":";;AAUA;;;;;;;;;;AAUe,MAAMA,cAAA,SAAuBC,UAAA,CAAA;EAC1C,IAAaC,YAA4B;AACvC,IAAA,OAAO,gBAAA;AACT,EAAA;AACF;;"}
@@ -0,0 +1,5 @@
1
+ import '@glimmer/component';
2
+ export { R as default } from '../rectangle-Cl7tbXuZ.js';
3
+ import '@ember/template-compilation';
4
+ import '@ember/component';
5
+ //# sourceMappingURL=rectangle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rectangle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,5 @@
1
+ import '@glimmer/component';
2
+ export { S as default } from '../sector-7shQPJuQ.js';
3
+ import '@ember/template-compilation';
4
+ import '@ember/component';
5
+ //# sourceMappingURL=sector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,35 @@
1
+ import { isObject, isString } from '@sindresorhus/is';
2
+
3
+ /*
4
+ * Reading a chart's config, as shadcn's chart.tsx reads it.
5
+ */
6
+ /**
7
+ * shadcn's `getPayloadConfigFromPayload`: the config entry for a tooltip or legend item. The
8
+ * entry is found by `key`, or by the string at `key` in the item or in its row (so
9
+ * `nameKey="browser"` finds `chrome` in `{ browser: 'chrome' }`).
10
+ */
11
+ function payloadConfig(config, payload, key) {
12
+ if (!config || !isObject(payload)) return undefined;
13
+ const item = payload;
14
+ const row = 'payload' in item && isObject(item['payload']) ? item['payload'] : undefined;
15
+ let configLabelKey = key;
16
+ if (key in item && isString(item[key])) {
17
+ configLabelKey = item[key];
18
+ } else if (row && key in row && isString(row[key])) {
19
+ configLabelKey = row[key];
20
+ }
21
+ return configLabelKey in config ? config[configLabelKey] : config[key];
22
+ }
23
+
24
+ /**
25
+ * A colour safe to write into a `style` attribute or a style sheet: one value, with nothing
26
+ * that could end the declaration or the rule.
27
+ */
28
+ function cssValue(value) {
29
+ if (value === undefined || value === null) return undefined;
30
+ const text = String(value);
31
+ return /[;{}<>"\\]/.test(text) ? undefined : text;
32
+ }
33
+
34
+ export { cssValue as c, payloadConfig as p };
35
+ //# sourceMappingURL=config-DnsUmxOT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-DnsUmxOT.js","sources":["../src/-private/config.ts"],"sourcesContent":["/*\n * Reading a chart's config, as shadcn's chart.tsx reads it.\n */\nimport { isObject, isString } from '@sindresorhus/is'\nimport type { ChartConfig, ChartConfigItem } from '../types.ts'\n\n/**\n * shadcn's `getPayloadConfigFromPayload`: the config entry for a tooltip or legend item. The\n * entry is found by `key`, or by the string at `key` in the item or in its row (so\n * `nameKey=\"browser\"` finds `chrome` in `{ browser: 'chrome' }`).\n */\nexport function payloadConfig(\n config: ChartConfig | undefined,\n payload: unknown,\n key: string,\n): ChartConfigItem | undefined {\n if (!config || !isObject(payload)) return undefined\n const item = payload as Record<string, unknown>\n const row =\n 'payload' in item && isObject(item['payload'])\n ? (item['payload'] as Record<string, unknown>)\n : undefined\n let configLabelKey = key\n if (key in item && isString(item[key])) {\n configLabelKey = item[key]\n } else if (row && key in row && isString(row[key])) {\n configLabelKey = row[key]\n }\n return configLabelKey in config ? config[configLabelKey] : config[key]\n}\n\n/**\n * A colour safe to write into a `style` attribute or a style sheet: one value, with nothing\n * that could end the declaration or the rule.\n */\nexport function cssValue(value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n const text = String(value)\n return /[;{}<>\"\\\\]/.test(text) ? undefined : text\n}\n"],"names":["payloadConfig","config","payload","key","isObject","undefined","item","row","configLabelKey","isString","cssValue","value","text","String","test"],"mappings":";;AAAA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAC3BC,MAA+B,EAC/BC,OAAgB,EAChBC,GAAW,EACkB;EAC7B,IAAI,CAACF,MAAM,IAAI,CAACG,QAAQ,CAACF,OAAO,CAAC,EAAE,OAAOG,SAAS;EACnD,MAAMC,IAAI,GAAGJ,OAAkC;AAC/C,EAAA,MAAMK,GAAG,GACP,SAAS,IAAID,IAAI,IAAIF,QAAQ,CAACE,IAAI,CAAC,SAAS,CAAC,CAAC,GACzCA,IAAI,CAAC,SAAS,CAAC,GAChBD,SAAS;EACf,IAAIG,cAAc,GAAGL,GAAG;EACxB,IAAIA,GAAG,IAAIG,IAAI,IAAIG,QAAQ,CAACH,IAAI,CAACH,GAAG,CAAC,CAAC,EAAE;AACtCK,IAAAA,cAAc,GAAGF,IAAI,CAACH,GAAG,CAAC;AAC5B,EAAA,CAAC,MAAM,IAAII,GAAG,IAAIJ,GAAG,IAAII,GAAG,IAAIE,QAAQ,CAACF,GAAG,CAACJ,GAAG,CAAC,CAAC,EAAE;AAClDK,IAAAA,cAAc,GAAGD,GAAG,CAACJ,GAAG,CAAC;AAC3B,EAAA;AACA,EAAA,OAAOK,cAAc,IAAIP,MAAM,GAAGA,MAAM,CAACO,cAAc,CAAC,GAAGP,MAAM,CAACE,GAAG,CAAC;AACxE;;AAEA;AACA;AACA;AACA;AACO,SAASO,QAAQA,CAACC,KAAc,EAAsB;EAC3D,IAAIA,KAAK,KAAKN,SAAS,IAAIM,KAAK,KAAK,IAAI,EAAE,OAAON,SAAS;AAC3D,EAAA,MAAMO,IAAI,GAAGC,MAAM,CAACF,KAAK,CAAC;EAC1B,OAAO,YAAY,CAACG,IAAI,CAACF,IAAI,CAAC,GAAGP,SAAS,GAAGO,IAAI;AACnD;;"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ export { default as AreaChart } from './components/area-chart.js';
2
+ export { default as BarChart } from './components/bar-chart.js';
3
+ export { default as ChartContainer } from './components/chart-container.js';
4
+ export { default as ChartLegendContent } from './components/chart-legend-content.js';
5
+ export { default as ChartStyle } from './components/chart-style.js';
6
+ export { default as ChartTooltipContent } from './components/chart-tooltip-content.js';
7
+ export { default as Dot } from './components/dot.js';
8
+ export { default as LineChart } from './components/line-chart.js';
9
+ export { P as PieChart } from './pie-chart-CmDtW_Ge.js';
10
+ export { default as RadarChart } from './components/radar-chart.js';
11
+ export { default as RadialBarChart } from './components/radial-bar-chart.js';
12
+ export { R as Rectangle } from './rectangle-Cl7tbXuZ.js';
13
+ export { S as Sector } from './sector-7shQPJuQ.js';
14
+ export { THEMES } from './types.js';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}