@funnest/charts-ui 0.7.0 → 0.7.2

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.
@@ -1,8 +1,9 @@
1
1
  import type { WidgetContext } from '../context.js';
2
2
  /**
3
3
  * Favorite intervals as toolbar chips + a grouped menu (분 | 시간 | 일) where hovering a row
4
- * reveals a ★ to pin/unpin it. On narrow screens only the menu trigger (showing the current
5
- * interval) remains.
4
+ * reveals a ★ to pin/unpin it. The current interval is among the chips even when it isn't a
5
+ * favorite, in time order (15분 | 일 picking 1분 reads 1분 | 15분 | 일, not 15분 | 일 | 1분). On
6
+ * narrow screens only the menu trigger (showing the current interval) remains.
6
7
  */
7
8
  export declare function IntervalPicker({ ctx }: {
8
9
  ctx: WidgetContext;
package/dist/index.js CHANGED
@@ -1861,6 +1861,9 @@ function Dialogs({ ctx }) {
1861
1861
  return null;
1862
1862
  }
1863
1863
 
1864
+ // src/components/interval-picker.tsx
1865
+ import { resolutionToMs } from "@funnest/charts";
1866
+
1864
1867
  // src/components/keep-in-view.ts
1865
1868
  var MARGIN = 8;
1866
1869
  function useKeepInView(open) {
@@ -1919,16 +1922,18 @@ function IntervalPicker({ ctx }) {
1919
1922
  const supported = s3.symbol?.supportedResolutions;
1920
1923
  const isSupported = (r3) => !supported || supported.includes(r3);
1921
1924
  const order = ctx.intervalGroups.flatMap((g3) => g3.intervals);
1922
- const favorites = [...s3.favoriteIntervals].sort((a4, b) => order.indexOf(a4) - order.indexOf(b));
1925
+ const favorites = s3.favoriteIntervals;
1926
+ const byTime = (a4, b) => order.includes(a4) && order.includes(b) ? order.indexOf(a4) - order.indexOf(b) : resolutionToMs(a4) - resolutionToMs(b);
1927
+ const chips = [.../* @__PURE__ */ new Set([...favorites, ...s3.resolution ? [s3.resolution] : []])].sort(byTime);
1923
1928
  const select = (r3) => {
1924
1929
  setOpen(false);
1925
1930
  ctx.selectResolution(r3);
1926
1931
  };
1927
1932
  return /* @__PURE__ */ a3("div", { class: "fnc-interval-picker", ref, children: [
1928
- /* @__PURE__ */ a3("div", { class: "fnc-intervals", children: favorites.map((r3) => /* @__PURE__ */ a3(
1933
+ /* @__PURE__ */ a3("div", { class: "fnc-intervals", children: chips.map((r3) => /* @__PURE__ */ a3(
1929
1934
  "button",
1930
1935
  {
1931
- class: "fnc-chip",
1936
+ class: favorites.includes(r3) ? "fnc-chip" : "fnc-chip fnc-chip-extra",
1932
1937
  "aria-pressed": r3 === s3.resolution,
1933
1938
  disabled: !isSupported(r3),
1934
1939
  "data-tip": isSupported(r3) ? resolutionLabel(r3, s3.locale, "long") : t3.unsupportedInterval,
@@ -1939,7 +1944,7 @@ function IntervalPicker({ ctx }) {
1939
1944
  /* @__PURE__ */ a3(
1940
1945
  "button",
1941
1946
  {
1942
- class: `fnc-btn fnc-btn-wide fnc-interval-trigger${favorites.includes(s3.resolution) ? "" : " fnc-interval-trigger-active"}`,
1947
+ class: "fnc-btn fnc-btn-wide fnc-interval-trigger",
1943
1948
  "data-tip": t3.moreIntervals,
1944
1949
  "aria-label": t3.moreIntervals,
1945
1950
  "aria-haspopup": "menu",
@@ -3564,8 +3569,6 @@ var CSS = (
3564
3569
  .fnc-interval-picker { position: relative; display: flex; align-items: center; min-width: 0; }
3565
3570
  .fnc-interval-trigger { gap: 2px; padding: 0 6px; }
3566
3571
  .fnc-interval-current { display: none; font-size: 13px; color: var(--fnc-text); }
3567
- .fnc-interval-trigger-active { background: var(--fnc-surface); }
3568
- .fnc-interval-trigger-active .fnc-interval-current { display: inline; }
3569
3572
  .fnc-chip:disabled { opacity: 0.35; cursor: default; background: none; }
3570
3573
  .fnc-interval-menu {
3571
3574
  width: 208px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
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.7.0"
45
+ "@funnest/charts": "0.7.2"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"