plass-ui 1.4.0 → 1.6.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/CHANGELOG.md +432 -0
- package/README.md +45 -23
- package/dist/components/accordion/PlAccordion.d.ts +1 -1
- package/dist/components/alert/PlAlert.js +1 -1
- package/dist/components/anchor/PlAnchor.d.ts +14 -1
- package/dist/components/anchor/PlAnchor.js +1 -1
- package/dist/components/animate-appear/PlAnimateAppear.js +1 -1
- package/dist/components/animate-blink/PlAnimateBlink.js +1 -1
- package/dist/components/animate-counter/PlAnimateCounter.js +1 -1
- package/dist/components/animate-fade/PlAnimateFade.js +1 -1
- package/dist/components/animate-float/PlAnimateFloat.js +1 -1
- package/dist/components/animate-grow/PlAnimateGrow.js +1 -1
- package/dist/components/animate-headline/PlAnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/PlAnimateLighting.js +1 -1
- package/dist/components/animate-marquee/PlAnimateMarquee.d.ts +16 -4
- package/dist/components/animate-marquee/PlAnimateMarquee.js +1 -1
- package/dist/components/animate-reveal/PlAnimateReveal.js +1 -1
- package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
- package/dist/components/animate-scramble/PlAnimateScramble.js +1 -1
- package/dist/components/animate-shake/PlAnimateShake.js +1 -1
- package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
- package/dist/components/animate-split/PlAnimateSplit.d.ts +7 -4
- package/dist/components/animate-split/PlAnimateSplit.js +1 -1
- package/dist/components/animate-typing/PlAnimateTyping.d.ts +3 -2
- package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
- package/dist/components/app-logo/PlAppLogo.js +1 -1
- package/dist/components/area-chart/PlAreaChart.d.ts +1 -1
- package/dist/components/area-chart/PlAreaChart.js +1 -1
- package/dist/components/aspect-ratio/PlAspectRatio.d.ts +2 -1
- package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
- package/dist/components/avatar/PlAvatar.js +1 -1
- package/dist/components/back-top/PlBackTop.d.ts +8 -1
- package/dist/components/back-top/PlBackTop.js +1 -1
- package/dist/components/badge/PlBadge.js +1 -1
- package/dist/components/bar-chart/PlBarChart.d.ts +1 -1
- package/dist/components/bar-chart/PlBarChart.js +1 -1
- package/dist/components/blockquote/PlBlockquote.js +1 -1
- package/dist/components/bottom-navigation/PlBottomNavigation.d.ts +3 -0
- package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
- package/dist/components/button/PlButton.d.ts +8 -0
- package/dist/components/button/PlButton.js +1 -1
- package/dist/components/calendar/PlCalendar.js +1 -1
- package/dist/components/card/PlCard.js +1 -1
- package/dist/components/carousel/PlCarousel.d.ts +1 -1
- package/dist/components/carousel/PlCarousel.js +1 -1
- package/dist/components/chat-bubble/PlChatBubble.d.ts +4 -1
- package/dist/components/chat-bubble/PlChatBubble.js +1 -1
- package/dist/components/checkbox/PlCheckbox.js +1 -1
- package/dist/components/chip/PlChip.d.ts +6 -2
- package/dist/components/chip/PlChip.js +1 -1
- package/dist/components/code-block/PlCodeBlock.d.ts +19 -2
- package/dist/components/code-block/PlCodeBlock.js +1 -1
- package/dist/components/color-picker/PlColorPicker.d.ts +19 -2
- package/dist/components/color-picker/PlColorPicker.js +1 -1
- package/dist/components/combobox/PlCombobox.d.ts +14 -7
- package/dist/components/combobox/PlCombobox.js +1 -1
- package/dist/components/command-palette/PlCommandPalette.d.ts +6 -2
- package/dist/components/command-palette/PlCommandPalette.js +1 -1
- package/dist/components/confirm/PlConfirmProvider.js +1 -1
- package/dist/components/container/PlContainer.js +1 -1
- package/dist/components/data-table/PlDataTable.d.ts +20 -6
- package/dist/components/data-table/PlDataTable.js +1 -1
- package/dist/components/date-picker/PlDatePicker.js +1 -1
- package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
- package/dist/components/drawer/PlDrawer.js +1 -1
- package/dist/components/empty/PlEmpty.js +1 -1
- package/dist/components/file-picker/PlFilePicker.d.ts +22 -3
- package/dist/components/file-picker/PlFilePicker.js +1 -1
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.d.ts +3 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
- package/dist/components/form/PlForm.js +1 -1
- package/dist/components/gallery/PlGallery.d.ts +40 -2
- package/dist/components/gallery/PlGallery.js +1 -1
- package/dist/components/gallery/PlGalleryViewer.js +1 -1
- package/dist/components/gauge-chart/PlGaugeChart.js +1 -1
- package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -1
- package/dist/components/highlight/PlHighlight.d.ts +10 -3
- package/dist/components/highlight/PlHighlight.js +1 -1
- package/dist/components/hot-keys/PlHotKeys.js +1 -1
- package/dist/components/hover-card/PlHoverCard.d.ts +5 -3
- package/dist/components/hover-card/PlHoverCard.js +1 -1
- package/dist/components/how-to-steps/PlHowToSteps.js +1 -1
- package/dist/components/image/PlImage.d.ts +195 -8
- package/dist/components/image/PlImage.js +1 -1
- package/dist/components/image/PlImagePreview.d.ts +58 -0
- package/dist/components/image/PlImagePreview.js +1 -0
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/list/PlList.js +1 -1
- package/dist/components/menu/PlMenu.d.ts +14 -5
- package/dist/components/menu/PlMenu.js +1 -1
- package/dist/components/meter/PlMeter.js +1 -1
- package/dist/components/navigation-menu/PlNavigationMenu.d.ts +7 -1
- package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
- package/dist/components/number-field/PlNumberField.d.ts +12 -4
- package/dist/components/number-field/PlNumberField.js +1 -1
- package/dist/components/otp-field/PlOtpField.d.ts +15 -1
- package/dist/components/otp-field/PlOtpField.js +1 -1
- package/dist/components/page-layout/PlPageLayout.js +1 -1
- package/dist/components/pagination/PlPagination.d.ts +12 -9
- package/dist/components/pagination/PlPagination.js +1 -1
- package/dist/components/panes/PlPanes.d.ts +5 -0
- package/dist/components/panes/PlPanes.js +1 -1
- package/dist/components/pie-chart/PlPieChart.js +1 -1
- package/dist/components/pill/PlPill.js +1 -1
- package/dist/components/popover/PlPopover.d.ts +5 -5
- package/dist/components/popover/PlPopover.js +1 -1
- package/dist/components/progress-box/PlProgressBox.js +1 -1
- package/dist/components/progress-circular/PlProgressCircular.js +1 -1
- package/dist/components/progress-linear/PlProgressLinear.js +1 -1
- package/dist/components/radio-group/PlRadioGroup.js +1 -1
- package/dist/components/rating/PlRating.d.ts +1 -1
- package/dist/components/rating/PlRating.js +1 -1
- package/dist/components/scatter-chart/PlScatterChart.js +1 -1
- package/dist/components/scroll-area/PlScrollArea.js +1 -1
- package/dist/components/scroll-zone/PlScrollZone.d.ts +19 -6
- package/dist/components/scroll-zone/PlScrollZone.js +1 -1
- package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
- package/dist/components/select/PlSelect.d.ts +8 -2
- package/dist/components/select/PlSelect.js +1 -1
- package/dist/components/show/PlShow.d.ts +16 -0
- package/dist/components/show/PlShow.js +1 -1
- package/dist/components/sidebar/PlSidebar.js +1 -1
- package/dist/components/sidebar/PlSidebarTrigger.js +1 -1
- package/dist/components/skeleton/PlSkeleton.js +1 -1
- package/dist/components/slider/PlSlider.d.ts +13 -1
- package/dist/components/slider/PlSlider.js +1 -1
- package/dist/components/sparkline/PlSparkline.js +1 -1
- package/dist/components/spoiler/PlSpoiler.d.ts +15 -8
- package/dist/components/spoiler/PlSpoiler.js +1 -1
- package/dist/components/stat/PlStat.d.ts +4 -0
- package/dist/components/stat/PlStat.js +1 -1
- package/dist/components/stepper/PlStepper.d.ts +1 -1
- package/dist/components/stepper/PlStepper.js +1 -1
- package/dist/components/switch/PlSwitch.js +1 -1
- package/dist/components/table/PlTable.d.ts +5 -5
- package/dist/components/tabs/PlTabs.d.ts +26 -1
- package/dist/components/tabs/PlTabs.js +1 -1
- package/dist/components/text-field/PlTextField.d.ts +15 -5
- package/dist/components/text-field/PlTextField.js +1 -1
- package/dist/components/text-link/PlTextLink.js +1 -1
- package/dist/components/time-picker/PlTimePicker.js +1 -1
- package/dist/components/timeline/PlTimeline.js +1 -1
- package/dist/components/timeline-chart/PlTimelineChart.js +1 -1
- package/dist/components/toast/PlToast.js +1 -1
- package/dist/components/toggle/PlToggle.js +1 -1
- package/dist/components/tooltip/PlTooltip.js +1 -1
- package/dist/components/tour/PlTour.js +1 -1
- package/dist/components/transfer/PlTransfer.d.ts +10 -1
- package/dist/components/transfer/PlTransfer.js +1 -1
- package/dist/components/tree/PlTree.js +1 -1
- package/dist/components/tree-select/PlTreeSelect.js +1 -1
- package/dist/components/typography/PlTypography.js +1 -1
- package/dist/components/window-pane/PlWindowPane.d.ts +3 -3
- package/dist/components/window-pane/PlWindowPane.js +1 -1
- package/dist/css/area-chart.css +1 -0
- package/dist/css/back-top.css +2 -0
- package/dist/css/bar-chart.css +1 -0
- package/dist/css/calendar.css +1 -0
- package/dist/css/carousel.css +2 -0
- package/dist/css/color-picker.css +1 -0
- package/dist/css/combobox.css +1 -0
- package/dist/css/command-palette.css +1 -0
- package/dist/css/confirm.css +2 -0
- package/dist/css/data-table.css +5 -0
- package/dist/css/date-picker.css +1 -0
- package/dist/css/date-range-picker.css +1 -0
- package/dist/css/date-time-picker.css +1 -0
- package/dist/css/floating-action-button.css +2 -0
- package/dist/css/gallery.css +5 -0
- package/dist/css/gauge-chart.css +1 -0
- package/dist/css/heatmap-chart.css +1 -0
- package/dist/css/icon-button.css +1 -0
- package/dist/css/image.css +2 -0
- package/dist/css/line-chart.css +1 -0
- package/dist/css/menubar.css +1 -0
- package/dist/css/pagination.css +1 -0
- package/dist/css/pie-chart.css +1 -0
- package/dist/css/popconfirm.css +2 -0
- package/dist/css/scatter-chart.css +1 -0
- package/dist/css/scroll-zone.css +2 -0
- package/dist/css/sidebar.css +3 -0
- package/dist/css/sparkline.css +1 -0
- package/dist/css/spoiler.css +1 -0
- package/dist/css/stat.css +1 -0
- package/dist/css/time-picker.css +1 -0
- package/dist/css/timeline-chart.css +1 -0
- package/dist/css/tour.css +1 -0
- package/dist/css/transfer.css +4 -0
- package/dist/css/tree-select.css +2 -0
- package/dist/hooks/usePlElementSize.d.ts +4 -1
- package/dist/hooks/usePlElementSize.js +1 -1
- package/dist/hooks/usePlHotKeys.d.ts +5 -1
- package/dist/hooks/usePlHotKeys.js +1 -1
- package/dist/hooks/usePlOnScreen.d.ts +4 -0
- package/dist/hooks/usePlOnScreen.js +1 -1
- package/dist/internal/animate.d.ts +24 -21
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +3 -14
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +90 -3
- package/dist/internal/chart.js +1 -1
- package/dist/internal/color-scheme.js +1 -1
- package/dist/internal/data-table.d.ts +5 -4
- package/dist/internal/data-table.js +1 -1
- package/dist/internal/date.d.ts +10 -0
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +14 -1
- package/dist/internal/drag.d.ts +16 -0
- package/dist/internal/drag.js +1 -1
- package/dist/internal/focusable.d.ts +8 -0
- package/dist/internal/focusable.js +1 -0
- package/dist/internal/form.d.ts +61 -0
- package/dist/internal/form.js +1 -0
- package/dist/internal/gallery.d.ts +60 -14
- package/dist/internal/gallery.js +1 -1
- package/dist/internal/glow.d.ts +32 -0
- package/dist/internal/glow.js +1 -0
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/image.d.ts +94 -0
- package/dist/internal/image.js +1 -0
- package/dist/internal/inert.d.ts +19 -0
- package/dist/internal/inert.js +1 -0
- package/dist/internal/keys.d.ts +19 -0
- package/dist/internal/keys.js +1 -1
- package/dist/internal/labels.d.ts +58 -1
- package/dist/internal/labels.js +1 -1
- package/dist/internal/link.d.ts +17 -0
- package/dist/internal/link.js +1 -1
- package/dist/internal/notch.d.ts +83 -0
- package/dist/internal/notch.js +1 -0
- package/dist/internal/page-layout.d.ts +14 -7
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.d.ts +51 -8
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +16 -8
- package/dist/internal/progress.js +1 -1
- package/dist/internal/scramble.d.ts +4 -0
- package/dist/internal/scramble.js +1 -1
- package/dist/internal/scroll-target.d.ts +5 -0
- package/dist/internal/scroll-target.js +1 -0
- package/dist/internal/steps.js +1 -1
- package/dist/internal/styles.d.ts +87 -0
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +39 -0
- package/dist/internal/text.js +1 -0
- package/dist/internal/watermark.d.ts +44 -0
- package/dist/internal/watermark.js +1 -0
- package/dist/internal/wheel.d.ts +52 -0
- package/dist/internal/wheel.js +1 -0
- package/dist/internal/window.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/provider/PlColorSchemeScript.js +1 -1
- package/dist/provider/PlassProvider.d.ts +4 -3
- package/dist/provider/PlassProvider.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +313 -15
- package/dist/tokens.css +313 -15
- package/dist/types.d.ts +71 -29
- package/package.json +15 -15
package/dist/internal/keys.d.ts
CHANGED
|
@@ -43,11 +43,30 @@ export declare function canonicalKey(token: string): string;
|
|
|
43
43
|
*/
|
|
44
44
|
export interface PlassKeyState {
|
|
45
45
|
key: string;
|
|
46
|
+
/** The physical key, for when `key` is what a modifier turned it into. */
|
|
47
|
+
code?: string;
|
|
46
48
|
metaKey: boolean;
|
|
47
49
|
ctrlKey: boolean;
|
|
48
50
|
shiftKey: boolean;
|
|
49
51
|
altKey: boolean;
|
|
50
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether the key belongs to text an input method is still composing.
|
|
55
|
+
*
|
|
56
|
+
* The Enter that commits a Korean syllable and the Escape that cancels a
|
|
57
|
+
* Japanese conversion are the input method's keys, not the page's: answering
|
|
58
|
+
* one fires a binding the reader did not press, and consuming it breaks the
|
|
59
|
+
* word they were typing. `229` is what a browser reports for such a key where
|
|
60
|
+
* `isComposing` is not set.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isComposingKey(event: {
|
|
63
|
+
keyCode?: number;
|
|
64
|
+
isComposing?: boolean;
|
|
65
|
+
} & {
|
|
66
|
+
nativeEvent?: {
|
|
67
|
+
isComposing?: boolean;
|
|
68
|
+
};
|
|
69
|
+
}): boolean;
|
|
51
70
|
/**
|
|
52
71
|
* Does the chord carry a modifier a reader cannot type?
|
|
53
72
|
*
|
package/dist/internal/keys.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function detectOS(){if("undefined"==typeof navigator)return"windows";const e=navigator.userAgentData,t=`${e?.platform??""} ${navigator.platform??""} ${navigator.userAgent??""}`;return/mac|iphone|ipad|ipod/i.test(t)?"mac":/win/i.test(t)?"windows":"linux"}export const keyAliases={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",numpadenter:"enter",esc:"escape",del:"delete",caps:"capslock"};export function canonicalKey(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return keyAliases[t]??t}const e={up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",space:" ",plus:"+"};export function hasHardModifier(e){return e.split("+").slice(0,-1).map(canonicalKey).some(e=>"mod"===e||"ctrl"===e||"meta"===e||"alt"===e)}const t=new Set(["enter","backspace","delete","arrowleft","arrowright","arrowup","arrowdown","home","end","pageup","pagedown"]);export function editsText(e){return 1===e.length||t.has(e.toLowerCase())}export function isTypingTarget(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;if("TEXTAREA"===e.tagName||"SELECT"===e.tagName)return!0;if("INPUT"===e.tagName){const t=e.type;return!["button","checkbox","color","file","image","radio","range","reset","submit"].includes(t)}return!1}export function matchesHotKey(t,
|
|
1
|
+
export function detectOS(){if("undefined"==typeof navigator)return"windows";const e=navigator.userAgentData,t=`${e?.platform??""} ${navigator.platform??""} ${navigator.userAgent??""}`;return/mac|iphone|ipad|ipod/i.test(t)?"mac":/win/i.test(t)?"windows":"linux"}export const keyAliases={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",numpadenter:"enter",esc:"escape",del:"delete",caps:"capslock"};export function canonicalKey(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return keyAliases[t]??t}const e={up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",space:" ",plus:"+"};export function isComposingKey(e){return Boolean(e.nativeEvent?.isComposing??e.isComposing)||229===e.keyCode}export function hasHardModifier(e){return e.split("+").slice(0,-1).map(canonicalKey).some(e=>"mod"===e||"ctrl"===e||"meta"===e||"alt"===e)}const t=new Set(["enter","backspace","delete","arrowleft","arrowright","arrowup","arrowdown","home","end","pageup","pagedown"]);export function editsText(e){return 1===e.length||t.has(e.toLowerCase())}export function isTypingTarget(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;if("TEXTAREA"===e.tagName||"SELECT"===e.tagName)return!0;if("INPUT"===e.tagName){const t=e.type;return!["button","checkbox","color","file","image","radio","range","reset","submit"].includes(t)}return!1}export function matchesHotKey(t,o){const n=o.split("+").map(canonicalKey),r=new Set(n.slice(0,-1)),a=n[n.length-1],i=e[a]??a,s="mac"===detectOS()?t.metaKey:t.ctrlKey,c=!(1===i.length&&!/[a-z0-9]/.test(i)&&!r.has("shift"))&&t.shiftKey;if(r.has("mod")!==s)return!1;if(r.has("shift")!==c||r.has("alt")!==t.altKey)return!1;if(!r.has("mod")&&(r.has("ctrl")!==t.ctrlKey||r.has("meta")!==t.metaKey))return!1;const p=t.key.toLowerCase();return p===i||!(!/^[a-z0-9]$/.test(i)||/^[a-z0-9]$/.test(p)||!t.code)&&t.code===(/[a-z]/.test(i)?`Key${i.toUpperCase()}`:`Digit${i}`)}export function hotKeyHandler(e,t){if(e||t)return o=>{if(t?.(o),e&&!o.defaultPrevented&&!isComposingKey(o))for(const t of Object.keys(e))if(matchesHotKey(o,t))return o.preventDefault(),o.stopPropagation(),void e[t]()}}
|
|
@@ -5,6 +5,8 @@ export interface PlassLabels {
|
|
|
5
5
|
cancel: string;
|
|
6
6
|
/** The other one. */
|
|
7
7
|
confirm: string;
|
|
8
|
+
/** The one button on a message that only needs to have been read. */
|
|
9
|
+
acknowledge: string;
|
|
8
10
|
/** Empties a field, a picker, a search. */
|
|
9
11
|
clear: string;
|
|
10
12
|
/** Finishes with a picker, or with a tour. */
|
|
@@ -36,6 +38,8 @@ export interface PlassLabels {
|
|
|
36
38
|
preview: string;
|
|
37
39
|
/** What a list says when it has nothing in it. */
|
|
38
40
|
empty: string;
|
|
41
|
+
/** Marks a step, or anything else, that may be left out. */
|
|
42
|
+
optional: string;
|
|
39
43
|
/** The trail's landmark, and the button that opens the steps it folded away. */
|
|
40
44
|
breadcrumb: string;
|
|
41
45
|
breadcrumbExpand: string;
|
|
@@ -43,6 +47,9 @@ export interface PlassLabels {
|
|
|
43
47
|
carousel: string;
|
|
44
48
|
carouselPrevious: string;
|
|
45
49
|
carouselNext: string;
|
|
50
|
+
/** What a slide is, said after its name: one slide's `aria-roledescription`.
|
|
51
|
+
* The reel's own is `carousel`. */
|
|
52
|
+
slide: string;
|
|
46
53
|
/** The wall of pictures' own landmark. */
|
|
47
54
|
gallery: string;
|
|
48
55
|
/** What a drawing of numbers is called when the caller has not named it. */
|
|
@@ -56,6 +63,8 @@ export interface PlassLabels {
|
|
|
56
63
|
commandPalettePlaceholder: string;
|
|
57
64
|
/** What a sheet over the whole page is called when it has no name. */
|
|
58
65
|
overlay: string;
|
|
66
|
+
/** The region the toasts are announced in. */
|
|
67
|
+
notifications: string;
|
|
59
68
|
/** The pager's landmark and its four steppers, which move by a page. */
|
|
60
69
|
pagination: string;
|
|
61
70
|
paginationPrevious: string;
|
|
@@ -64,8 +73,10 @@ export interface PlassLabels {
|
|
|
64
73
|
paginationLast: string;
|
|
65
74
|
/** The stars' group. */
|
|
66
75
|
rating: string;
|
|
67
|
-
/** The panel's landmark, the
|
|
76
|
+
/** The panel's landmark, the buttons that open and shut it, and the handle
|
|
77
|
+
* that sizes it. */
|
|
68
78
|
sidebar: string;
|
|
79
|
+
sidebarOpen: string;
|
|
69
80
|
sidebarClose: string;
|
|
70
81
|
sidebarResize: string;
|
|
71
82
|
/** The first link on a page, which jumps past the furniture. */
|
|
@@ -76,6 +87,16 @@ export interface PlassLabels {
|
|
|
76
87
|
onThisPage: string;
|
|
77
88
|
/** What a chat bubble says while somebody is still writing. */
|
|
78
89
|
typing: string;
|
|
90
|
+
/** What a chat bubble's mark says about the message it is on. */
|
|
91
|
+
messageSending: string;
|
|
92
|
+
messageSent: string;
|
|
93
|
+
messageDelivered: string;
|
|
94
|
+
messageRead: string;
|
|
95
|
+
messageFailed: string;
|
|
96
|
+
/** What covers a spoiler until it is revealed. */
|
|
97
|
+
spoilerWarning: string;
|
|
98
|
+
/** What a file picker's drop zone says when the caller has not said. */
|
|
99
|
+
filePickerTitle: string;
|
|
79
100
|
/** Read out after a link that leaves the page, and never drawn. */
|
|
80
101
|
newTab: string;
|
|
81
102
|
/** The two columns of a transfer, and the buttons between them. */
|
|
@@ -118,6 +139,42 @@ export interface PlassLabels {
|
|
|
118
139
|
/** Which end of a range the calendar is currently asking for. */
|
|
119
140
|
start: string;
|
|
120
141
|
end: string;
|
|
142
|
+
/** A page button's name. */
|
|
143
|
+
paginationPage: (page: number) => string;
|
|
144
|
+
/** What the pager's live region says once the page has changed. */
|
|
145
|
+
paginationStatus: (page: number, count: number) => string;
|
|
146
|
+
/** What one star is called, and a read-only row with a score. The score can
|
|
147
|
+
* be a fraction, so a pack writes it the way its language writes a number:
|
|
148
|
+
* `2.5` in English, `2,5` in German. */
|
|
149
|
+
ratingValue: (value: number, count: number) => string;
|
|
150
|
+
/** And a read-only row with none. */
|
|
151
|
+
ratingNone: string;
|
|
152
|
+
/** One slide's name, which is also its dot's. */
|
|
153
|
+
carouselSlide: (index: number, count: number) => string;
|
|
154
|
+
/** Where a picture sits in a gallery: said after a tile's own words, and
|
|
155
|
+
* drawn as the viewer's counter. */
|
|
156
|
+
galleryItem: (index: number, total: number) => string;
|
|
157
|
+
/** A remove button named after what it takes away: a file, a chip. */
|
|
158
|
+
removeItem: (name: string) => string;
|
|
159
|
+
/** The row that offers what was typed as a value of its own. */
|
|
160
|
+
addCustom: (query: string) => string;
|
|
161
|
+
/** One slot of a code field, named by its place in the row. */
|
|
162
|
+
otpSlot: (index: number, count: number) => string;
|
|
163
|
+
/** What a transfer says once rows have moved, given how many and the list. */
|
|
164
|
+
transferMoved: (count: number, list: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Why a file picker turned files away, one line per reason and given how many
|
|
167
|
+
* were turned away for it.
|
|
168
|
+
*
|
|
169
|
+
* Grouped by reason rather than named one file at a time, because the batch
|
|
170
|
+
* that goes wrong is usually the big one — a folder dropped on a picker with
|
|
171
|
+
* a `maxFiles` of five is ninety-five lines saying the same thing. What the
|
|
172
|
+
* limit itself *is* belongs in `hint`, which is where a picker already says
|
|
173
|
+
* what it accepts, so these do not repeat it.
|
|
174
|
+
*/
|
|
175
|
+
filesRejectedType: (count: number) => string;
|
|
176
|
+
filesRejectedSize: (count: number) => string;
|
|
177
|
+
filesRejectedCount: (count: number) => string;
|
|
121
178
|
}
|
|
122
179
|
/**
|
|
123
180
|
* English, and the reason the library needs no setup to read.
|
package/dist/internal/labels.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useDefaults as a}from"./defaults.js";export const defaultLabels={close:"Close",cancel:"Cancel",confirm:"Confirm",clear:"Clear",done:"Done",skip:"Skip",search:"Search",selectAll:"Select all",selectRow:"Select row",remove:"Remove",dismiss:"Dismiss",open:"Open",previous:"Previous",next:"Next",reveal:"Reveal",hide:"Hide",increase:"Increase",decrease:"Decrease",preview:"Preview",empty:"Nothing here",breadcrumb:"Breadcrumb",breadcrumbExpand:"Show the hidden steps",carousel:"Carousel",carouselPrevious:"Previous slide",carouselNext:"Next slide",commandPalette:"Command palette",commandPalettePlaceholder:"Search commands",gallery:"Gallery",chart:"Chart",minimize:"Minimize",maximize:"Maximize",restore:"Restore",resizeWindow:"Resize window",overlay:"Overlay",pagination:"Pagination",paginationPrevious:"Previous page",paginationNext:"Next page",paginationFirst:"First page",paginationLast:"Last page",rating:"Rating",sidebar:"Sidebar",sidebarClose:"Close sidebar",sidebarResize:"Resize sidebar",skipToContent:"Skip to content",backToTop:"Back to top",onThisPage:"On this page",typing:"Typing…",newTab:"(opens in a new tab)",transferAvailable:"Available",transferSelected:"Selected",transferToSelected:"Move to selected",transferToAvailable:"Move to available",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",code:"Code",previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",thisMonth:"This month",thisYear:"This year",now:"Now",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function useLabels(){const{labels:o}=a();return e.useMemo(()=>o?{...defaultLabels,...o}:defaultLabels,[o])}
|
|
1
|
+
"use client";import*as e from"react";import{useDefaults as a}from"./defaults.js";export const defaultLabels={close:"Close",cancel:"Cancel",confirm:"Confirm",acknowledge:"OK",clear:"Clear",done:"Done",skip:"Skip",search:"Search",selectAll:"Select all",selectRow:"Select row",remove:"Remove",dismiss:"Dismiss",open:"Open",previous:"Previous",next:"Next",reveal:"Reveal",hide:"Hide",increase:"Increase",decrease:"Decrease",preview:"Preview",empty:"Nothing here",optional:"Optional",breadcrumb:"Breadcrumb",breadcrumbExpand:"Show the hidden steps",carousel:"Carousel",carouselPrevious:"Previous slide",carouselNext:"Next slide",slide:"slide",commandPalette:"Command palette",commandPalettePlaceholder:"Search commands",gallery:"Gallery",chart:"Chart",minimize:"Minimize",maximize:"Maximize",restore:"Restore",resizeWindow:"Resize window",overlay:"Overlay",notifications:"Notifications",pagination:"Pagination",paginationPrevious:"Previous page",paginationNext:"Next page",paginationFirst:"First page",paginationLast:"Last page",rating:"Rating",sidebar:"Sidebar",sidebarOpen:"Open sidebar",sidebarClose:"Close sidebar",sidebarResize:"Resize sidebar",skipToContent:"Skip to content",backToTop:"Back to top",onThisPage:"On this page",typing:"Typing…",messageSending:"Sending",messageSent:"Sent",messageDelivered:"Delivered",messageRead:"Read",messageFailed:"Not delivered",spoilerWarning:"This may contain spoilers",filePickerTitle:"Drop files here, or click to browse",newTab:"(opens in a new tab)",transferAvailable:"Available",transferSelected:"Selected",transferToSelected:"Move to selected",transferToAvailable:"Move to available",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",code:"Code",previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",thisMonth:"This month",thisYear:"This year",now:"Now",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End",paginationPage:e=>`Page ${e}`,paginationStatus:(e,a)=>`Page ${e} of ${a}`,ratingValue:(e,a)=>`${e.toLocaleString("en")} out of ${a}`,ratingNone:"No rating",carouselSlide:(e,a)=>`Slide ${e} of ${a}`,galleryItem:(e,a)=>`${e} of ${a}`,removeItem:e=>`Remove ${e}`,addCustom:e=>`Add “${e}”`,otpSlot:(e,a)=>`Character ${e} of ${a}`,transferMoved:(e,a)=>`${e} ${1===e?"item":"items"} moved to ${a}`,filesRejectedType:e=>`${e} ${1===e?"file is":"files are"} not an accepted type`,filesRejectedSize:e=>`${e} ${1===e?"file is":"files are"} too large`,filesRejectedCount:e=>`${e} ${1===e?"file":"files"} did not fit`};export function useLabels(){const{labels:o}=a();return e.useMemo(()=>o?{...defaultLabels,...o}:defaultLabels,[o])}
|
package/dist/internal/link.d.ts
CHANGED
|
@@ -16,3 +16,20 @@
|
|
|
16
16
|
* that can drift, and the one that drifts is the one nobody reads.
|
|
17
17
|
*/
|
|
18
18
|
export declare function safeRel(target: string | undefined, rel: string | undefined): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Whether an address is one this library will point an `href` at.
|
|
21
|
+
*
|
|
22
|
+
* Relative addresses pass, and so do `http`, `https` and `mailto`. Everything
|
|
23
|
+
* else is turned down, which in practice means `javascript:` — an address that
|
|
24
|
+
* runs code instead of going somewhere. React 19 refuses to write one, but the
|
|
25
|
+
* peer range starts at React 18, which only warns and then writes it.
|
|
26
|
+
*
|
|
27
|
+
* The test is done on the address with tabs and line breaks taken out and the
|
|
28
|
+
* leading control characters and spaces trimmed, because that is the address the
|
|
29
|
+
* browser navigates to: a tab written into the middle of a scheme is gone by the
|
|
30
|
+
* time it counts. Only the scheme is read, so the rest is handed back untouched.
|
|
31
|
+
*
|
|
32
|
+
* Here beside `safeRel` for the same reason that one is here: which addresses a
|
|
33
|
+
* component will follow is one decision, and it belongs in one place.
|
|
34
|
+
*/
|
|
35
|
+
export declare function safeHref(href: string | undefined): string | undefined;
|
package/dist/internal/link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function safeRel(e,
|
|
1
|
+
export function safeRel(e,t){return void 0===e||""===e||"_self"===e?t:[...new Set([...(t??"").split(/\s+/).filter(Boolean),"noopener","noreferrer"])].join(" ")}const e=new Set(["http:","https:","mailto:"]),t=/^[a-z][a-z0-9+.-]*:/i;export function safeHref(r){if(void 0===r)return;const n=r.replace(/[\t\n\r]/g,"").replace(/^[\0- ]+/,""),o=t.exec(n);return null===o||e.has(o[0].toLowerCase())?r:void 0}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The label in the field's own top edge — `labelPlacement="notch"`.
|
|
3
|
+
*
|
|
4
|
+
* One module because every field-shaped control in the library draws the same
|
|
5
|
+
* notch: a PlTextField, a PlSelect's trigger, a PlCombobox, a PlNumberField, a
|
|
6
|
+
* PlFilePicker's drop zone and every picker that goes through `internal/picker`
|
|
7
|
+
* have to be indistinguishable along their top edge or a form looks like two
|
|
8
|
+
* forms stacked on each other.
|
|
9
|
+
*
|
|
10
|
+
* **The cut is real.** A `<legend>` takes a segment out of its `<fieldset>`'s
|
|
11
|
+
* border, and that is the only way to open a gap in a line without knowing what
|
|
12
|
+
* is behind it. The usual trick — a label with the page's own background colour
|
|
13
|
+
* painted over the border — cannot work here twice over: a library that does
|
|
14
|
+
* not paint the page has no idea what colour it is, and a Plass field is
|
|
15
|
+
* translucent, so a patch of flat colour would read as a patch of flat colour.
|
|
16
|
+
*
|
|
17
|
+
* **The fieldset is a sibling of the control rather than the control itself.**
|
|
18
|
+
* Half the shells this is drawn on are `<button>`s — a Select's trigger, a file
|
|
19
|
+
* picker's drop zone — and a button cannot contain a fieldset. So the frame
|
|
20
|
+
* below wraps the shell, the shell is drawn exactly as it always was, and the
|
|
21
|
+
* edge is laid over it with its own border. The shell's own border goes
|
|
22
|
+
* transparent for the length of it; `notchShellStyle` is that one declaration,
|
|
23
|
+
* written inline because it has to beat a `hover:` and a `disabled` rule that
|
|
24
|
+
* are already in the class string.
|
|
25
|
+
*/
|
|
26
|
+
import * as React from 'react';
|
|
27
|
+
import type { PlassDensity, PlassSize, PlassVariant } from '../types.js';
|
|
28
|
+
/**
|
|
29
|
+
* What the shell gives up while the edge is drawing for it.
|
|
30
|
+
*
|
|
31
|
+
* Inline rather than a class: every field's shell already carries a
|
|
32
|
+
* `border-color` at rest, another on hover, another on focus and another when
|
|
33
|
+
* disabled, and a utility added on top of those would be one more declaration
|
|
34
|
+
* of the same property at the same specificity — whichever of them Tailwind
|
|
35
|
+
* happened to emit last would win. The border itself stays, transparent, so the
|
|
36
|
+
* control's inside is the same size it was.
|
|
37
|
+
*/
|
|
38
|
+
export declare const notchShellStyle: React.CSSProperties;
|
|
39
|
+
export interface FieldNotchProps {
|
|
40
|
+
/**
|
|
41
|
+
* Whether to draw one at all. `false` renders the shell and nothing else, so
|
|
42
|
+
* a call site wraps its control once and unconditionally rather than writing
|
|
43
|
+
* the whole thing out twice — which is what keeps the two placements from
|
|
44
|
+
* drifting into two controls.
|
|
45
|
+
*/
|
|
46
|
+
notched: boolean;
|
|
47
|
+
size: PlassSize;
|
|
48
|
+
density: PlassDensity;
|
|
49
|
+
variant: PlassVariant;
|
|
50
|
+
/** Unavailable — the edge dims with the control. */
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/** Shown but not editable — the edge stays and stops answering. */
|
|
53
|
+
readOnly?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The whole edge, when it is not a field's hairline — width, style, colour and
|
|
56
|
+
* every state, replacing the three maps above.
|
|
57
|
+
*
|
|
58
|
+
* A PlFilePicker's drop zone is the one caller that needs it: its edge is 2px
|
|
59
|
+
* and dashed in all three variants, and it has a state no field has, a file
|
|
60
|
+
* being dragged over the box. Passed as one resolved string rather than added
|
|
61
|
+
* to the maps, for the reason every component in this library resolves its own
|
|
62
|
+
* states with an if/else — two utilities for one property at one specificity
|
|
63
|
+
* are settled by the order Tailwind happened to emit them in.
|
|
64
|
+
*/
|
|
65
|
+
edgeClassName?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The element that names the control, ready to render: a `Field.Label` for a
|
|
68
|
+
* field that has one, or the `<span>` an `aria-labelledby` points at. The
|
|
69
|
+
* same element the stacked placement renders, so the two cannot drift.
|
|
70
|
+
*/
|
|
71
|
+
label: React.ReactNode;
|
|
72
|
+
/** The control's shell, drawn exactly as it is without a notch. */
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Lays the notched edge over a control's shell.
|
|
77
|
+
*
|
|
78
|
+
* The frame is what the edge is positioned against and what hover and focus are
|
|
79
|
+
* read from, so the shell has to be inside it — and the shell is rendered
|
|
80
|
+
* untouched, which is the point: a notch is a decision about the label, not a
|
|
81
|
+
* second way of drawing a field.
|
|
82
|
+
*/
|
|
83
|
+
export declare function FieldNotch({ notched, size, density, variant, disabled, readOnly, edgeClassName, label, children }: FieldNotchProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{Fragment as r,jsx as o,jsxs as e}from"react/jsx-runtime";import{cx as s,metaTextClasses as t,radiusClasses as l,transitionClasses as d}from"./styles.js";const a={xs:"-top-[5px]",sm:"-top-[5.5px]",md:"-top-[6px]",lg:"-top-[6.5px]",xl:"-top-[7px]"},i={xs:"mt-[5px]",sm:"mt-[5.5px]",md:"mt-[6px]",lg:"mt-[6.5px]",xl:"mt-[7px]"},n={default:{xs:"ms-2",sm:"ms-2.5",md:"ms-3",lg:"ms-5",xl:"ms-6"},compact:{xs:"ms-2",sm:"ms-2.5",md:"ms-3",lg:"ms-3.5",xl:"ms-4"}},p={xs:"px-0.5",sm:"px-0.5",md:"px-1",lg:"px-1",xl:"px-1"},m={solid:/* @__PURE__ */["border border-transparent","group-focus-within/field:[border-color:var(--p-ring)]"].join(" "),glass:/* @__PURE__ */["border [border-color:var(--plass-border)]","group-hover/field:[border-color:var(--p-line)]","group-focus-within/field:[border-color:var(--p-ring)]"].join(" "),ghost:/* @__PURE__ */["border border-transparent","group-focus-within/field:[border-color:var(--p-ring)]"].join(" ")},c={solid:"border border-transparent",glass:"border [border-color:var(--plass-border)]",ghost:"border border-transparent"},b={solid:"border border-transparent opacity-50",glass:/* @__PURE__ */["border [border-color:var(--plass-border)] opacity-50","forced-colors:[border-color:GrayText]"].join(" "),ghost:"border border-transparent opacity-50"},x=/* @__PURE__ */["group-has-[:focus-visible]/field:[border-width:2px]","group-has-[:focus-visible]/field:forced-colors:[border-color:Highlight]"].join(" ");export const notchShellStyle={borderColor:"transparent"};export function FieldNotch({notched:g,size:f,density:h,variant:u,disabled:v=!1,readOnly:j=!1,edgeClassName:y,label:w,children:N}){return g?e("div",{className:s("group/field relative flex w-full",i[f]),children:[N,o("fieldset",{role:"presentation",className:s("pointer-events-none absolute inset-x-0 bottom-0 m-0 min-w-0 p-0",a[f],l[f],d,y??(v?b[u]:j?c[u]:`${m[u]} ${x}`)),children:o("legend",{className:s("pointer-events-auto font-semibold leading-none",t[f],n[h][f],p[f],v?"text-(--plass-muted-fg)":"text-(--plass-fg)"),children:w})})]}):o(r,{children:N})}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { PlassDirection } from './direction.js';
|
|
2
3
|
import type { PlassBreakpoint, PlassSide } from '../types.js';
|
|
3
4
|
/**
|
|
4
5
|
* The vocabulary a page's structure is written in, and the context the four
|
|
@@ -129,12 +130,18 @@ export declare function useCollapsed(breakpoint: PlPageLayoutCollapse): boolean;
|
|
|
129
130
|
* question and a layout flips under RTL on its own. A drawer is attached to an
|
|
130
131
|
* edge of the *window*, which `PlassSide` names physically for the same reason
|
|
131
132
|
* a tooltip above a button is above it in every writing direction — so the two
|
|
132
|
-
* have to be translated
|
|
133
|
-
* them.
|
|
133
|
+
* have to be translated.
|
|
134
134
|
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
135
|
+
* `direction` is what the nearest `PlassProvider` was told, and it wins for the
|
|
136
|
+
* reason it wins there: a provider given a direction is describing a subtree
|
|
137
|
+
* that runs the other way from the page, and a drawer is portalled out of that
|
|
138
|
+
* subtree, so the document is the one place that cannot say which way it runs.
|
|
139
|
+
* Without one, the document's own direction is the answer, as it is for the
|
|
140
|
+
* provider.
|
|
141
|
+
*
|
|
142
|
+
* The document is read during render rather than in an effect, which is safe
|
|
143
|
+
* here for a narrower reason than it looks: the only caller is a sidebar that
|
|
144
|
+
* has already collapsed, and collapsing is a client-side answer. There is no
|
|
145
|
+
* server render of this to disagree with.
|
|
139
146
|
*/
|
|
140
|
-
export declare function drawerSide(side: PlassSidebarSide): PlassSide;
|
|
147
|
+
export declare function drawerSide(side: PlassSidebarSide, direction?: PlassDirection): PlassSide;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{belowQuery as
|
|
1
|
+
"use client";import*as e from"react";import{belowQuery as t}from"./breakpoints.js";import{useMediaQuery as n}from"./media.js";export const PlPageLayoutContext=/* @__PURE__ */e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const PlassSidebarSideContext=/* @__PURE__ */e.createContext(null);export const collapsedOnlyClasses={none:"hidden",xs:"hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"};export const expandedOnlyClasses={none:"",xs:"",sm:"max-sm:hidden",md:"max-md:hidden",lg:"max-lg:hidden",xl:"max-xl:hidden"};export function useCollapsed(e){return n("none"===e?null:function collapseQuery(e){return"xs"===e?null:t(e)}(e))}export function drawerSide(e,t){const n=t?"rtl"===t:"undefined"!=typeof document&&"rtl"===getComputedStyle(document.documentElement).direction;return"start"===e?n?"right":"left":n?"left":"right"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassPickerLabels } from './calendar.js';
|
|
3
|
-
import type { PlassColor, PlassElevation, PlassFieldClassNames, PlassSize, PlassStyleProps } from '../types.js';
|
|
3
|
+
import type { PlassColor, PlassElevation, PlassFieldClassNames, PlassFieldLabelPlacement, PlassSize, PlassStyleProps } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The shell all four pickers wear: a field-shaped trigger with a popup hanging
|
|
6
6
|
* off it.
|
|
@@ -41,6 +41,41 @@ export declare function popupSlots(color: PlassColor, elevation: PlassElevation)
|
|
|
41
41
|
export declare const pickerPopupClasses: string;
|
|
42
42
|
/** The popup's own padding, one track tighter than a control's. */
|
|
43
43
|
export declare const popupPaddingClasses: Record<PlassSize, string>;
|
|
44
|
+
export interface PopupArrowProps {
|
|
45
|
+
/**
|
|
46
|
+
* The `Arrow` part of whichever Base UI popup this is — `Popover.Arrow`,
|
|
47
|
+
* `PreviewCard.Arrow`, `Tooltip.Arrow`. Each of the three roots has its own,
|
|
48
|
+
* and only the primitive knows where to put it.
|
|
49
|
+
*/
|
|
50
|
+
as: React.ElementType<{
|
|
51
|
+
className?: string;
|
|
52
|
+
children?: React.ReactNode;
|
|
53
|
+
}>;
|
|
54
|
+
/** How wide the wedge is, in pixels. Its height is half of that. */
|
|
55
|
+
size: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The wedge that points a floating sheet at what opened it.
|
|
59
|
+
*
|
|
60
|
+
* One drawing for all three, and it is the *stroked* one: a triangle filled
|
|
61
|
+
* with the sheet's own `--plass-glass-press`, with the hairline drawn along its
|
|
62
|
+
* two slanted sides only.
|
|
63
|
+
*
|
|
64
|
+
* Both of those are the glass rules rather than a preference. The fill is the
|
|
65
|
+
* same one declaration the plate carries, so the wedge stays on the plate's
|
|
66
|
+
* rung of the opacity ladder — a wedge stacked out of a line triangle and a
|
|
67
|
+
* fill triangle composites two translucent whites and comes out lighter than
|
|
68
|
+
* the sheet it grew from, which in the dark theme is 0.25 against the plate's
|
|
69
|
+
* 0.15. And `--plass-glass-line` is a cut edge rather than a colour to fill
|
|
70
|
+
* with, so it is stroked: on the two sides that are a cut edge, and not across
|
|
71
|
+
* the base, which is not one — the plate is on the other side of it.
|
|
72
|
+
*
|
|
73
|
+
* `non-scaling-stroke` is what keeps that hairline one pixel at every `size`.
|
|
74
|
+
* The path is written in a 10×5 viewBox and the box is drawn at whatever the
|
|
75
|
+
* component's ladder says, so a stroke that scaled would be thinner than the
|
|
76
|
+
* plate's border on a small sheet and thicker on a large one.
|
|
77
|
+
*/
|
|
78
|
+
export declare function PopupArrow({ as: Arrow, size }: PopupArrowProps): React.JSX.Element;
|
|
44
79
|
export interface PlassPickerShellProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children' | 'defaultValue'> {
|
|
45
80
|
/**
|
|
46
81
|
* Drop shadow depth of the *trigger*. `0`, like a `PlTextField`: a field is
|
|
@@ -49,8 +84,14 @@ export interface PlassPickerShellProps extends PlassStyleProps, Omit<React.Compo
|
|
|
49
84
|
* @default 0
|
|
50
85
|
*/
|
|
51
86
|
elevation?: PlassElevation;
|
|
52
|
-
/**
|
|
87
|
+
/** The name of what the control holds. */
|
|
53
88
|
label?: React.ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* Where the `label` goes — above the trigger, or in its top edge.
|
|
91
|
+
* Falls back to the nearest `PlassProvider`, then to `top`.
|
|
92
|
+
* @default 'top'
|
|
93
|
+
*/
|
|
94
|
+
labelPlacement?: PlassFieldLabelPlacement;
|
|
54
95
|
/** Helper text below it. */
|
|
55
96
|
description?: React.ReactNode;
|
|
56
97
|
/** Error message below. Its presence also turns the control invalid. */
|
|
@@ -88,11 +129,13 @@ interface InternalShellProps extends PlassPickerShellProps {
|
|
|
88
129
|
open: boolean;
|
|
89
130
|
onOpenChange: (open: boolean) => void;
|
|
90
131
|
labels: PlassPickerLabels;
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
132
|
+
/** The name the value submits under. */
|
|
133
|
+
name?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The value as a form submits it: one string, or one row per entry. An empty
|
|
136
|
+
* string, a list with an empty entry and an empty list are no value.
|
|
137
|
+
*/
|
|
138
|
+
formValue: string | readonly string[];
|
|
96
139
|
children: React.ReactNode;
|
|
97
140
|
triggerRef?: React.Ref<HTMLButtonElement>;
|
|
98
141
|
}
|
|
@@ -104,7 +147,7 @@ interface InternalShellProps extends PlassPickerShellProps {
|
|
|
104
147
|
* and the way `invalid` re-points the whole colour family at `danger` so the
|
|
105
148
|
* edge, the ring and the message turn over together.
|
|
106
149
|
*/
|
|
107
|
-
export declare function PickerShell({ variant, size, color, density, elevation, label, description, error, invalid, startIcon, fullWidth, disabled, readOnly, required, id, className, classNames, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels,
|
|
150
|
+
export declare function PickerShell({ variant, size, color, density, elevation, label, labelPlacement: labelPlacementProp, description, error, invalid, startIcon, fullWidth, disabled, readOnly, required, id, className, classNames, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels, name, formValue, children, triggerRef, ...props }: InternalShellProps): React.JSX.Element;
|
|
108
151
|
/**
|
|
109
152
|
* The row of shortcuts under a picker's panel.
|
|
110
153
|
*
|
package/dist/internal/picker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as s from"react";import{Field as
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as s from"react";import{Field as t}from"@base-ui/react/field";import{Popover as a}from"@base-ui/react/popover";import{FormControl as r,leaveFormControl as i}from"./form.js";import{glowPointerMove as o}from"./glow.js";import{CloseIcon as n}from"./icons.js";import{WidthSizer as d}from"./sizer.js";import{FieldNotch as p,notchShellStyle as c}from"./notch.js";import{useDefaults as m}from"./defaults.js";import{chipRemoveClasses as u,controlHeightClasses as f,controlTextLeadingClasses as h,cx as g,disabledClasses as x,fieldReadOnlyClasses as b,fieldRestClasses as v,focusWithinRingClasses as y,gapClasses as N,glassClasses as j,hasContent as w,iconClasses as P,metaTextClasses as k,paddingXClasses as $,radiusClasses as z,stackGapClasses as C,surfaceSlots as O,transitionClasses as B}from"./styles.js";export function popupSlots(e,l){return{...O(e,l),"--p-fill":`var(--plass-${e}-fill)`,"--p-on-solid":`var(--plass-${e}-on-solid)`}}const I=/* @__PURE__ */["group relative flex w-full items-center select-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",B,P].join(" "),R=y;export const pickerPopupClasses=/* @__PURE__ */[j,"border text-(--plass-fg) bg-(--plass-glass-press)","[border-color:var(--plass-glass-line)]","[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]","[outline:none]","[transition:opacity_var(--plass-duration)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export const popupPaddingClasses={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};const q=/* @__PURE__ */["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" ");export function PopupArrow({as:s,size:t}){return e(s,{className:q,children:l("svg",{width:t,height:t/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:[e("path",{d:"M0 0h10L5 5z",fill:"var(--plass-glass-press)"}),e("path",{d:"M0 0 5 5 10 0",fill:"none",stroke:"var(--plass-glass-line)",strokeWidth:"1",vectorEffect:"non-scaling-stroke"})]})})}export function PickerShell({variant:y="glass",size:j="md",color:P="primary",density:B="default",elevation:q=0,label:D,labelPlacement:E,description:F,error:M,invalid:S,startIcon:L,fullWidth:V=!1,disabled:W=!1,readOnly:_=!1,required:A=!1,id:T,className:G,classNames:H,style:J,display:K,samples:Q,empty:U,clearable:X=!1,onClear:Y,open:Z,onOpenChange:ee,labels:le,name:se,formValue:te,children:ae,triggerRef:re,...ie}){const oe=s.useId(),ne=T??`${oe}-trigger`,de=`${oe}-label`,pe=`${oe}-value`,ce=`${oe}-description`,me=`${oe}-error`,ue=m(),fe="notch"===(E??ue.labelPlacement??"top")&&w(D),he=null!=M&&!1!==M&&""!==M,ge=S??he,xe=ge?"danger":P,be=!W&&!_,ve=W||_,ye=s.useRef(null),Ne=e(t.Label,{id:de,htmlFor:ne,className:g(k[j],"font-semibold",W?"text-(--plass-muted-fg)":"text-(--plass-fg)",H?.label),children:D});return l(t.Root,{disabled:W,invalid:ge,className:g("flex-col align-top",C[j],V?"flex w-full":"inline-flex",G),style:{...O(xe,q),...J},...ie,children:[w(D)&&!fe?Ne:null,l(a.Root,{open:Z,onOpenChange:e=>ee(e),children:[e(p,{notched:fe,size:j,density:B,variant:y,disabled:W,readOnly:_,label:Ne,children:l("span",{style:fe?c:void 0,onPointerMove:o(be),className:g(I,fe?"":R,f[j],h[j],z[j],N[j],$[B][j],W?x[y]:_?b[y]:v[y],be?"plass-glow":"",H?.control),children:[e(t.Validity,{children:({validity:s})=>{const t=!1===s.valid,r=[F?ce:null,he||t&&!W&&!0!==S?me:null].filter(Boolean).join(" ")||void 0;return l(a.Trigger,{id:ne,ref:re,disabled:W,"aria-labelledby":D?`${de} ${pe}`:void 0,"aria-describedby":r,"aria-required":A||void 0,"aria-invalid":ge||t||void 0,onBlur:()=>{Z||i(ye.current)},className:g("flex min-w-0 flex-1 items-center bg-transparent text-start [font:inherit] text-inherit",N[j],"[outline:none]",ve?"cursor-default":"cursor-pointer"),children:[L?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)",children:L}):null,l("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{id:pe,className:g("w-full truncate",U?"text-(--plass-muted-fg)":"text-(--plass-fg)"),children:K}),V?null:e(d,{samples:Q??[]})]})]})}}),!X||U||ve?null:e("button",{type:"button","aria-label":le.clear,className:g(u,"text-(--plass-muted-fg)"),onClick:e=>{e.stopPropagation(),Y()},children:e(n,{})})]})}),e(a.Portal,{children:e(a.Positioner,{className:"plass-portal z-(--plass-z-portal) [outline:none]",sideOffset:6,align:"start",children:e(a.Popup,{initialFocus:!1,className:g(pickerPopupClasses,z[j],popupPaddingClasses[j],h[j]),style:popupSlots(xe,3),children:ae})})})]}),F?e(t.Description,{id:ce,className:g("m-0",k[j],"text-(--plass-muted-fg)",H?.description),children:F}):null,e(t.Error,he?{id:me,match:!0,className:g(k[j],"text-(--p-accent)",H?.error),children:M}:{id:me,className:g(k[j],"text-(--p-accent)",H?.error)}),e(r,{ref:ye,name:se,value:te,required:A&&!_,disabled:W,standIn:()=>ye.current?.ownerDocument.getElementById(ne)})]})}export function PickerFooter({size:l,children:s}){return e("div",{className:g("flex items-center justify-end border-t pt-1.5","[border-color:var(--plass-divider)]",N[l]),children:s})}export function PickerDivider(){return e("div",{"aria-hidden":"true",className:"w-px self-stretch bg-(--plass-divider)"})}
|
|
@@ -120,7 +120,13 @@ export declare const plateGapClasses: Record<PlassSize, string>;
|
|
|
120
120
|
* also why the movement is on `width` and never on the paint: a gradient cannot
|
|
121
121
|
* be transitioned, and a length can.
|
|
122
122
|
*/
|
|
123
|
-
export declare const trackClasses = "bg-(--plass-track)";
|
|
123
|
+
export declare const trackClasses = "bg-(--plass-track) forced-colors:border forced-colors:[border-color:CanvasText]";
|
|
124
|
+
/**
|
|
125
|
+
* The filled part of a track. Forced-colours mode drops the gradient and
|
|
126
|
+
* repaints the groove in the page's colour, so there the track gets an edge and
|
|
127
|
+
* the fill the system's highlight.
|
|
128
|
+
*/
|
|
129
|
+
export declare const fillClasses = "[background-image:var(--p-fill)] forced-colors:[background-color:Highlight] forced-colors:[border-color:Highlight] forced-colors:[color:HighlightText]";
|
|
124
130
|
/** The bar's own duration, one step slower than a control's, so a fill reads as travel. */
|
|
125
131
|
export declare const fillTransitionClasses = "[transition:width_var(--plass-duration-slow)_var(--plass-ease)]";
|
|
126
132
|
/**
|
|
@@ -134,13 +140,15 @@ export declare function progressFraction(value: number | null | undefined, min:
|
|
|
134
140
|
/**
|
|
135
141
|
* What the value reads as, both on screen and to a screen reader.
|
|
136
142
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
143
|
+
* Without `format` it is a percentage of the range rather than of 100 — "3%"
|
|
144
|
+
* for step 3 of 4 is worse than saying nothing — written in `locale`, so a page
|
|
145
|
+
* in German reads "75 %". Base UI's own default is that percentage too, but it
|
|
146
|
+
* reads a value that is not finite as indeterminate where `progressFraction`
|
|
147
|
+
* clamps it, so the percentage is written here from the fraction. A caller who
|
|
148
|
+
* passed `format` gets Base UI's formatted string, in the same `locale`, because
|
|
149
|
+
* at that point they have said what the number means.
|
|
142
150
|
*/
|
|
143
|
-
export declare function progressText(fraction: number | null, formatted: string | null, hasFormat: boolean): string | null;
|
|
151
|
+
export declare function progressText(fraction: number | null, formatted: string | null, hasFormat: boolean, locale: string | undefined): string | null;
|
|
144
152
|
/**
|
|
145
153
|
* The same string, shaped for Base UI's `getAriaValueText`.
|
|
146
154
|
*
|
|
@@ -148,4 +156,4 @@ export declare function progressText(fraction: number | null, formatted: string
|
|
|
148
156
|
* to Base UI — it already announces indeterminate progress, and re-inventing
|
|
149
157
|
* that here would be one more English string the library has to own.
|
|
150
158
|
*/
|
|
151
|
-
export declare function progressAriaText(fraction: number | null, hasFormat: boolean): ((formatted: string | null) => string) | undefined;
|
|
159
|
+
export declare function progressAriaText(fraction: number | null, hasFormat: boolean, locale: string | undefined): ((formatted: string | null) => string) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function progressSlots(s){return{"--p-fill":`var(--plass-${s}-fill)`,"--p-solid":`var(--plass-${s}-solid)`,"--p-solid-to":`var(--plass-${s}-solid-to)`,"--p-accent":`var(--plass-${s}-accent)`,"--p-soft":`var(--plass-${s}-soft)`,"--p-soft-press":`var(--plass-${s}-soft-press)`}}export const barThicknessClasses={xs:"h-1",sm:"h-1.5",md:"h-1.5",lg:"h-2",xl:"h-2.5"};export const ringDiameters={xs:14,sm:16,md:20,lg:26,xl:32};export const ringStrokes={xs:1.5,sm:1.75,md:2,lg:2.5,xl:3};export const plateSizeClasses={xs:"size-2",sm:"size-2.5",md:"size-3",lg:"size-4",xl:"size-5"};export const plateRadiusClasses={xs:"rounded-[0.1875rem]",sm:"rounded-[0.25rem]",md:"rounded-[0.28125rem]",lg:"rounded-[0.375rem]",xl:"rounded-[0.4375rem]"};export const plateGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const trackClasses
|
|
1
|
+
import{numberFormatter as s}from"./format.js";import{forcedFieldEdgeClasses as r,forcedFillClasses as e}from"./styles.js";export function progressSlots(s){return{"--p-fill":`var(--plass-${s}-fill)`,"--p-solid":`var(--plass-${s}-solid)`,"--p-solid-to":`var(--plass-${s}-solid-to)`,"--p-accent":`var(--plass-${s}-accent)`,"--p-soft":`var(--plass-${s}-soft)`,"--p-soft-press":`var(--plass-${s}-soft-press)`}}export const barThicknessClasses={xs:"h-1",sm:"h-1.5",md:"h-1.5",lg:"h-2",xl:"h-2.5"};export const ringDiameters={xs:14,sm:16,md:20,lg:26,xl:32};export const ringStrokes={xs:1.5,sm:1.75,md:2,lg:2.5,xl:3};export const plateSizeClasses={xs:"size-2",sm:"size-2.5",md:"size-3",lg:"size-4",xl:"size-5"};export const plateRadiusClasses={xs:"rounded-[0.1875rem]",sm:"rounded-[0.25rem]",md:"rounded-[0.28125rem]",lg:"rounded-[0.375rem]",xl:"rounded-[0.4375rem]"};export const plateGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const trackClasses=`bg-(--plass-track) ${r}`;export const fillClasses=`[background-image:var(--p-fill)] ${e}`;export const fillTransitionClasses="[transition:width_var(--plass-duration-slow)_var(--plass-ease)]";export function progressFraction(s,r,e){return null==s||Number.isNaN(s)||e<=r?null:Math.min(1,Math.max(0,(s-r)/(e-r)))}const t={style:"percent"};export function progressText(r,e,o,l){return null===r?null:o?e:s(l,t).format(r)}export function progressAriaText(s,r,e){if(null!==s)return t=>progressText(s,t,r,e)??""}
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
* of.
|
|
13
13
|
*
|
|
14
14
|
* `characters` overrides it for the caller who genuinely wants a terminal look.
|
|
15
|
+
*
|
|
16
|
+
* **A character is a grapheme**, what a reader counts as one: an emoji, a flag,
|
|
17
|
+
* a letter with its accent. Cut by code point instead, an emoji is halved into
|
|
18
|
+
* pieces that each draw as a broken glyph, and the noise flickers with them.
|
|
15
19
|
*/
|
|
16
20
|
/** Everything in the text that is worth scrambling: no spaces, no repeats. */
|
|
17
21
|
export declare function poolOf(text: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function poolOf(
|
|
1
|
+
import{graphemesOf as t}from"./text.js";export function poolOf(o){const n=new Set;for(const r of t(o))""!==r.trim()&&n.add(r);return Array.from(n).join("")}export function scrambleAt(o,n,r,e){const m=t(o),a=t(n),f=Math.floor(m.length*Math.max(0,Math.min(1,r)));return 0===a.length?o:m.map((t,o)=>o<f||""===t.trim()?t:a[(31*o+17*e)%a.length]).join("")}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/** What a component scrolls, or follows the scroll of. */
|
|
3
|
+
export type PlassScrollTarget = Window | HTMLElement | React.RefObject<HTMLElement | null> | (() => Window | HTMLElement | null);
|
|
4
|
+
/** What `target` names, or the window when it names nothing. */
|
|
5
|
+
export declare function resolveScrollTarget(target: PlassScrollTarget | undefined): Window | HTMLElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function resolveScrollTarget(n){return void 0===n?"undefined"==typeof window?null:window:"function"==typeof n?n():"current"in n?n.current:n}
|
package/dist/internal/steps.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const bulletSizeValues={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"};export const bulletGapClasses={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const bulletStatusClasses={complete
|
|
1
|
+
import{forcedFillClasses as e}from"./styles.js";export const bulletSizeValues={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"};export const bulletGapClasses={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const bulletStatusClasses={complete:`[background-image:var(--p-fill)] text-(--p-on-solid) ${e}`,current:`[background-image:var(--p-fill)] text-(--p-on-solid) [box-shadow:0_0_0_0.25rem_var(--p-soft)] ${e} forced-colors:[outline:2px_solid_Highlight] forced-colors:[outline-offset:2px]`,upcoming:"border-2 bg-(--plass-surface) text-(--plass-muted-fg) [border-color:var(--plass-border)]"};export const connectorColorClasses={complete:"[border-color:var(--p-line-hover)]",current:"[border-color:var(--plass-border)]",upcoming:"[border-color:var(--plass-border)]"};export const connectorStyleClasses={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",none:""};export const titleStatusClasses={complete:"text-(--plass-fg)",current:"text-(--p-accent)",upcoming:"text-(--plass-muted-fg)"};export function statusAt(e,o){return null===o?"upcoming":e<o?"complete":e===o?"current":"upcoming"}
|