package file→ .shtukbase/packages/design-lenses/test/fixtures/project/lib/design/components.data.js
test/fixtures/project/lib/design/components.data.js
91 lines, 5.4 KB.
- // A test fixture of lib/design/components.data.js (build contract, section 6), written by hand for the design lenses.
- (function () {
- const card = (attrs, title, desc) =>
- '<div data-slot="package-card" class="package-card"' + attrs + '><div class="icon-plate" data-slot="icon-plate"><i></i></div>'
- + '<div><h4 data-slot="card-title">' + title + '</h4><p data-slot="card-description">' + desc + '</p>'
- + '<span class="chip" data-slot="chip" data-tone="accent">0.1.0</span> <span class="chip" data-slot="chip">design</span></div></div>';
- window.SB_COMPONENTS = {
- version: 1,
- style: "demo",
- css: ["/design/demo/tokens.css", "/design/demo-ui/ui.css"],
- components: [
- {
- id: "button", title: "Button", level: "primitive", description: "A compact action button.",
- uses: [], parts: ["button"], states: ["default", "hover", "disabled"], status: [],
- controls: {
- variant: { kind: "select", options: ["default", "outline", "ghost", "destructive"], default: "default" },
- size: { kind: "segment", options: ["s", "m", "l"], default: "m" },
- },
- cssProperties: ["--primary", "--radius"],
- html: {
- source: "/design/demo-ui/components/primitive/button/button.html",
- css: "/design/demo-ui/components/primitive/button/button.css",
- templates: {
- default: '<button data-slot="button" class="button">Install</button>',
- hover: '<button data-slot="button" class="button" data-state="hover">Install</button>',
- disabled: '<button data-slot="button" class="button" disabled>Install</button>',
- },
- },
- react: { source: "/components/ui/button.tsx" },
- page: "/design/components/button.md",
- },
- {
- id: "chip", title: "Chip", level: "primitive", description: "A small label: a version, a group, a state.",
- uses: [], parts: [], states: ["default"], status: [],
- controls: { tone: { kind: "swatch", options: ["default", "accent", "blue"], colors: ["#e9e9e7", "#e04a72", "#2383e2"], default: "default" } },
- cssProperties: ["--sb-hue-1", "--sb-hue-2"],
- html: {
- source: "/design/demo-ui/components/primitive/chip/chip.html", css: "/design/demo-ui/components/primitive/chip/chip.css",
- templates: { default: '<span data-slot="chip" class="chip">design</span>' },
- },
- react: null,
- page: "/design/components/chip.md",
- },
- {
- id: "package-card", title: "Package card", level: "composite", description: "A package on a white card: icon plate, title, description, chips.",
- uses: ["icon-plate", "chip", "kicker"], parts: ["card-header", "card-title", "card-description", "card-content", "card-footer"],
- states: ["default", "hover", "selected"], status: ["loading", "empty", "error"],
- controls: {
- preset: { kind: "select", options: ["base", "compact", "editorial"], default: "base", section: "Look" },
- glow: { kind: "bool", default: false, section: "Look" },
- width: { kind: "range", min: 220, max: 420, step: 10, unit: "px", default: 300, section: "Size" },
- },
- cssProperties: ["--sb-glow", "--sb-edge"],
- html: {
- source: "/design/demo-ui/components/composite/package-card/package-card.html",
- css: "/design/demo-ui/components/composite/package-card/package-card.css",
- templates: {
- default: card('', "Design tokens", "The token contract and the build of tokens.css."),
- hover: card(' data-state="hover"', "Design tokens", "The token contract and the build of tokens.css."),
- selected: card(' data-state="selected"', "Design tokens", "The token contract and the build of tokens.css."),
- loading: card(' data-status="loading"', "Design tokens", "The token contract and the build."),
- empty: card(' data-status="empty"', "No package", "Nothing is installed yet."),
- error: card(' data-status="error"', "Design tokens", "The package could not be read."),
- },
- },
- react: { source: "/components/ui/package-card.tsx" },
- page: "/design/components/package-card.md",
- },
- {
- id: "package-grid", title: "Package grid", level: "block", description: "Package cards on a sheet, two columns.",
- uses: ["package-card"], parts: [], states: ["default"], status: ["empty"],
- controls: { density: { kind: "segment", options: ["normal", "tight"], default: "normal" } },
- cssProperties: [],
- html: {
- source: "/design/demo-ui/components/block/package-grid/package-grid.html", css: "/design/demo-ui/components/block/package-grid/package-grid.css",
- templates: {
- default: '<div data-slot="package-grid" class="package-grid">' + card('', "Lenses", "HTML lenses over a base.") + card('', "Kit style", "The lens kit style and skins.") + '</div>',
- empty: '<div data-slot="package-grid" class="package-grid" data-status="empty"><span class="chip">No packages</span></div>',
- },
- },
- react: null,
- page: "/design/components/package-grid.md",
- },
- {
- id: "settings-page", title: "Settings page", level: "page", description: "A page with no HTML template yet.",
- uses: ["package-grid"], parts: [], states: [], status: [], controls: {}, cssProperties: [],
- html: null, react: { source: "/components/pages/settings.tsx" }, page: "/design/components/settings-page.md",
- },
- ],
- };
- })();