@vjdesigns/vjdesigns-ui 3.7.0 → 3.8.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 +204 -189
- package/README.md +854 -854
- package/dist/ai/llms-full.txt +784 -589
- package/dist/ai/llms.txt +4 -0
- package/dist/ai/registry.json +741 -17
- package/dist/components/data-display/Poll/Poll.cjs.js +1 -0
- package/dist/components/data-display/Poll/Poll.d.ts +114 -0
- package/dist/components/data-display/Poll/Poll.mjs +335 -0
- package/dist/components/data-display/Poll/Poll.module.css.cjs.js +1 -0
- package/dist/components/data-display/Poll/Poll.module.css.mjs +46 -0
- package/dist/components/data-display/Poll/index.d.ts +1 -0
- package/dist/components/data-display/RatingBreakdown/RatingBreakdown.cjs.js +1 -0
- package/dist/components/data-display/RatingBreakdown/RatingBreakdown.d.ts +35 -0
- package/dist/components/data-display/RatingBreakdown/RatingBreakdown.mjs +88 -0
- package/dist/components/data-display/RatingBreakdown/RatingBreakdown.module.css.cjs.js +1 -0
- package/dist/components/data-display/RatingBreakdown/RatingBreakdown.module.css.mjs +21 -0
- package/dist/components/data-display/RatingBreakdown/index.d.ts +1 -0
- package/dist/components/data-display/ReviewCard/ReviewCard.cjs.js +1 -0
- package/dist/components/data-display/ReviewCard/ReviewCard.d.ts +67 -0
- package/dist/components/data-display/ReviewCard/ReviewCard.mjs +174 -0
- package/dist/components/data-display/ReviewCard/ReviewCard.module.css.cjs.js +1 -0
- package/dist/components/data-display/ReviewCard/ReviewCard.module.css.mjs +26 -0
- package/dist/components/data-display/ReviewCard/index.d.ts +1 -0
- package/dist/components/forms/RatingScale/RatingScale.cjs.js +1 -0
- package/dist/components/forms/RatingScale/RatingScale.d.ts +106 -0
- package/dist/components/forms/RatingScale/RatingScale.mjs +175 -0
- package/dist/components/forms/RatingScale/RatingScale.module.css.cjs.js +1 -0
- package/dist/components/forms/RatingScale/RatingScale.module.css.mjs +28 -0
- package/dist/components/forms/RatingScale/index.d.ts +1 -0
- package/dist/components/navigation/MobileNav/MobileNav.module.css.cjs.js +1 -1
- package/dist/components/navigation/MobileNav/MobileNav.module.css.mjs +14 -14
- package/dist/components/primitives/Icon/icons.cjs.js +1 -1
- package/dist/components/primitives/Icon/icons.d.ts +70 -0
- package/dist/components/primitives/Icon/icons.mjs +203 -134
- package/dist/components/primitives/Typography/Typography.d.ts +2 -2
- package/dist/i18n/en.cjs.js +1 -1
- package/dist/i18n/en.mjs +161 -0
- package/dist/i18n/types.d.ts +171 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +111 -107
- package/dist/locales/ar.cjs.js +1 -1
- package/dist/locales/ar.mjs +196 -0
- package/dist/locales/bn.cjs.js +1 -1
- package/dist/locales/bn.mjs +131 -0
- package/dist/locales/cs.cjs.js +1 -1
- package/dist/locales/cs.mjs +181 -0
- package/dist/locales/da.cjs.js +1 -1
- package/dist/locales/da.mjs +161 -0
- package/dist/locales/de.cjs.js +1 -1
- package/dist/locales/de.mjs +161 -0
- package/dist/locales/el.cjs.js +1 -1
- package/dist/locales/el.mjs +161 -0
- package/dist/locales/es.cjs.js +1 -1
- package/dist/locales/es.mjs +161 -0
- package/dist/locales/fa.cjs.js +1 -1
- package/dist/locales/fa.mjs +131 -0
- package/dist/locales/fi.cjs.js +1 -1
- package/dist/locales/fi.mjs +161 -0
- package/dist/locales/fr.cjs.js +1 -1
- package/dist/locales/fr.mjs +166 -0
- package/dist/locales/he.cjs.js +1 -1
- package/dist/locales/he.mjs +171 -0
- package/dist/locales/hi.cjs.js +1 -1
- package/dist/locales/hi.mjs +161 -0
- package/dist/locales/hu.cjs.js +1 -1
- package/dist/locales/hu.mjs +131 -0
- package/dist/locales/id.cjs.js +1 -1
- package/dist/locales/id.mjs +131 -0
- package/dist/locales/it.cjs.js +1 -1
- package/dist/locales/it.mjs +166 -0
- package/dist/locales/ja.cjs.js +1 -1
- package/dist/locales/ja.mjs +131 -0
- package/dist/locales/ko.cjs.js +1 -1
- package/dist/locales/ko.mjs +131 -0
- package/dist/locales/nb.cjs.js +1 -1
- package/dist/locales/nb.mjs +161 -0
- package/dist/locales/nl.cjs.js +1 -1
- package/dist/locales/nl.mjs +161 -0
- package/dist/locales/pl.cjs.js +1 -1
- package/dist/locales/pl.mjs +181 -0
- package/dist/locales/pt-BR.cjs.js +1 -1
- package/dist/locales/pt-BR.mjs +166 -0
- package/dist/locales/ro.cjs.js +1 -1
- package/dist/locales/ro.mjs +171 -0
- package/dist/locales/ru.cjs.js +1 -1
- package/dist/locales/ru.mjs +181 -0
- package/dist/locales/sv.cjs.js +1 -1
- package/dist/locales/sv.mjs +161 -0
- package/dist/locales/th.cjs.js +1 -1
- package/dist/locales/th.mjs +131 -0
- package/dist/locales/tr.cjs.js +1 -1
- package/dist/locales/tr.mjs +131 -0
- package/dist/locales/uk.cjs.js +1 -1
- package/dist/locales/uk.mjs +181 -0
- package/dist/locales/ur.cjs.js +1 -1
- package/dist/locales/ur.mjs +161 -0
- package/dist/locales/vi.cjs.js +1 -1
- package/dist/locales/vi.mjs +131 -0
- package/dist/locales/zh-Hans.cjs.js +1 -1
- package/dist/locales/zh-Hans.mjs +131 -0
- package/dist/locales/zh-Hant.cjs.js +1 -1
- package/dist/locales/zh-Hant.mjs +131 -0
- package/dist/vjdesigns-ui.css +1 -1
- package/package.json +1 -1
package/dist/ai/registry.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vjdesigns/vjdesigns-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"summary": "Accessible React 19 component library: WCAG 2.2 AA verified (axe on every story, a contrast check on every color pair), 31 languages with right-to-left support, themeable with any brand color (auto-adjusted to stay accessible), tree-shakable, no runtime dependencies besides React.",
|
|
5
5
|
"install": "npm install @vjdesigns/vjdesigns-ui",
|
|
6
6
|
"stylesheet": "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css",
|
|
@@ -17,27 +17,27 @@
|
|
|
17
17
|
{
|
|
18
18
|
"id": "setup",
|
|
19
19
|
"title": "Installation",
|
|
20
|
-
"markdown": "Install the package along with React and React DOM. The library requires **React 19**, which the components need in order to render:\n\n```bash\nnpm install @vjdesigns/vjdesigns-ui react react-dom\n```\n\nIf your project already uses React, you only need the first package:\n\n```bash\nnpm install @vjdesigns/vjdesigns-ui\n```\n\n### Browser support\n\nThe components support the current and previous major versions of evergreen browsers, with these minimums:\n\n| Browser | Minimum version |\n| --- | --- |\n| Chrome, Edge, and other Chromium browsers | 111 |\n| Firefox | 121 |\n| Safari (macOS and iOS) | 16.2 |\n\nThese are set by the CSS the components rely on: `color-mix()`, container queries, `:has()` (which draws some keyboard focus rings), and the `inert` attribute. Internet Explorer and legacy (non-Chromium) Edge aren't supported.\n\nA few newer features are used only where available, with a fallback elsewhere: `field-sizing` for auto-growing `Textarea` (measured in JavaScript otherwise), the `scrollend` event in `Carousel`, and `hidden=\"until-found\"` for find-in-page in `Accordion` and `Collapsible`.\n\n### Import the styles\n\nThe component styles and shared design tokens ship as a separate stylesheet. Import it **once** at your app's entry point, or the components will render unstyled.\n\n**React:** in `main.tsx` (or `App.tsx`)\n\n```ts\nimport \"@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\";\n```\n\n**Angular:** add it to the `styles` array in `angular.json`\n\n```json\n\"styles\": [\n \"node_modules/@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\",\n \"src/styles.css\"\n]\n```\n\n**Vue:** in `main.ts`\n\n```ts\nimport \"@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\";\n```"
|
|
20
|
+
"markdown": "Install the package along with React and React DOM. The library requires **React 19**, which the components need in order to render:\r\n\r\n```bash\r\nnpm install @vjdesigns/vjdesigns-ui react react-dom\r\n```\r\n\r\nIf your project already uses React, you only need the first package:\r\n\r\n```bash\r\nnpm install @vjdesigns/vjdesigns-ui\r\n```\r\n\r\n### Browser support\r\n\r\nThe components support the current and previous major versions of evergreen browsers, with these minimums:\r\n\r\n| Browser | Minimum version |\r\n| --- | --- |\r\n| Chrome, Edge, and other Chromium browsers | 111 |\r\n| Firefox | 121 |\r\n| Safari (macOS and iOS) | 16.2 |\r\n\r\nThese are set by the CSS the components rely on: `color-mix()`, container queries, `:has()` (which draws some keyboard focus rings), and the `inert` attribute. Internet Explorer and legacy (non-Chromium) Edge aren't supported.\r\n\r\nA few newer features are used only where available, with a fallback elsewhere: `field-sizing` for auto-growing `Textarea` (measured in JavaScript otherwise), the `scrollend` event in `Carousel`, and `hidden=\"until-found\"` for find-in-page in `Accordion` and `Collapsible`.\r\n\r\n### Import the styles\r\n\r\nThe component styles and shared design tokens ship as a separate stylesheet. Import it **once** at your app's entry point, or the components will render unstyled.\r\n\r\n**React:** in `main.tsx` (or `App.tsx`)\r\n\r\n```ts\r\nimport \"@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\";\r\n```\r\n\r\n**Angular:** add it to the `styles` array in `angular.json`\r\n\r\n```json\r\n\"styles\": [\r\n \"node_modules/@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\",\r\n \"src/styles.css\"\r\n]\r\n```\r\n\r\n**Vue:** in `main.ts`\r\n\r\n```ts\r\nimport \"@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\";\r\n```"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"id": "usage",
|
|
24
24
|
"title": "Usage",
|
|
25
|
-
"markdown": "The components are built with React. You can use them directly in a React project. In Angular or Vue, you mount them inside a small wrapper component, as shown below.\n\n### React\n\n```tsx\nimport { useState } from \"react\";\nimport { Button, CheckBox } from \"@vjdesigns/vjdesigns-ui\";\n\nexport function SignupForm() {\n const [accepted, setAccepted] = useState(false);\n\n return (\n <form>\n <CheckBox\n label=\"Accept terms\"\n checked={accepted}\n onCheckedChange={setAccepted}\n />\n <Button\n variant=\"solid\"\n tone=\"primary\"\n size=\"md\"\n disabled={!accepted}\n onClick={() => console.log(\"Submitted\")}\n >\n Submit\n </Button>\n </form>\n );\n}\n```\n\n### Next.js (App Router) and React Server Components\n\nThe library works in Server Components. Interactive components (anything with state, effects, or context: `Button`, `DataGrid`, `Modal`, ...) are marked `\"use client\"`, so you can render them from a Server Component like any client component. Utilities (`cx`, `sortRows`, `createBrandPalette`, `getLocaleDirection`, ...) and the locale catalogs have no directive, so you can call or read them on the server too. Every component also renders on the server for the first paint.\n\nPut the providers in a small client file of your own, and render it from the root layout:\n\n```tsx\n// app/providers.tsx\n\"use client\";\nimport { LocaleProvider, ToastProvider } from \"@vjdesigns/vjdesigns-ui\";\nimport es from \"@vjdesigns/vjdesigns-ui/locales/es\";\nimport type { ReactNode } from \"react\";\n\nexport function Providers({ children }: { children: ReactNode }) {\n return (\n <LocaleProvider locale=\"es\" messages={es}>\n <ToastProvider>{children}</ToastProvider>\n </LocaleProvider>\n );\n}\n```\n\n```tsx\n// app/layout.tsx (a Server Component)\nimport \"@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\";\nimport { getLocaleDirection } from \"@vjdesigns/vjdesigns-ui\";\nimport { Providers } from \"./providers\";\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"es\" dir={getLocaleDirection(\"es\")}>\n <body>\n <Providers>{children}</Providers>\n </body>\n </html>\n );\n}\n```\n\nTwo rules of Server Components to keep in mind:\n\n- **Functions can't be passed from a Server Component to a client one.** That includes event handlers (`onClick`), DataGrid columns with `cell` or `value` functions, and the locale catalogs themselves (their plural messages are functions, which is why `LocaleProvider` goes in the client providers file above). Render those components from your own `\"use client\"` file.\n- **Compound parts can't be reached with a dot from a Server Component** (`Tabs.List`, `Menu.Item`): Next.js reports \"You cannot dot into a client module\". Use them inside a `\"use client\"` file, or use the named exports where they exist (`CardHeader`, `CardBody`, `NavbarBrand`, ...).\n\n### Angular\n\nMake a standalone wrapper that renders the React component into its host element. The wrapper uses `createElement`, so you don't need to change your JSX or TSX settings.\n\n```ts\n// vj-button.component.ts\nimport {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n Output,\n ViewChild,\n} from \"@angular/core\";\nimport { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from \"react\";\nimport { createRoot, Root } from \"react-dom/client\";\nimport {\n Button,\n type ButtonProps,\n type ButtonVariant,\n type Size,\n type Tone,\n} from \"@vjdesigns/vjdesigns-ui\";\n\n// Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.\nconst ReactButton = Button as (props: ButtonProps) => ReactElement;\n\n@Component({\n selector: \"vj-button\",\n standalone: true,\n template: `<span #host></span>`,\n})\nexport class VjButtonComponent implements AfterViewInit, OnChanges, OnDestroy {\n @ViewChild(\"host\", { static: true }) host!: ElementRef<HTMLElement>;\n\n @Input() label = \"\";\n @Input() variant: ButtonVariant = \"solid\";\n @Input() tone: Tone = \"primary\";\n @Input() size: Size = \"md\";\n @Input() disabled = false;\n @Output() clicked = new EventEmitter<MouseEvent>();\n\n private root?: Root;\n\n ngAfterViewInit() {\n this.root = createRoot(this.host.nativeElement);\n this.render();\n }\n\n ngOnChanges() {\n this.render();\n }\n\n ngOnDestroy() {\n this.root?.unmount();\n }\n\n private render() {\n this.root?.render(\n createElement(\n ReactButton,\n {\n variant: this.variant,\n tone: this.tone,\n size: this.size,\n disabled: this.disabled,\n onClick: (event: ReactMouseEvent) => this.clicked.emit(event.nativeEvent),\n },\n this.label // the button's text is passed as children\n )\n );\n }\n}\n```\n\nImport the wrapper wherever you need it:\n\n```ts\n// app.component.ts\nimport { Component } from \"@angular/core\";\nimport { VjButtonComponent } from \"./vj-button.component\";\n\n@Component({\n selector: \"app-root\",\n standalone: true,\n imports: [VjButtonComponent],\n template: `<vj-button label=\"Submit\" tone=\"primary\" (clicked)=\"onSubmit()\" />`,\n})\nexport class AppComponent {\n onSubmit() {\n console.log(\"Submitted\");\n }\n}\n```\n\n### Vue 3\n\nMake a wrapper component that mounts the React component when it loads and re-renders it whenever its props change.\n\n```vue\n<!-- VjButton.vue -->\n<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from \"react\";\nimport { createRoot, type Root } from \"react-dom/client\";\nimport {\n Button,\n type ButtonProps,\n type ButtonVariant,\n type Size,\n type Tone,\n} from \"@vjdesigns/vjdesigns-ui\";\n\n// Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.\nconst ReactButton = Button as (props: ButtonProps) => ReactElement;\n\nconst props = withDefaults(\n defineProps<{\n label: string;\n variant?: ButtonVariant;\n tone?: Tone;\n size?: Size;\n disabled?: boolean;\n }>(),\n { variant: \"solid\", tone: \"primary\", size: \"md\", disabled: false }\n);\n\nconst emit = defineEmits<{ click: [event: MouseEvent] }>();\n\nconst host = ref<HTMLElement | null>(null);\nlet root: Root | undefined;\n\nfunction render() {\n root?.render(\n createElement(\n ReactButton,\n {\n variant: props.variant,\n tone: props.tone,\n size: props.size,\n disabled: props.disabled,\n onClick: (event: ReactMouseEvent) => emit(\"click\", event.nativeEvent),\n },\n props.label // the button's text is passed as children\n )\n );\n}\n\nonMounted(() => {\n root = createRoot(host.value!);\n render();\n});\n\nwatch(() => ({ ...props }), render);\n\nonBeforeUnmount(() => root?.unmount());\n</script>\n\n<template>\n <span ref=\"host\" />\n</template>\n```\n\nUse it like any other Vue component:\n\n```vue\n<script setup lang=\"ts\">\nimport VjButton from \"./VjButton.vue\";\n\nconst onSubmit = () => console.log(\"Submitted\");\n</script>\n\n<template>\n <VjButton label=\"Submit\" tone=\"primary\" @click=\"onSubmit\" />\n</template>\n```\n\n> **Tip:** Wrap `CheckBox` and any other component the same way. Pass its props into `createElement`, and send its callbacks back out as Angular outputs or Vue emits. For `CheckBox`, that means sending `onCheckedChange` back out."
|
|
25
|
+
"markdown": "The components are built with React. You can use them directly in a React project. In Angular or Vue, you mount them inside a small wrapper component, as shown below.\r\n\r\n### React\r\n\r\n```tsx\r\nimport { useState } from \"react\";\r\nimport { Button, CheckBox } from \"@vjdesigns/vjdesigns-ui\";\r\n\r\nexport function SignupForm() {\r\n const [accepted, setAccepted] = useState(false);\r\n\r\n return (\r\n <form>\r\n <CheckBox\r\n label=\"Accept terms\"\r\n checked={accepted}\r\n onCheckedChange={setAccepted}\r\n />\r\n <Button\r\n variant=\"solid\"\r\n tone=\"primary\"\r\n size=\"md\"\r\n disabled={!accepted}\r\n onClick={() => console.log(\"Submitted\")}\r\n >\r\n Submit\r\n </Button>\r\n </form>\r\n );\r\n}\r\n```\r\n\r\n### Next.js (App Router) and React Server Components\r\n\r\nThe library works in Server Components. Interactive components (anything with state, effects, or context: `Button`, `DataGrid`, `Modal`, ...) are marked `\"use client\"`, so you can render them from a Server Component like any client component. Utilities (`cx`, `sortRows`, `createBrandPalette`, `getLocaleDirection`, ...) and the locale catalogs have no directive, so you can call or read them on the server too. Every component also renders on the server for the first paint.\r\n\r\nPut the providers in a small client file of your own, and render it from the root layout:\r\n\r\n```tsx\r\n// app/providers.tsx\r\n\"use client\";\r\nimport { LocaleProvider, ToastProvider } from \"@vjdesigns/vjdesigns-ui\";\r\nimport es from \"@vjdesigns/vjdesigns-ui/locales/es\";\r\nimport type { ReactNode } from \"react\";\r\n\r\nexport function Providers({ children }: { children: ReactNode }) {\r\n return (\r\n <LocaleProvider locale=\"es\" messages={es}>\r\n <ToastProvider>{children}</ToastProvider>\r\n </LocaleProvider>\r\n );\r\n}\r\n```\r\n\r\n```tsx\r\n// app/layout.tsx (a Server Component)\r\nimport \"@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css\";\r\nimport { getLocaleDirection } from \"@vjdesigns/vjdesigns-ui\";\r\nimport { Providers } from \"./providers\";\r\n\r\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\r\n return (\r\n <html lang=\"es\" dir={getLocaleDirection(\"es\")}>\r\n <body>\r\n <Providers>{children}</Providers>\r\n </body>\r\n </html>\r\n );\r\n}\r\n```\r\n\r\nTwo rules of Server Components to keep in mind:\r\n\r\n- **Functions can't be passed from a Server Component to a client one.** That includes event handlers (`onClick`), DataGrid columns with `cell` or `value` functions, and the locale catalogs themselves (their plural messages are functions, which is why `LocaleProvider` goes in the client providers file above). Render those components from your own `\"use client\"` file.\r\n- **Compound parts can't be reached with a dot from a Server Component** (`Tabs.List`, `Menu.Item`): Next.js reports \"You cannot dot into a client module\". Use them inside a `\"use client\"` file, or use the named exports where they exist (`CardHeader`, `CardBody`, `NavbarBrand`, ...).\r\n\r\n### Angular\r\n\r\nMake a standalone wrapper that renders the React component into its host element. The wrapper uses `createElement`, so you don't need to change your JSX or TSX settings.\r\n\r\n```ts\r\n// vj-button.component.ts\r\nimport {\r\n AfterViewInit,\r\n Component,\r\n ElementRef,\r\n EventEmitter,\r\n Input,\r\n OnChanges,\r\n OnDestroy,\r\n Output,\r\n ViewChild,\r\n} from \"@angular/core\";\r\nimport { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from \"react\";\r\nimport { createRoot, Root } from \"react-dom/client\";\r\nimport {\r\n Button,\r\n type ButtonProps,\r\n type ButtonVariant,\r\n type Size,\r\n type Tone,\r\n} from \"@vjdesigns/vjdesigns-ui\";\r\n\r\n// Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.\r\nconst ReactButton = Button as (props: ButtonProps) => ReactElement;\r\n\r\n@Component({\r\n selector: \"vj-button\",\r\n standalone: true,\r\n template: `<span #host></span>`,\r\n})\r\nexport class VjButtonComponent implements AfterViewInit, OnChanges, OnDestroy {\r\n @ViewChild(\"host\", { static: true }) host!: ElementRef<HTMLElement>;\r\n\r\n @Input() label = \"\";\r\n @Input() variant: ButtonVariant = \"solid\";\r\n @Input() tone: Tone = \"primary\";\r\n @Input() size: Size = \"md\";\r\n @Input() disabled = false;\r\n @Output() clicked = new EventEmitter<MouseEvent>();\r\n\r\n private root?: Root;\r\n\r\n ngAfterViewInit() {\r\n this.root = createRoot(this.host.nativeElement);\r\n this.render();\r\n }\r\n\r\n ngOnChanges() {\r\n this.render();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.root?.unmount();\r\n }\r\n\r\n private render() {\r\n this.root?.render(\r\n createElement(\r\n ReactButton,\r\n {\r\n variant: this.variant,\r\n tone: this.tone,\r\n size: this.size,\r\n disabled: this.disabled,\r\n onClick: (event: ReactMouseEvent) => this.clicked.emit(event.nativeEvent),\r\n },\r\n this.label // the button's text is passed as children\r\n )\r\n );\r\n }\r\n}\r\n```\r\n\r\nImport the wrapper wherever you need it:\r\n\r\n```ts\r\n// app.component.ts\r\nimport { Component } from \"@angular/core\";\r\nimport { VjButtonComponent } from \"./vj-button.component\";\r\n\r\n@Component({\r\n selector: \"app-root\",\r\n standalone: true,\r\n imports: [VjButtonComponent],\r\n template: `<vj-button label=\"Submit\" tone=\"primary\" (clicked)=\"onSubmit()\" />`,\r\n})\r\nexport class AppComponent {\r\n onSubmit() {\r\n console.log(\"Submitted\");\r\n }\r\n}\r\n```\r\n\r\n### Vue 3\r\n\r\nMake a wrapper component that mounts the React component when it loads and re-renders it whenever its props change.\r\n\r\n```vue\r\n<!-- VjButton.vue -->\r\n<script setup lang=\"ts\">\r\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\r\nimport { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from \"react\";\r\nimport { createRoot, type Root } from \"react-dom/client\";\r\nimport {\r\n Button,\r\n type ButtonProps,\r\n type ButtonVariant,\r\n type Size,\r\n type Tone,\r\n} from \"@vjdesigns/vjdesigns-ui\";\r\n\r\n// Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.\r\nconst ReactButton = Button as (props: ButtonProps) => ReactElement;\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n label: string;\r\n variant?: ButtonVariant;\r\n tone?: Tone;\r\n size?: Size;\r\n disabled?: boolean;\r\n }>(),\r\n { variant: \"solid\", tone: \"primary\", size: \"md\", disabled: false }\r\n);\r\n\r\nconst emit = defineEmits<{ click: [event: MouseEvent] }>();\r\n\r\nconst host = ref<HTMLElement | null>(null);\r\nlet root: Root | undefined;\r\n\r\nfunction render() {\r\n root?.render(\r\n createElement(\r\n ReactButton,\r\n {\r\n variant: props.variant,\r\n tone: props.tone,\r\n size: props.size,\r\n disabled: props.disabled,\r\n onClick: (event: ReactMouseEvent) => emit(\"click\", event.nativeEvent),\r\n },\r\n props.label // the button's text is passed as children\r\n )\r\n );\r\n}\r\n\r\nonMounted(() => {\r\n root = createRoot(host.value!);\r\n render();\r\n});\r\n\r\nwatch(() => ({ ...props }), render);\r\n\r\nonBeforeUnmount(() => root?.unmount());\r\n</script>\r\n\r\n<template>\r\n <span ref=\"host\" />\r\n</template>\r\n```\r\n\r\nUse it like any other Vue component:\r\n\r\n```vue\r\n<script setup lang=\"ts\">\r\nimport VjButton from \"./VjButton.vue\";\r\n\r\nconst onSubmit = () => console.log(\"Submitted\");\r\n</script>\r\n\r\n<template>\r\n <VjButton label=\"Submit\" tone=\"primary\" @click=\"onSubmit\" />\r\n</template>\r\n```\r\n\r\n> **Tip:** Wrap `CheckBox` and any other component the same way. Pass its props into `createElement`, and send its callbacks back out as Angular outputs or Vue emits. For `CheckBox`, that means sending `onCheckedChange` back out."
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"id": "theming",
|
|
29
29
|
"title": "Theming",
|
|
30
|
-
"markdown": "Wrap any part of your app in `Theme` to set the color mode, brand palette, and accent for everything inside it:\n\n```tsx\nimport { Theme, Button } from \"@vjdesigns/vjdesigns-ui\";\n\n<Theme mode=\"dark\" brand=\"purple\" fill>\n <Button>Dark, purple button</Button>\n</Theme>\n```\n\n| Prop | Type | Default | Description |\n| --- | --- | --- | --- |\n| `mode` | `\"light\" \\| \"dark\"` | inherited | Color mode for everything inside. |\n| `brand` | `\"black\" \\| \"blue\" \\| \"gold\" \\| \"green\" \\| \"purple\"`, a hex color, or `{ light, dark }` | inherited | Brand palette for buttons, links, focus rings and indicators. |\n| `accent` | `\"brand\" | \"lime\"`, a hex color, or `{ light, dark }` | inherited (the brand's own) | The bright highlight on badges, switches, progress bars, sliders, steppers, and active navigation. |\n| `fill` | `boolean` | `false` | Paints the theme's background and text color on the wrapper. |\n\nOutside React (or to theme the whole page), set the attributes on `<html>` instead:\n\n```html\n<html data-theme=\"dark\" data-brand=\"purple\" data-accent=\"lime\">\n```\n\n### Accent color\n\nThe accent is the energetic highlight: badges, switches, progress bars, sliders, steppers, and the active link in the Navbar. By default it follows the brand, as a bright shade of the brand's own color, so it always fits:\n\n| Brand | Default accent |\n| --- | --- |\n| `blue` (default) | sky blue `#76c7ff` |\n| `purple` | lavender `#c0b0ff` |\n| `gold` | amber `#f5ad5f` |\n| `green` | mint `#72d4ad` |\n| `black` | lime `#c8f031` (black has no hue to build on) |\n| a custom hex | generated from that color |\n\nTo choose a different one:\n\n```tsx\n<Theme accent=\"lime\">…</Theme> // the original bright yellow-green (\"volt\", its former name, still works)\n<Theme accent=\"#ff6b00\">…</Theme> // any color\n<Theme accent=\"brand\">…</Theme> // back to the brand's own, inside an area with another accent\n```\n\nAccents always carry dark text. A color too dark for that is lightened (same hue) just enough to meet WCAG AA, with a warning in development. An accent you set also holds inside nested brands. In CSS, `accentCss(\"name\", \"#ff6b00\")` generates a `[data-accent=\"name\"]` rule, like `brandCss` below.\n\n### Custom brand colors\n\nPass any hex color as `brand` and a full palette is generated for both modes:\n\n```tsx\n<Theme brand=\"#e11d48\">…</Theme>\n<Theme brand={{ light: \"#4338ca\", dark: \"#f472b6\" }}>…</Theme>\n```\n\nEvery generated palette meets WCAG 2.2 AA. A single color is used exactly as given in the mode where it has enough contrast (dark colors in light mode, light colors in dark mode), and the other mode gets a matching shade of the same hue. If a color doesn't have enough contrast (for example, a mid-tone that fails in both modes), its lightness is shifted just enough to pass, and a warning is logged in development.\n\nTo define a brand in CSS instead (for the whole page, applied before any JavaScript runs), generate a stylesheet rule with `brandCss`:\n\n```ts\nimport { brandCss } from \"@vjdesigns/vjdesigns-ui\";\n\nbrandCss(\"acme\", \"#e11d48\"); // '[data-brand=\"acme\"] { --brand-light-primary: … }'\n```\n\nAdd the rule to your stylesheet and use `<html data-brand=\"acme\">`. `createBrandPalette(color)` returns the generated colors as an object, if you need them directly.\n\n### Tailwind CSS\n\nA Tailwind CSS v4 preset turns the design tokens into utilities, so your own layouts match the components. Import it after Tailwind in your CSS, and keep importing the library's stylesheet as usual:\n\n```css\n@import \"tailwindcss\";\n@import \"@vjdesigns/vjdesigns-ui/tailwind.css\";\n```\n\n```tsx\n<section className=\"bg-surface text-text rounded-xl shadow-md p-6\">\n <h2 className=\"font-display text-2xl tracking-tight\">Season stats</h2>\n <p className=\"text-text-muted\">Updated after every game.</p>\n <span className=\"bg-accent text-on-accent rounded-control px-3\">New</span>\n</section>\n```\n\nEvery utility points at a token (`bg-primary` is `var(--color-primary)`), so Tailwind classes follow `Theme`, `data-theme`, `data-brand`, and `data-accent` exactly like the components, with no `dark:` variants needed.\n\n| Group | Utilities |\n| --- | --- |\n| Colors | `bg-`, `text-`, `border-`, `ring-`, … with `bg`, `surface` (`-raised`, `-sunken`, `-hover`, `-active`), `overlay`, `text` (`-muted`, `-disabled`, `-inverse`), `border` (`-strong`, `-input`), `focus-ring`, `link-visited`; and for `primary`, `accent`, `success`, `warning`, `danger`, `info`, `neutral`: the solid color, `-hover`, `-active`, `on-…` (text on the solid), `-subtle`, `-subtle-hover`, `-subtle-text`, `-border`. Opacity modifiers work (`bg-primary/50`). |\n| Charts | `bg-chart-1` to `bg-chart-8`, for fills only, in that order. Slots 3 to 5 are under 3:1 on white, so pair them with a legend, labels, or a data table. |\n| Type | `font-display` (headings, buttons, labels, numbers), `font-body`, `font-mono`; `text-xs` to `text-6xl` (plus `text-md`); `font-regular` to `font-black`; `leading-tight`, `-snug`, `-normal`, `-relaxed`; `tracking-tight`, `-normal`, `-wide`, `-caps` |\n| Shape | `rounded-control` (pill controls), `rounded-field` (text fields), `rounded-xs` to `rounded-2xl`, `rounded-pill` |\n| Depth | `shadow-xs` to `shadow-xl`, `blur-sm`, `blur-lg` |\n| Motion | `ease-spring` (enter and press), `ease-standard`, `ease-in`, `ease-out`; `duration-instant`, `-fast`, `-normal`, `-slow` (0ms under reduced motion) |\n| Sizes | `h-control-sm`, `-md`, `-lg` (and `w-`, `min-h-`, …), `size-target` (the 24px minimum pointer target), `max-w-xs` to `max-w-2xl` and `@xs:` to `@2xl:` container queries |\n| Layers | `z-sticky`, `z-overlay`, `z-modal`, `z-popover`, `z-dropdown`, `z-toast`, `z-tooltip` |\n| Dark mode | `dark:` follows `data-theme=\"dark\"`, not the OS setting. |\n\nTailwind's numeric spacing (`p-4` = 1rem) already matches the 4px token scale, and the breakpoints (`sm:` to `2xl:`) are the same as Tailwind's.\n\nSome Tailwind names change meaning with the preset: `rounded-*`, `shadow-*`, `blur-sm`/`-lg`, `ease-in`/`-out`, `font-mono`, `font-medium` to `font-black`, `leading-*`, and the `text-*` sizes take the library's values (for example, `rounded-md` is 12px and `font-black` is 800). So do the containers: `max-w-md` and `@md:` are 48rem, not Tailwind's 28rem. The library's stylesheet already gives some of these names its own values once it's loaded, even without the preset; the preset keeps the utilities and the container queries consistent.\n\nFor text contrast, use the pairs the components use: `text-text` or `text-text-muted` on `bg-bg`, `bg-surface`, and the other surfaces; `text-on-primary` on `bg-primary` (likewise `on-accent`, `on-success`, …); `text-primary-subtle-text` on `bg-primary-subtle` (likewise for each tone). These pairs meet WCAG 2.2 AA in both themes and every brand. Don't use accent or chart colors for text.\n\nThe preset doesn't change the components, and Tailwind's preflight (its CSS reset) doesn't override them, whichever stylesheet loads first."
|
|
30
|
+
"markdown": "Wrap any part of your app in `Theme` to set the color mode, brand palette, and accent for everything inside it:\r\n\r\n```tsx\r\nimport { Theme, Button } from \"@vjdesigns/vjdesigns-ui\";\r\n\r\n<Theme mode=\"dark\" brand=\"purple\" fill>\r\n <Button>Dark, purple button</Button>\r\n</Theme>\r\n```\r\n\r\n| Prop | Type | Default | Description |\r\n| --- | --- | --- | --- |\r\n| `mode` | `\"light\" \\| \"dark\"` | inherited | Color mode for everything inside. |\r\n| `brand` | `\"black\" \\| \"blue\" \\| \"gold\" \\| \"green\" \\| \"purple\"`, a hex color, or `{ light, dark }` | inherited | Brand palette for buttons, links, focus rings and indicators. |\r\n| `accent` | `\"brand\" | \"lime\"`, a hex color, or `{ light, dark }` | inherited (the brand's own) | The bright highlight on badges, switches, progress bars, sliders, steppers, and active navigation. |\r\n| `fill` | `boolean` | `false` | Paints the theme's background and text color on the wrapper. |\r\n\r\nOutside React (or to theme the whole page), set the attributes on `<html>` instead:\r\n\r\n```html\r\n<html data-theme=\"dark\" data-brand=\"purple\" data-accent=\"lime\">\r\n```\r\n\r\n### Accent color\r\n\r\nThe accent is the energetic highlight: badges, switches, progress bars, sliders, steppers, and the active link in the Navbar. By default it follows the brand, as a bright shade of the brand's own color, so it always fits:\r\n\r\n| Brand | Default accent |\r\n| --- | --- |\r\n| `blue` (default) | sky blue `#76c7ff` |\r\n| `purple` | lavender `#c0b0ff` |\r\n| `gold` | amber `#f5ad5f` |\r\n| `green` | mint `#72d4ad` |\r\n| `black` | lime `#c8f031` (black has no hue to build on) |\r\n| a custom hex | generated from that color |\r\n\r\nTo choose a different one:\r\n\r\n```tsx\r\n<Theme accent=\"lime\">…</Theme> // the original bright yellow-green (\"volt\", its former name, still works)\r\n<Theme accent=\"#ff6b00\">…</Theme> // any color\r\n<Theme accent=\"brand\">…</Theme> // back to the brand's own, inside an area with another accent\r\n```\r\n\r\nAccents always carry dark text. A color too dark for that is lightened (same hue) just enough to meet WCAG AA, with a warning in development. An accent you set also holds inside nested brands. In CSS, `accentCss(\"name\", \"#ff6b00\")` generates a `[data-accent=\"name\"]` rule, like `brandCss` below.\r\n\r\n### Custom brand colors\r\n\r\nPass any hex color as `brand` and a full palette is generated for both modes:\r\n\r\n```tsx\r\n<Theme brand=\"#e11d48\">…</Theme>\r\n<Theme brand={{ light: \"#4338ca\", dark: \"#f472b6\" }}>…</Theme>\r\n```\r\n\r\nEvery generated palette meets WCAG 2.2 AA. A single color is used exactly as given in the mode where it has enough contrast (dark colors in light mode, light colors in dark mode), and the other mode gets a matching shade of the same hue. If a color doesn't have enough contrast (for example, a mid-tone that fails in both modes), its lightness is shifted just enough to pass, and a warning is logged in development.\r\n\r\nTo define a brand in CSS instead (for the whole page, applied before any JavaScript runs), generate a stylesheet rule with `brandCss`:\r\n\r\n```ts\r\nimport { brandCss } from \"@vjdesigns/vjdesigns-ui\";\r\n\r\nbrandCss(\"acme\", \"#e11d48\"); // '[data-brand=\"acme\"] { --brand-light-primary: … }'\r\n```\r\n\r\nAdd the rule to your stylesheet and use `<html data-brand=\"acme\">`. `createBrandPalette(color)` returns the generated colors as an object, if you need them directly.\r\n\r\n### Tailwind CSS\r\n\r\nA Tailwind CSS v4 preset turns the design tokens into utilities, so your own layouts match the components. Import it after Tailwind in your CSS, and keep importing the library's stylesheet as usual:\r\n\r\n```css\r\n@import \"tailwindcss\";\r\n@import \"@vjdesigns/vjdesigns-ui/tailwind.css\";\r\n```\r\n\r\n```tsx\r\n<section className=\"bg-surface text-text rounded-xl shadow-md p-6\">\r\n <h2 className=\"font-display text-2xl tracking-tight\">Season stats</h2>\r\n <p className=\"text-text-muted\">Updated after every game.</p>\r\n <span className=\"bg-accent text-on-accent rounded-control px-3\">New</span>\r\n</section>\r\n```\r\n\r\nEvery utility points at a token (`bg-primary` is `var(--color-primary)`), so Tailwind classes follow `Theme`, `data-theme`, `data-brand`, and `data-accent` exactly like the components, with no `dark:` variants needed.\r\n\r\n| Group | Utilities |\r\n| --- | --- |\r\n| Colors | `bg-`, `text-`, `border-`, `ring-`, … with `bg`, `surface` (`-raised`, `-sunken`, `-hover`, `-active`), `overlay`, `text` (`-muted`, `-disabled`, `-inverse`), `border` (`-strong`, `-input`), `focus-ring`, `link-visited`; and for `primary`, `accent`, `success`, `warning`, `danger`, `info`, `neutral`: the solid color, `-hover`, `-active`, `on-…` (text on the solid), `-subtle`, `-subtle-hover`, `-subtle-text`, `-border`. Opacity modifiers work (`bg-primary/50`). |\r\n| Charts | `bg-chart-1` to `bg-chart-8`, for fills only, in that order. Slots 3 to 5 are under 3:1 on white, so pair them with a legend, labels, or a data table. |\r\n| Type | `font-display` (headings, buttons, labels, numbers), `font-body`, `font-mono`; `text-xs` to `text-6xl` (plus `text-md`); `font-regular` to `font-black`; `leading-tight`, `-snug`, `-normal`, `-relaxed`; `tracking-tight`, `-normal`, `-wide`, `-caps` |\r\n| Shape | `rounded-control` (pill controls), `rounded-field` (text fields), `rounded-xs` to `rounded-2xl`, `rounded-pill` |\r\n| Depth | `shadow-xs` to `shadow-xl`, `blur-sm`, `blur-lg` |\r\n| Motion | `ease-spring` (enter and press), `ease-standard`, `ease-in`, `ease-out`; `duration-instant`, `-fast`, `-normal`, `-slow` (0ms under reduced motion) |\r\n| Sizes | `h-control-sm`, `-md`, `-lg` (and `w-`, `min-h-`, …), `size-target` (the 24px minimum pointer target), `max-w-xs` to `max-w-2xl` and `@xs:` to `@2xl:` container queries |\r\n| Layers | `z-sticky`, `z-overlay`, `z-modal`, `z-popover`, `z-dropdown`, `z-toast`, `z-tooltip` |\r\n| Dark mode | `dark:` follows `data-theme=\"dark\"`, not the OS setting. |\r\n\r\nTailwind's numeric spacing (`p-4` = 1rem) already matches the 4px token scale, and the breakpoints (`sm:` to `2xl:`) are the same as Tailwind's.\r\n\r\nSome Tailwind names change meaning with the preset: `rounded-*`, `shadow-*`, `blur-sm`/`-lg`, `ease-in`/`-out`, `font-mono`, `font-medium` to `font-black`, `leading-*`, and the `text-*` sizes take the library's values (for example, `rounded-md` is 12px and `font-black` is 800). So do the containers: `max-w-md` and `@md:` are 48rem, not Tailwind's 28rem. The library's stylesheet already gives some of these names its own values once it's loaded, even without the preset; the preset keeps the utilities and the container queries consistent.\r\n\r\nFor text contrast, use the pairs the components use: `text-text` or `text-text-muted` on `bg-bg`, `bg-surface`, and the other surfaces; `text-on-primary` on `bg-primary` (likewise `on-accent`, `on-success`, …); `text-primary-subtle-text` on `bg-primary-subtle` (likewise for each tone). These pairs meet WCAG 2.2 AA in both themes and every brand. Don't use accent or chart colors for text.\r\n\r\nThe preset doesn't change the components, and Tailwind's preflight (its CSS reset) doesn't override them, whichever stylesheet loads first."
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"id": "languages",
|
|
34
34
|
"title": "Languages",
|
|
35
|
-
"markdown": "Components have built-in text: button names like \"Close\" and \"Next page\", screen-reader announcements like \"3 results available\", validation messages, and date formats. Wrap your app in `LocaleProvider` to show all of it in another language:\n\n```tsx\nimport { LocaleProvider } from \"@vjdesigns/vjdesigns-ui\";\nimport es from \"@vjdesigns/vjdesigns-ui/locales/es\";\n\n<LocaleProvider locale=\"es\" messages={es}>\n <App />\n</LocaleProvider>\n```\n\n`LocaleProvider` sets:\n\n- **Built-in text** for every component, from `messages`.\n- **Dates and numbers** in the locale's format (`23/10/2026`, `1.234,5`), and plurals that follow the language's rules.\n- **Writing direction**: Arabic, Hebrew, Persian, and Urdu get `dir=\"rtl\"`, and layouts and arrow keys mirror.\n- **`lang`** on its wrapper, so screen readers pronounce the text correctly. Popups (menus, dialogs, tooltips) keep the language of the area that opened them.\n\nEach locale is a separate import, so your app only downloads the languages it uses. Without a `LocaleProvider`, components use English text and the browser's date and number format.\n\nThis library only translates its own built-in text. Text your app passes in, like `<Button>Save</Button>`, is your app's content: translate it with your app's i18n library (react-i18next, FormatJS, and so on).\n\n### What gets translated\n\nThe language is never picked automatically from where the user lives or their browser settings. Your app chooses it by rendering a `LocaleProvider`. For example, with `<LocaleProvider locale=\"de\" messages={de}>`:\n\n| | Translated? |\n| --- | --- |\n| Text your app passes in, like `<Button>Save</Button>` | No: your app translates it |\n| Built-in names, like \"Close\", \"Next page\", \"Clear search\" | Yes: \"Schließen\", \"Nächste Seite\", \"Suche löschen\" |\n| Screen-reader announcements, like \"3 results available\" | Yes: \"3 Ergebnisse verfügbar\" |\n| Validation messages, empty states, file-upload prompts | Yes |\n| Dates and numbers | Yes: \"23.10.2026\", \"4,5\" |\n\nTo follow the user's browser language, pass it yourself: `locale={navigator.language}` together with the matching `messages` (see [Switching language at runtime](#switching-language-at-runtime)).\n\n### Bundled languages\n\n`ar` Arabic · `bn` Bengali · `cs` Czech · `da` Danish · `de` German · `el` Greek · `es` Spanish · `fa` Persian · `fi` Finnish · `fr` French · `he` Hebrew · `hi` Hindi · `hu` Hungarian · `id` Indonesian · `it` Italian · `ja` Japanese · `ko` Korean · `nb` Norwegian Bokmål · `nl` Dutch · `pl` Polish · `pt-BR` Portuguese (Brazil) · `ro` Romanian · `ru` Russian · `sv` Swedish · `th` Thai · `tr` Turkish · `uk` Ukrainian · `ur` Urdu · `vi` Vietnamese · `zh-Hans` Chinese (Simplified) · `zh-Hant` Chinese (Traditional), plus English (the default).\n\nThe translations are machine-generated and haven't been reviewed by native speakers yet. If you find a wrong or awkward phrase, override it (below) and report it so the bundled locale can be fixed. (Working on the library itself? See [Translating built-in text](#translating-built-in-text).)\n\n### Changing a few strings\n\nPass only the strings you want to change. Everything else falls back to the outer provider's language (English at the top):\n\n```tsx\n<LocaleProvider locale=\"en-GB\" messages={{ pagination: { next: \"Onwards\" } }}>\n```\n\nProviders nest, so an inner provider can switch the language for one part of the page. Per-component props such as `clearLabel` or `labels` still win over the provider.\n\n### Other languages\n\nFor a language that isn't bundled, write a complete messages object. TypeScript flags any missing string. Use English as the template:\n\n```ts\nimport { en, plural, type Messages } from \"@vjdesigns/vjdesigns-ui\";\n\nconst p = plural(\"sw\");\nexport const sw: Messages = {\n ...en,\n pagination: { ...en.pagination, next: \"Ukurasa unaofuata\", previous: \"Ukurasa uliopita\" },\n searchInput: {\n ...en.searchInput,\n results: (count) => p(count, { \"=0\": \"Hakuna matokeo\", one: \"Tokeo #\", other: \"Matokeo #\" }),\n },\n // ...\n};\n```\n\n`plural(locale)` picks the right plural form for any language (`#` is the formatted number).\n\n### Switching language at runtime\n\nList the languages your app offers as loaders, so each one is downloaded only when picked:\n\n```tsx\nimport { LocaleProvider, type Messages } from \"@vjdesigns/vjdesigns-ui\";\n\nconst loaders: Record<string, () => Promise<{ default: Messages }>> = {\n es: () => import(\"@vjdesigns/vjdesigns-ui/locales/es\"),\n fr: () => import(\"@vjdesigns/vjdesigns-ui/locales/fr\"),\n ar: () => import(\"@vjdesigns/vjdesigns-ui/locales/ar\"),\n};\n\nfunction App({ lang }: { lang: string }) {\n const [messages, setMessages] = useState<Messages>();\n useEffect(() => {\n const load = loaders[lang];\n if (load) load().then((mod) => setMessages(mod.default));\n else setMessages(undefined); // English\n }, [lang]);\n // Until a language loads, the previous one (or English) shows.\n return <LocaleProvider locale={lang} messages={messages}>…</LocaleProvider>;\n}\n```\n\nFor server rendering, also set `<html lang=\"…\" dir=\"…\">` on the page. `getLocaleDirection(locale)` returns `\"ltr\"` or `\"rtl\"`."
|
|
35
|
+
"markdown": "Components have built-in text: button names like \"Close\" and \"Next page\", screen-reader announcements like \"3 results available\", validation messages, and date formats. Wrap your app in `LocaleProvider` to show all of it in another language:\r\n\r\n```tsx\r\nimport { LocaleProvider } from \"@vjdesigns/vjdesigns-ui\";\r\nimport es from \"@vjdesigns/vjdesigns-ui/locales/es\";\r\n\r\n<LocaleProvider locale=\"es\" messages={es}>\r\n <App />\r\n</LocaleProvider>\r\n```\r\n\r\n`LocaleProvider` sets:\r\n\r\n- **Built-in text** for every component, from `messages`.\r\n- **Dates and numbers** in the locale's format (`23/10/2026`, `1.234,5`), and plurals that follow the language's rules.\r\n- **Writing direction**: Arabic, Hebrew, Persian, and Urdu get `dir=\"rtl\"`, and layouts and arrow keys mirror.\r\n- **`lang`** on its wrapper, so screen readers pronounce the text correctly. Popups (menus, dialogs, tooltips) keep the language of the area that opened them.\r\n\r\nEach locale is a separate import, so your app only downloads the languages it uses. Without a `LocaleProvider`, components use English text and the browser's date and number format.\r\n\r\nThis library only translates its own built-in text. Text your app passes in, like `<Button>Save</Button>`, is your app's content: translate it with your app's i18n library (react-i18next, FormatJS, and so on).\r\n\r\n### What gets translated\r\n\r\nThe language is never picked automatically from where the user lives or their browser settings. Your app chooses it by rendering a `LocaleProvider`. For example, with `<LocaleProvider locale=\"de\" messages={de}>`:\r\n\r\n| | Translated? |\r\n| --- | --- |\r\n| Text your app passes in, like `<Button>Save</Button>` | No: your app translates it |\r\n| Built-in names, like \"Close\", \"Next page\", \"Clear search\" | Yes: \"Schließen\", \"Nächste Seite\", \"Suche löschen\" |\r\n| Screen-reader announcements, like \"3 results available\" | Yes: \"3 Ergebnisse verfügbar\" |\r\n| Validation messages, empty states, file-upload prompts | Yes |\r\n| Dates and numbers | Yes: \"23.10.2026\", \"4,5\" |\r\n\r\nTo follow the user's browser language, pass it yourself: `locale={navigator.language}` together with the matching `messages` (see [Switching language at runtime](#switching-language-at-runtime)).\r\n\r\n### Bundled languages\r\n\r\n`ar` Arabic · `bn` Bengali · `cs` Czech · `da` Danish · `de` German · `el` Greek · `es` Spanish · `fa` Persian · `fi` Finnish · `fr` French · `he` Hebrew · `hi` Hindi · `hu` Hungarian · `id` Indonesian · `it` Italian · `ja` Japanese · `ko` Korean · `nb` Norwegian Bokmål · `nl` Dutch · `pl` Polish · `pt-BR` Portuguese (Brazil) · `ro` Romanian · `ru` Russian · `sv` Swedish · `th` Thai · `tr` Turkish · `uk` Ukrainian · `ur` Urdu · `vi` Vietnamese · `zh-Hans` Chinese (Simplified) · `zh-Hant` Chinese (Traditional), plus English (the default).\r\n\r\nThe translations are machine-generated and haven't been reviewed by native speakers yet. If you find a wrong or awkward phrase, override it (below) and report it so the bundled locale can be fixed. (Working on the library itself? See [Translating built-in text](#translating-built-in-text).)\r\n\r\n### Changing a few strings\r\n\r\nPass only the strings you want to change. Everything else falls back to the outer provider's language (English at the top):\r\n\r\n```tsx\r\n<LocaleProvider locale=\"en-GB\" messages={{ pagination: { next: \"Onwards\" } }}>\r\n```\r\n\r\nProviders nest, so an inner provider can switch the language for one part of the page. Per-component props such as `clearLabel` or `labels` still win over the provider.\r\n\r\n### Other languages\r\n\r\nFor a language that isn't bundled, write a complete messages object. TypeScript flags any missing string. Use English as the template:\r\n\r\n```ts\r\nimport { en, plural, type Messages } from \"@vjdesigns/vjdesigns-ui\";\r\n\r\nconst p = plural(\"sw\");\r\nexport const sw: Messages = {\r\n ...en,\r\n pagination: { ...en.pagination, next: \"Ukurasa unaofuata\", previous: \"Ukurasa uliopita\" },\r\n searchInput: {\r\n ...en.searchInput,\r\n results: (count) => p(count, { \"=0\": \"Hakuna matokeo\", one: \"Tokeo #\", other: \"Matokeo #\" }),\r\n },\r\n // ...\r\n};\r\n```\r\n\r\n`plural(locale)` picks the right plural form for any language (`#` is the formatted number).\r\n\r\n### Switching language at runtime\r\n\r\nList the languages your app offers as loaders, so each one is downloaded only when picked:\r\n\r\n```tsx\r\nimport { LocaleProvider, type Messages } from \"@vjdesigns/vjdesigns-ui\";\r\n\r\nconst loaders: Record<string, () => Promise<{ default: Messages }>> = {\r\n es: () => import(\"@vjdesigns/vjdesigns-ui/locales/es\"),\r\n fr: () => import(\"@vjdesigns/vjdesigns-ui/locales/fr\"),\r\n ar: () => import(\"@vjdesigns/vjdesigns-ui/locales/ar\"),\r\n};\r\n\r\nfunction App({ lang }: { lang: string }) {\r\n const [messages, setMessages] = useState<Messages>();\r\n useEffect(() => {\r\n const load = loaders[lang];\r\n if (load) load().then((mod) => setMessages(mod.default));\r\n else setMessages(undefined); // English\r\n }, [lang]);\r\n // Until a language loads, the previous one (or English) shows.\r\n return <LocaleProvider locale={lang} messages={messages}>…</LocaleProvider>;\r\n}\r\n```\r\n\r\nFor server rendering, also set `<html lang=\"…\" dir=\"…\">` on the page. `getLocaleDirection(locale)` returns `\"ltr\"` or `\"rtl\"`."
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"id": "validation",
|
|
39
39
|
"title": "Form validation",
|
|
40
|
-
"markdown": "> **Front-end validation is not security.** It helps people fill in a form correctly, but anyone can turn off JavaScript or send requests straight to your server. Always validate again on the server. The format checks below (`isEmail`, `isIP`, …) are plain functions you can reuse there.\n\n`useFormValidation` checks a form when it's submitted, using the browser's own rules on each input (`required`, `type=\"email\"`, `minLength`, `pattern`, `min` / `max`) plus any rules you add. Messages follow the current language.\n\n```tsx\nimport {\n useFormValidation, rules, ErrorSummary, Field, Input, PasswordInput, Button,\n} from \"@vjdesigns/vjdesigns-ui\";\n\nfunction SignUp() {\n const form = useFormValidation({\n rules: {\n confirm: rules.matches(\"password\", \"The passwords don't match.\"),\n serverIp: rules.ip(), // IPv4 or IPv6\n },\n // Runs only when everything is valid. Return the server's errors to show them on their fields.\n onValid: async (values) => {\n const response = await api.signUp(values);\n return response.errors; // e.g. { username: \"That username is taken.\" }\n },\n });\n\n return (\n <form {...form.formProps}>\n <ErrorSummary ref={form.summaryRef} errors={form.errorList} />\n <Field label=\"Email\" required error={form.errors.email}>\n <Input name=\"email\" type=\"email\" />\n </Field>\n <Field label=\"Password\" required error={form.errors.password}>\n <PasswordInput name=\"password\" minLength={12} />\n </Field>\n <Field label=\"Confirm password\" required error={form.errors.confirm}>\n <PasswordInput name=\"confirm\" />\n </Field>\n <Field label=\"Server IP\" error={form.errors.serverIp}>\n <Input name=\"serverIp\" />\n </Field>\n <Button type=\"submit\" loading={form.isSubmitting}>Create account</Button>\n </form>\n );\n}\n```\n\nHow it behaves:\n\n- **On submit**, every field is checked. If anything is wrong, the `ErrorSummary` at the top lists the problems and takes focus, so screen readers announce it. Each item links to its field. Without a summary, focus goes to the first invalid field.\n- **Errors are keyed by the field's `name`.** Pass `form.errors.<name>` to each `Field`'s `error`.\n- **After a failed submit**, an error disappears as soon as the field is fixed (while typing), and a field is fully re-checked when you leave it. It doesn't nag while you're still typing.\n- **Server errors** (returned from `onValid`, or set with `form.setErrors({...})`) show on their fields and stay until that field is edited.\n- **Emails** must have a real domain (`name@example.com`). The browser's own check also accepts `name@localhost`.\n\n### Rules and format checks\n\n| Rule | Checks |\n| --- | --- |\n| `rules.required()` | Not empty (for controls without a native `required`) |\n| `rules.email()` | An email address in the usual format, with a top-level domain |\n| `rules.ip()` / `rules.ip({ version: 4 })` / `rules.ip({ version: 6 })` | An IPv4 or IPv6 address |\n| `rules.minLength(n)` / `rules.maxLength(n)` | Length in characters |\n| `rules.pattern(/regex/, \"message\")` | The whole value matches |\n| `rules.matches(\"otherField\")` | Equals another field (confirm password) |\n| your own `(value, { values }) => message` | Anything else |\n\nEach rule takes an optional custom message. The checks behind them are exported for use anywhere, including your server:\n\n- `isEmail(value)`\n- `isIPv4(value)`: four numbers 0–255, no leading zeros\n- `isIPv6(value)`: including `::` shorthand and IPv4 tails like `::ffff:192.168.0.1`\n- `isIP(value, version?)`"
|
|
40
|
+
"markdown": "> **Front-end validation is not security.** It helps people fill in a form correctly, but anyone can turn off JavaScript or send requests straight to your server. Always validate again on the server. The format checks below (`isEmail`, `isIP`, …) are plain functions you can reuse there.\r\n\r\n`useFormValidation` checks a form when it's submitted, using the browser's own rules on each input (`required`, `type=\"email\"`, `minLength`, `pattern`, `min` / `max`) plus any rules you add. Messages follow the current language.\r\n\r\n```tsx\r\nimport {\r\n useFormValidation, rules, ErrorSummary, Field, Input, PasswordInput, Button,\r\n} from \"@vjdesigns/vjdesigns-ui\";\r\n\r\nfunction SignUp() {\r\n const form = useFormValidation({\r\n rules: {\r\n confirm: rules.matches(\"password\", \"The passwords don't match.\"),\r\n serverIp: rules.ip(), // IPv4 or IPv6\r\n },\r\n // Runs only when everything is valid. Return the server's errors to show them on their fields.\r\n onValid: async (values) => {\r\n const response = await api.signUp(values);\r\n return response.errors; // e.g. { username: \"That username is taken.\" }\r\n },\r\n });\r\n\r\n return (\r\n <form {...form.formProps}>\r\n <ErrorSummary ref={form.summaryRef} errors={form.errorList} />\r\n <Field label=\"Email\" required error={form.errors.email}>\r\n <Input name=\"email\" type=\"email\" />\r\n </Field>\r\n <Field label=\"Password\" required error={form.errors.password}>\r\n <PasswordInput name=\"password\" minLength={12} />\r\n </Field>\r\n <Field label=\"Confirm password\" required error={form.errors.confirm}>\r\n <PasswordInput name=\"confirm\" />\r\n </Field>\r\n <Field label=\"Server IP\" error={form.errors.serverIp}>\r\n <Input name=\"serverIp\" />\r\n </Field>\r\n <Button type=\"submit\" loading={form.isSubmitting}>Create account</Button>\r\n </form>\r\n );\r\n}\r\n```\r\n\r\nHow it behaves:\r\n\r\n- **On submit**, every field is checked. If anything is wrong, the `ErrorSummary` at the top lists the problems and takes focus, so screen readers announce it. Each item links to its field. Without a summary, focus goes to the first invalid field.\r\n- **Errors are keyed by the field's `name`.** Pass `form.errors.<name>` to each `Field`'s `error`.\r\n- **After a failed submit**, an error disappears as soon as the field is fixed (while typing), and a field is fully re-checked when you leave it. It doesn't nag while you're still typing.\r\n- **Server errors** (returned from `onValid`, or set with `form.setErrors({...})`) show on their fields and stay until that field is edited.\r\n- **Emails** must have a real domain (`name@example.com`). The browser's own check also accepts `name@localhost`.\r\n\r\n### Rules and format checks\r\n\r\n| Rule | Checks |\r\n| --- | --- |\r\n| `rules.required()` | Not empty (for controls without a native `required`) |\r\n| `rules.email()` | An email address in the usual format, with a top-level domain |\r\n| `rules.ip()` / `rules.ip({ version: 4 })` / `rules.ip({ version: 6 })` | An IPv4 or IPv6 address |\r\n| `rules.minLength(n)` / `rules.maxLength(n)` | Length in characters |\r\n| `rules.pattern(/regex/, \"message\")` | The whole value matches |\r\n| `rules.matches(\"otherField\")` | Equals another field (confirm password) |\r\n| your own `(value, { values }) => message` | Anything else |\r\n\r\nEach rule takes an optional custom message. The checks behind them are exported for use anywhere, including your server:\r\n\r\n- `isEmail(value)`\r\n- `isIPv4(value)`: four numbers 0–255, no leading zeros\r\n- `isIPv6(value)`: including `::` shorthand and IPv4 tails like `::ffff:192.168.0.1`\r\n- `isIP(value, version?)`"
|
|
41
41
|
}
|
|
42
42
|
],
|
|
43
43
|
"components": [
|
|
@@ -3492,6 +3492,486 @@
|
|
|
3492
3492
|
}
|
|
3493
3493
|
]
|
|
3494
3494
|
},
|
|
3495
|
+
{
|
|
3496
|
+
"name": "Poll",
|
|
3497
|
+
"category": "data-display",
|
|
3498
|
+
"folder": "Poll",
|
|
3499
|
+
"import": "import { Poll } from \"@vjdesigns/vjdesigns-ui\";",
|
|
3500
|
+
"description": "A poll with two phases: voting (a question with choices) and results\r\n(each choice's share, printed as a percentage, with bars). Four layouts:\r\n`bars`, `cards`, `compact`, and `versus` for two choices head to head.\r\nThe poll is UI only: it reports votes through `onVote` and shows the\r\ncounts you pass in `options`; storing votes and enforcing one vote per\r\nperson is up to your server.",
|
|
3501
|
+
"nativeElement": "div",
|
|
3502
|
+
"props": [
|
|
3503
|
+
{
|
|
3504
|
+
"name": "question",
|
|
3505
|
+
"type": "ReactNode",
|
|
3506
|
+
"required": true,
|
|
3507
|
+
"description": "The question, rendered as a heading (see `headingLevel`)."
|
|
3508
|
+
},
|
|
3509
|
+
{
|
|
3510
|
+
"name": "options",
|
|
3511
|
+
"type": "PollOption[]",
|
|
3512
|
+
"required": true,
|
|
3513
|
+
"description": "The choices, with their vote counts. Update `votes` after `onVote`, including the new vote."
|
|
3514
|
+
},
|
|
3515
|
+
{
|
|
3516
|
+
"name": "layout",
|
|
3517
|
+
"type": "PollLayout",
|
|
3518
|
+
"required": false,
|
|
3519
|
+
"default": "\"bars\"",
|
|
3520
|
+
"description": "Layout of both phases. `versus` needs exactly two options."
|
|
3521
|
+
},
|
|
3522
|
+
{
|
|
3523
|
+
"name": "multiple",
|
|
3524
|
+
"type": "boolean",
|
|
3525
|
+
"required": false,
|
|
3526
|
+
"default": "false",
|
|
3527
|
+
"description": "Allow more than one choice (checkboxes)."
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
"name": "maxChoices",
|
|
3531
|
+
"type": "number",
|
|
3532
|
+
"required": false,
|
|
3533
|
+
"description": "With `multiple`: the most choices one voter can pick."
|
|
3534
|
+
},
|
|
3535
|
+
{
|
|
3536
|
+
"name": "value",
|
|
3537
|
+
"type": "string[]",
|
|
3538
|
+
"required": false,
|
|
3539
|
+
"description": "The viewer's choice (controlled). After voting, it marks \"Your vote\" in the results."
|
|
3540
|
+
},
|
|
3541
|
+
{
|
|
3542
|
+
"name": "defaultValue",
|
|
3543
|
+
"type": "string[]",
|
|
3544
|
+
"required": false,
|
|
3545
|
+
"default": "[]",
|
|
3546
|
+
"description": "Initial choice (uncontrolled)."
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
"name": "onValueChange",
|
|
3550
|
+
"type": "(value: string[]) => void",
|
|
3551
|
+
"required": false,
|
|
3552
|
+
"description": "Called when the viewer's choice changes, before or as they vote."
|
|
3553
|
+
},
|
|
3554
|
+
{
|
|
3555
|
+
"name": "voted",
|
|
3556
|
+
"type": "boolean",
|
|
3557
|
+
"required": false,
|
|
3558
|
+
"description": "Whether the viewer has voted (controlled). Use with `onVotedChange`."
|
|
3559
|
+
},
|
|
3560
|
+
{
|
|
3561
|
+
"name": "defaultVoted",
|
|
3562
|
+
"type": "boolean",
|
|
3563
|
+
"required": false,
|
|
3564
|
+
"default": "false",
|
|
3565
|
+
"description": "Initial voted state (uncontrolled), e.g. `true` when the server says they already voted."
|
|
3566
|
+
},
|
|
3567
|
+
{
|
|
3568
|
+
"name": "onVotedChange",
|
|
3569
|
+
"type": "(voted: boolean) => void",
|
|
3570
|
+
"required": false,
|
|
3571
|
+
"description": "Called when the voted state changes (after a vote, or on \"Change vote\")."
|
|
3572
|
+
},
|
|
3573
|
+
{
|
|
3574
|
+
"name": "onVote",
|
|
3575
|
+
"type": "(values: string[]) => void | Promise<void>",
|
|
3576
|
+
"required": false,
|
|
3577
|
+
"description": "Called with the chosen values when the viewer votes. Return a promise to\r\nshow a loading state; if it rejects, the poll stays in the voting phase\r\n(show your own error message)."
|
|
3578
|
+
},
|
|
3579
|
+
{
|
|
3580
|
+
"name": "submitMode",
|
|
3581
|
+
"type": "PollSubmitMode",
|
|
3582
|
+
"required": false,
|
|
3583
|
+
"default": "\"instant\" for a single choice, \"button\" with `multiple",
|
|
3584
|
+
"description": "`button`: choose, then press Vote. `instant`: clicking a choice votes\r\n(single choice only; each choice is a button)."
|
|
3585
|
+
},
|
|
3586
|
+
{
|
|
3587
|
+
"name": "showResults",
|
|
3588
|
+
"type": "PollShowResults",
|
|
3589
|
+
"required": false,
|
|
3590
|
+
"default": "\"after-vote\"",
|
|
3591
|
+
"description": "When results show: `after-vote`, `always` (results only, no voting), or\r\n`never` (only once the poll is closed, which avoids bandwagon voting)."
|
|
3592
|
+
},
|
|
3593
|
+
{
|
|
3594
|
+
"name": "closed",
|
|
3595
|
+
"type": "boolean",
|
|
3596
|
+
"required": false,
|
|
3597
|
+
"default": "false",
|
|
3598
|
+
"description": "The poll is over: voting is off and the final results show. Also true once `endsAt` passes."
|
|
3599
|
+
},
|
|
3600
|
+
{
|
|
3601
|
+
"name": "endsAt",
|
|
3602
|
+
"type": "string",
|
|
3603
|
+
"required": false,
|
|
3604
|
+
"description": "When voting ends: an ISO date (\"2026-12-01\", the end of that day) or date-time. Shown as \"Ends in 3 days\"."
|
|
3605
|
+
},
|
|
3606
|
+
{
|
|
3607
|
+
"name": "totalVotes",
|
|
3608
|
+
"type": "number",
|
|
3609
|
+
"required": false,
|
|
3610
|
+
"description": "Total votes, when it differs from the sum of `votes` (e.g. multiple choice counts voters)."
|
|
3611
|
+
},
|
|
3612
|
+
{
|
|
3613
|
+
"name": "allowChangeVote",
|
|
3614
|
+
"type": "boolean",
|
|
3615
|
+
"required": false,
|
|
3616
|
+
"default": "false",
|
|
3617
|
+
"description": "Show a \"Change vote\" button in the results while the poll is open."
|
|
3618
|
+
},
|
|
3619
|
+
{
|
|
3620
|
+
"name": "highlightWinner",
|
|
3621
|
+
"type": "boolean",
|
|
3622
|
+
"required": false,
|
|
3623
|
+
"default": "true",
|
|
3624
|
+
"description": "Mark the sole leader with a \"Leading\" (or \"Winner\") tag and bold label."
|
|
3625
|
+
},
|
|
3626
|
+
{
|
|
3627
|
+
"name": "headingLevel",
|
|
3628
|
+
"type": "2 | 3 | 4 | 5 | 6",
|
|
3629
|
+
"required": false,
|
|
3630
|
+
"default": "3",
|
|
3631
|
+
"description": "Heading level of the question."
|
|
3632
|
+
},
|
|
3633
|
+
{
|
|
3634
|
+
"name": "size",
|
|
3635
|
+
"type": "Size",
|
|
3636
|
+
"required": false,
|
|
3637
|
+
"default": "\"md\"",
|
|
3638
|
+
"description": "Text and control size."
|
|
3639
|
+
},
|
|
3640
|
+
{
|
|
3641
|
+
"name": "labels",
|
|
3642
|
+
"type": "Partial<{ vote: string; changeVote: string; yourVote: string; leading: string; winner: string; finalResults: string; versus: string; }>",
|
|
3643
|
+
"required": false,
|
|
3644
|
+
"description": "Overrides the built-in text (vote button, tags, footer, announcements). Localize it here."
|
|
3645
|
+
}
|
|
3646
|
+
],
|
|
3647
|
+
"subcomponents": [],
|
|
3648
|
+
"storybook": "Data Display/Poll",
|
|
3649
|
+
"stories": [
|
|
3650
|
+
{
|
|
3651
|
+
"name": "Playground",
|
|
3652
|
+
"description": ""
|
|
3653
|
+
},
|
|
3654
|
+
{
|
|
3655
|
+
"name": "Bars",
|
|
3656
|
+
"description": ""
|
|
3657
|
+
},
|
|
3658
|
+
{
|
|
3659
|
+
"name": "Cards",
|
|
3660
|
+
"description": ""
|
|
3661
|
+
},
|
|
3662
|
+
{
|
|
3663
|
+
"name": "Compact",
|
|
3664
|
+
"description": ""
|
|
3665
|
+
},
|
|
3666
|
+
{
|
|
3667
|
+
"name": "Versus",
|
|
3668
|
+
"description": ""
|
|
3669
|
+
},
|
|
3670
|
+
{
|
|
3671
|
+
"name": "All Layouts",
|
|
3672
|
+
"description": ""
|
|
3673
|
+
},
|
|
3674
|
+
{
|
|
3675
|
+
"name": "Sizes",
|
|
3676
|
+
"description": ""
|
|
3677
|
+
},
|
|
3678
|
+
{
|
|
3679
|
+
"name": "Multiple Choice",
|
|
3680
|
+
"description": ""
|
|
3681
|
+
},
|
|
3682
|
+
{
|
|
3683
|
+
"name": "Async vote (loading and failure)",
|
|
3684
|
+
"description": ""
|
|
3685
|
+
},
|
|
3686
|
+
{
|
|
3687
|
+
"name": "Hidden Until Closed",
|
|
3688
|
+
"description": ""
|
|
3689
|
+
},
|
|
3690
|
+
{
|
|
3691
|
+
"name": "Closed",
|
|
3692
|
+
"description": ""
|
|
3693
|
+
},
|
|
3694
|
+
{
|
|
3695
|
+
"name": "Ended By Date",
|
|
3696
|
+
"description": ""
|
|
3697
|
+
},
|
|
3698
|
+
{
|
|
3699
|
+
"name": "Tie",
|
|
3700
|
+
"description": ""
|
|
3701
|
+
},
|
|
3702
|
+
{
|
|
3703
|
+
"name": "No Votes Yet",
|
|
3704
|
+
"description": ""
|
|
3705
|
+
},
|
|
3706
|
+
{
|
|
3707
|
+
"name": "Long Content",
|
|
3708
|
+
"description": ""
|
|
3709
|
+
},
|
|
3710
|
+
{
|
|
3711
|
+
"name": "computePollResults()",
|
|
3712
|
+
"description": ""
|
|
3713
|
+
}
|
|
3714
|
+
]
|
|
3715
|
+
},
|
|
3716
|
+
{
|
|
3717
|
+
"name": "RatingBreakdown",
|
|
3718
|
+
"category": "data-display",
|
|
3719
|
+
"folder": "RatingBreakdown",
|
|
3720
|
+
"import": "import { RatingBreakdown } from \"@vjdesigns/vjdesigns-ui\";",
|
|
3721
|
+
"description": "The summary above a review list: the average rating as a big number with\r\nstars, the review count, and one bar per level showing its share. Each\r\nrow reads \"5 stars: 920 reviews, 72%\"; with `onLevelSelect` the rows are\r\ntoggle buttons for filtering by level.",
|
|
3722
|
+
"nativeElement": "div",
|
|
3723
|
+
"props": [
|
|
3724
|
+
{
|
|
3725
|
+
"name": "counts",
|
|
3726
|
+
"type": "Record<number, number>",
|
|
3727
|
+
"required": true,
|
|
3728
|
+
"description": "Reviews per level, e.g. `{ 5: 920, 4: 210, 3: 80, 2: 40, 1: 34 }`. Missing levels count as 0."
|
|
3729
|
+
},
|
|
3730
|
+
{
|
|
3731
|
+
"name": "average",
|
|
3732
|
+
"type": "number",
|
|
3733
|
+
"required": false,
|
|
3734
|
+
"description": "The average rating. Computed from `counts` when omitted."
|
|
3735
|
+
},
|
|
3736
|
+
{
|
|
3737
|
+
"name": "total",
|
|
3738
|
+
"type": "number",
|
|
3739
|
+
"required": false,
|
|
3740
|
+
"description": "Total reviews. The sum of `counts` when omitted."
|
|
3741
|
+
},
|
|
3742
|
+
{
|
|
3743
|
+
"name": "max",
|
|
3744
|
+
"type": "number",
|
|
3745
|
+
"required": false,
|
|
3746
|
+
"default": "5",
|
|
3747
|
+
"description": "The highest level (number of stars)."
|
|
3748
|
+
},
|
|
3749
|
+
{
|
|
3750
|
+
"name": "onLevelSelect",
|
|
3751
|
+
"type": "(level: number | null) => void",
|
|
3752
|
+
"required": false,
|
|
3753
|
+
"description": "Called when a level row is pressed, with that level, or `null` when the\r\npressed row is pressed again. Turns each row into a toggle button for\r\nfiltering a review list."
|
|
3754
|
+
},
|
|
3755
|
+
{
|
|
3756
|
+
"name": "selectedLevel",
|
|
3757
|
+
"type": "number | null",
|
|
3758
|
+
"required": false,
|
|
3759
|
+
"description": "The level currently filtered on (shown pressed). Use with `onLevelSelect`."
|
|
3760
|
+
},
|
|
3761
|
+
{
|
|
3762
|
+
"name": "recommendPercent",
|
|
3763
|
+
"type": "number",
|
|
3764
|
+
"required": false,
|
|
3765
|
+
"description": "Share of reviewers who would recommend, 0 to 100. Shown as \"92% would recommend\"."
|
|
3766
|
+
},
|
|
3767
|
+
{
|
|
3768
|
+
"name": "layout",
|
|
3769
|
+
"type": "RatingBreakdownLayout",
|
|
3770
|
+
"required": false,
|
|
3771
|
+
"default": "\"stacked\"",
|
|
3772
|
+
"description": "`stacked`: the average above the bars. `inline`: beside them (wraps on narrow screens)."
|
|
3773
|
+
},
|
|
3774
|
+
{
|
|
3775
|
+
"name": "size",
|
|
3776
|
+
"type": "Size",
|
|
3777
|
+
"required": false,
|
|
3778
|
+
"default": "\"md\"",
|
|
3779
|
+
"description": "Text size."
|
|
3780
|
+
}
|
|
3781
|
+
],
|
|
3782
|
+
"subcomponents": [],
|
|
3783
|
+
"storybook": "Data Display/RatingBreakdown",
|
|
3784
|
+
"stories": [
|
|
3785
|
+
{
|
|
3786
|
+
"name": "Playground",
|
|
3787
|
+
"description": ""
|
|
3788
|
+
},
|
|
3789
|
+
{
|
|
3790
|
+
"name": "Stacked",
|
|
3791
|
+
"description": ""
|
|
3792
|
+
},
|
|
3793
|
+
{
|
|
3794
|
+
"name": "Inline",
|
|
3795
|
+
"description": ""
|
|
3796
|
+
},
|
|
3797
|
+
{
|
|
3798
|
+
"name": "Filterable",
|
|
3799
|
+
"description": ""
|
|
3800
|
+
},
|
|
3801
|
+
{
|
|
3802
|
+
"name": "Sizes",
|
|
3803
|
+
"description": ""
|
|
3804
|
+
},
|
|
3805
|
+
{
|
|
3806
|
+
"name": "No Reviews",
|
|
3807
|
+
"description": ""
|
|
3808
|
+
},
|
|
3809
|
+
{
|
|
3810
|
+
"name": "Ten Point Scale",
|
|
3811
|
+
"description": ""
|
|
3812
|
+
}
|
|
3813
|
+
]
|
|
3814
|
+
},
|
|
3815
|
+
{
|
|
3816
|
+
"name": "ReviewCard",
|
|
3817
|
+
"category": "data-display",
|
|
3818
|
+
"folder": "ReviewCard",
|
|
3819
|
+
"import": "import { ReviewCard } from \"@vjdesigns/vjdesigns-ui\";",
|
|
3820
|
+
"description": "One customer review: the reviewer with avatar, star rating, date,\r\nverified badge, headline, body (clamped with \"Read more\"), a would-\r\nrecommend indicator, photos, helpful votes, and an owner reply. Rendered\r\nas an `<article>` named by its headline (or the reviewer).",
|
|
3821
|
+
"nativeElement": "article",
|
|
3822
|
+
"props": [
|
|
3823
|
+
{
|
|
3824
|
+
"name": "author",
|
|
3825
|
+
"type": "ReviewAuthor",
|
|
3826
|
+
"required": true,
|
|
3827
|
+
"description": "The reviewer."
|
|
3828
|
+
},
|
|
3829
|
+
{
|
|
3830
|
+
"name": "rating",
|
|
3831
|
+
"type": "number",
|
|
3832
|
+
"required": false,
|
|
3833
|
+
"description": "Star rating, shown with `RatingDisplay`. Omit for a text-only review."
|
|
3834
|
+
},
|
|
3835
|
+
{
|
|
3836
|
+
"name": "max",
|
|
3837
|
+
"type": "number",
|
|
3838
|
+
"required": false,
|
|
3839
|
+
"default": "5",
|
|
3840
|
+
"description": "Highest rating."
|
|
3841
|
+
},
|
|
3842
|
+
{
|
|
3843
|
+
"name": "title",
|
|
3844
|
+
"type": "ReactNode",
|
|
3845
|
+
"required": false,
|
|
3846
|
+
"description": "Review headline, rendered as a heading (see `headingLevel`)."
|
|
3847
|
+
},
|
|
3848
|
+
{
|
|
3849
|
+
"name": "headingLevel",
|
|
3850
|
+
"type": "2 | 3 | 4 | 5 | 6",
|
|
3851
|
+
"required": false,
|
|
3852
|
+
"default": "3",
|
|
3853
|
+
"description": "Heading level of `title`."
|
|
3854
|
+
},
|
|
3855
|
+
{
|
|
3856
|
+
"name": "date",
|
|
3857
|
+
"type": "string",
|
|
3858
|
+
"required": false,
|
|
3859
|
+
"description": "ISO date (\"YYYY-MM-DD\") the review was written. Formatted for the locale in a `<time>`."
|
|
3860
|
+
},
|
|
3861
|
+
{
|
|
3862
|
+
"name": "verified",
|
|
3863
|
+
"type": "boolean",
|
|
3864
|
+
"required": false,
|
|
3865
|
+
"default": "false",
|
|
3866
|
+
"description": "Show a \"Verified purchase\" badge."
|
|
3867
|
+
},
|
|
3868
|
+
{
|
|
3869
|
+
"name": "verifiedLabel",
|
|
3870
|
+
"type": "string",
|
|
3871
|
+
"required": false,
|
|
3872
|
+
"default": "\"Verified purchase\"",
|
|
3873
|
+
"description": "Text of the verified badge, e.g. \"Verified attendee\"."
|
|
3874
|
+
},
|
|
3875
|
+
{
|
|
3876
|
+
"name": "recommend",
|
|
3877
|
+
"type": "boolean",
|
|
3878
|
+
"required": false,
|
|
3879
|
+
"description": "`true`: thumbs up \"Recommends\". `false`: thumbs down \"Doesn't recommend\". Omit to show neither."
|
|
3880
|
+
},
|
|
3881
|
+
{
|
|
3882
|
+
"name": "children",
|
|
3883
|
+
"type": "ReactNode",
|
|
3884
|
+
"required": false,
|
|
3885
|
+
"description": "The review body. Long text is clamped to `maxLines` with a \"Read more\" button."
|
|
3886
|
+
},
|
|
3887
|
+
{
|
|
3888
|
+
"name": "maxLines",
|
|
3889
|
+
"type": "number",
|
|
3890
|
+
"required": false,
|
|
3891
|
+
"default": "5",
|
|
3892
|
+
"description": "Lines shown before \"Read more\". `0` never clamps."
|
|
3893
|
+
},
|
|
3894
|
+
{
|
|
3895
|
+
"name": "media",
|
|
3896
|
+
"type": "ReactNode",
|
|
3897
|
+
"required": false,
|
|
3898
|
+
"description": "Photos or other media, shown under the body."
|
|
3899
|
+
},
|
|
3900
|
+
{
|
|
3901
|
+
"name": "helpfulCount",
|
|
3902
|
+
"type": "number",
|
|
3903
|
+
"required": false,
|
|
3904
|
+
"description": "How many people found the review helpful. Shown as \"12 people found this helpful\"."
|
|
3905
|
+
},
|
|
3906
|
+
{
|
|
3907
|
+
"name": "helpful",
|
|
3908
|
+
"type": "boolean | null",
|
|
3909
|
+
"required": false,
|
|
3910
|
+
"description": "The viewer's helpful vote (controlled): `true` yes, `false` no, `null` none."
|
|
3911
|
+
},
|
|
3912
|
+
{
|
|
3913
|
+
"name": "defaultHelpful",
|
|
3914
|
+
"type": "boolean | null",
|
|
3915
|
+
"required": false,
|
|
3916
|
+
"default": "null",
|
|
3917
|
+
"description": "Initial helpful vote (uncontrolled)."
|
|
3918
|
+
},
|
|
3919
|
+
{
|
|
3920
|
+
"name": "onHelpfulChange",
|
|
3921
|
+
"type": "(helpful: boolean | null) => void",
|
|
3922
|
+
"required": false,
|
|
3923
|
+
"description": "Called with the viewer's helpful vote. Setting it shows \"Helpful? Yes / No\"\r\ntoggle buttons; pressing the pressed one again clears it (`null`)."
|
|
3924
|
+
},
|
|
3925
|
+
{
|
|
3926
|
+
"name": "response",
|
|
3927
|
+
"type": "ReviewResponse",
|
|
3928
|
+
"required": false,
|
|
3929
|
+
"description": "An owner or seller reply, shown indented under the review."
|
|
3930
|
+
},
|
|
3931
|
+
{
|
|
3932
|
+
"name": "actions",
|
|
3933
|
+
"type": "ReactNode",
|
|
3934
|
+
"required": false,
|
|
3935
|
+
"description": "Extra actions in the footer, e.g. Report or Share buttons."
|
|
3936
|
+
}
|
|
3937
|
+
],
|
|
3938
|
+
"subcomponents": [],
|
|
3939
|
+
"storybook": "Data Display/ReviewCard",
|
|
3940
|
+
"stories": [
|
|
3941
|
+
{
|
|
3942
|
+
"name": "Playground",
|
|
3943
|
+
"description": ""
|
|
3944
|
+
},
|
|
3945
|
+
{
|
|
3946
|
+
"name": "Complete",
|
|
3947
|
+
"description": ""
|
|
3948
|
+
},
|
|
3949
|
+
{
|
|
3950
|
+
"name": "Long Review Read More",
|
|
3951
|
+
"description": ""
|
|
3952
|
+
},
|
|
3953
|
+
{
|
|
3954
|
+
"name": "Short Review No Clamp",
|
|
3955
|
+
"description": ""
|
|
3956
|
+
},
|
|
3957
|
+
{
|
|
3958
|
+
"name": "Does Not Recommend",
|
|
3959
|
+
"description": ""
|
|
3960
|
+
},
|
|
3961
|
+
{
|
|
3962
|
+
"name": "Text Only",
|
|
3963
|
+
"description": ""
|
|
3964
|
+
},
|
|
3965
|
+
{
|
|
3966
|
+
"name": "With Photos",
|
|
3967
|
+
"description": ""
|
|
3968
|
+
},
|
|
3969
|
+
{
|
|
3970
|
+
"name": "Composition: reviews page",
|
|
3971
|
+
"description": ""
|
|
3972
|
+
}
|
|
3973
|
+
]
|
|
3974
|
+
},
|
|
3495
3975
|
{
|
|
3496
3976
|
"name": "Stat",
|
|
3497
3977
|
"category": "data-display",
|
|
@@ -10592,6 +11072,236 @@
|
|
|
10592
11072
|
}
|
|
10593
11073
|
]
|
|
10594
11074
|
},
|
|
11075
|
+
{
|
|
11076
|
+
"name": "RatingScale",
|
|
11077
|
+
"category": "forms",
|
|
11078
|
+
"folder": "RatingScale",
|
|
11079
|
+
"import": "import { RatingScale } from \"@vjdesigns/vjdesigns-ui\";",
|
|
11080
|
+
"description": "A labeled, single-choice rating scale: faces, numbers (such as a 0 to 10\r\nlikelihood scale), or thumbs up and down. Unlike `Rating`, each option is\r\nits own choice with its own name, so choosing one never fills the others.\r\nBuilt on native radios in a `role=\"radiogroup\"`: Tab lands on the selected\r\noption, arrow keys move and select, and the value submits with a form.",
|
|
11081
|
+
"nativeElement": "div",
|
|
11082
|
+
"props": [
|
|
11083
|
+
{
|
|
11084
|
+
"name": "variant",
|
|
11085
|
+
"type": "RatingScaleVariant",
|
|
11086
|
+
"required": false,
|
|
11087
|
+
"default": "\"numbers\"",
|
|
11088
|
+
"description": "Look and built-in options: five `faces` (very unhappy to very happy),\r\n`numbers` from `min` to `max` (e.g. a 0 to 10 likelihood scale), or\r\n`thumbs` up (`1`) and down (`0`)."
|
|
11089
|
+
},
|
|
11090
|
+
{
|
|
11091
|
+
"name": "value",
|
|
11092
|
+
"type": "number | null",
|
|
11093
|
+
"required": false,
|
|
11094
|
+
"description": "Selected value (controlled). `null` means nothing is selected. Use with `onValueChange`."
|
|
11095
|
+
},
|
|
11096
|
+
{
|
|
11097
|
+
"name": "defaultValue",
|
|
11098
|
+
"type": "number | null",
|
|
11099
|
+
"required": false,
|
|
11100
|
+
"default": "null",
|
|
11101
|
+
"description": "Initial value (uncontrolled)."
|
|
11102
|
+
},
|
|
11103
|
+
{
|
|
11104
|
+
"name": "onValueChange",
|
|
11105
|
+
"type": "(value: number | null) => void",
|
|
11106
|
+
"required": false,
|
|
11107
|
+
"description": "Called with the selected value, or `null` when cleared."
|
|
11108
|
+
},
|
|
11109
|
+
{
|
|
11110
|
+
"name": "min",
|
|
11111
|
+
"type": "number",
|
|
11112
|
+
"required": false,
|
|
11113
|
+
"default": "1",
|
|
11114
|
+
"description": "`numbers` only: the lowest value."
|
|
11115
|
+
},
|
|
11116
|
+
{
|
|
11117
|
+
"name": "max",
|
|
11118
|
+
"type": "number",
|
|
11119
|
+
"required": false,
|
|
11120
|
+
"default": "5",
|
|
11121
|
+
"description": "`numbers` only: the highest value."
|
|
11122
|
+
},
|
|
11123
|
+
{
|
|
11124
|
+
"name": "options",
|
|
11125
|
+
"type": "RatingScaleOption[]",
|
|
11126
|
+
"required": false,
|
|
11127
|
+
"description": "Custom options, replacing the variant's built-in set (and `min` / `max`).\r\nThe variant still sets the look."
|
|
11128
|
+
},
|
|
11129
|
+
{
|
|
11130
|
+
"name": "startLabel",
|
|
11131
|
+
"type": "ReactNode",
|
|
11132
|
+
"required": false,
|
|
11133
|
+
"description": "Caption under the first option, e.g. \"Not likely\". Also read as part of the description."
|
|
11134
|
+
},
|
|
11135
|
+
{
|
|
11136
|
+
"name": "endLabel",
|
|
11137
|
+
"type": "ReactNode",
|
|
11138
|
+
"required": false,
|
|
11139
|
+
"description": "Caption under the last option, e.g. \"Very likely\". Also read as part of the description."
|
|
11140
|
+
},
|
|
11141
|
+
{
|
|
11142
|
+
"name": "showLabels",
|
|
11143
|
+
"type": "boolean",
|
|
11144
|
+
"required": false,
|
|
11145
|
+
"default": "false",
|
|
11146
|
+
"description": "Show each option's label under it (faces and thumbs)."
|
|
11147
|
+
},
|
|
11148
|
+
{
|
|
11149
|
+
"name": "sentiment",
|
|
11150
|
+
"type": "boolean",
|
|
11151
|
+
"required": false,
|
|
11152
|
+
"default": "false",
|
|
11153
|
+
"description": "`faces` only: tint the faces from danger (lowest) to success (highest).\r\nThe face shapes already carry the meaning; the tint is extra."
|
|
11154
|
+
},
|
|
11155
|
+
{
|
|
11156
|
+
"name": "size",
|
|
11157
|
+
"type": "Size",
|
|
11158
|
+
"required": false,
|
|
11159
|
+
"default": "\"md\"",
|
|
11160
|
+
"description": "Option size. Falls back to a surrounding Field's size."
|
|
11161
|
+
},
|
|
11162
|
+
{
|
|
11163
|
+
"name": "allowClear",
|
|
11164
|
+
"type": "boolean",
|
|
11165
|
+
"required": false,
|
|
11166
|
+
"description": "Let the user remove their choice: clicking (or pressing Space on) the\r\nselected option again, or pressing Delete / Backspace, resets it to `null`."
|
|
11167
|
+
},
|
|
11168
|
+
{
|
|
11169
|
+
"name": "clearHint",
|
|
11170
|
+
"type": "string",
|
|
11171
|
+
"required": false,
|
|
11172
|
+
"default": "\"Press Space on the selected rating, or Delete, to clear it.\"",
|
|
11173
|
+
"description": "Instructions announced with each option when `allowClear` is on. Localize it here."
|
|
11174
|
+
},
|
|
11175
|
+
{
|
|
11176
|
+
"name": "disabled",
|
|
11177
|
+
"type": "boolean",
|
|
11178
|
+
"required": false,
|
|
11179
|
+
"description": "Disables every option. Falls back to a surrounding Field's state."
|
|
11180
|
+
},
|
|
11181
|
+
{
|
|
11182
|
+
"name": "readOnly",
|
|
11183
|
+
"type": "boolean",
|
|
11184
|
+
"required": false,
|
|
11185
|
+
"description": "Show the value without allowing changes: a single `role=\"img\"` named\r\n\"Rated: Happy\", plus a hidden input so the value still submits when `name` is set."
|
|
11186
|
+
},
|
|
11187
|
+
{
|
|
11188
|
+
"name": "invalid",
|
|
11189
|
+
"type": "boolean",
|
|
11190
|
+
"required": false,
|
|
11191
|
+
"description": "Marks the scale invalid: danger outlines and `aria-invalid`. Falls back to a surrounding Field's state."
|
|
11192
|
+
},
|
|
11193
|
+
{
|
|
11194
|
+
"name": "required",
|
|
11195
|
+
"type": "boolean",
|
|
11196
|
+
"required": false,
|
|
11197
|
+
"description": "A choice is required: sets native `required` on the radios. Falls back to a surrounding Field's state."
|
|
11198
|
+
},
|
|
11199
|
+
{
|
|
11200
|
+
"name": "name",
|
|
11201
|
+
"type": "string",
|
|
11202
|
+
"required": false,
|
|
11203
|
+
"description": "Shared `name` for the native radios (used in form submission). Generated with `useId` when omitted."
|
|
11204
|
+
},
|
|
11205
|
+
{
|
|
11206
|
+
"name": "getReadOnlyLabel",
|
|
11207
|
+
"type": "(option: RatingScaleOption) => string",
|
|
11208
|
+
"required": false,
|
|
11209
|
+
"default": "\"Rated: Happy\"",
|
|
11210
|
+
"description": "Read-only: accessible name. Localize it here."
|
|
11211
|
+
},
|
|
11212
|
+
{
|
|
11213
|
+
"name": "unratedLabel",
|
|
11214
|
+
"type": "string",
|
|
11215
|
+
"required": false,
|
|
11216
|
+
"default": "\"Not rated\"",
|
|
11217
|
+
"description": "Read-only with no value: accessible name."
|
|
11218
|
+
},
|
|
11219
|
+
{
|
|
11220
|
+
"name": "label",
|
|
11221
|
+
"type": "ReactNode",
|
|
11222
|
+
"required": false,
|
|
11223
|
+
"description": "Visible label, used when the scale stands alone. Ignored inside a\r\n`Field`/`Fieldset`, whose label or legend names it. Without a label,\r\npass `aria-label` or `aria-labelledby`."
|
|
11224
|
+
},
|
|
11225
|
+
{
|
|
11226
|
+
"name": "description",
|
|
11227
|
+
"type": "ReactNode",
|
|
11228
|
+
"required": false,
|
|
11229
|
+
"description": "Help text under the label, linked with `aria-describedby`."
|
|
11230
|
+
}
|
|
11231
|
+
],
|
|
11232
|
+
"subcomponents": [],
|
|
11233
|
+
"storybook": "Forms/RatingScale",
|
|
11234
|
+
"stories": [
|
|
11235
|
+
{
|
|
11236
|
+
"name": "Playground",
|
|
11237
|
+
"description": ""
|
|
11238
|
+
},
|
|
11239
|
+
{
|
|
11240
|
+
"name": "Faces",
|
|
11241
|
+
"description": ""
|
|
11242
|
+
},
|
|
11243
|
+
{
|
|
11244
|
+
"name": "Faces With Sentiment",
|
|
11245
|
+
"description": ""
|
|
11246
|
+
},
|
|
11247
|
+
{
|
|
11248
|
+
"name": "Numbers (0 to 10)",
|
|
11249
|
+
"description": ""
|
|
11250
|
+
},
|
|
11251
|
+
{
|
|
11252
|
+
"name": "One To Five",
|
|
11253
|
+
"description": ""
|
|
11254
|
+
},
|
|
11255
|
+
{
|
|
11256
|
+
"name": "Thumbs",
|
|
11257
|
+
"description": ""
|
|
11258
|
+
},
|
|
11259
|
+
{
|
|
11260
|
+
"name": "All Variants",
|
|
11261
|
+
"description": ""
|
|
11262
|
+
},
|
|
11263
|
+
{
|
|
11264
|
+
"name": "Sizes",
|
|
11265
|
+
"description": ""
|
|
11266
|
+
},
|
|
11267
|
+
{
|
|
11268
|
+
"name": "Allow Clear",
|
|
11269
|
+
"description": ""
|
|
11270
|
+
},
|
|
11271
|
+
{
|
|
11272
|
+
"name": "Read Only",
|
|
11273
|
+
"description": ""
|
|
11274
|
+
},
|
|
11275
|
+
{
|
|
11276
|
+
"name": "Read Only Unrated",
|
|
11277
|
+
"description": ""
|
|
11278
|
+
},
|
|
11279
|
+
{
|
|
11280
|
+
"name": "Disabled",
|
|
11281
|
+
"description": ""
|
|
11282
|
+
},
|
|
11283
|
+
{
|
|
11284
|
+
"name": "Invalid",
|
|
11285
|
+
"description": ""
|
|
11286
|
+
},
|
|
11287
|
+
{
|
|
11288
|
+
"name": "Custom Options",
|
|
11289
|
+
"description": ""
|
|
11290
|
+
},
|
|
11291
|
+
{
|
|
11292
|
+
"name": "In Field",
|
|
11293
|
+
"description": ""
|
|
11294
|
+
},
|
|
11295
|
+
{
|
|
11296
|
+
"name": "Controlled",
|
|
11297
|
+
"description": ""
|
|
11298
|
+
},
|
|
11299
|
+
{
|
|
11300
|
+
"name": "Survey Form",
|
|
11301
|
+
"description": ""
|
|
11302
|
+
}
|
|
11303
|
+
]
|
|
11304
|
+
},
|
|
10595
11305
|
{
|
|
10596
11306
|
"name": "SearchForm",
|
|
10597
11307
|
"category": "forms",
|
|
@@ -15730,7 +16440,7 @@
|
|
|
15730
16440
|
"category": "navigation",
|
|
15731
16441
|
"folder": "MobileNav",
|
|
15732
16442
|
"import": "import { MobileNav } from \"@vjdesigns/vjdesigns-ui\";",
|
|
15733
|
-
"description": "A mobile navigation bar: a bottom tab bar, a top bar, or a side rail of\nicon-and-label links. A bubble slides to the current item, with an\nanimated `effect` (floating bubbles by default; also sparkle, confetti,\nglow, jelly, orbit, splash, or none). With reduced motion, the bubble simply\nmoves without the effects.\n\nRenders a `<nav>` landmark with a list of links. The current item has\n`aria-current=\"page\"` and is marked by the bubble's shape and an indicator\nbar, never by color alone. Every item keeps its label as its accessible\nname, even when labels are hidden.",
|
|
16443
|
+
"description": "A mobile navigation bar: a bottom tab bar, a top bar, or a side rail of\r\nicon-and-label links. A bubble slides to the current item, with an\r\nanimated `effect` (floating bubbles by default; also sparkle, confetti,\r\nglow, jelly, orbit, splash, or none). With reduced motion, the bubble simply\r\nmoves without the effects.\r\n\r\nRenders a `<nav>` landmark with a list of links. The current item has\r\n`aria-current=\"page\"` and is marked by the bubble's shape and an indicator\r\nbar, never by color alone. Every item keeps its label as its accessible\r\nname, even when labels are hidden.",
|
|
15734
16444
|
"nativeElement": "nav",
|
|
15735
16445
|
"props": [
|
|
15736
16446
|
{
|
|
@@ -15772,7 +16482,7 @@
|
|
|
15772
16482
|
"type": "MobileNavPosition",
|
|
15773
16483
|
"required": false,
|
|
15774
16484
|
"default": "\"fixed\"",
|
|
15775
|
-
"description": "`fixed` stays on its edge of the viewport; `sticky` sticks to its edge of\nthe scroll container; `static` stays in the flow."
|
|
16485
|
+
"description": "`fixed` stays on its edge of the viewport; `sticky` sticks to its edge of\r\nthe scroll container; `static` stays in the flow."
|
|
15776
16486
|
},
|
|
15777
16487
|
{
|
|
15778
16488
|
"name": "size",
|
|
@@ -15786,7 +16496,7 @@
|
|
|
15786
16496
|
"type": "MobileNavEffect",
|
|
15787
16497
|
"required": false,
|
|
15788
16498
|
"default": "\"bubbles\"",
|
|
15789
|
-
"description": "The animated effect when the current item changes: `bubbles`,\n`sparkle`, `confetti`, `glow`, `jelly`, `orbit`, `splash`, or `none` to\nturn it off. See `MobileNavEffect`."
|
|
16499
|
+
"description": "The animated effect when the current item changes: `bubbles`,\r\n`sparkle`, `confetti`, `glow`, `jelly`, `orbit`, `splash`, or `none` to\r\nturn it off. See `MobileNavEffect`."
|
|
15790
16500
|
},
|
|
15791
16501
|
{
|
|
15792
16502
|
"name": "activeTone",
|
|
@@ -15813,7 +16523,7 @@
|
|
|
15813
16523
|
"type": "boolean",
|
|
15814
16524
|
"required": false,
|
|
15815
16525
|
"default": "true",
|
|
15816
|
-
"description": "With `position=\"fixed\"`, keeps focused and scrolled-to content clear of\nthe bar (WCAG 2.4.11): while mounted, sets the matching `scroll-padding`\non `<html>` to the space the bar covers, and `--mobile-nav-offset` on\n`<html>` to the same length, so the page can reserve room for it\n(`body { padding-block-end: var(--mobile-nav-offset, 0px) }` under a\nbottom bar). Both are restored on unmount, and are 0 while hidden by\n`hideAbove`."
|
|
16526
|
+
"description": "With `position=\"fixed\"`, keeps focused and scrolled-to content clear of\r\nthe bar (WCAG 2.4.11): while mounted, sets the matching `scroll-padding`\r\non `<html>` to the space the bar covers, and `--mobile-nav-offset` on\r\n`<html>` to the same length, so the page can reserve room for it\r\n(`body { padding-block-end: var(--mobile-nav-offset, 0px) }` under a\r\nbottom bar). Both are restored on unmount, and are 0 while hidden by\r\n`hideAbove`."
|
|
15817
16527
|
},
|
|
15818
16528
|
{
|
|
15819
16529
|
"name": "value",
|
|
@@ -15845,14 +16555,14 @@
|
|
|
15845
16555
|
{
|
|
15846
16556
|
"name": "MobileNav.Item",
|
|
15847
16557
|
"exportedAs": "MobileNavItem",
|
|
15848
|
-
"description": "One destination in a `MobileNav`: an icon over a label, in its own `<li>`.\nSelecting it makes it current when the root is uncontrolled (and calls\n`onValueChange`), even if a client-side router prevents the default\nnavigation.",
|
|
16558
|
+
"description": "One destination in a `MobileNav`: an icon over a label, in its own `<li>`.\r\nSelecting it makes it current when the root is uncontrolled (and calls\r\n`onValueChange`), even if a client-side router prevents the default\r\nnavigation.",
|
|
15849
16559
|
"props": [
|
|
15850
16560
|
{
|
|
15851
16561
|
"name": "as",
|
|
15852
16562
|
"type": "C",
|
|
15853
16563
|
"required": false,
|
|
15854
16564
|
"default": "\"a\"",
|
|
15855
|
-
"description": "The element or component to render, e.g. your router's `Link`. Use a\nlink for navigation; `\"button\"` suits an action such as opening a sheet."
|
|
16565
|
+
"description": "The element or component to render, e.g. your router's `Link`. Use a\r\nlink for navigation; `\"button\"` suits an action such as opening a sheet."
|
|
15856
16566
|
},
|
|
15857
16567
|
{
|
|
15858
16568
|
"name": "value",
|
|
@@ -15864,7 +16574,7 @@
|
|
|
15864
16574
|
"name": "active",
|
|
15865
16575
|
"type": "boolean",
|
|
15866
16576
|
"required": false,
|
|
15867
|
-
"description": "Marks the item as the current page (`aria-current=\"page\"`), whatever\nthe root's `value`. Use it when your router knows the current page."
|
|
16577
|
+
"description": "Marks the item as the current page (`aria-current=\"page\"`), whatever\r\nthe root's `value`. Use it when your router knows the current page."
|
|
15868
16578
|
},
|
|
15869
16579
|
{
|
|
15870
16580
|
"name": "icon",
|
|
@@ -15882,7 +16592,7 @@
|
|
|
15882
16592
|
"name": "badge",
|
|
15883
16593
|
"type": "MobileNavBadgeValue",
|
|
15884
16594
|
"required": false,
|
|
15885
|
-
"description": "A count (shown with `Badge` `count`, capped at 99+, hidden at 0) or a\nshort text such as \"New\", on the icon's corner. It's read after the\nlabel (\"Messages 3\")."
|
|
16595
|
+
"description": "A count (shown with `Badge` `count`, capped at 99+, hidden at 0) or a\r\nshort text such as \"New\", on the icon's corner. It's read after the\r\nlabel (\"Messages 3\")."
|
|
15886
16596
|
},
|
|
15887
16597
|
{
|
|
15888
16598
|
"name": "badgeLabel",
|
|
@@ -15913,7 +16623,7 @@
|
|
|
15913
16623
|
},
|
|
15914
16624
|
{
|
|
15915
16625
|
"name": "Effects",
|
|
15916
|
-
"description": "Every `effect`. Tap the items to play each one. `effect=\"none\"` turns the\neffect off; the bubble still slides. With reduced motion, none play."
|
|
16626
|
+
"description": "Every `effect`. Tap the items to play each one. `effect=\"none\"` turns the\r\neffect off; the bubble still slides. With reduced motion, none play."
|
|
15917
16627
|
},
|
|
15918
16628
|
{
|
|
15919
16629
|
"name": "Placements",
|
|
@@ -15953,7 +16663,7 @@
|
|
|
15953
16663
|
},
|
|
15954
16664
|
{
|
|
15955
16665
|
"name": "Fixed",
|
|
15956
|
-
"description": "`position=\"fixed\"` (the default in apps): the bar stays on the viewport's\nbottom edge, and `<html>` gets scroll padding and `--mobile-nav-offset`\nso focused content isn't hidden behind it."
|
|
16666
|
+
"description": "`position=\"fixed\"` (the default in apps): the bar stays on the viewport's\r\nbottom edge, and `<html>` gets scroll padding and `--mobile-nav-offset`\r\nso focused content isn't hidden behind it."
|
|
15957
16667
|
}
|
|
15958
16668
|
]
|
|
15959
16669
|
},
|
|
@@ -21117,7 +21827,21 @@
|
|
|
21117
21827
|
"FolderIcon",
|
|
21118
21828
|
"FolderOpenIcon",
|
|
21119
21829
|
"ImageIcon",
|
|
21120
|
-
"LoaderIcon"
|
|
21830
|
+
"LoaderIcon",
|
|
21831
|
+
"FaceVerySadIcon",
|
|
21832
|
+
"FaceSadIcon",
|
|
21833
|
+
"FaceNeutralIcon",
|
|
21834
|
+
"FaceHappyIcon",
|
|
21835
|
+
"FaceVeryHappyIcon",
|
|
21836
|
+
"ThumbsUpIcon",
|
|
21837
|
+
"ThumbsDownIcon",
|
|
21838
|
+
"VerifiedIcon",
|
|
21839
|
+
"VolumeIcon",
|
|
21840
|
+
"VolumeOffIcon",
|
|
21841
|
+
"FullscreenIcon",
|
|
21842
|
+
"FullscreenExitIcon",
|
|
21843
|
+
"CaptionsIcon",
|
|
21844
|
+
"PipIcon"
|
|
21121
21845
|
],
|
|
21122
21846
|
"hooks": [
|
|
21123
21847
|
{
|