@hattisar/design-tokens 0.3.8 → 0.3.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/package.json +1 -1
  2. package/tokens.css +84 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hattisar/design-tokens",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "Shared design tokens (colors, type, radius, spacing, motion) and base primitives (reset, buttons, inputs, cards, modals, auth shell) for every Hattisar frontend.",
5
5
  "main": "tokens.css",
6
6
  "files": [
package/tokens.css CHANGED
@@ -109,6 +109,25 @@
109
109
  --color-brand-active: color-mix(in srgb, var(--color-brand) 70%, black);
110
110
  --color-brand-text: #ffffff;
111
111
 
112
+ /* The main call to action.
113
+ Asked for by hex: "main CTA color #4285f4". It is the one place in
114
+ this palette with a hue — greys carry structure, colour carries
115
+ status, and now one blue carries "this is the button you press".
116
+ --color-brand stays charcoal ink: it is the focus ring, the active
117
+ tab marker and the checkbox tick, and turning all of those blue is
118
+ a bigger change than a call-to-action colour.
119
+
120
+ White on #4285f4 measures 3.56:1, below the 4.5:1 this file
121
+ promises everywhere else. It is recorded as a deliberate exception
122
+ in check-contrast.mjs rather than quietly left out of it — the
123
+ nearest shade that passes is #1a73e8 at 4.51:1, visually the same
124
+ blue, if the ratio matters more than the exact hex. */
125
+ --color-cta: #4285f4;
126
+ --color-cta-hover: color-mix(in srgb, var(--color-cta) 88%, black);
127
+ --color-cta-active: color-mix(in srgb, var(--color-cta) 76%, black);
128
+ --color-cta-text: #ffffff;
129
+
130
+
112
131
  /* Secondary button — bordered light-gray fill. Reuses
113
132
  --color-surface-tint/--color-border-strong/--color-text-primary
114
133
  rather than their own literal hex, so the secondary button always
@@ -254,11 +273,15 @@
254
273
  --field-min-width: 260px;
255
274
  /* For a control whose value is a word, not a sentence — a variant
256
275
  name, a unit, a percentage — inside a line-item row. */
257
- /* The metadata rail on a master-data form. Narrower than the
258
- document rail (340px), which has to hold a party summary and a
259
- Notes textarea — this holds status, tags and a note, and a
260
- narrower rail keeps the content column the obvious subject. */
261
- --record-rail-width: 300px;
276
+ /* The label column on a vertical form, and how wide a control gets.
277
+ A control that stretches to the page is the thing that made these
278
+ forms read as a wall: an email box does not need 900px, and at
279
+ that width the eye has to travel back across empty space to find
280
+ the next label. Zoho holds both to a fixed, comfortable size and
281
+ lets the page be as wide as it likes. */
282
+ --form-label-width: 160px;
283
+ --form-control-width: 340px;
284
+ --form-control-width-wide: 520px;
262
285
  --field-min-width-narrow: 140px;
263
286
 
264
287
  --space-16: 64px;
@@ -400,6 +423,10 @@
400
423
  --color-brand-hover: color-mix(in srgb, var(--color-brand) 90%, black);
401
424
  --color-brand-active: color-mix(in srgb, var(--color-brand) 75%, black);
402
425
  --color-brand-text: #09090b;
426
+ --color-cta: #4285f4;
427
+ --color-cta-hover: color-mix(in srgb, var(--color-cta) 88%, black);
428
+ --color-cta-active: color-mix(in srgb, var(--color-cta) 76%, black);
429
+ --color-cta-text: #ffffff;
403
430
 
404
431
  --shadow-btn-primary: 0 1px 2px rgba(9, 9, 11, 0.12);
405
432
  --shadow-btn-secondary: 0 1px 2px rgba(9, 9, 11, 0.05);
@@ -504,6 +531,10 @@
504
531
  --color-brand-hover: color-mix(in srgb, var(--color-brand) 85%, black);
505
532
  --color-brand-active: color-mix(in srgb, var(--color-brand) 70%, black);
506
533
  --color-brand-text: #ffffff;
534
+ --color-cta: #4285f4;
535
+ --color-cta-hover: color-mix(in srgb, var(--color-cta) 88%, black);
536
+ --color-cta-active: color-mix(in srgb, var(--color-cta) 76%, black);
537
+ --color-cta-text: #ffffff;
507
538
 
508
539
  --shadow-btn-primary: 0 1px 2px rgba(0, 0, 0, 0.4);
509
540
  --shadow-btn-secondary: 0 1px 2px rgba(0, 0, 0, 0.3);
@@ -706,8 +737,10 @@ label[data-required]::after {
706
737
  font-weight: var(--font-weight-regular);
707
738
  }
708
739
 
709
- /* Primary action — highest-contrast neutral fill (--color-brand),
710
- paired text color (--color-brand-text). */
740
+ /* Primary action — the call-to-action fill. Charcoal until it was
741
+ given a colour of its own; --color-brand still carries structure
742
+ (focus ring, active tab, checkbox tick) and is deliberately not
743
+ this. */
711
744
  button {
712
745
  font: inherit;
713
746
  cursor: pointer;
@@ -716,8 +749,8 @@ button {
716
749
  padding: 5px 10px;
717
750
  font-size: var(--text-base);
718
751
  font-weight: 400;
719
- background: var(--color-brand);
720
- color: var(--color-brand-text);
752
+ background: var(--color-cta);
753
+ color: var(--color-cta-text);
721
754
  box-shadow: var(--shadow-btn-primary);
722
755
  transition:
723
756
  transform 0.05s ease,
@@ -726,11 +759,11 @@ button {
726
759
  }
727
760
 
728
761
  button:hover {
729
- background: var(--color-brand-hover);
762
+ background: var(--color-cta-hover);
730
763
  }
731
764
 
732
765
  button:active {
733
- background: var(--color-brand-active);
766
+ background: var(--color-cta-active);
734
767
  transform: scale(0.97);
735
768
  }
736
769
 
@@ -975,6 +1008,46 @@ input[type="date"]::-webkit-calendar-picker-indicator:hover {
975
1008
  box-shadow spread follows the border-radius exactly, so it reads as
976
1009
  one thickened edge — which fixes the original complaint without
977
1010
  leaving keyboard users hunting for which field they are in. */
1011
+ /* A required field says so on its label, in the red this app already
1012
+ uses for things that are wrong or missing.
1013
+ Asked for: "use our existing red for required field title" — the
1014
+ same convention Zoho uses, where a required label is red and the
1015
+ optional ones are not.
1016
+
1017
+ Written as `:has()` rather than a prop on forty forms: the label
1018
+ already wraps its control, so the markup that says "required" is
1019
+ already there and nothing needs to be repeated. A field that becomes
1020
+ optional stops being red on its own, which a hand-maintained flag
1021
+ would not.
1022
+
1023
+ The control inside is put back to the normal ink — colour is
1024
+ inherited, and a red label would otherwise mean red typing in the
1025
+ box under it. */
1026
+ /*
1027
+ * Descendant, not direct child. A Combobox already renders a hidden
1028
+ * `<input required>` so that native form validation still works the
1029
+ * way the `<select required>` it replaced did — but it is nested
1030
+ * inside the container div, so `> :required` could not see it and only
1031
+ * the handful of plain `<input required>` fields turned red. Every
1032
+ * picker in the app is a Combobox underneath, so this is the
1033
+ * difference between one red label on a form and all of them.
1034
+ */
1035
+ label:has(:required) {
1036
+ color: var(--color-danger);
1037
+ }
1038
+
1039
+ /*
1040
+ * The controls inside go back to the normal ink. Colour inherits, so
1041
+ * without this a red label means red typing in the box under it — and
1042
+ * on a Combobox, red text in the dropdown as well.
1043
+ */
1044
+ label:has(:required) input,
1045
+ label:has(:required) select,
1046
+ label:has(:required) textarea,
1047
+ label:has(:required) .combobox-input {
1048
+ color: var(--color-text-primary);
1049
+ }
1050
+
978
1051
  input:focus-visible,
979
1052
  select:focus-visible,
980
1053
  textarea:focus-visible {