@godxjp/ui-mcp 0.20.0 → 0.21.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/dist/index.js +134 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -735,10 +735,21 @@ function MyShell({ children }: { content: React.ReactNode }) {
|
|
|
735
735
|
description: "Render as Radix Slot \u2014 merge props onto the child (<a>/<Link>)."
|
|
736
736
|
},
|
|
737
737
|
{ name: "disabled", type: "boolean", description: "Disable the button." },
|
|
738
|
+
{
|
|
739
|
+
name: "loading",
|
|
740
|
+
type: "boolean",
|
|
741
|
+
defaultValue: "false",
|
|
742
|
+
description: 'In-flight state \u2014 shows a leading `Loader2` spinner (replaces a leading icon if present), sets `aria-busy="true"`, and blocks activation (non-interactive, pointer-events disabled) while keeping the label visible so the width doesn\'t jump. Prefer this over a hand-rolled `<Loader2 className="animate-spin">` inside the button. Ignored when `asChild` (Slot requires a single child).'
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: "loadingText",
|
|
746
|
+
type: "string",
|
|
747
|
+
description: "Optional label to swap in while `loading` (pass the `t()`-translated string, e.g. `loadingText={t('saving')}`). When omitted the original children stay beside the spinner."
|
|
748
|
+
},
|
|
738
749
|
{
|
|
739
750
|
name: "onClick",
|
|
740
751
|
type: "React.MouseEventHandler<HTMLButtonElement>",
|
|
741
|
-
description: "Click handler."
|
|
752
|
+
description: "Click handler. Does not fire while `loading` or `disabled`."
|
|
742
753
|
}
|
|
743
754
|
],
|
|
744
755
|
usage: [
|
|
@@ -747,7 +758,8 @@ function MyShell({ children }: { content: React.ReactNode }) {
|
|
|
747
758
|
"DO use `asChild` to render the button as a React Router/Inertia `<Link>` or native `<a>` while keeping all button styling and a11y: `<Button asChild variant=\"outline\"><Link href={route('invoices.show', id)}>\u8A73\u7D30</Link></Button>`. Never wrap a `<button>` around an `<a>` \u2014 that is invalid HTML.",
|
|
748
759
|
"DON'T use raw `<button>` elements anywhere in the UI \u2014 always use this `Button`. The only exception is an `aria-hidden` native control used as an e2e/a11y hook paired with a visible godx-ui control.",
|
|
749
760
|
'DO set `type="submit"` explicitly on form submit buttons (the default HTML button type inside `<form>` is already `submit`, but being explicit prevents accidental double-submissions when a `type="button"` sibling exists). For cancel/reset actions set `type="button"` to avoid accidental form submission.',
|
|
750
|
-
"DON'T apply raw padding, height, or `rounded-*` overrides to `Button` via `className` \u2014 the size variants encode the full box model. If a custom size is truly needed, use `buttonVariants` from `@godxjp/ui/general` to compose a new cva class rather than fighting the existing ones."
|
|
761
|
+
"DON'T apply raw padding, height, or `rounded-*` overrides to `Button` via `className` \u2014 the size variants encode the full box model. If a custom size is truly needed, use `buttonVariants` from `@godxjp/ui/general` to compose a new cva class rather than fighting the existing ones.",
|
|
762
|
+
"DO use the `loading` prop for async/pending actions instead of hand-rolling `<Loader2 className=\"animate-spin\">` inside the button \u2014 `loading` renders the spinner, sets `aria-busy`, and blocks activation for you; pair with `loadingText={t('saving')}` to swap the label. For a TanStack Query refetch use `ButtonRefetch` (it owns its own loading lifecycle) rather than wiring `loading` manually."
|
|
751
763
|
],
|
|
752
764
|
useCases: [
|
|
753
765
|
'Primary form submission in a Dialog or Sheet (e.g. `<Button type="submit" disabled={form.processing}>\u4FDD\u5B58</Button>`) \u2014 the `disabled` prop greys it out and blocks pointer events, preventing double-submit during async operations.',
|
|
@@ -781,9 +793,9 @@ import { Trash2 } from "lucide-react";
|
|
|
781
793
|
props: [
|
|
782
794
|
{
|
|
783
795
|
name: "size",
|
|
784
|
-
type: '"2xs" | "xs" | "sm" | "md" | "lg" | "xl"',
|
|
796
|
+
type: '"2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"',
|
|
785
797
|
defaultValue: '"sm"',
|
|
786
|
-
description: "Golden-ratio type-scale step. NEVER an arbitrary px (`text-[13px]` is banned) \u2014 pick the nearest step."
|
|
798
|
+
description: "Golden-ratio type-scale step (2xs\u20262xl). NEVER an arbitrary px (`text-[13px]` is banned) \u2014 pick the nearest step."
|
|
787
799
|
},
|
|
788
800
|
{
|
|
789
801
|
name: "tone",
|
|
@@ -793,9 +805,9 @@ import { Trash2 } from "lucide-react";
|
|
|
793
805
|
},
|
|
794
806
|
{
|
|
795
807
|
name: "weight",
|
|
796
|
-
type: '"regular" | "medium" | "
|
|
808
|
+
type: '"regular" | "medium" | "bold"',
|
|
797
809
|
defaultValue: '"regular"',
|
|
798
|
-
description: "Font weight
|
|
810
|
+
description: "Font weight \u2014 the 3-weight canon: regular 400 (body), medium 500 (label), bold 700 (emphasis). 600/semibold is forbidden."
|
|
799
811
|
},
|
|
800
812
|
{ name: "align", type: '"start" | "center" | "end"', description: "Logical text alignment." },
|
|
801
813
|
{ name: "truncate", type: "boolean", description: "Single-line ellipsis." },
|
|
@@ -803,9 +815,9 @@ import { Trash2 } from "lucide-react";
|
|
|
803
815
|
{ name: "mono", type: "boolean", description: "Monospace family for codes / ids." },
|
|
804
816
|
{
|
|
805
817
|
name: "as",
|
|
806
|
-
type: '"span" | "p" | "div" | "label" | "strong" | "em" | "small"',
|
|
818
|
+
type: '"span" | "p" | "div" | "label" | "strong" | "em" | "small" | "code" | "kbd" | "dt" | "dd" | "caption" | "abbr"',
|
|
807
819
|
defaultValue: '"span"',
|
|
808
|
-
description: "Rendered element."
|
|
820
|
+
description: "Rendered element. `code`/`kbd` are monospace by default."
|
|
809
821
|
}
|
|
810
822
|
],
|
|
811
823
|
usage: [
|
|
@@ -1917,6 +1929,119 @@ import { ResponsiveGrid } from "@godxjp/ui/layout";
|
|
|
1917
1929
|
storyPath: "data-entry/Input.stories.tsx",
|
|
1918
1930
|
rules: []
|
|
1919
1931
|
},
|
|
1932
|
+
{
|
|
1933
|
+
name: "NumberInput",
|
|
1934
|
+
group: "data-entry",
|
|
1935
|
+
tagline: "WAI-ARIA spinbutton for localized numeric entry \u2014 composes the real Input (role=spinbutton, inputMode=decimal) with stacked increment/decrement step Buttons. Type freely, Arrow/Shift-Arrow step, value commits clamped to min/max + rounded to precision.",
|
|
1936
|
+
props: [
|
|
1937
|
+
{
|
|
1938
|
+
name: "value",
|
|
1939
|
+
type: "number | null",
|
|
1940
|
+
description: "Controlled value. `null` = empty field. Pair with `onValueChange`."
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
name: "defaultValue",
|
|
1944
|
+
type: "number | null",
|
|
1945
|
+
defaultValue: "null",
|
|
1946
|
+
description: "Uncontrolled initial value."
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
name: "onValueChange",
|
|
1950
|
+
type: "(value: number | null) => void",
|
|
1951
|
+
description: "Value change callback (vocabulary triad \u2014 NOT onChange). Receives `null` when the field is empty."
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
name: "min",
|
|
1955
|
+
type: "number",
|
|
1956
|
+
description: "Lower bound \u2014 clamps on commit and disables the decrement stepper at the floor."
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
name: "max",
|
|
1960
|
+
type: "number",
|
|
1961
|
+
description: "Upper bound \u2014 clamps on commit and disables the increment stepper at the ceiling."
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
name: "step",
|
|
1965
|
+
type: "number",
|
|
1966
|
+
defaultValue: "1",
|
|
1967
|
+
description: "Increment for the steppers + ArrowUp/ArrowDown (Shift = \xD710)."
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
name: "precision",
|
|
1971
|
+
type: "number",
|
|
1972
|
+
description: "Committed decimal places. Inferred from `step` when omitted."
|
|
1973
|
+
},
|
|
1974
|
+
{ name: "disabled", type: "boolean", description: "Disables typing and stepping." },
|
|
1975
|
+
{
|
|
1976
|
+
name: "readOnly",
|
|
1977
|
+
type: "boolean",
|
|
1978
|
+
description: "Value is shown and selectable but not typeable or steppable."
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
name: "size",
|
|
1982
|
+
type: '"xs" | "sm" | "md" | "lg"',
|
|
1983
|
+
defaultValue: '"md"',
|
|
1984
|
+
description: "Control height tier (--control-height). Aligns with sibling controls on a row."
|
|
1985
|
+
},
|
|
1986
|
+
{ name: "placeholder", type: "string", description: "Placeholder shown when empty." },
|
|
1987
|
+
{
|
|
1988
|
+
name: "prefix",
|
|
1989
|
+
type: "React.ReactNode",
|
|
1990
|
+
description: "Leading decorative affix inside the field (e.g. `\xA5`). aria-hidden."
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
name: "suffix",
|
|
1994
|
+
type: "React.ReactNode",
|
|
1995
|
+
description: "Trailing decorative affix inside the field (e.g. `%`). aria-hidden."
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
name: "name",
|
|
1999
|
+
type: "string",
|
|
2000
|
+
description: "Form field name \u2014 submits its value natively."
|
|
2001
|
+
},
|
|
2002
|
+
{ name: "id", type: "string", description: "Associates with a <label htmlFor> / FormField." },
|
|
2003
|
+
{
|
|
2004
|
+
name: "aria-label",
|
|
2005
|
+
type: "string",
|
|
2006
|
+
description: "Accessible name for the spinbutton when no visible FormField label is present."
|
|
2007
|
+
}
|
|
2008
|
+
],
|
|
2009
|
+
usage: [
|
|
2010
|
+
"DO use NumberInput (not `<Input type='number'>`) whenever numeric entry wants steppers, min/max clamping, precision rounding, or a \xA5/% affix \u2014 it is the canonical numeric primitive. Plain Input has no stepper and no clamp.",
|
|
2011
|
+
"DO drive it controlled with `value` + `onValueChange` carrying `number | null` (the vocabulary triad \u2014 NOT `onChange`). `null` means the field is empty; never substitute 0 for empty.",
|
|
2012
|
+
"DON'T pass `value` without `onValueChange` \u2014 like every controlled @godxjp/ui input it would freeze. Omit both for uncontrolled (use `defaultValue`).",
|
|
2013
|
+
"DO set `step` to your increment and let `precision` (or the decimals of `step`) round the committed value: `step={0.25} precision={2}` gives quarter-step entry rounded to 2 places on blur/Enter.",
|
|
2014
|
+
"DO set `min`/`max` for bounded quantities \u2014 the value clamps on commit and the matching stepper Button auto-disables at the bound. The steppers are tabIndex=-1 so they never pollute the keyboard tab order (Arrow keys cover keyboard stepping).",
|
|
2015
|
+
"DON'T wrap it in a hand-rolled label/error markup \u2014 compose it inside FormField (matching `id`) for the aria wiring, exactly like Input.",
|
|
2016
|
+
"DON'T format the value yourself for display \u2014 NumberInput formats at rest via Intl.NumberFormat in the active locale while keeping the raw value typeable on focus."
|
|
2017
|
+
],
|
|
2018
|
+
useCases: [
|
|
2019
|
+
"Quantity / line-item steppers in order, invoice, or cart forms (min={1}, step={1}) where \xB1 buttons and a floor are expected.",
|
|
2020
|
+
"Price / amount fields with a currency affix (prefix='\xA5', step={10}) \u2014 the affix is decorative and the committed value stays a plain number.",
|
|
2021
|
+
"Percentage / rate inputs bounded 0\u2013100 (suffix='%', min={0} max={100}).",
|
|
2022
|
+
"Decimal measurements \u2014 weight, dimensions, exchange rates (step={0.25}, precision={2}) needing rounded commit.",
|
|
2023
|
+
"Any bounded numeric setting (timeouts, retry counts, page sizes) where a slider is too coarse and a free Input lacks clamping."
|
|
2024
|
+
],
|
|
2025
|
+
related: [
|
|
2026
|
+
"Input \u2014 the plain single-line field NumberInput composes; use Input directly only for free numeric text with no stepper/clamp need.",
|
|
2027
|
+
"Slider \u2014 use instead when the user picks an approximate value within a range by dragging; NumberInput is for exact keyed entry.",
|
|
2028
|
+
"FormField \u2014 compose NumberInput inside FormField (matching id) for label/helper/error a11y wiring.",
|
|
2029
|
+
"TimeInput \u2014 the HH:mm sibling spinbutton; NumberInput is for plain numbers, TimeInput for clock times."
|
|
2030
|
+
],
|
|
2031
|
+
storyPath: "data-entry/NumberInput.stories.tsx",
|
|
2032
|
+
rules: [3, 6],
|
|
2033
|
+
example: `import { NumberInput } from "@godxjp/ui/data-entry";
|
|
2034
|
+
|
|
2035
|
+
<NumberInput
|
|
2036
|
+
value={qty}
|
|
2037
|
+
onValueChange={setQty}
|
|
2038
|
+
min={1}
|
|
2039
|
+
max={99}
|
|
2040
|
+
step={1}
|
|
2041
|
+
prefix="\xA5"
|
|
2042
|
+
aria-label="\u6570\u91CF"
|
|
2043
|
+
/>`
|
|
2044
|
+
},
|
|
1920
2045
|
{
|
|
1921
2046
|
name: "SearchInput",
|
|
1922
2047
|
group: "data-entry",
|
|
@@ -10097,7 +10222,7 @@ ${c.example}
|
|
|
10097
10222
|
// package.json
|
|
10098
10223
|
var package_default = {
|
|
10099
10224
|
name: "@godxjp/ui-mcp",
|
|
10100
|
-
version: "0.
|
|
10225
|
+
version: "0.21.0",
|
|
10101
10226
|
description: "Model Context Protocol server for @godxjp/ui \u2014 gives Claude Code / Codex CLI / Cursor / any MCP-aware agent live access to the component catalog, prop vocabulary, design tokens, 34 cardinal rules, copy-paste-ready patterns, 12 design / taste skills synthesised from Leonxlnx/taste-skill, 20+ anti-AI-tell patterns, and a 50-check redesign audit \u2014 token-efficient (list \u2192 drill-down).",
|
|
10102
10227
|
type: "module",
|
|
10103
10228
|
main: "./dist/index.js",
|