@gntik-ai/ui 0.5.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gntik-ai/ui",
3
- "version": "0.5.0",
3
+ "version": "0.9.0",
4
4
  "description": "gntik-ui React components and layouts on Base UI, styled with the brand tokens.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,149 +0,0 @@
1
- 'use client';
2
- import { clsx } from "clsx";
3
- import { extendTailwindMerge } from "tailwind-merge";
4
- import { createTV } from "tailwind-variants";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- import { CircleAlert } from "lucide-react";
7
- import { Field } from "@base-ui/react/field";
8
- import { Fieldset } from "@base-ui/react/fieldset";
9
- //#region src/utils/density-merge.ts
10
- /**
11
- * Teaches tailwind-merge the density utilities from @gntik-ai/tokens (density.css), so
12
- * `cn('h-control', 'h-10')` and `px-control … px-0` resolve like any other Tailwind conflict.
13
- * Shared by `cn()` and the `tv()` instance.
14
- */
15
- const densityMergeConfig = { extend: { classGroups: {
16
- h: [{ h: [
17
- "control-sm",
18
- "control",
19
- "control-lg",
20
- "item",
21
- "tab",
22
- "chip",
23
- "token",
24
- "row"
25
- ] }],
26
- w: [{ w: [
27
- "control-sm",
28
- "control",
29
- "control-lg"
30
- ] }],
31
- size: [{ size: [
32
- "control-sm",
33
- "control",
34
- "control-lg"
35
- ] }],
36
- px: [{ px: [
37
- "control-sm",
38
- "control",
39
- "control-lg",
40
- "field"
41
- ] }],
42
- ps: [{ ps: ["field"] }],
43
- py: [{ py: ["cell", "bar"] }],
44
- gap: [{ gap: ["tight"] }]
45
- } } };
46
- //#endregion
47
- //#region src/utils/cn.ts
48
- const twMerge = extendTailwindMerge(densityMergeConfig);
49
- /** Joins class names and resolves Tailwind conflicts (last one wins), density utilities included. */
50
- function cn(...inputs) {
51
- return twMerge(clsx(inputs));
52
- }
53
- //#endregion
54
- //#region src/utils/tv.ts
55
- /** `tv()` with tailwind-merge aware of the density utilities (h-control, px-control…). */
56
- const tv = createTV({ twMergeConfig: densityMergeConfig });
57
- //#endregion
58
- //#region src/components/Field/field.variants.ts
59
- const fieldVariants = tv({ slots: {
60
- root: "flex min-w-0 flex-col gap-2 data-disabled:opacity-70",
61
- label: "inline-flex items-center gap-0.5 text-[13px] font-medium text-foreground data-disabled:cursor-not-allowed",
62
- required: "text-destructive-text",
63
- description: "text-[12px] leading-5 text-muted-foreground text-pretty",
64
- error: "flex items-start gap-1.5 text-[12px] leading-5 text-destructive-text",
65
- item: "flex",
66
- fieldset: "m-0 flex min-w-0 flex-col gap-3 border-0 p-0 data-disabled:opacity-70",
67
- legend: "p-0 text-[13px] font-semibold text-foreground",
68
- legendDescription: "-mt-2 text-[13px] leading-6 text-muted-foreground text-pretty"
69
- } });
70
- //#endregion
71
- //#region src/components/Field/Field.tsx
72
- const s = fieldVariants();
73
- /**
74
- * Groups a label, a control, a description and an error. Base UI wires the ids: the label
75
- * targets the control, and the description and error are linked with aria-describedby.
76
- * Pass `invalid` to drive the error from outside (e.g. a form library).
77
- */
78
- function Field$1({ className, ...props }) {
79
- return /* @__PURE__ */ jsx(Field.Root, {
80
- className: cn(s.root(), className),
81
- ...props
82
- });
83
- }
84
- /** Visible label; clicking it focuses the field's control. */
85
- function FieldLabel({ className, required, children, ...props }) {
86
- return /* @__PURE__ */ jsxs(Field.Label, {
87
- className: cn(s.label(), className),
88
- ...props,
89
- children: [children, required && /* @__PURE__ */ jsx("span", {
90
- "aria-hidden": true,
91
- className: s.required(),
92
- children: "*"
93
- })]
94
- });
95
- }
96
- /** Helper text under the control, announced as part of its description. */
97
- function FieldDescription({ className, ...props }) {
98
- return /* @__PURE__ */ jsx(Field.Description, {
99
- className: cn(s.description(), className),
100
- ...props
101
- });
102
- }
103
- /**
104
- * Validation message. Rendered only while the field is invalid (or when `match` says so)
105
- * and linked to the control through aria-describedby.
106
- */
107
- function FieldError({ className, hideIcon, children, ...props }) {
108
- return /* @__PURE__ */ jsxs(Field.Error, {
109
- className: cn(s.error(), className),
110
- ...props,
111
- children: [!hideIcon && /* @__PURE__ */ jsx(CircleAlert, {
112
- size: 13,
113
- "aria-hidden": true,
114
- className: "mt-[3px] shrink-0"
115
- }), /* @__PURE__ */ jsx("span", { children })]
116
- });
117
- }
118
- /** Wraps one checkbox or radio inside a group that lives in a Field. */
119
- function FieldItem({ className, ...props }) {
120
- return /* @__PURE__ */ jsx(Field.Item, {
121
- className: cn(s.item(), className),
122
- ...props
123
- });
124
- }
125
- /** Groups related fields (or a checkbox/radio group) under a shared legend. */
126
- function Fieldset$1({ className, ...props }) {
127
- return /* @__PURE__ */ jsx(Fieldset.Root, {
128
- className: cn(s.fieldset(), className),
129
- ...props
130
- });
131
- }
132
- /** The fieldset's accessible name. */
133
- function FieldsetLegend({ className, ...props }) {
134
- return /* @__PURE__ */ jsx(Fieldset.Legend, {
135
- className: cn(s.legend(), className),
136
- ...props
137
- });
138
- }
139
- /** Supporting text under a legend. */
140
- function FieldsetDescription({ className, ...props }) {
141
- return /* @__PURE__ */ jsx("p", {
142
- className: cn(s.legendDescription(), className),
143
- ...props
144
- });
145
- }
146
- //#endregion
147
- export { FieldLabel as a, FieldsetLegend as c, cn as d, FieldItem as i, fieldVariants as l, FieldDescription as n, Fieldset$1 as o, FieldError as r, FieldsetDescription as s, Field$1 as t, tv as u };
148
-
149
- //# sourceMappingURL=Field-neBukiNh.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Field-neBukiNh.js","names":["Field","BaseField","Fieldset","BaseFieldset"],"sources":["../src/utils/density-merge.ts","../src/utils/cn.ts","../src/utils/tv.ts","../src/components/Field/field.variants.ts","../src/components/Field/Field.tsx"],"sourcesContent":["/**\n * Teaches tailwind-merge the density utilities from @gntik-ai/tokens (density.css), so\n * `cn('h-control', 'h-10')` and `px-control … px-0` resolve like any other Tailwind conflict.\n * Shared by `cn()` and the `tv()` instance.\n */\nexport const densityMergeConfig = {\n extend: {\n classGroups: {\n h: [{ h: ['control-sm', 'control', 'control-lg', 'item', 'tab', 'chip', 'token', 'row'] }],\n w: [{ w: ['control-sm', 'control', 'control-lg'] }],\n size: [{ size: ['control-sm', 'control', 'control-lg'] }],\n px: [{ px: ['control-sm', 'control', 'control-lg', 'field'] }],\n ps: [{ ps: ['field'] }],\n py: [{ py: ['cell', 'bar'] }],\n gap: [{ gap: ['tight'] }],\n },\n },\n};\n","import { clsx, type ClassValue } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\nimport { densityMergeConfig } from './density-merge';\n\nconst twMerge = extendTailwindMerge(densityMergeConfig);\n\n/** Joins class names and resolves Tailwind conflicts (last one wins), density utilities included. */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { createTV } from 'tailwind-variants';\nimport { densityMergeConfig } from './density-merge';\n\nexport { type VariantProps } from 'tailwind-variants';\n\n/** `tv()` with tailwind-merge aware of the density utilities (h-control, px-control…). */\nexport const tv = createTV({ twMergeConfig: densityMergeConfig });\n","import { tv, type VariantProps } from '../../utils/tv';\n\nexport const fieldVariants = tv({\n slots: {\n root: 'flex min-w-0 flex-col gap-2 data-disabled:opacity-70',\n label: 'inline-flex items-center gap-0.5 text-[13px] font-medium text-foreground data-disabled:cursor-not-allowed',\n required: 'text-destructive-text',\n description: 'text-[12px] leading-5 text-muted-foreground text-pretty',\n error: 'flex items-start gap-1.5 text-[12px] leading-5 text-destructive-text',\n item: 'flex',\n fieldset: 'm-0 flex min-w-0 flex-col gap-3 border-0 p-0 data-disabled:opacity-70',\n legend: 'p-0 text-[13px] font-semibold text-foreground',\n legendDescription: '-mt-2 text-[13px] leading-6 text-muted-foreground text-pretty',\n },\n});\n\nexport type FieldVariantProps = VariantProps<typeof fieldVariants>;\n","import { Field as BaseField } from '@base-ui/react/field';\nimport { Fieldset as BaseFieldset } from '@base-ui/react/fieldset';\nimport { CircleAlert } from 'lucide-react';\nimport type { HTMLAttributes, ReactNode, Ref } from 'react';\nimport { cn } from '../../utils/cn';\nimport { fieldVariants } from './field.variants';\n\nconst s = fieldVariants();\n\nexport interface FieldProps extends Omit<BaseField.Root.Props, 'className'> {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * Groups a label, a control, a description and an error. Base UI wires the ids: the label\n * targets the control, and the description and error are linked with aria-describedby.\n * Pass `invalid` to drive the error from outside (e.g. a form library).\n */\nexport function Field({ className, ...props }: FieldProps) {\n return <BaseField.Root className={cn(s.root(), className)} {...props} />;\n}\n\nexport interface FieldLabelProps extends Omit<BaseField.Label.Props, 'className'> {\n className?: string;\n ref?: Ref<HTMLLabelElement>;\n /** Shows a required marker after the label text (also set `required` on the control). */\n required?: boolean;\n}\n\n/** Visible label; clicking it focuses the field's control. */\nexport function FieldLabel({ className, required, children, ...props }: FieldLabelProps) {\n return (\n <BaseField.Label className={cn(s.label(), className)} {...props}>\n {children}\n {required && (\n <span aria-hidden className={s.required()}>\n *\n </span>\n )}\n </BaseField.Label>\n );\n}\n\nexport interface FieldDescriptionProps extends Omit<BaseField.Description.Props, 'className'> {\n className?: string;\n ref?: Ref<HTMLParagraphElement>;\n}\n\n/** Helper text under the control, announced as part of its description. */\nexport function FieldDescription({ className, ...props }: FieldDescriptionProps) {\n return <BaseField.Description className={cn(s.description(), className)} {...props} />;\n}\n\nexport interface FieldErrorProps extends Omit<BaseField.Error.Props, 'className'> {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n /** Hide the leading alert icon. */\n hideIcon?: boolean;\n}\n\n/**\n * Validation message. Rendered only while the field is invalid (or when `match` says so)\n * and linked to the control through aria-describedby.\n */\nexport function FieldError({ className, hideIcon, children, ...props }: FieldErrorProps) {\n return (\n <BaseField.Error className={cn(s.error(), className)} {...props}>\n {!hideIcon && <CircleAlert size={13} aria-hidden className=\"mt-[3px] shrink-0\" />}\n <span>{children}</span>\n </BaseField.Error>\n );\n}\n\nexport interface FieldItemProps extends Omit<BaseField.Item.Props, 'className'> {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** Wraps one checkbox or radio inside a group that lives in a Field. */\nexport function FieldItem({ className, ...props }: FieldItemProps) {\n return <BaseField.Item className={cn(s.item(), className)} {...props} />;\n}\n\nexport interface FieldsetProps extends Omit<BaseFieldset.Root.Props, 'className'> {\n className?: string;\n ref?: Ref<HTMLFieldSetElement>;\n}\n\n/** Groups related fields (or a checkbox/radio group) under a shared legend. */\nexport function Fieldset({ className, ...props }: FieldsetProps) {\n return <BaseFieldset.Root className={cn(s.fieldset(), className)} {...props} />;\n}\n\nexport interface FieldsetLegendProps extends Omit<BaseFieldset.Legend.Props, 'className'> {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** The fieldset's accessible name. */\nexport function FieldsetLegend({ className, ...props }: FieldsetLegendProps) {\n return <BaseFieldset.Legend className={cn(s.legend(), className)} {...props} />;\n}\n\n/** Supporting text under a legend. */\nexport function FieldsetDescription({\n className,\n ...props\n}: HTMLAttributes<HTMLParagraphElement> & { children?: ReactNode }) {\n return <p className={cn(s.legendDescription(), className)} {...props} />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAKA,MAAa,qBAAqB,EAChC,QAAQ,EACN,aAAa;CACX,GAAG,CAAC,EAAE,GAAG;EAAC;EAAc;EAAW;EAAc;EAAQ;EAAO;EAAQ;EAAS;CAAK,EAAE,CAAC;CACzF,GAAG,CAAC,EAAE,GAAG;EAAC;EAAc;EAAW;CAAY,EAAE,CAAC;CAClD,MAAM,CAAC,EAAE,MAAM;EAAC;EAAc;EAAW;CAAY,EAAE,CAAC;CACxD,IAAI,CAAC,EAAE,IAAI;EAAC;EAAc;EAAW;EAAc;CAAO,EAAE,CAAC;CAC7D,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;CACtB,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAC;CAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO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