material-plus-ui 0.0.1 → 1.0.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 +39 -28
- package/dist/components/accordion/MPAccordion.d.ts +115 -0
- package/dist/components/accordion/MPAccordion.js +1 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/alert/MPAlert.d.ts +91 -0
- package/dist/components/alert/MPAlert.js +1 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/aspect-ratio/MPAspectRatio.d.ts +69 -0
- package/dist/components/aspect-ratio/MPAspectRatio.js +1 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +1 -0
- package/dist/components/avatar/MPAvatar.d.ts +97 -0
- package/dist/components/avatar/MPAvatar.js +1 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/badge/MPBadge.d.ts +104 -0
- package/dist/components/badge/MPBadge.js +1 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/blockquote/MPBlockquote.d.ts +73 -0
- package/dist/components/blockquote/MPBlockquote.js +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/blockquote/index.js +1 -0
- package/dist/components/box/MPBox.d.ts +78 -0
- package/dist/components/box/MPBox.js +1 -0
- package/dist/components/box/index.d.ts +2 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/breadcrumb/MPBreadcrumb.d.ts +105 -0
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/MPButton.d.ts +70 -0
- package/dist/components/button/MPButton.js +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button-group/MPButtonGroup.d.ts +31 -0
- package/dist/components/button-group/MPButtonGroup.js +1 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card/MPCard.d.ts +73 -0
- package/dist/components/card/MPCard.js +1 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/carousel/MPCarousel.d.ts +116 -0
- package/dist/components/carousel/MPCarousel.js +1 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +1 -0
- package/dist/components/chat-bubble/MPChatBubble.d.ts +132 -0
- package/dist/components/chat-bubble/MPChatBubble.js +1 -0
- package/dist/components/chat-bubble/index.d.ts +2 -0
- package/dist/components/chat-bubble/index.js +1 -0
- package/dist/components/checkbox/MPCheckbox.d.ts +76 -0
- package/dist/components/checkbox/MPCheckbox.js +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/MPChip.d.ts +64 -0
- package/dist/components/chip/MPChip.js +1 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/collapsible/MPCollapsible.d.ts +97 -0
- package/dist/components/collapsible/MPCollapsible.js +1 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/color-picker/MPColorPicker.d.ts +113 -0
- package/dist/components/color-picker/MPColorPicker.js +1 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +1 -0
- package/dist/components/combobox/MPCombobox.d.ts +147 -0
- package/dist/components/combobox/MPCombobox.js +1 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/date-picker/MPDatePicker.d.ts +95 -0
- package/dist/components/date-picker/MPDatePicker.js +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/MPDateRangePicker.d.ts +98 -0
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/date-time-picker/MPDateTimePicker.d.ts +78 -0
- package/dist/components/date-time-picker/MPDateTimePicker.js +1 -0
- package/dist/components/date-time-picker/index.d.ts +2 -0
- package/dist/components/date-time-picker/index.js +1 -0
- package/dist/components/dialog/MPDialog.d.ts +145 -0
- package/dist/components/dialog/MPDialog.js +1 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/divider/MPDivider.d.ts +80 -0
- package/dist/components/divider/MPDivider.js +1 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/drawer/MPDrawer.d.ts +163 -0
- package/dist/components/drawer/MPDrawer.js +1 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/empty/MPEmpty.d.ts +64 -0
- package/dist/components/empty/MPEmpty.js +1 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/empty/index.js +1 -0
- package/dist/components/file-picker/MPFilePicker.d.ts +103 -0
- package/dist/components/file-picker/MPFilePicker.js +1 -0
- package/dist/components/file-picker/index.d.ts +2 -0
- package/dist/components/file-picker/index.js +1 -0
- package/dist/components/highlight/MPHighlight.d.ts +95 -0
- package/dist/components/highlight/MPHighlight.js +1 -0
- package/dist/components/highlight/index.d.ts +2 -0
- package/dist/components/highlight/index.js +1 -0
- package/dist/components/icon-button/MPIconButton.d.ts +59 -0
- package/dist/components/icon-button/MPIconButton.js +1 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/list/MPList.d.ts +96 -0
- package/dist/components/list/MPList.js +1 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/locale/MPLocaleProvider.d.ts +63 -0
- package/dist/components/locale/MPLocaleProvider.js +1 -0
- package/dist/components/locale/index.d.ts +2 -0
- package/dist/components/locale/index.js +1 -0
- package/dist/components/menu/MPMenu.d.ts +223 -0
- package/dist/components/menu/MPMenu.js +1 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/number-field/MPNumberField.d.ts +99 -0
- package/dist/components/number-field/MPNumberField.js +1 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/otp-field/MPOtpField.d.ts +89 -0
- package/dist/components/otp-field/MPOtpField.js +1 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +1 -0
- package/dist/components/overlay/MPOverlay.d.ts +96 -0
- package/dist/components/overlay/MPOverlay.js +1 -0
- package/dist/components/overlay/index.d.ts +2 -0
- package/dist/components/overlay/index.js +1 -0
- package/dist/components/panes/MPPanes.d.ts +100 -0
- package/dist/components/panes/MPPanes.js +1 -0
- package/dist/components/panes/index.d.ts +2 -0
- package/dist/components/panes/index.js +1 -0
- package/dist/components/pill/MPPill.d.ts +117 -0
- package/dist/components/pill/MPPill.js +1 -0
- package/dist/components/pill/index.d.ts +2 -0
- package/dist/components/pill/index.js +1 -0
- package/dist/components/popover/MPPopover.d.ts +138 -0
- package/dist/components/popover/MPPopover.js +1 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/progress-box/MPProgressBox.d.ts +40 -0
- package/dist/components/progress-box/MPProgressBox.js +1 -0
- package/dist/components/progress-box/index.d.ts +2 -0
- package/dist/components/progress-box/index.js +1 -0
- package/dist/components/progress-circular/MPProgressCircular.d.ts +32 -0
- package/dist/components/progress-circular/MPProgressCircular.js +1 -0
- package/dist/components/progress-circular/index.d.ts +2 -0
- package/dist/components/progress-circular/index.js +1 -0
- package/dist/components/progress-linear/MPProgressLinear.d.ts +32 -0
- package/dist/components/progress-linear/MPProgressLinear.js +1 -0
- package/dist/components/progress-linear/index.d.ts +2 -0
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/radio-group/MPRadioGroup.d.ts +81 -0
- package/dist/components/radio-group/MPRadioGroup.js +1 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/segmented-button/MPSegmentedButton.d.ts +75 -0
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -0
- package/dist/components/segmented-button/index.d.ts +2 -0
- package/dist/components/segmented-button/index.js +1 -0
- package/dist/components/select/MPSelect.d.ts +86 -0
- package/dist/components/select/MPSelect.js +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/shortcut/MPShortcut.d.ts +67 -0
- package/dist/components/shortcut/MPShortcut.js +1 -0
- package/dist/components/shortcut/index.d.ts +2 -0
- package/dist/components/shortcut/index.js +1 -0
- package/dist/components/skeleton/MPSkeleton.d.ts +76 -0
- package/dist/components/skeleton/MPSkeleton.js +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/slider/MPSlider.d.ts +77 -0
- package/dist/components/slider/MPSlider.js +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/snackbar/MPSnackbar.d.ts +170 -0
- package/dist/components/snackbar/MPSnackbar.js +1 -0
- package/dist/components/snackbar/index.d.ts +2 -0
- package/dist/components/snackbar/index.js +1 -0
- package/dist/components/spoiler/MPSpoiler.d.ts +106 -0
- package/dist/components/spoiler/MPSpoiler.js +1 -0
- package/dist/components/spoiler/index.d.ts +2 -0
- package/dist/components/spoiler/index.js +1 -0
- package/dist/components/switch/MPSwitch.d.ts +75 -0
- package/dist/components/switch/MPSwitch.js +1 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/MPTable.d.ts +107 -0
- package/dist/components/table/MPTable.js +1 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/text-field/MPTextField.d.ts +17 -18
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/text-link/MPTextLink.d.ts +88 -0
- package/dist/components/text-link/MPTextLink.js +1 -0
- package/dist/components/text-link/index.d.ts +2 -0
- package/dist/components/text-link/index.js +1 -0
- package/dist/components/time-picker/MPTimePicker.d.ts +108 -0
- package/dist/components/time-picker/MPTimePicker.js +1 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/timeline/MPTimeline.d.ts +96 -0
- package/dist/components/timeline/MPTimeline.js +1 -0
- package/dist/components/timeline/index.d.ts +2 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/tooltip/MPTooltip.d.ts +117 -0
- package/dist/components/tooltip/MPTooltip.js +1 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/typography/MPTypography.d.ts +94 -0
- package/dist/components/typography/MPTypography.js +1 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/constants/icons.d.ts +36 -0
- package/dist/constants/icons.js +1 -1
- package/dist/index.d.ts +55 -0
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.d.ts +118 -0
- package/dist/internal/Calendar.js +1 -0
- package/dist/internal/FieldOutline.d.ts +38 -0
- package/dist/internal/FieldOutline.js +1 -0
- package/dist/internal/Picker.d.ts +110 -0
- package/dist/internal/Picker.js +1 -0
- package/dist/internal/StateLayer.d.ts +45 -0
- package/dist/internal/StateLayer.js +1 -0
- package/dist/internal/SupportingText.d.ts +23 -0
- package/dist/internal/SupportingText.js +1 -0
- package/dist/internal/WidthSizer.d.ts +31 -0
- package/dist/internal/WidthSizer.js +1 -0
- package/dist/internal/accent.d.ts +39 -0
- package/dist/internal/accent.js +1 -0
- package/dist/internal/button-group.d.ts +21 -0
- package/dist/internal/button-group.js +1 -0
- package/dist/internal/color.d.ts +125 -0
- package/dist/internal/color.js +1 -0
- package/dist/internal/date.d.ts +179 -0
- package/dist/internal/date.js +1 -0
- package/dist/internal/i18n.d.ts +131 -0
- package/dist/internal/i18n.js +1 -0
- package/dist/internal/locale.d.ts +43 -0
- package/dist/internal/locale.js +1 -0
- package/dist/internal/menu.d.ts +23 -0
- package/dist/internal/menu.js +1 -0
- package/dist/internal/progress.d.ts +126 -0
- package/dist/internal/progress.js +1 -0
- package/dist/internal/scale.d.ts +127 -0
- package/dist/internal/scale.js +1 -0
- package/dist/internal/surface.d.ts +76 -0
- package/dist/internal/surface.js +1 -0
- package/dist/internal/visually-hidden.d.ts +23 -0
- package/dist/internal/visually-hidden.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1285 -20
- package/dist/types.d.ts +107 -16
- package/package.json +16 -21
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the library says on its own behalf.
|
|
3
|
+
*
|
|
4
|
+
* Almost nothing in Material Plus writes text a reader sees — a button says
|
|
5
|
+
* whatever it was handed, a dialog's title is the caller's. The exceptions are
|
|
6
|
+
* the strings a component has to invent because there is nowhere else for them
|
|
7
|
+
* to come from: the name on a calendar's back arrow, the word on the button that
|
|
8
|
+
* empties a picker, the label a screen reader hears for a column of minutes.
|
|
9
|
+
*
|
|
10
|
+
* Those are collected here rather than defaulted inside each component, because
|
|
11
|
+
* they are a *set*. A product in Korean does not want four pickers each
|
|
12
|
+
* defaulting to English and each needing eighteen override props; and the next
|
|
13
|
+
* component that needs a word should get it from the same place rather than
|
|
14
|
+
* starting a second table beside this one.
|
|
15
|
+
*
|
|
16
|
+
* What is *not* in here is anything `Intl` already knows. Month names, weekday
|
|
17
|
+
* names, AM/PM and number formats come from the platform, which speaks more
|
|
18
|
+
* languages than this file ever will — see `internal/date.ts`. This is only for
|
|
19
|
+
* the words the platform has no opinion about.
|
|
20
|
+
*
|
|
21
|
+
* Every component that reads this takes a `locale` and an override prop for the
|
|
22
|
+
* strings themselves, so an unsupported language is never a dead end: `locale`
|
|
23
|
+
* gets you a translation for free, `MPLocaleProvider` gets you one for the whole
|
|
24
|
+
* application at once, and the prop gets you one for anything else.
|
|
25
|
+
*
|
|
26
|
+
* Nothing here is exported from `src/index.ts` — the public surface is
|
|
27
|
+
* `MPLocaleProvider` and the per-component `labels` props.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* One namespace per component, rather than one flat list of keys.
|
|
31
|
+
*
|
|
32
|
+
* A namespace is what makes a partial translation possible: a locale supplies
|
|
33
|
+
* whatever it has and the rest falls back to English one namespace at a time, so
|
|
34
|
+
* adding a namespace here does not silently blank the strings in every language
|
|
35
|
+
* that has not caught up with it yet.
|
|
36
|
+
*/
|
|
37
|
+
export interface MPMessages {
|
|
38
|
+
/**
|
|
39
|
+
* The four pickers.
|
|
40
|
+
*
|
|
41
|
+
* One namespace for all of them rather than one each, because they are one
|
|
42
|
+
* vocabulary: a caller who has translated "Previous month" for the date picker
|
|
43
|
+
* has translated it for the range picker in the same breath, and the clock's
|
|
44
|
+
* column names are shared by two components outright.
|
|
45
|
+
*/
|
|
46
|
+
picker: {
|
|
47
|
+
/** The calendar's steppers, in day view. */
|
|
48
|
+
previousMonth: string;
|
|
49
|
+
nextMonth: string;
|
|
50
|
+
/** The same steppers in month view, where they move by a year. */
|
|
51
|
+
previousYear: string;
|
|
52
|
+
nextYear: string;
|
|
53
|
+
/** And in year view, where they move by a page of twelve. */
|
|
54
|
+
previousYears: string;
|
|
55
|
+
nextYears: string;
|
|
56
|
+
/** The two header buttons that open the month grid and the year grid. */
|
|
57
|
+
chooseMonth: string;
|
|
58
|
+
chooseYear: string;
|
|
59
|
+
/** The footer's actions. */
|
|
60
|
+
today: string;
|
|
61
|
+
now: string;
|
|
62
|
+
clear: string;
|
|
63
|
+
done: string;
|
|
64
|
+
/** The clock's columns, which are otherwise unlabelled lists of numbers. */
|
|
65
|
+
hour: string;
|
|
66
|
+
minute: string;
|
|
67
|
+
second: string;
|
|
68
|
+
meridiem: string;
|
|
69
|
+
/** Which end of a range the calendar is currently asking for. */
|
|
70
|
+
start: string;
|
|
71
|
+
end: string;
|
|
72
|
+
};
|
|
73
|
+
/** MPAlert. */
|
|
74
|
+
alert: {
|
|
75
|
+
/** The × in the corner, which has no text of its own. */
|
|
76
|
+
dismiss: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* MPChatBubble.
|
|
80
|
+
*
|
|
81
|
+
* Every string here is read out and never drawn: a delivery state is a mark
|
|
82
|
+
* on the bubble, and the word behind it is for the readers the mark says
|
|
83
|
+
* nothing to. That is exactly why they belong in this table rather than in a
|
|
84
|
+
* prop — a thread is a column of forty of these, and a caller who had to hand
|
|
85
|
+
* over five words per message would hand over the English ones.
|
|
86
|
+
*/
|
|
87
|
+
chat: {
|
|
88
|
+
/** On its way. */
|
|
89
|
+
sending: string;
|
|
90
|
+
/** It left. */
|
|
91
|
+
sent: string;
|
|
92
|
+
/** It arrived on their device. */
|
|
93
|
+
delivered: string;
|
|
94
|
+
/** They opened it. */
|
|
95
|
+
read: string;
|
|
96
|
+
/** It did not go — the one step that is not on the ladder. */
|
|
97
|
+
failed: string;
|
|
98
|
+
/** The three dots, which are a picture of somebody writing. */
|
|
99
|
+
typing: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* MPSpoiler.
|
|
103
|
+
*
|
|
104
|
+
* The one namespace whose strings are *drawn* rather than only announced —
|
|
105
|
+
* they are the words on the cover, and a cover written in a language the page
|
|
106
|
+
* is not in is a cover nobody reads.
|
|
107
|
+
*/
|
|
108
|
+
spoiler: {
|
|
109
|
+
/** The button that uncovers the content. */
|
|
110
|
+
reveal: string;
|
|
111
|
+
/** The button that covers it again, when the spoiler is reversible. */
|
|
112
|
+
hide: string;
|
|
113
|
+
/** The line above the button, saying why the content is covered. */
|
|
114
|
+
notice: string;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The strings for a locale, merged over English.
|
|
119
|
+
*
|
|
120
|
+
* `undefined` is English rather than the runtime's own locale, and that is
|
|
121
|
+
* deliberate: `navigator.language` differs between the server that renders the
|
|
122
|
+
* markup and the browser that hydrates it, and text that changes between those
|
|
123
|
+
* two is a hydration mismatch in the one part of the page a reader is looking
|
|
124
|
+
* at. A component that should follow the reader is *told* which language to
|
|
125
|
+
* follow — by its own `locale` prop, or by an `MPLocaleProvider` above it.
|
|
126
|
+
*
|
|
127
|
+
* Note that this is only about the words in the table. The dates themselves are
|
|
128
|
+
* formatted by `Intl` against the same tag, and `Intl` speaks every language the
|
|
129
|
+
* platform does whether or not there is an entry here.
|
|
130
|
+
*/
|
|
131
|
+
export declare function resolveMessages(locale?: string): MPMessages;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={picker:{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",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"},alert:{dismiss:"Dismiss"},chat:{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing"},spoiler:{reveal:"Reveal",hide:"Hide",notice:"Hidden so it is not read by accident"}},n={ko:{picker:{previousMonth:"이전 달",nextMonth:"다음 달",previousYear:"이전 해",nextYear:"다음 해",previousYears:"이전 연도 목록",nextYears:"다음 연도 목록",chooseMonth:"월 선택",chooseYear:"연도 선택",today:"오늘",now:"지금",clear:"지우기",done:"완료",hour:"시",minute:"분",second:"초",meridiem:"오전/오후",start:"시작",end:"종료"},alert:{dismiss:"닫기"},chat:{sending:"보내는 중",sent:"보냄",delivered:"전달됨",read:"읽음",failed:"전송 실패",typing:"입력 중"},spoiler:{reveal:"보기",hide:"가리기",notice:"실수로 읽지 않도록 가려 두었습니다"}},ja:{picker:{previousMonth:"前の月",nextMonth:"次の月",previousYear:"前の年",nextYear:"次の年",previousYears:"前の年の一覧",nextYears:"次の年の一覧",chooseMonth:"月を選択",chooseYear:"年を選択",today:"今日",now:"現在",clear:"クリア",done:"完了",hour:"時",minute:"分",second:"秒",meridiem:"午前/午後",start:"開始",end:"終了"},alert:{dismiss:"閉じる"},chat:{sending:"送信中",sent:"送信済み",delivered:"配信済み",read:"既読",failed:"送信できませんでした",typing:"入力中"},spoiler:{reveal:"表示する",hide:"隠す",notice:"うっかり読まないように隠してあります"}},"zh-hans":{picker:{previousMonth:"上个月",nextMonth:"下个月",previousYear:"上一年",nextYear:"下一年",previousYears:"上一页年份",nextYears:"下一页年份",chooseMonth:"选择月份",chooseYear:"选择年份",today:"今天",now:"此刻",clear:"清除",done:"完成",hour:"小时",minute:"分钟",second:"秒",meridiem:"上午/下午",start:"开始",end:"结束"},alert:{dismiss:"关闭"},chat:{sending:"发送中",sent:"已发送",delivered:"已送达",read:"已读",failed:"未发送",typing:"正在输入"},spoiler:{reveal:"显示",hide:"隐藏",notice:"已隐藏,以免不小心读到"}},"zh-hant":{picker:{previousMonth:"上個月",nextMonth:"下個月",previousYear:"上一年",nextYear:"下一年",previousYears:"上一頁年份",nextYears:"下一頁年份",chooseMonth:"選擇月份",chooseYear:"選擇年份",today:"今天",now:"此刻",clear:"清除",done:"完成",hour:"小時",minute:"分鐘",second:"秒",meridiem:"上午/下午",start:"開始",end:"結束"},alert:{dismiss:"關閉"},chat:{sending:"傳送中",sent:"已傳送",delivered:"已送達",read:"已讀",failed:"未傳送",typing:"正在輸入"},spoiler:{reveal:"顯示",hide:"隱藏",notice:"已隱藏,以免不小心讀到"}},es:{picker:{previousMonth:"Mes anterior",nextMonth:"Mes siguiente",previousYear:"Año anterior",nextYear:"Año siguiente",previousYears:"Años anteriores",nextYears:"Años siguientes",chooseMonth:"Elegir un mes",chooseYear:"Elegir un año",today:"Hoy",now:"Ahora",clear:"Borrar",done:"Listo",hour:"Hora",minute:"Minuto",second:"Segundo",meridiem:"a. m./p. m.",start:"Inicio",end:"Fin"},alert:{dismiss:"Cerrar"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregado",read:"Leído",failed:"No enviado",typing:"Escribiendo"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Oculto para que no se lea por accidente"}},pt:{picker:{previousMonth:"Mês anterior",nextMonth:"Próximo mês",previousYear:"Ano anterior",nextYear:"Próximo ano",previousYears:"Anos anteriores",nextYears:"Próximos anos",chooseMonth:"Escolher um mês",chooseYear:"Escolher um ano",today:"Hoje",now:"Agora",clear:"Limpar",done:"Concluído",hour:"Hora",minute:"Minuto",second:"Segundo",meridiem:"AM/PM",start:"Início",end:"Fim"},alert:{dismiss:"Fechar"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregue",read:"Lido",failed:"Não enviado",typing:"Digitando"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Oculto para não ser lido por acidente"}},fr:{picker:{previousMonth:"Mois précédent",nextMonth:"Mois suivant",previousYear:"Année précédente",nextYear:"Année suivante",previousYears:"Années précédentes",nextYears:"Années suivantes",chooseMonth:"Choisir un mois",chooseYear:"Choisir une année",today:"Aujourd'hui",now:"Maintenant",clear:"Effacer",done:"Terminé",hour:"Heure",minute:"Minute",second:"Seconde",meridiem:"AM/PM",start:"Début",end:"Fin"},alert:{dismiss:"Fermer"},chat:{sending:"Envoi en cours",sent:"Envoyé",delivered:"Distribué",read:"Lu",failed:"Non envoyé",typing:"En train d'écrire"},spoiler:{reveal:"Afficher",hide:"Masquer",notice:"Masqué pour ne pas être lu par accident"}},de:{picker:{previousMonth:"Voriger Monat",nextMonth:"Nächster Monat",previousYear:"Voriges Jahr",nextYear:"Nächstes Jahr",previousYears:"Vorige Jahre",nextYears:"Nächste Jahre",chooseMonth:"Monat auswählen",chooseYear:"Jahr auswählen",today:"Heute",now:"Jetzt",clear:"Löschen",done:"Fertig",hour:"Stunde",minute:"Minute",second:"Sekunde",meridiem:"AM/PM",start:"Beginn",end:"Ende"},alert:{dismiss:"Schließen"},chat:{sending:"Wird gesendet",sent:"Gesendet",delivered:"Zugestellt",read:"Gelesen",failed:"Nicht gesendet",typing:"Schreibt"},spoiler:{reveal:"Anzeigen",hide:"Verbergen",notice:"Verborgen, damit es nicht versehentlich gelesen wird"}},it:{picker:{previousMonth:"Mese precedente",nextMonth:"Mese successivo",previousYear:"Anno precedente",nextYear:"Anno successivo",previousYears:"Anni precedenti",nextYears:"Anni successivi",chooseMonth:"Scegli un mese",chooseYear:"Scegli un anno",today:"Oggi",now:"Adesso",clear:"Cancella",done:"Fatto",hour:"Ora",minute:"Minuto",second:"Secondo",meridiem:"AM/PM",start:"Inizio",end:"Fine"},alert:{dismiss:"Chiudi"},chat:{sending:"Invio in corso",sent:"Inviato",delivered:"Consegnato",read:"Letto",failed:"Non inviato",typing:"Sta scrivendo"},spoiler:{reveal:"Mostra",hide:"Nascondi",notice:"Nascosto per non essere letto per sbaglio"}},nl:{picker:{previousMonth:"Vorige maand",nextMonth:"Volgende maand",previousYear:"Vorig jaar",nextYear:"Volgend jaar",previousYears:"Vorige jaren",nextYears:"Volgende jaren",chooseMonth:"Kies een maand",chooseYear:"Kies een jaar",today:"Vandaag",now:"Nu",clear:"Wissen",done:"Klaar",hour:"Uur",minute:"Minuut",second:"Seconde",meridiem:"AM/PM",start:"Begin",end:"Einde"},alert:{dismiss:"Sluiten"},chat:{sending:"Verzenden",sent:"Verzonden",delivered:"Bezorgd",read:"Gelezen",failed:"Niet verzonden",typing:"Aan het typen"},spoiler:{reveal:"Tonen",hide:"Verbergen",notice:"Verborgen zodat het niet per ongeluk wordt gelezen"}},pl:{picker:{previousMonth:"Poprzedni miesiąc",nextMonth:"Następny miesiąc",previousYear:"Poprzedni rok",nextYear:"Następny rok",previousYears:"Poprzednie lata",nextYears:"Następne lata",chooseMonth:"Wybierz miesiąc",chooseYear:"Wybierz rok",today:"Dzisiaj",now:"Teraz",clear:"Wyczyść",done:"Gotowe",hour:"Godzina",minute:"Minuta",second:"Sekunda",meridiem:"AM/PM",start:"Początek",end:"Koniec"},alert:{dismiss:"Zamknij"},chat:{sending:"Wysyłanie",sent:"Wysłano",delivered:"Dostarczono",read:"Przeczytano",failed:"Nie wysłano",typing:"Pisze"},spoiler:{reveal:"Pokaż",hide:"Ukryj",notice:"Ukryte, aby nie przeczytać przez przypadek"}},ru:{picker:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYear:"Предыдущий год",nextYear:"Следующий год",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выбрать месяц",chooseYear:"Выбрать год",today:"Сегодня",now:"Сейчас",clear:"Очистить",done:"Готово",hour:"Часы",minute:"Минуты",second:"Секунды",meridiem:"ДП/ПП",start:"Начало",end:"Конец"},alert:{dismiss:"Закрыть"},chat:{sending:"Отправка",sent:"Отправлено",delivered:"Доставлено",read:"Прочитано",failed:"Не отправлено",typing:"Печатает"},spoiler:{reveal:"Показать",hide:"Скрыть",notice:"Скрыто, чтобы не прочитать случайно"}},tr:{picker:{previousMonth:"Önceki ay",nextMonth:"Sonraki ay",previousYear:"Önceki yıl",nextYear:"Sonraki yıl",previousYears:"Önceki yıllar",nextYears:"Sonraki yıllar",chooseMonth:"Ay seçin",chooseYear:"Yıl seçin",today:"Bugün",now:"Şimdi",clear:"Temizle",done:"Tamam",hour:"Saat",minute:"Dakika",second:"Saniye",meridiem:"ÖÖ/ÖS",start:"Başlangıç",end:"Bitiş"},alert:{dismiss:"Kapat"},chat:{sending:"Gönderiliyor",sent:"Gönderildi",delivered:"İletildi",read:"Okundu",failed:"Gönderilemedi",typing:"Yazıyor"},spoiler:{reveal:"Göster",hide:"Gizle",notice:"Yanlışlıkla okunmasın diye gizlendi"}},ar:{picker:{previousMonth:"الشهر السابق",nextMonth:"الشهر التالي",previousYear:"السنة السابقة",nextYear:"السنة التالية",previousYears:"السنوات السابقة",nextYears:"السنوات التالية",chooseMonth:"اختيار شهر",chooseYear:"اختيار سنة",today:"اليوم",now:"الآن",clear:"مسح",done:"تم",hour:"الساعة",minute:"الدقيقة",second:"الثانية",meridiem:"ص/م",start:"البداية",end:"النهاية"},alert:{dismiss:"إغلاق"},chat:{sending:"جارٍ الإرسال",sent:"تم الإرسال",delivered:"تم التسليم",read:"تمت القراءة",failed:"لم يتم الإرسال",typing:"يكتب الآن"},spoiler:{reveal:"إظهار",hide:"إخفاء",notice:"مخفي حتى لا يُقرأ بالخطأ"}},hi:{picker:{previousMonth:"पिछला महीना",nextMonth:"अगला महीना",previousYear:"पिछला वर्ष",nextYear:"अगला वर्ष",previousYears:"पिछले वर्ष",nextYears:"अगले वर्ष",chooseMonth:"महीना चुनें",chooseYear:"वर्ष चुनें",today:"आज",now:"अभी",clear:"हटाएँ",done:"हो गया",hour:"घंटा",minute:"मिनट",second:"सेकंड",meridiem:"AM/PM",start:"प्रारंभ",end:"समाप्ति"},alert:{dismiss:"बंद करें"},chat:{sending:"भेजा जा रहा है",sent:"भेजा गया",delivered:"पहुँच गया",read:"पढ़ लिया गया",failed:"नहीं भेजा गया",typing:"टाइप कर रहे हैं"},spoiler:{reveal:"दिखाएँ",hide:"छिपाएँ",notice:"गलती से न पढ़ लिया जाए इसलिए छिपाया गया है"}},id:{picker:{previousMonth:"Bulan sebelumnya",nextMonth:"Bulan berikutnya",previousYear:"Tahun sebelumnya",nextYear:"Tahun berikutnya",previousYears:"Tahun-tahun sebelumnya",nextYears:"Tahun-tahun berikutnya",chooseMonth:"Pilih bulan",chooseYear:"Pilih tahun",today:"Hari ini",now:"Sekarang",clear:"Hapus",done:"Selesai",hour:"Jam",minute:"Menit",second:"Detik",meridiem:"AM/PM",start:"Mulai",end:"Akhir"},alert:{dismiss:"Tutup"},chat:{sending:"Mengirim",sent:"Terkirim",delivered:"Diterima",read:"Dibaca",failed:"Gagal terkirim",typing:"Sedang mengetik"},spoiler:{reveal:"Tampilkan",hide:"Sembunyikan",notice:"Disembunyikan agar tidak terbaca tanpa sengaja"}},vi:{picker:{previousMonth:"Tháng trước",nextMonth:"Tháng sau",previousYear:"Năm trước",nextYear:"Năm sau",previousYears:"Các năm trước",nextYears:"Các năm sau",chooseMonth:"Chọn tháng",chooseYear:"Chọn năm",today:"Hôm nay",now:"Bây giờ",clear:"Xóa",done:"Xong",hour:"Giờ",minute:"Phút",second:"Giây",meridiem:"SA/CH",start:"Bắt đầu",end:"Kết thúc"},alert:{dismiss:"Đóng"},chat:{sending:"Đang gửi",sent:"Đã gửi",delivered:"Đã nhận",read:"Đã đọc",failed:"Chưa gửi được",typing:"Đang nhập"},spoiler:{reveal:"Hiện",hide:"Ẩn",notice:"Đã ẩn để không vô tình đọc phải"}},th:{picker:{previousMonth:"เดือนก่อนหน้า",nextMonth:"เดือนถัดไป",previousYear:"ปีก่อนหน้า",nextYear:"ปีถัดไป",previousYears:"ชุดปีก่อนหน้า",nextYears:"ชุดปีถัดไป",chooseMonth:"เลือกเดือน",chooseYear:"เลือกปี",today:"วันนี้",now:"ตอนนี้",clear:"ล้าง",done:"เสร็จสิ้น",hour:"ชั่วโมง",minute:"นาที",second:"วินาที",meridiem:"AM/PM",start:"เริ่ม",end:"สิ้นสุด"},alert:{dismiss:"ปิด"},chat:{sending:"กำลังส่ง",sent:"ส่งแล้ว",delivered:"ส่งถึงแล้ว",read:"อ่านแล้ว",failed:"ส่งไม่สำเร็จ",typing:"กำลังพิมพ์"},spoiler:{reveal:"แสดง",hide:"ซ่อน",notice:"ซ่อนไว้เพื่อไม่ให้อ่านโดยบังเอิญ"}}},r={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const i=new Map([["",e]]);export function resolveMessages(o){const a=o?.trim()??"",t=i.get(a);if(t)return t;const s=function(e){const n=e.toLowerCase().split(/[-_]/).filter(Boolean),r=n[0];if(!r)return[];const i=n.slice(1),o=i.find(e=>/^[a-z]{4}$/.test(e)),a=i.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[o?`${r}-${o}`:"",a?`${r}-${a}`:"",r].filter(Boolean)}(a).map(e=>n[e]??n[r[e]??""]).find(Boolean),d=s?{picker:{...e.picker,...s.picker},alert:{...e.alert,...s.alert},chat:{...e.chat,...s.chat},spoiler:{...e.spoiler,...s.spoiler}}:e;return i.set(a,d),d}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which language the components speak, and where that answer comes from.
|
|
3
|
+
*
|
|
4
|
+
* Two sources, in this order, and the order is the whole design:
|
|
5
|
+
*
|
|
6
|
+
* 1. **The component's own `locale` prop.** One control in a different language
|
|
7
|
+
* from the page around it is a real thing — an admin editing a Japanese
|
|
8
|
+
* listing from a Korean dashboard — and a component library that cannot draw
|
|
9
|
+
* it has decided the page's language on the caller's behalf.
|
|
10
|
+
* 2. **`MPLocaleProvider`, above it in the tree.** Which is what an application
|
|
11
|
+
* actually has: one language, set once, at the root.
|
|
12
|
+
*
|
|
13
|
+
* There is deliberately no third source. `navigator.language` is *not* consulted
|
|
14
|
+
* as a fallback, and that is not an oversight — see the note on
|
|
15
|
+
* `resolveMessages` in `internal/i18n.ts`. The runtime's own locale differs
|
|
16
|
+
* between the server that renders the markup and the browser that hydrates it,
|
|
17
|
+
* so reading it would put a hydration mismatch in the one part of the page a
|
|
18
|
+
* reader is looking at. `undefined` therefore means "the platform's default",
|
|
19
|
+
* which `Intl` resolves consistently in both places.
|
|
20
|
+
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { type MPMessages } from './i18n';
|
|
23
|
+
/**
|
|
24
|
+
* `undefined` rather than `'en'`, and the distinction matters.
|
|
25
|
+
*
|
|
26
|
+
* With no provider the pickers hand `undefined` to `Intl`, which formats dates
|
|
27
|
+
* in whatever the platform is set to — so a page that never mentions a locale
|
|
28
|
+
* still writes dates the way its reader expects. It is only the words in the
|
|
29
|
+
* table that fall back to English, because those are the ones the platform has
|
|
30
|
+
* no opinion about.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MPLocaleContext: React.Context<string | undefined>;
|
|
33
|
+
/** The locale in force here: the prop if there is one, otherwise the provider's. */
|
|
34
|
+
export declare function useMPLocale(locale?: string): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* A namespace's strings with a caller's overrides on top.
|
|
37
|
+
*
|
|
38
|
+
* The overrides win over the translation, which wins over English. That order is
|
|
39
|
+
* what makes an unsupported language a partial answer rather than a dead end: a
|
|
40
|
+
* caller supplies the handful of words they care about and everything else is
|
|
41
|
+
* still translated, or still English, rather than blank.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useMPMessages<Namespace extends keyof MPMessages>(namespace: Namespace, locale: string | undefined, overrides?: Partial<MPMessages[Namespace]>): MPMessages[Namespace];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{resolveMessages as t}from"./i18n";export const MPLocaleContext=e.createContext(void 0);export function useMPLocale(t){const o=e.useContext(MPLocaleContext);return t??o}export function useMPMessages(o,n,r){return e.useMemo(()=>{const e=t(n)[o];return r?{...e,...r}:e},[o,n,r])}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a menu row inherits from the menu around it.
|
|
3
|
+
*
|
|
4
|
+
* The same arrangement `MPButtonGroup` uses, and for the same reason: `size` and
|
|
5
|
+
* `color` are properties of the *menu*, not of any one row in it, and passing
|
|
6
|
+
* them per row would be two chances per row to get one wrong — with a silent
|
|
7
|
+
* failure, a menu whose fourth item is a size bigger than the three above it.
|
|
8
|
+
*
|
|
9
|
+
* It lives in `internal/` rather than in `MPMenu.tsx` because a submenu is a menu
|
|
10
|
+
* inside a menu and a context menu is the same rows hung off a right-click, so
|
|
11
|
+
* three components read this and none of them should have to import the others.
|
|
12
|
+
*
|
|
13
|
+
* Unlike the button group's context this one is never `null`: a row rendered
|
|
14
|
+
* outside a menu is a bug Base UI will report first, and defaulting here keeps
|
|
15
|
+
* every row from having to answer "what if there is no menu".
|
|
16
|
+
*/
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
import type { MPColor, MPSize } from '../types';
|
|
19
|
+
export interface MPMenuContextValue {
|
|
20
|
+
size: MPSize;
|
|
21
|
+
color: MPColor;
|
|
22
|
+
}
|
|
23
|
+
export declare const MPMenuContext: React.Context<MPMenuContextValue>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";export const MPMenuContext=t.createContext({size:"md",color:"primary"});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the three progress indicators share.
|
|
3
|
+
*
|
|
4
|
+
* `MPProgressLinear`, `MPProgressCircular` and `MPProgressBox` are three shapes
|
|
5
|
+
* answering one question — how far along is this, and is it moving at all — so
|
|
6
|
+
* everything that is *not* the shape lives here: the props, the ladders and the
|
|
7
|
+
* arithmetic that turns `value`/`min`/`max` into a fraction.
|
|
8
|
+
*
|
|
9
|
+
* The shapes themselves are all that is left in each component, which is the
|
|
10
|
+
* point: they are the only thing that genuinely differs. A `value` of `null` has
|
|
11
|
+
* to mean the same thing on a bar, a ring and a row of segments, or the trio is
|
|
12
|
+
* three components that happen to share a prefix.
|
|
13
|
+
*
|
|
14
|
+
* Every class string here is a literal, for the reason `scale.ts` gives:
|
|
15
|
+
* Tailwind finds classes by scanning source text, so an interpolated `h-${n}`
|
|
16
|
+
* generates no rule at all.
|
|
17
|
+
*/
|
|
18
|
+
import type * as React from 'react';
|
|
19
|
+
import type { MPSize } from '../types';
|
|
20
|
+
/**
|
|
21
|
+
* The props all three indicators take.
|
|
22
|
+
*
|
|
23
|
+
* Declared once and extended rather than copied three times. `color` and `size`
|
|
24
|
+
* are deliberately *not* here — they are on `MPStyleProps` for every other
|
|
25
|
+
* component and each indicator documents what its own `size` means, which is a
|
|
26
|
+
* different quantity on a bar (thickness), a ring (diameter) and a row of
|
|
27
|
+
* segments (one segment).
|
|
28
|
+
*/
|
|
29
|
+
export interface MPProgressProps {
|
|
30
|
+
/**
|
|
31
|
+
* How far along, between `min` and `max`.
|
|
32
|
+
*
|
|
33
|
+
* `null` — the default — is the indeterminate case: something is happening and
|
|
34
|
+
* nobody knows how much of it is left. That is the default on purpose. An
|
|
35
|
+
* indicator that has not been told a value should say so rather than draw an
|
|
36
|
+
* empty track, which is a claim that no progress has been made.
|
|
37
|
+
* @default null
|
|
38
|
+
*/
|
|
39
|
+
value?: number | null;
|
|
40
|
+
/** @default 0 */
|
|
41
|
+
min?: number;
|
|
42
|
+
/** @default 100 */
|
|
43
|
+
max?: number;
|
|
44
|
+
/** A name for what is loading. Read out with the value by a screen reader. */
|
|
45
|
+
label?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Shows the value as text beside the shape. A percentage of the range unless
|
|
48
|
+
* `format` says otherwise.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
showValue?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* How the value is written when it is shown — `Intl.NumberFormat` options, so
|
|
54
|
+
* bytes and currencies work as well as plain numbers. Without it the value is
|
|
55
|
+
* a percentage of `min`…`max`, which is the only formatting that holds for a
|
|
56
|
+
* range nobody described.
|
|
57
|
+
*/
|
|
58
|
+
format?: Intl.NumberFormatOptions;
|
|
59
|
+
className?: string;
|
|
60
|
+
style?: React.CSSProperties;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* How thick the linear track is.
|
|
64
|
+
*
|
|
65
|
+
* Its own ladder rather than a step off `CONTROL_HEIGHT`: a bar is not a control
|
|
66
|
+
* with a label inside it. `md` is MD3's own 4dp, and the ladder is centred on it
|
|
67
|
+
* the same way every other one is centred on its spec value.
|
|
68
|
+
*/
|
|
69
|
+
export declare const BAR_THICKNESS: Record<MPSize, string>;
|
|
70
|
+
/**
|
|
71
|
+
* The diameter of the ring, in CSS pixels.
|
|
72
|
+
*
|
|
73
|
+
* Numbers rather than classes because the same value has to reach the SVG's
|
|
74
|
+
* `viewBox` arithmetic, and a ring is one of the few things in this library that
|
|
75
|
+
* a Tailwind class cannot describe on its own.
|
|
76
|
+
*
|
|
77
|
+
* `md` is MD3's own 48dp, and every rung sits inside the control height at the
|
|
78
|
+
* same step — a 48px ring inside a 56px field — so a spinner dropped into a
|
|
79
|
+
* button, a field or a table row never makes the row taller than it was.
|
|
80
|
+
*/
|
|
81
|
+
export declare const RING_DIAMETER: Record<MPSize, number>;
|
|
82
|
+
/** The ring's stroke, MD3's 4dp at `md`, thickening so the hole stays in proportion. */
|
|
83
|
+
export declare const RING_STROKE: Record<MPSize, number>;
|
|
84
|
+
/** One segment of an `MPProgressBox`. An indicator, so its own ladder again. */
|
|
85
|
+
export declare const SEGMENT_SIZE: Record<MPSize, string>;
|
|
86
|
+
/**
|
|
87
|
+
* The corner cut off a segment.
|
|
88
|
+
*
|
|
89
|
+
* `corner-extra-small` from `md` up, which is the spec's smallest corner and the
|
|
90
|
+
* right one for a tile this size. The two rungs below it cap it, because 4px on
|
|
91
|
+
* an 8px box is not a cut corner — it is a circle.
|
|
92
|
+
*
|
|
93
|
+
* A cap rather than the literal 3px it used to be, so the tiles still follow the
|
|
94
|
+
* token in the one direction the cap does not block: under a squarer theme these
|
|
95
|
+
* go square with everything else, and under a rounder one they hold at 3px,
|
|
96
|
+
* which is the whole point of capping them.
|
|
97
|
+
*/
|
|
98
|
+
export declare const SEGMENT_RADIUS: Record<MPSize, string>;
|
|
99
|
+
/** Between the segments. Tight — they are one object, not a row of squares. */
|
|
100
|
+
export declare const SEGMENT_GAP: Record<MPSize, string>;
|
|
101
|
+
/**
|
|
102
|
+
* `value` as a fraction of the range, or `null` when there is nothing to say.
|
|
103
|
+
*
|
|
104
|
+
* The clamp is not defensive programming for its own sake — `value` usually
|
|
105
|
+
* arrives from a division somewhere, and a bar that renders 140% wide because
|
|
106
|
+
* one request finished twice is a worse bug than a bar that sits full.
|
|
107
|
+
*/
|
|
108
|
+
export declare function progressFraction(value: number | null | undefined, min: number, max: number): number | null;
|
|
109
|
+
/**
|
|
110
|
+
* What the value reads as, both on screen and to a screen reader.
|
|
111
|
+
*
|
|
112
|
+
* Base UI's own default is `${value}%`, which is right only when the range
|
|
113
|
+
* happens to be 0–100 — "3%" for step 3 of 4 is worse than saying nothing. So
|
|
114
|
+
* the percentage is computed from the fraction, and a caller who passed `format`
|
|
115
|
+
* gets Base UI's formatted string instead, because at that point they have said
|
|
116
|
+
* what the number means.
|
|
117
|
+
*/
|
|
118
|
+
export declare function progressText(fraction: number | null, formatted: string | null, hasFormat: boolean): string | null;
|
|
119
|
+
/**
|
|
120
|
+
* The same string, shaped for Base UI's `getAriaValueText`.
|
|
121
|
+
*
|
|
122
|
+
* `undefined` when there is no value, which hands the indeterminate case back to
|
|
123
|
+
* Base UI — it already announces indeterminate progress, and re-inventing that
|
|
124
|
+
* here would be one more English string the library has to own.
|
|
125
|
+
*/
|
|
126
|
+
export declare function progressAriaText(fraction: number | null, hasFormat: boolean): ((formatted: string | null) => string) | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const BAR_THICKNESS={xs:"h-0.5",sm:"h-[3px]",md:"h-1",lg:"h-1.5",xl:"h-2"};export const RING_DIAMETER={xs:24,sm:32,md:48,lg:56,xl:64};export const RING_STROKE={xs:2.5,sm:3,md:4,lg:4.5,xl:5};export const SEGMENT_SIZE={xs:"size-2",sm:"size-2.5",md:"size-3",lg:"size-4",xl:"size-5"};export const SEGMENT_RADIUS={xs:"rounded-[min(var(--mp-sys-shape-corner-extra-small),3px)]",sm:"rounded-[min(var(--mp-sys-shape-corner-extra-small),3px)]",md:"rounded-mp-xs",lg:"rounded-mp-xs",xl:"rounded-mp-sm"};export const SEGMENT_GAP={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};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)))}export function progressText(s,r,e){return null===s?null:e?r:`${Math.round(100*s)}%`}export function progressAriaText(s,r){if(null!==s)return e=>progressText(s,e,r)??""}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The size ladder, once.
|
|
3
|
+
*
|
|
4
|
+
* `MPSize` promises that a rung means the same thing on every control — see
|
|
5
|
+
* `docs/{locale}/design/prop-conventions.md` — and a promise kept by twelve
|
|
6
|
+
* separate tables is a promise that gets broken the first time one of them is
|
|
7
|
+
* edited alone. So the heights, the type roles and the spacing that follow from
|
|
8
|
+
* them live here, and a component picks the rows it needs.
|
|
9
|
+
*
|
|
10
|
+
* ## Why they are written out rather than computed
|
|
11
|
+
*
|
|
12
|
+
* Every value below is a literal class string, and it has to be: Tailwind finds
|
|
13
|
+
* classes by scanning source text, so an interpolated `h-${n}` generates no rule
|
|
14
|
+
* at all. That is also why this file is scanned — `@source '.'` in `styles.css`
|
|
15
|
+
* covers the whole compiled library, this module included.
|
|
16
|
+
*
|
|
17
|
+
* ## What is *not* here
|
|
18
|
+
*
|
|
19
|
+
* Anything one component decides on its own. A switch's track is not on the
|
|
20
|
+
* ladder because it is not a control height — it is a track a thumb runs along,
|
|
21
|
+
* sized by the thumb. A checkbox's tick is not either. Those tables stay in the
|
|
22
|
+
* component that owns them, next to the reasoning for their numbers.
|
|
23
|
+
*/
|
|
24
|
+
import type { MPSize } from '../types';
|
|
25
|
+
/**
|
|
26
|
+
* The control heights, and the ladder every other table here is derived from.
|
|
27
|
+
*
|
|
28
|
+
* 32 / 40 / 56 / 64 / 72, with `md` at Material's own 56 — the same rungs
|
|
29
|
+
* `MPTextField` is drawn at, so a button, a select and a field in one form row
|
|
30
|
+
* line up. The first three are also MD3's own extra-small, small and medium
|
|
31
|
+
* button heights; `lg` and `xl` are this library's, because the spec's are 96
|
|
32
|
+
* and 136 and a 96px button beside a 64px field is not a row.
|
|
33
|
+
*/
|
|
34
|
+
export declare const CONTROL_HEIGHT: Record<MPSize, string>;
|
|
35
|
+
/** The same numbers as a square, for a control with no label to pad against. */
|
|
36
|
+
export declare const CONTROL_SQUARE: Record<MPSize, string>;
|
|
37
|
+
/**
|
|
38
|
+
* What a control's own text is set in.
|
|
39
|
+
*
|
|
40
|
+
* `label-large` at the bottom two rungs and `title-medium` from `md` up, which
|
|
41
|
+
* is the pair MD3 puts on its small and medium buttons. A smaller control moves
|
|
42
|
+
* *down the Material type scale* rather than to an interpolated size of the
|
|
43
|
+
* library's own — the same rule the text field follows into `body-medium`.
|
|
44
|
+
*/
|
|
45
|
+
export declare const CONTROL_TEXT: Record<MPSize, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Inline padding on a control with a label in it.
|
|
48
|
+
*
|
|
49
|
+
* MD3's own 12 / 16 / 24 for the first three rungs, continued at the same pace.
|
|
50
|
+
* A button's padding grows faster than its height on purpose: the label is what
|
|
51
|
+
* a pill is drawn around, so a taller button that kept 24px of padding would
|
|
52
|
+
* come out looking squeezed.
|
|
53
|
+
*/
|
|
54
|
+
export declare const CONTROL_PAD_X: Record<MPSize, string>;
|
|
55
|
+
/** The gap between a control's icon and its label. */
|
|
56
|
+
export declare const CONTROL_GAP: Record<MPSize, string>;
|
|
57
|
+
/**
|
|
58
|
+
* The glyph a control draws beside its label, in CSS pixels.
|
|
59
|
+
*
|
|
60
|
+
* A number rather than a class because `MPIcon` takes a length — it is the one
|
|
61
|
+
* component that is not on the ladder, for the reason given in the prop
|
|
62
|
+
* conventions: an icon has no height of its own to pick from a scale.
|
|
63
|
+
*/
|
|
64
|
+
export declare const CONTROL_ICON: Record<MPSize, number>;
|
|
65
|
+
/**
|
|
66
|
+
* What text *beside* a control is set in — a checkbox's label, a radio's.
|
|
67
|
+
*
|
|
68
|
+
* The body scale rather than the label scale, and the same two roles a text
|
|
69
|
+
* field's own input takes. A checkbox's label is prose that happens to sit next
|
|
70
|
+
* to a control; a button's label is part of one. Setting the first in
|
|
71
|
+
* `title-medium` at 500 would make a list of options read as a list of headings.
|
|
72
|
+
*/
|
|
73
|
+
export declare const PROSE_TEXT: Record<MPSize, string>;
|
|
74
|
+
/**
|
|
75
|
+
* Supporting text: a label above a control, a description or an error under it.
|
|
76
|
+
*
|
|
77
|
+
* `body-small` at every rung, deliberately. Supporting text is prose about the
|
|
78
|
+
* control rather than part of it, and prose that shrank with the control would
|
|
79
|
+
* be unreadable at `xs` — where it is needed most, because that is the density a
|
|
80
|
+
* form gets cramped at.
|
|
81
|
+
*/
|
|
82
|
+
export declare const META_TEXT = "text-mp-body-small";
|
|
83
|
+
/**
|
|
84
|
+
* The room inside a sheet.
|
|
85
|
+
*
|
|
86
|
+
* `md` is 16px, which is MD3's own card padding, and the ladder is centred on it
|
|
87
|
+
* the same way the control heights are centred on 56. The steps are 4px apart at
|
|
88
|
+
* the bottom and widen at the top, because the difference between 20 and 24 is
|
|
89
|
+
* the difference between "roomy" and "spacious" while 8 and 10 are both "tight".
|
|
90
|
+
*/
|
|
91
|
+
export declare const SHEET_PAD: Record<MPSize, string>;
|
|
92
|
+
/** The same track sideways only, for a sheet that sets its own vertical room. */
|
|
93
|
+
export declare const SHEET_PAD_X: Record<MPSize, string>;
|
|
94
|
+
/**
|
|
95
|
+
* And the other axis, for the sheet that is built out of stacked sections.
|
|
96
|
+
*
|
|
97
|
+
* A card, a drawer and a collapsible all make the same trade: without dividers
|
|
98
|
+
* the *sheet* carries the vertical room and each section carries only the
|
|
99
|
+
* horizontal, so the gaps between sections belong to the sheet; with them each
|
|
100
|
+
* section carries both, so a hairline can reach the sheet's edges. That needs
|
|
101
|
+
* the two axes separately, and it needs them written out — Tailwind finds
|
|
102
|
+
* classes by scanning source text, so a `p-4` turned into a `py-4` at runtime
|
|
103
|
+
* generates no rule at all and the padding simply would not exist.
|
|
104
|
+
*/
|
|
105
|
+
export declare const SHEET_PAD_Y: Record<MPSize, string>;
|
|
106
|
+
/**
|
|
107
|
+
* A sheet's heading.
|
|
108
|
+
*
|
|
109
|
+
* The `title` roles rather than the `headline` ones: a headline is what a page
|
|
110
|
+
* is about, and a list row's first line is not. `md` lands on `title-medium`,
|
|
111
|
+
* which is `body-large` at weight 500 — exactly the relationship MD3 draws
|
|
112
|
+
* between a list item's headline and its supporting text.
|
|
113
|
+
*/
|
|
114
|
+
export declare const SHEET_TITLE: Record<MPSize, string>;
|
|
115
|
+
/** Between a sheet's stacked parts — a heading and the paragraph under it. */
|
|
116
|
+
export declare const SHEET_GAP: Record<MPSize, string>;
|
|
117
|
+
/** The gap between a control and the text stacked above or below it. */
|
|
118
|
+
export declare const STACK_GAP: Record<MPSize, string>;
|
|
119
|
+
/**
|
|
120
|
+
* Whether a slot was given something worth drawing a wrapper around.
|
|
121
|
+
*
|
|
122
|
+
* `false` and `null` both mean "nothing here" in JSX — they are what a
|
|
123
|
+
* `condition && <Icon />` leaves behind — and an empty string is a caller
|
|
124
|
+
* clearing a default. Testing for `undefined` alone would draw a padded, gapped
|
|
125
|
+
* box around each of them.
|
|
126
|
+
*/
|
|
127
|
+
export declare function hasContent(node: unknown): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CONTROL_HEIGHT={xs:"h-8",sm:"h-10",md:"h-14",lg:"h-16",xl:"h-18"};export const CONTROL_SQUARE={xs:"size-8",sm:"size-10",md:"size-14",lg:"size-16",xl:"size-18"};export const CONTROL_TEXT={xs:"text-mp-label-large",sm:"text-mp-label-large",md:"text-mp-title-medium",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};export const CONTROL_PAD_X={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-8",xl:"px-10"};export const CONTROL_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-2",lg:"gap-2.5",xl:"gap-3"};export const CONTROL_ICON={xs:16,sm:18,md:20,lg:22,xl:24};export const PROSE_TEXT={xs:"text-mp-body-medium",sm:"text-mp-body-medium",md:"text-mp-body-large",lg:"text-mp-body-large",xl:"text-mp-body-large"};export const META_TEXT="text-mp-body-small";export const SHEET_PAD={xs:"p-2.5",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"};export const SHEET_PAD_X={xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"};export const SHEET_PAD_Y={xs:"py-2.5",sm:"py-3",md:"py-4",lg:"py-5",xl:"py-6"};export const SHEET_TITLE={xs:"text-mp-title-small",sm:"text-mp-title-small",md:"text-mp-title-medium",lg:"text-mp-title-large",xl:"text-mp-headline-small"};export const SHEET_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const STACK_GAP={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export function hasContent(t){return null!=t&&!1!==t&&""!==t}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The surfaces, and the two questions they answer.
|
|
3
|
+
*
|
|
4
|
+
* The first is what everything that floats above the page has in common. Eight
|
|
5
|
+
* components portal something to the end of `<body>` — the dialog, the drawer,
|
|
6
|
+
* the overlay, the menu, the popover, the snackbar, the combobox's list and the
|
|
7
|
+
* colour picker's panel — and the three strings below are the parts of that
|
|
8
|
+
* which must not differ between them. A dialog opened over an overlay would
|
|
9
|
+
* otherwise show a seam where two scrims of slightly different alpha overlap,
|
|
10
|
+
* and a menu that faded on a different curve from the dialog it was opened
|
|
11
|
+
* inside would read as two libraries.
|
|
12
|
+
*
|
|
13
|
+
* The second is what a *container* paints itself at, which is the last section
|
|
14
|
+
* of the file.
|
|
15
|
+
*/
|
|
16
|
+
import type { MPVariant } from '../types';
|
|
17
|
+
/**
|
|
18
|
+
* The positioner every portalled popup wears.
|
|
19
|
+
*
|
|
20
|
+
* `mp-portal` is a hook, not a style. A portalled element leaves the subtree a
|
|
21
|
+
* host may have scoped its CSS reset to, so the class is there for that host to
|
|
22
|
+
* hang the same reset off — this library never styles it.
|
|
23
|
+
*
|
|
24
|
+
* `z-50` is Tailwind's top stacking step and is shared by every popup here, so
|
|
25
|
+
* the order two open popups stack in is the order they were opened in rather
|
|
26
|
+
* than a number somebody picked.
|
|
27
|
+
*/
|
|
28
|
+
export declare const PORTAL_LAYER = "mp-portal z-50 outline-none";
|
|
29
|
+
/**
|
|
30
|
+
* The scrim: MD3's own `scrim` role at 32%.
|
|
31
|
+
*
|
|
32
|
+
* The alpha lives here rather than in the token because 32% is what the
|
|
33
|
+
* *component* draws it at — the role itself is a colour, and a page that themes
|
|
34
|
+
* `--mp-sys-color-scrim` should not have to restate an opacity to do it.
|
|
35
|
+
*
|
|
36
|
+
* The 2px blur is not a frost. It is enough to take the edge off text directly
|
|
37
|
+
* under the sheet without turning the page into a smear, which is the difference
|
|
38
|
+
* between "you cannot use this right now" and "this is gone".
|
|
39
|
+
*/
|
|
40
|
+
export declare const SCRIM = "bg-mp-scrim/32 [backdrop-filter:blur(2px)]";
|
|
41
|
+
/**
|
|
42
|
+
* Opacity, and only opacity.
|
|
43
|
+
*
|
|
44
|
+
* Everything that uses this is a box full of text. A surface that scales or
|
|
45
|
+
* slides on the way in drags its own sentence across the screen while the reader
|
|
46
|
+
* is already looking at it, and a menu that slides has moved the row the pointer
|
|
47
|
+
* was already reaching for.
|
|
48
|
+
*/
|
|
49
|
+
export declare const FADE: string;
|
|
50
|
+
/**
|
|
51
|
+
* The five weights, said the way a **container** says them.
|
|
52
|
+
*
|
|
53
|
+
* This is the other half of the library's `variant` vocabulary, and the half
|
|
54
|
+
* that is easy to get wrong. On a component that *is* the thing being coloured —
|
|
55
|
+
* a button, a chip, an alert — `filled` is the accent under its own ink. On a
|
|
56
|
+
* component that is a box holding **somebody else's** content it cannot be:
|
|
57
|
+
* dyeing the box dyes their content's background, and every link, field and
|
|
58
|
+
* button they put inside it would then need an on-accent treatment of its own.
|
|
59
|
+
*
|
|
60
|
+
* So a container's ladder runs up the neutral surface roles instead, and
|
|
61
|
+
* `filled` is the loudest one it is allowed — MD3's `surface-container-highest`,
|
|
62
|
+
* which is also the specification's own *filled card*. `elevated` and `outlined`
|
|
63
|
+
* are MD3's other two card variants to the letter: `surface-container-low` under
|
|
64
|
+
* a level-1 shadow, and a hairline in `outline-variant`. `text` paints nothing
|
|
65
|
+
* at all, which is what a container nested inside another container wants.
|
|
66
|
+
*
|
|
67
|
+
* The ink is deliberately **not** here. Most callers want `text-mp-on-surface`
|
|
68
|
+
* and say so once beside this, but a table sets the ink per cell and a carousel
|
|
69
|
+
* has none of its own, and a ladder that decided for them would be a ladder they
|
|
70
|
+
* had to undo.
|
|
71
|
+
*
|
|
72
|
+
* It lives in `internal/` for the reason `scale.ts` gives about the size ladder:
|
|
73
|
+
* nine components read it, and a promise kept by nine separate tables is a
|
|
74
|
+
* promise that gets broken the first time one of them is edited alone.
|
|
75
|
+
*/
|
|
76
|
+
export declare const CONTAINER_SURFACE: Record<MPVariant, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PORTAL_LAYER="mp-portal z-50 outline-none";export const SCRIM="bg-mp-scrim/32 [backdrop-filter:blur(2px)]";export const FADE=["transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" ");export const CONTAINER_SURFACE={filled:"bg-mp-surface-container-highest",tonal:"bg-mp-surface-container",elevated:"shadow-mp-1 bg-mp-surface-container-low",outlined:"border-mp-outline-variant border bg-transparent",text:"bg-transparent"};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text for a screen reader and nobody else.
|
|
3
|
+
*
|
|
4
|
+
* The sentence behind a bare number on a badge, the "opens in a new tab" after a
|
|
5
|
+
* link's label, the name an avatar's initials are standing in for, the direction
|
|
6
|
+
* a sorted column is sorted in. In every one of those the visible mark is
|
|
7
|
+
* shorthand a reader who can see it expands instantly and a reader who cannot
|
|
8
|
+
* gets nothing from at all.
|
|
9
|
+
*
|
|
10
|
+
* Not `hidden`, not `display: none` and not `opacity: 0` — the first two take the
|
|
11
|
+
* text off the accessibility tree along with the screen, which is the opposite of
|
|
12
|
+
* what is wanted, and the third leaves a clickable ghost the size of the words. A
|
|
13
|
+
* 1px clipped box is the one form that is invisible to a sighted reader and
|
|
14
|
+
* present to every other kind.
|
|
15
|
+
*
|
|
16
|
+
* This is Tailwind's own `sr-only` written out. It is written out because
|
|
17
|
+
* Preflight is not the only thing this library leaves off: `sr-only` is a
|
|
18
|
+
* *utility*, so it is generated — but a consumer running their own Tailwind build
|
|
19
|
+
* with a `prefix` configured would generate it under a different name, and a
|
|
20
|
+
* component that hardcoded `sr-only` would come out visible on their page. The
|
|
21
|
+
* arbitrary properties below survive any prefix.
|
|
22
|
+
*/
|
|
23
|
+
export declare const VISUALLY_HIDDEN = "absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VISUALLY_HIDDEN="absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";
|