@jonmilner/ui 0.23.1 → 0.23.2
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/ColorField/ColorField.css +1 -1
- package/dist/Combobox/Combobox.css +1 -1
- package/dist/NumberField/NumberField.css +1 -1
- package/dist/SearchField/SearchField.css +1 -1
- package/dist/TextField/TextField.css +1 -1
- package/dist/Textarea/Textarea.css +1 -1
- package/dist/Textarea/Textarea.css.mjs +15 -6
- package/dist/Textarea/client.mjs +52 -0
- package/dist/Textarea/index.d.mts +6 -1
- package/dist/Textarea/index.mjs +54 -34
- package/dist/docs/Textarea.md +49 -3
- package/dist/docs/llms.txt +1 -1
- package/dist/docs/manifest.json +16 -1
- package/dist/styles/control-inset.mjs +7 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.flex, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.alert, components.avatar, components.badge, components.body, components.button, components.caption, components.chip, components.code, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.label, components.menu, components.multiselect, components.number-field, components.popover, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.nav-list, components.table;
|
|
2
|
-
@layer components.color-field{.nmj5ie0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}.nmj5ie1{appearance:none;border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);
|
|
2
|
+
@layer components.color-field{.nmj5ie0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}.nmj5ie1{appearance:none;inline-size:100%;min-inline-size:0;color:var(--color-fg);border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);grid-area:1/1;padding-block:0}.nmj5ie1::placeholder{color:var(--color-fg-muted);opacity:1}.nmj5ie1:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}.nmj5ie1:disabled{background-color:var(--color-bg-muted);color:var(--color-fg-muted);cursor:not-allowed;border-style:dashed}.nmj5ie1[aria-invalid=true]{border-color:var(--color-danger)}.nmj5ie1[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}.nmj5ie2{block-size:var(--size-xs);padding-inline-start:calc(var(--size-xs) + var(--space-12));padding-inline-end:var(--space-6)}.nmj5ie3{block-size:var(--size-sm);padding-inline-start:calc(var(--size-xs) + var(--space-12));padding-inline-end:var(--space-8)}.nmj5ie4{block-size:var(--size-med);padding-inline-start:calc(var(--size-sm) + var(--space-12));padding-inline-end:var(--space-12)}.nmj5ie5{appearance:none;border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-xs);cursor:pointer;background-color:#0000;grid-area:1/1;justify-self:start;padding:0;position:relative;inset-inline-start:var(--space-4)}.nmj5ie5::-webkit-color-swatch-wrapper{padding:0}.nmj5ie5::-webkit-color-swatch{border-radius:var(--radius-xs);forced-color-adjust:none;border:none}.nmj5ie5::-moz-color-swatch{border-radius:var(--radius-xs);forced-color-adjust:none;border:none}.nmj5ie5:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}.nmj5ie5:disabled{cursor:not-allowed;border-style:dashed}.nmj5ie6,.nmj5ie7{inline-size:var(--size-xs);block-size:var(--size-xs)}.nmj5ie8{inline-size:var(--size-sm);block-size:var(--size-sm)}.nmj5ie9{font-family:var(--font-body);font-size:var(--font-size-xs);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:calc(var(--size-xs) + var(--space-12));line-height:normal}.nmj5iea{font-family:var(--font-body);font-size:var(--font-size-sm);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:calc(var(--size-xs) + var(--space-12));line-height:normal}.nmj5ieb{font-family:var(--font-body);font-size:var(--font-size-med);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:calc(var(--size-sm) + var(--space-12));line-height:normal}.nmj5iec{font-family:var(--font-body);font-size:var(--font-size-xs);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-6);line-height:normal}.nmj5ied{font-family:var(--font-body);font-size:var(--font-size-sm);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-8);line-height:normal}.nmj5iee{font-family:var(--font-body);font-size:var(--font-size-med);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-12);line-height:normal}.nmj5ief{vertical-align:calc((1cap - var(--font-size-xs)) / 2);display:inline-block}.nmj5ieg{vertical-align:calc((1cap - var(--font-size-sm)) / 2);display:inline-block}.nmj5ieh{vertical-align:calc((1cap - var(--font-size-med)) / 2);display:inline-block}.nmj5iei{padding-inline-start:calc(calc(var(--size-xs) + var(--space-12)) + var(--font-size-xs) + var(--space-4))}.nmj5iej{padding-inline-start:calc(calc(var(--size-xs) + var(--space-12)) + var(--font-size-sm) + var(--space-4))}.nmj5iek{padding-inline-start:calc(calc(var(--size-sm) + var(--space-12)) + var(--font-size-med) + var(--space-8))}.nmj5iel{padding-inline-end:calc(var(--space-6) + var(--font-size-xs) + var(--space-4))}.nmj5iem{padding-inline-end:calc(var(--space-8) + var(--font-size-sm) + var(--space-4))}.nmj5ien{padding-inline-end:calc(var(--space-12) + var(--font-size-med) + var(--space-8))}@media (pointer:coarse){.nmj5ie1,.nmj5ie9,.nmj5iea,.nmj5ieb,.nmj5iec,.nmj5ied,.nmj5iee{font-size:var(--font-size-med)}}@media (forced-colors:active){.nmj5ie1:disabled{color:graytext;border-color:graytext}.nmj5ie5{border-color:canvastext}.nmj5ie5:disabled{border-color:graytext}}@supports (text-box:trim-both cap alphabetic){.nmj5ie1{text-box-trim:none}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.flex, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.alert, components.avatar, components.badge, components.body, components.button, components.caption, components.chip, components.code, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.label, components.menu, components.multiselect, components.number-field, components.popover, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.nav-list, components.table;
|
|
2
|
-
@layer components.combobox{.y6b2yi0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}.y6b2yi1{text-align:start;border-color:var(--color-border-strong);justify-content:stretch}.y6b2yi1[aria-invalid=true]{border-color:var(--color-danger)}.y6b2yi1[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}:where(.y6b2yi1) ._1gwwloa0{flex:auto;justify-items:stretch;min-inline-size:0}:where(.y6b2yi1) ._1gwwloa1{min-inline-size:0}:where(.y6b2yi1) ._1gwwloa2{flex:auto;min-inline-size:0}.y6b2yi2{min-inline-size:0;display:block}.y6b2yi2[data-placeholder]{color:var(--color-fg-muted)}.y6b2yi3{min-inline-size:0;display:grid}.y6b2yi4{grid-area:1/1}.y6b2yi4[aria-hidden=true]{visibility:hidden}.y6b2yi5{grid-area:1/1}.y6b2yi6{border:var(--space-1) solid var(--color-border);min-inline-size:min(var(--anchor-width), var(--available-width));max-inline-size:var(--available-width);max-block-size:var(--available-height);transform-origin:var(--transform-origin);transition:opacity var(--duration-fast) var(--easing-standard), scale var(--duration-fast) var(--easing-enter);overflow:hidden}.y6b2yi6:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}.y6b2yi6[data-starting-style],.y6b2yi6[data-ending-style]{opacity:0;scale:calc(1 - var(--scale-med))}.y6b2yi7{appearance:none;border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-xs);background-color:var(--color-bg);
|
|
2
|
+
@layer components.combobox{.y6b2yi0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}.y6b2yi1{text-align:start;border-color:var(--color-border-strong);justify-content:stretch}.y6b2yi1[aria-invalid=true]{border-color:var(--color-danger)}.y6b2yi1[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}:where(.y6b2yi1) ._1gwwloa0{flex:auto;justify-items:stretch;min-inline-size:0}:where(.y6b2yi1) ._1gwwloa1{min-inline-size:0}:where(.y6b2yi1) ._1gwwloa2{flex:auto;min-inline-size:0}.y6b2yi2{min-inline-size:0;display:block}.y6b2yi2[data-placeholder]{color:var(--color-fg-muted)}.y6b2yi3{min-inline-size:0;display:grid}.y6b2yi4{grid-area:1/1}.y6b2yi4[aria-hidden=true]{visibility:hidden}.y6b2yi5{grid-area:1/1}.y6b2yi6{border:var(--space-1) solid var(--color-border);min-inline-size:min(var(--anchor-width), var(--available-width));max-inline-size:var(--available-width);max-block-size:var(--available-height);transform-origin:var(--transform-origin);transition:opacity var(--duration-fast) var(--easing-standard), scale var(--duration-fast) var(--easing-enter);overflow:hidden}.y6b2yi6:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}.y6b2yi6[data-starting-style],.y6b2yi6[data-ending-style]{opacity:0;scale:calc(1 - var(--scale-med))}.y6b2yi7{appearance:none;inline-size:100%;min-inline-size:0;color:var(--color-fg);border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-xs);background-color:var(--color-bg);padding-block:0}.y6b2yi7::placeholder{color:var(--color-fg-muted);opacity:1}.y6b2yi7:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}.y6b2yi7:disabled{background-color:var(--color-bg-muted);color:var(--color-fg-muted);cursor:not-allowed;border-style:dashed}.y6b2yi7[aria-invalid=true]{border-color:var(--color-danger)}.y6b2yi7[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}.y6b2yi8{block-size:var(--size-xs);padding-inline:var(--space-6)}.y6b2yi9{block-size:var(--size-sm);padding-inline:var(--space-8)}.y6b2yia{block-size:var(--size-med);padding-inline:var(--space-12)}.y6b2yib:empty{position:absolute}.y6b2yib:not(:empty){padding-block:var(--space-8);padding-inline:var(--space-12)}.y6b2yic{min-block-size:0;overflow-y:auto}.y6b2yid{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;overflow-wrap:anywhere;-webkit-user-select:none;user-select:none}.y6b2yid:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:calc(-1 * var(--space-2))}.y6b2yid[data-highlighted]{background-color:light-dark(var(--color-bg-muted),color-mix(in srgb, var(--color-fg) 10%, var(--color-bg-raised)))}.y6b2yid[aria-disabled=true]{color:var(--color-fg-muted);cursor:not-allowed}.y6b2yie{visibility:hidden;flex-shrink:0}.y6b2yid[aria-selected=true] .y6b2yie{visibility:visible}@media (pointer:coarse){.y6b2yi7{font-size:var(--font-size-med)}}@media (forced-colors:active){.y6b2yi1{--color-fg:CanvasText}.y6b2yi1[aria-disabled=true]{border-color:graytext}.y6b2yi7:disabled{color:graytext;border-color:graytext}.y6b2yid[data-highlighted]{forced-color-adjust:none;color:highlighttext;background-color:highlight}.y6b2yid[data-highlighted]:focus-visible{color:canvastext;background-color:canvas}.y6b2yid[aria-disabled=true]{color:graytext}}@supports (text-box:trim-both cap alphabetic){.y6b2yi4,.y6b2yi5{text-box-trim:trim-both}.y6b2yi7{text-box-trim:none}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.flex, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.alert, components.avatar, components.badge, components.body, components.button, components.caption, components.chip, components.code, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.label, components.menu, components.multiselect, components.number-field, components.popover, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.nav-list, components.table;
|
|
2
|
-
@layer components.number-field{._4ak7w90{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._4ak7w91{grid-template-columns:var(--space-4) auto minmax(0, 1fr) auto var(--space-4)}._4ak7w92{appearance:none;border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);
|
|
2
|
+
@layer components.number-field{._4ak7w90{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._4ak7w91{grid-template-columns:var(--space-4) auto minmax(0, 1fr) auto var(--space-4)}._4ak7w92{appearance:none;inline-size:100%;min-inline-size:0;color:var(--color-fg);border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);text-align:center;grid-area:1/1/auto/-1;padding-block:0}._4ak7w92::placeholder{color:var(--color-fg-muted);opacity:1}._4ak7w92:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._4ak7w92:disabled{background-color:var(--color-bg-muted);color:var(--color-fg-muted);cursor:not-allowed;border-style:dashed}._4ak7w92[aria-invalid=true]{border-color:var(--color-danger)}._4ak7w92[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}._4ak7w93{block-size:var(--size-xs);padding-inline:calc(var(--size-xs) + var(--space-4))}._4ak7w94{block-size:var(--size-sm);padding-inline:calc(var(--size-xs) + var(--space-4))}._4ak7w95{block-size:var(--size-med);padding-inline:calc(var(--size-sm) + var(--space-4))}._4ak7w96{background-clip:padding-box;grid-area:1/2}._4ak7w97{background-clip:padding-box;grid-area:1/4}@media (pointer:coarse){._4ak7w92{font-size:var(--font-size-med)}}@media (forced-colors:active){._4ak7w92:disabled{color:graytext;border-color:graytext}._4ak7w96{border-color:#0000}._4ak7w96[aria-disabled=true]{border-color:graytext}._4ak7w97{border-color:#0000}._4ak7w97[aria-disabled=true]{border-color:graytext}}@supports (text-box:trim-both cap alphabetic){._4ak7w92{text-box-trim:none}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.flex, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.alert, components.avatar, components.badge, components.body, components.button, components.caption, components.chip, components.code, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.label, components.menu, components.multiselect, components.number-field, components.popover, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.nav-list, components.table;
|
|
2
|
-
@layer components.search-field{._1cj8r6g0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._1cj8r6g1{appearance:none;border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);
|
|
2
|
+
@layer components.search-field{._1cj8r6g0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._1cj8r6g1{appearance:none;inline-size:100%;min-inline-size:0;color:var(--color-fg);border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);grid-area:1/1;padding-block:0}._1cj8r6g1::placeholder{color:var(--color-fg-muted);opacity:1}._1cj8r6g1:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._1cj8r6g1:disabled{background-color:var(--color-bg-muted);color:var(--color-fg-muted);cursor:not-allowed;border-style:dashed}._1cj8r6g1[aria-invalid=true]{border-color:var(--color-danger)}._1cj8r6g1[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}._1cj8r6g1::-webkit-search-cancel-button{appearance:none}._1cj8r6g1::-webkit-search-decoration{appearance:none}._1cj8r6g2{block-size:var(--size-xs);padding-inline-start:var(--space-6);padding-inline-end:calc(var(--size-xs) + var(--space-4))}._1cj8r6g3{block-size:var(--size-sm);padding-inline-start:var(--space-8);padding-inline-end:calc(var(--size-xs) + var(--space-4))}._1cj8r6g4{block-size:var(--size-med);padding-inline-start:var(--space-12);padding-inline-end:calc(var(--size-sm) + var(--space-4))}._1cj8r6g5{font-family:var(--font-body);font-size:var(--font-size-xs);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:var(--space-6);line-height:normal}._1cj8r6g6{font-family:var(--font-body);font-size:var(--font-size-sm);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:var(--space-8);line-height:normal}._1cj8r6g7{font-family:var(--font-body);font-size:var(--font-size-med);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:var(--space-12);line-height:normal}._1cj8r6g8{font-family:var(--font-body);font-size:var(--font-size-xs);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-6);line-height:normal}._1cj8r6g9{font-family:var(--font-body);font-size:var(--font-size-sm);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-8);line-height:normal}._1cj8r6ga{font-family:var(--font-body);font-size:var(--font-size-med);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-12);line-height:normal}._1cj8r6gb{vertical-align:calc((1cap - var(--font-size-xs)) / 2);display:inline-block}._1cj8r6gc{vertical-align:calc((1cap - var(--font-size-sm)) / 2);display:inline-block}._1cj8r6gd{vertical-align:calc((1cap - var(--font-size-med)) / 2);display:inline-block}._1cj8r6ge{padding-inline-start:calc(var(--space-6) + var(--font-size-xs) + var(--space-4))}._1cj8r6gf{padding-inline-start:calc(var(--space-8) + var(--font-size-sm) + var(--space-4))}._1cj8r6gg{padding-inline-start:calc(var(--space-12) + var(--font-size-med) + var(--space-8))}._1cj8r6gh{padding-inline-end:calc(var(--space-6) + var(--font-size-xs) + var(--space-4))}._1cj8r6gi{padding-inline-end:calc(var(--space-8) + var(--font-size-sm) + var(--space-4))}._1cj8r6gj{padding-inline-end:calc(var(--space-12) + var(--font-size-med) + var(--space-8))}._1cj8r6gk{background-clip:padding-box;grid-area:1/1;justify-self:end;position:relative;inset-inline-end:var(--space-4)}@media (pointer:coarse){._1cj8r6g1,._1cj8r6g5,._1cj8r6g6,._1cj8r6g7,._1cj8r6g8,._1cj8r6g9,._1cj8r6ga{font-size:var(--font-size-med)}}@media (forced-colors:active){._1cj8r6g1:disabled{color:graytext;border-color:graytext}._1cj8r6gk{border-color:#0000}}@supports (text-box:trim-both cap alphabetic){._1cj8r6g1{text-box-trim:none}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.flex, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.alert, components.avatar, components.badge, components.body, components.button, components.caption, components.chip, components.code, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.label, components.menu, components.multiselect, components.number-field, components.popover, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.nav-list, components.table;
|
|
2
|
-
@layer components.text-field{._20at410{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._20at411{appearance:none;border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);
|
|
2
|
+
@layer components.text-field{._20at410{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._20at411{appearance:none;inline-size:100%;min-inline-size:0;color:var(--color-fg);border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);grid-area:1/1;padding-block:0}._20at411::placeholder{color:var(--color-fg-muted);opacity:1}._20at411:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._20at411:disabled{background-color:var(--color-bg-muted);color:var(--color-fg-muted);cursor:not-allowed;border-style:dashed}._20at411[aria-invalid=true]{border-color:var(--color-danger)}._20at411[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}._20at412{block-size:var(--size-xs);padding-inline:var(--space-6)}._20at413{block-size:var(--size-sm);padding-inline:var(--space-8)}._20at414{block-size:var(--size-med);padding-inline:var(--space-12)}._20at415{font-family:var(--font-body);font-size:var(--font-size-xs);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:var(--space-6);line-height:normal}._20at416{font-family:var(--font-body);font-size:var(--font-size-sm);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:var(--space-8);line-height:normal}._20at417{font-family:var(--font-body);font-size:var(--font-size-med);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center start;padding-inline-start:var(--space-12);line-height:normal}._20at418{font-family:var(--font-body);font-size:var(--font-size-xs);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-6);line-height:normal}._20at419{font-family:var(--font-body);font-size:var(--font-size-sm);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-8);line-height:normal}._20at41a{font-family:var(--font-body);font-size:var(--font-size-med);color:var(--color-fg-muted);pointer-events:none;grid-area:1/1;place-self:center end;padding-inline-end:var(--space-12);line-height:normal}._20at41b{vertical-align:calc((1cap - var(--font-size-xs)) / 2);display:inline-block}._20at41c{vertical-align:calc((1cap - var(--font-size-sm)) / 2);display:inline-block}._20at41d{vertical-align:calc((1cap - var(--font-size-med)) / 2);display:inline-block}._20at41e{padding-inline-start:calc(var(--space-6) + var(--font-size-xs) + var(--space-4))}._20at41f{padding-inline-start:calc(var(--space-8) + var(--font-size-sm) + var(--space-4))}._20at41g{padding-inline-start:calc(var(--space-12) + var(--font-size-med) + var(--space-8))}._20at41h{padding-inline-end:calc(var(--space-6) + var(--font-size-xs) + var(--space-4))}._20at41i{padding-inline-end:calc(var(--space-8) + var(--font-size-sm) + var(--space-4))}._20at41j{padding-inline-end:calc(var(--space-12) + var(--font-size-med) + var(--space-8))}@media (pointer:coarse){._20at411,._20at415,._20at416,._20at417,._20at418,._20at419,._20at41a{font-size:var(--font-size-med)}}@media (forced-colors:active){._20at411:disabled{color:graytext;border-color:graytext}}@supports (text-box:trim-both cap alphabetic){._20at411{text-box-trim:none}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.flex, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.alert, components.avatar, components.badge, components.body, components.button, components.caption, components.chip, components.code, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.label, components.menu, components.multiselect, components.number-field, components.popover, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.nav-list, components.table;
|
|
2
|
-
@layer components.textarea{._1kwv2lp0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._1kwv2lp1
|
|
2
|
+
@layer components.textarea{._1kwv2lp0{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;overflow:hidden}._1kwv2lp4{--_1kwv2lp3:calc(var(--_1kwv2lp1) + 2 * var(--_1kwv2lp2) + 2 * var(--space-1));appearance:none;inline-size:100%;min-inline-size:0;color:var(--color-fg);border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);min-block-size:var(--_1kwv2lp3);resize:block;padding-block:0}._1kwv2lp4::placeholder{color:var(--color-fg-muted);opacity:1}._1kwv2lp4:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._1kwv2lp4:disabled{background-color:var(--color-bg-muted);color:var(--color-fg-muted);cursor:not-allowed;resize:none;border-style:dashed}._1kwv2lp4[aria-invalid=true]{border-color:var(--color-danger)}._1kwv2lp4[aria-invalid=true]:not(:focus-visible){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}._1kwv2lp5{--_1kwv2lp1:calc(var(--font-size-xs) * var(--line-height-med));--_1kwv2lp2:calc((var(--size-xs) - 2 * var(--space-1) - var(--font-size-xs) * var(--line-height-med)) / 2);padding-block:var(--_1kwv2lp2);padding-inline:var(--space-6)}._1kwv2lp6{--_1kwv2lp1:calc(var(--font-size-sm) * var(--line-height-med));--_1kwv2lp2:calc((var(--size-sm) - 2 * var(--space-1) - var(--font-size-sm) * var(--line-height-med)) / 2);padding-block:var(--_1kwv2lp2);padding-inline:var(--space-8)}._1kwv2lp7{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:calc((var(--size-med) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2);padding-block:var(--_1kwv2lp2);padding-inline:var(--space-12)}._1kwv2lp8{border-width:var(--space-1);border-style:solid;border-color:var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);inline-size:100%;min-inline-size:0}._1kwv2lp8:has(textarea:focus-visible){outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._1kwv2lp8:has(textarea:disabled){background-color:var(--color-bg-muted);border-style:dashed}._1kwv2lp8:has(textarea[aria-invalid=true]){border-color:var(--color-danger)}._1kwv2lp8:has(textarea[aria-invalid=true]:not(:focus-visible)){outline:var(--space-1) solid var(--color-danger);outline-offset:calc(-1 * var(--space-2))}._1kwv2lp9{--_1kwv2lp3:calc(var(--_1kwv2lp1) + 2 * var(--_1kwv2lp2) + 2 * var(--space-0));appearance:none;inline-size:100%;min-inline-size:0;color:var(--color-fg);min-block-size:var(--_1kwv2lp3);resize:block;background-color:#0000;border-width:0;padding-block:0}._1kwv2lp9::placeholder{color:var(--color-fg-muted);opacity:1}._1kwv2lp9:focus-visible{outline:none}._1kwv2lp9:disabled{color:var(--color-fg-muted);cursor:not-allowed;resize:none}._1kwv2lpa{--_1kwv2lp1:calc(var(--font-size-xs) * var(--line-height-med));--_1kwv2lp2:calc((var(--size-xs) - 2 * var(--space-1) - var(--font-size-xs) * var(--line-height-med)) / 2);padding-block:var(--_1kwv2lp2);padding-inline:var(--space-6)}._1kwv2lpb{--_1kwv2lp1:calc(var(--font-size-sm) * var(--line-height-med));--_1kwv2lp2:calc((var(--size-sm) - 2 * var(--space-1) - var(--font-size-sm) * var(--line-height-med)) / 2);padding-block:var(--_1kwv2lp2);padding-inline:var(--space-8)}._1kwv2lpc{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:calc((var(--size-med) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2);padding-block:var(--_1kwv2lp2);padding-inline:var(--space-12)}._1kwv2lpf{resize:none;field-sizing:content;min-block-size:calc((var(--_1kwv2lpd) - 1) * var(--_1kwv2lp1) + var(--_1kwv2lp3));max-block-size:var(--_1kwv2lpe,none);overflow-y:auto}@media (pointer:coarse){._1kwv2lp4{font-size:var(--font-size-med)}._1kwv2lp5{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:max(var(--space-0), calc((var(--size-xs) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2))}._1kwv2lp6{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:max(var(--space-0), calc((var(--size-sm) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2))}._1kwv2lp7{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:max(var(--space-0), calc((var(--size-med) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2))}._1kwv2lp9{font-size:var(--font-size-med)}._1kwv2lpa{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:max(var(--space-0), calc((var(--size-xs) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2))}._1kwv2lpb{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:max(var(--space-0), calc((var(--size-sm) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2))}._1kwv2lpc{--_1kwv2lp1:calc(var(--font-size-med) * var(--line-height-med));--_1kwv2lp2:max(var(--space-0), calc((var(--size-med) - 2 * var(--space-1) - var(--font-size-med) * var(--line-height-med)) / 2))}}@media (forced-colors:active){._1kwv2lp4:disabled{color:graytext;border-color:graytext}._1kwv2lp8:has(textarea:disabled){border-color:graytext}._1kwv2lp9:disabled{color:graytext}}@supports (text-box:trim-both cap alphabetic){._1kwv2lp4,._1kwv2lp9{text-box-trim:none}}}
|
|
@@ -5,13 +5,22 @@ import "./Textarea.css";
|
|
|
5
5
|
import { createRuntimeFn as e } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
6
6
|
// src/Textarea/Textarea.css.ts
|
|
7
7
|
var t = "_1kwv2lp0", n = e({
|
|
8
|
-
defaultClassName: "
|
|
8
|
+
defaultClassName: "_1kwv2lp4",
|
|
9
9
|
variantClassNames: { size: {
|
|
10
|
-
sm: "
|
|
11
|
-
med: "
|
|
12
|
-
lg: "
|
|
10
|
+
sm: "_1kwv2lp5",
|
|
11
|
+
med: "_1kwv2lp6",
|
|
12
|
+
lg: "_1kwv2lp7"
|
|
13
13
|
} },
|
|
14
14
|
defaultVariants: {},
|
|
15
15
|
compoundVariants: []
|
|
16
|
-
})
|
|
17
|
-
|
|
16
|
+
}), r = "_1kwv2lp8", i = e({
|
|
17
|
+
defaultClassName: "_1kwv2lp9",
|
|
18
|
+
variantClassNames: { size: {
|
|
19
|
+
sm: "_1kwv2lpa",
|
|
20
|
+
med: "_1kwv2lpb",
|
|
21
|
+
lg: "_1kwv2lpc"
|
|
22
|
+
} },
|
|
23
|
+
defaultVariants: {},
|
|
24
|
+
compoundVariants: []
|
|
25
|
+
}), a = "var(--_1kwv2lpd)", o = "var(--_1kwv2lpe)", s = "_1kwv2lpf";
|
|
26
|
+
export { r as box, i as boxedInput, s as grow, t as hiddenLabel, n as input, o as maxBlockSize, a as rows };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Text as e } from "../Text/index.mjs";
|
|
3
|
+
import { useCallback as t, useLayoutEffect as n, useRef as r } from "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
// src/Textarea/client.tsx
|
|
6
|
+
var a, o = () => a ??= CSS.supports("field-sizing", "content");
|
|
7
|
+
function s(e) {
|
|
8
|
+
let t = e.parentElement, n = t?.style.blockSize, r = e.scrollTop;
|
|
9
|
+
t && (t.style.blockSize = `${t.offsetHeight}px`), e.style.blockSize = "auto", e.style.blockSize = `${e.scrollHeight + e.offsetHeight - e.clientHeight}px`, t && (t.style.blockSize = n ?? ""), e.scrollTop = r;
|
|
10
|
+
}
|
|
11
|
+
function c(e, t) {
|
|
12
|
+
if (typeof e == "function") {
|
|
13
|
+
let n = e(t);
|
|
14
|
+
return typeof n == "function" ? n : () => e(null);
|
|
15
|
+
}
|
|
16
|
+
return e && (e.current = t), () => {
|
|
17
|
+
e && (e.current = null);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function l({ ref: a, ...l }) {
|
|
21
|
+
let u = r(null), d = r(a), f = r(void 0), p = t((e) => (u.current = e, f.current = c(d.current, e), () => {
|
|
22
|
+
u.current = null, f.current?.(), f.current = void 0;
|
|
23
|
+
}), []);
|
|
24
|
+
n(() => {
|
|
25
|
+
d.current !== a && (d.current = a, u.current && (f.current?.(), f.current = c(a, u.current)));
|
|
26
|
+
}, [a]);
|
|
27
|
+
let m = l.value !== void 0, h = r(void 0);
|
|
28
|
+
return n(() => {
|
|
29
|
+
u.current && !o() && s(u.current);
|
|
30
|
+
}, [l.value, l.size]), n(() => {
|
|
31
|
+
let e = u.current;
|
|
32
|
+
if (!e || o()) return;
|
|
33
|
+
let t = { id: 0 }, n = () => {
|
|
34
|
+
cancelAnimationFrame(t.id), t.id = requestAnimationFrame(() => s(e));
|
|
35
|
+
}, r = () => s(e), i = (t) => {
|
|
36
|
+
t.target === e.form && n();
|
|
37
|
+
};
|
|
38
|
+
h.current = e.getBoundingClientRect().width;
|
|
39
|
+
let a = new ResizeObserver(([e]) => {
|
|
40
|
+
let t = e.borderBoxSize[0].inlineSize;
|
|
41
|
+
t !== h.current && (h.current = t, n());
|
|
42
|
+
});
|
|
43
|
+
return m || e.addEventListener("input", r), document.addEventListener("reset", i, !0), a.observe(e), () => {
|
|
44
|
+
e.removeEventListener("input", r), document.removeEventListener("reset", i, !0), a.disconnect(), cancelAnimationFrame(t.id);
|
|
45
|
+
};
|
|
46
|
+
}, [m]), /* @__PURE__ */ i(e, {
|
|
47
|
+
as: "textarea",
|
|
48
|
+
...l,
|
|
49
|
+
ref: p
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export { l as GrowingTextarea };
|
|
@@ -3,6 +3,10 @@ import { TextFieldInputProps } from "../TextField/index.mjs";
|
|
|
3
3
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
4
|
export type TextareaInputProps = Pick<ComponentPropsWithRef<"textarea">, Exclude<keyof TextFieldInputProps, "pattern">>;
|
|
5
5
|
export type TextareaProps = StyleProps & {
|
|
6
|
+
actions?: ReactNode;
|
|
7
|
+
autoGrow?: boolean | {
|
|
8
|
+
maxBlockSize: string;
|
|
9
|
+
};
|
|
6
10
|
className?: string;
|
|
7
11
|
defaultValue?: string;
|
|
8
12
|
description?: ReactNode;
|
|
@@ -14,10 +18,11 @@ export type TextareaProps = StyleProps & {
|
|
|
14
18
|
name?: string;
|
|
15
19
|
onValueChange?: (value: string) => void;
|
|
16
20
|
placeholder?: string;
|
|
21
|
+
renderError?: (error: ReactNode) => ReactNode;
|
|
17
22
|
required?: boolean;
|
|
18
23
|
rows?: number;
|
|
19
24
|
size?: "sm" | "med" | "lg";
|
|
20
25
|
style?: CSSProperties;
|
|
21
26
|
value?: string;
|
|
22
27
|
};
|
|
23
|
-
export declare function Textarea({ label, hideLabel, rows, value, defaultValue, onValueChange, placeholder, description, error, size, disabled, required, name, inputProps, className, style, ...atoms }: TextareaProps): import("react").JSX.Element;
|
|
28
|
+
export declare function Textarea({ label, hideLabel, rows, value, defaultValue, onValueChange, placeholder, description, error, renderError, autoGrow, actions, size, disabled, required, name, inputProps, className, style, ...atoms }: TextareaProps): import("react").JSX.Element;
|
package/dist/Textarea/index.mjs
CHANGED
|
@@ -1,40 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Box as e } from "../Box/base.mjs";
|
|
2
|
+
import { Field as t } from "../Field/index.mjs";
|
|
3
|
+
import { controlInset as n } from "../styles/control-inset.mjs";
|
|
4
|
+
import { controlText as r } from "../styles/control-size.mjs";
|
|
5
|
+
import { customProperty as i } from "../styles/custom-property.mjs";
|
|
6
|
+
import { join as a } from "../styles/join.mjs";
|
|
7
|
+
import { Text as o } from "../Text/index.mjs";
|
|
8
|
+
import { GrowingTextarea as s } from "./client.mjs";
|
|
9
|
+
import { box as c, boxedInput as l, hiddenLabel as u, input as d, maxBlockSize as f, rows as p } from "./Textarea.css.mjs";
|
|
10
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
import { Input as g } from "@base-ui/react/input";
|
|
7
12
|
// src/Textarea/index.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var _ = (e) => e != null && e !== !1 && e !== "";
|
|
14
|
+
function v({ label: v, hideLabel: y = !1, rows: b = 3, value: x, defaultValue: S, onValueChange: C, placeholder: w, description: T, error: E, renderError: D, autoGrow: O = !1, actions: k, size: A = "med", disabled: j = !1, required: M = !1, name: N, inputProps: P, className: F, style: I, ...L }) {
|
|
15
|
+
let R = k !== void 0, z = O !== !1, B = typeof O == "object" ? O.maxBlockSize : void 0, V = z ? s : o, H = { [i(p)]: String(b) };
|
|
16
|
+
B !== void 0 && (H[i(f)] = B);
|
|
17
|
+
let U = /* @__PURE__ */ m(g, {
|
|
18
|
+
...P,
|
|
19
|
+
defaultValue: S,
|
|
20
|
+
name: N,
|
|
21
|
+
onValueChange: C && ((e) => C(e)),
|
|
22
|
+
placeholder: w,
|
|
23
|
+
render: /* @__PURE__ */ m(V, {
|
|
24
|
+
as: "textarea",
|
|
25
|
+
className: a(R ? l({ size: A }) : d({ size: A }), z && "_1kwv2lpf"),
|
|
26
|
+
rows: b,
|
|
27
|
+
size: r[A],
|
|
28
|
+
style: z ? H : void 0
|
|
29
|
+
}),
|
|
30
|
+
required: M,
|
|
31
|
+
value: x
|
|
32
|
+
}), W = /* @__PURE__ */ m(t.Error, { children: E });
|
|
33
|
+
return /* @__PURE__ */ h(t, {
|
|
34
|
+
...L,
|
|
35
|
+
className: F,
|
|
36
|
+
disabled: j,
|
|
37
|
+
invalid: _(E),
|
|
38
|
+
style: I,
|
|
15
39
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
className:
|
|
18
|
-
children:
|
|
40
|
+
/* @__PURE__ */ m(t.Label, {
|
|
41
|
+
className: y ? u : void 0,
|
|
42
|
+
children: v
|
|
19
43
|
}),
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
value: d
|
|
34
|
-
}),
|
|
35
|
-
h != null && /* @__PURE__ */ a(e.Description, { children: h }),
|
|
36
|
-
/* @__PURE__ */ a(e.Error, { children: g })
|
|
44
|
+
R ? /* @__PURE__ */ h(e, {
|
|
45
|
+
className: c,
|
|
46
|
+
children: [U, _(k) && /* @__PURE__ */ m(e, {
|
|
47
|
+
display: "flex",
|
|
48
|
+
gap: "4",
|
|
49
|
+
justifyContent: "end",
|
|
50
|
+
paddingBlockEnd: "4",
|
|
51
|
+
paddingInline: n[A],
|
|
52
|
+
children: k
|
|
53
|
+
})]
|
|
54
|
+
}) : U,
|
|
55
|
+
T != null && /* @__PURE__ */ m(t.Description, { children: T }),
|
|
56
|
+
D ? D(W) : W
|
|
37
57
|
]
|
|
38
58
|
});
|
|
39
59
|
}
|
|
40
|
-
export {
|
|
60
|
+
export { v as Textarea };
|
package/dist/docs/Textarea.md
CHANGED
|
@@ -2,25 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
A form field for several lines of free text: a `<textarea>` (role `textbox`, multi-line) with TextField's look. Built on Base UI's `Input` rendered as a textarea (ADR 0003); it composes `Field` for its label, description and error (ADR 0026, 0136). `rows` sets its starting height, three by default, and the user can drag it taller or shorter. Three sizes (`sm`, `med`, `lg`) set TextField's text size and padding, so the first line sits where a TextField's text does (ADR 0124).
|
|
5
|
+
A form field for several lines of free text: a `<textarea>` (role `textbox`, multi-line) with TextField's look. Built on Base UI's `Input` rendered as a textarea (ADR 0003); it composes `Field` for its label, description and error (ADR 0026, 0136). `rows` sets its starting height, three by default, and the user can drag it taller or shorter; with `autoGrow` it grows with its text instead. Three sizes (`sm`, `med`, `lg`) set TextField's text size and padding, so the first line sits where a TextField's text does (ADR 0124).
|
|
6
6
|
|
|
7
7
|
## When to use
|
|
8
8
|
|
|
9
9
|
- A reply, a note, a comment, a description, a message: free text that may run to several lines or paragraphs.
|
|
10
10
|
- A settings or edit form whose fields line up with a `TextField`: they share the border, the text size and the inline padding.
|
|
11
|
+
- A chat or comment composer: `autoGrow` with a cap, a send Button in `actions`, and the error in a row of its own with `renderError`.
|
|
11
12
|
|
|
12
13
|
## When not to use
|
|
13
14
|
|
|
14
15
|
- One line of text (a name, an email, a title): use `TextField`; Enter submits its form.
|
|
15
16
|
- A query that searches or filters: use `SearchField`.
|
|
16
17
|
- Formatted text (bold, links, lists): a rich text editor is out of scope; take Markdown in a Textarea and render it in the app.
|
|
17
|
-
- A character counter
|
|
18
|
+
- A character counter: not built in. Set `maxLength` in `inputProps` for a hard cap.
|
|
18
19
|
|
|
19
20
|
## Rules
|
|
20
21
|
|
|
21
22
|
- `label` is required and names the textarea, even when the design shows none: pass `hideLabel` to keep it for assistive technology and hide it from sight. Never pass an empty label, and never let `placeholder` stand in for one.
|
|
22
23
|
- `value` with `onValueChange` controls it; `defaultValue` leaves it uncontrolled. `onValueChange` gets the new string on each keystroke, line breaks as `\n`.
|
|
23
24
|
- `rows` (default `3`) sets the starting height in lines. The user may resize it vertically only, never under one line or one control height, and not while it is disabled; text longer than the box scrolls inside it.
|
|
25
|
+
- `autoGrow` grows the textarea with its text, a line at a time, from `rows` lines; it never shrinks below them and has no drag handle. Pass `{ maxBlockSize }`, any CSS length (`"12rem"`, `"40vh"`, `"min(20rem, 60cqb)"`), to stop it there: past that it scrolls inside the box. `true` grows without a cap, so give one wherever the page could scroll away under the user. It uses CSS `field-sizing: content` where the browser has it, and elsewhere measures the text on input, on a new `value` or `size`, after a form reset and on a width change, so it behaves the same in every browser; a script that assigns the textarea's `.value` itself is not tracked, so pass `value` instead. Set `autoGrow` once: changing it remounts the textarea, which loses its focus and caret.
|
|
26
|
+
- `actions` renders inside the box, in a row at its bottom-end below the text, so the text never runs under it; it follows the textarea in tab order. Put Buttons or IconButtons there (send, attach), each with its own name. The box draws the border, the focus ring (while the textarea has focus; a button draws its own), the invalid border and the disabled look. `disabled` does not reach the actions: they stay enabled, so pass `disabled` to each yourself. Any value but `undefined` draws the box; `null`, `false` and `""` draw it with no row, so actions that appear with the text (`actions={draft && <Send />}`) keep the textarea, its focus and its caret. Without `actions` it is the plain Textarea; changing between `undefined` and a value remounts the textarea.
|
|
27
|
+
- `renderError` places the error slot: it gets the slot as an element and renders what it returns where the slot would be, after the description, so you can put it in a row beside a hint or a Button. The field stays `aria-invalid` with the danger border, the message joins `aria-describedby`, and the slot is still the field's one live region; nothing renders under the box. Render the slot once, and keep it in the tree while there is no error, so an error that appears is announced.
|
|
28
|
+
- Put only Buttons, IconButtons and text in `actions` and `renderError`'s row, never a Base UI field control (Select, Checkbox, Switch, another field): it would register with this Field and take its label and error.
|
|
24
29
|
- `description` and `error` render below the textarea through `Field`; a non-empty `error` marks the field invalid (`aria-invalid`, a danger border) and joins the textarea's `aria-describedby`. Field's error slot announces it (ADR 0097): never add a `role="alert"` of your own.
|
|
25
30
|
- `disabled` uses the native `disabled`: the textarea leaves the tab order and does not submit, with a dashed border. `required` sets the native `required`.
|
|
26
31
|
- `name` submits the value with its form. A native form reset puts an uncontrolled field back to its `defaultValue` but fires no change, so `onValueChange` misses it; control the field if the form resets and you track the value.
|
|
@@ -51,6 +56,27 @@ A form field for several lines of free text: a `<textarea>` (role `textbox`, mul
|
|
|
51
56
|
<Textarea label="Note" value={note} onValueChange={setNote} inputProps={{ spellCheck: true }} />
|
|
52
57
|
```
|
|
53
58
|
|
|
59
|
+
```tsx
|
|
60
|
+
<Textarea
|
|
61
|
+
label="Message"
|
|
62
|
+
hideLabel
|
|
63
|
+
rows={1}
|
|
64
|
+
autoGrow={{ maxBlockSize: "40vh" }}
|
|
65
|
+
value={draft}
|
|
66
|
+
onValueChange={setDraft}
|
|
67
|
+
actions={<IconButton icon={ArrowUpIcon} label="Send" onClick={send} />}
|
|
68
|
+
error={sendError}
|
|
69
|
+
renderError={(slot) => (
|
|
70
|
+
<Inline gap="8" justifyContent="space-between">
|
|
71
|
+
{slot}
|
|
72
|
+
<Button size="sm" variant="ghost" onClick={retry}>
|
|
73
|
+
Retry
|
|
74
|
+
</Button>
|
|
75
|
+
</Inline>
|
|
76
|
+
)}
|
|
77
|
+
/>
|
|
78
|
+
```
|
|
79
|
+
|
|
54
80
|
## Don't
|
|
55
81
|
|
|
56
82
|
```tsx
|
|
@@ -64,6 +90,21 @@ A form field for several lines of free text: a `<textarea>` (role `textbox`, mul
|
|
|
64
90
|
<Textarea label="Reply" inputProps={{ "aria-label": "Your reply" }} />
|
|
65
91
|
```
|
|
66
92
|
|
|
93
|
+
```tsx
|
|
94
|
+
// An auto-grow box with no cap in a scrolling page: a long message pushes everything below it away.
|
|
95
|
+
<Textarea label="Reply" autoGrow />
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
// A Base UI field control in `actions` or `renderError`'s row: it registers with this Field.
|
|
100
|
+
<Textarea label="Message" actions={<Select label="Model" options={models} />} />
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
// Its own copy of the error: `renderError` places the one slot Field announces.
|
|
105
|
+
<Textarea label="Message" error={error} renderError={() => <Caption>{error}</Caption>} />
|
|
106
|
+
```
|
|
107
|
+
|
|
67
108
|
```tsx
|
|
68
109
|
// A one-line Textarea: a title is a TextField, and Enter submits its form.
|
|
69
110
|
<Textarea label="Title" rows={1} />
|
|
@@ -73,7 +114,9 @@ A form field for several lines of free text: a `<textarea>` (role `textbox`, mul
|
|
|
73
114
|
|
|
74
115
|
- The textarea is a multi-line `textbox` named by the label, visible or not.
|
|
75
116
|
- Invalid adds a 2px danger border, a 2px `CanvasText` border under forced colors, and the error message with its icon, never color alone; disabled adds a dashed border. Every size is at least 24 px tall. Under forced colors the border, text and disabled state use system colors. On a coarse pointer (a touch screen) the text is 16px at every size, so iOS Safari does not zoom the page when the field takes focus.
|
|
76
|
-
- Text longer than the box scrolls inside it, with the keyboard as with a pointer; the page around it does not move.
|
|
117
|
+
- Text longer than the box scrolls inside it, with the keyboard as with a pointer; the page around it does not move. With `autoGrow` the box grows as the user types, which moves what is below it a line at a time; the cap bounds that, and past it the text scrolls.
|
|
118
|
+
- With `actions` the textarea comes first in tab order, then each action. Its text area stops above the actions row at every size and text zoom, so a line never sits under a button. The box shows the focus ring while the textarea has focus, and each button its own.
|
|
119
|
+
- With `renderError` the message is still the textarea's description and is announced once, from the slot wherever it sits.
|
|
77
120
|
|
|
78
121
|
## Props
|
|
79
122
|
|
|
@@ -83,6 +126,8 @@ Generated from the TypeScript types.
|
|
|
83
126
|
|
|
84
127
|
| Prop | Type | Required | Description |
|
|
85
128
|
| --- | --- | --- | --- |
|
|
129
|
+
| `actions` | `ReactNode` | no | |
|
|
130
|
+
| `autoGrow` | `boolean \| { maxBlockSize: string; }` | no | |
|
|
86
131
|
| `className` | `string` | no | |
|
|
87
132
|
| `defaultValue` | `string` | no | |
|
|
88
133
|
| `description` | `ReactNode` | no | |
|
|
@@ -94,6 +139,7 @@ Generated from the TypeScript types.
|
|
|
94
139
|
| `name` | `string` | no | |
|
|
95
140
|
| `onValueChange` | `((value: string) => void)` | no | |
|
|
96
141
|
| `placeholder` | `string` | no | |
|
|
142
|
+
| `renderError` | `((error: ReactNode) => ReactNode)` | no | |
|
|
97
143
|
| `required` | `boolean` | no | |
|
|
98
144
|
| `rows` | `number` | no | |
|
|
99
145
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
package/dist/docs/llms.txt
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
- [Tag](Tag.md): A label that puts content in a category: a topic, a label, a user-made category. A `span` with a subtle tone fill (gray by default) and an `xs` (4px) radius (a small mark's step in `docs/shape.md`, so wrapped lines stay inside the fill) around a `Text` in the `label` font. It can be read-only, a link, or removable. `appearance="outline"` swaps the fill for a 1px border, a `med` (8px) radius and a small dot in the tone's color, for a quieter label among dense content.
|
|
53
53
|
- [Text](Text.md): The base of all visible text, and the primitive every text component builds on. Its box is trimmed to the cap height and the baseline, so the gap around text is the visible space and text sits centred in a padded control. It takes every Box style prop (`color`, `textAlign`, margins), plus `size`, `font`, `weight`, `leading`, `truncate` and `wrap`. An app almost never renders it directly: rendering `Text` is a code smell, since `Heading`, `Body`, `Label`, `Caption` and `Code` cover a string a user sees.
|
|
54
54
|
- [TextField](TextField.md): A form field for one line of text that is not a search: an `<input>` (role `textbox`) with SearchField's look and no button over it; optional icons sit inside the field. `type` picks `text`, `email`, `url` or `tel`. Built on Base UI's `Input` (ADR 0003); it composes `Field` for its label, description and error (ADR 0026, 0110). Three sizes at Button's heights (`sm`, `med`, `lg`: 24, 32 and 40 px, ADR 0124).
|
|
55
|
-
- [Textarea](Textarea.md): A form field for several lines of free text: a `<textarea>` (role `textbox`, multi-line) with TextField's look. Built on Base UI's `Input` rendered as a textarea (ADR 0003); it composes `Field` for its label, description and error (ADR 0026, 0136). `rows` sets its starting height, three by default, and the user can drag it taller or shorter. Three sizes (`sm`, `med`, `lg`) set TextField's text size and padding, so the first line sits where a TextField's text does (ADR 0124).
|
|
55
|
+
- [Textarea](Textarea.md): A form field for several lines of free text: a `<textarea>` (role `textbox`, multi-line) with TextField's look. Built on Base UI's `Input` rendered as a textarea (ADR 0003); it composes `Field` for its label, description and error (ADR 0026, 0136). `rows` sets its starting height, three by default, and the user can drag it taller or shorter; with `autoGrow` it grows with its text instead. Three sizes (`sm`, `med`, `lg`) set TextField's text size and padding, so the first line sits where a TextField's text does (ADR 0124).
|
|
56
56
|
- [Toast](Toast.md): Tells the user briefly about the result of an action without interrupting them: "Changes saved", "Message sent", "Couldn't upload the file". Material calls it a snackbar and Atlassian a flag. Built on Base UI's Toast, which owns the queue, the timers and swipe-to-dismiss. The parts add the look: a card tinted by variant in a stack at the bottom end corner, an icon per variant, a close button, and a slide-up-and-fade that is a plain fade under reduced motion. A toast never takes focus and moves nothing on the page.
|
|
57
57
|
- [Tooltip](Tooltip.md): A short hint about a control that shows on hover after a delay and at once on keyboard focus: a status pill's reason ("2 of 5 checks failed"), why a button is disabled, a few label and value rows. Built on Base UI's Tooltip, which owns the behavior: the hover delay, opening on focus, Esc, blur and pointer leave closing it, and keeping it open while the pointer is over the popup. The parts add the look, a small raised surface with a border and shadow, and link the popup to its trigger as its description (`role="tooltip"`, `aria-describedby`), which Base UI leaves out.
|
|
58
58
|
- [VisuallyHidden](VisuallyHidden.md): Text that screen readers read and nobody sees: a 1px clipped box, out of the layout, still in the accessibility tree. Use it for words a sighted user gets from the layout, an icon or a color, never to hide a control or a skip link. One element, chosen with `as`, a `span` by default.
|
package/dist/docs/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./manifest.schema.json",
|
|
3
3
|
"package": "@jonmilner/ui",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.2",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Alert",
|
|
@@ -3976,6 +3976,16 @@
|
|
|
3976
3976
|
"name": "Textarea",
|
|
3977
3977
|
"styleProps": true,
|
|
3978
3978
|
"props": [
|
|
3979
|
+
{
|
|
3980
|
+
"name": "actions",
|
|
3981
|
+
"type": "ReactNode",
|
|
3982
|
+
"required": false
|
|
3983
|
+
},
|
|
3984
|
+
{
|
|
3985
|
+
"name": "autoGrow",
|
|
3986
|
+
"type": "boolean | { maxBlockSize: string; }",
|
|
3987
|
+
"required": false
|
|
3988
|
+
},
|
|
3979
3989
|
{
|
|
3980
3990
|
"name": "className",
|
|
3981
3991
|
"type": "string",
|
|
@@ -4031,6 +4041,11 @@
|
|
|
4031
4041
|
"type": "string",
|
|
4032
4042
|
"required": false
|
|
4033
4043
|
},
|
|
4044
|
+
{
|
|
4045
|
+
"name": "renderError",
|
|
4046
|
+
"type": "((error: ReactNode) => ReactNode)",
|
|
4047
|
+
"required": false
|
|
4048
|
+
},
|
|
4034
4049
|
{
|
|
4035
4050
|
"name": "required",
|
|
4036
4051
|
"type": "boolean",
|