@unisim/sdk 0.215.0 → 0.216.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.
@@ -0,0 +1,14 @@
1
+ /** The id of the `<style>` element {@link installTabStyles} adds. */
2
+ export declare const TAB_STYLE_ID = "unisim-tab-css";
3
+ /**
4
+ * The complete tab stylesheet. A page with no build step pastes this into its
5
+ * CSS; everything else lets `<Tabs>` or `installTabStyles()` inject it.
6
+ */
7
+ export declare const TAB_CSS: string;
8
+ /**
9
+ * Adds {@link TAB_CSS} to the document once. Safe to call any number of times,
10
+ * and a no-op outside a browser. `<Tabs>` calls it itself; call it directly
11
+ * when a page uses the `u-tabs` classes on its own markup.
12
+ */
13
+ export declare function installTabStyles(doc?: Document | undefined): void;
14
+ //# sourceMappingURL=tabStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabStyles.d.ts","sourceRoot":"","sources":["../src/tabStyles.ts"],"names":[],"mappings":"AAgEA,qEAAqE;AACrE,eAAO,MAAM,YAAY,mBAAmB,CAAA;AAE5C;;;GAGG;AACH,eAAO,MAAM,OAAO,QAmHnB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,QAAQ,GAAG,SAAkE,GAAG,IAAI,CAMzH"}
@@ -0,0 +1,194 @@
1
+ // @unisim/sdk — the suite's tab bar, as CSS.
2
+ //
3
+ // Owner decision 2026-11-04, from the tab and button studies
4
+ // (https://claude.ai/artifact/YBeVjfweANs1Khogwr5X9h; BRANDING.md → Tabs):
5
+ // option D, the tray with an orbit corner. The familiar segmented tray, but the
6
+ // selected segment carries the Orbit box's corner arc, which grows out of its
7
+ // top-left corner. Hover draws the arc in partway (as the Orbit chip's arc
8
+ // does), selecting draws it the rest of the way, and moving off plays it back.
9
+ //
10
+ // The tray (`.u-tabs`) a tablist, or a <nav> of links / buttons.
11
+ // A segment (`.u-tab`) a tab, a link or a button.
12
+ // Selected any of `aria-selected="true"`, `aria-current` (not "false"),
13
+ // `aria-pressed="true"` or `.u-tab--current`, so a tablist, a
14
+ // nav and a toggle group all work unchanged.
15
+ // Opens here `data-default-view="true"`, which `useDefaultView()`'s
16
+ // buttonProps already hands out, adds a small orange dot after
17
+ // the label. It replaced the orange ring, which read as focus.
18
+ //
19
+ // This file has no React import on purpose: `Tabs.tsx` is the component, and a
20
+ // page with no build step, or an app with its own tab logic (drag to reorder,
21
+ // say), uses these classes on its own markup after `installTabStyles()`.
22
+ //
23
+ // ── Cascade, grounds ───────────────────────────────────────────────────────
24
+ // As the buttons and boxes: the tray's and segment's own look is layered
25
+ // (`components.unisim-tabs`, zero specificity), so an app's utilities win; the
26
+ // arc, the dot and the focus ring stay unlayered. Grounds as the chips.
27
+ //
28
+ // ── Knobs ──────────────────────────────────────────────────────────────────
29
+ // --u-tab-accent / --u-tab-accent-dark the arc and the dot
30
+ // --u-tab-accent-text / --u-tab-accent-text-dark the selected label
31
+ // A tenant colour goes in as `brand_color_accessible`, never `brand_color`.
32
+ //
33
+ // ── Contrast ───────────────────────────────────────────────────────────────
34
+ // Selected labels are Orange 700 on white (5.18:1) and #FF9A1F on the dark
35
+ // segment; unselected labels are slate on the tray. `tests/controls.browser.mjs`
36
+ // measures every one on both grounds.
37
+ const LIGHT = {
38
+ tray: '#e9edf4',
39
+ seg: '#ffffff',
40
+ ink: '#0f172a',
41
+ soft: '#475569',
42
+ accent: 'var(--u-tab-accent, #e05504)',
43
+ 'accent-text': 'var(--u-tab-accent-text, #c2410c)',
44
+ shadow: '0 1px 2px rgba(15, 23, 42, 0.10), 0 1px 1px rgba(15, 23, 42, 0.04)',
45
+ focus: '#e05504',
46
+ };
47
+ const DARK = {
48
+ tray: 'rgba(255, 255, 255, 0.06)',
49
+ seg: '#1e293b',
50
+ ink: '#e6eaf2',
51
+ soft: '#9fb0c6',
52
+ accent: 'var(--u-tab-accent-dark, #ff9a1f)',
53
+ 'accent-text': 'var(--u-tab-accent-text-dark, #ff9a1f)',
54
+ shadow: '0 1px 2px rgba(0, 0, 0, 0.5)',
55
+ focus: '#ff9a1f',
56
+ };
57
+ const decl = (tokens) => Object.entries(tokens).map(([k, v]) => `--_t-${k}: ${v};`).join(' ');
58
+ const SELECTED = ':is([aria-selected="true"], [aria-current]:not([aria-current="false"]), [aria-pressed="true"], .u-tab--current)';
59
+ /** The id of the `<style>` element {@link installTabStyles} adds. */
60
+ export const TAB_STYLE_ID = 'unisim-tab-css';
61
+ /**
62
+ * The complete tab stylesheet. A page with no build step pastes this into its
63
+ * CSS; everything else lets `<Tabs>` or `installTabStyles()` inject it.
64
+ */
65
+ export const TAB_CSS = `
66
+ @property --u-tab-rx { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
67
+ @property --u-tab-ry { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
68
+ .u-tabs, .u-tab { ${decl(LIGHT)} }
69
+ [data-u-ground="dark"] .u-tabs, .dark .u-tabs, [data-theme="dark"] .u-tabs,
70
+ [data-u-ground="dark"] .u-tab, .dark .u-tab, [data-theme="dark"] .u-tab { ${decl(DARK)} }
71
+ .u-tabs[data-u-ground="light"], .u-tabs[data-u-ground="light"] .u-tab { ${decl(LIGHT)} }
72
+ .u-tabs[data-u-ground="dark"], .u-tabs[data-u-ground="dark"] .u-tab { ${decl(DARK)} }
73
+
74
+ /* The tray's and segments' own look, layered and at zero specificity. */
75
+ @layer theme, base, components, utilities;
76
+ @layer components.unisim-tabs {
77
+ :where(.u-tabs) {
78
+ box-sizing: border-box;
79
+ display: flex;
80
+ gap: 4px;
81
+ width: max-content;
82
+ max-width: 100%;
83
+ padding: 4px;
84
+ border-radius: 14px;
85
+ background: var(--_t-tray);
86
+ overflow-x: auto;
87
+ scrollbar-width: none;
88
+ }
89
+ :where(.u-tab) {
90
+ position: relative;
91
+ box-sizing: border-box;
92
+ flex: none;
93
+ display: inline-flex;
94
+ align-items: center;
95
+ gap: 7px;
96
+ padding: 10px 16px;
97
+ border: 0;
98
+ border-radius: 10px;
99
+ background: transparent;
100
+ color: var(--_t-soft);
101
+ font: inherit;
102
+ font-size: 14px;
103
+ font-weight: 600;
104
+ line-height: 1;
105
+ white-space: nowrap;
106
+ text-decoration: none;
107
+ cursor: pointer;
108
+ -webkit-user-select: none;
109
+ user-select: none;
110
+ -webkit-touch-callout: none;
111
+ -webkit-tap-highlight-color: transparent;
112
+ transition: color 0.15s, background-color 0.15s, box-shadow 0.15s;
113
+ }
114
+ :where(.u-tab${SELECTED}) {
115
+ background: var(--_t-seg);
116
+ color: var(--_t-accent-text);
117
+ font-weight: 700;
118
+ box-shadow: var(--_t-shadow);
119
+ }
120
+ @media (hover: hover) {
121
+ :where(.u-tab:not(${SELECTED}):hover) {
122
+ background: color-mix(in srgb, var(--_t-seg) 45%, transparent);
123
+ color: var(--_t-ink);
124
+ }
125
+ }
126
+ }
127
+ .u-tabs::-webkit-scrollbar { display: none; }
128
+
129
+ /* ── The orbit corner ──
130
+ Two strokes (top and leading edge) masked so they fade out from the corner:
131
+ --u-tab-rx is how far along the top, --u-tab-ry how far down. Both are
132
+ registered, so they animate; leaving a hovered tab plays the arc back. */
133
+ .u-tab::before {
134
+ content: "";
135
+ position: absolute;
136
+ inset: 0;
137
+ box-sizing: border-box;
138
+ border-radius: inherit;
139
+ border-top: 2px solid var(--_t-accent);
140
+ border-left: 2px solid var(--_t-accent);
141
+ opacity: 0;
142
+ --u-tab-rx: 0%;
143
+ --u-tab-ry: 0%;
144
+ -webkit-mask:
145
+ linear-gradient(to right, #000 calc(var(--u-tab-rx) * 0.2), transparent var(--u-tab-rx)),
146
+ linear-gradient(to bottom, #000 calc(var(--u-tab-ry) * 0.25), transparent var(--u-tab-ry));
147
+ -webkit-mask-composite: source-in;
148
+ mask:
149
+ linear-gradient(to right, #000 calc(var(--u-tab-rx) * 0.2), transparent var(--u-tab-rx)),
150
+ linear-gradient(to bottom, #000 calc(var(--u-tab-ry) * 0.25), transparent var(--u-tab-ry));
151
+ mask-composite: intersect;
152
+ pointer-events: none;
153
+ transition: --u-tab-rx 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), --u-tab-ry 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s;
154
+ }
155
+ .u-tab${SELECTED}::before { opacity: 1; --u-tab-rx: 62%; --u-tab-ry: 88%; }
156
+ /* ⚠️ Pointers that really hover only: a touchscreen keeps :hover on the last
157
+ thing tapped, which would leave a half-drawn arc behind (the chips' lesson). */
158
+ @media (hover: hover) {
159
+ .u-tab:not(${SELECTED}):hover::before { opacity: 1; --u-tab-rx: 34%; --u-tab-ry: 55%; }
160
+ }
161
+
162
+ /* Opens here: the default view's dot. */
163
+ .u-tab[data-default-view="true"]::after {
164
+ content: "";
165
+ flex: none;
166
+ width: 6px;
167
+ height: 6px;
168
+ border-radius: 50%;
169
+ background: var(--_t-accent);
170
+ }
171
+
172
+ /* Inside the tray's scrollport, so the ring sits on the segment's edge. */
173
+ .u-tab:focus-visible { outline: 2px solid var(--_t-focus); outline-offset: 0; }
174
+
175
+ .u-tab[hidden], .u-tabs[hidden] { display: none; }
176
+
177
+ @media (prefers-reduced-motion: reduce) {
178
+ .u-tab, .u-tab::before { transition: none; }
179
+ }
180
+ `;
181
+ /**
182
+ * Adds {@link TAB_CSS} to the document once. Safe to call any number of times,
183
+ * and a no-op outside a browser. `<Tabs>` calls it itself; call it directly
184
+ * when a page uses the `u-tabs` classes on its own markup.
185
+ */
186
+ export function installTabStyles(doc = typeof document === 'undefined' ? undefined : document) {
187
+ if (!doc || doc.getElementById(TAB_STYLE_ID))
188
+ return;
189
+ const el = doc.createElement('style');
190
+ el.id = TAB_STYLE_ID;
191
+ el.textContent = TAB_CSS;
192
+ doc.head.appendChild(el);
193
+ }
194
+ //# sourceMappingURL=tabStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabStyles.js","sourceRoot":"","sources":["../src/tabStyles.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,6DAA6D;AAC7D,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AqE;AACrE,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAA;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;;;oBAGH,IAAI,CAAC,KAAK,CAAC;;4EAE6C,IAAI,CAAC,IAAI,CAAC;0EACZ,IAAI,CAAC,KAAK,CAAC;wEACb,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA0CnE,QAAQ;;;;;;;sBAOD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkCtB,QAAQ;;;;eAID,QAAQ;;;;;;;;;;;;;;;;;;;;;CAqBtB,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA4B,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;IACjH,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC;QAAE,OAAM;IACpD,MAAM,EAAE,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IACrC,EAAE,CAAC,EAAE,GAAG,YAAY,CAAA;IACpB,EAAE,CAAC,WAAW,GAAG,OAAO,CAAA;IACxB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;AAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisim/sdk",
3
- "version": "0.215.0",
3
+ "version": "0.216.0",
4
4
  "description": "Shared React SDK for the Universal Suite — auth, entitlements, usage telemetry, changelog, org admin.",
5
5
  "license": "MIT",
6
6
  "author": "Universal Simulation Ltd",
@@ -103,7 +103,9 @@
103
103
  "test:contrast": "npm run build && node tests/contrast.mjs",
104
104
  "test:chips": "npm run build && node tests/chips.browser.mjs",
105
105
  "test:boxes": "npm run build && node tests/boxes.browser.mjs",
106
+ "test:controls": "npm run build && node tests/controls.browser.mjs",
106
107
  "test:i18n": "npm run build && node tests/i18n.mjs",
108
+ "test:development-ribbon": "npm run build && node tests/development-ribbon.browser.mjs",
107
109
  "test:privacy-note": "npm run build && node tests/privacy-note-i18n.browser.mjs",
108
110
  "test:oauth": "npm run build && node tests/oauth-providers.mjs",
109
111
  "test:native-oauth": "npm run build && node tests/native-oauth.mjs",