@hirobius/design-system 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE/main.tsx +21 -0
  2. package/README.md +124 -0
  3. package/dist/chunks/TokenDisplayContext-B3gxyQN7.js +95 -0
  4. package/dist/chunks/form-DnGRy27o.js +63 -0
  5. package/dist/cn.js +8 -0
  6. package/dist/contexts.js +133 -0
  7. package/dist/form.js +62 -0
  8. package/dist/hirobius-ui.js +5611 -0
  9. package/dist/manifest.js +28 -0
  10. package/dist/tokens.css +1 -0
  11. package/dist/tokens.js +693 -0
  12. package/dist/types/src/app/components/activity-feed.d.ts +43 -0
  13. package/dist/types/src/app/components/alert.d.ts +18 -0
  14. package/dist/types/src/app/components/asset-img.d.ts +54 -0
  15. package/dist/types/src/app/components/avatar.d.ts +23 -0
  16. package/dist/types/src/app/components/badge.d.ts +20 -0
  17. package/dist/types/src/app/components/breadcrumb.d.ts +26 -0
  18. package/dist/types/src/app/components/button.d.ts +37 -0
  19. package/dist/types/src/app/components/callout.d.ts +23 -0
  20. package/dist/types/src/app/components/card.d.ts +119 -0
  21. package/dist/types/src/app/components/checkbox.d.ts +20 -0
  22. package/dist/types/src/app/components/cinematic-link.d.ts +13 -0
  23. package/dist/types/src/app/components/code-block.d.ts +29 -0
  24. package/dist/types/src/app/components/combobox.d.ts +46 -0
  25. package/dist/types/src/app/components/component-instance-matrix.d.ts +21 -0
  26. package/dist/types/src/app/components/container.d.ts +31 -0
  27. package/dist/types/src/app/components/dialog.d.ts +73 -0
  28. package/dist/types/src/app/components/disclosure.d.ts +32 -0
  29. package/dist/types/src/app/components/divider.d.ts +21 -0
  30. package/dist/types/src/app/components/doc-link-card.d.ts +26 -0
  31. package/dist/types/src/app/components/empty-state.d.ts +24 -0
  32. package/dist/types/src/app/components/error-boundary.d.ts +25 -0
  33. package/dist/types/src/app/components/error-pattern.d.ts +9 -0
  34. package/dist/types/src/app/components/field.d.ts +25 -0
  35. package/dist/types/src/app/components/form.d.ts +106 -0
  36. package/dist/types/src/app/components/foundation-swatch.d.ts +39 -0
  37. package/dist/types/src/app/components/grid.d.ts +65 -0
  38. package/dist/types/src/app/components/heading-stack.d.ts +42 -0
  39. package/dist/types/src/app/components/history-card.d.ts +12 -0
  40. package/dist/types/src/app/components/icon-button.d.ts +23 -0
  41. package/dist/types/src/app/components/icon.d.ts +30 -0
  42. package/dist/types/src/app/components/info-page.d.ts +10 -0
  43. package/dist/types/src/app/components/inline-code.d.ts +12 -0
  44. package/dist/types/src/app/components/inline-link.d.ts +17 -0
  45. package/dist/types/src/app/components/input.d.ts +46 -0
  46. package/dist/types/src/app/components/lab/tokenUtils.d.ts +38 -0
  47. package/dist/types/src/app/components/menu.d.ts +56 -0
  48. package/dist/types/src/app/components/nav-group.d.ts +24 -0
  49. package/dist/types/src/app/components/nav-item.d.ts +21 -0
  50. package/dist/types/src/app/components/not-found-pattern.d.ts +1 -0
  51. package/dist/types/src/app/components/page.d.ts +43 -0
  52. package/dist/types/src/app/components/pagination.d.ts +24 -0
  53. package/dist/types/src/app/components/popover.d.ts +44 -0
  54. package/dist/types/src/app/components/progress.d.ts +25 -0
  55. package/dist/types/src/app/components/radio.d.ts +18 -0
  56. package/dist/types/src/app/components/segmented-control.d.ts +33 -0
  57. package/dist/types/src/app/components/skeleton.d.ts +25 -0
  58. package/dist/types/src/app/components/sketch.d.ts +13 -0
  59. package/dist/types/src/app/components/slider.d.ts +22 -0
  60. package/dist/types/src/app/components/spinner.d.ts +20 -0
  61. package/dist/types/src/app/components/stack.d.ts +39 -0
  62. package/dist/types/src/app/components/stat.d.ts +24 -0
  63. package/dist/types/src/app/components/status-list-item.d.ts +25 -0
  64. package/dist/types/src/app/components/status-tile.d.ts +22 -0
  65. package/dist/types/src/app/components/stepper-field.d.ts +13 -0
  66. package/dist/types/src/app/components/surface-padding.d.ts +18 -0
  67. package/dist/types/src/app/components/surface.d.ts +30 -0
  68. package/dist/types/src/app/components/table.d.ts +40 -0
  69. package/dist/types/src/app/components/tabs.d.ts +27 -0
  70. package/dist/types/src/app/components/tag.d.ts +32 -0
  71. package/dist/types/src/app/components/text-lockup.d.ts +38 -0
  72. package/dist/types/src/app/components/text.d.ts +26 -0
  73. package/dist/types/src/app/components/tile-grid.d.ts +17 -0
  74. package/dist/types/src/app/components/toast.d.ts +56 -0
  75. package/dist/types/src/app/components/toggle.d.ts +18 -0
  76. package/dist/types/src/app/components/token.d.ts +59 -0
  77. package/dist/types/src/app/components/tooltip.d.ts +33 -0
  78. package/dist/types/src/app/context/DemoStateContext.d.ts +21 -0
  79. package/dist/types/src/app/context/FontContext.d.ts +4 -0
  80. package/dist/types/src/app/context/LanguageContext.d.ts +23 -0
  81. package/dist/types/src/app/context/RouterContext.d.ts +61 -0
  82. package/dist/types/src/app/context/TenantContext.d.ts +29 -0
  83. package/dist/types/src/app/context/ThemeContext.d.ts +18 -0
  84. package/dist/types/src/app/context/TokenDisplayContext.d.ts +11 -0
  85. package/dist/types/src/app/context/index.d.ts +19 -0
  86. package/dist/types/src/app/data/manifest-types.d.ts +128 -0
  87. package/dist/types/src/app/design-system/generated-token-refs.d.ts +586 -0
  88. package/dist/types/src/app/design-system/generated-token-values.d.ts +223 -0
  89. package/dist/types/src/app/design-system/theme.d.ts +32 -0
  90. package/dist/types/src/app/design-system/tokens.d.ts +333 -0
  91. package/dist/types/src/app/hooks/useFocusVisible.d.ts +9 -0
  92. package/dist/types/src/app/hooks/useInteractionState.d.ts +27 -0
  93. package/dist/types/src/app/layouts/CaseStudyLayout.d.ts +21 -0
  94. package/dist/types/src/app/layouts/DocLayout.d.ts +16 -0
  95. package/dist/types/src/app/layouts/EmbeddedDocLayoutContext.d.ts +6 -0
  96. package/dist/types/src/app/lib/nav-active.d.ts +16 -0
  97. package/dist/types/src/app/lib/navLevels.d.ts +4 -0
  98. package/dist/types/src/app/pages/hds/HdsSystemDocLayout.d.ts +7 -0
  99. package/dist/types/src/form/hds-form.d.ts +61 -0
  100. package/dist/types/src/form/index.d.ts +30 -0
  101. package/dist/types/src/form/use-hds-form.d.ts +23 -0
  102. package/dist/types/src/index.d.ts +2276 -0
  103. package/dist/types/src/lib/deprecation.d.ts +4 -0
  104. package/dist/types/src/lib/manifest-entry.d.ts +3 -0
  105. package/dist/types/src/lib/utils.d.ts +3 -0
  106. package/dist/variables.css +461 -0
  107. package/hirobius.tokens.json +2220 -0
  108. package/package.json +366 -0
  109. package/protocol/envelope.mjs +201 -0
  110. package/protocol/figma-snapshot.schema.json +190 -0
  111. package/public/hds-manifest.json +11230 -0
@@ -0,0 +1,4 @@
1
+ export type NavLevel = 'root' | 'section' | 'nested' | 'deep';
2
+ export declare function getNavLevelInset(level: NavLevel): string;
3
+ export declare function getNavLevelLeadingPadding(level: NavLevel): string;
4
+ export declare function getNextNavLevel(level: NavLevel): NavLevel;
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type DocLayoutContentMaxWidth } from '../../layouts/DocLayout';
3
+ /** @public */
4
+ export declare function HdsSystemDocLayout({ contentSlot, contentMaxWidth, }: {
5
+ contentSlot: ReactNode;
6
+ contentMaxWidth?: DocLayoutContentMaxWidth;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,61 @@
1
+ import * as React from 'react';
2
+ import { type UseFormReturn, type FieldValues, type FieldPath } from 'react-hook-form';
3
+ /** @public */
4
+ export interface HdsFormProps<TFieldValues extends FieldValues> extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> {
5
+ /** The form object returned by `useHdsForm`. */
6
+ form: UseFormReturn<TFieldValues>;
7
+ /** Called with the parsed, validated values once the schema passes. */
8
+ onSubmit: (values: TFieldValues) => void | Promise<void>;
9
+ children: React.ReactNode;
10
+ }
11
+ /**
12
+ * Wraps the presentational `Form` in RHF's `FormProvider` and routes submission
13
+ * through `handleSubmit` so `onSubmit` only fires with schema-valid values.
14
+ * @public
15
+ */
16
+ export declare function HdsForm<TFieldValues extends FieldValues>({ form, onSubmit, children, ...formProps }: HdsFormProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
17
+ /**
18
+ * Props handed to `HdsFormField`'s render function — spread them onto your
19
+ * control. They combine RHF's field binding (`name`/`value`/`onChange`/`onBlur`/
20
+ * `ref`) with HDS's a11y wiring (`id`/`aria-invalid`/`aria-describedby`).
21
+ * @public
22
+ */
23
+ export interface HdsFieldRenderProps {
24
+ name: string;
25
+ value: unknown;
26
+ onChange: (...args: unknown[]) => void;
27
+ onBlur: (...args: unknown[]) => void;
28
+ ref: React.Ref<unknown>;
29
+ id: string;
30
+ required?: boolean;
31
+ 'aria-invalid'?: boolean;
32
+ 'aria-describedby'?: string;
33
+ }
34
+ /** @public */
35
+ export interface HdsFormFieldProps<TFieldValues extends FieldValues = FieldValues> {
36
+ /** Field name — a typed path into the form's values. */
37
+ name: FieldPath<TFieldValues>;
38
+ /** Field label, associated to the control via htmlFor/id. */
39
+ label: string;
40
+ /** Render the control, spreading the supplied props (binding + a11y) onto it. */
41
+ children: (props: HdsFieldRenderProps) => React.ReactElement;
42
+ /** Helper text below the control; linked via aria-describedby. */
43
+ description?: string;
44
+ /** Adds the required marker + sets `required` on the control. */
45
+ required?: boolean;
46
+ className?: string;
47
+ }
48
+ /**
49
+ * Binds a control to RHF by `name` and renders it inside the presentational
50
+ * field markup. The control is supplied via a render function so RHF's callback
51
+ * ref attaches directly (no clone). The field's validation error (its `message`
52
+ * from the Zod schema) is shown through the same label/error/aria markup the
53
+ * core `FormField` uses.
54
+ *
55
+ * <HdsFormField name="email" label="Email">
56
+ * {(props) => <input type="email" className="…" {...props} />}
57
+ * </HdsFormField>
58
+ *
59
+ * @public
60
+ */
61
+ export declare function HdsFormField<TFieldValues extends FieldValues = FieldValues>({ name, label, children, description, required, className, }: HdsFormFieldProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `@hirobius/design-system/form`
3
+ *
4
+ * OPTIONAL React Hook Form + Zod adapter for HDS forms. Kept on its own subpath
5
+ * so the main barrel stays validation-agnostic and zero-dependency — only apps
6
+ * that import this entry pull in `react-hook-form`, `zod`, and
7
+ * `@hookform/resolvers` (all declared as optional peer dependencies).
8
+ *
9
+ * import { z } from 'zod';
10
+ * import { useHdsForm, HdsForm, HdsFormField } from '@hirobius/design-system/form';
11
+ *
12
+ * const schema = z.object({ email: z.string().email('Enter a valid email') });
13
+ *
14
+ * function SignUp() {
15
+ * const form = useHdsForm(schema, { defaultValues: { email: '' } });
16
+ * return (
17
+ * <HdsForm form={form} onSubmit={(values) => save(values)}>
18
+ * <HdsFormField name="email" label="Email">
19
+ * {(props) => <input type="email" className="…" {...props} />}
20
+ * </HdsFormField>
21
+ * <Button type="submit">Save</Button>
22
+ * </HdsForm>
23
+ * );
24
+ * }
25
+ *
26
+ * @doc-ignore subpath barrel, not an HDS component
27
+ */
28
+ export { useHdsForm } from './use-hds-form';
29
+ export { HdsForm, HdsFormField } from './hds-form';
30
+ export type { HdsFormProps, HdsFormFieldProps, HdsFieldRenderProps } from './hds-form';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * useHdsForm — React Hook Form pre-wired with a Zod resolver.
3
+ *
4
+ * Part of the OPTIONAL `@hirobius/design-system/form` subpath. RHF + Zod are
5
+ * optional peer dependencies, so consumers that never import this subpath pay
6
+ * nothing for them (the main barrel stays validation-agnostic).
7
+ *
8
+ * const schema = z.object({ email: z.string().email() });
9
+ * const form = useHdsForm(schema, { defaultValues: { email: '' } });
10
+ *
11
+ * @doc-ignore adapter for the ./form subpath, not an HDS component
12
+ */
13
+ import { type UseFormProps, type UseFormReturn, type FieldValues } from 'react-hook-form';
14
+ import type { ZodType } from 'zod';
15
+ /**
16
+ * Thin wrapper over RHF's `useForm` that pre-wires `zodResolver(schema)` and
17
+ * defaults validation to `onTouched` (errors surface after a field blurs, not on
18
+ * every keystroke). The schema's parsed output type drives the form's field
19
+ * types, so `form.handleSubmit` hands you a fully-typed, validated value object.
20
+ *
21
+ * @public
22
+ */
23
+ export declare function useHdsForm<TFieldValues extends FieldValues>(schema: ZodType<TFieldValues>, options?: Omit<UseFormProps<TFieldValues>, 'resolver'>): UseFormReturn<TFieldValues>;