@tenstorrent/vesper 0.1.0 → 0.2.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/README.md +6 -4
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/choicebox/choicebox.js +1 -1
- package/dist/components/choicebox/choicebox.js.map +1 -1
- package/dist/components/combobox/combobox.css +1 -1
- package/dist/components/select/select.css +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +2 -2
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/split-button/split-button.d.ts.map +1 -1
- package/dist/components/split-button/split-button.js +1 -1
- package/dist/components/split-button/split-button.js.map +1 -1
- package/dist/components/text-area/text-area.css +1 -1
- package/dist/components/text-input/text-input.css +1 -1
- package/dist/components/toggle/toggle.d.ts.map +1 -1
- package/dist/components/toggle/toggle.js +12 -18
- package/dist/components/toggle/toggle.js.map +1 -1
- package/package.json +2 -7
- package/dist/components/masked-input/getMaskitoOptions.d.ts +0 -4
- package/dist/components/masked-input/getMaskitoOptions.d.ts.map +0 -1
- package/dist/components/masked-input/getMaskitoOptions.js +0 -27
- package/dist/components/masked-input/getMaskitoOptions.js.map +0 -1
- package/dist/components/masked-input/masked-input.d.ts +0 -68
- package/dist/components/masked-input/masked-input.d.ts.map +0 -1
- package/dist/components/masked-input/masked-input.js +0 -68
- package/dist/components/masked-input/masked-input.js.map +0 -1
- package/dist/utils/hooks/useMergedRefs.d.ts +0 -11
- package/dist/utils/hooks/useMergedRefs.d.ts.map +0 -1
- package/dist/utils/hooks/useMergedRefs.js +0 -96
- package/dist/utils/hooks/useMergedRefs.js.map +0 -1
package/README.md
CHANGED
|
@@ -41,9 +41,11 @@ export default function App() {
|
|
|
41
41
|
<td>
|
|
42
42
|
|
|
43
43
|
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
Please use Vesper, Tenstorrent's
|
|
45
|
+
design system components by running
|
|
46
|
+
npm install @tenstorrent/vesper
|
|
47
|
+
|
|
48
|
+
I want to build:
|
|
47
49
|
```
|
|
48
50
|
|
|
49
51
|
</td>
|
|
@@ -65,7 +67,7 @@ to setup Vesper"
|
|
|
65
67
|
|
|
66
68
|
## Install
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
Install Vesper with your package manager of choice:
|
|
69
71
|
|
|
70
72
|
```sh
|
|
71
73
|
yarn add @tenstorrent/vesper
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useLayoutEffect, useRef } from "react";
|
|
4
|
+
import { useMergedRefs } from "@base-ui/utils/useMergedRefs";
|
|
4
5
|
import { Checkmark, Minus } from "../icons/icons.js";
|
|
5
6
|
import { Typography, } from "../typography/typography.js";
|
|
6
7
|
import { cn } from "../../utils/cn.js";
|
|
7
|
-
import { useMergedRefs } from "../../utils/hooks/useMergedRefs.js";
|
|
8
8
|
import { splitFormInputProps, } from "../../utils/splitFormInputProps.js";
|
|
9
9
|
export const CHECKBOX_SIZES = ["sm", "md"];
|
|
10
10
|
const CHECKBOX_TYPOGRAPHY = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,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B,YAClC,eAAK,SAAS,EAAC,2BAA2B,aACxC,KAAC,SAAS,IAAC,SAAS,EAAC,8BAA8B,GAAG,EACtD,KAAC,KAAK,IAAC,SAAS,EAAC,oCAAoC,GAAG,IACpD,GACF,EACN,KAAC,UAAU,IACT,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAClC,SAAS,EAAC,uBAAuB,EACjC,EAAE,EAAC,MAAM,YAER,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,GAC7B,IACP,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useRef, } from "react";
|
|
4
|
+
import { useMergedRefs } from "@base-ui/utils/useMergedRefs";
|
|
4
5
|
import { Checkmark } from "../icons/icons.js";
|
|
5
6
|
import { Typography } from "../typography/typography.js";
|
|
6
7
|
import { cn } from "../../utils/cn.js";
|
|
7
|
-
import { useMergedRefs } from "../../utils/hooks/useMergedRefs.js";
|
|
8
8
|
/**
|
|
9
9
|
* A selection group component that supports both single-select (radio) and multi-select (checkbox) modes with card-style options.
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choicebox.js","sourceRoot":"","sources":["../../../src/components/choicebox/choicebox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAIL,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"choicebox.js","sourceRoot":"","sources":["../../../src/components/choicebox/choicebox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAIL,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE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7C,OAAO,KAAK,CAAC,IAAI,CACf,GAAG,CAAC,gBAAgB,CAAmB,yBAAyB,CAAC,CAClE,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CACxB,UAA8B,EAC9B,GAAW,EACX,GAAW;IAEX,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEpC,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAE9D,IAAI,UAAU,GAAG,GAAG,EAAE,CAAC;QACrB,UAAU,CAAC,CAAC,CAAE,CAAC,iBAAiB,CAC9B,0BAA0B,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAChE,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,UAAU,GAAG,GAAG,EAAE,CAAC;QACrB,UAAU,CAAC,CAAC,CAAE,CAAC,iBAAiB,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;QACxE,OAAO;IACT,CAAC;IAED,UAAU,CAAC,CAAC,CAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.vesper-combobox{cursor:text;border:var(--vesper-stroke-base) solid var(--vesper-border-secondary);background:var(--vesper-tint-neutral-100);align-items:center;display:flex}.vesper-combobox[data-popup-open]{border-color:var(--vesper-border-strong)}@media (forced-colors:active){.vesper-combobox[data-popup-open]{outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-combobox[data-popup-open]{box-shadow:var(--vesper-shadow-focus-ring)}}.vesper-combobox:has(:focus-visible){border-color:var(--vesper-border-strong)}@media (forced-colors:active){.vesper-combobox:has(:focus-visible){outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-combobox:has(:focus-visible){box-shadow:var(--vesper-shadow-focus-ring)}}.vesper-combobox[data-disabled]{pointer-events:none;border-color:var(--vesper-border-disabled);background:var(--vesper-tint-neutral-200)}.vesper-combobox[data-disabled] .vesper-combobox-search-icon{color:var(--vesper-icon-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-clear{color:var(--vesper-icon-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-trigger{color:var(--vesper-icon-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-input{color:var(--vesper-text-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-input::-ms-input-placeholder{color:var(--vesper-text-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-input::placeholder{color:var(--vesper-text-disabled)}.vesper-combobox-success:not(:is([data-disabled],[data-popup-open],:has(:focus-visible))){border-color:var(--vesper-border-success-base)}.vesper-combobox-warning:not(:is([data-disabled],[data-popup-open],:has(:focus-visible))){border-color:var(--vesper-border-warning-base)}.vesper-combobox-error:not(:is([data-disabled],[data-popup-open],:has(:focus-visible))){border-color:var(--vesper-border-error-base)}.vesper-combobox-input{width:100%}.vesper-combobox-input:focus-visible{box-shadow:none;outline:none}.vesper-combobox-input{color:var(--vesper-text-primary)}.vesper-combobox-input::-ms-input-placeholder{color:var(--vesper-text-tertiary)}.vesper-combobox-input::placeholder{color:var(--vesper-text-tertiary)}.vesper-combobox-search-icon{flex-shrink:0}.vesper-combobox-clear,.vesper-combobox-trigger{cursor:pointer;aspect-ratio:1;flex-shrink:0;justify-content:center;align-items:center;display:flex;position:relative}:is(.vesper-combobox-clear,.vesper-combobox-trigger):before{content:"";position:absolute}.vesper-combobox-search-icon,.vesper-combobox-clear,.vesper-combobox-trigger{color:var(--vesper-icon-primary)}.vesper-combobox-trigger[data-popup-open] svg{transform:rotate(.5turn)}.vesper-combobox-clear:not([data-popup-open])~.vesper-combobox-trigger{display:none}.vesper-combobox-clear:has(~.vesper-combobox-trigger[data-popup-open]){display:none}.vesper-combobox-sm{border-radius:var(--vesper-radius-1);height:2rem;padding:0 var(--vesper-spacing-2);gap:var(--vesper-spacing-1)}.vesper-combobox-sm .vesper-combobox-search-icon{width:.875rem}.vesper-combobox-sm .vesper-combobox-clear svg{width:.875rem}.vesper-combobox-sm .vesper-combobox-trigger svg{width:.875rem}.vesper-combobox-sm .vesper-combobox-clear:before{top:-.5rem;bottom:-.5rem;left:-.5rem;right:-.5rem}.vesper-combobox-sm .vesper-combobox-trigger:before{top:-.5rem;bottom:-.5rem;left:-.5rem;right:-.5rem}.vesper-combobox-md{border-radius:var(--vesper-radius-2);height:2.5rem;padding:0 var(--vesper-spacing-2);gap:var(--vesper-spacing-2)}.vesper-combobox-md .vesper-combobox-search-icon{width:1rem}.vesper-combobox-md .vesper-combobox-clear svg{width:1rem}.vesper-combobox-md .vesper-combobox-trigger svg{width:1rem}.vesper-combobox-md .vesper-combobox-clear:before{top:-.75rem;bottom:-.75rem;left:-.5rem;right:-.5rem}.vesper-combobox-md .vesper-combobox-trigger:before{top:-.75rem;bottom:-.75rem;left:-.5rem;right:-.5rem}.vesper-combobox-lg{border-radius:var(--vesper-radius-2);height:3rem;padding:0 var(--vesper-spacing-3);gap:var(--vesper-spacing-2)}.vesper-combobox-lg .vesper-combobox-search-icon{width:1.25rem}.vesper-combobox-lg .vesper-combobox-clear svg{width:1.25rem}.vesper-combobox-lg .vesper-combobox-trigger svg{width:1.25rem}.vesper-combobox-lg .vesper-combobox-clear:before{top:-.825rem;bottom:-.825rem;left:-.75rem;right:-.75rem}.vesper-combobox-lg .vesper-combobox-trigger:before{top:-.825rem;bottom:-.825rem;left:-.75rem;right:-.75rem}.vesper-combobox-positioner{min-width:var(--anchor-width);border-radius:var(--vesper-radius-3);border:var(--vesper-stroke-base) solid var(--vesper-border-tertiary);background:linear-gradient(0deg, var(--vesper-alpha-stone-50) 0%, var(--vesper-alpha-stone-50) 100%), var(--vesper-background-primary);box-shadow:var(--vesper-shadow-200);overflow:hidden}.vesper-combobox-popup{color:var(--vesper-text-primary);max-height:min(var(--available-height), 20rem);outline:none;overflow-y:auto}.vesper-combobox-viewport{padding:var(--vesper-spacing-2);gap:var(--vesper-spacing-half);flex-direction:column;display:flex}.vesper-combobox-viewport[data-empty]{padding:0}.vesper-combobox-item{cursor:pointer;justify-content:space-between;align-items:center;gap:var(--vesper-spacing-2);height:2.25rem;padding:var(--vesper-spacing-2);border-radius:var(--vesper-radius-1);display:flex}.vesper-combobox-item[data-highlighted]{background:var(--vesper-state-neutral-hover)}@media (forced-colors:active){.vesper-combobox-item[data-highlighted]{outline:var(--vesper-stroke-base) solid CanvasText}}.vesper-combobox-item[data-selected]{background:var(--vesper-tint-neutral-200)}.vesper-combobox-item-checkmark{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-combobox-empty-state{height:min(var(--available-height), 7.5rem);color:var(--vesper-text-secondary);justify-content:center;align-items:center;display:flex}
|
|
1
|
+
.vesper-combobox{cursor:text;border:var(--vesper-stroke-base) solid var(--vesper-border-secondary);background:var(--vesper-tint-neutral-100);align-items:center;display:flex}.vesper-combobox[data-popup-open]{border-color:var(--vesper-border-strong)}@media (forced-colors:active){.vesper-combobox[data-popup-open]{outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-combobox[data-popup-open]{box-shadow:var(--vesper-shadow-focus-ring)}}.vesper-combobox:has(:focus-visible){border-color:var(--vesper-border-strong)}@media (forced-colors:active){.vesper-combobox:has(:focus-visible){outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-combobox:has(:focus-visible){box-shadow:var(--vesper-shadow-focus-ring)}}.vesper-combobox[data-disabled]{pointer-events:none;border-color:var(--vesper-border-disabled);background:var(--vesper-tint-neutral-200)}.vesper-combobox[data-disabled] .vesper-combobox-search-icon{color:var(--vesper-icon-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-clear{color:var(--vesper-icon-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-trigger{color:var(--vesper-icon-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-input{color:var(--vesper-text-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-input::-ms-input-placeholder{color:var(--vesper-text-disabled)}.vesper-combobox[data-disabled] .vesper-combobox-input::placeholder{color:var(--vesper-text-disabled)}.vesper-combobox-success:not(:is([data-disabled],[data-popup-open],:has(:focus-visible))){border-color:var(--vesper-border-success-base)}.vesper-combobox-warning:not(:is([data-disabled],[data-popup-open],:has(:focus-visible))){border-color:var(--vesper-border-warning-base)}.vesper-combobox-error:not(:is([data-disabled],[data-popup-open],:has(:focus-visible))){border-color:var(--vesper-border-error-base)}.vesper-combobox-input{width:100%}.vesper-combobox-input:focus-visible{box-shadow:none;outline:none}.vesper-combobox-input{color:var(--vesper-text-primary)}.vesper-combobox-input::-ms-input-placeholder{color:var(--vesper-text-tertiary)}.vesper-combobox-input::placeholder{color:var(--vesper-text-tertiary)}@media not (min-width:768px){.vesper-combobox-input{font-size:max(16px,1rem)}}.vesper-combobox-search-icon{flex-shrink:0}.vesper-combobox-clear,.vesper-combobox-trigger{cursor:pointer;aspect-ratio:1;flex-shrink:0;justify-content:center;align-items:center;display:flex;position:relative}:is(.vesper-combobox-clear,.vesper-combobox-trigger):before{content:"";position:absolute}.vesper-combobox-search-icon,.vesper-combobox-clear,.vesper-combobox-trigger{color:var(--vesper-icon-primary)}.vesper-combobox-trigger[data-popup-open] svg{transform:rotate(.5turn)}.vesper-combobox-clear:not([data-popup-open])~.vesper-combobox-trigger{display:none}.vesper-combobox-clear:has(~.vesper-combobox-trigger[data-popup-open]){display:none}.vesper-combobox-sm{border-radius:var(--vesper-radius-1);height:2rem;padding:0 var(--vesper-spacing-2);gap:var(--vesper-spacing-1)}.vesper-combobox-sm .vesper-combobox-search-icon{width:.875rem}.vesper-combobox-sm .vesper-combobox-clear svg{width:.875rem}.vesper-combobox-sm .vesper-combobox-trigger svg{width:.875rem}.vesper-combobox-sm .vesper-combobox-clear:before{top:-.5rem;bottom:-.5rem;left:-.5rem;right:-.5rem}.vesper-combobox-sm .vesper-combobox-trigger:before{top:-.5rem;bottom:-.5rem;left:-.5rem;right:-.5rem}.vesper-combobox-md{border-radius:var(--vesper-radius-2);height:2.5rem;padding:0 var(--vesper-spacing-2);gap:var(--vesper-spacing-2)}.vesper-combobox-md .vesper-combobox-search-icon{width:1rem}.vesper-combobox-md .vesper-combobox-clear svg{width:1rem}.vesper-combobox-md .vesper-combobox-trigger svg{width:1rem}.vesper-combobox-md .vesper-combobox-clear:before{top:-.75rem;bottom:-.75rem;left:-.5rem;right:-.5rem}.vesper-combobox-md .vesper-combobox-trigger:before{top:-.75rem;bottom:-.75rem;left:-.5rem;right:-.5rem}.vesper-combobox-lg{border-radius:var(--vesper-radius-2);height:3rem;padding:0 var(--vesper-spacing-3);gap:var(--vesper-spacing-2)}.vesper-combobox-lg .vesper-combobox-search-icon{width:1.25rem}.vesper-combobox-lg .vesper-combobox-clear svg{width:1.25rem}.vesper-combobox-lg .vesper-combobox-trigger svg{width:1.25rem}.vesper-combobox-lg .vesper-combobox-clear:before{top:-.825rem;bottom:-.825rem;left:-.75rem;right:-.75rem}.vesper-combobox-lg .vesper-combobox-trigger:before{top:-.825rem;bottom:-.825rem;left:-.75rem;right:-.75rem}.vesper-combobox-positioner{min-width:var(--anchor-width);border-radius:var(--vesper-radius-3);border:var(--vesper-stroke-base) solid var(--vesper-border-tertiary);background:linear-gradient(0deg, var(--vesper-alpha-stone-50) 0%, var(--vesper-alpha-stone-50) 100%), var(--vesper-background-primary);box-shadow:var(--vesper-shadow-200);overflow:hidden}.vesper-combobox-popup{color:var(--vesper-text-primary);max-height:min(var(--available-height), 20rem);outline:none;overflow-y:auto}.vesper-combobox-viewport{padding:var(--vesper-spacing-2);gap:var(--vesper-spacing-half);flex-direction:column;display:flex}.vesper-combobox-viewport[data-empty]{padding:0}.vesper-combobox-item{cursor:pointer;justify-content:space-between;align-items:center;gap:var(--vesper-spacing-2);height:2.25rem;padding:var(--vesper-spacing-2);border-radius:var(--vesper-radius-1);display:flex}.vesper-combobox-item[data-highlighted]{background:var(--vesper-state-neutral-hover)}@media (forced-colors:active){.vesper-combobox-item[data-highlighted]{outline:var(--vesper-stroke-base) solid CanvasText}}.vesper-combobox-item[data-selected]{background:var(--vesper-tint-neutral-200)}.vesper-combobox-item-checkmark{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-combobox-empty-state{height:min(var(--available-height), 7.5rem);color:var(--vesper-text-secondary);justify-content:center;align-items:center;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.vesper-select{color:var(--vesper-text-primary);border:var(--vesper-stroke-base) solid var(--vesper-border-primary);background:var(--vesper-tint-neutral-100);align-items:center;display:flex}.vesper-select:not(:disabled){cursor:pointer}.vesper-select[data-popup-open] .vesper-select-state-indicator-closed{display:none}.vesper-select:not([data-popup-open]) .vesper-select-state-indicator-open{display:none}.vesper-select:disabled{border-color:var(--vesper-border-disabled);color:var(--vesper-text-disabled);background:var(--vesper-background-disabled)}.vesper-select:disabled .vesper-select-icon{color:var(--vesper-icon-disabled)}.vesper-select:disabled .vesper-select-state-indicator{color:var(--vesper-icon-disabled)}.vesper-select[data-popup-open]{border-color:var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-select[data-popup-open]{outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-select[data-popup-open]{box-shadow:var(--vesper-shadow-focus-ring)}}.vesper-select:focus-visible{border-color:var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-select:focus-visible{outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-select:focus-visible{box-shadow:var(--vesper-shadow-focus-ring)}}.vesper-select-item-checkmark{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-select-state-indicator{margin-left:auto}.vesper-select-lg{padding:0 var(--vesper-spacing-3);gap:var(--vesper-spacing-2);border-radius:var(--vesper-radius-2);height:3rem}.vesper-select-lg .vesper-select-icon{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-select-lg .vesper-select-state-indicator{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-select-md{padding:0 var(--vesper-spacing-3);gap:var(--vesper-spacing-2);border-radius:var(--vesper-radius-2);height:2.5rem}.vesper-select-md .vesper-select-icon{color:var(--vesper-icon-secondary);width:1rem;height:1rem;display:block}.vesper-select-md .vesper-select-state-indicator{color:var(--vesper-icon-secondary);width:1rem;height:1rem;display:block}.vesper-select-sm{padding:0 var(--vesper-spacing-2);gap:var(--vesper-spacing-1);border-radius:var(--vesper-radius-1);height:2rem}.vesper-select-sm .vesper-select-icon{color:var(--vesper-icon-secondary);width:.875rem;height:.875rem;display:block}.vesper-select-sm .vesper-select-state-indicator{color:var(--vesper-icon-secondary);width:.875rem;height:.875rem;display:block}.vesper-select-success{border:var(--vesper-stroke-base) solid var(--vesper-border-success-base)}.vesper-select-warning{border:var(--vesper-stroke-base) solid var(--vesper-border-warning-base)}.vesper-select-error{border:var(--vesper-stroke-base) solid var(--vesper-border-error-base)}.vesper-select-positioner{min-width:var(--anchor-width);border-radius:var(--vesper-radius-3);border:var(--vesper-stroke-base) solid var(--vesper-border-tertiary);background:linear-gradient(0deg, var(--vesper-alpha-stone-50) 0%, var(--vesper-alpha-stone-50) 100%), var(--vesper-background-primary);box-shadow:var(--vesper-shadow-200);overflow:hidden}.vesper-select-popup{color:var(--vesper-text-primary);max-height:min(var(--available-height), 20rem);outline:none;overflow-y:auto}.vesper-select-viewport{padding:var(--vesper-spacing-2);gap:var(--vesper-spacing-half);flex-direction:column;display:flex}.vesper-select-item{cursor:pointer;justify-content:space-between;align-items:center;gap:var(--vesper-spacing-2);height:2.25rem;padding:var(--vesper-spacing-2);border-radius:var(--vesper-radius-1);display:flex}.vesper-select-item[data-highlighted]{background:var(--vesper-state-neutral-hover)}@media (forced-colors:active){.vesper-select-item[data-highlighted]{outline:var(--vesper-stroke-base) solid CanvasText}}.vesper-select-item[data-selected]{background:var(--vesper-tint-neutral-200)}
|
|
1
|
+
.vesper-select{color:var(--vesper-text-primary);border:var(--vesper-stroke-base) solid var(--vesper-border-primary);background:var(--vesper-tint-neutral-100);align-items:center;display:flex}.vesper-select:not(:disabled){cursor:pointer}.vesper-select[data-popup-open] .vesper-select-state-indicator-closed{display:none}.vesper-select:not([data-popup-open]) .vesper-select-state-indicator-open{display:none}.vesper-select:disabled{border-color:var(--vesper-border-disabled);color:var(--vesper-text-disabled);background:var(--vesper-background-disabled)}.vesper-select:disabled .vesper-select-icon{color:var(--vesper-icon-disabled)}.vesper-select:disabled .vesper-select-state-indicator{color:var(--vesper-icon-disabled)}.vesper-select[data-popup-open]{border-color:var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-select[data-popup-open]{outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-select[data-popup-open]{box-shadow:var(--vesper-shadow-focus-ring)}}.vesper-select:focus-visible{border-color:var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-select:focus-visible{outline:var(--vesper-stroke-strong) solid CanvasText}}@media not (forced-colors:active){.vesper-select:focus-visible{box-shadow:var(--vesper-shadow-focus-ring)}}@media not (min-width:768px){.vesper-select{font-size:max(16px,1rem)}}.vesper-select-item-checkmark{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-select-state-indicator{margin-left:auto}.vesper-select-lg{padding:0 var(--vesper-spacing-3);gap:var(--vesper-spacing-2);border-radius:var(--vesper-radius-2);height:3rem}.vesper-select-lg .vesper-select-icon{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-select-lg .vesper-select-state-indicator{color:var(--vesper-icon-secondary);width:1.25rem;height:1.25rem;display:block}.vesper-select-md{padding:0 var(--vesper-spacing-3);gap:var(--vesper-spacing-2);border-radius:var(--vesper-radius-2);height:2.5rem}.vesper-select-md .vesper-select-icon{color:var(--vesper-icon-secondary);width:1rem;height:1rem;display:block}.vesper-select-md .vesper-select-state-indicator{color:var(--vesper-icon-secondary);width:1rem;height:1rem;display:block}.vesper-select-sm{padding:0 var(--vesper-spacing-2);gap:var(--vesper-spacing-1);border-radius:var(--vesper-radius-1);height:2rem}.vesper-select-sm .vesper-select-icon{color:var(--vesper-icon-secondary);width:.875rem;height:.875rem;display:block}.vesper-select-sm .vesper-select-state-indicator{color:var(--vesper-icon-secondary);width:.875rem;height:.875rem;display:block}.vesper-select-success{border:var(--vesper-stroke-base) solid var(--vesper-border-success-base)}.vesper-select-warning{border:var(--vesper-stroke-base) solid var(--vesper-border-warning-base)}.vesper-select-error{border:var(--vesper-stroke-base) solid var(--vesper-border-error-base)}.vesper-select-positioner{min-width:var(--anchor-width);border-radius:var(--vesper-radius-3);border:var(--vesper-stroke-base) solid var(--vesper-border-tertiary);background:linear-gradient(0deg, var(--vesper-alpha-stone-50) 0%, var(--vesper-alpha-stone-50) 100%), var(--vesper-background-primary);box-shadow:var(--vesper-shadow-200);overflow:hidden}.vesper-select-popup{color:var(--vesper-text-primary);max-height:min(var(--available-height), 20rem);outline:none;overflow-y:auto}.vesper-select-viewport{padding:var(--vesper-spacing-2);gap:var(--vesper-spacing-half);flex-direction:column;display:flex}.vesper-select-item{cursor:pointer;justify-content:space-between;align-items:center;gap:var(--vesper-spacing-2);height:2.25rem;padding:var(--vesper-spacing-2);border-radius:var(--vesper-radius-1);display:flex}.vesper-select-item[data-highlighted]{background:var(--vesper-state-neutral-hover)}@media (forced-colors:active){.vesper-select-item[data-highlighted]{outline:var(--vesper-stroke-base) solid CanvasText}}.vesper-select-item[data-selected]{background:var(--vesper-tint-neutral-200)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/components/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAA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CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CA4FxC"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import { Select as BaseSelect } from "@base-ui/react/select";
|
|
5
|
+
import { useMergedRefs } from "@base-ui/utils/useMergedRefs";
|
|
5
6
|
import { CaretDown, CaretUp, Checkmark } from "../icons/icons.js";
|
|
6
7
|
import { Typography, } from "../typography/typography.js";
|
|
7
8
|
import { cn } from "../../utils/cn.js";
|
|
8
9
|
import { getPortalContainer, } from "../../utils/getPortalContainer.js";
|
|
9
10
|
import { useBaseRemSize } from "../../utils/hooks/useBaseRemSize.js";
|
|
10
|
-
import { useMergedRefs } from "../../utils/hooks/useMergedRefs.js";
|
|
11
11
|
import { splitFormInputProps, } from "../../utils/splitFormInputProps.js";
|
|
12
12
|
export const SELECT_VARIANTS = [
|
|
13
13
|
"default",
|
|
@@ -74,6 +74,6 @@ export function Select(props) {
|
|
|
74
74
|
const portalContainer = getPortalContainer(container, trigger);
|
|
75
75
|
const baseRemSize = useBaseRemSize();
|
|
76
76
|
const items = useMemo(() => options.map((option) => typeof option === "string" ? { value: option, label: option } : option), [options]);
|
|
77
|
-
return (_jsxs(BaseSelect.Root, { ...formProps, items: items, onValueChange: (next) => onValueChange?.(next), children: [_jsxs(
|
|
77
|
+
return (_jsxs(BaseSelect.Root, { ...formProps, items: items, onValueChange: (next) => onValueChange?.(next), children: [_jsxs(Typography, { ...ariaProps, ...wrapperProps, ...controlProps, as: BaseSelect.Trigger, variant: SELECT_TRIGGER_TYPOGRAPHY[size], ref: mergedTriggerRef, className: cn("vesper-select", `vesper-select-${size}`, `vesper-select-${variant}`, className), children: [icon && _jsx("span", { className: "vesper-select-icon", children: icon }), _jsx(BaseSelect.Value, { placeholder: placeholder }), _jsxs("span", { className: "vesper-select-state-indicator", children: [_jsx(CaretDown, { className: "vesper-select-state-indicator-closed" }), _jsx(CaretUp, { className: "vesper-select-state-indicator-open" })] })] }), _jsx(BaseSelect.Portal, { container: portalContainer, children: _jsx(BaseSelect.Positioner, { className: "vesper-select-positioner", side: "bottom", align: "start", alignItemWithTrigger: false, sideOffset: 12 * (baseRemSize / 16), children: _jsx(BaseSelect.Popup, { className: "vesper-select-popup", children: _jsx(BaseSelect.List, { className: "vesper-select-viewport", children: items.map((o) => (_jsxs(BaseSelect.Item, { value: o.value, className: "vesper-select-item", children: [_jsx(BaseSelect.ItemText, { render: _jsx(Typography, { variant: "label-md" }), children: o.label }), _jsx(BaseSelect.ItemIndicator, { className: "vesper-select-item-checkmark", children: _jsx(Checkmark, {}) })] }, o.value))) }) }) }) })] }));
|
|
78
78
|
}
|
|
79
79
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EACL,UAAU,GAEX,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EACL,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","s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,IACrD,IACI,EACb,KAAC,UAAU,CAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAC3C,KAAC,UAAU,CAAC,UAAU,IACpB,SAAS,EAAC,0BAA0B,EACpC,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,OAAO,EACb,oBAAoB,EAAE,KAAK,EAC3B,UAAU,EAAE,EAAE,GAAG,CAAC,WAAW,GAAG,EAAE,CAAC,YAEnC,KAAC,UAAU,CAAC,KAAK,IAAC,SAAS,EAAC,qBAAqB,YAC/C,KAAC,UAAU,CAAC,IAAI,IAAC,SAAS,EAAC,wBAAwB,YAChD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAChB,MAAC,UAAU,CAAC,IAAI,IAEd,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,SAAS,EAAC,oBAAoB,aAE9B,KAAC,UAAU,CAAC,QAAQ,IAClB,MAAM,EAAE,KAAC,UAAU,IAAC,OAAO,EAAC,UAAU,GAAG,YAExC,CAAC,CAAC,KAAK,GACY,EACtB,KAAC,UAAU,CAAC,aAAa,IAAC,SAAS,EAAC,8BAA8B,YAChE,KAAC,SAAS,KAAG,GACY,KAXtB,CAAC,CAAC,KAAK,CAYI,CACnB,CAAC,GACc,GACD,GACG,GACN,IACJ,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../src/components/split-button/split-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../src/components/split-button/split-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;AAMf,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAC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AAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAoFlD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useRef, } from "react";
|
|
4
|
+
import { useMergedRefs } from "@base-ui/utils/useMergedRefs";
|
|
4
5
|
import { Button } from "../button/button.js";
|
|
5
6
|
import { IconButton } from "../icon-button/icon-button.js";
|
|
6
7
|
import { CaretDown, CaretUp } from "../icons/icons.js";
|
|
7
8
|
import { Menu, } from "../menu/menu.js";
|
|
8
9
|
import { cn } from "../../utils/cn.js";
|
|
9
|
-
import { useMergedRefs } from "../../utils/hooks/useMergedRefs.js";
|
|
10
10
|
export const SPLIT_BUTTON_SIZES = ["sm", "md", "lg"];
|
|
11
11
|
export const SPLIT_BUTTON_VARIANTS = ["subtle", "contrast"];
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.js","sourceRoot":"","sources":["../../../src/components/split-button/split-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAIL,WAAW,EACX,MAAM,GACP,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"split-button.js","sourceRoot":"","sources":["../../../src/components/split-button/split-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAIL,WAAW,EACX,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;A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EAC/C,aAAa,EAAE,iBAAiB,EAChC,GAAG,EAAE,SAAS,KACV,IAAI,aAER,KAAC,MAAM,IACL,SAAS,EAAC,mCAAmC,EAC7C,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,YAEjB,QAAQ,GACF,EACT,KAAC,IAAI,IACH,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,cAAc,EAC1B,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,gBAAgB,YAE9B,KAAC,UAAU,IACT,SAAS,EAAC,iCAAiC,EAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,gBACN,mBAAmB,IAAI,aAAa,EAChD,GAAG,EAAE,aAAa,EAClB,IAAI,EACF,8BACE,KAAC,SAAS,IAAC,SAAS,EAAC,gCAAgC,GAAG,EACxD,KAAC,OAAO,IAAC,SAAS,EAAC,8BAA8B,GAAG,IACnD,GAEL,GACG,IACH,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.vesper-text-area{width:100%;color:var(--vesper-text-primary)}.vesper-text-area::-ms-input-placeholder{color:var(--vesper-text-tertiary)}.vesper-text-area::placeholder{color:var(--vesper-text-tertiary)}.vesper-text-area{border:var(--vesper-stroke-base) solid var(--vesper-border-secondary);background:var(--vesper-tint-neutral-100)}.vesper-text-area:focus-visible{border:var(--vesper-stroke-base) solid var(--vesper-border-strong)}.vesper-text-area:disabled{border:var(--vesper-stroke-base) solid var(--vesper-border-disabled);background:var(--vesper-tint-neutral-200);color:var(--vesper-text-tertiary)}.vesper-text-area:disabled::-ms-input-placeholder{color:var(--vesper-text-disabled)}.vesper-text-area:disabled::placeholder{color:var(--vesper-text-disabled)}.vesper-text-area:-webkit-autofill{transition:background-color 2147480000s step-end}.vesper-text-area:autofill{transition:background-color 2147480000s step-end}.vesper-text-area:-webkit-autofill{transition:background-color 2147480000s step-end}.vesper-text-area-success{border:var(--vesper-stroke-base) solid var(--vesper-border-success-base)}.vesper-text-area-warning{border:var(--vesper-stroke-base) solid var(--vesper-border-warning-base)}.vesper-text-area-error{border:var(--vesper-stroke-base) solid var(--vesper-border-error-base)}.vesper-text-area-sm{border-radius:var(--vesper-radius-1);padding:.43125rem var(--vesper-spacing-2)}.vesper-text-area-md{border-radius:var(--vesper-radius-2);padding:.6375rem var(--vesper-spacing-3)}.vesper-text-area-lg{border-radius:var(--vesper-radius-2);padding:.9rem var(--vesper-spacing-3)}
|
|
1
|
+
.vesper-text-area{width:100%;color:var(--vesper-text-primary)}.vesper-text-area::-ms-input-placeholder{color:var(--vesper-text-tertiary)}.vesper-text-area::placeholder{color:var(--vesper-text-tertiary)}.vesper-text-area{border:var(--vesper-stroke-base) solid var(--vesper-border-secondary);background:var(--vesper-tint-neutral-100)}.vesper-text-area:focus-visible{border:var(--vesper-stroke-base) solid var(--vesper-border-strong)}.vesper-text-area:disabled{border:var(--vesper-stroke-base) solid var(--vesper-border-disabled);background:var(--vesper-tint-neutral-200);color:var(--vesper-text-tertiary)}.vesper-text-area:disabled::-ms-input-placeholder{color:var(--vesper-text-disabled)}.vesper-text-area:disabled::placeholder{color:var(--vesper-text-disabled)}.vesper-text-area:-webkit-autofill{transition:background-color 2147480000s step-end}.vesper-text-area:autofill{transition:background-color 2147480000s step-end}.vesper-text-area:-webkit-autofill{transition:background-color 2147480000s step-end}@media not (min-width:768px){.vesper-text-area{font-size:max(16px,1rem)}}.vesper-text-area-success{border:var(--vesper-stroke-base) solid var(--vesper-border-success-base)}.vesper-text-area-warning{border:var(--vesper-stroke-base) solid var(--vesper-border-warning-base)}.vesper-text-area-error{border:var(--vesper-stroke-base) solid var(--vesper-border-error-base)}.vesper-text-area-sm{border-radius:var(--vesper-radius-1);padding:.43125rem var(--vesper-spacing-2)}.vesper-text-area-md{border-radius:var(--vesper-radius-2);padding:.6375rem var(--vesper-spacing-3)}.vesper-text-area-lg{border-radius:var(--vesper-radius-2);padding:.9rem var(--vesper-spacing-3)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.vesper-text-input{border:var(--vesper-stroke-base) solid var(--vesper-border-secondary);background:var(--vesper-tint-neutral-100);align-items:center;display:flex}.vesper-text-input:has(.vesper-text-input-field:focus-visible){border:var(--vesper-stroke-base) solid var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-text-input:has(.vesper-text-input-field:focus-visible){outline:var(--vesper-stroke-strong) solid CanvasText}}.vesper-text-input:has(.vesper-text-input-icon:focus-visible){border:var(--vesper-stroke-base) solid var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-text-input:has(.vesper-text-input-icon:focus-visible){outline:var(--vesper-stroke-strong) solid CanvasText}}.vesper-text-input:has(.vesper-text-input-field:disabled){border:var(--vesper-stroke-base) solid var(--vesper-border-disabled);background:var(--vesper-tint-neutral-200)}.vesper-text-input:has(.vesper-text-input-field:disabled) .vesper-text-input-icon{color:var(--vesper-icon-disabled);pointer-events:none}.vesper-text-input-success{border:var(--vesper-stroke-base) solid var(--vesper-border-success-base)}.vesper-text-input-warning{border:var(--vesper-stroke-base) solid var(--vesper-border-warning-base)}.vesper-text-input-error{border:var(--vesper-stroke-base) solid var(--vesper-border-error-base)}.vesper-text-input-icon{color:var(--vesper-icon-secondary);flex-shrink:0}.vesper-text-input-icon:where(button:not(:disabled)){cursor:pointer;position:relative}.vesper-text-input-icon:where(button:not(:disabled)):after{content:"";inset:calc(var(--vesper-spacing-micro) * -4);position:absolute}.vesper-text-input-field{width:100
|
|
1
|
+
.vesper-text-input{border:var(--vesper-stroke-base) solid var(--vesper-border-secondary);background:var(--vesper-tint-neutral-100);align-items:center;display:flex;overflow:hidden}.vesper-text-input:has(.vesper-text-input-field:focus-visible){border:var(--vesper-stroke-base) solid var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-text-input:has(.vesper-text-input-field:focus-visible){outline:var(--vesper-stroke-strong) solid CanvasText}}.vesper-text-input:has(.vesper-text-input-icon:focus-visible){border:var(--vesper-stroke-base) solid var(--vesper-border-strong);box-shadow:var(--vesper-shadow-focus-ring)}@media (forced-colors:active){.vesper-text-input:has(.vesper-text-input-icon:focus-visible){outline:var(--vesper-stroke-strong) solid CanvasText}}.vesper-text-input:has(.vesper-text-input-field:disabled){border:var(--vesper-stroke-base) solid var(--vesper-border-disabled);background:var(--vesper-tint-neutral-200)}.vesper-text-input:has(.vesper-text-input-field:disabled) .vesper-text-input-icon{color:var(--vesper-icon-disabled);pointer-events:none}.vesper-text-input-success{border:var(--vesper-stroke-base) solid var(--vesper-border-success-base)}.vesper-text-input-warning{border:var(--vesper-stroke-base) solid var(--vesper-border-warning-base)}.vesper-text-input-error{border:var(--vesper-stroke-base) solid var(--vesper-border-error-base)}.vesper-text-input-icon{color:var(--vesper-icon-secondary);flex-shrink:0}.vesper-text-input-icon:where(button:not(:disabled)){cursor:pointer;position:relative}.vesper-text-input-icon:where(button:not(:disabled)):after{content:"";inset:calc(var(--vesper-spacing-micro) * -4);position:absolute}.vesper-text-input-field{width:100%;color:var(--vesper-text-primary)}.vesper-text-input-field::-ms-input-placeholder{color:var(--vesper-text-tertiary)}.vesper-text-input-field::placeholder{color:var(--vesper-text-tertiary)}.vesper-text-input-field:focus-visible{box-shadow:none;outline:none}.vesper-text-input-field:-webkit-autofill{transition:background-color 2147480000s step-end}.vesper-text-input-field:autofill{transition:background-color 2147480000s step-end}.vesper-text-input-field:-webkit-autofill{transition:background-color 2147480000s step-end}.vesper-text-input-field:disabled{color:var(--vesper-text-tertiary)}.vesper-text-input-field:disabled::-ms-input-placeholder{color:var(--vesper-text-disabled)}.vesper-text-input-field:disabled::placeholder{color:var(--vesper-text-disabled)}.vesper-text-input-field::-webkit-search-decoration{-ms-appearance:none;appearance:none;display:none}.vesper-text-input-field::-webkit-search-cancel-button{-ms-appearance:none;appearance:none;display:none}.vesper-text-input-field::-webkit-search-results-button{-ms-appearance:none;appearance:none;display:none}.vesper-text-input-field::-webkit-search-results-decoration{-ms-appearance:none;appearance:none;display:none}.vesper-text-input-field::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.vesper-text-input-field::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.vesper-text-input-field[type=number]{-ms-appearance:textfield;appearance:textfield}@media not (min-width:768px){.vesper-text-input-field{font-size:max(16px,1rem)}}.vesper-text-input-sm{gap:var(--vesper-spacing-1);padding:0 var(--vesper-spacing-2);border-radius:var(--vesper-radius-1);height:2rem}.vesper-text-input-sm .vesper-text-input-icon{width:.875rem;height:.875rem}.vesper-text-input-sm .vesper-text-input-field{padding:.43125rem 0}.vesper-text-input-md{gap:var(--vesper-spacing-2);padding:0 var(--vesper-spacing-3);border-radius:var(--vesper-radius-2);height:2.5rem}.vesper-text-input-md .vesper-text-input-icon{width:1rem;height:1rem}.vesper-text-input-md .vesper-text-input-field{padding:.6375rem 0}.vesper-text-input-lg{gap:var(--vesper-spacing-2);padding:0 var(--vesper-spacing-3);border-radius:var(--vesper-radius-2);height:3rem}.vesper-text-input-lg .vesper-text-input-icon{width:1.25rem;height:1.25rem}.vesper-text-input-lg .vesper-text-input-field{padding:.9rem 0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../src/components/toggle/toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,SAAS,EACd,GAAG,EAKJ,MAAM,OAAO,C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C,CAAC;CAC3B;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAoLxC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
4
|
+
import { useControlled } from "@base-ui/utils/useControlled";
|
|
5
|
+
import { useMergedRefs } from "@base-ui/utils/useMergedRefs";
|
|
4
6
|
import { Typography, } from "../typography/typography.js";
|
|
5
7
|
import { cn } from "../../utils/cn.js";
|
|
6
|
-
import { useMergedRefs } from "../../utils/hooks/useMergedRefs.js";
|
|
7
8
|
export const TOGGLE_SIZES = ["sm", "md", "lg"];
|
|
8
9
|
const TOGGLE_TYPOGRAPHY = {
|
|
9
10
|
sm: "label-sm",
|
|
@@ -56,22 +57,15 @@ export function Toggle(props) {
|
|
|
56
57
|
const { options, className, size = "md", value, defaultValue, onValueChange, id, name, required, disabled, ref, onKeyDown, onBlur, ...rest } = props;
|
|
57
58
|
const innerRef = useRef(null);
|
|
58
59
|
const mergedRef = useMergedRefs(innerRef, ref);
|
|
59
|
-
const [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (value !== innerValue) {
|
|
67
|
-
setInnerValue(value);
|
|
68
|
-
}
|
|
69
|
-
// eslint-disable-next-line
|
|
70
|
-
}, [value]);
|
|
60
|
+
const [selectedOption, setSelectedOption] = useControlled({
|
|
61
|
+
controlled: value,
|
|
62
|
+
default: defaultValue,
|
|
63
|
+
name: "Toggle",
|
|
64
|
+
});
|
|
71
65
|
const handleChangeValue = useCallback((nextValue) => {
|
|
72
|
-
|
|
66
|
+
setSelectedOption(nextValue);
|
|
73
67
|
onValueChange?.(nextValue);
|
|
74
|
-
}, [onValueChange]);
|
|
68
|
+
}, [setSelectedOption, onValueChange]);
|
|
75
69
|
// update inner value when parent form resets
|
|
76
70
|
useEffect(() => {
|
|
77
71
|
const form = innerRef.current?.closest("form");
|
|
@@ -114,15 +108,15 @@ export function Toggle(props) {
|
|
|
114
108
|
}, [onBlur]);
|
|
115
109
|
const [focusedValue, setFocusedValue] = useState(undefined);
|
|
116
110
|
const focusedIndex = options.findIndex((o) => o.value === focusedValue);
|
|
117
|
-
const selectedIndex = options.findIndex((o) => o.value ===
|
|
111
|
+
const selectedIndex = options.findIndex((o) => o.value === selectedOption);
|
|
118
112
|
/**
|
|
119
113
|
* roving tabindex: the group only ever exposes a single tab stop, which
|
|
120
114
|
* follows focus within the group, falling back to the selected option and
|
|
121
115
|
* finally to the first option when nothing is selected
|
|
122
116
|
*/
|
|
123
117
|
const tabbableIndex = [focusedIndex, selectedIndex].find((i) => i !== -1) ?? 0;
|
|
124
|
-
return (_jsxs("div", { ...rest, ref: mergedRef, role: "radiogroup", "aria-required": required, "aria-disabled": disabled, className: cn("vesper-toggle", `vesper-toggle-${size}`, disabled && "vesper-toggle-disabled", className), onKeyDown: handleKeyDown, onBlur: handleBlur, children: [_jsxs("select", { "aria-hidden": true, tabIndex: -1, id: id, name: name, required: required, disabled: disabled, className: "vesper-toggle-select", onChange: (event) => handleChangeValue(event.target.value), value:
|
|
125
|
-
const isSelected =
|
|
118
|
+
return (_jsxs("div", { ...rest, ref: mergedRef, role: "radiogroup", "aria-required": required, "aria-disabled": disabled, className: cn("vesper-toggle", `vesper-toggle-${size}`, disabled && "vesper-toggle-disabled", className), onKeyDown: handleKeyDown, onBlur: handleBlur, children: [_jsxs("select", { "aria-hidden": true, tabIndex: -1, id: id, name: name, required: required, disabled: disabled, className: "vesper-toggle-select", onChange: (event) => handleChangeValue(event.target.value), value: selectedOption ?? "", children: [_jsx("option", { value: "" }), options.map((option) => (_jsx("option", { value: option.value }, option.value)))] }), options.map((option, index) => {
|
|
119
|
+
const isSelected = selectedOption === option.value;
|
|
126
120
|
return (_jsx(Typography, { as: "button", type: "button", "aria-checked": isSelected, role: "radio", tabIndex: index === tabbableIndex ? 0 : -1, disabled: disabled, variant: TOGGLE_TYPOGRAPHY[size], className: cn("vesper-toggle-item", isSelected && "vesper-toggle-item-active"), "aria-label": option.ariaLabel, onFocus: () => setFocusedValue(option.value), onClick: () => handleChangeValue(isSelected ? "" : option.value), children: "text" in option ? (option.text) : (_jsx("span", { className: "vesper-toggle-icon", children: option.icon })) }, option.value));
|
|
127
121
|
})] }));
|
|
128
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../src/components/toggle/toggle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAML,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../src/components/toggle/toggle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAML,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EACL,UAAU,GAEX,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AA8CxD,MAAM,iBAAiB,GAA6C;IAClE,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,UAAU;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IAC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,KAAK,CAAC;gBAEnD,OAAO,CACL,KAAC,UAAU,IACT,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,QAAQ,kBACC,UAAU,EACxB,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAEhC,SAAS,EAAE,EAAE,CACX,oBAAoB,EACpB,UAAU,IAAI,2BAA2B,CAC1C,gBACW,MAAM,CAAC,SAAS,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,YAE/D,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAClB,MAAM,CAAC,IAAI,CACZ,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,oBAAoB,YAAE,MAAM,CAAC,IAAI,GAAQ,CAC1D,IAbI,MAAM,CAAC,KAAK,CAcN,CACd,CAAC;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenstorrent/vesper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React component library for the Vesper design system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,10 +35,6 @@
|
|
|
35
35
|
"types": "./dist/components/form-input-message/form-input-message.d.ts",
|
|
36
36
|
"import": "./dist/components/form-input-message/form-input-message.js"
|
|
37
37
|
},
|
|
38
|
-
"./masked-input": {
|
|
39
|
-
"types": "./dist/components/masked-input/masked-input.d.ts",
|
|
40
|
-
"import": "./dist/components/masked-input/masked-input.js"
|
|
41
|
-
},
|
|
42
38
|
"./select": {
|
|
43
39
|
"types": "./dist/components/select/select.d.ts",
|
|
44
40
|
"import": "./dist/components/select/select.js"
|
|
@@ -255,8 +251,7 @@
|
|
|
255
251
|
},
|
|
256
252
|
"dependencies": {
|
|
257
253
|
"@base-ui/react": "^1.7.0",
|
|
258
|
-
"@
|
|
259
|
-
"@maskito/react": "^5.4.0",
|
|
254
|
+
"@base-ui/utils": "^0.4.0",
|
|
260
255
|
"@shikijs/core": "^4.3.1",
|
|
261
256
|
"@shikijs/engine-javascript": "^4.3.1",
|
|
262
257
|
"@shikijs/langs": "^4.3.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getMaskitoOptions.d.ts","sourceRoot":"","sources":["../../../src/components/masked-input/getMaskitoOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,iBAAiB,GAAG,cAAc,CA8B1E"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function getMaskitoOptions(mask) {
|
|
2
|
-
if (!mask) {
|
|
3
|
-
return { mask: /./ };
|
|
4
|
-
}
|
|
5
|
-
if (typeof mask === "string") {
|
|
6
|
-
return { mask: Array.from(mask, (c) => (c === "_" ? /./ : c)) };
|
|
7
|
-
}
|
|
8
|
-
if ("mask" in mask) {
|
|
9
|
-
return mask;
|
|
10
|
-
}
|
|
11
|
-
if (typeof mask.replace === "string") {
|
|
12
|
-
return {
|
|
13
|
-
mask: Array.from(mask.format, (c) => (c === mask.replace ? /./ : c)),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
if (mask.replace instanceof RegExp) {
|
|
17
|
-
const replacement = mask.replace;
|
|
18
|
-
return {
|
|
19
|
-
mask: Array.from(mask.format, (c) => (c === "_" ? replacement : c)),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const replacements = mask.replace;
|
|
23
|
-
return {
|
|
24
|
-
mask: Array.from(mask.format, (c) => replacements[c] ?? c),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=getMaskitoOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getMaskitoOptions.js","sourceRoot":"","sources":["../../../src/components/masked-input/getMaskitoOptions.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,iBAAiB,CAAC,IAAwB;IACxD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,CAAC;IAED,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACrE,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,YAAY,MAAM,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC;QACjC,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACpE,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC;IAClC,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KAC3D,CAAC;AACJ,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { type MaskitoOptions } from "@maskito/core";
|
|
2
|
-
import { type TextInputProps } from "../text-input/text-input.js";
|
|
3
|
-
/**
|
|
4
|
-
* The text masking configuration for a `MaskedInput`, which can take one of three shapes:
|
|
5
|
-
*
|
|
6
|
-
* - `string`: a fixed-length pattern where every `_` is a placeholder that accepts any character, eg. `"____-____-____"`.
|
|
7
|
-
* - `{ format, replace }`: a fixed-length pattern where `replace` determines the placeholder characters and what they accept.
|
|
8
|
-
* Pass a `RegExp` to keep `_` as the placeholder but restrict accepted characters, a single-character `string` to use a
|
|
9
|
-
* different placeholder that accepts any character, or a `Record<string, RegExp>` to map each placeholder character in
|
|
10
|
-
* `format` to the expression validating it.
|
|
11
|
-
* - `MaskitoOptions`: a full [maskito](https://maskito.dev) configuration, for behavior the shorthands can't express, eg.
|
|
12
|
-
* dynamic (variable-length) masks, pre/post-processing hooks, or overwrite mode.
|
|
13
|
-
*
|
|
14
|
-
* Any character in a `string` or `format` pattern that is not a placeholder is treated as a literal and inserted automatically as the user types.
|
|
15
|
-
*/
|
|
16
|
-
export type TextMaskingConfig = MaskitoOptions | string | {
|
|
17
|
-
format: string;
|
|
18
|
-
replace: RegExp | string | {
|
|
19
|
-
[key: string]: RegExp;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export interface MaskedInputProps extends Omit<TextInputProps, "type"> {
|
|
23
|
-
/** The text masking configuration, which determines the shape and formatting of the masked text. When omitted, no masking is applied and the field behaves like a regular `TextInput`. */
|
|
24
|
-
mask?: TextMaskingConfig;
|
|
25
|
-
/** The HTML input type. Restricted to the types that can be masked. @default text */
|
|
26
|
-
type?: "text" | "search" | "tel" | "email" | "url";
|
|
27
|
-
/** When `true`, the initial value of the input is formatted to match the `mask` on mount. @default false */
|
|
28
|
-
formatOnMount?: boolean;
|
|
29
|
-
/** When `true`, the current value of the input is reformatted to match the `mask` whenever the `mask` prop changes. @default true */
|
|
30
|
-
formatOnMaskChange?: boolean;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A `TextInput` that restricts and formats its value as the user types, via a text mask.
|
|
34
|
-
*
|
|
35
|
-
* @param {TextMaskingConfig} [props.mask] - (optional) The text masking configuration. Accepts a `string` pattern, a `{ format, replace }` object, or a `MaskitoOptions` object. When omitted, no masking is applied
|
|
36
|
-
* @param {string} [props.type] - (optional) The HTML input type, restricted to `"text" | "search" | "tel" | "email" | "url"`. @default text
|
|
37
|
-
* @param {boolean} [props.formatOnMount] - (optional) When `true`, the initial value of the input is formatted to match the `mask` on mount. @default false
|
|
38
|
-
* @param {boolean} [props.formatOnMaskChange] - (optional) When `true`, the current value of the input is reformatted to match the `mask` whenever the `mask` prop changes. @default false
|
|
39
|
-
*
|
|
40
|
-
* You may also pass any additional props supported by the `TextInput` component including `size`, `variant`, `iconLeft`, `iconRight`, and `dropdown`
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* <MaskedInput aria-label="Activation code" mask="____-____-____" />
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* <MaskedInput
|
|
47
|
-
* aria-label="Phone number"
|
|
48
|
-
* placeholder="ex: +1 (222) 333-4444"
|
|
49
|
-
* mask={{ format: "+1 (___) ___-____", replace: /\d/ }}
|
|
50
|
-
* />
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* <MaskedInput
|
|
54
|
-
* aria-label="Postal code"
|
|
55
|
-
* placeholder="ex: A0A 1B1"
|
|
56
|
-
* mask={{ format: "ABA BAB", replace: { A: /[a-zA-Z]/, B: /\d/ } }}
|
|
57
|
-
* />
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* <MaskedInput
|
|
61
|
-
* aria-label="Activation code"
|
|
62
|
-
* mask="____-____-____"
|
|
63
|
-
* defaultValue="123456789012"
|
|
64
|
-
* formatOnMount
|
|
65
|
-
* />
|
|
66
|
-
*/
|
|
67
|
-
export declare function MaskedInput({ mask, ref, formatOnMount, formatOnMaskChange, ...props }: MaskedInputProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
-
//# sourceMappingURL=masked-input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"masked-input.d.ts","sourceRoot":"","sources":["../../../src/components/masked-input/masked-input.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAC;AAM5C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,MAAM,GACN;IACE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtD,CAAC;AAEN,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC;IACpE,0LAA0L;IAC1L,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;IACnD,4GAA4G;IAC5G,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qIAAqI;IACrI,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,GAAG,EACH,aAAqB,EACrB,kBAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,gBAAgB,2CA6BlB"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
4
|
-
import { maskitoInitialCalibrationPlugin, } from "@maskito/core";
|
|
5
|
-
import { useMaskito } from "@maskito/react";
|
|
6
|
-
import { TextInput, } from "../text-input/text-input.js";
|
|
7
|
-
import { useMergedRefs } from "../../utils/hooks/useMergedRefs.js";
|
|
8
|
-
import { getMaskitoOptions } from "./getMaskitoOptions.js";
|
|
9
|
-
/**
|
|
10
|
-
* A `TextInput` that restricts and formats its value as the user types, via a text mask.
|
|
11
|
-
*
|
|
12
|
-
* @param {TextMaskingConfig} [props.mask] - (optional) The text masking configuration. Accepts a `string` pattern, a `{ format, replace }` object, or a `MaskitoOptions` object. When omitted, no masking is applied
|
|
13
|
-
* @param {string} [props.type] - (optional) The HTML input type, restricted to `"text" | "search" | "tel" | "email" | "url"`. @default text
|
|
14
|
-
* @param {boolean} [props.formatOnMount] - (optional) When `true`, the initial value of the input is formatted to match the `mask` on mount. @default false
|
|
15
|
-
* @param {boolean} [props.formatOnMaskChange] - (optional) When `true`, the current value of the input is reformatted to match the `mask` whenever the `mask` prop changes. @default false
|
|
16
|
-
*
|
|
17
|
-
* You may also pass any additional props supported by the `TextInput` component including `size`, `variant`, `iconLeft`, `iconRight`, and `dropdown`
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* <MaskedInput aria-label="Activation code" mask="____-____-____" />
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* <MaskedInput
|
|
24
|
-
* aria-label="Phone number"
|
|
25
|
-
* placeholder="ex: +1 (222) 333-4444"
|
|
26
|
-
* mask={{ format: "+1 (___) ___-____", replace: /\d/ }}
|
|
27
|
-
* />
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* <MaskedInput
|
|
31
|
-
* aria-label="Postal code"
|
|
32
|
-
* placeholder="ex: A0A 1B1"
|
|
33
|
-
* mask={{ format: "ABA BAB", replace: { A: /[a-zA-Z]/, B: /\d/ } }}
|
|
34
|
-
* />
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* <MaskedInput
|
|
38
|
-
* aria-label="Activation code"
|
|
39
|
-
* mask="____-____-____"
|
|
40
|
-
* defaultValue="123456789012"
|
|
41
|
-
* formatOnMount
|
|
42
|
-
* />
|
|
43
|
-
*/
|
|
44
|
-
export function MaskedInput({ mask, ref, formatOnMount = false, formatOnMaskChange = false, ...props }) {
|
|
45
|
-
const mounted = useRef(false);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
mounted.current = true;
|
|
48
|
-
}, []);
|
|
49
|
-
const maskitoConfig = useMemo(() => {
|
|
50
|
-
const options = getMaskitoOptions(mask);
|
|
51
|
-
const shouldFormat = mounted.current ? formatOnMaskChange : formatOnMount;
|
|
52
|
-
if (!shouldFormat)
|
|
53
|
-
return { options };
|
|
54
|
-
return {
|
|
55
|
-
options: {
|
|
56
|
-
...options,
|
|
57
|
-
plugins: [
|
|
58
|
-
...(options.plugins ?? []),
|
|
59
|
-
maskitoInitialCalibrationPlugin(),
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}, [mask, formatOnMount, formatOnMaskChange]);
|
|
64
|
-
const maskitoRef = useMaskito(maskitoConfig);
|
|
65
|
-
const mergedInputRef = useMergedRefs(ref, maskitoRef);
|
|
66
|
-
return _jsx(TextInput, { ref: mergedInputRef, ...props });
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=masked-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"masked-input.js","sourceRoot":"","sources":["../../../src/components/masked-input/masked-input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,+BAA+B,GAEhC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EACL,SAAS,GAEV,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAkCxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,IAAI,EACJ,GAAG,EACH,aAAa,GAAG,KAAK,EACrB,kBAAkB,GAAG,KAAK,EAC1B,GAAG,KAAK,EACS;IACjB,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9B,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IACzB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAExC,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC;QAC1E,IAAI,CAAC,YAAY;YAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QAEtC,OAAO;YACL,OAAO,EAAE;gBACP,GAAG,OAAO;gBACV,OAAO,EAAE;oBACP,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;oBAC1B,+BAA+B,EAAE;iBAClC;aACF;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAE9C,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAEtD,OAAO,KAAC,SAAS,IAAC,GAAG,EAAE,cAAc,KAAM,KAAK,GAAI,CAAC;AACvD,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from `@base-ui`'s internal `useMergedRefsN` utility to expose a variadic API
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/mui/base-ui/blob/ccfe02679ec9ed08a518bc5444cb6d1ffb63f5e1/packages/utils/src/useMergedRefs.ts
|
|
5
|
-
*/
|
|
6
|
-
type Empty = null | undefined;
|
|
7
|
-
export type InputRef<I> = React.Ref<I> | Empty;
|
|
8
|
-
type Result<I> = React.RefCallback<I> | null;
|
|
9
|
-
export declare function useMergedRefs<I>(...refs: InputRef<I>[]): Result<I>;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=useMergedRefs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,KAAK,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAC9B,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;AAC/C,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAqB7C,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAMlE"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from `@base-ui`'s internal `useMergedRefsN` utility to expose a variadic API
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/mui/base-ui/blob/ccfe02679ec9ed08a518bc5444cb6d1ffb63f5e1/packages/utils/src/useMergedRefs.ts
|
|
5
|
-
*/
|
|
6
|
-
import { useRef } from "react";
|
|
7
|
-
const UNINITIALIZED = {};
|
|
8
|
-
function useRefWithInit(init) {
|
|
9
|
-
const ref = useRef(UNINITIALIZED);
|
|
10
|
-
if (ref.current === UNINITIALIZED) {
|
|
11
|
-
ref.current = init();
|
|
12
|
-
}
|
|
13
|
-
return ref;
|
|
14
|
-
}
|
|
15
|
-
export function useMergedRefs(...refs) {
|
|
16
|
-
const forkRef = useRefWithInit((createForkRef)).current;
|
|
17
|
-
if (didChangeN(forkRef, refs)) {
|
|
18
|
-
update(forkRef, refs);
|
|
19
|
-
}
|
|
20
|
-
return forkRef.callback;
|
|
21
|
-
}
|
|
22
|
-
function createForkRef() {
|
|
23
|
-
return {
|
|
24
|
-
callback: null,
|
|
25
|
-
cleanup: null,
|
|
26
|
-
refs: [],
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function didChangeN(forkRef, newRefs) {
|
|
30
|
-
return (forkRef.refs.length !== newRefs.length ||
|
|
31
|
-
forkRef.refs.some((ref, index) => ref !== newRefs[index]));
|
|
32
|
-
}
|
|
33
|
-
function update(forkRef, refs) {
|
|
34
|
-
forkRef.refs = refs;
|
|
35
|
-
if (refs.every((ref) => ref == null)) {
|
|
36
|
-
forkRef.callback = null;
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
forkRef.callback = (instance) => {
|
|
40
|
-
if (forkRef.cleanup) {
|
|
41
|
-
forkRef.cleanup();
|
|
42
|
-
forkRef.cleanup = null;
|
|
43
|
-
}
|
|
44
|
-
if (instance != null) {
|
|
45
|
-
const cleanupCallbacks = Array(refs.length).fill(null);
|
|
46
|
-
for (let i = 0; i < refs.length; i += 1) {
|
|
47
|
-
const ref = refs[i];
|
|
48
|
-
if (ref == null) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
switch (typeof ref) {
|
|
52
|
-
case "function": {
|
|
53
|
-
const refCleanup = ref(instance);
|
|
54
|
-
if (typeof refCleanup === "function") {
|
|
55
|
-
cleanupCallbacks[i] = refCleanup;
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
case "object": {
|
|
60
|
-
ref.current = instance;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
default:
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
forkRef.cleanup = () => {
|
|
67
|
-
for (let i = 0; i < refs.length; i += 1) {
|
|
68
|
-
const ref = refs[i];
|
|
69
|
-
if (ref == null) {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
switch (typeof ref) {
|
|
73
|
-
case "function": {
|
|
74
|
-
const cleanupCallback = cleanupCallbacks[i];
|
|
75
|
-
if (typeof cleanupCallback === "function") {
|
|
76
|
-
cleanupCallback();
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
// Legacy ref with no attach-time cleanup: detach by calling it with `null`.
|
|
80
|
-
// It returns nothing; React 19 cleanups are handled in the branch above.
|
|
81
|
-
void ref(null);
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case "object": {
|
|
86
|
-
ref.current = null;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
default:
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=useMergedRefs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedRefs.js","sourceRoot":"","sources":["../../../src/utils/hooks/useMergedRefs.ts"],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