@kanso-labs/kanso-ui 0.28.4 → 0.28.6
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/{LICENSE → LICENSE.md} +1 -1
- package/README.md +109 -11
- package/dist/calendar/styles.js +2 -0
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/index.js +28 -0
- package/dist/chip/index.js.map +1 -0
- package/dist/chip/styles.js +16 -0
- package/dist/chip/styles.js.map +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +10 -1
- package/dist/components/chip/index.js +22 -12
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.js +11 -6
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +9 -2
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +2 -1
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/copy-field/index.js +83 -30
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +6 -0
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +8 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +4 -1
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +6 -3
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +2 -1
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.d.ts +2 -1
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +8 -2
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/text/index.d.ts +8 -0
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +1 -0
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +8 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +3 -1
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/styles.css +16 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","TimeFieldProps","RACTimeFieldProps","TimeValue","stylex","DateInput","RACDateInput","TimeField","RACTimeField","FieldVariant","FieldBox","FieldMessage","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","renderSegment","segmentStyles","mergeStatefulStyles","Omit","T","className","description","error","floatingLabel","label","leadingIcon","style","trailingIcon","variant","t0","$","_c","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","Symbol","for","input","t7","t8","t9"],"sources":["../../../src/components/time-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TimeFieldProps as RACTimeFieldProps, TimeValue } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { DateInput as RACDateInput, TimeField as RACTimeField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A time typed a segment at a time. Every part of it is DateField's, from\n// `src/segments` — the segment treatment, the muted placeholder, the filled\n// focus and the punctuation between — so a time on a form and a date on the\n// same form cannot come apart.\n//\n// What differs is the value it holds and nothing else. The time pickers page\n// gives its input the text field's own box, which is what the shared field\n// chrome already draws, so there is no measurement here that the date field's\n// comment does not already name.\n//\n// **Twelve or twenty-four hours is the reader's locale, not a prop.** React\n// Aria decides from the locale whether there is a day-period segment at all,\n// so a field under `I18nProvider` with `en-GB` shows a 24-hour clock and the\n// same field under `en-US` shows AM and PM. Nothing here overrides it, and\n// `hourCycle` is React Aria's own for a page that has to.\n\ntype TimeFieldProps<T extends TimeValue = TimeValue> = Omit<RACTimeFieldProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the field's render state. */\n className?: RACTimeFieldProps<T>['className'];\n /** Supporting text under the field. */\n description?: string;\n /** The message shown instead of the description, which also marks the field invalid. */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","TimeFieldProps","RACTimeFieldProps","TimeValue","stylex","DateInput","RACDateInput","TimeField","RACTimeField","FieldVariant","FieldBox","FieldMessage","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","renderSegment","segmentStyles","mergeStatefulStyles","Omit","T","className","description","error","floatingLabel","label","leadingIcon","style","trailingIcon","variant","t0","$","_c","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","Symbol","for","input","t7","t8","t9"],"sources":["../../../src/components/time-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TimeFieldProps as RACTimeFieldProps, TimeValue } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { DateInput as RACDateInput, TimeField as RACTimeField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A time typed a segment at a time. Every part of it is DateField's, from\n// `src/segments` — the segment treatment, the muted placeholder, the filled\n// focus and the punctuation between — so a time on a form and a date on the\n// same form cannot come apart.\n//\n// What differs is the value it holds and nothing else. The time pickers page\n// gives its input the text field's own box, which is what the shared field\n// chrome already draws, so there is no measurement here that the date field's\n// comment does not already name.\n//\n// **Twelve or twenty-four hours is the reader's locale, not a prop.** React\n// Aria decides from the locale whether there is a day-period segment at all,\n// so a field under `I18nProvider` with `en-GB` shows a 24-hour clock and the\n// same field under `en-US` shows AM and PM. Nothing here overrides it, and\n// `hourCycle` is React Aria's own for a page that has to.\n\ntype TimeFieldProps<T extends TimeValue = TimeValue> = Omit<RACTimeFieldProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the field's render state. */\n className?: RACTimeFieldProps<T>['className'];\n /** Supporting text under the field. */\n description?: string;\n /** The message shown instead of the description, which also marks the field invalid. */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. An icon drawn\n * in `em` takes that size from the slot.\n */\n leadingIcon?: ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACTimeFieldProps<T>['style'];\n /**\n * An icon at the box's trailing end, in the page's 24dp size. An icon\n * drawn in `em` takes that size from the slot.\n */\n trailingIcon?: ReactNode;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n};\n\n/**\n * A time typed rather than picked: one segment per part, each its own focus\n * stop. The value is React Aria's — pass `value` with `onChange` to control\n * it, or `defaultValue` — as a `Time` from this package's `./date` subpath.\n *\n * ```tsx\n * import { Time } from '@kanso-labs/kanso-ui/date'\n *\n * <TimeField defaultValue={new Time(9, 30)} label=\"Label\" />\n * ```\n *\n * Whether it shows a twelve or twenty-four hour clock is the reader's\n * locale, through React Aria's `I18nProvider`. `granularity` takes it down\n * to seconds, and `minValue` and `maxValue` bound what may be typed.\n *\n * The segments are `DateField`'s, and the box, label and message are the\n * field chrome in `src/field`. The call site's `className` and `style` land\n * on the field as a whole, which is the element a layout positions.\n */\nfunction TimeField<T extends TimeValue>({\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n trailingIcon,\n variant = 'filled',\n ...props\n}: TimeFieldProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACTimeField<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, for the reason DateField's own comment gives: the\n // box reads an `<input>` to decide, and a segmented field has none —\n // its segments hold the value's line from the first render.\n isPopulated label={label} leading={leadingIcon} trailing={trailingIcon} variant={variant}>\n <FieldValue>\n <RACDateInput {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n </FieldValue>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACTimeField>;\n}\nexport type { TimeFieldProps };\nexport default TimeField;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,SAAAO,YAAAuB,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAwC,MAAA,EAAAV,aAAAC,OAAAC,eAAAS,IAAAC,YAAAC,IAAAV,OAAAC,aAAAE,cAAAC,SAAAO,IAAA,GAAAC,YAAAP;CAGtC,MAAAN,gBAAAS,OAAAK,KAAAA,IAAA,OAAAL;CACA,MAAAC,aAAAC,OAAAG,KAAAA,IAAA,QAAAH;CAIA,MAAAN,UAAAO,OAAAE,KAAAA,IAAA,WAAAF;CAGA,MAAAG,qBAA2BxB,2BAA2B;CAC9C,MAAAyB,KAAAhC;CAAY,IAAAiC;CAAA,IAAAV,EAAA,OAAAR,OAAA;EAAuCkB,KAAA3B,YAAYS,KAAK;EAACQ,EAAA,KAAAR;EAAAQ,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAyD,MAAAW,KAAAxB,oBAAoBd,MAAaS,YAAW8B,IAAK,GAAGN,OAAK;CAAC,IAAAO;CAAA,IAAAb,EAAA,OAAAc,OAAAC,IAAA,2BAAA,GAAA;EAM1LF,KAAA,oBAAC,YAAD,EAAA,UACE,oBAAC,WAAD;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,MAAAQ;EAAAR,EAAA,MAAAmB;CAAA,OAAAA,KAAAnB,EAAA;CAAA,OAbVmB;AAaU"}
|
|
@@ -30,7 +30,8 @@ type TokenFieldProps$1<T extends TokenFieldValue = TokenFieldValue> = {
|
|
|
30
30
|
label: string;
|
|
31
31
|
/**
|
|
32
32
|
* An icon at the start of the box, before the label and the value: the
|
|
33
|
-
* page's 24dp leading icon, in the muted role.
|
|
33
|
+
* page's 24dp leading icon, in the muted role. An icon drawn in `em` takes
|
|
34
|
+
* that size from the slot.
|
|
34
35
|
*/
|
|
35
36
|
leadingIcon?: ReactNode;
|
|
36
37
|
/**
|
|
@@ -43,6 +44,7 @@ type TokenFieldProps$1<T extends TokenFieldValue = TokenFieldValue> = {
|
|
|
43
44
|
/**
|
|
44
45
|
* An icon at the end of the box, after the value: the page's 24dp trailing
|
|
45
46
|
* icon, in the muted role and the error role once the field has an error.
|
|
47
|
+
* An icon drawn in `em` takes that size from the slot.
|
|
46
48
|
*/
|
|
47
49
|
trailingIcon?: ReactNode;
|
|
48
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","TokenFieldProps","RACTokenFieldProps","TokenInputProps","RACTokenInputProps","stylex","Token","RACToken","TokenField","RACTokenField","TokenInput","RACTokenInput","TokenFieldValue","FieldVariant","chipStyles","FieldBox","FieldMessage","fieldStyles","invalidFrom","focus","mergeStatefulStyles","colors","typography","TOKEN_LINE","styles","token","kfSwDN","kXLuUW","$$css","className","T","description","error","floatingLabel","label","leadingIcon","renderToken","segment","TokenSegment","style","trailingIcon","variant","Omit","Parameters","isPopulated","value","undefined","segments","some","text","length","tokenContent","props","base","ring","unselected","t0","$","_c","T0","populated","t1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","defaultValue","root","isDisabled","Symbol","for","0","1"],"sources":["../../../src/components/token-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TokenFieldProps as RACTokenFieldProps, TokenInputProps as RACTokenInputProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Token as RACToken, TokenField as RACTokenField, TokenInput as RACTokenInput, TokenFieldValue } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { chipStyles } from '../../chip/styles';\nimport { FieldBox, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom } from '../../field/root';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// The chips page's input chips inside a text field: a field whose value is\n// text with pills in it — a tag input, a mention field, a structured search\n// box. The box, label, supporting line and error are the field chrome in\n// `src/field`, shared with every other field; the pill is the chip module's\n// in `src/chip`, shared with Chip and ChipGroup. What is here is React Aria's\n// `TokenField` around them.\n//\n// The value is React Aria's `TokenFieldValue`, a list of text and token\n// segments rather than a string, and this component does not wrap it. What\n// counts as a token is the whole question a token field exists to answer — a\n// hash tag, an @ mention, a chosen contact — and a wrapper would be a second\n// place to decide it. The class is re-exported from the package so a call\n// site can subclass it and override `tokenize`.\n//\n// Three things are worth knowing.\n//\n// **The editable area is not an input.** React Aria draws a contenteditable\n// element, since a token cannot live inside an `<input>`. So the box is drawn\n// `multiline` and grows with what it holds, and the chrome is told whether it\n// is populated rather than reading an input's value — a token field is the\n// third control the chrome cannot ask, after a select and a picker.\n//\n// **The box's whole height is the editable area.** A press anywhere in the\n// box has to put the caret in the text, so the box is not covered by a press\n// target the way Select's is; React Aria's own element fills the control's\n// place and takes the press.\n//\n// **A token is drawn by the call site, or by this.** `renderToken` takes a\n// segment and returns what the pill holds; without it the pill holds the\n// segment's own text. Either way the pill is the page's, so a token here and\n// a chip elsewhere cannot drift.\n\n// A token's pill is 32dp tall inside a body line of 24, so the control's\n// line makes room for it or the pills overlap once the value wraps. Stated\n// once because the control's floor and its line have to agree, and the\n// clearance under the label is measured from it.\nconst TOKEN_LINE = '32px';\nconst styles = {\n token: {\n kfSwDN: \"x87ps6o\",\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\ntype TokenFieldProps<T extends TokenFieldValue = TokenFieldValue> = {\n /** A function may compute the class from the field's render state. */\n className?: RACTokenFieldProps<T>['className'];\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and the red underline both\n * follow from it.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds something. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a field with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role.\n */\n leadingIcon?: ReactNode;\n /**\n * What each token holds. Given a segment, return what to draw inside its\n * pill; without it the pill holds the segment's own text.\n */\n renderToken?: (segment: TokenSegment) => ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACTokenFieldProps<T>['style'];\n /**\n * An icon at the end of the box, after the value: the page's 24dp trailing\n * icon, in the muted role and the error role once the field has an error.\n */\n trailingIcon?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACTokenFieldProps<T>, 'children' | 'className' | 'style'>;\n\n// One token, as React Aria hands it to the editable area's render function.\n// Taken from that prop rather than imported, since the type lives in\n// `react-stately`, which this package does not depend on directly.\ntype TokenSegment = Parameters<RACTokenInputProps['children']>[0];\n\n// Whether the field holds anything, for the floating label. A token field's\n// editable area is a contenteditable element rather than an input, so the\n// chrome cannot read a value off it and is told instead.\nfunction isPopulated(value: TokenFieldValue | undefined) {\n if (value === undefined) {\n return undefined;\n }\n return value.segments.some(segment => segment.text.length > 0);\n}\n\n// What each token draws. Built by a call rather than written inline at the\n// prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its input.\nfunction tokenContent(renderToken: TokenFieldProps['renderToken']) {\n return (segment: TokenSegment) => <RACToken {...stylex.props(chipStyles.base, focus.ring, chipStyles.unselected, styles.token)}>\n {renderToken === undefined ? segment.text : renderToken(segment)}\n </RACToken>;\n}\n\n/**\n * A labelled field whose value is text with inline tokens — a tag input, a\n * mention field, a structured search box. Its value is React Aria's\n * `TokenFieldValue`: pass `value` with `onChange` to control it, or\n * `defaultValue` to let it keep its own.\n *\n * ```tsx\n * const [value, setValue] = useState(new TokenFieldValue([]))\n *\n * <TokenField label=\"Label\" onChange={setValue} value={value} />\n * ```\n *\n * What counts as a token is the call site's: subclass `TokenFieldValue` and\n * override `tokenize`, which the package re-exports for that. `renderToken`\n * decides what each pill holds; without it, the segment's own text.\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, and the pill is the chip module's, shared with Chip and\n * ChipGroup.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction TokenField<T extends TokenFieldValue = TokenFieldValue>({\n description,\n error,\n floatingLabel = true,\n label,\n leadingIcon,\n renderToken,\n trailingIcon,\n variant = 'filled',\n ...props\n}: TokenFieldProps<T>) {\n const populated = isPopulated(props.value ?? props.defaultValue);\n return <RACTokenField<T> {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `TokenField` does not, so the\n // box is told outright or its label and its underline never turn.\n isDisabled={props.isDisabled} isInvalid={invalidFrom(error)} isPopulated={populated} label={label} leading={leadingIcon} multiline trailing={trailingIcon} variant={variant}>\n <RACTokenInput<T> {...{\n 0: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x21xpn4 x1t137rt x126k92a\"\n },\n 1: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x1t137rt x126k92a xhm3zzy xczxdwi\"\n }\n }[!!(variant === 'filled') << 0]}>\n {tokenContent(renderToken)}\n </RACTokenInput>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACTokenField>;\n}\nexport type { TokenFieldProps, TokenSegment };\nexport default TokenField;"],"mappings":";;;;;;;;;;AAkDA,MAAMwB,SAAS,EACbC,OAAO;CACLC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA2DA,SAASgB,YAAYC,OAAoC;CACvD,IAAIA,UAAUC,KAAAA,GACZ;CAEF,OAAOD,MAAME,SAASC,MAAKX,YAAWA,QAAQY,KAAKC,SAAS,CAAC;AAC/D;AAKA,SAASC,aAAaf,aAA6C;CACjE,QAAQC,YAA0B,oBAAC,OAAD;EAAU,GAAIhC,MAAaS,WAAWuC,MAAMlC,MAAMmC,MAAMxC,WAAWyC,YAAY/B,OAAOC,KAAK;EACxHW,UAAAA,gBAAgBU,KAAAA,IAAYT,QAAQY,OAAOb,YAAYC,OAAO;CACvD,CAAA;AACd;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAA7B,aAAAgD,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAA5B;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAyB;CAAA,IAAAR;CAAA,IAAAhB;CAAA,IAAAyB;CAAA,IAAAC;CAAA,IAAAtB;CAAA,IAAAC;CAAA,IAAAgB,EAAA,OAAAD,IAAA;EAAiE,MAAA,EAAAzB,aAAAgC,IAAA/B,OAAAgC,IAAA/B,eAAAgC,IAAA/B,OAAAgC,IAAA/B,aAAAgC,IAAA/B,aAAAgC,IAAA5B,cAAA6B,IAAA5B,SAAA6B,KAAA,GAAAC,QAAAf;EAAAzB,cAAAgC;EAAA/B,QAAAgC;EAAA9B,QAAAgC;EAAA/B,cAAAgC;EAAA/B,cAAAgC;EAAA5B,eAAA6B;EAAAjB,UAAAmB;EAG/D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A,MAAAzB;EAAAyB,EAAA,MAAAa;CAAA,OAAAA,MAAAb,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,QAAAE,MAAAF,EAAA,QAAAI,MAAAJ,EAAA,QAAAa,OAAAb,EAAA,QAAAK,MAAAL,EAAA,QAAAY,IAAA;EAjBrDE,MAAA,qBAAC,IAAD;GAAc,GAAQnB;GAAK,GAAMU;GAAjC,UAAA,CACHO,IAgBAC,GAjBiB;;EAkBHb,EAAA,MAAAE;EAAAF,EAAA,MAAAI;EAAAJ,EAAA,MAAAa;EAAAb,EAAA,MAAAK;EAAAL,EAAA,MAAAY;EAAAZ,EAAA,MAAAc;CAAA,OAAAA,MAAAd,EAAA;CAAA,OAlBXc;AAkBW"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","TokenFieldProps","RACTokenFieldProps","TokenInputProps","RACTokenInputProps","stylex","Token","RACToken","TokenField","RACTokenField","TokenInput","RACTokenInput","TokenFieldValue","FieldVariant","chipStyles","FieldBox","FieldMessage","fieldStyles","invalidFrom","focus","mergeStatefulStyles","colors","typography","TOKEN_LINE","styles","token","kfSwDN","kXLuUW","$$css","className","T","description","error","floatingLabel","label","leadingIcon","renderToken","segment","TokenSegment","style","trailingIcon","variant","Omit","Parameters","isPopulated","value","undefined","segments","some","text","length","tokenContent","props","base","ring","unselected","t0","$","_c","T0","populated","t1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","defaultValue","root","isDisabled","Symbol","for","0","1"],"sources":["../../../src/components/token-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TokenFieldProps as RACTokenFieldProps, TokenInputProps as RACTokenInputProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Token as RACToken, TokenField as RACTokenField, TokenInput as RACTokenInput, TokenFieldValue } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { chipStyles } from '../../chip/styles';\nimport { FieldBox, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom } from '../../field/root';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// The chips page's input chips inside a text field: a field whose value is\n// text with pills in it — a tag input, a mention field, a structured search\n// box. The box, label, supporting line and error are the field chrome in\n// `src/field`, shared with every other field; the pill is the chip module's\n// in `src/chip`, shared with Chip and ChipGroup. What is here is React Aria's\n// `TokenField` around them.\n//\n// The value is React Aria's `TokenFieldValue`, a list of text and token\n// segments rather than a string, and this component does not wrap it. What\n// counts as a token is the whole question a token field exists to answer — a\n// hash tag, an @ mention, a chosen contact — and a wrapper would be a second\n// place to decide it. The class is re-exported from the package so a call\n// site can subclass it and override `tokenize`.\n//\n// Three things are worth knowing.\n//\n// **The editable area is not an input.** React Aria draws a contenteditable\n// element, since a token cannot live inside an `<input>`. So the box is drawn\n// `multiline` and grows with what it holds, and the chrome is told whether it\n// is populated rather than reading an input's value — a token field is the\n// third control the chrome cannot ask, after a select and a picker.\n//\n// **The box's whole height is the editable area.** A press anywhere in the\n// box has to put the caret in the text, so the box is not covered by a press\n// target the way Select's is; React Aria's own element fills the control's\n// place and takes the press.\n//\n// **A token is drawn by the call site, or by this.** `renderToken` takes a\n// segment and returns what the pill holds; without it the pill holds the\n// segment's own text. Either way the pill is the page's, so a token here and\n// a chip elsewhere cannot drift.\n\n// A token's pill is 32dp tall inside a body line of 24, so the control's\n// line makes room for it or the pills overlap once the value wraps. Stated\n// once because the control's floor and its line have to agree, and the\n// clearance under the label is measured from it.\nconst TOKEN_LINE = '32px';\nconst styles = {\n token: {\n kfSwDN: \"x87ps6o\",\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\ntype TokenFieldProps<T extends TokenFieldValue = TokenFieldValue> = {\n /** A function may compute the class from the field's render state. */\n className?: RACTokenFieldProps<T>['className'];\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and the red underline both\n * follow from it.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds something. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a field with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * What each token holds. Given a segment, return what to draw inside its\n * pill; without it the pill holds the segment's own text.\n */\n renderToken?: (segment: TokenSegment) => ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACTokenFieldProps<T>['style'];\n /**\n * An icon at the end of the box, after the value: the page's 24dp trailing\n * icon, in the muted role and the error role once the field has an error.\n * An icon drawn in `em` takes that size from the slot.\n */\n trailingIcon?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACTokenFieldProps<T>, 'children' | 'className' | 'style'>;\n\n// One token, as React Aria hands it to the editable area's render function.\n// Taken from that prop rather than imported, since the type lives in\n// `react-stately`, which this package does not depend on directly.\ntype TokenSegment = Parameters<RACTokenInputProps['children']>[0];\n\n// Whether the field holds anything, for the floating label. A token field's\n// editable area is a contenteditable element rather than an input, so the\n// chrome cannot read a value off it and is told instead.\nfunction isPopulated(value: TokenFieldValue | undefined) {\n if (value === undefined) {\n return undefined;\n }\n return value.segments.some(segment => segment.text.length > 0);\n}\n\n// What each token draws. Built by a call rather than written inline at the\n// prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its input.\nfunction tokenContent(renderToken: TokenFieldProps['renderToken']) {\n return (segment: TokenSegment) => <RACToken {...stylex.props(chipStyles.base, focus.ring, chipStyles.unselected, styles.token)}>\n {renderToken === undefined ? segment.text : renderToken(segment)}\n </RACToken>;\n}\n\n/**\n * A labelled field whose value is text with inline tokens — a tag input, a\n * mention field, a structured search box. Its value is React Aria's\n * `TokenFieldValue`: pass `value` with `onChange` to control it, or\n * `defaultValue` to let it keep its own.\n *\n * ```tsx\n * const [value, setValue] = useState(new TokenFieldValue([]))\n *\n * <TokenField label=\"Label\" onChange={setValue} value={value} />\n * ```\n *\n * What counts as a token is the call site's: subclass `TokenFieldValue` and\n * override `tokenize`, which the package re-exports for that. `renderToken`\n * decides what each pill holds; without it, the segment's own text.\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, and the pill is the chip module's, shared with Chip and\n * ChipGroup.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction TokenField<T extends TokenFieldValue = TokenFieldValue>({\n description,\n error,\n floatingLabel = true,\n label,\n leadingIcon,\n renderToken,\n trailingIcon,\n variant = 'filled',\n ...props\n}: TokenFieldProps<T>) {\n const populated = isPopulated(props.value ?? props.defaultValue);\n return <RACTokenField<T> {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `TokenField` does not, so the\n // box is told outright or its label and its underline never turn.\n isDisabled={props.isDisabled} isInvalid={invalidFrom(error)} isPopulated={populated} label={label} leading={leadingIcon} multiline trailing={trailingIcon} variant={variant}>\n <RACTokenInput<T> {...{\n 0: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x21xpn4 x1t137rt x126k92a\"\n },\n 1: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x1t137rt x126k92a xhm3zzy xczxdwi\"\n }\n }[!!(variant === 'filled') << 0]}>\n {tokenContent(renderToken)}\n </RACTokenInput>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACTokenField>;\n}\nexport type { TokenFieldProps, TokenSegment };\nexport default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AL,EAAA,QAAAY,IAAA;EAjBrDE,MAAA,qBAAC,IAAD;GAAc,GAAQnB;GAAK,GAAMU;GAAjC,UAAA,CACHO,IAgBAC,GAjBiB;;EAkBHb,EAAA,MAAAE;EAAAF,EAAA,MAAAI;EAAAJ,EAAA,MAAAa;EAAAb,EAAA,MAAAK;EAAAL,EAAA,MAAAY;EAAAZ,EAAA,MAAAc;CAAA,OAAAA,MAAAd,EAAA;CAAA,OAlBXc;AAkBW"}
|
package/dist/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","names":["collectionSizes","dropIndicator","listRow","listRowTwoLine","menuRow","sectionHeading","tableHeaderRow","tableRow","const"],"sources":["../src/layout.ts"],"sourcesContent":["// What the collections actually measure, for the layouts a virtualized one is\n// given. React Aria's `ListLayout`, `GridLayout`, `TableLayout` and\n// `WaterfallLayout` position rows from a size rather than from the DOM, so a\n// virtualized List, ListBox, Table or Tree has to be told how tall its rows\n// are — and a number guessed at the call site puts every row in the wrong\n// place the moment a component's own height changes.\n//\n// These are that number, and `src/layout.test.
|
|
1
|
+
{"version":3,"file":"layout.js","names":["collectionSizes","dropIndicator","listRow","listRowTwoLine","menuRow","sectionHeading","tableHeaderRow","tableRow","const"],"sources":["../src/layout.ts"],"sourcesContent":["// What the collections actually measure, for the layouts a virtualized one is\n// given. React Aria's `ListLayout`, `GridLayout`, `TableLayout` and\n// `WaterfallLayout` position rows from a size rather than from the DOM, so a\n// virtualized List, ListBox, Table or Tree has to be told how tall its rows\n// are — and a number guessed at the call site puts every row in the wrong\n// place the moment a component's own height changes.\n//\n// These are that number, and `src/layout.test.tsx` renders each collection and\n// measures it, so a constant here cannot drift from what the component draws.\n//\n// They are the heights as rendered, which is what a virtualizer needs — not\n// what a spec page names, where the two can differ. They agree today.\n\n/**\n * The heights the collections draw, in pixels, for a virtualized one's\n * layout options.\n *\n * ```tsx\n * <Virtualizer\n * layout={ListLayout}\n * layoutOptions={{\n * rowSize: collectionSizes.listRow,\n * headingSize: collectionSizes.sectionHeading,\n * }}\n * >\n * <List aria-label=\"Label\" items={items}>{renderItem}</List>\n * </Virtualizer>\n * ```\n *\n * A row that wraps is taller than any of these, so a collection whose content\n * varies takes `estimatedRowSize` rather than `rowSize` and lets React Aria\n * measure the rest.\n */\nconst collectionSizes = {\n /** The thickness of the line a drag draws between two rows. */\n dropIndicator: 2,\n /** A `List`, `ListBox` or `Tree` row with a headline alone. */\n listRow: 56,\n /** A `List`, `ListBox` or `Tree` row with a headline and a supporting line. */\n listRowTwoLine: 72,\n /** A `Menu` item, which the menus page gives a shorter floor than a list's. */\n menuRow: 48,\n /** A `List.Section` or `Tree.Section` heading. */\n sectionHeading: 38,\n /** A `Table` header row, which the data tables page draws taller than a body row. */\n tableHeaderRow: 56,\n /** A `Table` body row. */\n tableRow: 52,\n} as const\n\nexport { collectionSizes }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiCA,MAAMA,kBAAkB;;CAEtBC,eAAe;;CAEfC,SAAS;;CAETC,gBAAgB;;CAEhBC,SAAS;;CAETC,gBAAgB;;CAEhBC,gBAAgB;;CAEhBC,UAAU;AACZ"}
|
package/dist/styles.css
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
grid-area: 1 / 1 / 2 / 2;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
.x15r89dc {
|
|
13
|
+
grid-area: 1 / 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
.x1jz8bvi {
|
|
13
17
|
inset: -1px;
|
|
14
18
|
}
|
|
@@ -1399,6 +1403,10 @@
|
|
|
1399
1403
|
justify-content: space-between;
|
|
1400
1404
|
}
|
|
1401
1405
|
|
|
1406
|
+
.x1o2pa38 {
|
|
1407
|
+
justify-items: center;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1402
1410
|
.x1qn8t5l {
|
|
1403
1411
|
letter-spacing: var(--x10nh56i);
|
|
1404
1412
|
}
|
|
@@ -1563,6 +1571,10 @@
|
|
|
1563
1571
|
margin-inline-start: auto;
|
|
1564
1572
|
}
|
|
1565
1573
|
|
|
1574
|
+
.xxuhe3a {
|
|
1575
|
+
margin-inline-start: calc(-1 * var(--xod9tvo));
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1566
1578
|
.x1m7rnnc {
|
|
1567
1579
|
margin-inline-start: var(--x3km7fe);
|
|
1568
1580
|
}
|
|
@@ -2683,6 +2695,10 @@
|
|
|
2683
2695
|
min-height: calc(32px + var(--x1lrg4gv));
|
|
2684
2696
|
}
|
|
2685
2697
|
|
|
2698
|
+
.x1fivsg2 {
|
|
2699
|
+
min-height: 280px;
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2686
2702
|
.x1chvrdh {
|
|
2687
2703
|
min-height: var(--x-minBlockSize);
|
|
2688
2704
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanso-labs/kanso-ui",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.6",
|
|
4
4
|
"description": "A React component library built on React Aria Components primitives and styled with StyleX, with design tokens sourced from a single W3C DTCG file and compiled via Style Dictionary",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@commitlint/cli": "21.2.2",
|
|
75
75
|
"@commitlint/config-conventional": "21.2.2",
|
|
76
76
|
"@eslint/js": "10.0.1",
|
|
77
|
-
"@kanso-labs/unplugin-style-dictionary": "0.
|
|
77
|
+
"@kanso-labs/unplugin-style-dictionary": "0.9.0",
|
|
78
78
|
"@rolldown/plugin-babel": "0.2.4",
|
|
79
79
|
"@storybook/addon-a11y": "10.6.0",
|
|
80
80
|
"@storybook/addon-docs": "10.6.0",
|
|
@@ -101,14 +101,14 @@
|
|
|
101
101
|
"oxc-transform-react": "0.145.0",
|
|
102
102
|
"oxfmt": "0.68.0",
|
|
103
103
|
"oxlint": "1.83.0",
|
|
104
|
-
"oxlint-tsgolint": "7.0.
|
|
104
|
+
"oxlint-tsgolint": "7.0.2002",
|
|
105
105
|
"playwright": "1.63.0",
|
|
106
106
|
"publint": "0.3.24",
|
|
107
107
|
"react": "19.3.0",
|
|
108
108
|
"react-dom": "19.3.0",
|
|
109
109
|
"rimraf": "6.1.3",
|
|
110
110
|
"storybook": "10.6.0",
|
|
111
|
-
"style-dictionary": "5.5.
|
|
111
|
+
"style-dictionary": "5.5.4",
|
|
112
112
|
"tsdown": "0.23.0",
|
|
113
113
|
"typescript": "6.0.3",
|
|
114
114
|
"typescript-eslint": "8.70.0",
|