altum 0.0.4 → 0.0.5
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 +6 -0
- package/README.md +47 -1
- package/dist/base/DialogBase/DialogBase.js +1 -1
- package/dist/base/ToggleControlBase/ToggleControlBase.js +1 -1
- package/dist/base/ToggleControlBase/ToggleControlBase.module.css.js +1 -1
- package/dist/components/Accordion/Accordion.module.css.js +1 -1
- package/dist/components/ActionList/ActionList.js +1 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/Alert.module.css.js +1 -1
- package/dist/components/Avatar/Avatar.module.css.js +1 -1
- package/dist/components/Bubble/Bubble.module.css.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.module.css.js +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.module.css.js +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.js +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.module.css.js +1 -0
- package/dist/components/Calendar/Calendar.module.css.js +1 -1
- package/dist/components/Calendar/Calendar.slots.js +1 -1
- package/dist/components/Calendar/Calendar.utils.js +1 -1
- package/dist/components/Calendar/Calendar.views.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.MonthView.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.Schedule.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.Schedule.module.css.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.Schedule.utils.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.YearView.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.chrome.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.context.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.module.css.js +1 -1
- package/dist/components/CalendarBoard/CalendarBoard.utils.js +1 -1
- package/dist/components/CalendarBoard/calendar.schedule.js +1 -1
- package/dist/components/Chip/Chip.js +1 -1
- package/dist/components/Chip/Chip.module.css.js +1 -1
- package/dist/components/ColorSwatchGroup/ColorSwatchGroup.module.css.js +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.js +1 -1
- package/dist/components/CustomSelect/CustomSelect.Filter.js +1 -1
- package/dist/components/CustomSelect/CustomSelect.Shell.js +1 -1
- package/dist/components/CustomSelect/CustomSelect.Shell.module.css.js +1 -1
- package/dist/components/DateField/DateField.js +1 -1
- package/dist/components/DateRangeField/DateRangeField.js +1 -1
- package/dist/components/DayStripCalendar/DayStripCalendar.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +1 -1
- package/dist/components/FileList/FileList.js +1 -1
- package/dist/components/Grid/Grid.js +1 -1
- package/dist/components/Grid/Grid.utils.js +1 -1
- package/dist/components/LocaleProvider/LocaleProvider.js +1 -1
- package/dist/components/MaskedField/MaskedField.js +1 -1
- package/dist/components/Notification/Notification.js +1 -1
- package/dist/components/NumberField/NumberField.js +1 -1
- package/dist/components/Overflow/Overflow.js +1 -1
- package/dist/components/Overflow/Overflow.module.css.js +1 -1
- package/dist/components/Overflow/OverflowActionsMode.js +1 -1
- package/dist/components/Overflow/OverflowMeasure.js +1 -1
- package/dist/components/Overlay/Overlay.module.css.js +1 -1
- package/dist/components/Pagination/Pagination.js +1 -1
- package/dist/components/PasswordField/PasswordField.js +1 -1
- package/dist/components/PasswordField/PasswordField.module.css.js +1 -1
- package/dist/components/PinInput/PinInput.js +1 -1
- package/dist/components/PinInput/PinInput.module.css.js +1 -1
- package/dist/components/RelativeTime/RelativeTime.js +1 -1
- package/dist/components/SearchField/SearchField.js +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Steps/Steps.module.css.js +1 -1
- package/dist/components/SuggestField/SuggestField.js +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.module.css.js +1 -0
- package/dist/components/TextareaField/TextareaField.js +1 -1
- package/dist/components/TextareaField/TextareaField.module.css.js +1 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.module.css.js +1 -1
- package/dist/components/TimeField/TimeField.js +1 -1
- package/dist/entries/hooks.js +1 -1
- package/dist/entries/locales.js +1 -0
- package/dist/entries/utils.js +1 -1
- package/dist/hooks/useForm.js +1 -1
- package/dist/hooks/useFormProvider.js +1 -0
- package/dist/index.js +1 -1
- package/dist/locales/en.js +1 -1
- package/dist/locales/localeContext.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/translate.js +1 -1
- package/dist/shared/form/Form.utils.js +1 -0
- package/dist/shared/form/formRules.js +1 -0
- package/dist/shared/form/formValues.js +1 -0
- package/dist/styles/toggleBox.module.css.js +1 -1
- package/dist/utils/autoHeight.js +1 -1
- package/dist/utils/date.js +1 -0
- package/dist/utils/duration.js +1 -0
- package/dist/utils/eventTarget.js +1 -0
- package/dist/utils/injectCss.js +1 -1
- package/dist/utils/locale.js +1 -0
- package/dist/utils/plural.js +1 -0
- package/dist/utils/timezone.js +1 -0
- package/docs/COMPONENTS.md +7 -7
- package/docs/LAYOUT.md +3 -3
- package/docs/THEMING.md +4 -4
- package/package.json +6 -1
- package/types/entries/hooks.d.ts +61 -13
- package/types/entries/locales.d.ts +280 -0
- package/types/entries/utils.d.ts +70 -8
- package/types/index.d.ts +67 -52
- package/dist/base/ButtonBase/ButtonBase.js +0 -1
- package/dist/base/ButtonBase/ButtonBase.module.css.js +0 -1
- package/dist/base/FieldBase/FieldBase.js +0 -1
- package/dist/base/FieldBase/FieldBase.module.css.js +0 -1
- package/dist/base/TextControl/TextControl.js +0 -1
- package/dist/hooks/useFieldControl.js +0 -1
- package/dist/hooks/useOverflowEdges.js +0 -1
- package/dist/hooks/useScrollFocusedChildIntoView.js +0 -1
- package/dist/styles/ControlTrack.module.css.js +0 -1
- package/dist/utils/controlTrack.js +0 -1
- package/dist/utils/fieldPlaceholder.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{injectCss as o}from"../utils/injectCss.js";var r='._9TRXw[data-align=start] .yMKDd{margin-top:var(--altum-toggle-align-nudge)}._9TRXw:active .sppC0:not(:disabled,[aria-readonly=true])~.yMKDd,._9TRXw:hover .sppC0:not(:checked):not(:disabled,[aria-readonly=true])~.yMKDd{border-color:var(--altum-color-border-hover)}._9TRXw:has(.sppC0[aria-readonly=true]) .yMKDd{background-color:var(--altum-color-control-bg-readonly);border-color:var(--altum-color-control-border-readonly);border-style:dashed}._9TRXw:has(.sppC0[aria-readonly=true]):hover .yMKDd{border-color:var(--altum-color-control-border-readonly)}._9TRXw .sppC0:checked~.yMKDd{background-color:var(--altum-color-control-bg-checked);border-color:var(--altum-color-control-border-checked)}:is(._9TRXw .sppC0:checked~.yMKDd):after{opacity:1}._9TRXw .sppC0:focus-visible~.yMKDd{outline:var(--altum-focus-ring-width) solid var(--altum-focus-ring-color);outline-offset:var(--altum-focus-ring-offset)}.sppC0{appearance:none}.yMKDd{background-color:var(--altum-color-control-bg);border:1px solid var(--altum-color-control-border);box-sizing:border-box;display:inline-block;height:var(--altum-toggle-box-size);position:relative;width:var(--altum-toggle-box-size)}.yMKDd,.yMKDd:after{transition:var(--altum-transition-smooth)}.yMKDd:after{content:"";left:50%;opacity:0;position:absolute;top:50%}@media (prefers-reduced-motion:reduce){.yMKDd,.yMKDd:after{transition:none}}';const
|
|
1
|
+
"use client";import{injectCss as o}from"../utils/injectCss.js";var r='._9TRXw[data-align=start] .yMKDd{margin-top:var(--altum-toggle-align-nudge)}._9TRXw:active .sppC0:not(:disabled,[aria-readonly=true])~.yMKDd,._9TRXw:hover .sppC0:not(:checked):not(:disabled,[aria-readonly=true])~.yMKDd{border-color:var(--altum-color-border-hover)}._9TRXw:has(.sppC0[aria-readonly=true]) .yMKDd{background-color:var(--altum-color-control-bg-readonly);border-color:var(--altum-color-control-border-readonly);border-style:dashed}._9TRXw:has(.sppC0[aria-readonly=true]):hover .yMKDd{border-color:var(--altum-color-control-border-readonly)}._9TRXw .sppC0:checked~.yMKDd{background-color:var(--altum-color-control-bg-checked);border-color:var(--altum-color-control-border-checked)}:is(._9TRXw .sppC0:checked~.yMKDd):after{opacity:1}._9TRXw .sppC0:focus-visible~.yMKDd{outline:var(--altum-focus-ring-width) solid var(--altum-focus-ring-color);outline-offset:var(--altum-focus-ring-offset)}.sppC0{appearance:none}.yMKDd{background-color:var(--altum-color-control-bg);border:1px solid var(--altum-color-control-border);box-sizing:border-box;display:inline-block;flex-shrink:0;height:var(--altum-toggle-box-size);min-height:var(--altum-toggle-box-size);min-width:var(--altum-toggle-box-size);position:relative;width:var(--altum-toggle-box-size)}.yMKDd,.yMKDd:after{transition:var(--altum-transition-smooth)}.yMKDd:after{content:"";left:50%;opacity:0;position:absolute;top:50%}@media (prefers-reduced-motion:reduce){.yMKDd,.yMKDd:after{transition:none}}';const e={root:"_9TRXw",box:"yMKDd",input:"sppC0"};o(r);export{e as default};
|
package/dist/utils/autoHeight.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(e,
|
|
1
|
+
function n(e,o={}){const{minHeightPx:t=0,maxHeight:a}=o;e.style.maxHeight=a!==void 0?typeof a=="number"?`${a}px`:a:"",e.style.height="auto";const i=e.scrollHeight,r=parseFloat(getComputedStyle(e).maxHeight),h=Number.isFinite(r)?r:1/0,l=Math.min(Math.max(i,t),h);e.style.height=`${l}px`,e.style.overflowY=i>h?"auto":"hidden"}function p(e,o){const t=getComputedStyle(e),a=parseFloat(t.getPropertyValue("--altum-field-size-height"))||0,i=parseFloat(t.lineHeight)||parseFloat(t.fontSize)*1.25,r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),h=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),l=r+h+i*o;return o<=1&&a>0?Math.max(l,a):l}export{n as adjustElementHeight,p as getTextareaMinHeightPx};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{localeToBcp47 as D}from"./locale.js";function u(t,e=1){const r=new Date(t),n=r.getDay(),a=e===1?n===0?6:n-1:n;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function l(t,e=1){const r=u(t,e);return Array.from({length:7},(n,a)=>{const o=new Date(r);return o.setDate(r.getDate()+a),o})}function c(t,e,r){const n=new Date(t.getTime());switch(r){case"minute":n.setMinutes(n.getMinutes()+e);break;case"hour":n.setHours(n.getHours()+e);break;case"day":n.setDate(n.getDate()+e);break;case"week":n.setDate(n.getDate()+e*7);break;case"month":n.setMonth(n.getMonth()+e);break;case"year":n.setFullYear(n.getFullYear()+e);break;default:return r}return n}function s(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function f(t,e){return c(s(t),e,"day")}function m(t,e){return g(t,e)===0}function g(t,e){const r=t.getFullYear()-e.getFullYear();if(r)return r<0?-1:1;const n=t.getMonth()-e.getMonth();if(n)return n<0?-1:1;const a=t.getDate()-e.getDate();return a<0?-1:a>0?1:0}function d(t){const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(!e)return null;const r=Number(e[1]),n=Number(e[2]),a=Number(e[3]),o=new Date(r,n-1,a);return o.getFullYear()!==r||o.getMonth()!==n-1||o.getDate()!==a?null:o}function h(t){const e=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${r}`}function i(t){return(Math.trunc(t)%24+24)%24}function b(t,e){const r=new Date(Date.UTC(2020,0,15,i(t),0,0));return new Intl.DateTimeFormat(D(e),{timeZone:"UTC",hour:"numeric",minute:"2-digit"}).format(r)}function y(t){return`${String(i(t)).padStart(2,"0")}:00`}export{f as addDays,c as addToDate,g as compareDay,b as formatHourLabel,y as formatHourTime,h as formatLocalDate,l as getWeekDays,u as getWeekStart,m as isSameDay,d as parseLocalDate,s as startOfDay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=60,o=3600,t=86400,r=604800,e={minute:60,hour:3600,day:86400,week:604800};function S(n,u){return n/e[u]}function a(n,u){return n*e[u]}function c(n){return n!==0&&n%604800===0?{unit:"week",value:n/604800}:n!==0&&n%86400===0?{unit:"day",value:n/86400}:n!==0&&n%3600===0?{unit:"hour",value:n/3600}:{unit:"minute",value:n/60}}export{t as DAY_SECONDS,o as HOUR_SECONDS,i as MINUTE_SECONDS,r as WEEK_SECONDS,c as getDurationUnitAndValue,S as secondsToUnit,a as unitToSeconds};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=["input","textarea","select","a",'[contenteditable="true"]'].join(", "),r=['[role="dialog"]','[role="listbox"]','[role="menu"]','[role="tree"]',"[data-side]"].join(",");function a(e){return`[class*="${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"]`}function s(e){if(typeof HTMLElement>"u"||!(e instanceof HTMLElement))return!1;const{tagName:t}=e;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}function l(e,t){return typeof Element>"u"||!(e instanceof Element)||!t?!1:!!e.closest(t)}function c(e,t,n,o){return typeof Node>"u"||!(e instanceof Node)?!0:!(t?.contains(e)||e instanceof Element&&(n&&e.closest(n)||o&&e.closest(a(o))))}export{i as DEFAULT_DRAG_BLOCKED_SELECTOR,r as DEFAULT_PORTAL_SELECTOR,l as isDragBlockedTarget,s as isEditableTarget,c as isOutsideFormInteraction};
|
package/dist/utils/injectCss.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(t){if(typeof document>"u")return;const e=document.createElement("style");e.textContent
|
|
1
|
+
function n(t){if(typeof document>"u")return;const e=document.createElement("style");e.textContent=`@layer altum{${t}}`,document.head.appendChild(e)}export{n as injectCss};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(e){return e==="en"?"en-US":"ru-RU"}export{n as localeToBcp47};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(u,t,n,l){const e=Math.abs(Math.trunc(u)),a=e%10,r=e%100;return a===1&&r!==11?t:a>=2&&a<=4&&(r<12||r>14)?n:l}function c(u,t,n){return Math.abs(Math.trunc(u))===1?t:n}function f(u,t,n){return u==="en"?c(t,n.one,n.many):o(t,n.one,n.few,n.many)}export{f as plural,c as pluralEn,o as pluralRu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{localeToBcp47 as m}from"./locale.js";const c=["UTC","Africa/Cairo","Africa/Johannesburg","America/Anchorage","America/Argentina/Buenos_Aires","America/Chicago","America/Denver","America/Los_Angeles","America/Mexico_City","America/New_York","America/Sao_Paulo","Asia/Dubai","Asia/Hong_Kong","Asia/Kolkata","Asia/Shanghai","Asia/Singapore","Asia/Tokyo","Australia/Sydney","Europe/Berlin","Europe/London","Europe/Moscow","Europe/Paris","Pacific/Auckland","Pacific/Honolulu"];function s(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function f(){const e=Intl,t=typeof e.supportedValuesOf=="function"?[...e.supportedValuesOf("timeZone")]:[...c];return t.includes("UTC")||t.unshift("UTC"),t}function l(e){if(!e)return!1;try{return!0}catch{return!1}}function a(e,t){try{const n=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(e),r={};for(const i of n)i.type!=="literal"&&(r[i.type]=i.value);const o=Number(r.hour);return{year:Number(r.year),month:Number(r.month),day:Number(r.day),hour:o===24?0:o,minute:Number(r.minute),second:Number(r.second)}}catch{return null}}function d(e,t=new Date){const n=a(t,e);if(!n)return null;const r=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second);return Math.round((r-t.getTime())/6e4)}function y(e,t,n){const r=a(e,n),o=a(t,n);return!r||!o?!1:r.year===o.year&&r.month===o.month&&r.day===o.day}function h(e,t,n,r={}){try{return new Intl.DateTimeFormat(m(n),{...r,timeZone:t}).format(e)}catch{return""}}function u(e,t=new Date){try{return new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??""}catch{return""}}function A(e){const t=u(e);return t?`${e} (${t})`:e}export{h as formatInTimeZone,A as formatTimezoneLabel,u as formatTimezoneOffset,s as getBrowserTimezone,f as getSupportedTimezones,d as getTimezoneOffsetMinutes,a as getZonedParts,y as isSameZonedDay,l as isValidTimeZone};
|
package/docs/COMPONENTS.md
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
| Компонент | Описание |
|
|
14
14
|
|-----------|----------|
|
|
15
|
-
| **Button** | Кнопка: `variant` (`primary` / `tinted` / `secondary` / `
|
|
16
|
-
| **ButtonIcon** |
|
|
15
|
+
| **Button** | Кнопка: `variant` (`primary` / `tinted` / `secondary` / `danger` / `danger_tinted` / `ghost` / `link`), `prefix` / `postfix`, `loading`, `fullWidth`. |
|
|
16
|
+
| **ButtonIcon** | Иконка-кнопка на базе **Button**; `circle` / `square`; по умолчанию `variant="ghost"`. |
|
|
17
17
|
| **ButtonGroup** | Составная группа (`ButtonGroup` + `ButtonGroup.Item`): `mode` `button` (независимые, выбранность через `active` на Item) / `toggle` (один выбранный, слайдер) / `multi_toggle` (несколько); `itemFit` `equal` \| `content`; `width` `auto` \| `full`; `variant` / `status` / `size` / `borderless` на Root. |
|
|
18
18
|
| **SegmentedControl** | Обёртка над `ButtonGroup` (`mode="toggle"`, `width="full"`): `options` + `value` / `onChange`; `itemFit` `equal` \| `content`; варианты `primary` / `tinted` / `secondary` (по умолчанию) / `ghost` / `plain`. |
|
|
19
19
|
| **Overflow** | Лишние пункты за ⋯ в `Dropdown`. `Overflow.Item` — панель действий; прочие дети — измерение ширины. `longPress` открывает меню долгим нажатием (хост — **`ActionSheetTrigger`**). |
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
|
|
27
27
|
| Компонент | Описание |
|
|
28
28
|
|-----------|----------|
|
|
29
|
-
| **TextField** |
|
|
29
|
+
| **TextField** | Примитив поля: chrome + `as` (`input` / `textarea` / `button` / `div`). `label` — floating-лейбл; без `label` — поле без подписи (`aria-label` / `placeholder`). `description` — подсказка или слот под chrome. `keepPlaceholder` — не скрывать placeholder при фокусе пустого поля. |
|
|
30
30
|
| **PasswordField** | Пароль на базе TextField: показать/скрыть, опциональный индикатор сложности. |
|
|
31
|
-
| **SearchField** | Обёртка над `TextField` с
|
|
32
|
-
| **TextareaField** | Многострочное поле на **
|
|
31
|
+
| **SearchField** | Обёртка над `TextField` с иконкой поиска (`onClear` от TextField). Без `label` — тулбарный вид. |
|
|
32
|
+
| **TextareaField** | Многострочное поле на **TextField** `as="textarea"`; авто-рост высоты. |
|
|
33
33
|
| **NumberField** | Числовой ввод на базе `TextField` с кнопками +/-. |
|
|
34
34
|
| **MaskedField** | Поле с маской ввода (телефон, дата и т.п.) на базе `TextField`; опционально `maskAsPlaceholder`. Не переопределяйте `padding` / `font-size` на inner `input`. |
|
|
35
|
-
| **PinInput** | PIN / OTP
|
|
35
|
+
| **PinInput** | PIN / OTP: группа ячеек на **TextField**. `label` — **FieldLabel**; `description` / `error` — **FormMessage**. |
|
|
36
36
|
| **Rating** | Оценка звёздами. |
|
|
37
37
|
| **FormMessage** | Подсказка / ошибка / успех под полем; `variant` `hint` / `error` / `success`. |
|
|
38
38
|
| **Select** | Поле выбора: `options`, `value` / `onChange`, `label`, `filterable`; `selectionMode="multiple"` рисует chips. |
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
| **Accordion** | `Accordion.Item` с `title` и содержимым в `children`; `flush` (по умолчанию) / `bordered`; `multiple`, отключённый пункт. |
|
|
93
93
|
| **Badge** | `size` sm/md, `position` overlay/standalone, `variant` включая `error`; overlay — `--altum-badge-overhang`. Числовой `label` ограничивается через `max`; `children` — якорь overlay. |
|
|
94
94
|
| **Avatar** / **AvatarGroup** | Размеры `xs`…`xl`, кольцо статуса, запасная иконка; группа с наложением. |
|
|
95
|
-
| **Chip** | Тег / фильтр: `mode` `chip` \| `tag` \| `toggle` (`as` — deprecated-алиас), `size`, `onRemove` / `onClick`. **`ChipGroup`**: `mode` `chip` \| `tag`, `
|
|
95
|
+
| **Chip** | Тег / фильтр: `mode` `chip` \| `tag` \| `toggle` (`as` — deprecated-алиас), `size`, `onRemove` / `onClick`. **`ChipGroup`**: `mode` `chip` \| `tag`, `gap`. |
|
|
96
96
|
| **StatBadge** | Компактный блок статистики: число + подпись; `variant` `default` / `success` / `warning` / `error`; `size` `md` / `sm`. |
|
|
97
97
|
| **EmptyState** | Пустое состояние: иконка (`--altum-color-empty-icon`), заголовок, описание, действие; `size` для вложенных панелей. |
|
|
98
98
|
| **DescriptionList** | Список «ключ — значение» (`stacked` / `inline`, колонки). |
|
package/docs/LAYOUT.md
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from 'altum';
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Связанные: **
|
|
22
|
+
Связанные: **TextField** — см. [COMPONENTS.md](./COMPONENTS.md).
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
| Поля + Chip + Button в одной строке фильтров | **ControlRow** |
|
|
35
35
|
| Одному ребёнку — `flex: 1` или «не сжимать» | **LayoutItem** (`ControlRow.Item` / `Layout.Item`) |
|
|
36
36
|
| Колонки сетки | **Grid** |
|
|
37
|
-
| Оболочка input (label / prefix / clear) | **
|
|
37
|
+
| Оболочка input (label / prefix / clear) | **TextField** |
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
@@ -279,4 +279,4 @@ Flex-ячейка внутри Stack / Inline / Split / ControlRow.
|
|
|
279
279
|
| `Stack` для чипов в ряд | **Inline** |
|
|
280
280
|
| `div` + `display:flex` + px `gap` | **Stack** / **Inline** с токенами |
|
|
281
281
|
| Оборачивать всё в `LayoutItem` | Только где нужны `grow` / `shrink` |
|
|
282
|
-
| Путать `Layout` и `
|
|
282
|
+
| Путать `Layout` и `TextField` | `Layout` — панель UI; `TextField` — оболочка поля ввода |
|
package/docs/THEMING.md
CHANGED
|
@@ -4,7 +4,7 @@ altum использует **CSS custom properties** для всех дизай
|
|
|
4
4
|
|
|
5
5
|
## Быстрый старт
|
|
6
6
|
|
|
7
|
-
Оберните приложение в `ThemeProvider` (установка — [README](../README.md)). Стили инжектятся из JS — отдельный `styles.css` не нужен. По умолчанию `applyTo="wrapper"`. Для порталов (`Modal`, `Sheet`, выпадающие панели, `Notification`) используйте **`applyTo="document"`**, чтобы классы и `data-theme` попали на `html` / `body
|
|
7
|
+
Оберните приложение в `ThemeProvider` (установка — [README](../README.md)). Стили инжектятся из JS — отдельный `styles.css` не нужен. По умолчанию `applyTo="wrapper"`. Для порталов (`Modal`, `Sheet`, выпадающие панели, `Notification`) используйте **`applyTo="document"`**, чтобы классы и `data-theme` попали на `html` / `body` и не дублировались на обёртке. Тогда переопределение токенов на `body` доходит до детей. Синхронизация идёт в **`useLayoutEffect`**, чтобы первый кадр совпадал с `initialTheme` / контролируемой `theme`.
|
|
8
8
|
|
|
9
9
|
### Контролируемая тема и хранилище
|
|
10
10
|
|
|
@@ -240,13 +240,13 @@ return (
|
|
|
240
240
|
|
|
241
241
|
### Опасность / деструктив (`--altum-color-danger-*`)
|
|
242
242
|
|
|
243
|
-
Действия удаления, состояния ошибки. API кнопки: `
|
|
243
|
+
Действия удаления, состояния ошибки. API кнопки: `variant="danger"` (заливка) и `variant="danger_tinted"` (мягкая смывка).
|
|
244
244
|
|
|
245
245
|
| Переменная | Назначение |
|
|
246
246
|
|------------|------------|
|
|
247
247
|
| `--altum-color-danger-bg-solid` | Залитая деструктивная кнопка |
|
|
248
|
-
| `--altum-color-danger-text-secondary` | Текст контурной деструктивной
|
|
249
|
-
| `--altum-color-danger-tint-bg` / `--altum-color-danger-tint-text` | Мягкий tint опасности (`variant="
|
|
248
|
+
| `--altum-color-danger-text-secondary` | Текст контурной деструктивной |
|
|
249
|
+
| `--altum-color-danger-tint-bg` / `--altum-color-danger-tint-text` | Мягкий tint опасности (`variant="danger_tinted"`) |
|
|
250
250
|
|
|
251
251
|
### Контролы формы (`--altum-color-input-*`, `--altum-color-control-*`)
|
|
252
252
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "altum",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Библиотека React + TypeScript UI-компонентов: CSS Modules, токены ThemeProvider, адаптация overlay/sheet.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alexander <azeeson@gmail.com>",
|
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
"import": "./dist/entries/icons.js",
|
|
41
41
|
"default": "./dist/entries/icons.js"
|
|
42
42
|
},
|
|
43
|
+
"./locales": {
|
|
44
|
+
"types": "./types/entries/locales.d.ts",
|
|
45
|
+
"import": "./dist/entries/locales.js",
|
|
46
|
+
"default": "./dist/entries/locales.js"
|
|
47
|
+
},
|
|
43
48
|
"./package.json": "./package.json"
|
|
44
49
|
},
|
|
45
50
|
"files": [
|
package/types/entries/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { RefObject, PointerEvent, MouseEvent as MouseEvent$1 } from 'react';
|
|
2
|
+
import { RefObject, PointerEvent, MouseEvent as MouseEvent$1, Dispatch, SetStateAction, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface UseOutsideClickOptions {
|
|
5
5
|
enabled?: boolean;
|
|
@@ -84,6 +84,62 @@ declare function usePresence(open: boolean, durationMs: number): {
|
|
|
84
84
|
presented: boolean;
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
+
type FormErrors<T extends Record<string, unknown>> = Partial<Record<keyof T, string>>;
|
|
88
|
+
type FieldValidate<T extends Record<string, unknown>, K extends keyof T> = (value: T[K], values: T) => string | undefined;
|
|
89
|
+
interface RegisterOptions<T extends Record<string, unknown>, K extends keyof T> {
|
|
90
|
+
getValue?: (payload: unknown) => T[K];
|
|
91
|
+
validate?: FieldValidate<T, K>;
|
|
92
|
+
}
|
|
93
|
+
declare function useForm<T extends Record<string, unknown>>(initialValues: T): {
|
|
94
|
+
values: T;
|
|
95
|
+
errors: Partial<Record<keyof T, string>>;
|
|
96
|
+
isDirty: boolean;
|
|
97
|
+
register: <K extends keyof T>(name: K, options?: RegisterOptions<T, K>) => {
|
|
98
|
+
value: T[K];
|
|
99
|
+
onChange: (payload: unknown) => void;
|
|
100
|
+
};
|
|
101
|
+
hasErrors: boolean;
|
|
102
|
+
setValues: Dispatch<SetStateAction<T>>;
|
|
103
|
+
setValue: <K extends keyof T>(name: K, value: T[K]) => void;
|
|
104
|
+
setError: (name: keyof T, message: string) => void;
|
|
105
|
+
clearErrors: (name?: keyof T) => void;
|
|
106
|
+
reset: (next?: T) => void;
|
|
107
|
+
handleSubmit: (onValid: (values: T) => void) => (event?: {
|
|
108
|
+
preventDefault?: () => void;
|
|
109
|
+
}) => void;
|
|
110
|
+
};
|
|
111
|
+
type UseFormReturn<T extends Record<string, unknown>> = ReturnType<typeof useForm<T>>;
|
|
112
|
+
|
|
113
|
+
declare function useFormContext<T extends Record<string, unknown>>(): UseFormReturn<T>;
|
|
114
|
+
declare function useFormProvider<T extends Record<string, unknown>>(initialValues: T): {
|
|
115
|
+
FormProvider: {
|
|
116
|
+
({ children }: {
|
|
117
|
+
children?: ReactNode;
|
|
118
|
+
}): react.FunctionComponentElement<react.ProviderProps<UseFormReturn<Record<string, unknown>> | null>>;
|
|
119
|
+
displayName: string;
|
|
120
|
+
};
|
|
121
|
+
values: T;
|
|
122
|
+
errors: Partial<Record<keyof T, string>>;
|
|
123
|
+
isDirty: boolean;
|
|
124
|
+
register: <K extends keyof T>(name: K, options?: RegisterOptions<T, K> | undefined) => {
|
|
125
|
+
value: T[K];
|
|
126
|
+
onChange: (payload: unknown) => void;
|
|
127
|
+
};
|
|
128
|
+
hasErrors: boolean;
|
|
129
|
+
setValues: react.Dispatch<react.SetStateAction<T>>;
|
|
130
|
+
setValue: <K extends keyof T>(name: K, value: T[K]) => void;
|
|
131
|
+
setError: (name: keyof T, message: string) => void;
|
|
132
|
+
clearErrors: (name?: keyof T | undefined) => void;
|
|
133
|
+
reset: (next?: T | undefined) => void;
|
|
134
|
+
handleSubmit: (onValid: (values: T) => void) => (event?: {
|
|
135
|
+
preventDefault?: (() => void) | undefined;
|
|
136
|
+
}) => void;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
type FormRule<T extends Record<string, unknown> = Record<string, unknown>> = (value: unknown, values: T) => string | undefined;
|
|
140
|
+
declare function required(message: string): FormRule;
|
|
141
|
+
declare function pattern(regex: RegExp, message: string): FormRule;
|
|
142
|
+
declare function compose<T extends Record<string, unknown> = Record<string, unknown>>(...rules: FormRule<T>[]): FormRule<T>;
|
|
87
143
|
interface ValidationRules {
|
|
88
144
|
required?: string;
|
|
89
145
|
pattern?: {
|
|
@@ -92,16 +148,8 @@ interface ValidationRules {
|
|
|
92
148
|
};
|
|
93
149
|
validate?: (val: unknown) => string | boolean;
|
|
94
150
|
}
|
|
95
|
-
declare function
|
|
96
|
-
|
|
97
|
-
errors: Record<string, string>;
|
|
98
|
-
register: (name: keyof T, rules?: ValidationRules) => {
|
|
99
|
-
value: T[keyof T];
|
|
100
|
-
onChange: (val: unknown) => void;
|
|
101
|
-
};
|
|
102
|
-
hasErrors: boolean;
|
|
103
|
-
setValues: react.Dispatch<react.SetStateAction<T>>;
|
|
104
|
-
};
|
|
151
|
+
declare function fieldRules(rules: ValidationRules): FormRule;
|
|
152
|
+
declare function checkedValue(payload: unknown): boolean;
|
|
105
153
|
|
|
106
|
-
export { MOBILE_MEDIA_QUERY, REDUCED_MOTION_QUERY, useBodyScrollLock, useControlledState, useControlledStateWithCallback, useDocumentKeyDown, useEscapeKey, useFocusRestore, useFocusTrap, useForm, useInertSiblings, useLongPress, useMediaQuery, useNow, useOutsideClick, useOverlay, useOverlayPanel, usePrefersReducedMotion, usePresence };
|
|
107
|
-
export type { DocumentKeyDownTarget, UseDocumentKeyDownOptions, UseEscapeKeyOptions, UseFocusTrapOptions, UseLongPressHandlers, UseLongPressOptions, UseOutsideClickOptions, UseOverlayOptions, UseOverlayPanelOptions, ValidationRules };
|
|
154
|
+
export { MOBILE_MEDIA_QUERY, REDUCED_MOTION_QUERY, checkedValue, compose, fieldRules, pattern, required, useBodyScrollLock, useControlledState, useControlledStateWithCallback, useDocumentKeyDown, useEscapeKey, useFocusRestore, useFocusTrap, useForm, useFormContext, useFormProvider, useInertSiblings, useLongPress, useMediaQuery, useNow, useOutsideClick, useOverlay, useOverlayPanel, usePrefersReducedMotion, usePresence };
|
|
155
|
+
export type { DocumentKeyDownTarget, FieldValidate, FormErrors, FormRule, RegisterOptions, UseDocumentKeyDownOptions, UseEscapeKeyOptions, UseFocusTrapOptions, UseFormReturn, UseLongPressHandlers, UseLongPressOptions, UseOutsideClickOptions, UseOverlayOptions, UseOverlayPanelOptions, ValidationRules };
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
declare const ru: {
|
|
2
|
+
readonly common: {
|
|
3
|
+
readonly close: "Закрыть";
|
|
4
|
+
readonly clear: "Очистить";
|
|
5
|
+
readonly collapse: "Свернуть";
|
|
6
|
+
};
|
|
7
|
+
readonly calendar: {
|
|
8
|
+
readonly months: readonly ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];
|
|
9
|
+
readonly monthsShort: readonly ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"];
|
|
10
|
+
readonly weekdaysShort: readonly ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"];
|
|
11
|
+
readonly prevMonth: "Предыдущий месяц";
|
|
12
|
+
readonly nextMonth: "Следующий месяц";
|
|
13
|
+
readonly prevYear: "Предыдущий год";
|
|
14
|
+
readonly nextYear: "Следующий год";
|
|
15
|
+
readonly prevYears: "Предыдущие годы";
|
|
16
|
+
readonly nextYears: "Следующие годы";
|
|
17
|
+
readonly selectYear: "Выбрать год, сейчас {year}";
|
|
18
|
+
readonly selectMonth: "Выбрать месяц, сейчас {month}";
|
|
19
|
+
readonly monthsOfYear: "Месяцы {year}";
|
|
20
|
+
readonly yearsRange: "Годы {start}–{end}";
|
|
21
|
+
};
|
|
22
|
+
readonly calendarBoard: {
|
|
23
|
+
readonly ariaLabel: "Календарная доска";
|
|
24
|
+
readonly prevPeriod: "Предыдущий период";
|
|
25
|
+
readonly nextPeriod: "Следующий период";
|
|
26
|
+
readonly viewSwitchAria: "Представление календаря";
|
|
27
|
+
readonly views: {
|
|
28
|
+
readonly month: "Месяц";
|
|
29
|
+
readonly week: "Неделя";
|
|
30
|
+
readonly day: "День";
|
|
31
|
+
readonly year: "Год";
|
|
32
|
+
};
|
|
33
|
+
readonly scheduleAria: "Расписание";
|
|
34
|
+
readonly allDay: "События на весь день";
|
|
35
|
+
readonly allDayShort: "весь день";
|
|
36
|
+
readonly dayWithTasks: {
|
|
37
|
+
readonly one: "{day} {month}, {count} задача";
|
|
38
|
+
readonly few: "{day} {month}, {count} задачи";
|
|
39
|
+
readonly many: "{day} {month}, {count} задач";
|
|
40
|
+
};
|
|
41
|
+
readonly dayWithoutTasks: "{day} {month}";
|
|
42
|
+
readonly moreTasks: {
|
|
43
|
+
readonly one: "ещё {count} задача";
|
|
44
|
+
readonly few: "ещё {count} задачи";
|
|
45
|
+
readonly many: "ещё {count} задач";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly dayStrip: {
|
|
49
|
+
readonly ariaLabel: "Навигация по дням";
|
|
50
|
+
readonly prev: "Предыдущий день";
|
|
51
|
+
readonly next: "Следующий день";
|
|
52
|
+
readonly days: "Дни";
|
|
53
|
+
};
|
|
54
|
+
readonly timeField: {
|
|
55
|
+
readonly hours: "Часы";
|
|
56
|
+
readonly minutes: "Минуты";
|
|
57
|
+
};
|
|
58
|
+
readonly dateRangeField: {
|
|
59
|
+
readonly label: "Период";
|
|
60
|
+
readonly start: "С";
|
|
61
|
+
readonly end: "По";
|
|
62
|
+
};
|
|
63
|
+
readonly select: {
|
|
64
|
+
readonly removeItem: "Удалить {label}";
|
|
65
|
+
};
|
|
66
|
+
readonly customSelect: {
|
|
67
|
+
readonly filterPlaceholder: "Поиск...";
|
|
68
|
+
readonly noOptions: "Ничего не найдено";
|
|
69
|
+
};
|
|
70
|
+
readonly listbox: {
|
|
71
|
+
readonly noOptions: "Ничего не найдено";
|
|
72
|
+
};
|
|
73
|
+
readonly suggestField: {
|
|
74
|
+
readonly noOptions: "Ничего не найдено";
|
|
75
|
+
};
|
|
76
|
+
readonly sheet: {
|
|
77
|
+
readonly ariaLabel: "Панель";
|
|
78
|
+
};
|
|
79
|
+
readonly modal: {
|
|
80
|
+
readonly ariaLabel: "Диалог";
|
|
81
|
+
};
|
|
82
|
+
readonly confirmDialog: {
|
|
83
|
+
readonly confirm: "Подтвердить";
|
|
84
|
+
readonly cancel: "Отмена";
|
|
85
|
+
};
|
|
86
|
+
readonly table: {
|
|
87
|
+
readonly expandColumn: "Развернуть";
|
|
88
|
+
readonly selectAll: "Выбрать все строки";
|
|
89
|
+
readonly selectRow: "Выбрать строку {id}";
|
|
90
|
+
readonly resizeColumn: "Изменить ширину: {header}";
|
|
91
|
+
readonly emptyTitle: "Нет данных";
|
|
92
|
+
readonly rowActions: "Действия строки";
|
|
93
|
+
};
|
|
94
|
+
readonly pagination: {
|
|
95
|
+
readonly ariaLabel: "Пагинация";
|
|
96
|
+
readonly prev: "Предыдущая страница";
|
|
97
|
+
readonly next: "Следующая страница";
|
|
98
|
+
readonly page: "Страница {page}";
|
|
99
|
+
readonly summary: "{start}–{end} из {total}";
|
|
100
|
+
readonly pageSizeLabel: "На странице";
|
|
101
|
+
readonly pageSizeAria: "Размер страницы";
|
|
102
|
+
};
|
|
103
|
+
readonly sortable: {
|
|
104
|
+
readonly moveUp: "Переместить вверх";
|
|
105
|
+
readonly moveDown: "Переместить вниз";
|
|
106
|
+
readonly moved: "Позиция {position} из {total}: элемент перемещён";
|
|
107
|
+
readonly dragItem: "Перетащить элемент";
|
|
108
|
+
};
|
|
109
|
+
readonly upload: {
|
|
110
|
+
readonly dropHint: "Перетащите файлы сюда или";
|
|
111
|
+
readonly choose: "выберите";
|
|
112
|
+
readonly selectedCount: {
|
|
113
|
+
readonly one: "Выбран {count} файл";
|
|
114
|
+
readonly few: "Выбрано {count} файла";
|
|
115
|
+
readonly many: "Выбрано {count} файлов";
|
|
116
|
+
};
|
|
117
|
+
readonly release: "Отпустите файл для загрузки";
|
|
118
|
+
};
|
|
119
|
+
readonly imageCrop: {
|
|
120
|
+
readonly title: "Обрезка изображения";
|
|
121
|
+
readonly confirm: "Применить";
|
|
122
|
+
readonly cancel: "Отмена";
|
|
123
|
+
readonly choose: "Выберите изображение";
|
|
124
|
+
readonly hint: "Перетащите изображение или измените масштаб за углы";
|
|
125
|
+
readonly loadError: "Не удалось загрузить изображение";
|
|
126
|
+
readonly cropError: "Не удалось обрезать изображение";
|
|
127
|
+
readonly exportError: "Не удалось экспортировать изображение";
|
|
128
|
+
readonly scaleHandle: "Масштаб {corner}";
|
|
129
|
+
};
|
|
130
|
+
readonly imageGallery: {
|
|
131
|
+
readonly empty: "Нет изображений";
|
|
132
|
+
readonly prev: "Предыдущее изображение";
|
|
133
|
+
readonly next: "Следующее изображение";
|
|
134
|
+
readonly imageN: "Изображение {index}";
|
|
135
|
+
};
|
|
136
|
+
readonly imageLightbox: {
|
|
137
|
+
readonly close: "Закрыть галерею";
|
|
138
|
+
readonly ariaLabel: "Галерея изображений";
|
|
139
|
+
};
|
|
140
|
+
readonly sidebar: {
|
|
141
|
+
readonly ariaLabel: "Навигация сайдбара";
|
|
142
|
+
readonly openMenu: "Открыть меню";
|
|
143
|
+
readonly expand: "Развернуть";
|
|
144
|
+
readonly collapse: "Свернуть";
|
|
145
|
+
readonly expandSidebar: "Развернуть сайдбар";
|
|
146
|
+
readonly collapseSidebar: "Свернуть сайдбар";
|
|
147
|
+
};
|
|
148
|
+
readonly password: {
|
|
149
|
+
readonly reveal: "Показать пароль";
|
|
150
|
+
readonly hide: "Скрыть пароль";
|
|
151
|
+
readonly strength: {
|
|
152
|
+
readonly weak: "Слабый";
|
|
153
|
+
readonly fair: "Средний";
|
|
154
|
+
readonly good: "Хороший";
|
|
155
|
+
readonly strong: "Надёжный";
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
readonly numberField: {
|
|
159
|
+
readonly group: "Изменить значение";
|
|
160
|
+
readonly decrement: "Уменьшить";
|
|
161
|
+
readonly increment: "Увеличить";
|
|
162
|
+
};
|
|
163
|
+
readonly pinInput: {
|
|
164
|
+
readonly ariaLabel: "Код подтверждения";
|
|
165
|
+
readonly digit: "Цифра {index}";
|
|
166
|
+
};
|
|
167
|
+
readonly searchField: {
|
|
168
|
+
readonly label: "Поиск";
|
|
169
|
+
};
|
|
170
|
+
readonly slider: {
|
|
171
|
+
readonly ariaLabel: "Ползунок";
|
|
172
|
+
readonly from: "От";
|
|
173
|
+
readonly to: "До";
|
|
174
|
+
};
|
|
175
|
+
readonly rating: {
|
|
176
|
+
readonly ariaLabel: "Рейтинг";
|
|
177
|
+
};
|
|
178
|
+
readonly actionList: {
|
|
179
|
+
readonly filterPlaceholder: "Фильтр…";
|
|
180
|
+
readonly empty: "Ничего не найдено";
|
|
181
|
+
readonly ariaLabel: "Список действий";
|
|
182
|
+
};
|
|
183
|
+
readonly commandPalette: {
|
|
184
|
+
readonly placeholder: "Поиск команд…";
|
|
185
|
+
readonly title: "Командная палитра";
|
|
186
|
+
};
|
|
187
|
+
readonly pullToRefresh: {
|
|
188
|
+
readonly pull: "Потяните для обновления";
|
|
189
|
+
readonly release: "Отпустите";
|
|
190
|
+
readonly refreshing: "Обновление…";
|
|
191
|
+
};
|
|
192
|
+
readonly spinner: {
|
|
193
|
+
readonly typing: "Печатает";
|
|
194
|
+
readonly loading: "Загрузка";
|
|
195
|
+
};
|
|
196
|
+
readonly steps: {
|
|
197
|
+
readonly ariaLabel: "Шаги";
|
|
198
|
+
};
|
|
199
|
+
readonly segmentedControl: {
|
|
200
|
+
readonly ariaLabel: "Сегментированный контроль";
|
|
201
|
+
};
|
|
202
|
+
readonly bubble: {
|
|
203
|
+
readonly expand: "Ещё";
|
|
204
|
+
readonly collapse: "Свернуть";
|
|
205
|
+
readonly reactions: "Реакции";
|
|
206
|
+
};
|
|
207
|
+
readonly chip: {
|
|
208
|
+
readonly remove: "Удалить";
|
|
209
|
+
readonly groupChips: "Чипы";
|
|
210
|
+
readonly groupTags: "Теги";
|
|
211
|
+
};
|
|
212
|
+
readonly fileList: {
|
|
213
|
+
readonly remove: "Удалить";
|
|
214
|
+
readonly retry: "Повторить";
|
|
215
|
+
};
|
|
216
|
+
readonly virtualList: {
|
|
217
|
+
readonly ariaLabel: "Список";
|
|
218
|
+
};
|
|
219
|
+
readonly skipLink: {
|
|
220
|
+
readonly label: "Перейти к содержимому";
|
|
221
|
+
};
|
|
222
|
+
readonly overflow: {
|
|
223
|
+
readonly title: "Действия";
|
|
224
|
+
readonly ariaLabel: "Действия";
|
|
225
|
+
readonly more: "Ещё действия";
|
|
226
|
+
readonly groupTitle: "Ещё";
|
|
227
|
+
readonly groupAriaLabel: "Группа";
|
|
228
|
+
readonly groupMore: "Показать ещё";
|
|
229
|
+
};
|
|
230
|
+
readonly buttonGroup: {
|
|
231
|
+
readonly ariaLabel: "Группа кнопок";
|
|
232
|
+
};
|
|
233
|
+
readonly menu: {
|
|
234
|
+
readonly mobileTitle: "Меню";
|
|
235
|
+
readonly ariaLabel: "Меню";
|
|
236
|
+
readonly contextAriaLabel: "Контекстное меню";
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
type DeepStringify<T> = T extends string ? string : T extends readonly (infer U)[] ? DeepStringify<U>[] : T extends object ? {
|
|
241
|
+
[K in keyof T]: DeepStringify<T[K]>;
|
|
242
|
+
} : T;
|
|
243
|
+
type Messages = DeepStringify<typeof ru>;
|
|
244
|
+
type DeepPartialMessages = {
|
|
245
|
+
[K in keyof Messages]?: Messages[K] extends (infer U)[] ? U[] : Messages[K] extends object ? {
|
|
246
|
+
[P in keyof Messages[K]]?: DeepPartialMessagesValue<Messages[K][P]>;
|
|
247
|
+
} : Messages[K];
|
|
248
|
+
};
|
|
249
|
+
type DeepPartialMessagesValue<T> = T extends (infer U)[] ? U[] : T extends object ? {
|
|
250
|
+
[P in keyof T]?: DeepPartialMessagesValue<T[P]>;
|
|
251
|
+
} : T;
|
|
252
|
+
type LocaleCode = 'ru' | 'en';
|
|
253
|
+
interface PluralMessage {
|
|
254
|
+
one: string;
|
|
255
|
+
few: string;
|
|
256
|
+
many: string;
|
|
257
|
+
}
|
|
258
|
+
interface MessageTree {
|
|
259
|
+
[key: string]: string | PluralMessage | readonly string[] | MessageTree;
|
|
260
|
+
}
|
|
261
|
+
type TranslationParams = Record<string, string | number>;
|
|
262
|
+
|
|
263
|
+
declare const en: Messages;
|
|
264
|
+
|
|
265
|
+
declare const builtInMessages: Record<LocaleCode, Messages>;
|
|
266
|
+
|
|
267
|
+
declare function deepMergeMessages(base: Messages, override?: DeepPartialMessages): Messages;
|
|
268
|
+
declare function translate(messages: MessageTree, key: string, params?: TranslationParams, locale?: LocaleCode): string;
|
|
269
|
+
type TranslateFn = (key: string, params?: TranslationParams) => string;
|
|
270
|
+
|
|
271
|
+
interface LocaleContextValue {
|
|
272
|
+
locale: LocaleCode;
|
|
273
|
+
messages: Messages;
|
|
274
|
+
t: TranslateFn;
|
|
275
|
+
}
|
|
276
|
+
declare function useLocale(): LocaleContextValue;
|
|
277
|
+
declare function useT(): TranslateFn;
|
|
278
|
+
|
|
279
|
+
export { builtInMessages, deepMergeMessages, en, ru, translate, useLocale, useT };
|
|
280
|
+
export type { DeepPartialMessages, LocaleCode, LocaleContextValue, MessageTree, Messages, PluralMessage, TranslateFn, TranslationParams };
|
package/types/entries/utils.d.ts
CHANGED
|
@@ -82,6 +82,74 @@ declare function getFormControlState(options: {
|
|
|
82
82
|
isInteractive: boolean;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
type PropertyPath = string | readonly (string | number)[];
|
|
86
|
+
declare function toPath(path: PropertyPath): string[];
|
|
87
|
+
declare function set<T>(source: T, path: PropertyPath, value: unknown): T;
|
|
88
|
+
|
|
89
|
+
declare const DEFAULT_DRAG_BLOCKED_SELECTOR: string;
|
|
90
|
+
declare const DEFAULT_PORTAL_SELECTOR: string;
|
|
91
|
+
declare function isEditableTarget(target: EventTarget | null): boolean;
|
|
92
|
+
declare function isDragBlockedTarget(target: EventTarget | null, selector: string): boolean;
|
|
93
|
+
declare function isOutsideFormInteraction(target: EventTarget | null, container: HTMLElement | null, portalSelector: string, classNamePart?: string): boolean;
|
|
94
|
+
|
|
95
|
+
type LocaleCode = 'ru' | 'en';
|
|
96
|
+
|
|
97
|
+
interface ZonedDateParts {
|
|
98
|
+
year: number;
|
|
99
|
+
month: number;
|
|
100
|
+
day: number;
|
|
101
|
+
hour: number;
|
|
102
|
+
minute: number;
|
|
103
|
+
second: number;
|
|
104
|
+
}
|
|
105
|
+
declare function getBrowserTimezone(): string;
|
|
106
|
+
declare function getSupportedTimezones(): string[];
|
|
107
|
+
declare function isValidTimeZone(timeZone: string): boolean;
|
|
108
|
+
declare function getZonedParts(date: Date, timeZone: string): ZonedDateParts | null;
|
|
109
|
+
declare function getTimezoneOffsetMinutes(timeZone: string, date?: Date): number | null;
|
|
110
|
+
declare function isSameZonedDay(a: Date, b: Date, timeZone: string): boolean;
|
|
111
|
+
declare function formatInTimeZone(date: Date, timeZone: string, locale: LocaleCode, options?: Intl.DateTimeFormatOptions): string;
|
|
112
|
+
declare function formatTimezoneOffset(timeZone: string, date?: Date): string;
|
|
113
|
+
declare function formatTimezoneLabel(timeZone: string): string;
|
|
114
|
+
|
|
115
|
+
type WeekStartsOn = 0 | 1;
|
|
116
|
+
type DateAddUnit = 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
117
|
+
declare function getWeekStart(date: Date, weekStartsOn?: WeekStartsOn): Date;
|
|
118
|
+
declare function getWeekDays(anchor: Date, weekStartsOn?: WeekStartsOn): Date[];
|
|
119
|
+
declare function addToDate(date: Date, amount: number, unit: DateAddUnit): Date;
|
|
120
|
+
declare function startOfDay(date: Date): Date;
|
|
121
|
+
declare function addDays(date: Date, days: number): Date;
|
|
122
|
+
declare function isSameDay(a: Date, b: Date): boolean;
|
|
123
|
+
declare function compareDay(a: Date, b: Date): number;
|
|
124
|
+
declare function parseLocalDate(value: string): Date | null;
|
|
125
|
+
declare function formatLocalDate(date: Date): string;
|
|
126
|
+
declare function formatHourLabel(hour: number, locale: LocaleCode): string;
|
|
127
|
+
declare function formatHourTime(hour: number): string;
|
|
128
|
+
|
|
129
|
+
declare const MINUTE_SECONDS = 60;
|
|
130
|
+
declare const HOUR_SECONDS: number;
|
|
131
|
+
declare const DAY_SECONDS: number;
|
|
132
|
+
declare const WEEK_SECONDS: number;
|
|
133
|
+
type DurationUnit = 'minute' | 'hour' | 'day' | 'week';
|
|
134
|
+
interface DurationUnitValue {
|
|
135
|
+
unit: DurationUnit;
|
|
136
|
+
value: number;
|
|
137
|
+
}
|
|
138
|
+
declare function secondsToUnit(seconds: number, unit: DurationUnit): number;
|
|
139
|
+
declare function unitToSeconds(value: number, unit: DurationUnit): number;
|
|
140
|
+
declare function getDurationUnitAndValue(seconds: number): DurationUnitValue;
|
|
141
|
+
|
|
142
|
+
declare function localeToBcp47(locale: LocaleCode): string;
|
|
143
|
+
|
|
144
|
+
interface PluralForms {
|
|
145
|
+
one: string;
|
|
146
|
+
few: string;
|
|
147
|
+
many: string;
|
|
148
|
+
}
|
|
149
|
+
declare function pluralRu(count: number, one: string, few: string, many: string): string;
|
|
150
|
+
declare function pluralEn(count: number, one: string, other: string): string;
|
|
151
|
+
declare function plural(locale: LocaleCode, count: number, forms: PluralForms): string;
|
|
152
|
+
|
|
85
153
|
type KeyboardShortcutParts = {
|
|
86
154
|
key: string;
|
|
87
155
|
mod: boolean;
|
|
@@ -118,12 +186,6 @@ declare function liveStatus(hidden: AriaHidden, label?: string): {
|
|
|
118
186
|
'aria-label'?: string;
|
|
119
187
|
};
|
|
120
188
|
|
|
121
|
-
type ControlTrackVariant = 'primary' | 'tinted' | 'secondary' | 'ghost' | 'plain' | 'link';
|
|
122
|
-
|
|
123
|
-
declare function controlTrackClassName(variant: ControlTrackVariant, options?: {
|
|
124
|
-
readOnly?: boolean;
|
|
125
|
-
}): string;
|
|
126
|
-
|
|
127
189
|
declare function mergeStyles(internal?: CSSProperties | null, external?: CSSProperties | null): CSSProperties | undefined;
|
|
128
190
|
|
|
129
191
|
type AnyProps = Record<string, unknown>;
|
|
@@ -171,5 +233,5 @@ type Density = 'default' | 'compact';
|
|
|
171
233
|
|
|
172
234
|
type SurfaceVariant = 'primary' | 'tinted' | 'secondary' | 'ghost' | 'plain';
|
|
173
235
|
|
|
174
|
-
export { OVERLAY_Z_INDEX_DEFAULT, OverlayStackProvider, SPACING_TOKEN_CSS, Slot, adjustElementHeight, clamp, clampToViewport, cn, composeEventHandlers, composeRefs, computeAnchorPosition,
|
|
175
|
-
export type { AnchorAlign, AnchorPositionResult, AnchorPositionStyle, AnchorSide,
|
|
236
|
+
export { DAY_SECONDS, DEFAULT_DRAG_BLOCKED_SELECTOR, DEFAULT_PORTAL_SELECTOR, HOUR_SECONDS, MINUTE_SECONDS, OVERLAY_Z_INDEX_DEFAULT, OverlayStackProvider, SPACING_TOKEN_CSS, Slot, WEEK_SECONDS, addDays, addToDate, adjustElementHeight, clamp, clampToViewport, cn, compareDay, composeEventHandlers, composeRefs, computeAnchorPosition, defaultListboxFilterFn, elevateAboveOverlayStack, filterListboxOptions, findEnabledListboxIndex, findListboxOption, flattenResolvedListboxGroups, formatAriaKeyShortcuts, formatBytes, formatHourLabel, formatHourTime, formatInTimeZone, formatKeyboardShortcut, formatLocalDate, formatTimezoneLabel, formatTimezoneOffset, getAnchorSideSpace, getBrowserTimezone, getDurationUnitAndValue, getFormControlState, getListboxDisplayValue, getListboxOptionDomId, getListboxOptionText, getListboxPath, getSupportedTimezones, getTextareaMinHeightPx, getTimezoneOffsetMinutes, getTranslateXFromTransform, getWeekDays, getWeekStart, getZonedParts, isDragBlockedTarget, isEditableTarget, isOutsideFormInteraction, isSameDay, isSameZonedDay, isValidTimeZone, liveStatus, localeToBcp47, matchListboxOption, matchesKeyboardShortcut, mergeSlotProps, mergeStyles, moveArrayItem, moveListboxHighlight, parseKeyboardShortcut, parseLocalDate, plural, pluralEn, pluralRu, renderChildren, resolveListboxGroups, resolveOverlayZIndex, resolvePreferredSide, resolveSpacingCss, resolveStackedOverlayZIndex, secondsToUnit, set, startOfDay, toCssSize, toPath, toggleSet, unitToSeconds, useOverlayStackZIndex };
|
|
237
|
+
export type { AnchorAlign, AnchorPositionResult, AnchorPositionStyle, AnchorSide, DateAddUnit, Density, DurationUnit, DurationUnitValue, EnrichedThroughChild, EnrichedThroughFn, GroupGap, KeyboardShortcutParts, ListboxFilterFn, ListboxGroup, ListboxOption, OverlayZIndexTier, PluralForms, PossibleRef, PropertyPath, RenderChildrenFn, RenderChildrenOptions, ResolvedListboxGroup, SlotProps, SpacingToken, SpacingValue, SurfaceVariant, WeekStartsOn, WithEnrichedChildren, ZonedDateParts };
|