@mindlogic-ai/logician-ui 5.0.0-alpha.28 → 5.0.0-alpha.29
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/MIGRATION-5.0.md +38 -0
- package/USAGE.md +20 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +12 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts.map +1 -0
- package/dist/components/DatePicker/RangeDatePicker.d.ts +2 -1
- package/dist/components/DatePicker/RangeDatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/RangeDatePicker.js +4 -2
- package/dist/components/DatePicker/RangeDatePicker.js.map +1 -1
- package/dist/components/DatePicker/RangeDatePicker.mjs +4 -2
- package/dist/components/DatePicker/RangeDatePicker.mjs.map +1 -1
- package/dist/components/DatePicker/SingleDatePicker.d.ts +2 -1
- package/dist/components/DatePicker/SingleDatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/SingleDatePicker.js +4 -2
- package/dist/components/DatePicker/SingleDatePicker.js.map +1 -1
- package/dist/components/DatePicker/SingleDatePicker.mjs +4 -2
- package/dist/components/DatePicker/SingleDatePicker.mjs.map +1 -1
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/MonthPicker/MonthPicker.d.ts.map +1 -1
- package/dist/components/MonthPicker/MonthPicker.js +3 -2
- package/dist/components/MonthPicker/MonthPicker.js.map +1 -1
- package/dist/components/MonthPicker/MonthPicker.mjs +3 -2
- package/dist/components/MonthPicker/MonthPicker.mjs.map +1 -1
- package/dist/components/MonthPicker/MonthPicker.types.d.ts +7 -1
- package/dist/components/MonthPicker/MonthPicker.types.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +7 -18
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.mjs +8 -19
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.styles.d.ts +18 -0
- package/dist/components/SegmentedControl/SegmentedControl.styles.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.styles.js +24 -0
- package/dist/components/SegmentedControl/SegmentedControl.styles.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.styles.mjs +23 -1
- package/dist/components/SegmentedControl/SegmentedControl.styles.mjs.map +1 -1
- package/dist/components/Tag/Tag.d.ts.map +1 -1
- package/dist/components/Tag/Tag.js +14 -2
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Tag/Tag.mjs +15 -3
- package/dist/components/Tag/Tag.mjs.map +1 -1
- package/dist/components/Tag/Tag.styles.d.ts +20 -2
- package/dist/components/Tag/Tag.styles.d.ts.map +1 -1
- package/dist/components/Tag/Tag.styles.js +81 -0
- package/dist/components/Tag/Tag.styles.js.map +1 -1
- package/dist/components/Tag/Tag.styles.mjs +81 -1
- package/dist/components/Tag/Tag.styles.mjs.map +1 -1
- package/dist/components/Tag/Tag.types.d.ts +15 -2
- package/dist/components/Tag/Tag.types.d.ts.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/theme/controlSizes.d.ts +91 -0
- package/dist/theme/controlSizes.d.ts.map +1 -0
- package/dist/theme/controlSizes.js +143 -0
- package/dist/theme/controlSizes.js.map +1 -0
- package/dist/theme/controlSizes.mjs +135 -0
- package/dist/theme/controlSizes.mjs.map +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +12 -43
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/index.mjs +12 -43
- package/dist/theme/index.mjs.map +1 -1
- package/dist/theme/recipes/controls.d.ts +94 -0
- package/dist/theme/recipes/controls.d.ts.map +1 -0
- package/dist/theme/recipes/controls.js +154 -0
- package/dist/theme/recipes/controls.js.map +1 -0
- package/dist/theme/recipes/controls.mjs +144 -0
- package/dist/theme/recipes/controls.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/DatePicker/DatePicker.types.ts +12 -0
- package/src/components/DatePicker/RangeDatePicker.tsx +7 -1
- package/src/components/DatePicker/SingleDatePicker.tsx +7 -1
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/MonthPicker/MonthPicker.tsx +7 -1
- package/src/components/MonthPicker/MonthPicker.types.ts +8 -1
- package/src/components/SegmentedControl/SegmentedControl.styles.ts +31 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +15 -22
- package/src/components/SegmentedControl/SegmentedControl.usage.mdx +15 -8
- package/src/components/Tag/Tag.styles.ts +117 -2
- package/src/components/Tag/Tag.test.tsx +87 -1
- package/src/components/Tag/Tag.tsx +22 -1
- package/src/components/Tag/Tag.types.ts +16 -2
- package/src/components/Tag/index.ts +2 -0
- package/src/components/claude.md +23 -0
- package/src/index.ts +12 -0
- package/src/theme/ControlSizes.stories.tsx +586 -0
- package/src/theme/claude.md +8 -0
- package/src/theme/controlSizes.test.ts +148 -0
- package/src/theme/controlSizes.ts +162 -0
- package/src/theme/index.ts +21 -46
- package/src/theme/recipes/controls.ts +171 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementType, ReactNode } from 'react';
|
|
2
|
-
import { TagRootProps } from '@chakra-ui/react';
|
|
2
|
+
import type { ConditionalValue, TagRootProps } from '@chakra-ui/react';
|
|
3
3
|
import type { SystemHue } from '@/theme/colors';
|
|
4
4
|
import type { PolymorphicProps } from '../../types/polymorphic';
|
|
5
5
|
/**
|
|
@@ -9,6 +9,8 @@ import type { PolymorphicProps } from '../../types/polymorphic';
|
|
|
9
9
|
* - `success` / `warning` / `danger` / `info`: status family `.bg` + `.fg`.
|
|
10
10
|
* Use them only when the tag reports a status.
|
|
11
11
|
*/
|
|
12
|
+
/** Tag sizes: the badge sizes plus `xs`, which only interactive tags draw. */
|
|
13
|
+
export type TagSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
14
|
export type TagTone = 'neutral' | 'success' | 'warning' | 'danger' | 'info';
|
|
13
15
|
/**
|
|
14
16
|
* 4.x colour palettes. Removed from `TagProps` in 5.0; still accepted at
|
|
@@ -21,7 +23,18 @@ export type TagColorPalette = 'primary' | 'secondary' | 'danger' | 'success' | '
|
|
|
21
23
|
* @deprecated Use `tone`, `selected` or `category`.
|
|
22
24
|
*/
|
|
23
25
|
export type TagVariant = 'soft' | 'solid' | 'outline';
|
|
24
|
-
export type TagOwnProps = Omit<TagRootProps, 'colorPalette' | 'variant' | 'as'> & {
|
|
26
|
+
export type TagOwnProps = Omit<TagRootProps, 'colorPalette' | 'variant' | 'as' | 'size'> & {
|
|
27
|
+
/**
|
|
28
|
+
* A static tag uses the badge sizes (`sm` · `md` · `lg` · `xl`; `xs` falls
|
|
29
|
+
* back to `sm`). An interactive tag — `onClick`, `selected`, `as="button"`
|
|
30
|
+
* or a link — uses the shared control scale (`xs`–`xl`), so it matches a
|
|
31
|
+
* `Button` / `Input` of the same size in a row.
|
|
32
|
+
*
|
|
33
|
+
* Responsive values (`{ base: 'xs', md: 'sm' }`, arrays) work for both;
|
|
34
|
+
* an interactive tag resolves the control scale per breakpoint.
|
|
35
|
+
* @default 'md'
|
|
36
|
+
*/
|
|
37
|
+
size?: ConditionalValue<TagSize>;
|
|
25
38
|
/**
|
|
26
39
|
* Colour role of the tag. Ignored while `selected` is true or `category`
|
|
27
40
|
* is set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.types.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/Tag.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,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,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,QAAQ,CAAC,QAAQ,SAAS,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC5E,QAAQ,EACR,WAAW,CACZ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Icon } from '@chakra-ui/react';
|
|
2
2
|
export { Tag } from './Tag';
|
|
3
3
|
export type { LegacyTagResolution, TagStyleOptions } from './Tag.styles';
|
|
4
|
-
export { getTagStyles, mapLegacyTagProps, tagTones, tagToneStyles, } from './Tag.styles';
|
|
5
|
-
export type { TagColorPalette, TagOwnProps, TagProps, TagTone, TagVariant, } from './Tag.types';
|
|
4
|
+
export { getTagSizeStyles, getTagStyles, mapLegacyTagProps, tagTones, tagToneStyles, } from './Tag.styles';
|
|
5
|
+
export type { TagColorPalette, TagOwnProps, TagProps, TagSize, TagTone, TagVariant, } from './Tag.types';
|
|
6
6
|
export * from './TagCloseButton';
|
|
7
7
|
export * from './TagLabel';
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,eAAe,EACf,WAAW,EACX,QAAQ,EACR,OAAO,EACP,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAE3B;;GAEG;AACH,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,CAAC;AAE/B;;GAEG;AACH,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,eAAe,EACf,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAE3B;;GAEG;AACH,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,CAAC;AAE/B;;GAEG;AACH,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export type { LanguageContextValue } from './hooks/useLanguage';
|
|
|
80
80
|
export { LanguageContext, useLanguage } from './hooks/useLanguage';
|
|
81
81
|
export { createLogicianTheme, logicianConfig, type LogicianThemeOptions, normalizeSemanticOverrides, system, theme, } from './theme';
|
|
82
82
|
export { colors, createSemanticColors, DEPRECATED_COLOR_TOKENS, type DeprecatedSemanticColorToken, type NeutralScale, type SecondaryScale, type SemanticColorToken, semanticTokens, SYSTEM_HUE_NAMES, type SystemHue, } from './theme/colors';
|
|
83
|
+
export { CONTROL_RADIUS, CONTROL_SIZES, controlHeightToken, controlHeightVar, type ControlSize, controlSizes, type ControlSizeSpec, CORE_CONTROL_SIZES, type CoreControlSize, getControlSize, } from './theme/controlSizes';
|
|
83
84
|
export { noZoomOnFocus } from './theme/formControls';
|
|
84
85
|
export { animationStyles, durations, easings, MOTION_DURATION_MS, MOTION_DURATION_S, MOTION_EASE, MOTION_EASE_CSS, MOTION_STAGGER_MAX, type MotionDurationToken, type MotionEaseToken, type MotionStyleToken, } from './theme/motion';
|
|
85
86
|
export { cubicBezier } from './utils/cubicBezier';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AAGvC,YAAY,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,cAAc,yBAAyB,CAAC;AAGxC,YAAY,EACV,WAAW,EACX,SAAS,IAAI,eAAe,GAC7B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,M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EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -198,6 +198,7 @@ var useHasHover = require('./hooks/useHasHover.js');
|
|
|
198
198
|
var useLanguage = require('./hooks/useLanguage.js');
|
|
199
199
|
var index = require('./theme/index.js');
|
|
200
200
|
var colors = require('./theme/colors.js');
|
|
201
|
+
var controlSizes = require('./theme/controlSizes.js');
|
|
201
202
|
var formControls = require('./theme/formControls.js');
|
|
202
203
|
var motion = require('./theme/motion.js');
|
|
203
204
|
var cubicBezier = require('./utils/cubicBezier.js');
|
|
@@ -392,6 +393,7 @@ exports.TabPanel = TabPanel.TabPanel;
|
|
|
392
393
|
exports.TabPanels = TabPanels.TabPanels;
|
|
393
394
|
exports.Tabs = Tabs.Tabs;
|
|
394
395
|
exports.Tag = Tag.Tag;
|
|
396
|
+
exports.getTagSizeStyles = Tag_styles.getTagSizeStyles;
|
|
395
397
|
exports.getTagStyles = Tag_styles.getTagStyles;
|
|
396
398
|
exports.mapLegacyTagProps = Tag_styles.mapLegacyTagProps;
|
|
397
399
|
exports.tagToneStyles = Tag_styles.tagToneStyles;
|
|
@@ -477,6 +479,13 @@ exports.SYSTEM_HUE_NAMES = colors.SYSTEM_HUE_NAMES;
|
|
|
477
479
|
exports.colors = colors.colors;
|
|
478
480
|
exports.createSemanticColors = colors.createSemanticColors;
|
|
479
481
|
exports.semanticTokens = colors.semanticTokens;
|
|
482
|
+
exports.CONTROL_RADIUS = controlSizes.CONTROL_RADIUS;
|
|
483
|
+
exports.CONTROL_SIZES = controlSizes.CONTROL_SIZES;
|
|
484
|
+
exports.CORE_CONTROL_SIZES = controlSizes.CORE_CONTROL_SIZES;
|
|
485
|
+
exports.controlHeightToken = controlSizes.controlHeightToken;
|
|
486
|
+
exports.controlHeightVar = controlSizes.controlHeightVar;
|
|
487
|
+
exports.controlSizes = controlSizes.controlSizes;
|
|
488
|
+
exports.getControlSize = controlSizes.getControlSize;
|
|
480
489
|
exports.noZoomOnFocus = formControls.noZoomOnFocus;
|
|
481
490
|
exports.MOTION_DURATION_MS = motion.MOTION_DURATION_MS;
|
|
482
491
|
exports.MOTION_DURATION_S = motion.MOTION_DURATION_S;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -139,7 +139,7 @@ export { TabPanel } from './components/Tabs/TabPanel.mjs';
|
|
|
139
139
|
export { TabPanels } from './components/Tabs/TabPanels.mjs';
|
|
140
140
|
export { Tabs } from './components/Tabs/Tabs.mjs';
|
|
141
141
|
export { Tag } from './components/Tag/Tag.mjs';
|
|
142
|
-
export { getTagStyles, mapLegacyTagProps, tagToneStyles, tagTones } from './components/Tag/Tag.styles.mjs';
|
|
142
|
+
export { getTagSizeStyles, getTagStyles, mapLegacyTagProps, tagToneStyles, tagTones } from './components/Tag/Tag.styles.mjs';
|
|
143
143
|
export { TagCloseButton } from './components/Tag/TagCloseButton/TagCloseButton.mjs';
|
|
144
144
|
export { TagLabel } from './components/Tag/TagLabel/TagLabel.mjs';
|
|
145
145
|
export { Textarea } from './components/Textarea/Textarea.mjs';
|
|
@@ -196,6 +196,7 @@ export { useHasHover } from './hooks/useHasHover.mjs';
|
|
|
196
196
|
export { LanguageContext, useLanguage } from './hooks/useLanguage.mjs';
|
|
197
197
|
export { createLogicianTheme, logicianConfig, normalizeSemanticOverrides, system, theme } from './theme/index.mjs';
|
|
198
198
|
export { DEPRECATED_COLOR_TOKENS, SYSTEM_HUE_NAMES, colors, createSemanticColors, semanticTokens } from './theme/colors.mjs';
|
|
199
|
+
export { CONTROL_RADIUS, CONTROL_SIZES, CORE_CONTROL_SIZES, controlHeightToken, controlHeightVar, controlSizes, getControlSize } from './theme/controlSizes.mjs';
|
|
199
200
|
export { noZoomOnFocus } from './theme/formControls.mjs';
|
|
200
201
|
export { MOTION_DURATION_MS, MOTION_DURATION_S, MOTION_EASE, MOTION_EASE_CSS, MOTION_STAGGER_MAX, animationStyles, durations, easings } from './theme/motion.mjs';
|
|
201
202
|
export { cubicBezier } from './utils/cubicBezier.mjs';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One size scale for every control.
|
|
3
|
+
*
|
|
4
|
+
* A row of controls — a table filter bar, a toolbar, an inline form — only
|
|
5
|
+
* lines up when every control resolves the same `size` value to the same
|
|
6
|
+
* height, type size, icon size and corner. Each component used to carry its own
|
|
7
|
+
* map (Chakra's recipe here, a local table there), and they drifted: in the
|
|
8
|
+
* FactChat coding-agent toolbar a `SegmentedControl size="sm"` drew 36px, an
|
|
9
|
+
* `Input size="xs"` 28px and an `lg` `Tag` 20.4px side by side (R28 3차 QA #18).
|
|
10
|
+
* Every height-bearing control and every recipe override now reads this table,
|
|
11
|
+
* and `controlSizes.test.ts` fails if one stops doing so.
|
|
12
|
+
*
|
|
13
|
+
* ## The scale is Button's
|
|
14
|
+
*
|
|
15
|
+
* `Button` was the reference and does not change: the values below are exactly
|
|
16
|
+
* Chakra's button recipe. Everything else is aligned to it.
|
|
17
|
+
*
|
|
18
|
+
* | size | height token | px at the 14px root | in a 16px `ScaledContext` (desktop) |
|
|
19
|
+
* |------|--------------|---------------------|-------------------------------------|
|
|
20
|
+
* | 2xs | `sizes.6` | 21 | 21 (2xs type is 0.875em) |
|
|
21
|
+
* | xs | `sizes.8` | 28 | 28 (xs type is 0.875em) |
|
|
22
|
+
* | sm | `sizes.9` | 31.5 | 36 |
|
|
23
|
+
* | md | `sizes.10` | 35 | 40 |
|
|
24
|
+
* | lg | `sizes.11` | 38.5 | 44 |
|
|
25
|
+
* | xl | `sizes.12` | 42 | 48 |
|
|
26
|
+
*
|
|
27
|
+
* ## Why one type step per size, not just one height
|
|
28
|
+
*
|
|
29
|
+
* `html` is 14px, and the sizes tokens are rem, so outside a `ScaledContext`
|
|
30
|
+
* the height alone decides. Inside one (FactChat's `ReadingScale` is
|
|
31
|
+
* `<ScaledContext fontSize="16px">`) the sizes tokens become **em**, and an em
|
|
32
|
+
* resolves against the control's *own* font size. Two controls with the same
|
|
33
|
+
* height token but different type therefore stop matching there — that is how
|
|
34
|
+
* `Input lg` (1.143em type) drew 50px next to a 44px `Button lg`. The same
|
|
35
|
+
* happens at the mobile breakpoint, where the textStyles drop to 0.875em. So
|
|
36
|
+
* every control takes its type from `textStyle` here too: equal type per size
|
|
37
|
+
* is what keeps equal height everywhere, not only at the root.
|
|
38
|
+
*
|
|
39
|
+
* Text-entry controls still raise their type to 16px under `pointer: coarse`
|
|
40
|
+
* (`noZoomOnFocus`, iOS zoom). At the root that changes nothing about height;
|
|
41
|
+
* inside a `ScaledContext` on a touch device it makes an `Input` taller than
|
|
42
|
+
* its neighbours. That is the price of not zooming, and it is left alone.
|
|
43
|
+
*
|
|
44
|
+
* ## Two padding ramps
|
|
45
|
+
*
|
|
46
|
+
* Action controls (Button, SegmentedControl items, interactive Tag) and field
|
|
47
|
+
* controls (Input, Select, Combobox, Textarea) keep different inline padding on
|
|
48
|
+
* purpose: a field's text starts near its edge, a button's label is centred in
|
|
49
|
+
* air. Each ramp is shared by its whole family.
|
|
50
|
+
*
|
|
51
|
+
* ## Icons
|
|
52
|
+
*
|
|
53
|
+
* `iconSize` is Button's `_icon` ramp as a sizes token; `iconBoxSize` is the
|
|
54
|
+
* `Icon` `boxSize` name with the same size, for icons a control draws itself
|
|
55
|
+
* (DatePicker / MonthPicker triggers) and for call sites placing an icon in a
|
|
56
|
+
* control (`<SearchIcon boxSize={controlSizes[size].iconBoxSize} />`).
|
|
57
|
+
*/
|
|
58
|
+
export declare const CONTROL_SIZES: readonly ["2xs", "xs", "sm", "md", "lg", "xl"];
|
|
59
|
+
export type ControlSize = (typeof CONTROL_SIZES)[number];
|
|
60
|
+
/**
|
|
61
|
+
* The four sizes a control row is built from. Every height-bearing control
|
|
62
|
+
* supports these; `2xs` / `xl` exist only where the component already had them.
|
|
63
|
+
*/
|
|
64
|
+
export declare const CORE_CONTROL_SIZES: readonly ["xs", "sm", "md", "lg"];
|
|
65
|
+
export type CoreControlSize = (typeof CORE_CONTROL_SIZES)[number];
|
|
66
|
+
export interface ControlSizeSpec {
|
|
67
|
+
/** `sizes` token key — the outer height of every height-bearing control. */
|
|
68
|
+
height: string;
|
|
69
|
+
/** textStyle every control uses at this size (font size + line height). */
|
|
70
|
+
textStyle: 'xs' | 'sm' | 'md';
|
|
71
|
+
/** `sizes` token key for an icon inside the control (Button's `_icon`). */
|
|
72
|
+
iconSize: string;
|
|
73
|
+
/** The `Icon` `boxSize` name that renders at `iconSize`. */
|
|
74
|
+
iconBoxSize: '2xs' | 'xs' | 'sm';
|
|
75
|
+
/** Inline padding of action controls (spacing token). */
|
|
76
|
+
actionPaddingX: string;
|
|
77
|
+
/** Inline padding of field controls (spacing token). */
|
|
78
|
+
fieldPaddingX: string;
|
|
79
|
+
/** Gap between an icon and the label (spacing token). */
|
|
80
|
+
gap: string;
|
|
81
|
+
}
|
|
82
|
+
export declare const controlSizes: Record<ControlSize, ControlSizeSpec>;
|
|
83
|
+
/** Corner radius of every boxed control, at every size (Button's). */
|
|
84
|
+
export declare const CONTROL_RADIUS = "md";
|
|
85
|
+
/** `sizes.N` token path of a size's height, for recipe CSS variables. */
|
|
86
|
+
export declare const controlHeightToken: (size: ControlSize) => string;
|
|
87
|
+
/** The same height as a CSS value, for `calc()` and inline styles. */
|
|
88
|
+
export declare const controlHeightVar: (size: ControlSize) => string;
|
|
89
|
+
/** Resolve an arbitrary `size` prop to a spec, falling back to `md`. */
|
|
90
|
+
export declare const getControlSize: (size: unknown) => ControlSizeSpec;
|
|
91
|
+
//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@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One size scale for every control.
|
|
6
|
+
*
|
|
7
|
+
* A row of controls — a table filter bar, a toolbar, an inline form — only
|
|
8
|
+
* lines up when every control resolves the same `size` value to the same
|
|
9
|
+
* height, type size, icon size and corner. Each component used to carry its own
|
|
10
|
+
* map (Chakra's recipe here, a local table there), and they drifted: in the
|
|
11
|
+
* FactChat coding-agent toolbar a `SegmentedControl size="sm"` drew 36px, an
|
|
12
|
+
* `Input size="xs"` 28px and an `lg` `Tag` 20.4px side by side (R28 3차 QA #18).
|
|
13
|
+
* Every height-bearing control and every recipe override now reads this table,
|
|
14
|
+
* and `controlSizes.test.ts` fails if one stops doing so.
|
|
15
|
+
*
|
|
16
|
+
* ## The scale is Button's
|
|
17
|
+
*
|
|
18
|
+
* `Button` was the reference and does not change: the values below are exactly
|
|
19
|
+
* Chakra's button recipe. Everything else is aligned to it.
|
|
20
|
+
*
|
|
21
|
+
* | size | height token | px at the 14px root | in a 16px `ScaledContext` (desktop) |
|
|
22
|
+
* |------|--------------|---------------------|-------------------------------------|
|
|
23
|
+
* | 2xs | `sizes.6` | 21 | 21 (2xs type is 0.875em) |
|
|
24
|
+
* | xs | `sizes.8` | 28 | 28 (xs type is 0.875em) |
|
|
25
|
+
* | sm | `sizes.9` | 31.5 | 36 |
|
|
26
|
+
* | md | `sizes.10` | 35 | 40 |
|
|
27
|
+
* | lg | `sizes.11` | 38.5 | 44 |
|
|
28
|
+
* | xl | `sizes.12` | 42 | 48 |
|
|
29
|
+
*
|
|
30
|
+
* ## Why one type step per size, not just one height
|
|
31
|
+
*
|
|
32
|
+
* `html` is 14px, and the sizes tokens are rem, so outside a `ScaledContext`
|
|
33
|
+
* the height alone decides. Inside one (FactChat's `ReadingScale` is
|
|
34
|
+
* `<ScaledContext fontSize="16px">`) the sizes tokens become **em**, and an em
|
|
35
|
+
* resolves against the control's *own* font size. Two controls with the same
|
|
36
|
+
* height token but different type therefore stop matching there — that is how
|
|
37
|
+
* `Input lg` (1.143em type) drew 50px next to a 44px `Button lg`. The same
|
|
38
|
+
* happens at the mobile breakpoint, where the textStyles drop to 0.875em. So
|
|
39
|
+
* every control takes its type from `textStyle` here too: equal type per size
|
|
40
|
+
* is what keeps equal height everywhere, not only at the root.
|
|
41
|
+
*
|
|
42
|
+
* Text-entry controls still raise their type to 16px under `pointer: coarse`
|
|
43
|
+
* (`noZoomOnFocus`, iOS zoom). At the root that changes nothing about height;
|
|
44
|
+
* inside a `ScaledContext` on a touch device it makes an `Input` taller than
|
|
45
|
+
* its neighbours. That is the price of not zooming, and it is left alone.
|
|
46
|
+
*
|
|
47
|
+
* ## Two padding ramps
|
|
48
|
+
*
|
|
49
|
+
* Action controls (Button, SegmentedControl items, interactive Tag) and field
|
|
50
|
+
* controls (Input, Select, Combobox, Textarea) keep different inline padding on
|
|
51
|
+
* purpose: a field's text starts near its edge, a button's label is centred in
|
|
52
|
+
* air. Each ramp is shared by its whole family.
|
|
53
|
+
*
|
|
54
|
+
* ## Icons
|
|
55
|
+
*
|
|
56
|
+
* `iconSize` is Button's `_icon` ramp as a sizes token; `iconBoxSize` is the
|
|
57
|
+
* `Icon` `boxSize` name with the same size, for icons a control draws itself
|
|
58
|
+
* (DatePicker / MonthPicker triggers) and for call sites placing an icon in a
|
|
59
|
+
* control (`<SearchIcon boxSize={controlSizes[size].iconBoxSize} />`).
|
|
60
|
+
*/
|
|
61
|
+
const CONTROL_SIZES = ['2xs', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
62
|
+
/**
|
|
63
|
+
* The four sizes a control row is built from. Every height-bearing control
|
|
64
|
+
* supports these; `2xs` / `xl` exist only where the component already had them.
|
|
65
|
+
*/
|
|
66
|
+
const CORE_CONTROL_SIZES = ['xs', 'sm', 'md', 'lg'];
|
|
67
|
+
const controlSizes = {
|
|
68
|
+
'2xs': {
|
|
69
|
+
height: '6',
|
|
70
|
+
textStyle: 'xs',
|
|
71
|
+
iconSize: '3.5',
|
|
72
|
+
iconBoxSize: '2xs',
|
|
73
|
+
actionPaddingX: '2',
|
|
74
|
+
fieldPaddingX: '2',
|
|
75
|
+
gap: '1',
|
|
76
|
+
},
|
|
77
|
+
xs: {
|
|
78
|
+
height: '8',
|
|
79
|
+
textStyle: 'xs',
|
|
80
|
+
iconSize: '4',
|
|
81
|
+
iconBoxSize: 'xs',
|
|
82
|
+
actionPaddingX: '2.5',
|
|
83
|
+
fieldPaddingX: '2',
|
|
84
|
+
gap: '1',
|
|
85
|
+
},
|
|
86
|
+
sm: {
|
|
87
|
+
height: '9',
|
|
88
|
+
textStyle: 'sm',
|
|
89
|
+
iconSize: '4',
|
|
90
|
+
iconBoxSize: 'xs',
|
|
91
|
+
actionPaddingX: '3.5',
|
|
92
|
+
fieldPaddingX: '2.5',
|
|
93
|
+
gap: '2',
|
|
94
|
+
},
|
|
95
|
+
md: {
|
|
96
|
+
height: '10',
|
|
97
|
+
textStyle: 'sm',
|
|
98
|
+
iconSize: '5',
|
|
99
|
+
iconBoxSize: 'sm',
|
|
100
|
+
actionPaddingX: '4',
|
|
101
|
+
fieldPaddingX: '3',
|
|
102
|
+
gap: '2',
|
|
103
|
+
},
|
|
104
|
+
lg: {
|
|
105
|
+
height: '11',
|
|
106
|
+
textStyle: 'md',
|
|
107
|
+
iconSize: '5',
|
|
108
|
+
iconBoxSize: 'sm',
|
|
109
|
+
actionPaddingX: '5',
|
|
110
|
+
// 12px at a 16px font — kept from the lg padding fix (f2820c8) so lg reads
|
|
111
|
+
// as a step up from md rather than a wider box.
|
|
112
|
+
fieldPaddingX: '3',
|
|
113
|
+
gap: '3',
|
|
114
|
+
},
|
|
115
|
+
xl: {
|
|
116
|
+
height: '12',
|
|
117
|
+
textStyle: 'md',
|
|
118
|
+
iconSize: '5',
|
|
119
|
+
iconBoxSize: 'sm',
|
|
120
|
+
actionPaddingX: '5',
|
|
121
|
+
fieldPaddingX: '4.5',
|
|
122
|
+
gap: '2.5',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
/** Corner radius of every boxed control, at every size (Button's). */
|
|
126
|
+
const CONTROL_RADIUS = 'md';
|
|
127
|
+
/** `sizes.N` token path of a size's height, for recipe CSS variables. */
|
|
128
|
+
const controlHeightToken = (size) => `sizes.${controlSizes[size].height}`;
|
|
129
|
+
/** The same height as a CSS value, for `calc()` and inline styles. */
|
|
130
|
+
const controlHeightVar = (size) => `var(--chakra-sizes-${controlSizes[size].height})`;
|
|
131
|
+
/** Resolve an arbitrary `size` prop to a spec, falling back to `md`. */
|
|
132
|
+
const getControlSize = (size) => typeof size === 'string' && size in controlSizes
|
|
133
|
+
? controlSizes[size]
|
|
134
|
+
: controlSizes.md;
|
|
135
|
+
|
|
136
|
+
exports.CONTROL_RADIUS = CONTROL_RADIUS;
|
|
137
|
+
exports.CONTROL_SIZES = CONTROL_SIZES;
|
|
138
|
+
exports.CORE_CONTROL_SIZES = CORE_CONTROL_SIZES;
|
|
139
|
+
exports.controlHeightToken = controlHeightToken;
|
|
140
|
+
exports.controlHeightVar = controlHeightVar;
|
|
141
|
+
exports.controlSizes = controlSizes;
|
|
142
|
+
exports.getControlSize = getControlSize;
|
|
143
|
+
//# sourceMappingURL=controlSizes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlSizes.js","sources":["../../src/theme/controlSizes.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDG;AAEI,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;AAIjE;;;AAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;AAqBlD,MAAM,YAAY,GAAyC;AAChE,IAAA,KAAK,EAAE;AACL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I;AACZ,QAAA,SAAS,EAAE,IAAI;AACf,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,cAAc,EAAE,GAAG;AACnB,QAAA,aAAa,EAAE,KAAK;AACpB,QAAA,GAAG,EAAE,KAAK;AACX,KAAA;;AAGH;AACO,MAAM,cAAc,GAAG;AAE9B;AACO,MAAM,kBAAkB,GAAG,CAAC,IAAiB,KAClD,CAAA,MAAA,EAAS,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM;AAEpC;AACO,MAAM,gBAAgB,GAAG,CAAC,IAAiB,KAChD,CAAA,mBAAA,EAAsB,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM;AAEjD;AACO,MAAM,cAAc,GAAG,CAAC,IAAa,KAC1C,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,IAAI;AAClC,MAAE,YAAY,CAAC,IAAmB;AAClC,MAAE,YAAY,CAAC;;;;;;;;;;"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* One size scale for every control.
|
|
4
|
+
*
|
|
5
|
+
* A row of controls — a table filter bar, a toolbar, an inline form — only
|
|
6
|
+
* lines up when every control resolves the same `size` value to the same
|
|
7
|
+
* height, type size, icon size and corner. Each component used to carry its own
|
|
8
|
+
* map (Chakra's recipe here, a local table there), and they drifted: in the
|
|
9
|
+
* FactChat coding-agent toolbar a `SegmentedControl size="sm"` drew 36px, an
|
|
10
|
+
* `Input size="xs"` 28px and an `lg` `Tag` 20.4px side by side (R28 3차 QA #18).
|
|
11
|
+
* Every height-bearing control and every recipe override now reads this table,
|
|
12
|
+
* and `controlSizes.test.ts` fails if one stops doing so.
|
|
13
|
+
*
|
|
14
|
+
* ## The scale is Button's
|
|
15
|
+
*
|
|
16
|
+
* `Button` was the reference and does not change: the values below are exactly
|
|
17
|
+
* Chakra's button recipe. Everything else is aligned to it.
|
|
18
|
+
*
|
|
19
|
+
* | size | height token | px at the 14px root | in a 16px `ScaledContext` (desktop) |
|
|
20
|
+
* |------|--------------|---------------------|-------------------------------------|
|
|
21
|
+
* | 2xs | `sizes.6` | 21 | 21 (2xs type is 0.875em) |
|
|
22
|
+
* | xs | `sizes.8` | 28 | 28 (xs type is 0.875em) |
|
|
23
|
+
* | sm | `sizes.9` | 31.5 | 36 |
|
|
24
|
+
* | md | `sizes.10` | 35 | 40 |
|
|
25
|
+
* | lg | `sizes.11` | 38.5 | 44 |
|
|
26
|
+
* | xl | `sizes.12` | 42 | 48 |
|
|
27
|
+
*
|
|
28
|
+
* ## Why one type step per size, not just one height
|
|
29
|
+
*
|
|
30
|
+
* `html` is 14px, and the sizes tokens are rem, so outside a `ScaledContext`
|
|
31
|
+
* the height alone decides. Inside one (FactChat's `ReadingScale` is
|
|
32
|
+
* `<ScaledContext fontSize="16px">`) the sizes tokens become **em**, and an em
|
|
33
|
+
* resolves against the control's *own* font size. Two controls with the same
|
|
34
|
+
* height token but different type therefore stop matching there — that is how
|
|
35
|
+
* `Input lg` (1.143em type) drew 50px next to a 44px `Button lg`. The same
|
|
36
|
+
* happens at the mobile breakpoint, where the textStyles drop to 0.875em. So
|
|
37
|
+
* every control takes its type from `textStyle` here too: equal type per size
|
|
38
|
+
* is what keeps equal height everywhere, not only at the root.
|
|
39
|
+
*
|
|
40
|
+
* Text-entry controls still raise their type to 16px under `pointer: coarse`
|
|
41
|
+
* (`noZoomOnFocus`, iOS zoom). At the root that changes nothing about height;
|
|
42
|
+
* inside a `ScaledContext` on a touch device it makes an `Input` taller than
|
|
43
|
+
* its neighbours. That is the price of not zooming, and it is left alone.
|
|
44
|
+
*
|
|
45
|
+
* ## Two padding ramps
|
|
46
|
+
*
|
|
47
|
+
* Action controls (Button, SegmentedControl items, interactive Tag) and field
|
|
48
|
+
* controls (Input, Select, Combobox, Textarea) keep different inline padding on
|
|
49
|
+
* purpose: a field's text starts near its edge, a button's label is centred in
|
|
50
|
+
* air. Each ramp is shared by its whole family.
|
|
51
|
+
*
|
|
52
|
+
* ## Icons
|
|
53
|
+
*
|
|
54
|
+
* `iconSize` is Button's `_icon` ramp as a sizes token; `iconBoxSize` is the
|
|
55
|
+
* `Icon` `boxSize` name with the same size, for icons a control draws itself
|
|
56
|
+
* (DatePicker / MonthPicker triggers) and for call sites placing an icon in a
|
|
57
|
+
* control (`<SearchIcon boxSize={controlSizes[size].iconBoxSize} />`).
|
|
58
|
+
*/
|
|
59
|
+
const CONTROL_SIZES = ['2xs', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
60
|
+
/**
|
|
61
|
+
* The four sizes a control row is built from. Every height-bearing control
|
|
62
|
+
* supports these; `2xs` / `xl` exist only where the component already had them.
|
|
63
|
+
*/
|
|
64
|
+
const CORE_CONTROL_SIZES = ['xs', 'sm', 'md', 'lg'];
|
|
65
|
+
const controlSizes = {
|
|
66
|
+
'2xs': {
|
|
67
|
+
height: '6',
|
|
68
|
+
textStyle: 'xs',
|
|
69
|
+
iconSize: '3.5',
|
|
70
|
+
iconBoxSize: '2xs',
|
|
71
|
+
actionPaddingX: '2',
|
|
72
|
+
fieldPaddingX: '2',
|
|
73
|
+
gap: '1',
|
|
74
|
+
},
|
|
75
|
+
xs: {
|
|
76
|
+
height: '8',
|
|
77
|
+
textStyle: 'xs',
|
|
78
|
+
iconSize: '4',
|
|
79
|
+
iconBoxSize: 'xs',
|
|
80
|
+
actionPaddingX: '2.5',
|
|
81
|
+
fieldPaddingX: '2',
|
|
82
|
+
gap: '1',
|
|
83
|
+
},
|
|
84
|
+
sm: {
|
|
85
|
+
height: '9',
|
|
86
|
+
textStyle: 'sm',
|
|
87
|
+
iconSize: '4',
|
|
88
|
+
iconBoxSize: 'xs',
|
|
89
|
+
actionPaddingX: '3.5',
|
|
90
|
+
fieldPaddingX: '2.5',
|
|
91
|
+
gap: '2',
|
|
92
|
+
},
|
|
93
|
+
md: {
|
|
94
|
+
height: '10',
|
|
95
|
+
textStyle: 'sm',
|
|
96
|
+
iconSize: '5',
|
|
97
|
+
iconBoxSize: 'sm',
|
|
98
|
+
actionPaddingX: '4',
|
|
99
|
+
fieldPaddingX: '3',
|
|
100
|
+
gap: '2',
|
|
101
|
+
},
|
|
102
|
+
lg: {
|
|
103
|
+
height: '11',
|
|
104
|
+
textStyle: 'md',
|
|
105
|
+
iconSize: '5',
|
|
106
|
+
iconBoxSize: 'sm',
|
|
107
|
+
actionPaddingX: '5',
|
|
108
|
+
// 12px at a 16px font — kept from the lg padding fix (f2820c8) so lg reads
|
|
109
|
+
// as a step up from md rather than a wider box.
|
|
110
|
+
fieldPaddingX: '3',
|
|
111
|
+
gap: '3',
|
|
112
|
+
},
|
|
113
|
+
xl: {
|
|
114
|
+
height: '12',
|
|
115
|
+
textStyle: 'md',
|
|
116
|
+
iconSize: '5',
|
|
117
|
+
iconBoxSize: 'sm',
|
|
118
|
+
actionPaddingX: '5',
|
|
119
|
+
fieldPaddingX: '4.5',
|
|
120
|
+
gap: '2.5',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
/** Corner radius of every boxed control, at every size (Button's). */
|
|
124
|
+
const CONTROL_RADIUS = 'md';
|
|
125
|
+
/** `sizes.N` token path of a size's height, for recipe CSS variables. */
|
|
126
|
+
const controlHeightToken = (size) => `sizes.${controlSizes[size].height}`;
|
|
127
|
+
/** The same height as a CSS value, for `calc()` and inline styles. */
|
|
128
|
+
const controlHeightVar = (size) => `var(--chakra-sizes-${controlSizes[size].height})`;
|
|
129
|
+
/** Resolve an arbitrary `size` prop to a spec, falling back to `md`. */
|
|
130
|
+
const getControlSize = (size) => typeof size === 'string' && size in controlSizes
|
|
131
|
+
? controlSizes[size]
|
|
132
|
+
: controlSizes.md;
|
|
133
|
+
|
|
134
|
+
export { CONTROL_RADIUS, CONTROL_SIZES, CORE_CONTROL_SIZES, controlHeightToken, controlHeightVar, controlSizes, getControlSize };
|
|
135
|
+
//# sourceMappingURL=controlSizes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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ACjB,QAAA,cAAc,EAAE,GAAG;AACnB,QAAA,aAAa,EAAE,GAAG;AAClB,QAAA,GAAG,EAAE,GAAG;AACT,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,SAAS,EAAE,IAAI;AACf,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,cAAc,EAAE,GAAG;;;AAGnB,QAAA,aAAa,EAAE,GAAG;AAClB,QAAA,GAAG,EAAE,GAAG;AACT,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,SAAS,EAAE,IAAI;AACf,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,cAAc,EAAE,GAAG;AACnB,QAAA,aAAa,EAAE,KAAK;AACpB,QAAA,GAAG,EAAE,KAAK;AACX,KAAA;;AAGH;AACO,MAAM,cAAc,GAAG;AAE9B;AACO,MAAM,kBAAkB,GAAG,CAAC,IAAiB,KAClD,CAAA,MAAA,EAAS,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM;AAEpC;AACO,MAAM,gBAAgB,GAAG,CAAC,IAAiB,KAChD,CAAA,mBAAA,EAAsB,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM;AAEjD;AACO,MAAM,cAAc,GAAG,CAAC,IAAa,KAC1C,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,IAAI;AAClC,MAAE,YAAY,CAAC,IAAmB;AAClC,MAAE,YAAY,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,UAAU,CAAC;AA2FlB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,uCA2GrB,CAAC;AAsBH;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,YAAY,EAC/D,MAAM,EAAE,CAAC,GACR,CAAC,CAaH;AAED,+CAA+C;AAC/C,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,gBA+FrE;AAKD,eAAO,MAAM,MAAM,0CAAsC,CAAC;AAE1D,eAAO,MAAM,KAAK,0CAAS,CAAC;AAE5B,eAAO,MAAM,cAAc,cAAS,CAAC;AACrC,eAAe,MAAM,CAAC"}
|
package/dist/theme/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var global = require('./global.js');
|
|
|
9
9
|
var motion = require('./motion.js');
|
|
10
10
|
var accordion = require('./recipes/accordion.js');
|
|
11
11
|
var avatar = require('./recipes/avatar.js');
|
|
12
|
+
var controls = require('./recipes/controls.js');
|
|
12
13
|
var table = require('./recipes/table.js');
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -201,46 +202,6 @@ const textStyles = react.defineTextStyles({
|
|
|
201
202
|
value: SHARED_TEXT_STYLE_VALUES.overline,
|
|
202
203
|
},
|
|
203
204
|
});
|
|
204
|
-
/**
|
|
205
|
-
* `lg`/`xl` form-control font size.
|
|
206
|
-
*
|
|
207
|
-
* Chakra's input, textarea and select recipes put `sm`/`md` on the `sm`
|
|
208
|
-
* textStyle and `lg`/`xl` on `md`. This theme maps both textStyles to
|
|
209
|
-
* `subtitleAndP`, so every size rendered at the same 14px and only the height
|
|
210
|
-
* changed. `lg`/`xl` get their own step here (desktop 16px, phone 14px);
|
|
211
|
-
* `xs`/`sm`/`md` keep their current size on purpose, so call sites that do not
|
|
212
|
-
* pass `size` render exactly as before.
|
|
213
|
-
*
|
|
214
|
-
* Spacing tokens are em-based, so Chakra's `lg` `px: 4` grows with the font to
|
|
215
|
-
* 16px. `lg` drops to `px: 3` (12px) to stay close to `md`'s 10.5px.
|
|
216
|
-
*/
|
|
217
|
-
const FORM_CONTROL_LG_FONT_SIZE = { base: '1em', md: '1.143em' };
|
|
218
|
-
const formControlLgOverride = {
|
|
219
|
-
variants: {
|
|
220
|
-
size: {
|
|
221
|
-
lg: { fontSize: FORM_CONTROL_LG_FONT_SIZE, px: '3' },
|
|
222
|
-
xl: { fontSize: FORM_CONTROL_LG_FONT_SIZE },
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
// Same `lg` step as Input, and the same height as Input `lg` (Chakra puts the
|
|
227
|
-
// select trigger one token taller). Chakra's `py: 3` is em-based, so at 16px it
|
|
228
|
-
// alone pushes the trigger past the min height; let the height token win.
|
|
229
|
-
const selectSlotRecipe = react.defineSlotRecipe({
|
|
230
|
-
slots: ['root', 'trigger', 'content'],
|
|
231
|
-
variants: {
|
|
232
|
-
size: {
|
|
233
|
-
lg: {
|
|
234
|
-
root: {
|
|
235
|
-
'--select-trigger-height': 'sizes.11',
|
|
236
|
-
'--select-trigger-padding-x': 'spacing.3',
|
|
237
|
-
},
|
|
238
|
-
trigger: { fontSize: FORM_CONTROL_LG_FONT_SIZE, py: '1.5' },
|
|
239
|
-
content: { fontSize: FORM_CONTROL_LG_FONT_SIZE },
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
205
|
const normalizeNode = (node) => {
|
|
245
206
|
const out = {};
|
|
246
207
|
for (const [key, child] of Object.entries(node)) {
|
|
@@ -377,15 +338,23 @@ function createLogicianTheme(options = {}) {
|
|
|
377
338
|
colors: colors.createSemanticColors(options),
|
|
378
339
|
},
|
|
379
340
|
textStyles,
|
|
341
|
+
// Every control's `size` variant reads the shared scale in
|
|
342
|
+
// ./controlSizes — see ./recipes/controls.
|
|
380
343
|
recipes: {
|
|
381
|
-
|
|
382
|
-
|
|
344
|
+
button: controls.buttonRecipe,
|
|
345
|
+
input: controls.inputRecipe,
|
|
346
|
+
textarea: controls.textareaRecipe,
|
|
383
347
|
},
|
|
384
348
|
slotRecipes: {
|
|
385
349
|
accordion: accordion.accordionSlotRecipe,
|
|
386
350
|
avatar: avatar.avatarSlotRecipe,
|
|
387
351
|
table: table.tableSlotRecipe,
|
|
388
|
-
select: selectSlotRecipe,
|
|
352
|
+
select: controls.selectSlotRecipe,
|
|
353
|
+
combobox: controls.comboboxSlotRecipe,
|
|
354
|
+
tabs: controls.tabsSlotRecipe,
|
|
355
|
+
checkbox: controls.checkboxSlotRecipe,
|
|
356
|
+
radioGroup: controls.radioGroupSlotRecipe,
|
|
357
|
+
switch: controls.switchSlotRecipe,
|
|
389
358
|
},
|
|
390
359
|
},
|
|
391
360
|
});
|