@yuneta/gobj-ui 7.23.101 → 7.23.102

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.
@@ -71055,11 +71055,18 @@ function repaint(gobj) {
71055
71055
  let mode = cur_mode(gobj);
71056
71056
  for (let m of priv.modes) {
71057
71057
  if (!m.$btn) continue;
71058
- m.$btn.classList.toggle("is-active", m === mode);
71059
- m.$btn.classList.toggle("is-link", m === mode && !m.overflow);
71058
+ let on = m === mode;
71059
+ if (m.overflow) {
71060
+ m.$btn.classList.toggle("is-active", on);
71061
+ if (on) m.$btn.setAttribute("aria-current", "true");
71062
+ else m.$btn.removeAttribute("aria-current");
71063
+ } else {
71064
+ m.$btn.classList.toggle("pressed_state", on);
71065
+ m.$btn.setAttribute("aria-pressed", on ? "true" : "false");
71066
+ }
71060
71067
  }
71061
71068
  if (mode && mode.$btn) scroll_mode_into_view(gobj, mode.$btn);
71062
- if (priv.$more) priv.$more.classList.toggle("is-link", !!(mode && mode.overflow));
71069
+ if (priv.$more) priv.$more.classList.toggle("pressed_state", !!(mode && mode.overflow));
71063
71070
  let is_bucket = !!(mode && mode.kind === "bucket");
71064
71071
  priv.$nav.classList.toggle("yui-period-nav-off", !is_bucket);
71065
71072
  priv.$label.disabled = !is_bucket;
@@ -71250,9 +71257,10 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria) {
71250
71257
  let $btn = (0, _yuneta_gobj_js.createElement2)([
71251
71258
  "button",
71252
71259
  {
71253
- class: `button is-small ${selected ? "is-link" : "is-ghost"} ${logical}`,
71260
+ class: `button is-small ${selected ? "pressed_state" : "is-ghost"} ${logical}`,
71254
71261
  type: "button",
71255
71262
  style: "width:100%;",
71263
+ ...selected ? { "aria-current": "date" } : {},
71256
71264
  title: aria || "",
71257
71265
  "aria-label": aria || ""
71258
71266
  },
@@ -71050,11 +71050,18 @@ function repaint(gobj) {
71050
71050
  let mode = cur_mode(gobj);
71051
71051
  for (let m of priv.modes) {
71052
71052
  if (!m.$btn) continue;
71053
- m.$btn.classList.toggle("is-active", m === mode);
71054
- m.$btn.classList.toggle("is-link", m === mode && !m.overflow);
71053
+ let on = m === mode;
71054
+ if (m.overflow) {
71055
+ m.$btn.classList.toggle("is-active", on);
71056
+ if (on) m.$btn.setAttribute("aria-current", "true");
71057
+ else m.$btn.removeAttribute("aria-current");
71058
+ } else {
71059
+ m.$btn.classList.toggle("pressed_state", on);
71060
+ m.$btn.setAttribute("aria-pressed", on ? "true" : "false");
71061
+ }
71055
71062
  }
71056
71063
  if (mode && mode.$btn) scroll_mode_into_view(gobj, mode.$btn);
71057
- if (priv.$more) priv.$more.classList.toggle("is-link", !!(mode && mode.overflow));
71064
+ if (priv.$more) priv.$more.classList.toggle("pressed_state", !!(mode && mode.overflow));
71058
71065
  let is_bucket = !!(mode && mode.kind === "bucket");
71059
71066
  priv.$nav.classList.toggle("yui-period-nav-off", !is_bucket);
71060
71067
  priv.$label.disabled = !is_bucket;
@@ -71245,9 +71252,10 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria) {
71245
71252
  let $btn = createElement2([
71246
71253
  "button",
71247
71254
  {
71248
- class: `button is-small ${selected ? "is-link" : "is-ghost"} ${logical}`,
71255
+ class: `button is-small ${selected ? "pressed_state" : "is-ghost"} ${logical}`,
71249
71256
  type: "button",
71250
71257
  style: "width:100%;",
71258
+ ...selected ? { "aria-current": "date" } : {},
71251
71259
  title: aria || "",
71252
71260
  "aria-label": aria || ""
71253
71261
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.101",
3
+ "version": "7.23.102",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -96,6 +96,9 @@ import {
96
96
 
97
97
  import i18next, {t} from "i18next";
98
98
 
99
+ /* `yui_toolbar.css` for `pressed_state`: the mark of a toggle that
100
+ * is ON lives with the toolbar, and a stylesheet rides its import. */
101
+ import "./yui_toolbar.css";
99
102
  import "./c_yui_period.css";
100
103
 
101
104
 
@@ -699,12 +702,31 @@ function repaint(gobj)
699
702
  let priv = gobj.priv;
700
703
  let mode = cur_mode(gobj);
701
704
 
705
+ /* The granularity in use looks PRESSED, like every other toggle of
706
+ * the library (`pressed_state`, `yui_toolbar.css`). It used to be
707
+ * `is-active` plus an `is-link` fill: a STATE painted with a colour,
708
+ * and colours here name kinds of ACTION. An overflow granularity is
709
+ * a `dropdown-item` and not a button, and there `is-active` is
710
+ * Bulma's own mark for the current item of a menu -- which is
711
+ * exactly what it is. */
702
712
  for(let m of priv.modes) {
703
713
  if(!m.$btn) {
704
714
  continue;
705
715
  }
706
- m.$btn.classList.toggle("is-active", m === mode);
707
- m.$btn.classList.toggle("is-link", m === mode && !m.overflow);
716
+ let on = (m === mode);
717
+ if(m.overflow) {
718
+ m.$btn.classList.toggle("is-active", on);
719
+ /* `aria-current` and not `aria-pressed`: the item is a link
720
+ * in a menu, and `aria-pressed` belongs to a button. */
721
+ if(on) {
722
+ m.$btn.setAttribute("aria-current", "true");
723
+ } else {
724
+ m.$btn.removeAttribute("aria-current");
725
+ }
726
+ } else {
727
+ m.$btn.classList.toggle("pressed_state", on);
728
+ m.$btn.setAttribute("aria-pressed", on? "true" : "false");
729
+ }
708
730
  }
709
731
  if(mode && mode.$btn) {
710
732
  scroll_mode_into_view(gobj, mode.$btn);
@@ -713,7 +735,7 @@ function repaint(gobj)
713
735
  /* An overflow granularity in use must SAY so on the trigger: the
714
736
  * control shows no active segment otherwise, and the user cannot
715
737
  * tell a quarter from a month by the arrows alone. */
716
- priv.$more.classList.toggle("is-link", !!(mode && mode.overflow));
738
+ priv.$more.classList.toggle("pressed_state", !!(mode && mode.overflow));
717
739
  }
718
740
 
719
741
  /* The navigator STAYS, disabled, in the modes with nothing to walk: it
@@ -991,8 +1013,12 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria)
991
1013
  * year around it. */
992
1014
  let $btn = createElement2(
993
1015
  /* The ONE place `is-small` is earned: 42 cells in a popover. */
994
- ["button", {class: `button is-small ${selected? "is-link" : "is-ghost"} ${logical}`,
1016
+ /* The picked instant is PRESSED, like every other mark of the
1017
+ * library -- it used to be an `is-link` fill, a colour on a
1018
+ * state. `aria-current="date"` is the same fact for a reader. */
1019
+ ["button", {class: `button is-small ${selected? "pressed_state" : "is-ghost"} ${logical}`,
995
1020
  type: "button", style: "width:100%;",
1021
+ ...(selected? {"aria-current": "date"} : {}),
996
1022
  title: aria || "", "aria-label": aria || ""}, String(label)]);
997
1023
  $btn.addEventListener("click", () => {
998
1024
  gobj_send_event(gobj, "EV_DATE_PICKED", {anchor: anchor_ms}, gobj);