@itguy614/clean-ui 1.2.2 → 1.3.1
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 +12 -0
- package/dist/clean-ui.css +1 -1
- package/dist/components/CuiAccordion.vue.js +2 -2
- package/dist/components/CuiAlert.vue.d.ts +3 -5
- package/dist/components/CuiAlert.vue.d.ts.map +1 -1
- package/dist/components/CuiAlert.vue.js +1 -1
- package/dist/components/CuiAlert.vue2.js +54 -50
- package/dist/components/CuiBadge.vue.js +3 -3
- package/dist/components/CuiBadge.vue2.js +23 -23
- package/dist/components/CuiBanner.vue.d.ts +15 -10
- package/dist/components/CuiBanner.vue.d.ts.map +1 -1
- package/dist/components/CuiBanner.vue.js +5 -80
- package/dist/components/CuiBanner.vue2.js +90 -2
- package/dist/components/CuiButton.vue.d.ts +9 -0
- package/dist/components/CuiButton.vue.d.ts.map +1 -1
- package/dist/components/CuiButton.vue.js +1 -1
- package/dist/components/CuiButton.vue2.js +77 -83
- package/dist/components/CuiButtonGroup.vue.d.ts +4 -2
- package/dist/components/CuiButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiButtonGroup.vue.js +1 -1
- package/dist/components/CuiButtonGroup.vue2.js +18 -9
- package/dist/components/CuiCard.vue.d.ts.map +1 -1
- package/dist/components/CuiCard.vue.js +5 -33
- package/dist/components/CuiCard.vue2.js +32 -2
- package/dist/components/CuiCardBody.vue.d.ts.map +1 -1
- package/dist/components/CuiCardBody.vue.js +5 -18
- package/dist/components/CuiCardBody.vue2.js +18 -2
- package/dist/components/CuiCardFooter.vue.d.ts.map +1 -1
- package/dist/components/CuiCardFooter.vue.js +5 -30
- package/dist/components/CuiCardFooter.vue2.js +25 -2
- package/dist/components/CuiCardHeader.vue.d.ts +5 -4
- package/dist/components/CuiCardHeader.vue.d.ts.map +1 -1
- package/dist/components/CuiCardHeader.vue.js +5 -49
- package/dist/components/CuiCardHeader.vue2.js +40 -2
- package/dist/components/CuiCardMedia.vue.d.ts.map +1 -1
- package/dist/components/CuiCardMedia.vue.js +3 -3
- package/dist/components/CuiCardMedia.vue2.js +6 -6
- package/dist/components/CuiCheckbox.vue.d.ts +2 -2
- package/dist/components/CuiCheckbox.vue.d.ts.map +1 -1
- package/dist/components/CuiCheckbox.vue.js +1 -1
- package/dist/components/CuiCheckbox.vue2.js +46 -34
- package/dist/components/CuiCheckboxGroup.vue.d.ts +2 -2
- package/dist/components/CuiCheckboxGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiCheckboxGroup.vue.js +2 -2
- package/dist/components/CuiCheckboxGroup.vue2.js +45 -35
- package/dist/components/CuiCodeBlock.vue.d.ts.map +1 -1
- package/dist/components/CuiCodeBlock.vue.js +14 -11
- package/dist/components/CuiColorPicker.vue.d.ts +2 -2
- package/dist/components/CuiColorPicker.vue.d.ts.map +1 -1
- package/dist/components/CuiColorPicker.vue.js +117 -104
- package/dist/components/CuiCombobox.vue.d.ts +2 -2
- package/dist/components/CuiCombobox.vue.d.ts.map +1 -1
- package/dist/components/CuiCombobox.vue.js +5 -330
- package/dist/components/CuiCombobox.vue2.js +330 -2
- package/dist/components/CuiConfirmDialog.vue.d.ts +5 -4
- package/dist/components/CuiConfirmDialog.vue.d.ts.map +1 -1
- package/dist/components/CuiConfirmDialog.vue.js +84 -73
- package/dist/components/CuiContextMenu.vue.d.ts +40 -1
- package/dist/components/CuiContextMenu.vue.d.ts.map +1 -1
- package/dist/components/CuiContextMenu.vue.js +1 -1
- package/dist/components/CuiContextMenu.vue2.js +149 -91
- package/dist/components/CuiCopyButton.vue.d.ts.map +1 -1
- package/dist/components/CuiCopyButton.vue.js +5 -61
- package/dist/components/CuiCopyButton.vue2.js +68 -2
- package/dist/components/CuiDataGridCardView.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridCardView.vue.js +10 -9
- package/dist/components/CuiDataGridColumnManager.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridColumnManager.vue.js +12 -11
- package/dist/components/CuiDataGridPagination.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridPagination.vue.js +9 -8
- package/dist/components/CuiDataGridSearch.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridSearch.vue.js +12 -9
- package/dist/components/CuiDataGridTable.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridTable.vue.js +213 -190
- package/dist/components/CuiDataGridViewManager.vue.d.ts.map +1 -1
- package/dist/components/CuiDataGridViewManager.vue.js +21 -20
- package/dist/components/CuiDatePicker.vue.d.ts +2 -2
- package/dist/components/CuiDatePicker.vue.d.ts.map +1 -1
- package/dist/components/CuiDatePicker.vue.js +257 -173
- package/dist/components/CuiDateRangePicker.vue.d.ts +2 -2
- package/dist/components/CuiDateRangePicker.vue.d.ts.map +1 -1
- package/dist/components/CuiDateRangePicker.vue.js +262 -179
- package/dist/components/CuiDivider.vue.d.ts +1 -3
- package/dist/components/CuiDivider.vue.d.ts.map +1 -1
- package/dist/components/CuiDivider.vue.js +47 -59
- package/dist/components/CuiDropdownMenu.vue.js +2 -2
- package/dist/components/CuiDropdownRadioGroup.vue.d.ts +4 -1
- package/dist/components/CuiDropdownRadioGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiDropdownRadioGroup.vue.js +27 -14
- package/dist/components/CuiDropdownSub.vue.js +2 -2
- package/dist/components/CuiEmptyState.vue.d.ts +5 -4
- package/dist/components/CuiEmptyState.vue.d.ts.map +1 -1
- package/dist/components/CuiEmptyState.vue.js +1 -1
- package/dist/components/CuiEmptyState.vue2.js +30 -24
- package/dist/components/CuiFieldset.vue.d.ts.map +1 -1
- package/dist/components/CuiFieldset.vue.js +1 -1
- package/dist/components/CuiFieldset.vue2.js +21 -21
- package/dist/components/CuiFileUpload.vue.d.ts +2 -2
- package/dist/components/CuiFileUpload.vue.d.ts.map +1 -1
- package/dist/components/CuiFileUpload.vue.js +70 -57
- package/dist/components/CuiFormField.vue.d.ts.map +1 -1
- package/dist/components/CuiFormField.vue.js +2 -2
- package/dist/components/CuiFormField.vue2.js +48 -42
- package/dist/components/CuiInput.vue.d.ts +2 -2
- package/dist/components/CuiInput.vue.d.ts.map +1 -1
- package/dist/components/CuiInput.vue.js +1 -1
- package/dist/components/CuiInput.vue2.js +97 -85
- package/dist/components/CuiInputStepper.vue.d.ts +2 -2
- package/dist/components/CuiInputStepper.vue.d.ts.map +1 -1
- package/dist/components/CuiInputStepper.vue.js +5 -187
- package/dist/components/CuiInputStepper.vue2.js +237 -2
- package/dist/components/CuiKbd.vue.d.ts.map +1 -1
- package/dist/components/CuiKbd.vue.js +6 -5
- package/dist/components/CuiMaskedInput.vue.d.ts +9 -3
- package/dist/components/CuiMaskedInput.vue.d.ts.map +1 -1
- package/dist/components/CuiMaskedInput.vue.js +132 -117
- package/dist/components/CuiModal.vue.d.ts +10 -2
- package/dist/components/CuiModal.vue.d.ts.map +1 -1
- package/dist/components/CuiModal.vue.js +2 -2
- package/dist/components/CuiModal.vue2.js +48 -44
- package/dist/components/CuiModalBody.vue.d.ts.map +1 -1
- package/dist/components/CuiModalBody.vue.js +16 -13
- package/dist/components/CuiModalFooter.vue.d.ts.map +1 -1
- package/dist/components/CuiModalFooter.vue.js +3 -2
- package/dist/components/CuiModalHeader.vue.d.ts +13 -4
- package/dist/components/CuiModalHeader.vue.d.ts.map +1 -1
- package/dist/components/CuiModalHeader.vue.js +54 -42
- package/dist/components/CuiPagination.vue.d.ts.map +1 -1
- package/dist/components/CuiPagination.vue.js +1 -1
- package/dist/components/CuiPagination.vue2.js +28 -25
- package/dist/components/CuiPopover.vue.d.ts.map +1 -1
- package/dist/components/CuiPopover.vue.js +80 -72
- package/dist/components/CuiRadio.vue.d.ts +2 -4
- package/dist/components/CuiRadio.vue.d.ts.map +1 -1
- package/dist/components/CuiRadio.vue.js +2 -2
- package/dist/components/CuiRadio.vue2.js +88 -74
- package/dist/components/CuiRadioGroup.vue.d.ts +2 -2
- package/dist/components/CuiRadioGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiRadioGroup.vue.js +3 -3
- package/dist/components/CuiRadioGroup.vue2.js +47 -37
- package/dist/components/CuiRating.vue.d.ts.map +1 -1
- package/dist/components/CuiRating.vue.js +15 -14
- package/dist/components/CuiResizablePanels.vue.d.ts.map +1 -1
- package/dist/components/CuiResizablePanels.vue.js +10 -9
- package/dist/components/CuiSelect.vue.d.ts +2 -2
- package/dist/components/CuiSelect.vue.d.ts.map +1 -1
- package/dist/components/CuiSelect.vue.js +2 -2
- package/dist/components/CuiSelect.vue2.js +161 -151
- package/dist/components/CuiSkeleton.vue.js +2 -2
- package/dist/components/CuiSkeleton.vue2.js +10 -10
- package/dist/components/CuiSlideover.vue.d.ts +2 -2
- package/dist/components/CuiSlideover.vue.d.ts.map +1 -1
- package/dist/components/CuiSlideover.vue.js +34 -30
- package/dist/components/CuiSlider.vue.d.ts +2 -2
- package/dist/components/CuiSlider.vue.d.ts.map +1 -1
- package/dist/components/CuiSlider.vue.js +5 -154
- package/dist/components/CuiSlider.vue2.js +171 -2
- package/dist/components/CuiSpinner.vue.d.ts.map +1 -1
- package/dist/components/CuiSpinner.vue.js +5 -4
- package/dist/components/CuiTable.vue.d.ts.map +1 -1
- package/dist/components/CuiTable.vue.js +4 -1
- package/dist/components/CuiTableBody.vue.d.ts.map +1 -1
- package/dist/components/CuiTableBody.vue.js +6 -6
- package/dist/components/CuiTableCell.vue.d.ts.map +1 -1
- package/dist/components/CuiTableCell.vue.js +11 -10
- package/dist/components/CuiTableFoot.vue.d.ts.map +1 -1
- package/dist/components/CuiTableFoot.vue.js +7 -7
- package/dist/components/CuiTableHead.vue.d.ts.map +1 -1
- package/dist/components/CuiTableHead.vue.js +7 -7
- package/dist/components/CuiTabs.vue.d.ts.map +1 -1
- package/dist/components/CuiTabs.vue.js +2 -2
- package/dist/components/CuiTabs.vue2.js +81 -76
- package/dist/components/CuiTagInput.vue.d.ts +2 -2
- package/dist/components/CuiTagInput.vue.d.ts.map +1 -1
- package/dist/components/CuiTagInput.vue.js +5 -294
- package/dist/components/CuiTagInput.vue2.js +276 -2
- package/dist/components/CuiTextarea.vue.d.ts +2 -2
- package/dist/components/CuiTextarea.vue.d.ts.map +1 -1
- package/dist/components/CuiTextarea.vue.js +4 -4
- package/dist/components/CuiTextarea.vue2.js +73 -59
- package/dist/components/CuiTimePicker.vue.d.ts +2 -2
- package/dist/components/CuiTimePicker.vue.d.ts.map +1 -1
- package/dist/components/CuiTimePicker.vue.js +172 -97
- package/dist/components/CuiTimeline.vue.d.ts.map +1 -1
- package/dist/components/CuiTimeline.vue.js +6 -5
- package/dist/components/CuiTimelineItem.vue.d.ts.map +1 -1
- package/dist/components/CuiTimelineItem.vue.js +11 -10
- package/dist/components/CuiToast.vue.d.ts +8 -10
- package/dist/components/CuiToast.vue.d.ts.map +1 -1
- package/dist/components/CuiToast.vue.js +2 -2
- package/dist/components/CuiToast.vue2.js +69 -67
- package/dist/components/CuiToggle.vue.d.ts +2 -2
- package/dist/components/CuiToggle.vue.d.ts.map +1 -1
- package/dist/components/CuiToggle.vue.js +2 -2
- package/dist/components/CuiToggle.vue2.js +71 -59
- package/dist/components/CuiToggleGroup.vue.d.ts +2 -2
- package/dist/components/CuiToggleGroup.vue.d.ts.map +1 -1
- package/dist/components/CuiToggleGroup.vue.js +2 -2
- package/dist/components/CuiToggleGroup.vue2.js +45 -35
- package/dist/components/CuiTooltip.vue.d.ts.map +1 -1
- package/dist/components/CuiTooltip.vue.js +2 -2
- package/dist/components/CuiTooltip.vue2.js +49 -45
- package/dist/components/CuiTransferList.vue.d.ts.map +1 -1
- package/dist/components/CuiTransferList.vue.js +31 -30
- package/dist/components/CuiTreeNode.vue.d.ts +9 -2
- package/dist/components/CuiTreeNode.vue.d.ts.map +1 -1
- package/dist/components/CuiTreeNode.vue.js +5 -179
- package/dist/components/CuiTreeNode.vue2.js +198 -2
- package/dist/components/CuiTreeView.vue.d.ts +33 -5
- package/dist/components/CuiTreeView.vue.d.ts.map +1 -1
- package/dist/components/CuiTreeView.vue.js +187 -44
- package/dist/composables/useCalendarKeyboard.d.ts +48 -0
- package/dist/composables/useCalendarKeyboard.d.ts.map +1 -0
- package/dist/composables/useCalendarKeyboard.js +91 -0
- package/dist/composables/useFieldDescribedBy.d.ts +30 -0
- package/dist/composables/useFieldDescribedBy.d.ts.map +1 -0
- package/dist/composables/useFieldDescribedBy.js +11 -0
- package/dist/composables/useMessages.d.ts.map +1 -1
- package/dist/composables/useMessages.js +6 -6
- package/dist/composables/usePopover.d.ts.map +1 -1
- package/dist/composables/usePopover.js +10 -0
- package/dist/composables/useScrollShadows.d.ts +3 -0
- package/dist/composables/useScrollShadows.d.ts.map +1 -1
- package/dist/composables/useScrollShadows.js +15 -12
- package/dist/icons/builtin.d.ts.map +1 -1
- package/dist/icons/builtin.js +38 -37
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +185 -182
- package/dist/messages.d.ts +39 -4
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +8 -7
- package/dist/types/common.d.ts +90 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/utils/colorIconMap.d.ts +47 -3
- package/dist/utils/colorIconMap.d.ts.map +1 -1
- package/dist/utils/colorIconMap.js +20 -5
- package/dist/utils/date.d.ts +13 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +46 -40
- package/dist/utils/sizing.d.ts +26 -1
- package/dist/utils/sizing.d.ts.map +1 -1
- package/dist/utils/sizing.js +22 -21
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/types/common.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export type CuiVariant = "solid" | "outline" | "subtle" | "ghost" | "dash";
|
|
|
16
16
|
/** A color value that accepts a role (mapped to its token) OR any raw CSS
|
|
17
17
|
* color string. Used by paint components (Icon, Divider, Backdrop). */
|
|
18
18
|
export type CuiColorOrCss = CuiColor | (string & {});
|
|
19
|
+
/**
|
|
20
|
+
* Element a component's title renders as — a heading level, or `div` to opt out.
|
|
21
|
+
*
|
|
22
|
+
* Shared by every component with a `title` convenience prop (`CuiCardHeader`,
|
|
23
|
+
* `CuiModalHeader`, `CuiConfirmDialog`), so the vocabulary stays one thing.
|
|
24
|
+
*/
|
|
25
|
+
export type CuiTitleAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div";
|
|
19
26
|
/** Every component can be hidden via `v-show`. */
|
|
20
27
|
export interface HideableProps {
|
|
21
28
|
/** Hide the component (v-show) */
|
|
@@ -45,6 +52,37 @@ export interface DisableableProps {
|
|
|
45
52
|
*/
|
|
46
53
|
export type LiveRegionMode = "off" | "polite" | "assertive";
|
|
47
54
|
/** Components that announce to screen readers via an ARIA live region. */
|
|
55
|
+
/**
|
|
56
|
+
* The role icon on a feedback component — CuiAlert, CuiToast, CuiBanner. Alongside an
|
|
57
|
+
* `#icon` slot, which replaces the icon with arbitrary content.
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* For components whose `title` prop renders a heading.
|
|
61
|
+
*
|
|
62
|
+
* A title that looks like a heading should be one — a `<div>` is invisible to heading
|
|
63
|
+
* navigation and absent from the document outline (#129). The right *level* depends on
|
|
64
|
+
* where the component sits, which the component cannot know, so it is the caller's:
|
|
65
|
+
* `h2` under a page `h1`, `h4` inside an `h3` section. `div` opts out for a title that
|
|
66
|
+
* is decorative rather than structural.
|
|
67
|
+
*
|
|
68
|
+
* Each component sets its own default in `withDefaults` — `h3` for a card, `h2` for a
|
|
69
|
+
* dialog, which starts a fresh accessible context.
|
|
70
|
+
*/
|
|
71
|
+
export interface TitleAsProps {
|
|
72
|
+
/** Element the title renders as. See {@link CuiTitleAs}. */
|
|
73
|
+
titleAs?: CuiTitleAs;
|
|
74
|
+
}
|
|
75
|
+
export interface RoleIconProps {
|
|
76
|
+
/**
|
|
77
|
+
* Replace the role icon. A name in the static icon registry (built-ins plus
|
|
78
|
+
* `registerIcons()`) renders that icon; anything else — an emoji, a character —
|
|
79
|
+
* renders as text. A name resolvable only through the optional lazy resolver is not
|
|
80
|
+
* known statically and renders as text.
|
|
81
|
+
*/
|
|
82
|
+
icon?: string;
|
|
83
|
+
/** Hide the role icon entirely. */
|
|
84
|
+
noIcon?: boolean;
|
|
85
|
+
}
|
|
48
86
|
export interface LiveRegionProps {
|
|
49
87
|
/**
|
|
50
88
|
* Screen-reader live-region mode. Defaults from `color`: `error` → assertive
|
|
@@ -68,4 +106,56 @@ export interface FormControlProps extends DisableableProps {
|
|
|
68
106
|
/** Readonly state */
|
|
69
107
|
readonly?: boolean;
|
|
70
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Attributes that belong on a form control's **native focusable element**, not
|
|
111
|
+
* on its wrapper.
|
|
112
|
+
*
|
|
113
|
+
* Without these declared as props, Vue's attribute fallthrough drops them on
|
|
114
|
+
* the component's single root — `.cui-input-wrapper`, `.cui-select`, and so on
|
|
115
|
+
* — which is a plain `<div>`. A `<label for>` then points at something that
|
|
116
|
+
* cannot be focused or labelled, so clicking the label does nothing and screen
|
|
117
|
+
* readers never form the label/control association (#78). `name` and
|
|
118
|
+
* `autocomplete` are equally useless on a wrapper: the browser only reads them
|
|
119
|
+
* off a real form control.
|
|
120
|
+
*
|
|
121
|
+
* Declaring them here takes them out of `$attrs`, so they stop landing on the
|
|
122
|
+
* wrapper and the component binds them where they belong. `class` and `style`
|
|
123
|
+
* still fall through to the wrapper, which is where consumers expect them.
|
|
124
|
+
*
|
|
125
|
+
* `CuiFormField` supplies `id`, `ariaDescribedby` and `ariaLabelledby` through
|
|
126
|
+
* its slot bindings, so `v-bind="f"` wires all of this up on its own.
|
|
127
|
+
*/
|
|
128
|
+
export interface AriaLabelableProps {
|
|
129
|
+
/** id of the element — what a `<label for>` has to point at, where it can. */
|
|
130
|
+
id?: string;
|
|
131
|
+
/** id(s) of the text describing this control — help text, error message. */
|
|
132
|
+
ariaDescribedby?: string;
|
|
133
|
+
/**
|
|
134
|
+
* id(s) of the element labelling this control.
|
|
135
|
+
*
|
|
136
|
+
* The only way to name something `<label for>` cannot reach: a group has no
|
|
137
|
+
* single control to point at, and `CuiSelect`'s trigger is a
|
|
138
|
+
* `div[role="combobox"]`, which is not a *labelable* element. `for`/`id`
|
|
139
|
+
* silently forms no association with either, so without this they are unnamed.
|
|
140
|
+
*/
|
|
141
|
+
ariaLabelledby?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Marks the control as required for assistive tech.
|
|
144
|
+
*
|
|
145
|
+
* `CuiFormField`'s visible marker is an asterisk, which is decorative and `aria-hidden`,
|
|
146
|
+
* so required-ness reached assistive tech through no path at all (#175). This rides the
|
|
147
|
+
* same plumbing as `ariaDescribedby`: declared once here, inherited by every control, and
|
|
148
|
+
* supplied automatically by `CuiFormField`.
|
|
149
|
+
*
|
|
150
|
+
* Deliberately `aria-required` rather than the native `required` attribute — the latter
|
|
151
|
+
* switches on browser validation and would change form behaviour, not just announce it.
|
|
152
|
+
*/
|
|
153
|
+
ariaRequired?: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface NativeControlProps extends AriaLabelableProps {
|
|
156
|
+
/** Native control name, for form serialization and browser autofill. */
|
|
157
|
+
name?: string;
|
|
158
|
+
/** Native autocomplete hint, e.g. `"email"`, `"street-address"`, `"off"`. */
|
|
159
|
+
autocomplete?: string;
|
|
160
|
+
}
|
|
71
161
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAKA;wCACwC;AACxC,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,WAAW,GACX,SAAS,GACT,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,eAAe,GACf,cAAc,CAAC;AAEnB;2CAC2C;AAC3C,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvD,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,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ACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1,6 +1,50 @@
|
|
|
1
|
+
import type { CuiColor } from "../types/common";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* Default icon per color role, for CuiAlert, CuiToast and CuiBanner.
|
|
4
|
+
*
|
|
5
|
+
* `error` is an octagon rather than an ✕ (which reads as "close") and rather than
|
|
6
|
+
* `warning-circle` (which would leave hue as the only thing separating the two roles).
|
|
7
|
+
* `components/__tests__/feedbackRoleIcon.test.ts` holds that invariant.
|
|
8
|
+
*
|
|
9
|
+
* These are the defaults, not the answer: `registerRoleIcons()` overrides them app-wide.
|
|
4
10
|
*/
|
|
5
|
-
export declare const COLOR_ICON_MAP: Record<
|
|
11
|
+
export declare const COLOR_ICON_MAP: Record<CuiColor, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Override the icon a color role renders in CuiAlert, CuiToast and CuiBanner.
|
|
14
|
+
*
|
|
15
|
+
* Role → icon is a theme concern in the same way role → colour is, and colours are
|
|
16
|
+
* overridable at the root. Without this, a design language with its own error glyph had
|
|
17
|
+
* to pass `icon` at every single feedback component in the app (#140).
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* registerRoleIcons({ error: "siren", success: "seal-check" });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Reactive, so a call after mount re-renders. Names are resolved the same way the `icon`
|
|
24
|
+
* prop is — see {@link resolveRoleIcon} — so an unregistered name renders as text rather
|
|
25
|
+
* than as a `?` glyph.
|
|
26
|
+
*/
|
|
27
|
+
export declare function registerRoleIcons(icons: Partial<Record<CuiColor, string>>): void;
|
|
28
|
+
/** Test seam: drop app-level overrides, leaving the library defaults. */
|
|
29
|
+
export declare function __clearRoleIcons(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve the icon a feedback component should render, from its color role and an
|
|
32
|
+
* optional `icon` override.
|
|
33
|
+
*
|
|
34
|
+
* - explicit override naming a registered icon → that icon
|
|
35
|
+
* - explicit override that is anything else → rendered as literal text
|
|
36
|
+
* - otherwise → the role's icon: `registerRoleIcons()` first, then the library default
|
|
37
|
+
*
|
|
38
|
+
* The text branch exists because `CuiToast.icon` has always taken an emoji or a character
|
|
39
|
+
* and a programmatic toast has no slot to fall back on, so one prop had to cover both.
|
|
40
|
+
*
|
|
41
|
+
* The discriminator is the STATIC registry — built-ins plus `registerIcons()`. A name that
|
|
42
|
+
* only resolves through the optional lazy resolver (`@itguy614/clean-ui/icons/lazy`) is
|
|
43
|
+
* not known here and renders as text. Mirrors `resolveLiveRegion` in shape: a pure
|
|
44
|
+
* resolver the components read once (#119).
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveRoleIcon(icon: string | undefined, color: CuiColor): {
|
|
47
|
+
name: string | null;
|
|
48
|
+
text: string | null;
|
|
49
|
+
};
|
|
6
50
|
//# sourceMappingURL=colorIconMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorIconMap.d.ts","sourceRoot":"","sources":["../../src/utils/colorIconMap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colorIconMap.d.ts","sourceRoot":"","sources":["../../src/utils/colorIconMap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAUnD,CAAC;AAKF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAEhF;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,QAAQ,GACd;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAK9C"}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
import { shallowReactive as i } from "vue";
|
|
2
|
+
import { hasIcon as o } from "../icons/registry.js";
|
|
1
3
|
const c = {
|
|
4
|
+
primary: "info",
|
|
5
|
+
secondary: "info",
|
|
2
6
|
success: "check-circle",
|
|
3
|
-
error: "
|
|
7
|
+
error: "warning-octagon",
|
|
4
8
|
warning: "warning-circle",
|
|
5
9
|
info: "info",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
surface: "info",
|
|
11
|
+
"surface-light": "info",
|
|
12
|
+
"surface-dark": "info"
|
|
13
|
+
}, t = i({});
|
|
14
|
+
function f(n) {
|
|
15
|
+
Object.assign(t, n);
|
|
16
|
+
}
|
|
17
|
+
function l(n, r) {
|
|
18
|
+
if (n) return o(n) ? { name: n, text: null } : { name: null, text: n };
|
|
19
|
+
const e = t[r] ?? c[r] ?? "info";
|
|
20
|
+
return o(e) ? { name: e, text: null } : { name: null, text: e };
|
|
21
|
+
}
|
|
9
22
|
export {
|
|
10
|
-
c as COLOR_ICON_MAP
|
|
23
|
+
c as COLOR_ICON_MAP,
|
|
24
|
+
f as registerRoleIcons,
|
|
25
|
+
l as resolveRoleIcon
|
|
11
26
|
};
|
package/dist/utils/date.d.ts
CHANGED
|
@@ -7,6 +7,19 @@ export declare function daysInMonth(year: number, month: number): number;
|
|
|
7
7
|
/** Get day of week for first day of month (0=Sun) */
|
|
8
8
|
export declare function firstDayOfMonth(year: number, month: number): number;
|
|
9
9
|
/** Check if two dates are the same calendar day */
|
|
10
|
+
/** How many years one page of a year picker shows. */
|
|
11
|
+
export declare const YEARS_PER_PAGE = 12;
|
|
12
|
+
/**
|
|
13
|
+
* Calendar arithmetic. Here rather than private to a component so the next
|
|
14
|
+
* picker doesn't hand-roll its own — this file is already the home for
|
|
15
|
+
* `daysInMonth`, `firstDayOfMonth` and friends. Date's constructor normalises
|
|
16
|
+
* overflow for us, so adding 1 to 31 January lands on 1 February.
|
|
17
|
+
*/
|
|
18
|
+
export declare const addDays: (date: Date, days: number) => Date;
|
|
19
|
+
export declare const addMonths: (date: Date, months: number) => Date;
|
|
20
|
+
export declare const addYears: (date: Date, years: number) => Date;
|
|
21
|
+
/** First year of the page `date` falls in, for a year grid. */
|
|
22
|
+
export declare const yearPageStart: (year: number, perPage?: number) => number;
|
|
10
23
|
export declare function isSameDay(a: Date, b: Date): boolean;
|
|
11
24
|
/** Check if a date is today */
|
|
12
25
|
export declare function isToday(d: Date): boolean;
|
package/dist/utils/date.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,eAAO,MAAM,WAAW,UAGvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAG7B,CAAC;AAEF,eAAO,MAAM,eAAe,UAA6C,CAAC;AAE1E,oCAAoC;AACpC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MA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M,CAUnD;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAMlD;AAED,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAK5C;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,kCAAkC;AAClC,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;IACJ,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACvC,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,iBAAiB,CAAC,EAAE,CAAC;CAChD,GACA,OAAO,CAeT"}
|
package/dist/utils/date.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const f = [
|
|
2
2
|
"January",
|
|
3
3
|
"February",
|
|
4
4
|
"March",
|
|
@@ -11,7 +11,7 @@ const D = [
|
|
|
11
11
|
"October",
|
|
12
12
|
"November",
|
|
13
13
|
"December"
|
|
14
|
-
],
|
|
14
|
+
], g = [
|
|
15
15
|
"Jan",
|
|
16
16
|
"Feb",
|
|
17
17
|
"Mar",
|
|
@@ -24,57 +24,58 @@ const D = [
|
|
|
24
24
|
"Oct",
|
|
25
25
|
"Nov",
|
|
26
26
|
"Dec"
|
|
27
|
-
],
|
|
28
|
-
function
|
|
27
|
+
], h = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
28
|
+
function S(e, t) {
|
|
29
29
|
return new Date(e, t + 1, 0).getDate();
|
|
30
30
|
}
|
|
31
31
|
function A(e, t) {
|
|
32
32
|
return new Date(e, t, 1).getDay();
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
const p = 12, y = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t), m = (e, t) => new Date(e.getFullYear(), e.getMonth() + t, e.getDate()), O = (e, t) => new Date(e.getFullYear() + t, e.getMonth(), e.getDate()), N = (e, t = p) => Math.floor(e / t) * t;
|
|
35
|
+
function Y(e, t) {
|
|
35
36
|
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
38
|
+
function T(e) {
|
|
39
|
+
return Y(e, /* @__PURE__ */ new Date());
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
const r = e.getFullYear(), n = e.getMonth(),
|
|
42
|
-
return t.replace("YYYY", String(r)).replace("YY", String(r).slice(-2)).replace("MMMM",
|
|
41
|
+
function w(e, t) {
|
|
42
|
+
const r = e.getFullYear(), n = e.getMonth(), c = e.getDate();
|
|
43
|
+
return t.replace("YYYY", String(r)).replace("YY", String(r).slice(-2)).replace("MMMM", f[n]).replace("MMM", g[n]).replace("MM", String(n + 1).padStart(2, "0")).replace(new RegExp("(?<!M)M(?!M)"), String(n + 1)).replace("DD", String(c).padStart(2, "0")).replace(new RegExp("(?<!D)D(?!D)"), String(c));
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function x(e, t) {
|
|
45
46
|
if (!e || !t) return null;
|
|
46
|
-
let r = -1, n = -1,
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const a = e.slice(
|
|
47
|
+
let r = -1, n = -1, c = 1;
|
|
48
|
+
const i = t.indexOf("YYYY"), s = i === -1 ? t.indexOf("YY") : -1, M = t.indexOf("MMMM"), o = M === -1 ? t.indexOf("MMM") : -1, l = M === -1 && o === -1 ? t.indexOf("MM") : -1, u = t.indexOf("DD");
|
|
49
|
+
if (i !== -1) {
|
|
50
|
+
const a = e.slice(i, i + 4);
|
|
50
51
|
r = parseInt(a, 10);
|
|
51
|
-
} else if (
|
|
52
|
-
const a = e.slice(
|
|
52
|
+
} else if (s !== -1) {
|
|
53
|
+
const a = e.slice(s, s + 2);
|
|
53
54
|
r = 2e3 + parseInt(a, 10);
|
|
54
55
|
}
|
|
55
56
|
if (l !== -1) {
|
|
56
57
|
const a = e.slice(l, l + 2);
|
|
57
58
|
n = parseInt(a, 10) - 1;
|
|
58
|
-
} else if (
|
|
59
|
-
const a = e.slice(
|
|
60
|
-
n =
|
|
59
|
+
} else if (o !== -1) {
|
|
60
|
+
const a = e.slice(o, o + 3);
|
|
61
|
+
n = g.findIndex((D) => D.toLowerCase() === a.toLowerCase());
|
|
61
62
|
} else if (M !== -1) {
|
|
62
|
-
const a =
|
|
63
|
-
a && (n =
|
|
63
|
+
const a = f.find((D) => e.includes(D));
|
|
64
|
+
a && (n = f.indexOf(a));
|
|
64
65
|
}
|
|
65
66
|
if (u !== -1) {
|
|
66
67
|
const a = e.slice(u, u + 2);
|
|
67
|
-
|
|
68
|
+
c = parseInt(a, 10);
|
|
68
69
|
}
|
|
69
|
-
return isNaN(r) || r < 0 || n < 0 || n > 11 || isNaN(
|
|
70
|
+
return isNaN(r) || r < 0 || n < 0 || n > 11 || isNaN(c) ? null : new Date(r, n, c);
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function F(e) {
|
|
72
73
|
return e.replace("YYYY", "####").replace("YY", "##").replace("MMMM", "AAAAAAAAAA").replace("MMM", "AAA").replace("MM", "##").replace(new RegExp("(?<!#)M(?!M)"), "##").replace("DD", "##").replace(new RegExp("(?<!#)D(?!D)"), "##");
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
+
function I(e) {
|
|
75
76
|
return e.replace(/[^0-9a-zA-Z]/g, "");
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function b(e) {
|
|
78
79
|
if (!e) return null;
|
|
79
80
|
const t = e.split("-");
|
|
80
81
|
if (t.length < 3) return null;
|
|
@@ -85,7 +86,7 @@ function d(e) {
|
|
|
85
86
|
const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
|
|
86
87
|
return `${t}-${r}-${n}`;
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function _(e, t) {
|
|
89
90
|
if (t.minDate && e < t.minDate || t.maxDate && e > t.maxDate || t.disabledDate && t.disabledDate(e)) return !0;
|
|
90
91
|
if (t.disabledDates) {
|
|
91
92
|
const r = d(e);
|
|
@@ -97,18 +98,23 @@ function x(e, t) {
|
|
|
97
98
|
return !1;
|
|
98
99
|
}
|
|
99
100
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
h as DAY_NAMES_SHORT,
|
|
102
|
+
f as MONTH_NAMES,
|
|
103
|
+
g as MONTH_NAMES_SHORT,
|
|
104
|
+
p as YEARS_PER_PAGE,
|
|
105
|
+
y as addDays,
|
|
106
|
+
m as addMonths,
|
|
107
|
+
O as addYears,
|
|
103
108
|
d as dateToIso,
|
|
104
|
-
|
|
109
|
+
S as daysInMonth,
|
|
105
110
|
A as firstDayOfMonth,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
w as formatDate,
|
|
112
|
+
F as formatToMask,
|
|
113
|
+
I as formatToRaw,
|
|
114
|
+
_ as isDateDisabled,
|
|
115
|
+
Y as isSameDay,
|
|
116
|
+
T as isToday,
|
|
117
|
+
b as isoToDate,
|
|
118
|
+
x as parseFormattedDate,
|
|
119
|
+
N as yearPageStart
|
|
114
120
|
};
|
package/dist/utils/sizing.d.ts
CHANGED
|
@@ -29,8 +29,33 @@ export interface ButtonSizeStyle extends SizeStyle {
|
|
|
29
29
|
* Use this in JS-emitted size maps instead of hand-writing the calc() string.
|
|
30
30
|
*/
|
|
31
31
|
export declare const scaleDensity: (v: string) => string;
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Like {@link scaleDensity} but floored at the minimum touch target — for interactive
|
|
34
|
+
* control heights.
|
|
35
|
+
*
|
|
36
|
+
* The floor is `--cui-control-min-target`, defaulting to the 24px of WCAG 2.5.8. It is a
|
|
37
|
+
* custom property so that going below the minimum is a deliberate, greppable act rather
|
|
38
|
+
* than an accident: set it on a container and every control inside relaxes together, which
|
|
39
|
+
* is the realistic case (a dense toolbar holds buttons *and* inputs). At the shipped sizes
|
|
40
|
+
* the floor only actually binds at `xs` + compact density.
|
|
41
|
+
*/
|
|
33
42
|
export declare const scaleControlHeight: (v: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* The size one step down the scale — for a control nested inside another, where matching
|
|
45
|
+
* the parent's size would crowd it: the tag chips inside a combobox or tag input, the
|
|
46
|
+
* +/- buttons inside an input stepper. `xs` has nowhere lower to go and stays `xs`.
|
|
47
|
+
*
|
|
48
|
+
* This is the only sizing concept those three composite controls genuinely shared; the
|
|
49
|
+
* rest of what their private tables carried derives from `INPUT_SIZE_SCALE` (#123).
|
|
50
|
+
*/
|
|
51
|
+
export declare const nestedSize: (size: CuiSize) => CuiSize;
|
|
52
|
+
/**
|
|
53
|
+
* Horizontal padding was rebalanced in #123/#124: `md` was 1rem (16px), equal to its own
|
|
54
|
+
* font size, which read as a lot of dead space beside a short value and sat well above
|
|
55
|
+
* comparable systems. The whole curve moved rather than just `md`, because dropping `md`
|
|
56
|
+
* alone to 12px would have made it identical to `sm` and flattened the two most-used
|
|
57
|
+
* steps. Heights and font sizes are unchanged.
|
|
58
|
+
*/
|
|
34
59
|
export declare const INPUT_SIZE_SCALE: Record<string, SizeStyle>;
|
|
35
60
|
export declare const BUTTON_SIZE_SCALE: Record<string, ButtonSizeStyle>;
|
|
36
61
|
export declare const TEXTAREA_SIZE_SCALE: Record<string, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizing.d.ts","sourceRoot":"","sources":["../../src/utils/sizing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,gEAAgE;AAChE,eAAO,MAAM,UAAU,EAAE,SAAS,OAAO,EAAmC,CAAC;AAE7E;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EACzC,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,SAAS,CAAC,EAAE,GACtB,CAAC,CAaH;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,GAAG,EAAE,MAAM,CAAC;CACb;AAQD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAAyB,CAAC;AAChE
|
|
1
|
+
{"version":3,"file":"sizing.d.ts","sourceRoot":"","sources":["../../src/utils/sizing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,gEAAgE;AAChE,eAAO,MAAM,UAAU,EAAE,SAAS,OAAO,EAAmC,CAAC;AAE7E;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EACzC,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,SAAS,CAAC,EAAE,GACtB,CAAC,CAaH;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,GAAG,EAAE,MAAM,CAAC;CACb;AAQD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAAyB,CAAC;AAChE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,GAAG,MAAM,WACoB,CAAC;AAMjE;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,OAAO,KAAG,OACY,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAMtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAM7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAM5F,CAAC"}
|
package/dist/utils/sizing.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
const S =
|
|
5
|
-
let
|
|
6
|
-
for (const
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
const t = ["xs", "sm", "md", "lg", "xl"];
|
|
2
|
+
function p(r, n) {
|
|
3
|
+
if (n.includes(r)) return r;
|
|
4
|
+
const S = t.indexOf(r);
|
|
5
|
+
let i = n[0], o = 1 / 0;
|
|
6
|
+
for (const s of n) {
|
|
7
|
+
const x = Math.abs(t.indexOf(s) - S);
|
|
8
|
+
x < o && (o = x, i = s);
|
|
9
9
|
}
|
|
10
|
-
return
|
|
10
|
+
return i;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const c = "var(--cui-density-scale, 1)", f = (r) => `calc(${r} * ${c})`, h = (r) => `max(var(--cui-control-min-target, 24px), calc(${r} * ${c}))`, e = f, m = h, g = (r) => t[Math.max(0, t.indexOf(r) - 1)], a = {
|
|
13
13
|
xs: { height: m("1.75rem"), px: e("0.5rem"), fontSize: "0.75rem" },
|
|
14
|
-
sm: { height: m("2rem"), px: e("0.
|
|
15
|
-
md: { height: m("2.5rem"), px: e("
|
|
16
|
-
lg: { height: m("3rem"), px: e("
|
|
17
|
-
xl: { height: m("3.5rem"), px: e("
|
|
14
|
+
sm: { height: m("2rem"), px: e("0.625rem"), fontSize: "0.8125rem" },
|
|
15
|
+
md: { height: m("2.5rem"), px: e("0.75rem"), fontSize: "1rem" },
|
|
16
|
+
lg: { height: m("3rem"), px: e("0.875rem"), fontSize: "1.0625rem" },
|
|
17
|
+
xl: { height: m("3.5rem"), px: e("1rem"), fontSize: "1.125rem" }
|
|
18
18
|
}, l = {
|
|
19
19
|
xs: { height: m("1.75rem"), px: e("0.5rem"), fontSize: "0.75rem", gap: e("0.25rem") },
|
|
20
20
|
sm: { height: m("2rem"), px: e("0.75rem"), fontSize: "0.8125rem", gap: e("0.375rem") },
|
|
21
21
|
md: { height: m("2.5rem"), px: e("1rem"), fontSize: "1rem", gap: e("0.5rem") },
|
|
22
22
|
lg: { height: m("3rem"), px: e("1.5rem"), fontSize: "1.0625rem", gap: e("0.5rem") },
|
|
23
23
|
xl: { height: m("3.5rem"), px: e("2rem"), fontSize: "1.125rem", gap: e("0.625rem") }
|
|
24
|
-
},
|
|
24
|
+
}, z = {
|
|
25
25
|
xs: { px: e("0.5rem"), py: e("0.25rem"), fontSize: "0.75rem" },
|
|
26
26
|
sm: { px: e("0.75rem"), py: e("0.375rem"), fontSize: "0.8125rem" },
|
|
27
27
|
md: { px: e("1rem"), py: e("0.5rem"), fontSize: "1rem" },
|
|
@@ -30,10 +30,11 @@ const p = "var(--cui-density-scale, 1)", c = (r) => `calc(${r} * ${p})`, f = (r)
|
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
32
|
l as BUTTON_SIZE_SCALE,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
a as INPUT_SIZE_SCALE,
|
|
34
|
+
t as SIZE_ORDER,
|
|
35
|
+
z as TEXTAREA_SIZE_SCALE,
|
|
36
|
+
p as clampSize,
|
|
37
|
+
g as nestedSize,
|
|
38
|
+
h as scaleControlHeight,
|
|
39
|
+
f as scaleDensity
|
|
39
40
|
};
|
package/dist/version.js
CHANGED
package/package.json
CHANGED