@kanso-labs/kanso-ui 0.45.27 → 0.45.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/dist/calendar/index.js +4 -4
- package/dist/calendar/index.js.map +1 -1
- package/dist/components/app-bar/index.js +1 -0
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +6 -6
- package/dist/components/autocomplete/index.js +4 -4
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.d.ts +5 -5
- package/dist/components/breadcrumbs/index.js +5 -5
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +7 -7
- package/dist/components/calendar/index.js +4 -4
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +5 -5
- package/dist/components/checkbox-group/index.js +4 -4
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +4 -4
- package/dist/components/color-area/index.js +4 -4
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +7 -7
- package/dist/components/color-field/index.js +4 -4
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +4 -4
- package/dist/components/color-picker/index.js +4 -4
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-slider/index.d.ts +6 -6
- package/dist/components/color-slider/index.js +4 -4
- package/dist/components/color-slider/index.js.map +1 -1
- package/dist/components/color-swatch/index.d.ts +4 -4
- package/dist/components/color-swatch/index.js +4 -4
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.d.ts +12 -12
- package/dist/components/color-swatch-picker/index.js +7 -7
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/color-wheel/index.d.ts +6 -6
- package/dist/components/color-wheel/index.js +4 -4
- package/dist/components/color-wheel/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +5 -5
- package/dist/components/combo-box/index.js +4 -4
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +6 -6
- package/dist/components/date-field/index.js +4 -4
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +6 -6
- package/dist/components/date-picker/index.js +4 -4
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +6 -6
- package/dist/components/date-range-picker/index.js +4 -4
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +6 -6
- package/dist/components/dialog/index.js +9 -9
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +10 -10
- package/dist/components/disclosure/index.js +8 -8
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/disclosure-group/index.d.ts +4 -4
- package/dist/components/disclosure-group/index.js +4 -4
- package/dist/components/disclosure-group/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +8 -8
- package/dist/components/drop-zone/index.js +6 -6
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/form/index.d.ts +5 -5
- package/dist/components/form/index.js +4 -4
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/link/index.d.ts +6 -6
- package/dist/components/link/index.js +4 -4
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +18 -18
- package/dist/components/list-box/index.js +11 -11
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +16 -16
- package/dist/components/menu/index.js +14 -14
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +6 -6
- package/dist/components/meter/index.js +4 -4
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +15 -15
- package/dist/components/navigation-tree/index.js +13 -13
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +5 -5
- package/dist/components/number-field/index.js +4 -4
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popover/index.js +12 -12
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +5 -5
- package/dist/components/radio-group/index.js +4 -4
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +7 -7
- package/dist/components/range-calendar/index.js +4 -4
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +6 -6
- package/dist/components/search-field/index.js +4 -4
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/select/index.d.ts +5 -5
- package/dist/components/select/index.js +4 -4
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +5 -5
- package/dist/components/separator/index.js +4 -4
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +5 -5
- package/dist/components/sheet/index.js +12 -12
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +4 -4
- package/dist/components/slider/index.js +4 -4
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/table/index.d.ts +20 -20
- package/dist/components/table/index.js +17 -17
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +5 -5
- package/dist/components/tabs/index.js +8 -8
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +2 -2
- package/dist/components/text-area/index.js +2 -2
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +4 -4
- package/dist/components/text-field/index.js +4 -4
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +6 -6
- package/dist/components/time-field/index.js +4 -4
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +7 -7
- package/dist/components/token-field/index.js +4 -4
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +6 -6
- package/dist/components/toolbar/index.js +4 -4
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/index.js +4 -4
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +17 -17
- package/dist/components/tree/index.js +14 -14
- package/dist/components/tree/index.js.map +1 -1
- package/dist/drag/hooks.d.ts +3 -3
- package/dist/drag/hooks.js +4 -4
- package/dist/drag/hooks.js.map +1 -1
- package/dist/drag/index.js +4 -4
- package/dist/drag/index.js.map +1 -1
- package/dist/react-aria.d.ts +2 -2
- package/dist/react-aria.js +2 -2
- package/package.json +10 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, RefAttributes } from "react";
|
|
2
|
-
import { CheckboxGroupProps } from "react-aria-components";
|
|
3
|
-
type CheckboxGroupProps
|
|
2
|
+
import { CheckboxGroupProps as CheckboxGroupProps$1 } from "react-aria-components";
|
|
3
|
+
type CheckboxGroupProps = {
|
|
4
4
|
/** The checkboxes, each with a `value` of its own. */
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
/**
|
|
@@ -24,7 +24,7 @@ type CheckboxGroupProps$1 = {
|
|
|
24
24
|
* introduce.
|
|
25
25
|
*/
|
|
26
26
|
label: string;
|
|
27
|
-
} & Omit<CheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;
|
|
27
|
+
} & Omit<CheckboxGroupProps$1, 'children' | 'isInvalid' | 'validationBehavior'>;
|
|
28
28
|
/**
|
|
29
29
|
* A labelled set of checkboxes with one value between them. The value is
|
|
30
30
|
* React Aria's: pass `value` with `onChange` to control it, or
|
|
@@ -35,5 +35,5 @@ type CheckboxGroupProps$1 = {
|
|
|
35
35
|
* The call site's `className` and `style` land on the group as a whole,
|
|
36
36
|
* which is the element a layout positions.
|
|
37
37
|
*/
|
|
38
|
-
declare function CheckboxGroup
|
|
39
|
-
export { type CheckboxGroupProps
|
|
38
|
+
declare function CheckboxGroup({ children, description, error, label, ...props }: CheckboxGroupProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
39
|
+
export { type CheckboxGroupProps, CheckboxGroup as default };
|
|
@@ -7,7 +7,7 @@ import { groupStyles } from "../../field/styles.js";
|
|
|
7
7
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
8
8
|
import { c } from "react/compiler-runtime";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { CheckboxGroup } from "react-aria-components";
|
|
10
|
+
import { CheckboxGroup as CheckboxGroup$1 } from "react-aria-components";
|
|
11
11
|
// src/components/checkbox-group/index.tsx
|
|
12
12
|
/**
|
|
13
13
|
* A labelled set of checkboxes with one value between them. The value is
|
|
@@ -19,11 +19,11 @@ import { CheckboxGroup } from "react-aria-components";
|
|
|
19
19
|
* The call site's `className` and `style` land on the group as a whole,
|
|
20
20
|
* which is the element a layout positions.
|
|
21
21
|
*/
|
|
22
|
-
function CheckboxGroup
|
|
22
|
+
function CheckboxGroup(t0) {
|
|
23
23
|
const $ = c(14);
|
|
24
24
|
const { children, description, error, label, ...props$1 } = t0;
|
|
25
25
|
const validationBehavior = useFieldValidationBehavior();
|
|
26
|
-
const T0 = CheckboxGroup;
|
|
26
|
+
const T0 = CheckboxGroup$1;
|
|
27
27
|
let t1;
|
|
28
28
|
if ($[0] !== error) {
|
|
29
29
|
t1 = invalidFrom(error);
|
|
@@ -79,6 +79,6 @@ function groupContent(label, children, description, error) {
|
|
|
79
79
|
})
|
|
80
80
|
] });
|
|
81
81
|
}
|
|
82
|
-
export { CheckboxGroup
|
|
82
|
+
export { CheckboxGroup as default };
|
|
83
83
|
|
|
84
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","CheckboxGroup","RACCheckboxGroup","controlStyles","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","t0","$","props","validationBehavior","T0","t1","t2","root","t3","groupContent","t4","state","isRequired","stack","isDisabled"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxGroupRenderProps, CheckboxGroupProps as RACCheckboxGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxGroup as RACCheckboxGroup } from 'react-aria-components';\nimport { controlStyles } from '../../control/styles';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A labelled set of checkboxes sharing one value. The checkbox page draws\n// the boxes; the group is what the ARIA pattern asks for around them — a\n// group named by its label, described by its description, and invalid as a\n// whole — and its label, description and error are the field chrome's, so a\n// group reads like the fields beside it. The label is label-large, the role\n// a field's label takes at rest, since a group has no box to float it in.\ntype CheckboxGroupProps = {\n /** The checkboxes, each with a `value` of its own. */\n children?: ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state — the message, the boxes' error\n * colours and `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n label: string;\n} & Omit<RACCheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Checkbox` inside\n * names the entry it stands for with `value`. Disabled, read-only and the\n * error state reach every checkbox from here.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction CheckboxGroup({\n children,\n description,\n error,\n label,\n ...props\n}: CheckboxGroupProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACCheckboxGroup isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root), props)}>\n {groupContent(label, children, description, error)}\n </RACCheckboxGroup>;\n}\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The label takes the group's render state, so\n// its colour follows disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined) {\n return (state: CheckboxGroupRenderProps) => <>\n <FieldLabel isRequired={state.isRequired} state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div {...stylex.props(controlStyles.stack)}>{children}</div>\n <FieldMessage description={description} error={error} inset={false} isDisabled={state.isDisabled} />\n </>;\n}\nexport type { CheckboxGroupProps };\nexport default CheckboxGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsDA,SAAAE,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","CheckboxGroup","RACCheckboxGroup","controlStyles","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","t0","$","props","validationBehavior","T0","t1","t2","root","t3","groupContent","t4","state","isRequired","stack","isDisabled"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxGroupRenderProps, CheckboxGroupProps as RACCheckboxGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxGroup as RACCheckboxGroup } from 'react-aria-components';\nimport { controlStyles } from '../../control/styles';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A labelled set of checkboxes sharing one value. The checkbox page draws\n// the boxes; the group is what the ARIA pattern asks for around them — a\n// group named by its label, described by its description, and invalid as a\n// whole — and its label, description and error are the field chrome's, so a\n// group reads like the fields beside it. The label is label-large, the role\n// a field's label takes at rest, since a group has no box to float it in.\ntype CheckboxGroupProps = {\n /** The checkboxes, each with a `value` of its own. */\n children?: ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state — the message, the boxes' error\n * colours and `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n label: string;\n} & Omit<RACCheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Checkbox` inside\n * names the entry it stands for with `value`. Disabled, read-only and the\n * error state reach every checkbox from here.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction CheckboxGroup({\n children,\n description,\n error,\n label,\n ...props\n}: CheckboxGroupProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACCheckboxGroup isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root), props)}>\n {groupContent(label, children, description, error)}\n </RACCheckboxGroup>;\n}\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The label takes the group's render state, so\n// its colour follows disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined) {\n return (state: CheckboxGroupRenderProps) => <>\n <FieldLabel isRequired={state.isRequired} state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div {...stylex.props(controlStyles.stack)}>{children}</div>\n <FieldMessage description={description} error={error} inset={false} isDisabled={state.isDisabled} />\n </>;\n}\nexport type { CheckboxGroupProps };\nexport default CheckboxGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsDA,SAAAE,cAAAW,IAAA;CAAA,MAAAC,IAAAd,EAAA,EAAA;CAAuB,MAAA,EAAAS,UAAAC,aAAAC,OAAAC,OAAA,GAAAG,YAAAF;CAOrB,MAAAG,qBAA2BV,2BAA2B;CAC9C,MAAAW,KAAAd;CAAgB,IAAAe;CAAA,IAAAJ,EAAA,OAAAH,OAAA;EAAYO,KAAAb,YAAYM,KAAK;EAACG,EAAA,KAAAH;EAAAG,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAyD,MAAAK,KAAAX,oBAAoBP,MAAaM,YAAWa,IAAK,GAAGL,OAAK;CAAC,IAAAM;CAAA,IAAAP,EAAA,OAAAL,YAAAK,EAAA,OAAAJ,eAAAI,EAAA,OAAAH,SAAAG,EAAA,OAAAF,OAAA;EACpKS,KAAAC,aAAaV,OAAOH,UAAUC,aAAaC,KAAK;EAACG,EAAA,KAAAL;EAAAK,EAAA,KAAAJ;EAAAI,EAAA,KAAAH;EAAAG,EAAA,KAAAF;EAAAE,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,OAAAG,MAAAH,EAAA,OAAAC,WAAAD,EAAA,OAAAI,MAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAO,MAAAP,EAAA,QAAAE,oBAAA;EAD/CO,KAAA,oBAAC,IAAD;GAA6B,WAAAL;GAAwCF;GAAkB,GAAMD;GAAK,GAAMI;GAC1GE,UAAAA;EADmB,CAAA;EAEHP,EAAA,KAAAG;EAAAH,EAAA,KAAAC;EAAAD,EAAA,KAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAE;EAAAF,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAFdS;AAEc;AAOvB,SAASD,aAAaV,OAAeH,UAAqBC,aAAiCC,OAA2B;CACpH,QAAQa,UAAoC,qBAAA,UAAA,EAAA,UAAA;EACxC,oBAAC,YAAD;GAAY,YAAYA,MAAMC;GAAmBD;GAAO,SAAQ;GAC7DZ,UAAAA;EACS,CAAA;EACZ,oBAAC,OAAD;GAAK,GAAIX,MAAaG,cAAcsB,KAAK;GAAIjB;EAAc,CAAA;EAC3D,oBAAC,cAAD;GAA2BC;GAAoBC;GAAO,OAAO;GAAO,YAAYa,MAAMG;EAAW,CAAA;CACnG,EAAA,CAAA;AACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, RefAttributes } from "react";
|
|
2
|
-
import { ColorAreaProps } from "react-aria-components";
|
|
3
|
-
type ColorAreaProps
|
|
2
|
+
import { ColorAreaProps as ColorAreaProps$1 } from "react-aria-components";
|
|
3
|
+
type ColorAreaProps = Omit<ColorAreaProps$1, 'children' | 'className' | 'style'> & {
|
|
4
4
|
/**
|
|
5
5
|
* Lands on the square around the plane, which is the element a layout
|
|
6
6
|
* positions and the one that carries its size.
|
|
@@ -43,5 +43,5 @@ type ColorAreaProps$1 = Omit<ColorAreaProps, 'children' | 'className' | 'style'>
|
|
|
43
43
|
* reason `ColorSwatch` does not take them: the element they would read
|
|
44
44
|
* state for is not the one a layout reaches.
|
|
45
45
|
*/
|
|
46
|
-
declare function ColorArea
|
|
47
|
-
export { type ColorAreaProps
|
|
46
|
+
declare function ColorArea({ className, isDisabled, ref, style, ...props }: ColorAreaProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
47
|
+
export { type ColorAreaProps, ColorArea as default };
|
|
@@ -3,7 +3,7 @@ import { thumbClassName } from "../../styles/color.js";
|
|
|
3
3
|
import { mergeStyles } from "../../styles/merge.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { ColorArea, ColorThumb } from "react-aria-components";
|
|
6
|
+
import { ColorArea as ColorArea$1, ColorThumb } from "react-aria-components";
|
|
7
7
|
// src/components/color-area/index.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Two channels of a colour as a plane, with a handle where they meet. The
|
|
@@ -39,7 +39,7 @@ import { ColorArea, ColorThumb } from "react-aria-components";
|
|
|
39
39
|
* reason `ColorSwatch` does not take them: the element they would read
|
|
40
40
|
* state for is not the one a layout reaches.
|
|
41
41
|
*/
|
|
42
|
-
function ColorArea
|
|
42
|
+
function ColorArea(t0) {
|
|
43
43
|
const $ = c(20);
|
|
44
44
|
let className;
|
|
45
45
|
let props;
|
|
@@ -92,7 +92,7 @@ function ColorArea$1(t0) {
|
|
|
92
92
|
} else t5 = $[11];
|
|
93
93
|
let t6;
|
|
94
94
|
if ($[12] !== isDisabled || $[13] !== props || $[14] !== t4) {
|
|
95
|
-
t6 = /* @__PURE__ */ jsx(ColorArea, {
|
|
95
|
+
t6 = /* @__PURE__ */ jsx(ColorArea$1, {
|
|
96
96
|
isDisabled,
|
|
97
97
|
...props,
|
|
98
98
|
...t4,
|
|
@@ -117,6 +117,6 @@ function ColorArea$1(t0) {
|
|
|
117
117
|
} else t7 = $[19];
|
|
118
118
|
return t7;
|
|
119
119
|
}
|
|
120
|
-
export { ColorArea
|
|
120
|
+
export { ColorArea as default };
|
|
121
121
|
|
|
122
122
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","ColorArea","thumbClassName","mergeStyles","className","style","t0","$","props","ref","t1","isDisabled","undefined","t2","0","1","t3","Symbol","for","t4","t5","t6","t7","RACColorThumb","RACColorArea"],"sources":["../../../src/components/color-area/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, RefAttributes } from 'react';\nimport type { ColorAreaProps as RACColorAreaProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorArea as RACColorArea, ColorThumb as RACColorThumb } from 'react-aria-components';\nimport { thumbClassName } from '../../styles/color';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Two channels of a colour at once, as a plane: one runs along the inline\n// axis and one along the block axis, and the handle sits where they meet.\n// React Aria paints both gradients on the plane's own inline `background`\n// and moves the handle in two axes, so what is here is the plane's shape and\n// the handle `ColorSlider` already draws, from `src/styles/color.ts`.\n//\n// The design carries no page for this, so the two choices below are the\n// library's own.\n//\n// **It is square, and takes the width it is given.** A plane has no natural\n// size, and a box that was not square would give its two channels unequal\n// travel — the same drag would move one further than the other, which is a\n// difference a reader cannot see and would feel as the control being wrong.\n//\n// **It carries no chequer, unlike a swatch or a colour slider's alpha\n// track.** Those two show the surface behind them where a colour thins out,\n// and a plane does not: React Aria stacks its gradients so the topmost is\n// opaque across the whole box, so nothing laid behind the plane is ever\n// seen. A chequer here was written first and then taken out, because it\n// could not be made to show under any pairing tried — including the RGB\n// alpha pairing whose gradient really does carry a `rgba(0, 0, 0, 0)` stop.\n//\n// **Alpha is a channel here only in RGB, and even there it does not thin\n// the plane.** Asked for it in HSL, React Aria draws the saturation and\n// lightness plane instead and says nothing — the gradients come out\n// identical to the pair it would have drawn anyway. It does not throw the\n// way an unknown channel does, so the only sign is a plane that will not\n// change, which is why it is written down here.\n\ntype ColorAreaProps = Omit<RACColorAreaProps, 'children' | 'className' | 'style'> & {\n /**\n * Lands on the square around the plane, which is the element a layout\n * positions and the one that carries its size.\n */\n className?: string;\n /** Lands on the square around the plane, as `className` does. */\n style?: CSSProperties;\n};\n\n/**\n * Two channels of a colour as a plane, with a handle where they meet. The\n * value is React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue`, as a CSS colour string or a `Color` from `parseColor`,\n * which this package re-exports.\n *\n * ```tsx\n * <ColorArea\n * defaultValue=\"hsl(200, 100%, 50%)\"\n * xChannel=\"saturation\"\n * yChannel=\"lightness\"\n * />\n * ```\n *\n * **`xChannel` and `yChannel` have to name channels the value's own space\n * has.** A hex or `rgb()` value parses as RGB, which has no saturation, so\n * naming one against it throws rather than converting — pass `colorSpace` to\n * convert it, or give the value in the space you mean to work in. The same\n * trap `ColorSlider` documents.\n *\n * **`alpha` is a channel here only in RGB.** Asked for it in HSL, React Aria\n * quietly draws the saturation and lightness plane instead, so a plane that\n * will not fade is the only sign anything was ignored.\n *\n * React Aria names the handle \"Color picker\" and announces both channels;\n * pass `aria-label` to say what the plane is for instead.\n *\n * The call site's `className` and `style` land on the square around the\n * plane rather than on the plane itself, so setting an `inlineSize` is what\n * resizes one — and it stays square, since two channels sharing a box want\n * equal travel. React Aria's function forms are not taken here for the same\n * reason `ColorSwatch` does not take them: the element they would read\n * state for is not the one a layout reaches.\n */\n// The ref lands on the chequered ground, the element the call site's class\n// and style do, rather than on React Aria's area inside it.\nfunction ColorArea({\n className,\n isDisabled = false,\n ref,\n style,\n ...props\n}: ColorAreaProps & RefAttributes<HTMLDivElement>) {\n return <div ref={ref} {...mergeStyles({\n 0: {\n className: \"x1plog1 x1xdvaa9 x9f619 xh8yej3\"\n },\n 1: {\n className: \"x1plog1 x1xdvaa9 x9f619 xh8yej3 x1ppv7y9\"\n }\n }[!!isDisabled << 0], {\n className,\n style\n })}>\n <RACColorArea isDisabled={isDisabled} {...props} {...{\n 0: {\n className: \"x5yr21d x1xdvaa9 x9f619 xsid9ct xh8yej3 x5ve5x3\"\n },\n 1: {\n className: \"x5yr21d x1xdvaa9 x9f619 xh8yej3 x5ve5x3 x1h6gzvc\"\n }\n }[!!isDisabled << 0]}>\n <RACColorThumb className={thumbClassName} />\n </RACColorArea>\n </div>;\n}\nexport type { ColorAreaProps };\nexport default ColorArea;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,SAAAC,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","ColorArea","thumbClassName","mergeStyles","className","style","t0","$","props","ref","t1","isDisabled","undefined","t2","0","1","t3","Symbol","for","t4","t5","t6","t7","RACColorThumb","RACColorArea"],"sources":["../../../src/components/color-area/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, RefAttributes } from 'react';\nimport type { ColorAreaProps as RACColorAreaProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorArea as RACColorArea, ColorThumb as RACColorThumb } from 'react-aria-components';\nimport { thumbClassName } from '../../styles/color';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Two channels of a colour at once, as a plane: one runs along the inline\n// axis and one along the block axis, and the handle sits where they meet.\n// React Aria paints both gradients on the plane's own inline `background`\n// and moves the handle in two axes, so what is here is the plane's shape and\n// the handle `ColorSlider` already draws, from `src/styles/color.ts`.\n//\n// The design carries no page for this, so the two choices below are the\n// library's own.\n//\n// **It is square, and takes the width it is given.** A plane has no natural\n// size, and a box that was not square would give its two channels unequal\n// travel — the same drag would move one further than the other, which is a\n// difference a reader cannot see and would feel as the control being wrong.\n//\n// **It carries no chequer, unlike a swatch or a colour slider's alpha\n// track.** Those two show the surface behind them where a colour thins out,\n// and a plane does not: React Aria stacks its gradients so the topmost is\n// opaque across the whole box, so nothing laid behind the plane is ever\n// seen. A chequer here was written first and then taken out, because it\n// could not be made to show under any pairing tried — including the RGB\n// alpha pairing whose gradient really does carry a `rgba(0, 0, 0, 0)` stop.\n//\n// **Alpha is a channel here only in RGB, and even there it does not thin\n// the plane.** Asked for it in HSL, React Aria draws the saturation and\n// lightness plane instead and says nothing — the gradients come out\n// identical to the pair it would have drawn anyway. It does not throw the\n// way an unknown channel does, so the only sign is a plane that will not\n// change, which is why it is written down here.\n\ntype ColorAreaProps = Omit<RACColorAreaProps, 'children' | 'className' | 'style'> & {\n /**\n * Lands on the square around the plane, which is the element a layout\n * positions and the one that carries its size.\n */\n className?: string;\n /** Lands on the square around the plane, as `className` does. */\n style?: CSSProperties;\n};\n\n/**\n * Two channels of a colour as a plane, with a handle where they meet. The\n * value is React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue`, as a CSS colour string or a `Color` from `parseColor`,\n * which this package re-exports.\n *\n * ```tsx\n * <ColorArea\n * defaultValue=\"hsl(200, 100%, 50%)\"\n * xChannel=\"saturation\"\n * yChannel=\"lightness\"\n * />\n * ```\n *\n * **`xChannel` and `yChannel` have to name channels the value's own space\n * has.** A hex or `rgb()` value parses as RGB, which has no saturation, so\n * naming one against it throws rather than converting — pass `colorSpace` to\n * convert it, or give the value in the space you mean to work in. The same\n * trap `ColorSlider` documents.\n *\n * **`alpha` is a channel here only in RGB.** Asked for it in HSL, React Aria\n * quietly draws the saturation and lightness plane instead, so a plane that\n * will not fade is the only sign anything was ignored.\n *\n * React Aria names the handle \"Color picker\" and announces both channels;\n * pass `aria-label` to say what the plane is for instead.\n *\n * The call site's `className` and `style` land on the square around the\n * plane rather than on the plane itself, so setting an `inlineSize` is what\n * resizes one — and it stays square, since two channels sharing a box want\n * equal travel. React Aria's function forms are not taken here for the same\n * reason `ColorSwatch` does not take them: the element they would read\n * state for is not the one a layout reaches.\n */\n// The ref lands on the chequered ground, the element the call site's class\n// and style do, rather than on React Aria's area inside it.\nfunction ColorArea({\n className,\n isDisabled = false,\n ref,\n style,\n ...props\n}: ColorAreaProps & RefAttributes<HTMLDivElement>) {\n return <div ref={ref} {...mergeStyles({\n 0: {\n className: \"x1plog1 x1xdvaa9 x9f619 xh8yej3\"\n },\n 1: {\n className: \"x1plog1 x1xdvaa9 x9f619 xh8yej3 x1ppv7y9\"\n }\n }[!!isDisabled << 0], {\n className,\n style\n })}>\n <RACColorArea isDisabled={isDisabled} {...props} {...{\n 0: {\n className: \"x5yr21d x1xdvaa9 x9f619 xsid9ct xh8yej3 x5ve5x3\"\n },\n 1: {\n className: \"x5yr21d x1xdvaa9 x9f619 xh8yej3 x5ve5x3 x1h6gzvc\"\n }\n }[!!isDisabled << 0]}>\n <RACColorThumb className={thumbClassName} />\n </RACColorArea>\n </div>;\n}\nexport type { ColorAreaProps };\nexport default ColorArea;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,SAAAC,UAAAK,IAAA;CAAA,MAAAC,IAAAP,EAAA,EAAA;CAAA,IAAAI;CAAA,IAAAI;CAAA,IAAAC;CAAA,IAAAJ;CAAA,IAAAK;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAmB,CAAA,CAAAF,WAAAO,YAAAD,IAAAD,KAAAJ,OAAA,GAAAG,SAAAF;EAM8BC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAA;EAAAN,YAAAG,EAAA;EAAAC,QAAAD,EAAA;EAAAE,MAAAF,EAAA;EAAAF,QAAAE,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAJ/C,MAAAI,aAAAD,OAAAE,KAAAA,IAAA,QAAAF;CAAkB,IAAAG;CAAA,IAAAN,EAAA,OAAAH,aAAAG,EAAA,OAAAI,cAAAJ,EAAA,OAAAF,OAAA;EAKQQ,KAAAV,YAAY;GAAAW,GACjC,EAAAV,WACU,kCACb;GAACW,GACE,EAAAX,WACU,2CACb;EACF,EAAE,CAAC,CAACO,cAAc,IAAI;GAAAP;GAAAC;EAGtB,CAAC;EAACE,EAAA,KAAAH;EAAAG,EAAA,KAAAI;EAAAJ,EAAA,KAAAF;EAAAE,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,QAAAU,OAAAC,IAAA,2BAAA,GAAA;EACuDF,KAAA;GAAAF,GAClD,EAAAV,WACU,kDACb;GAACW,GACE,EAAAX,WACU,mDACb;EACF;EAACG,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAPsD,MAAAY,KAAAH,GAOrD,CAAC,CAACL,cAAc;CAAE,IAAAS;CAAA,IAAAb,EAAA,QAAAU,OAAAC,IAAA,2BAAA,GAAA;EAChBE,KAAA,oBAACG,YAAD,EAA0BrB,WAAAA,eAAc,CAAA;EAAIK,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,QAAAI,cAAAJ,EAAA,QAAAC,SAAAD,EAAA,QAAAY,IAAA;EAR9CE,KAAA,oBAACG,aAAD;GAA0Bb;GAAU,GAAMH;GAAK,GAAMW;GAQnDC,UAAAA;EARW,CAAA;EASEb,EAAA,MAAAI;EAAAJ,EAAA,MAAAC;EAAAD,EAAA,MAAAY;EAAAZ,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,IAAAe;CAAA,IAAAf,EAAA,QAAAE,OAAAF,EAAA,QAAAM,MAAAN,EAAA,QAAAc,IAAA;EApBZC,KAAA,oBAAA,OAAA;GAAUb;GAAG,GAAMI;GAWtBQ,UAAAA;EAUI,CAAA;EAAAd,EAAA,MAAAE;EAAAF,EAAA,MAAAM;EAAAN,EAAA,MAAAc;EAAAd,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,OArBDe;AAqBC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FieldVariant } from "../../field/index.js";
|
|
2
2
|
import { ReactNode, Ref, RefAttributes } from "react";
|
|
3
|
-
import { ColorFieldProps } from "react-aria-components";
|
|
4
|
-
type ColorFieldProps
|
|
3
|
+
import { ColorFieldProps as ColorFieldProps$1 } from "react-aria-components";
|
|
4
|
+
type ColorFieldProps = {
|
|
5
5
|
/** A function may compute the class from the field's render state. */
|
|
6
|
-
className?: ColorFieldProps['className'];
|
|
6
|
+
className?: ColorFieldProps$1['className'];
|
|
7
7
|
/** Supporting text under the field. */
|
|
8
8
|
description?: string;
|
|
9
9
|
/**
|
|
@@ -35,7 +35,7 @@ type ColorFieldProps$1 = {
|
|
|
35
35
|
*/
|
|
36
36
|
leadingIcon?: ReactNode;
|
|
37
37
|
/** A function may compute the style from the field's render state. */
|
|
38
|
-
style?: ColorFieldProps['style'];
|
|
38
|
+
style?: ColorFieldProps$1['style'];
|
|
39
39
|
/**
|
|
40
40
|
* An icon at the box's trailing end, in the page's 24dp size. An icon
|
|
41
41
|
* drawn in `em` takes that size from the slot.
|
|
@@ -46,7 +46,7 @@ type ColorFieldProps$1 = {
|
|
|
46
46
|
* @default 'filled'
|
|
47
47
|
*/
|
|
48
48
|
variant?: FieldVariant;
|
|
49
|
-
} & Omit<ColorFieldProps, 'children' | 'className' | 'style'>;
|
|
49
|
+
} & Omit<ColorFieldProps$1, 'children' | 'className' | 'style'>;
|
|
50
50
|
/**
|
|
51
51
|
* A colour typed into a field. The value is React Aria's — pass `value` with
|
|
52
52
|
* `onChange` to control it, or `defaultValue` — as a CSS colour string or a
|
|
@@ -64,5 +64,5 @@ type ColorFieldProps$1 = {
|
|
|
64
64
|
* with every other field. The call site's `className` and `style` land on
|
|
65
65
|
* the field as a whole, which is the element a layout positions.
|
|
66
66
|
*/
|
|
67
|
-
declare function ColorField
|
|
68
|
-
export { type ColorFieldProps
|
|
67
|
+
declare function ColorField({ description, error, floatingLabel, inputRef, isDisabled, label, leadingIcon, trailingIcon, variant, ...props }: ColorFieldProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
68
|
+
export { type ColorFieldProps, ColorField as default };
|
|
@@ -5,7 +5,7 @@ import { fieldStyles, invalidFrom, useFieldValidationBehavior } from "../../fiel
|
|
|
5
5
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { ColorField } from "react-aria-components";
|
|
8
|
+
import { ColorField as ColorField$1 } from "react-aria-components";
|
|
9
9
|
// src/components/color-field/index.tsx
|
|
10
10
|
/**
|
|
11
11
|
* A colour typed into a field. The value is React Aria's — pass `value` with
|
|
@@ -24,14 +24,14 @@ import { ColorField } from "react-aria-components";
|
|
|
24
24
|
* with every other field. The call site's `className` and `style` land on
|
|
25
25
|
* the field as a whole, which is the element a layout positions.
|
|
26
26
|
*/
|
|
27
|
-
function ColorField
|
|
27
|
+
function ColorField(t0) {
|
|
28
28
|
const $ = c(24);
|
|
29
29
|
const { description, error, floatingLabel: t1, inputRef, isDisabled: t2, label, leadingIcon, trailingIcon, variant: t3, ...props$1 } = t0;
|
|
30
30
|
const floatingLabel = t1 === void 0 ? true : t1;
|
|
31
31
|
const isDisabled = t2 === void 0 ? false : t2;
|
|
32
32
|
const variant = t3 === void 0 ? "filled" : t3;
|
|
33
33
|
const validationBehavior = useFieldValidationBehavior();
|
|
34
|
-
const T0 = ColorField;
|
|
34
|
+
const T0 = ColorField$1;
|
|
35
35
|
let t4;
|
|
36
36
|
if ($[0] !== error) {
|
|
37
37
|
t4 = invalidFrom(error);
|
|
@@ -97,6 +97,6 @@ function ColorField$1(t0) {
|
|
|
97
97
|
} else t9 = $[23];
|
|
98
98
|
return t9;
|
|
99
99
|
}
|
|
100
|
-
export { ColorField
|
|
100
|
+
export { ColorField as default };
|
|
101
101
|
|
|
102
102
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","ColorField","RACColorField","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","description","error","floatingLabel","inputRef","label","leadingIcon","trailingIcon","variant","t0","$","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","t7","isRequired","t8","t9"],"sources":["../../../src/components/color-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, Ref, RefAttributes } from 'react';\nimport type { ColorFieldProps as RACColorFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorField as RACColorField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A colour typed rather than picked. React Aria renders a plain text input\n// holding the colour's own notation, so this is the text fields page's box\n// with nothing added — the same chrome `TextField` draws through, which is\n// what makes a colour field on a form the same shape as the field beside\n// it.\n//\n// Two things are worth knowing about what it holds.\n//\n// **`channel` turns it from a colour into a number.** Without one the field\n// holds the whole colour — `#6750A4` — and parses what is typed. With one\n// it holds that channel alone, as a number a reader can step, which is what\n// a picker's three boxes beside a plane are.\n//\n// **A swatch is the natural leading icon.** The field's value is a colour,\n// and the chrome already has a slot for something at the box's leading end;\n// passing a `ColorSwatch` there is what makes the field show the colour it\n// holds. It is left to the call site rather than drawn here, since a field\n// inside a picker sits beside a swatch already.\n\ntype ColorFieldProps = {\n /** A function may compute the class from the field's render state. */\n className?: RACColorFieldProps['className'];\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\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 /**\n * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\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. A\n * `ColorSwatch` shows the value. An icon drawn in `em` takes that size\n * from the slot.\n */\n leadingIcon?: ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACColorFieldProps['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} & Omit<RACColorFieldProps, 'children' | 'className' | 'style'>;\n\n/**\n * A colour typed into a field. The value is React Aria's — pass `value` with\n * `onChange` to control it, or `defaultValue` — as a CSS colour string or a\n * `Color` from `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorField defaultValue=\"#6750A4\" label=\"Label\" />\n * ```\n *\n * Without `channel` the field holds the whole colour and parses what is\n * typed; with one it holds that channel alone as a number. `colorSpace`\n * decides which space a channel belongs to, the same as on `ColorSlider`.\n *\n * The box, label and message are the field chrome in `src/field`, shared\n * with every other field. The call site's `className` and `style` land on\n * the field as a whole, which is the element a layout positions.\n */\nfunction ColorField({\n description,\n error,\n floatingLabel = true,\n inputRef,\n isDisabled = false,\n label,\n leadingIcon,\n trailingIcon,\n variant = 'filled',\n ...props\n}: ColorFieldProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACColorField isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel} isRequired={props.isRequired} label={label} leading={leadingIcon} trailing={trailingIcon} variant={variant}>\n <FieldInput ref={inputRef} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACColorField>;\n}\nexport type { ColorFieldProps };\nexport default ColorField;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,SAAAE,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","ColorField","RACColorField","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","description","error","floatingLabel","inputRef","label","leadingIcon","trailingIcon","variant","t0","$","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","t7","isRequired","t8","t9"],"sources":["../../../src/components/color-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, Ref, RefAttributes } from 'react';\nimport type { ColorFieldProps as RACColorFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorField as RACColorField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A colour typed rather than picked. React Aria renders a plain text input\n// holding the colour's own notation, so this is the text fields page's box\n// with nothing added — the same chrome `TextField` draws through, which is\n// what makes a colour field on a form the same shape as the field beside\n// it.\n//\n// Two things are worth knowing about what it holds.\n//\n// **`channel` turns it from a colour into a number.** Without one the field\n// holds the whole colour — `#6750A4` — and parses what is typed. With one\n// it holds that channel alone, as a number a reader can step, which is what\n// a picker's three boxes beside a plane are.\n//\n// **A swatch is the natural leading icon.** The field's value is a colour,\n// and the chrome already has a slot for something at the box's leading end;\n// passing a `ColorSwatch` there is what makes the field show the colour it\n// holds. It is left to the call site rather than drawn here, since a field\n// inside a picker sits beside a swatch already.\n\ntype ColorFieldProps = {\n /** A function may compute the class from the field's render state. */\n className?: RACColorFieldProps['className'];\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\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 /**\n * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\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. A\n * `ColorSwatch` shows the value. An icon drawn in `em` takes that size\n * from the slot.\n */\n leadingIcon?: ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACColorFieldProps['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} & Omit<RACColorFieldProps, 'children' | 'className' | 'style'>;\n\n/**\n * A colour typed into a field. The value is React Aria's — pass `value` with\n * `onChange` to control it, or `defaultValue` — as a CSS colour string or a\n * `Color` from `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorField defaultValue=\"#6750A4\" label=\"Label\" />\n * ```\n *\n * Without `channel` the field holds the whole colour and parses what is\n * typed; with one it holds that channel alone as a number. `colorSpace`\n * decides which space a channel belongs to, the same as on `ColorSlider`.\n *\n * The box, label and message are the field chrome in `src/field`, shared\n * with every other field. The call site's `className` and `style` land on\n * the field as a whole, which is the element a layout positions.\n */\nfunction ColorField({\n description,\n error,\n floatingLabel = true,\n inputRef,\n isDisabled = false,\n label,\n leadingIcon,\n trailingIcon,\n variant = 'filled',\n ...props\n}: ColorFieldProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACColorField isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel} isRequired={props.isRequired} label={label} leading={leadingIcon} trailing={trailingIcon} variant={variant}>\n <FieldInput ref={inputRef} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACColorField>;\n}\nexport type { ColorFieldProps };\nexport default ColorField;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,SAAAE,WAAAc,IAAA;CAAA,MAAAC,IAAAjB,EAAA,EAAA;CAAoB,MAAA,EAAAQ,aAAAC,OAAAC,eAAAQ,IAAAP,UAAAQ,YAAAC,IAAAR,OAAAC,aAAAC,cAAAC,SAAAM,IAAA,GAAAC,YAAAN;CAGlB,MAAAN,gBAAAQ,OAAAK,KAAAA,IAAA,OAAAL;CAEA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e;CAAA,OAAAA,KAAAf,EAAA;CAAA,IAAAgB;CAAA,IAAAhB,EAAA,QAAAQ,MAAAR,EAAA,QAAAE,cAAAF,EAAA,QAAAK,WAAAL,EAAA,QAAAS,MAAAT,EAAA,QAAAU,MAAAV,EAAA,QAAAa,MAAAb,EAAA,QAAAe,MAAAf,EAAA,QAAAO,oBAAA;EAJrDS,KAAA,qBAAC,IAAD;GAA2Bd;GAAuB,WAAAO;GAAwCF;GAAkB,GAAMF;GAAK,GAAMK;GAA7H,UAAA,CACHG,IAGAE,EAJiB;;EAKHf,EAAA,MAAAQ;EAAAR,EAAA,MAAAE;EAAAF,EAAA,MAAAK;EAAAL,EAAA,MAAAS;EAAAT,EAAA,MAAAU;EAAAV,EAAA,MAAAa;EAAAb,EAAA,MAAAe;EAAAf,EAAA,MAAAO;EAAAP,EAAA,MAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAA,OALXgB;AAKW"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode, RefAttributes } from "react";
|
|
2
|
-
import { ColorPickerProps } from "react-aria-components";
|
|
3
|
-
type ColorPickerProps
|
|
2
|
+
import { ColorPickerProps as ColorPickerProps$1 } from "react-aria-components";
|
|
3
|
+
type ColorPickerProps = Omit<ColorPickerProps$1, 'children'> & {
|
|
4
4
|
/** Whether the alpha strip is drawn under the hue one. @default false */
|
|
5
5
|
alpha?: boolean;
|
|
6
6
|
/** Replaces everything on the surface, for a picker that arranges its own parts. */
|
|
@@ -58,5 +58,5 @@ type ColorPickerProps$1 = Omit<ColorPickerProps, 'children'> & {
|
|
|
58
58
|
* The call site's `className` and `style` land on the trigger, which is the
|
|
59
59
|
* element a layout positions.
|
|
60
60
|
*/
|
|
61
|
-
declare function ColorPicker
|
|
62
|
-
export { type ColorPickerProps
|
|
61
|
+
declare function ColorPicker({ alpha, children, className, container, defaultOpen, isDisabled, isOpen, label, onOpenChange, ref, style, ...props }: ColorPickerProps & RefAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
62
|
+
export { type ColorPickerProps, ColorPicker as default };
|
|
@@ -11,7 +11,7 @@ import ColorSlider$1 from "../color-slider/index.js";
|
|
|
11
11
|
import ColorSwatch$1 from "../color-swatch/index.js";
|
|
12
12
|
import { c } from "react/compiler-runtime";
|
|
13
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { Button, ColorPicker, Dialog, DialogTrigger, Popover, parseColor, useLocale } from "react-aria-components";
|
|
14
|
+
import { Button, ColorPicker as ColorPicker$1, Dialog, DialogTrigger, Popover, parseColor, useLocale } from "react-aria-components";
|
|
15
15
|
// src/components/color-picker/index.tsx
|
|
16
16
|
const styles = {
|
|
17
17
|
triggerSwatch: {
|
|
@@ -86,7 +86,7 @@ const CHANNELS = parseColor("hsl(0, 0%, 0%)");
|
|
|
86
86
|
* The call site's `className` and `style` land on the trigger, which is the
|
|
87
87
|
* element a layout positions.
|
|
88
88
|
*/
|
|
89
|
-
function ColorPicker
|
|
89
|
+
function ColorPicker(t0) {
|
|
90
90
|
const $ = c(44);
|
|
91
91
|
let children;
|
|
92
92
|
let className;
|
|
@@ -243,7 +243,7 @@ function ColorPicker$1(t0) {
|
|
|
243
243
|
} else t10 = $[40];
|
|
244
244
|
let t11;
|
|
245
245
|
if ($[41] !== props$1 || $[42] !== t10) {
|
|
246
|
-
t11 = /* @__PURE__ */ jsx(ColorPicker, {
|
|
246
|
+
t11 = /* @__PURE__ */ jsx(ColorPicker$1, {
|
|
247
247
|
...props$1,
|
|
248
248
|
children: t10
|
|
249
249
|
});
|
|
@@ -256,6 +256,6 @@ function ColorPicker$1(t0) {
|
|
|
256
256
|
function _temp(state) {
|
|
257
257
|
return props(triggerStyles.base, focus.ring, state.isHovered && triggerStyles.hovered, state.isPressed && triggerStyles.pressed, state.isDisabled && triggerStyles.disabled);
|
|
258
258
|
}
|
|
259
|
-
export { ColorPicker
|
|
259
|
+
export { ColorPicker as default };
|
|
260
260
|
|
|
261
261
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","parseColor","ColorPicker","useLocale","focus","mergeStatefulStyles","overlay","popoverClassName","styles","triggerSwatch","kZKoxP","kmuXW","kzqmXN","$$css","triggerSwatchDisabled","kSiTet","DISABLED_TRIGGER_SWATCH","triggerStyles","base","kGNEyG","kWkggS","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","k8WAf4","kg3NbH","disabled","hovered","pressed","alpha","children","className","container","defaultOpen","isDisabled","isOpen","label","onOpenChange","style","CHANNELS","t0","$","props","ref","t1","t2","undefined","locale","t3","_temp","t4","state_0","state","t5","t6","Symbol","for","popupDialog","ring","t7","getChannelName","t8","t9","t10","t11","isHovered","isPressed","ColorSwatch","RACButton","ColorArea","ColorSlider","ColorField","RACDialog","RACPopover","RACDialogTrigger","RACColorPicker"],"sources":["../../../src/components/color-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode, RefAttributes } from 'react';\nimport type { ButtonRenderProps, ColorPickerProps as RACColorPickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { parseColor, Button as RACButton, ColorPicker as RACColorPicker, Dialog as RACDialog, DialogTrigger as RACDialogTrigger, Popover as RACPopover, useLocale } from 'react-aria-components';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { popoverClassName } from '../../styles/picker';\nimport { SwatchSquareContext } from '../../swatch';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\nimport ColorArea from '../color-area';\nimport ColorField from '../color-field';\nimport ColorSlider from '../color-slider';\nimport ColorSwatch from '../color-swatch';\n\n// Everything in this phase, in one control: a swatch and a label as the\n// trigger, and a plane, a hue slider, an alpha slider and a text field on\n// the surface it opens. React Aria's `ColorPicker` renders nothing of its\n// own — it is the state the five share — so what is here is the trigger,\n// the overlay and the arrangement inside it.\n//\n// The design carries no page for a colour picker. What it does carry is the\n// text fields page, which the field inside this one already draws through,\n// and the overlay surface every popover here shares. Three choices are the\n// library's own.\n//\n// **The trigger is a swatch beside a name, not a swatch alone.** A swatch\n// on its own is a coloured square with no affordance — nothing says it can\n// be pressed, and a screen reader is told a colour rather than an action.\n// The label is what makes it a button.\n//\n// **Hue is a slider rather than a wheel here.** A wheel and the plane want\n// the same space and would make the surface square and large; the strip\n// sits under the plane at the width it already has. `ColorWheel` is for a\n// picker that wants to be round, which is a different shape rather than a\n// different control.\n//\n// **It is docked above the medium breakpoint and modal below it**, centred\n// over a scrim there — the same swap `DatePicker` makes, at the width `Sheet`\n// changes presentation too, and the shared one in `src/styles/picker.ts`\n// rather than a third copy. A 280dp surface anchored to a trigger is\n// unreachable at 375px.\n//\n// One thing the picker has to do that its parts do not. **The plane and the\n// hue strip are pinned to HSL.** A channel has to belong to the value's own\n// space or React Aria throws, and a hex parses as RGB, which has no\n// saturation — so `<ColorPicker defaultValue=\"#6750A4\" />`, the call anyone\n// writes first, would throw outright. Converting here is what makes the\n// picker take any notation, and it costs the caller nothing: the value\n// handed back is still in whatever they passed.\n\nconst styles = {\n triggerSwatch: {\n kZKoxP: \"xxk0z11\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"xvy4d1p\",\n $$css: true\n },\n triggerSwatchDisabled: {\n kSiTet: \"x1ppv7y9\",\n $$css: true\n }\n};\n\n// Hoisted so the context is handed one array rather than a new one on every\n// render, which would re-render every swatch reading it.\nconst DISABLED_TRIGGER_SWATCH = [styles.triggerSwatch, styles.triggerSwatchDisabled];\nconst triggerStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x18fpw6u\",\n $$css: true\n },\n disabled: {\n kWkggS: \"x19v6zzp\",\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n hovered: {\n kWkggS: \"x1ei6177\",\n $$css: true\n },\n pressed: {\n kWkggS: \"x1vt8e7r\",\n $$css: true\n }\n};\ntype ColorPickerProps = Omit<RACColorPickerProps, 'children'> & {\n /** Whether the alpha strip is drawn under the hue one. @default false */\n alpha?: boolean;\n /** Replaces everything on the surface, for a picker that arranges its own parts. */\n children?: ReactNode;\n /** Lands on the trigger, which is the element a layout positions. */\n className?: string;\n /**\n * Where to portal the surface. Defaults to the container of the `ThemeScope`\n * around it, which keeps the surface on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the surface\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /** Whether the surface starts open. Uncontrolled; pair `isOpen` with `onOpenChange` instead. */\n defaultOpen?: boolean;\n /**\n * Whether the whole picker is inert — the trigger, and the plane, strips\n * and field on the surface, which can be on screen while disabled since\n * the surface opens independently of the trigger. An arrangement passed\n * as `children` is the call site's own to disable.\n * @default false\n */\n isDisabled?: boolean;\n /** Whether the surface is open. Controlled; needs `onOpenChange`. */\n isOpen?: boolean;\n /** What the trigger says beside its swatch. Always rendered; it is the button's name. */\n label: string;\n /** Called when the surface opens or closes. */\n onOpenChange?: (isOpen: boolean) => void;\n /** Lands on the trigger, as `className` does. */\n style?: CSSProperties;\n};\n\n// Any HSL colour names the channels the two strips draw. The labels are read\n// off it in the reader's locale, as React Aria words them, rather than written\n// here in English.\nconst CHANNELS = parseColor('hsl(0, 0%, 0%)');\n\n/**\n * A colour picked from a plane, a hue strip and a text field, behind a\n * trigger showing the colour. The value is React Aria's: pass `value` with\n * `onChange` to control it, or `defaultValue`, as a CSS colour string or a\n * `Color` from `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorPicker defaultValue=\"#6750A4\" label=\"Label\" />\n * ```\n *\n * `alpha` adds the transparency strip. Above the medium breakpoint the\n * surface is docked to the trigger; below it, it opens centred, the same\n * swap `DatePicker` makes. `defaultOpen`, `isOpen` and `onOpenChange` reach\n * the overlay, since the picker itself carries no open state — React Aria\n * keeps that on the dialog trigger this renders inside.\n *\n * Every part inside is this package's own — `ColorArea`, `ColorSlider`,\n * `ColorField` and `ColorSwatch` — and they share the picker's value\n * through React Aria's context rather than props. Passing `children`\n * replaces all of them, for a picker that wants a different arrangement.\n *\n * The call site's `className` and `style` land on the trigger, which is the\n * element a layout positions.\n */\nfunction ColorPicker({\n alpha = false,\n children,\n className,\n container,\n defaultOpen,\n isDisabled = false,\n isOpen,\n label,\n onOpenChange,\n ref,\n style,\n ...props\n}: ColorPickerProps & RefAttributes<HTMLButtonElement>) {\n const {\n locale\n } = useLocale();\n return <RACColorPicker {...props}>\n <RACDialogTrigger defaultOpen={defaultOpen} isOpen={isOpen} onOpenChange={onOpenChange}>\n <RACButton isDisabled={isDisabled}\n // React Aria's picker renders no element of its own, so the ref\n // lands on the trigger, as the call site's class and style do.\n ref={ref} {...mergeStatefulStyles(\n // A function of the state rather than a fixed class, since the\n // trigger is the element a layout positions and the call site's\n // own class has to merge into it — a plain `className` would\n // overwrite one or the other.\n (state: ButtonRenderProps) => stylex.props(triggerStyles.base, focus.ring, state.isHovered && triggerStyles.hovered, state.isPressed && triggerStyles.pressed, state.isDisabled && triggerStyles.disabled), {\n className,\n style\n })}>\n {(state: ButtonRenderProps) => <>\n <SwatchSquareContext value={state.isDisabled ? DISABLED_TRIGGER_SWATCH : styles.triggerSwatch}>\n <ColorSwatch />\n </SwatchSquareContext>\n {label}\n </>}\n </RACButton>\n <RACPopover className={popoverClassName}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n {/*\n Disabled reaches every control here, not only the trigger.\n React Aria's colour picker carries no disabled state of its\n own — react-stately's `useColorPickerState` has no such\n concept — so nothing hands it down the way a field's context\n would. And the surface opens independently of the trigger, so\n a disabled picker can still be on screen: already open when a\n form disables it, or opened from outside. Without this the\n plane could be dragged, the strips moved with the arrow keys\n and the field typed into, all changing the value of something\n documented as inert.\n An arrangement a call site passes as `children` is its own to\n disable; there is no context to reach it through.\n */}\n {children ?? <div className=\"x9f619 x78zum5 xdt5ytf x1gka490 x1dz1jew x193iq5w xgc26li\">\n <ColorArea aria-label={label} colorSpace=\"hsl\" isDisabled={isDisabled} xChannel=\"saturation\" yChannel=\"lightness\" />\n <ColorSlider channel=\"hue\" colorSpace=\"hsl\" isDisabled={isDisabled} label={CHANNELS.getChannelName('hue', locale)} />\n {alpha ? <ColorSlider channel=\"alpha\" isDisabled={isDisabled} label={CHANNELS.getChannelName('alpha', locale)} /> : null}\n <ColorField isDisabled={isDisabled} label={label} />\n </div>}\n </RACDialog>\n </RACPopover>\n </RACDialogTrigger>\n </RACColorPicker>;\n}\nexport type { ColorPickerProps };\nexport default ColorPicker;"],"mappings":";;;;;;;;;;;;;;;AAsDA,MAAMS,SAAS;CACbC,eAAe;EACbC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,uBAAuB;EACrBC,QAAQ;EACRF,OAAO;CACT;AACF;AAIA,MAAMG,0BAA0B,CAACR,OAAOC,eAAeD,OAAOM,qBAAqB;AACnF,MAAMG,gBAAgB;CACpBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EAC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AAJ,gBAAAI,EAAA,QAAAY,MAAAZ,EAAA,QAAAqB,IAAA;EA7CfC,MAAA,qBAACW,eAAD;GAA+BzC;GAAqBE;GAAsBE;GAA1E,UAAA,CACEgB,IAmBAS,EApBe;;EA8CErB,EAAA,MAAAR;EAAAQ,EAAA,MAAAN;EAAAM,EAAA,MAAAJ;EAAAI,EAAA,MAAAY;EAAAZ,EAAA,MAAAqB;EAAArB,EAAA,MAAAsB;CAAA,OAAAA,MAAAtB,EAAA;CAAA,IAAAuB;CAAA,IAAAvB,EAAA,QAAAC,WAAAD,EAAA,QAAAsB,KAAA;EA/ChBC,MAAA,oBAACW,aAAD;GAAe,GAAKjC;GACvBqB,UAAAA;EADkB,CAAA;EAgDHtB,EAAA,MAAAC;EAAAD,EAAA,MAAAsB;EAAAtB,EAAA,MAAAuB;CAAA,OAAAA,MAAAvB,EAAA;CAAA,OAhDZuB;AAgDY;AAjErB,SAAAf,MAAAG,OAAA;CAAA,OA2BoC7D,MAAaiB,cAAaC,MAAOd,MAAK+D,MAAON,MAAKa,aAAczD,cAAamB,SAAUyB,MAAKc,aAAc1D,cAAaoB,SAAUwB,MAAKlB,cAAe1B,cAAakB,QAAS;AAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","parseColor","ColorPicker","useLocale","focus","mergeStatefulStyles","overlay","popoverClassName","styles","triggerSwatch","kZKoxP","kmuXW","kzqmXN","$$css","triggerSwatchDisabled","kSiTet","DISABLED_TRIGGER_SWATCH","triggerStyles","base","kGNEyG","kWkggS","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","k8WAf4","kg3NbH","disabled","hovered","pressed","alpha","children","className","container","defaultOpen","isDisabled","isOpen","label","onOpenChange","style","CHANNELS","t0","$","props","ref","t1","t2","undefined","locale","t3","_temp","t4","state_0","state","t5","t6","Symbol","for","popupDialog","ring","t7","getChannelName","t8","t9","t10","t11","isHovered","isPressed","ColorSwatch","RACButton","ColorArea","ColorSlider","ColorField","RACDialog","RACPopover","RACDialogTrigger","RACColorPicker"],"sources":["../../../src/components/color-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode, RefAttributes } from 'react';\nimport type { ButtonRenderProps, ColorPickerProps as RACColorPickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { parseColor, Button as RACButton, ColorPicker as RACColorPicker, Dialog as RACDialog, DialogTrigger as RACDialogTrigger, Popover as RACPopover, useLocale } from 'react-aria-components';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { popoverClassName } from '../../styles/picker';\nimport { SwatchSquareContext } from '../../swatch';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\nimport ColorArea from '../color-area';\nimport ColorField from '../color-field';\nimport ColorSlider from '../color-slider';\nimport ColorSwatch from '../color-swatch';\n\n// Everything in this phase, in one control: a swatch and a label as the\n// trigger, and a plane, a hue slider, an alpha slider and a text field on\n// the surface it opens. React Aria's `ColorPicker` renders nothing of its\n// own — it is the state the five share — so what is here is the trigger,\n// the overlay and the arrangement inside it.\n//\n// The design carries no page for a colour picker. What it does carry is the\n// text fields page, which the field inside this one already draws through,\n// and the overlay surface every popover here shares. Three choices are the\n// library's own.\n//\n// **The trigger is a swatch beside a name, not a swatch alone.** A swatch\n// on its own is a coloured square with no affordance — nothing says it can\n// be pressed, and a screen reader is told a colour rather than an action.\n// The label is what makes it a button.\n//\n// **Hue is a slider rather than a wheel here.** A wheel and the plane want\n// the same space and would make the surface square and large; the strip\n// sits under the plane at the width it already has. `ColorWheel` is for a\n// picker that wants to be round, which is a different shape rather than a\n// different control.\n//\n// **It is docked above the medium breakpoint and modal below it**, centred\n// over a scrim there — the same swap `DatePicker` makes, at the width `Sheet`\n// changes presentation too, and the shared one in `src/styles/picker.ts`\n// rather than a third copy. A 280dp surface anchored to a trigger is\n// unreachable at 375px.\n//\n// One thing the picker has to do that its parts do not. **The plane and the\n// hue strip are pinned to HSL.** A channel has to belong to the value's own\n// space or React Aria throws, and a hex parses as RGB, which has no\n// saturation — so `<ColorPicker defaultValue=\"#6750A4\" />`, the call anyone\n// writes first, would throw outright. Converting here is what makes the\n// picker take any notation, and it costs the caller nothing: the value\n// handed back is still in whatever they passed.\n\nconst styles = {\n triggerSwatch: {\n kZKoxP: \"xxk0z11\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"xvy4d1p\",\n $$css: true\n },\n triggerSwatchDisabled: {\n kSiTet: \"x1ppv7y9\",\n $$css: true\n }\n};\n\n// Hoisted so the context is handed one array rather than a new one on every\n// render, which would re-render every swatch reading it.\nconst DISABLED_TRIGGER_SWATCH = [styles.triggerSwatch, styles.triggerSwatchDisabled];\nconst triggerStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x18fpw6u\",\n $$css: true\n },\n disabled: {\n kWkggS: \"x19v6zzp\",\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n hovered: {\n kWkggS: \"x1ei6177\",\n $$css: true\n },\n pressed: {\n kWkggS: \"x1vt8e7r\",\n $$css: true\n }\n};\ntype ColorPickerProps = Omit<RACColorPickerProps, 'children'> & {\n /** Whether the alpha strip is drawn under the hue one. @default false */\n alpha?: boolean;\n /** Replaces everything on the surface, for a picker that arranges its own parts. */\n children?: ReactNode;\n /** Lands on the trigger, which is the element a layout positions. */\n className?: string;\n /**\n * Where to portal the surface. Defaults to the container of the `ThemeScope`\n * around it, which keeps the surface on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the surface\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /** Whether the surface starts open. Uncontrolled; pair `isOpen` with `onOpenChange` instead. */\n defaultOpen?: boolean;\n /**\n * Whether the whole picker is inert — the trigger, and the plane, strips\n * and field on the surface, which can be on screen while disabled since\n * the surface opens independently of the trigger. An arrangement passed\n * as `children` is the call site's own to disable.\n * @default false\n */\n isDisabled?: boolean;\n /** Whether the surface is open. Controlled; needs `onOpenChange`. */\n isOpen?: boolean;\n /** What the trigger says beside its swatch. Always rendered; it is the button's name. */\n label: string;\n /** Called when the surface opens or closes. */\n onOpenChange?: (isOpen: boolean) => void;\n /** Lands on the trigger, as `className` does. */\n style?: CSSProperties;\n};\n\n// Any HSL colour names the channels the two strips draw. The labels are read\n// off it in the reader's locale, as React Aria words them, rather than written\n// here in English.\nconst CHANNELS = parseColor('hsl(0, 0%, 0%)');\n\n/**\n * A colour picked from a plane, a hue strip and a text field, behind a\n * trigger showing the colour. The value is React Aria's: pass `value` with\n * `onChange` to control it, or `defaultValue`, as a CSS colour string or a\n * `Color` from `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorPicker defaultValue=\"#6750A4\" label=\"Label\" />\n * ```\n *\n * `alpha` adds the transparency strip. Above the medium breakpoint the\n * surface is docked to the trigger; below it, it opens centred, the same\n * swap `DatePicker` makes. `defaultOpen`, `isOpen` and `onOpenChange` reach\n * the overlay, since the picker itself carries no open state — React Aria\n * keeps that on the dialog trigger this renders inside.\n *\n * Every part inside is this package's own — `ColorArea`, `ColorSlider`,\n * `ColorField` and `ColorSwatch` — and they share the picker's value\n * through React Aria's context rather than props. Passing `children`\n * replaces all of them, for a picker that wants a different arrangement.\n *\n * The call site's `className` and `style` land on the trigger, which is the\n * element a layout positions.\n */\nfunction ColorPicker({\n alpha = false,\n children,\n className,\n container,\n defaultOpen,\n isDisabled = false,\n isOpen,\n label,\n onOpenChange,\n ref,\n style,\n ...props\n}: ColorPickerProps & RefAttributes<HTMLButtonElement>) {\n const {\n locale\n } = useLocale();\n return <RACColorPicker {...props}>\n <RACDialogTrigger defaultOpen={defaultOpen} isOpen={isOpen} onOpenChange={onOpenChange}>\n <RACButton isDisabled={isDisabled}\n // React Aria's picker renders no element of its own, so the ref\n // lands on the trigger, as the call site's class and style do.\n ref={ref} {...mergeStatefulStyles(\n // A function of the state rather than a fixed class, since the\n // trigger is the element a layout positions and the call site's\n // own class has to merge into it — a plain `className` would\n // overwrite one or the other.\n (state: ButtonRenderProps) => stylex.props(triggerStyles.base, focus.ring, state.isHovered && triggerStyles.hovered, state.isPressed && triggerStyles.pressed, state.isDisabled && triggerStyles.disabled), {\n className,\n style\n })}>\n {(state: ButtonRenderProps) => <>\n <SwatchSquareContext value={state.isDisabled ? DISABLED_TRIGGER_SWATCH : styles.triggerSwatch}>\n <ColorSwatch />\n </SwatchSquareContext>\n {label}\n </>}\n </RACButton>\n <RACPopover className={popoverClassName}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n {/*\n Disabled reaches every control here, not only the trigger.\n React Aria's colour picker carries no disabled state of its\n own — react-stately's `useColorPickerState` has no such\n concept — so nothing hands it down the way a field's context\n would. And the surface opens independently of the trigger, so\n a disabled picker can still be on screen: already open when a\n form disables it, or opened from outside. Without this the\n plane could be dragged, the strips moved with the arrow keys\n and the field typed into, all changing the value of something\n documented as inert.\n An arrangement a call site passes as `children` is its own to\n disable; there is no context to reach it through.\n */}\n {children ?? <div className=\"x9f619 x78zum5 xdt5ytf x1gka490 x1dz1jew x193iq5w xgc26li\">\n <ColorArea aria-label={label} colorSpace=\"hsl\" isDisabled={isDisabled} xChannel=\"saturation\" yChannel=\"lightness\" />\n <ColorSlider channel=\"hue\" colorSpace=\"hsl\" isDisabled={isDisabled} label={CHANNELS.getChannelName('hue', locale)} />\n {alpha ? <ColorSlider channel=\"alpha\" isDisabled={isDisabled} label={CHANNELS.getChannelName('alpha', locale)} /> : null}\n <ColorField isDisabled={isDisabled} label={label} />\n </div>}\n </RACDialog>\n </RACPopover>\n </RACDialogTrigger>\n </RACColorPicker>;\n}\nexport type { ColorPickerProps };\nexport default ColorPicker;"],"mappings":";;;;;;;;;;;;;;;AAsDA,MAAMS,SAAS;CACbC,eAAe;EACbC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,uBAAuB;EACrBC,QAAQ;EACRF,OAAO;CACT;AACF;AAIA,MAAMG,0BAA0B,CAACR,OAAOC,eAAeD,OAAOM,qBAAqB;AACnF,MAAMG,gBAAgB;CACpBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRrB,OAAO;CACT;CACAsB,UAAU;EACRf,QAAQ;EACRI,QAAQ;EACRC,QAAQ;EACRZ,OAAO;CACT;CACAuB,SAAS;EACPhB,QAAQ;EACRP,OAAO;CACT;CACAwB,SAAS;EACPjB,QAAQ;EACRP,OAAO;CACT;AACF;AAuCA,MAAMmC,WAAW/C,WAAW,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;AA0B5C,SAAAC,YAAA+C,IAAA;CAAA,MAAAC,IAAAnD,EAAA,EAAA;CAAA,IAAAwC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAE;CAAA,IAAAC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AA;CAAA,OAhDZuB;AAgDY;AAjErB,SAAAf,MAAAG,OAAA;CAAA,OA2BoC7D,MAAaiB,cAAaC,MAAOd,MAAK+D,MAAON,MAAKa,aAAczD,cAAamB,SAAUyB,MAAKc,aAAc1D,cAAaoB,SAAUwB,MAAKlB,cAAe1B,cAAakB,QAAS;AAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RefAttributes } from "react";
|
|
2
|
-
import { ColorSliderProps } from "react-aria-components";
|
|
3
|
-
type ColorSliderProps
|
|
2
|
+
import { ColorSliderProps as ColorSliderProps$1 } from "react-aria-components";
|
|
3
|
+
type ColorSliderProps = Omit<ColorSliderProps$1, 'children' | 'className' | 'style'> & {
|
|
4
4
|
/** A function may compute the class from the slider's render state. */
|
|
5
|
-
className?: ColorSliderProps['className'];
|
|
5
|
+
className?: ColorSliderProps$1['className'];
|
|
6
6
|
/** What the slider is for. Always rendered; React Aria names the channel otherwise. */
|
|
7
7
|
label?: string;
|
|
8
8
|
/**
|
|
@@ -12,7 +12,7 @@ type ColorSliderProps$1 = Omit<ColorSliderProps, 'children' | 'className' | 'sty
|
|
|
12
12
|
*/
|
|
13
13
|
showValue?: boolean;
|
|
14
14
|
/** A function may compute the style from the slider's render state. */
|
|
15
|
-
style?: ColorSliderProps['style'];
|
|
15
|
+
style?: ColorSliderProps$1['style'];
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* A slider over one channel of a colour — hue, saturation, lightness, alpha
|
|
@@ -35,5 +35,5 @@ type ColorSliderProps$1 = Omit<ColorSliderProps, 'children' | 'className' | 'sty
|
|
|
35
35
|
* The call site's `className` and `style` land on the slider as a whole,
|
|
36
36
|
* which is the element a layout positions.
|
|
37
37
|
*/
|
|
38
|
-
declare function ColorSlider
|
|
39
|
-
export { type ColorSliderProps
|
|
38
|
+
declare function ColorSlider({ isDisabled, label, showValue, ...props }: ColorSliderProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
39
|
+
export { type ColorSliderProps, ColorSlider as default };
|
|
@@ -7,7 +7,7 @@ import { thumbClassName, verticalThumbClassName } from "../../styles/color.js";
|
|
|
7
7
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
8
8
|
import { c } from "react/compiler-runtime";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { ColorSlider, ColorThumb, SliderOutput, SliderTrack } from "react-aria-components";
|
|
10
|
+
import { ColorSlider as ColorSlider$1, ColorThumb, SliderOutput, SliderTrack } from "react-aria-components";
|
|
11
11
|
// src/components/color-slider/index.tsx
|
|
12
12
|
const styles = {
|
|
13
13
|
root: {
|
|
@@ -63,7 +63,7 @@ const styles = {
|
|
|
63
63
|
* The call site's `className` and `style` land on the slider as a whole,
|
|
64
64
|
* which is the element a layout positions.
|
|
65
65
|
*/
|
|
66
|
-
function ColorSlider
|
|
66
|
+
function ColorSlider(t0) {
|
|
67
67
|
const $ = c(35);
|
|
68
68
|
let T0;
|
|
69
69
|
let isDisabled;
|
|
@@ -79,7 +79,7 @@ function ColorSlider$1(t0) {
|
|
|
79
79
|
isDisabled = t4 === void 0 ? false : t4;
|
|
80
80
|
showValue = t6 === void 0 ? true : t6;
|
|
81
81
|
vertical = props$1.orientation === "vertical";
|
|
82
|
-
T0 = ColorSlider;
|
|
82
|
+
T0 = ColorSlider$1;
|
|
83
83
|
t1 = isDisabled;
|
|
84
84
|
t2 = props$1;
|
|
85
85
|
t3 = mergeStatefulStyles(props(groupStyles.root, styles.root, vertical && styles.rootVertical), props$1);
|
|
@@ -190,6 +190,6 @@ function ColorSlider$1(t0) {
|
|
|
190
190
|
} else t14 = $[34];
|
|
191
191
|
return t14;
|
|
192
192
|
}
|
|
193
|
-
export { ColorSlider
|
|
193
|
+
export { ColorSlider as default };
|
|
194
194
|
|
|
195
195
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","ColorSlider","RACColorSlider","groupStyles","chequer","thumbClassName","verticalThumbClassName","mergeStatefulStyles","styles","root","kzqmXN","$$css","rootVertical","kGNEyG","kZKoxP","trackGround","kaIpWk","kB7OPa","kqGvvJ","trackGroundDisabled","kSiTet","trackGroundVertical","kzQI83","kUOVxO","kAzted","className","label","showValue","t0","$","T0","isDisabled","t1","t2","t3","vertical","t4","t5","t6","props","undefined","orientation","t7","ground","t8","Symbol","for","0","2","1","3","t9","t10","t11","t12","t13","t14","RACSliderOutput","RACColorThumb","RACSliderTrack"],"sources":["../../../src/components/color-slider/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { ColorSliderProps as RACColorSliderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorSlider as RACColorSlider, ColorThumb as RACColorThumb, SliderOutput as RACSliderOutput, SliderTrack as RACSliderTrack } from 'react-aria-components';\nimport { FieldLabel } from '../../field';\nimport { groupStyles } from '../../field/styles';\nimport { chequer } from '../../styles/chequer';\nimport { thumbClassName, verticalThumbClassName } from '../../styles/color';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\n\n// The sliders page's track, carrying one channel of a colour instead of an\n// active and an inactive part: the page's 16dp strip with its 8dp corner,\n// centred in the 44dp a handle takes, and the same label-large label above\n// it. React Aria paints the gradient itself, on the track's own inline\n// `background`, so what runs along the strip is the channel rather than\n// anything chosen here.\n//\n// Three things depart from the page, each because a colour slider shows a\n// value the page's slider does not have.\n//\n// **The handle is a circle carrying the colour, not the page's 4dp bar.**\n// The page's handle is a mark on a track whose colour it already knows; this\n// one has to show the value it sits on, and 4dp of a colour is not a colour\n// anyone can read. It keeps the page's 44dp of height as the target it is\n// centred in.\n//\n// **The handle is ringed rather than filled with primary.** Its fill is the\n// value, so the ring is what has to read against it — and against every\n// other colour the track runs through. It is a surface-coloured ring with a\n// hairline outside it, which reads on a light track and a dark one alike.\n//\n// **There is no stop at the inactive end.** The page puts one 6dp from the\n// end of the inactive part; a channel has no inactive part, so there is no\n// end for it to mark.\n//\n// Vertical, the strip stands up with the channel rising from the bottom, as\n// React Aria paints it, and takes Slider's geometry: 240px tall until the\n// call site's style says otherwise, the press target widened across rather\n// than along, and the handle centred across the strip.\n//\n// The alpha channel is the one that needs a chequer, for the reason\n// `src/styles/chequer.ts` gives: a track fading to transparent over a light\n// surface and one fading to white are the same pixels without it.\n\nconst styles = {\n root: {\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n rootVertical: {\n kGNEyG: \"x1cy8zhl\",\n kZKoxP: \"x1u5z0ei\",\n kzqmXN: \"x14atkfc\",\n $$css: true\n },\n trackGround: {\n kZKoxP: \"xlup9mm\",\n kaIpWk: \"x1xdvaa9\",\n kB7OPa: \"x9f619\",\n kzqmXN: \"xh8yej3\",\n kqGvvJ: \"x2k5q2m\",\n $$css: true\n },\n trackGroundDisabled: {\n kSiTet: \"x1ppv7y9\",\n $$css: true\n },\n trackGroundVertical: {\n kZKoxP: \"xt7dq6l\",\n kzQI83: \"x1iyjqo2\",\n kzqmXN: \"x1kky2od\",\n kqGvvJ: \"x10im51j\",\n kUOVxO: \"xcwsfa8\",\n kAzted: \"x2lwn1j\",\n $$css: true\n }\n};\ntype ColorSliderProps = Omit<RACColorSliderProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the slider's render state. */\n className?: RACColorSliderProps['className'];\n /** What the slider is for. Always rendered; React Aria names the channel otherwise. */\n label?: string;\n /**\n * Whether the value React Aria announces is also shown, at the end of the\n * label's line.\n * @default true\n */\n showValue?: boolean;\n /** A function may compute the style from the slider's render state. */\n style?: RACColorSliderProps['style'];\n};\n\n/**\n * A slider over one channel of a colour — hue, saturation, lightness, alpha\n * and the rest. The value is React Aria's: pass `value` with `onChange` to\n * control it, or `defaultValue`, as a CSS colour string or a `Color` from\n * `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorSlider channel=\"hue\" defaultValue=\"hsl(200, 100%, 50%)\" label=\"Label\" />\n * ```\n *\n * **`channel` has to name a channel the value's own space has.** A hex or\n * `rgb()` value parses as RGB, which has no hue, so `channel=\"hue\"` against\n * one throws rather than converting — pass `colorSpace=\"hsl\"` to convert it,\n * or give the value in the space you mean to slide.\n *\n * React Aria paints the gradient and names the value — \"200°, cyan blue\" —\n * so the readout beside the label is what it announces.\n *\n * The call site's `className` and `style` land on the slider as a whole,\n * which is the element a layout positions.\n */\nfunction ColorSlider({\n isDisabled = false,\n label,\n showValue = true,\n ...props\n}: ColorSliderProps & RefAttributes<HTMLDivElement>) {\n const vertical = props.orientation === 'vertical';\n return <RACColorSlider isDisabled={isDisabled} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root, styles.root, vertical && styles.rootVertical), props)}>\n <div className=\"x1pha0wt x78zum5 x126z3so\">\n {label === undefined ? null : <FieldLabel variant=\"group\">{label}</FieldLabel>}\n {showValue ? <RACSliderOutput className=\"x1w5n3ug x1yicsit x1b35g6e xwth0xh xybisxh xvc5jky\" /> : null}\n </div>\n <div {...stylex.props(chequer.ground, styles.trackGround, vertical && styles.trackGroundVertical, isDisabled && styles.trackGroundDisabled)}>\n <RACSliderTrack {...{\n 0: {\n className: \"x1cpjm7i x1mtdikz xm4btww x1hmns74 x5yr21d x9f619 x1ypdohk xh8yej3 x1n2onr6\"\n },\n 2: {\n className: \"x1cpjm7i x1hmns74 x5yr21d x9f619 x1ypdohk xh8yej3 x1n2onr6 x1nc033x x8s3y0y\"\n },\n 1: {\n className: \"x1cpjm7i x1mtdikz xm4btww x1hmns74 x5yr21d x9f619 xh8yej3 x1n2onr6 x1h6gzvc\"\n },\n 3: {\n className: \"x1cpjm7i x1hmns74 x5yr21d x9f619 xh8yej3 x1n2onr6 x1nc033x x8s3y0y x1h6gzvc\"\n }\n }[!!vertical << 1 | !!isDisabled << 0]}>\n <RACColorThumb className={vertical ? verticalThumbClassName : thumbClassName} />\n </RACSliderTrack>\n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L,EAAA,MAAAS;EAAAT,EAAA,MAAA2B;CAAA,OAAAA,MAAA3B,EAAA;CAAA,OAvBZ2B;AAuBY"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","ColorSlider","RACColorSlider","groupStyles","chequer","thumbClassName","verticalThumbClassName","mergeStatefulStyles","styles","root","kzqmXN","$$css","rootVertical","kGNEyG","kZKoxP","trackGround","kaIpWk","kB7OPa","kqGvvJ","trackGroundDisabled","kSiTet","trackGroundVertical","kzQI83","kUOVxO","kAzted","className","label","showValue","t0","$","T0","isDisabled","t1","t2","t3","vertical","t4","t5","t6","props","undefined","orientation","t7","ground","t8","Symbol","for","0","2","1","3","t9","t10","t11","t12","t13","t14","RACSliderOutput","RACColorThumb","RACSliderTrack"],"sources":["../../../src/components/color-slider/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { ColorSliderProps as RACColorSliderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorSlider as RACColorSlider, ColorThumb as RACColorThumb, SliderOutput as RACSliderOutput, SliderTrack as RACSliderTrack } from 'react-aria-components';\nimport { FieldLabel } from '../../field';\nimport { groupStyles } from '../../field/styles';\nimport { chequer } from '../../styles/chequer';\nimport { thumbClassName, verticalThumbClassName } from '../../styles/color';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\n\n// The sliders page's track, carrying one channel of a colour instead of an\n// active and an inactive part: the page's 16dp strip with its 8dp corner,\n// centred in the 44dp a handle takes, and the same label-large label above\n// it. React Aria paints the gradient itself, on the track's own inline\n// `background`, so what runs along the strip is the channel rather than\n// anything chosen here.\n//\n// Three things depart from the page, each because a colour slider shows a\n// value the page's slider does not have.\n//\n// **The handle is a circle carrying the colour, not the page's 4dp bar.**\n// The page's handle is a mark on a track whose colour it already knows; this\n// one has to show the value it sits on, and 4dp of a colour is not a colour\n// anyone can read. It keeps the page's 44dp of height as the target it is\n// centred in.\n//\n// **The handle is ringed rather than filled with primary.** Its fill is the\n// value, so the ring is what has to read against it — and against every\n// other colour the track runs through. It is a surface-coloured ring with a\n// hairline outside it, which reads on a light track and a dark one alike.\n//\n// **There is no stop at the inactive end.** The page puts one 6dp from the\n// end of the inactive part; a channel has no inactive part, so there is no\n// end for it to mark.\n//\n// Vertical, the strip stands up with the channel rising from the bottom, as\n// React Aria paints it, and takes Slider's geometry: 240px tall until the\n// call site's style says otherwise, the press target widened across rather\n// than along, and the handle centred across the strip.\n//\n// The alpha channel is the one that needs a chequer, for the reason\n// `src/styles/chequer.ts` gives: a track fading to transparent over a light\n// surface and one fading to white are the same pixels without it.\n\nconst styles = {\n root: {\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n rootVertical: {\n kGNEyG: \"x1cy8zhl\",\n kZKoxP: \"x1u5z0ei\",\n kzqmXN: \"x14atkfc\",\n $$css: true\n },\n trackGround: {\n kZKoxP: \"xlup9mm\",\n kaIpWk: \"x1xdvaa9\",\n kB7OPa: \"x9f619\",\n kzqmXN: \"xh8yej3\",\n kqGvvJ: \"x2k5q2m\",\n $$css: true\n },\n trackGroundDisabled: {\n kSiTet: \"x1ppv7y9\",\n $$css: true\n },\n trackGroundVertical: {\n kZKoxP: \"xt7dq6l\",\n kzQI83: \"x1iyjqo2\",\n kzqmXN: \"x1kky2od\",\n kqGvvJ: \"x10im51j\",\n kUOVxO: \"xcwsfa8\",\n kAzted: \"x2lwn1j\",\n $$css: true\n }\n};\ntype ColorSliderProps = Omit<RACColorSliderProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the slider's render state. */\n className?: RACColorSliderProps['className'];\n /** What the slider is for. Always rendered; React Aria names the channel otherwise. */\n label?: string;\n /**\n * Whether the value React Aria announces is also shown, at the end of the\n * label's line.\n * @default true\n */\n showValue?: boolean;\n /** A function may compute the style from the slider's render state. */\n style?: RACColorSliderProps['style'];\n};\n\n/**\n * A slider over one channel of a colour — hue, saturation, lightness, alpha\n * and the rest. The value is React Aria's: pass `value` with `onChange` to\n * control it, or `defaultValue`, as a CSS colour string or a `Color` from\n * `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorSlider channel=\"hue\" defaultValue=\"hsl(200, 100%, 50%)\" label=\"Label\" />\n * ```\n *\n * **`channel` has to name a channel the value's own space has.** A hex or\n * `rgb()` value parses as RGB, which has no hue, so `channel=\"hue\"` against\n * one throws rather than converting — pass `colorSpace=\"hsl\"` to convert it,\n * or give the value in the space you mean to slide.\n *\n * React Aria paints the gradient and names the value — \"200°, cyan blue\" —\n * so the readout beside the label is what it announces.\n *\n * The call site's `className` and `style` land on the slider as a whole,\n * which is the element a layout positions.\n */\nfunction ColorSlider({\n isDisabled = false,\n label,\n showValue = true,\n ...props\n}: ColorSliderProps & RefAttributes<HTMLDivElement>) {\n const vertical = props.orientation === 'vertical';\n return <RACColorSlider isDisabled={isDisabled} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root, styles.root, vertical && styles.rootVertical), props)}>\n <div className=\"x1pha0wt x78zum5 x126z3so\">\n {label === undefined ? null : <FieldLabel variant=\"group\">{label}</FieldLabel>}\n {showValue ? <RACSliderOutput className=\"x1w5n3ug x1yicsit x1b35g6e xwth0xh xybisxh xvc5jky\" /> : null}\n </div>\n <div {...stylex.props(chequer.ground, styles.trackGround, vertical && styles.trackGroundVertical, isDisabled && styles.trackGroundDisabled)}>\n <RACSliderTrack {...{\n 0: {\n className: \"x1cpjm7i x1mtdikz xm4btww x1hmns74 x5yr21d x9f619 x1ypdohk xh8yej3 x1n2onr6\"\n },\n 2: {\n className: \"x1cpjm7i x1hmns74 x5yr21d x9f619 x1ypdohk xh8yej3 x1n2onr6 x1nc033x x8s3y0y\"\n },\n 1: {\n className: \"x1cpjm7i x1mtdikz xm4btww x1hmns74 x5yr21d x9f619 xh8yej3 x1n2onr6 x1h6gzvc\"\n },\n 3: {\n className: \"x1cpjm7i x1hmns74 x5yr21d x9f619 xh8yej3 x1n2onr6 x1nc033x x8s3y0y x1h6gzvc\"\n }\n }[!!vertical << 1 | !!isDisabled << 0]}>\n <RACColorThumb className={vertical ? verticalThumbClassName : thumbClassName} />\n </RACSliderTrack>\n </div>\n </RACColorSlider>;\n}\nexport type { ColorSliderProps };\nexport default ColorSlider;"],"mappings":";;;;;;;;;;;AAgDA,MAAMS,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,OAAO;CACT;CACAC,cAAc;EACZC,QAAQ;EACRC,QAAQ;EACRJ,QAAQ;EACRC,OAAO;CACT;CACAI,aAAa;EACXD,QAAQ;EACRE,QAAQ;EACRC,QAAQ;EACRP,QAAQ;EACRQ,QAAQ;EACRP,OAAO;CACT;CACAQ,qBAAqB;EACnBC,QAAQ;EACRT,OAAO;CACT;CACAU,qBAAqB;EACnBP,QAAQ;EACRQ,QAAQ;EACRZ,QAAQ;EACRQ,QAAQ;EACRK,QAAQ;EACRC,QAAQ;EACRb,OAAO;CACT;AACF;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAAV,YAAA2B,IAAA;CAAA,MAAAC,IAAA9B,EAAA,EAAA;CAAA,IAAA+B;CAAA,IAAAC;CAAA,IAAAL;CAAA,IAAAC;CAAA,IAAAK;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAD,IAAA;EAAqB,MAAA,EAAAG,YAAAK,IAAAV,OAAAW,IAAAV,WAAAW,IAAA,GAAAC,YAAAX;EAAAF,QAAAW;EACnBN,aAAAK,OAAAI,KAAAA,IAAA,QAAAJ;EAEAT,YAAAW,OAAAE,KAAAA,IAAA,OAAAF;EAGAH,WAAiBI,QAAKE,gBAAiB;EAC/BX,KAAA5B;EAA2B6B,KAAAA;EAAgBQ,KAAAA;EAAWL,KAAA3B,oBAAoBP,MAAaG,YAAWM,MAAOD,OAAMC,MAAO0B,YAAY3B,OAAMI,YAAa,GAAG2B,OAAK;EAACV,EAAA,KAAAD;EAAA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AML;GAAvD,UAAA,CACHI,IAIAiB,GALkB;;EAuBH1B,EAAA,MAAAC;EAAAD,EAAA,MAAAG;EAAAH,EAAA,MAAA0B;EAAA1B,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAS;EAAAT,EAAA,MAAA2B;CAAA,OAAAA,MAAA3B,EAAA;CAAA,OAvBZ2B;AAuBY"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, RefAttributes } from "react";
|
|
2
|
-
import { ColorSwatchProps } from "react-aria-components";
|
|
3
|
-
type ColorSwatchProps
|
|
2
|
+
import { ColorSwatchProps as ColorSwatchProps$1 } from "react-aria-components";
|
|
3
|
+
type ColorSwatchProps = Omit<ColorSwatchProps$1, 'className' | 'style'> & {
|
|
4
4
|
/**
|
|
5
5
|
* Lands on the square around the swatch, which is the element a layout
|
|
6
6
|
* positions and the one that carries its size.
|
|
@@ -30,5 +30,5 @@ type ColorSwatchProps$1 = Omit<ColorSwatchProps, 'className' | 'style'> & {
|
|
|
30
30
|
* React Aria's function forms are not taken here, since a swatch has no
|
|
31
31
|
* interactive state for one to read.
|
|
32
32
|
*/
|
|
33
|
-
declare function ColorSwatch
|
|
34
|
-
export { type ColorSwatchProps
|
|
33
|
+
declare function ColorSwatch({ className, ref, style, ...props }: ColorSwatchProps & RefAttributes<HTMLSpanElement>): import("react").JSX.Element;
|
|
34
|
+
export { type ColorSwatchProps, ColorSwatch as default };
|
|
@@ -6,7 +6,7 @@ import { SwatchSquareContext } from "../../swatch/index.js";
|
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { useContext } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import { ColorSwatch } from "react-aria-components";
|
|
9
|
+
import { ColorSwatch as ColorSwatch$1 } from "react-aria-components";
|
|
10
10
|
// src/components/color-swatch/index.tsx
|
|
11
11
|
const styles = { ground: {
|
|
12
12
|
kZKoxP: "x1vqgdyp",
|
|
@@ -38,7 +38,7 @@ const styles = { ground: {
|
|
|
38
38
|
* React Aria's function forms are not taken here, since a swatch has no
|
|
39
39
|
* interactive state for one to read.
|
|
40
40
|
*/
|
|
41
|
-
function ColorSwatch
|
|
41
|
+
function ColorSwatch(t0) {
|
|
42
42
|
const $ = c(15);
|
|
43
43
|
let className;
|
|
44
44
|
let props$1;
|
|
@@ -71,7 +71,7 @@ function ColorSwatch$1(t0) {
|
|
|
71
71
|
} else t1 = $[8];
|
|
72
72
|
let t2;
|
|
73
73
|
if ($[9] !== props$1) {
|
|
74
|
-
t2 = /* @__PURE__ */ jsx(ColorSwatch, {
|
|
74
|
+
t2 = /* @__PURE__ */ jsx(ColorSwatch$1, {
|
|
75
75
|
...props$1,
|
|
76
76
|
className: "x5yr21d x1tfhd1 xbd69nm x9f619 x1lliihq xh8yej3"
|
|
77
77
|
});
|
|
@@ -92,6 +92,6 @@ function ColorSwatch$1(t0) {
|
|
|
92
92
|
} else t3 = $[14];
|
|
93
93
|
return t3;
|
|
94
94
|
}
|
|
95
|
-
export { ColorSwatch
|
|
95
|
+
export { ColorSwatch as default };
|
|
96
96
|
|
|
97
97
|
//# sourceMappingURL=index.js.map
|