@setsquare/ui 0.1.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.
- package/CHANGELOG.md +70 -0
- package/LICENSE +202 -0
- package/NOTICE +49 -0
- package/README.md +313 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +59 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/tokens.d.ts +5 -0
- package/dist/lib/tokens.d.ts.map +1 -0
- package/dist/lib/tokens.js +22 -0
- package/dist/lib/tokens.js.map +1 -0
- package/dist/lib/use-element-width.d.ts +4 -0
- package/dist/lib/use-element-width.d.ts.map +1 -0
- package/dist/lib/use-element-width.js +17 -0
- package/dist/lib/use-element-width.js.map +1 -0
- package/dist/lint/index.d.ts +41 -0
- package/dist/lint/index.d.ts.map +1 -0
- package/dist/lint/index.js +648 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/shell/app-header.d.ts +13 -0
- package/dist/shell/app-header.d.ts.map +1 -0
- package/dist/shell/app-header.js +11 -0
- package/dist/shell/app-header.js.map +1 -0
- package/dist/shell/dashboard-shell.d.ts +67 -0
- package/dist/shell/dashboard-shell.d.ts.map +1 -0
- package/dist/shell/dashboard-shell.js +168 -0
- package/dist/shell/dashboard-shell.js.map +1 -0
- package/dist/shell/page-header.d.ts +19 -0
- package/dist/shell/page-header.d.ts.map +1 -0
- package/dist/shell/page-header.js +11 -0
- package/dist/shell/page-header.js.map +1 -0
- package/dist/shell/right-panel.d.ts +25 -0
- package/dist/shell/right-panel.d.ts.map +1 -0
- package/dist/shell/right-panel.js +37 -0
- package/dist/shell/right-panel.js.map +1 -0
- package/dist/shell/sidebar.d.ts +68 -0
- package/dist/shell/sidebar.d.ts.map +1 -0
- package/dist/shell/sidebar.js +68 -0
- package/dist/shell/sidebar.js.map +1 -0
- package/dist/shell/site-footer.d.ts +28 -0
- package/dist/shell/site-footer.d.ts.map +1 -0
- package/dist/shell/site-footer.js +15 -0
- package/dist/shell/site-footer.js.map +1 -0
- package/dist/shell/site-header-padding.d.ts +7 -0
- package/dist/shell/site-header-padding.d.ts.map +1 -0
- package/dist/shell/site-header-padding.js +27 -0
- package/dist/shell/site-header-padding.js.map +1 -0
- package/dist/shell/site-header.d.ts +23 -0
- package/dist/shell/site-header.d.ts.map +1 -0
- package/dist/shell/site-header.js +13 -0
- package/dist/shell/site-header.js.map +1 -0
- package/dist/shell/site-menu.d.ts +27 -0
- package/dist/shell/site-menu.d.ts.map +1 -0
- package/dist/shell/site-menu.js +56 -0
- package/dist/shell/site-menu.js.map +1 -0
- package/dist/shell/site-nav-link.d.ts +24 -0
- package/dist/shell/site-nav-link.d.ts.map +1 -0
- package/dist/shell/site-nav-link.js +35 -0
- package/dist/shell/site-nav-link.js.map +1 -0
- package/dist/shell/site-nav.d.ts +12 -0
- package/dist/shell/site-nav.d.ts.map +1 -0
- package/dist/shell/site-nav.js +9 -0
- package/dist/shell/site-nav.js.map +1 -0
- package/dist/shell/site-path.d.ts +8 -0
- package/dist/shell/site-path.d.ts.map +1 -0
- package/dist/shell/site-path.js +11 -0
- package/dist/shell/site-path.js.map +1 -0
- package/dist/shell/site-shell.d.ts +25 -0
- package/dist/shell/site-shell.d.ts.map +1 -0
- package/dist/shell/site-shell.js +17 -0
- package/dist/shell/site-shell.js.map +1 -0
- package/dist/styles/styles.css +10 -0
- package/dist/styles/theme.css +579 -0
- package/dist/styles/tokens.css +295 -0
- package/dist/testing/index.d.ts +321 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +1175 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tokens.json +982 -0
- package/dist/ui/alert.d.ts +35 -0
- package/dist/ui/alert.d.ts.map +1 -0
- package/dist/ui/alert.js +65 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/avatar.d.ts +16 -0
- package/dist/ui/avatar.d.ts.map +1 -0
- package/dist/ui/avatar.js +13 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/badge.d.ts +13 -0
- package/dist/ui/badge.d.ts.map +1 -0
- package/dist/ui/badge.js +24 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/breadcrumbs.d.ts +13 -0
- package/dist/ui/breadcrumbs.d.ts.map +1 -0
- package/dist/ui/breadcrumbs.js +12 -0
- package/dist/ui/breadcrumbs.js.map +1 -0
- package/dist/ui/button-styles.d.ts +24 -0
- package/dist/ui/button-styles.d.ts.map +1 -0
- package/dist/ui/button-styles.js +50 -0
- package/dist/ui/button-styles.js.map +1 -0
- package/dist/ui/button.d.ts +27 -0
- package/dist/ui/button.d.ts.map +1 -0
- package/dist/ui/button.js +30 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/calendar.d.ts +19 -0
- package/dist/ui/calendar.d.ts.map +1 -0
- package/dist/ui/calendar.js +52 -0
- package/dist/ui/calendar.js.map +1 -0
- package/dist/ui/card.d.ts +30 -0
- package/dist/ui/card.d.ts.map +1 -0
- package/dist/ui/card.js +18 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/checkbox.d.ts +36 -0
- package/dist/ui/checkbox.d.ts.map +1 -0
- package/dist/ui/checkbox.js +38 -0
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/code-block.d.ts +20 -0
- package/dist/ui/code-block.d.ts.map +1 -0
- package/dist/ui/code-block.js +22 -0
- package/dist/ui/code-block.js.map +1 -0
- package/dist/ui/combo-box.d.ts +17 -0
- package/dist/ui/combo-box.d.ts.map +1 -0
- package/dist/ui/combo-box.js +14 -0
- package/dist/ui/combo-box.js.map +1 -0
- package/dist/ui/copy-button.d.ts +14 -0
- package/dist/ui/copy-button.d.ts.map +1 -0
- package/dist/ui/copy-button.js +36 -0
- package/dist/ui/copy-button.js.map +1 -0
- package/dist/ui/date-field.d.ts +38 -0
- package/dist/ui/date-field.d.ts.map +1 -0
- package/dist/ui/date-field.js +78 -0
- package/dist/ui/date-field.js.map +1 -0
- package/dist/ui/dialog.d.ts +41 -0
- package/dist/ui/dialog.d.ts.map +1 -0
- package/dist/ui/dialog.js +69 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/disclosure.d.ts +18 -0
- package/dist/ui/disclosure.d.ts.map +1 -0
- package/dist/ui/disclosure.js +15 -0
- package/dist/ui/disclosure.js.map +1 -0
- package/dist/ui/empty-state.d.ts +17 -0
- package/dist/ui/empty-state.d.ts.map +1 -0
- package/dist/ui/empty-state.js +9 -0
- package/dist/ui/empty-state.js.map +1 -0
- package/dist/ui/error-state.d.ts +45 -0
- package/dist/ui/error-state.d.ts.map +1 -0
- package/dist/ui/error-state.js +88 -0
- package/dist/ui/error-state.js.map +1 -0
- package/dist/ui/field.d.ts +46 -0
- package/dist/ui/field.d.ts.map +1 -0
- package/dist/ui/field.js +79 -0
- package/dist/ui/field.js.map +1 -0
- package/dist/ui/file-upload.d.ts +54 -0
- package/dist/ui/file-upload.d.ts.map +1 -0
- package/dist/ui/file-upload.js +170 -0
- package/dist/ui/file-upload.js.map +1 -0
- package/dist/ui/form.d.ts +56 -0
- package/dist/ui/form.d.ts.map +1 -0
- package/dist/ui/form.js +137 -0
- package/dist/ui/form.js.map +1 -0
- package/dist/ui/grid-list.d.ts +24 -0
- package/dist/ui/grid-list.d.ts.map +1 -0
- package/dist/ui/grid-list.js +21 -0
- package/dist/ui/grid-list.js.map +1 -0
- package/dist/ui/hero.d.ts +36 -0
- package/dist/ui/hero.d.ts.map +1 -0
- package/dist/ui/hero.js +19 -0
- package/dist/ui/hero.js.map +1 -0
- package/dist/ui/icon-button.d.ts +18 -0
- package/dist/ui/icon-button.d.ts.map +1 -0
- package/dist/ui/icon-button.js +13 -0
- package/dist/ui/icon-button.js.map +1 -0
- package/dist/ui/icon.d.ts +20 -0
- package/dist/ui/icon.d.ts.map +1 -0
- package/dist/ui/icon.js +26 -0
- package/dist/ui/icon.js.map +1 -0
- package/dist/ui/kbd.d.ts +7 -0
- package/dist/ui/kbd.d.ts.map +1 -0
- package/dist/ui/kbd.js +7 -0
- package/dist/ui/kbd.js.map +1 -0
- package/dist/ui/link-card.d.ts +23 -0
- package/dist/ui/link-card.d.ts.map +1 -0
- package/dist/ui/link-card.js +19 -0
- package/dist/ui/link-card.js.map +1 -0
- package/dist/ui/list-box.d.ts +17 -0
- package/dist/ui/list-box.d.ts.map +1 -0
- package/dist/ui/list-box.js +18 -0
- package/dist/ui/list-box.js.map +1 -0
- package/dist/ui/menu.d.ts +31 -0
- package/dist/ui/menu.d.ts.map +1 -0
- package/dist/ui/menu.js +40 -0
- package/dist/ui/menu.js.map +1 -0
- package/dist/ui/number-field.d.ts +19 -0
- package/dist/ui/number-field.d.ts.map +1 -0
- package/dist/ui/number-field.js +19 -0
- package/dist/ui/number-field.js.map +1 -0
- package/dist/ui/prose.d.ts +12 -0
- package/dist/ui/prose.d.ts.map +1 -0
- package/dist/ui/prose.js +11 -0
- package/dist/ui/prose.js.map +1 -0
- package/dist/ui/radio-group.d.ts +20 -0
- package/dist/ui/radio-group.d.ts.map +1 -0
- package/dist/ui/radio-group.js +16 -0
- package/dist/ui/radio-group.js.map +1 -0
- package/dist/ui/scroll-region.d.ts +18 -0
- package/dist/ui/scroll-region.d.ts.map +1 -0
- package/dist/ui/scroll-region.js +29 -0
- package/dist/ui/scroll-region.js.map +1 -0
- package/dist/ui/search-field.d.ts +12 -0
- package/dist/ui/search-field.d.ts.map +1 -0
- package/dist/ui/search-field.js +12 -0
- package/dist/ui/search-field.js.map +1 -0
- package/dist/ui/search.d.ts +43 -0
- package/dist/ui/search.d.ts.map +1 -0
- package/dist/ui/search.js +45 -0
- package/dist/ui/search.js.map +1 -0
- package/dist/ui/section.d.ts +50 -0
- package/dist/ui/section.d.ts.map +1 -0
- package/dist/ui/section.js +25 -0
- package/dist/ui/section.js.map +1 -0
- package/dist/ui/segmented-control.d.ts +18 -0
- package/dist/ui/segmented-control.d.ts.map +1 -0
- package/dist/ui/segmented-control.js +17 -0
- package/dist/ui/segmented-control.js.map +1 -0
- package/dist/ui/select.d.ts +18 -0
- package/dist/ui/select.d.ts.map +1 -0
- package/dist/ui/select.js +13 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/selection-bar.d.ts +28 -0
- package/dist/ui/selection-bar.d.ts.map +1 -0
- package/dist/ui/selection-bar.js +35 -0
- package/dist/ui/selection-bar.js.map +1 -0
- package/dist/ui/sheet.d.ts +21 -0
- package/dist/ui/sheet.d.ts.map +1 -0
- package/dist/ui/sheet.js +16 -0
- package/dist/ui/sheet.js.map +1 -0
- package/dist/ui/skeleton.d.ts +31 -0
- package/dist/ui/skeleton.d.ts.map +1 -0
- package/dist/ui/skeleton.js +38 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/slider.d.ts +31 -0
- package/dist/ui/slider.d.ts.map +1 -0
- package/dist/ui/slider.js +33 -0
- package/dist/ui/slider.js.map +1 -0
- package/dist/ui/spinner.d.ts +27 -0
- package/dist/ui/spinner.d.ts.map +1 -0
- package/dist/ui/spinner.js +21 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/split.d.ts +14 -0
- package/dist/ui/split.d.ts.map +1 -0
- package/dist/ui/split.js +11 -0
- package/dist/ui/split.js.map +1 -0
- package/dist/ui/stat-list.d.ts +25 -0
- package/dist/ui/stat-list.d.ts.map +1 -0
- package/dist/ui/stat-list.js +14 -0
- package/dist/ui/stat-list.js.map +1 -0
- package/dist/ui/steps.d.ts +23 -0
- package/dist/ui/steps.d.ts.map +1 -0
- package/dist/ui/steps.js +16 -0
- package/dist/ui/steps.js.map +1 -0
- package/dist/ui/switch.d.ts +13 -0
- package/dist/ui/switch.d.ts.map +1 -0
- package/dist/ui/switch.js +12 -0
- package/dist/ui/switch.js.map +1 -0
- package/dist/ui/table.d.ts +25 -0
- package/dist/ui/table.d.ts.map +1 -0
- package/dist/ui/table.js +29 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/tag.d.ts +14 -0
- package/dist/ui/tag.d.ts.map +1 -0
- package/dist/ui/tag.js +11 -0
- package/dist/ui/tag.js.map +1 -0
- package/dist/ui/text-field.d.ts +27 -0
- package/dist/ui/text-field.d.ts.map +1 -0
- package/dist/ui/text-field.js +17 -0
- package/dist/ui/text-field.js.map +1 -0
- package/dist/ui/text-link.d.ts +17 -0
- package/dist/ui/text-link.d.ts.map +1 -0
- package/dist/ui/text-link.js +15 -0
- package/dist/ui/text-link.js.map +1 -0
- package/dist/ui/theme-switcher.d.ts +26 -0
- package/dist/ui/theme-switcher.d.ts.map +1 -0
- package/dist/ui/theme-switcher.js +32 -0
- package/dist/ui/theme-switcher.js.map +1 -0
- package/dist/ui/theme.d.ts +54 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +135 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/ui/toast.d.ts +34 -0
- package/dist/ui/toast.d.ts.map +1 -0
- package/dist/ui/toast.js +69 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/tooltip.d.ts +10 -0
- package/dist/ui/tooltip.d.ts.map +1 -0
- package/dist/ui/tooltip.js +10 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/package.json +123 -0
- package/templates/next/error.tsx +32 -0
- package/templates/next/loading.tsx +19 -0
- package/templates/next/not-found.tsx +18 -0
- package/templates/next/page-transition.tsx +33 -0
- package/templates/next/portal-layout.tsx +70 -0
- package/templates/next/prefetch-on-intent.ts +31 -0
- package/templates/next/root-layout.tsx +16 -0
- package/templates/next/site-layout.tsx +58 -0
- package/templates/next/site-nav.ts +16 -0
- package/templates/next/site-not-found.tsx +21 -0
- package/templates/next/site-router.tsx +17 -0
package/dist/lib/cn.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
3
|
+
/**
|
|
4
|
+
* tailwind-merge, taught this system's own utilities so a className you pass wins over the component's
|
|
5
|
+
* default for the same property ("px-2" replaces "px-3") without dropping anything unrelated.
|
|
6
|
+
*/
|
|
7
|
+
const merge = extendTailwindMerge({
|
|
8
|
+
extend: {
|
|
9
|
+
// Named sizes from the conformance tokens (h-control, size-choice, min-h-target, w-panel…).
|
|
10
|
+
theme: {
|
|
11
|
+
spacing: [
|
|
12
|
+
'target',
|
|
13
|
+
'control-target',
|
|
14
|
+
'control',
|
|
15
|
+
'control-sm',
|
|
16
|
+
'control-lg',
|
|
17
|
+
'nav-item',
|
|
18
|
+
'header',
|
|
19
|
+
'sidebar',
|
|
20
|
+
'sidebar-collapsed',
|
|
21
|
+
'panel',
|
|
22
|
+
'choice',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
classGroups: {
|
|
26
|
+
// The type scale (@utility text-title … text-code) sets size, line height and weight together.
|
|
27
|
+
'font-size': [
|
|
28
|
+
{
|
|
29
|
+
text: [
|
|
30
|
+
'display',
|
|
31
|
+
'display-page',
|
|
32
|
+
'display-section',
|
|
33
|
+
'lead',
|
|
34
|
+
'title',
|
|
35
|
+
'heading',
|
|
36
|
+
'subheading',
|
|
37
|
+
'body',
|
|
38
|
+
'ui',
|
|
39
|
+
'ui-strong',
|
|
40
|
+
'caption',
|
|
41
|
+
'caption-strong',
|
|
42
|
+
'code',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
'focus-ring': ['focus-ring', 'focus-ring-inset'],
|
|
47
|
+
// Field layers (theme.css): the painted box behind an input, and the input that is the target.
|
|
48
|
+
'field-paint': ['field-paint'],
|
|
49
|
+
'field-input': ['field-input'],
|
|
50
|
+
// Its own group, so tailwind-merge doesn't read it as a text colour and drop it for text-brand.
|
|
51
|
+
'text-link': ['text-link'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
/** Join class names, later ones winning where two set the same property. */
|
|
56
|
+
export function cn(...parts) {
|
|
57
|
+
return merge(clsx(parts));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=cn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;GAGG;AACH,MAAM,KAAK,GAAG,mBAAmB,CAA6D;IAC5F,MAAM,EAAE;QACN,4FAA4F;QAC5F,KAAK,EAAE;YACL,OAAO,EAAE;gBACP,QAAQ;gBACR,gBAAgB;gBAChB,SAAS;gBACT,YAAY;gBACZ,YAAY;gBACZ,UAAU;gBACV,QAAQ;gBACR,SAAS;gBACT,mBAAmB;gBACnB,OAAO;gBACP,QAAQ;aACT;SACF;QACD,WAAW,EAAE;YACX,+FAA+F;YAC/F,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE;wBACJ,SAAS;wBACT,cAAc;wBACd,iBAAiB;wBACjB,MAAM;wBACN,OAAO;wBACP,SAAS;wBACT,YAAY;wBACZ,MAAM;wBACN,IAAI;wBACJ,WAAW;wBACX,SAAS;wBACT,gBAAgB;wBAChB,MAAM;qBACP;iBACF;aACF;YACD,YAAY,EAAE,CAAC,YAAY,EAAE,kBAAkB,CAAC;YAChD,+FAA+F;YAC/F,aAAa,EAAE,CAAC,aAAa,CAAC;YAC9B,aAAa,EAAE,CAAC,aAAa,CAAC;YAC9B,gGAAgG;YAChG,WAAW,EAAE,CAAC,WAAW,CAAC;SAC3B;KACF;CACF,CAAC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,UAAU,EAAE,CAAC,GAAG,KAAmB;IACvC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Read a time token (e.g. "8000ms", "0.4s") from the resolved CSS variables. Falls back when not in a browser. */
|
|
2
|
+
export declare function readMs(name: string, fallback: number): number;
|
|
3
|
+
/** The first focusable element after `el` in document order (for moving focus off something being removed). */
|
|
4
|
+
export declare function focusAfter(el: HTMLElement | null, fallbackId?: string): void;
|
|
5
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/lib/tokens.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO7D;AAED,+GAA+G;AAC/G,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,EAAE,UAAU,SAAS,QAUrE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Read a time token (e.g. "8000ms", "0.4s") from the resolved CSS variables. Falls back when not in a browser. */
|
|
2
|
+
export function readMs(name, fallback) {
|
|
3
|
+
if (typeof document === 'undefined')
|
|
4
|
+
return fallback;
|
|
5
|
+
const raw = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
6
|
+
if (!raw)
|
|
7
|
+
return fallback;
|
|
8
|
+
const n = parseFloat(raw);
|
|
9
|
+
if (Number.isNaN(n))
|
|
10
|
+
return fallback;
|
|
11
|
+
return raw.endsWith('ms') ? n : raw.endsWith('s') ? n * 1000 : n;
|
|
12
|
+
}
|
|
13
|
+
/** The first focusable element after `el` in document order (for moving focus off something being removed). */
|
|
14
|
+
export function focusAfter(el, fallbackId = 'main') {
|
|
15
|
+
const selector = 'a[href], button:not([disabled]), input:not([disabled]):not([type=hidden]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
16
|
+
const all = Array.from(document.querySelectorAll(selector)).filter((x) => !el?.contains(x) && x.getClientRects().length > 0);
|
|
17
|
+
const next = el
|
|
18
|
+
? all.find((x) => el.compareDocumentPosition(x) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
19
|
+
: undefined;
|
|
20
|
+
(next ?? document.getElementById(fallbackId))?.focus();
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/lib/tokens.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,QAAgB;IACnD,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,QAAQ,CAAC;IACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACrF,IAAI,CAAC,GAAG;QAAE,OAAO,QAAQ,CAAC;IAC1B,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrC,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,UAAU,CAAC,EAAsB,EAAE,UAAU,GAAG,MAAM;IACpE,MAAM,QAAQ,GACZ,8JAA8J,CAAC;IACjK,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAc,QAAQ,CAAC,CAAC,CAAC,MAAM,CAC7E,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,CAAC,CACzD,CAAC;IACF,MAAM,IAAI,GAAG,EAAE;QACb,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,2BAA2B,CAAC;QACnF,CAAC,CAAC,SAAS,CAAC;IACd,CAAC,IAAI,IAAI,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-element-width.d.ts","sourceRoot":"","sources":["../../src/lib/use-element-width.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,MAAM,CAW1E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useLayoutEffect, useState } from 'react';
|
|
3
|
+
/** Width of an element, kept current with a ResizeObserver. 0 until first measured. */
|
|
4
|
+
export function useElementWidth(ref) {
|
|
5
|
+
const [width, setWidth] = useState(0);
|
|
6
|
+
useLayoutEffect(() => {
|
|
7
|
+
const el = ref.current;
|
|
8
|
+
if (!el)
|
|
9
|
+
return;
|
|
10
|
+
setWidth(el.getBoundingClientRect().width);
|
|
11
|
+
const ro = new ResizeObserver(([entry]) => setWidth(entry.contentRect.width));
|
|
12
|
+
ro.observe(el);
|
|
13
|
+
return () => ro.disconnect();
|
|
14
|
+
}, [ref]);
|
|
15
|
+
return width;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-element-width.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-element-width.js","sourceRoot":"","sources":["../../src/lib/use-element-width.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAElE,uFAAuF;AACvF,MAAM,UAAU,eAAe,CAAC,GAAkC;IAChE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE;YAAE,OAAO;QAChB,QAAQ,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9E,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACf,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACV,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @setsquare/ui/lint — lint rules that keep product code clear of the positioning bugs the components are
|
|
3
|
+
* built to avoid. An ESLint plugin (flat config), which oxlint also loads through `jsPlugins`.
|
|
4
|
+
*
|
|
5
|
+
* The bug they guard against: an element that is `position: absolute` with no offsets (React Aria's
|
|
6
|
+
* VisuallyHidden inputs, Tailwind's `sr-only`) is laid out against its nearest *positioned* ancestor. When a
|
|
7
|
+
* scroll container sits between the two, the element does not scroll with the content; when something scrolls
|
|
8
|
+
* it into view — focus, a screen reader's cursor, find in page — the browser scrolls the outer, often
|
|
9
|
+
* overflow:hidden, ancestor instead, and the page shifts, leaving blank space at the bottom.
|
|
10
|
+
*
|
|
11
|
+
* Two more keep the three-layer controls intact: a control's `className` is its target (Layer 1), so a size
|
|
12
|
+
* there can shrink the target below 44px at AAA; and the painted classes on their own (Layer 2) make the paint
|
|
13
|
+
* the target.
|
|
14
|
+
*
|
|
15
|
+
* Static analysis can only see some of it. `@setsquare/ui/testing` checks the rendered page, and finds the rest.
|
|
16
|
+
*/
|
|
17
|
+
import type { Rule } from 'eslint';
|
|
18
|
+
export declare const rules: {
|
|
19
|
+
'no-raw-aria-controls': Rule.RuleModule;
|
|
20
|
+
'positioned-scroll-container': Rule.RuleModule;
|
|
21
|
+
'no-static-control-root': Rule.RuleModule;
|
|
22
|
+
'no-target-shrink': Rule.RuleModule;
|
|
23
|
+
'no-visual-only-target': Rule.RuleModule;
|
|
24
|
+
'client-directive': Rule.RuleModule;
|
|
25
|
+
};
|
|
26
|
+
declare const plugin: {
|
|
27
|
+
meta: {
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
rules: {
|
|
31
|
+
'no-raw-aria-controls': Rule.RuleModule;
|
|
32
|
+
'positioned-scroll-container': Rule.RuleModule;
|
|
33
|
+
'no-static-control-root': Rule.RuleModule;
|
|
34
|
+
'no-target-shrink': Rule.RuleModule;
|
|
35
|
+
'no-visual-only-target': Rule.RuleModule;
|
|
36
|
+
'client-directive': Rule.RuleModule;
|
|
37
|
+
};
|
|
38
|
+
configs: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
export default plugin;
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lint/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAwoBnC,eAAO,MAAM,KAAK;IAChB,sBAAsB;IACtB,6BAA6B;IAC7B,wBAAwB;IACxB,kBAAkB;IAClB,uBAAuB;IACvB,kBAAkB;CACnB,CAAC;AAEF,QAAA,MAAM,MAAM;;QACF,IAAI;;;;;;;;;;aAEG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CACvC,CAAC;eAea,MAAM"}
|