@funnest/charts-ui 0.11.8 → 0.11.10

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 (2) hide show
  1. package/dist/index.js +47 -32
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1579,9 +1579,15 @@ function ToolGroup({
1579
1579
  /* @__PURE__ */ a3("span", { class: "fnc-tool-corner", children: /* @__PURE__ */ a3(CornerIcon, {}) }),
1580
1580
  /* @__PURE__ */ a3("span", { class: "fnc-tool-chevron", children: /* @__PURE__ */ a3(ChevronRightIcon, {}) })
1581
1581
  ] }),
1582
- open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tool-menu", role: "menu", ref: menu, children: tools.map((def, i3) => {
1582
+ open && /* @__PURE__ */ a3("div", { class: `fnc-menu fnc-tool-menu${tools.every((d3) => d3.tile) ? " is-tiles" : ""}`, role: "menu", ref: menu, children: tools.map((def, i3) => {
1583
1583
  const section = def.section?.[s3.locale];
1584
1584
  const heading = section && section !== tools[i3 - 1]?.section?.[s3.locale];
1585
+ if (def.tile) {
1586
+ if (tools[i3 - 1]?.tile && !heading) return null;
1587
+ const run = [];
1588
+ for (let j2 = i3; j2 < tools.length && tools[j2].tile && (j2 === i3 || tools[j2].section?.[s3.locale] === section); j2++) run.push(tools[j2]);
1589
+ return /* @__PURE__ */ a3($, { children: /* @__PURE__ */ a3("div", { class: `fnc-tool-tiles${i3 > 0 ? " is-after" : ""}`, role: "group", "aria-label": section ?? name, children: run.map((d3) => /* @__PURE__ */ a3("button", { class: "fnc-tool-tile", role: "menuitemradio", "aria-checked": d3.type === current.type, "aria-label": d3.name[s3.locale], onClick: () => pick(d3), children: /* @__PURE__ */ a3(ToolIcon, { def: d3, locale: s3.locale }) })) }) }, def.type);
1590
+ }
1585
1591
  return /* @__PURE__ */ a3($, { children: [
1586
1592
  heading && /* @__PURE__ */ a3("div", { class: `fnc-tool-section${i3 > 0 ? " is-after" : ""}`, role: "presentation", children: section }),
1587
1593
  /* @__PURE__ */ a3("div", { class: "fnc-tool-row", children: [
@@ -1977,8 +1983,8 @@ function SelectionBar({ ctx }) {
1977
1983
  children: /* @__PURE__ */ a3(GripIcon, {})
1978
1984
  }
1979
1985
  ),
1980
- !def?.levels && [...SWATCHES, ...recent.filter((c3) => !SWATCHES.includes(c3))].map((color) => /* @__PURE__ */ a3("button", { class: "fnc-swatch", style: { background: color }, "data-tip": t3.color, "aria-label": `${t3.color} ${color}`, "aria-pressed": current === color, onClick: () => pickColor(color) })),
1981
- !def?.levels && /* @__PURE__ */ a3("label", { class: "fnc-swatch fnc-swatch-add", "data-tip": t3.customColor, "aria-label": t3.customColor, children: [
1986
+ !def?.levels && !def?.plain && [...SWATCHES, ...recent.filter((c3) => !SWATCHES.includes(c3))].map((color) => /* @__PURE__ */ a3("button", { class: "fnc-swatch", style: { background: color }, "data-tip": t3.color, "aria-label": `${t3.color} ${color}`, "aria-pressed": current === color, onClick: () => pickColor(color) })),
1987
+ !def?.levels && !def?.plain && /* @__PURE__ */ a3("label", { class: "fnc-swatch fnc-swatch-add", "data-tip": t3.customColor, "aria-label": t3.customColor, children: [
1982
1988
  /* @__PURE__ */ a3("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M5 1.5v7M1.5 5h7", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) }),
1983
1989
  /* @__PURE__ */ a3(
1984
1990
  "input",
@@ -2147,39 +2153,41 @@ function SelectionBar({ ctx }) {
2147
2153
  /* @__PURE__ */ a3("button", { class: "fnc-menu-item", role: "menuitem", onClick: resetLevels, children: t3.resetLevels })
2148
2154
  ] })
2149
2155
  ] }),
2150
- /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
2151
- /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
2152
- /* @__PURE__ */ a3("button", { class: "fnc-btn fnc-selbar-width", "data-tip": t3.lineWidth, "aria-label": t3.lineWidth, "aria-expanded": menu === "width", onClick: () => setMenu(menu === "width" ? null : "width"), children: /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M3 10h14", stroke: "currentColor", "stroke-width": style.width ?? 2, "stroke-linecap": "round" }) }) }),
2153
- menu === "width" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop", role: "menu", children: WIDTHS.map((w3) => /* @__PURE__ */ a3(
2156
+ !def?.plain && /* @__PURE__ */ a3($, { children: [
2157
+ /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
2158
+ /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
2159
+ /* @__PURE__ */ a3("button", { class: "fnc-btn fnc-selbar-width", "data-tip": t3.lineWidth, "aria-label": t3.lineWidth, "aria-expanded": menu === "width", onClick: () => setMenu(menu === "width" ? null : "width"), children: /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M3 10h14", stroke: "currentColor", "stroke-width": style.width ?? 2, "stroke-linecap": "round" }) }) }),
2160
+ menu === "width" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop", role: "menu", children: WIDTHS.map((w3) => /* @__PURE__ */ a3(
2161
+ "button",
2162
+ {
2163
+ class: "fnc-menu-item",
2164
+ role: "menuitemradio",
2165
+ "aria-checked": (style.width ?? 2) === w3,
2166
+ onClick: () => {
2167
+ setStyle({ width: w3 });
2168
+ setMenu(null);
2169
+ },
2170
+ children: [
2171
+ /* @__PURE__ */ a3("svg", { width: "40", height: "12", viewBox: "0 0 40 12", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M2 6h36", stroke: "currentColor", "stroke-width": w3, "stroke-linecap": "round" }) }),
2172
+ /* @__PURE__ */ a3("span", { children: [
2173
+ w3,
2174
+ "px"
2175
+ ] })
2176
+ ]
2177
+ }
2178
+ )) })
2179
+ ] }),
2180
+ /* @__PURE__ */ a3(
2154
2181
  "button",
2155
2182
  {
2156
- class: "fnc-menu-item",
2157
- role: "menuitemradio",
2158
- "aria-checked": (style.width ?? 2) === w3,
2159
- onClick: () => {
2160
- setStyle({ width: w3 });
2161
- setMenu(null);
2162
- },
2163
- children: [
2164
- /* @__PURE__ */ a3("svg", { width: "40", height: "12", viewBox: "0 0 40 12", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M2 6h36", stroke: "currentColor", "stroke-width": w3, "stroke-linecap": "round" }) }),
2165
- /* @__PURE__ */ a3("span", { children: [
2166
- w3,
2167
- "px"
2168
- ] })
2169
- ]
2183
+ class: "fnc-btn",
2184
+ "data-tip": `${t3.lineStyle}: ${dash === "solid" ? t3.lineSolid : dash === "dashed" ? t3.lineDashed : t3.lineDotted}`,
2185
+ "aria-label": t3.lineStyle,
2186
+ onClick: () => setStyle({ dash: DASH_ORDER[(DASH_ORDER.indexOf(dash) + 1) % DASH_ORDER.length] }),
2187
+ children: /* @__PURE__ */ a3(DashGlyph, { dash })
2170
2188
  }
2171
- )) })
2189
+ )
2172
2190
  ] }),
2173
- /* @__PURE__ */ a3(
2174
- "button",
2175
- {
2176
- class: "fnc-btn",
2177
- "data-tip": `${t3.lineStyle}: ${dash === "solid" ? t3.lineSolid : dash === "dashed" ? t3.lineDashed : t3.lineDotted}`,
2178
- "aria-label": t3.lineStyle,
2179
- onClick: () => setStyle({ dash: DASH_ORDER[(DASH_ORDER.indexOf(dash) + 1) % DASH_ORDER.length] }),
2180
- children: /* @__PURE__ */ a3(DashGlyph, { dash })
2181
- }
2182
- ),
2183
2191
  def?.text && /* @__PURE__ */ a3(
2184
2192
  "input",
2185
2193
  {
@@ -6303,6 +6311,13 @@ var CSS = (
6303
6311
  .fnc-tool-section { padding: 8px 10px 4px; color: var(--fnc-text-2); font-size: 11px; font-weight: 600; }
6304
6312
  .fnc-tool-section.is-after { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--fnc-border); }
6305
6313
  .fnc-tool-menu .fnc-menu-item { white-space: nowrap; }
6314
+ .fnc-tool-menu.is-tiles { min-width: 0; }
6315
+ .fnc-tool-tiles { display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; padding: 6px; }
6316
+ .fnc-tool-tiles.is-after { border-top: 1px solid var(--fnc-border); }
6317
+ .fnc-tool-tile { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; cursor: pointer; }
6318
+ .fnc-tool-tile:hover { background: var(--fnc-surface); }
6319
+ .fnc-tool-tile[aria-checked='true'] { background: var(--fnc-surface); box-shadow: inset 0 0 0 1.5px var(--fnc-accent); }
6320
+ .fnc-tool-tile svg { width: 24px; height: 24px; }
6306
6321
  .fnc-tool-row { position: relative; display: flex; align-items: center; }
6307
6322
  .fnc-tool-row .fnc-menu-item { flex: 1; padding-right: 36px; }
6308
6323
  .fnc-tool-fav { position: absolute; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--fnc-text-2); opacity: 0; cursor: pointer; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.8",
3
+ "version": "0.11.10",
4
4
  "description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
5
5
  "keywords": [
6
6
  "chart",
@@ -42,7 +42,7 @@
42
42
  "NOTICE"
43
43
  ],
44
44
  "dependencies": {
45
- "@funnest/charts": "0.11.8"
45
+ "@funnest/charts": "0.11.10"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"