@panneau/ui 5.0.0-alpha.4 → 5.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -2
- package/dist/command-palette/CommandPalette.css +299 -0
- package/dist/command-palette/CommandPalette.d.ts +37 -0
- package/dist/command-palette/CommandPalette.d.ts.map +1 -0
- package/dist/command-palette/CommandPalette.js +194 -0
- package/dist/command-palette/CommandPalette.js.map +1 -0
- package/dist/command-palette/CommandPalette.module.js +62 -0
- package/dist/command-palette/CommandPalette.module.js.map +1 -0
- package/dist/command-palette/match.d.ts +39 -0
- package/dist/command-palette/match.d.ts.map +1 -0
- package/dist/command-palette/match.js +44 -0
- package/dist/command-palette/match.js.map +1 -0
- package/dist/command-palette/tokens.d.ts +3 -0
- package/dist/command-palette/tokens.d.ts.map +1 -0
- package/dist/command-palette/tokens.js +23 -0
- package/dist/command-palette/tokens.js.map +1 -0
- package/dist/command-palette/useCommandShortcut.d.ts +12 -0
- package/dist/command-palette/useCommandShortcut.d.ts.map +1 -0
- package/dist/command-palette/useCommandShortcut.js +29 -0
- package/dist/command-palette/useCommandShortcut.js.map +1 -0
- package/dist/date-picker/DatePicker.css +40 -0
- package/dist/date-picker/DatePicker.d.ts +2 -1
- package/dist/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/date-picker/DatePicker.js +54 -8
- package/dist/date-picker/DatePicker.js.map +1 -1
- package/dist/date-picker/DatePicker.module.js +5 -1
- package/dist/date-picker/DatePicker.module.js.map +1 -1
- package/dist/dialog/Dialog.css +36 -2
- package/dist/dialog/Dialog.d.ts +15 -3
- package/dist/dialog/Dialog.d.ts.map +1 -1
- package/dist/dialog/Dialog.js +22 -14
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/Dialog.module.js +8 -2
- package/dist/dialog/Dialog.module.js.map +1 -1
- package/dist/dialog/tokens.d.ts +1 -1
- package/dist/dialog/tokens.d.ts.map +1 -1
- package/dist/dialog/tokens.js +2 -0
- package/dist/dialog/tokens.js.map +1 -1
- package/dist/field/Field.css +9 -0
- package/dist/field/Field.module.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/menu/Menu.css +84 -0
- package/dist/menu/Menu.d.ts +33 -6
- package/dist/menu/Menu.d.ts.map +1 -1
- package/dist/menu/Menu.js +110 -25
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/Menu.module.js +22 -0
- package/dist/menu/Menu.module.js.map +1 -0
- package/dist/menu/tokens.d.ts +3 -0
- package/dist/menu/tokens.d.ts.map +1 -0
- package/dist/menu/tokens.js +31 -0
- package/dist/menu/tokens.js.map +1 -0
- package/dist/number-input/NumberInput.css +18 -0
- package/dist/number-input/NumberInput.js +1 -1
- package/dist/number-input/NumberInput.js.map +1 -1
- package/dist/number-input/NumberInput.module.js +3 -1
- package/dist/number-input/NumberInput.module.js.map +1 -1
- package/dist/pill-trigger/PillTrigger.css +104 -0
- package/dist/pill-trigger/PillTrigger.d.ts +20 -0
- package/dist/pill-trigger/PillTrigger.d.ts.map +1 -0
- package/dist/pill-trigger/PillTrigger.js +38 -0
- package/dist/pill-trigger/PillTrigger.js.map +1 -0
- package/dist/pill-trigger/PillTrigger.module.js +18 -0
- package/dist/pill-trigger/PillTrigger.module.js.map +1 -0
- package/dist/pill-trigger/tokens.d.ts +3 -0
- package/dist/pill-trigger/tokens.d.ts.map +1 -0
- package/dist/pill-trigger/tokens.js +37 -0
- package/dist/pill-trigger/tokens.js.map +1 -0
- package/dist/radio-group/RadioGroup.css +90 -0
- package/dist/radio-group/RadioGroup.d.ts +22 -3
- package/dist/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/radio-group/RadioGroup.js +42 -21
- package/dist/radio-group/RadioGroup.js.map +1 -1
- package/dist/radio-group/RadioGroup.module.js +12 -2
- package/dist/radio-group/RadioGroup.module.js.map +1 -1
- package/dist/radio-group/tokens.d.ts +2 -2
- package/dist/radio-group/tokens.d.ts.map +1 -1
- package/dist/radio-group/tokens.js +22 -2
- package/dist/radio-group/tokens.js.map +1 -1
- package/dist/segmented-control/SegmentedControl.css +83 -0
- package/dist/segmented-control/SegmentedControl.d.ts +35 -0
- package/dist/segmented-control/SegmentedControl.d.ts.map +1 -0
- package/dist/segmented-control/SegmentedControl.js +44 -0
- package/dist/segmented-control/SegmentedControl.js.map +1 -0
- package/dist/segmented-control/SegmentedControl.module.js +16 -0
- package/dist/segmented-control/SegmentedControl.module.js.map +1 -0
- package/dist/segmented-control/tokens.d.ts +3 -0
- package/dist/segmented-control/tokens.d.ts.map +1 -0
- package/dist/segmented-control/tokens.js +29 -0
- package/dist/segmented-control/tokens.js.map +1 -0
- package/dist/select/ListBox.css +23 -1
- package/dist/select/ListBox.module.js +2 -2
- package/dist/select/ListBox.module.js.map +1 -1
- package/dist/select/listBoxTokens.d.ts +1 -1
- package/dist/select/listBoxTokens.d.ts.map +1 -1
- package/dist/select/listBoxTokens.js +2 -0
- package/dist/select/listBoxTokens.js.map +1 -1
- package/dist/slider/Slider.css +84 -0
- package/dist/slider/Slider.d.ts +20 -0
- package/dist/slider/Slider.d.ts.map +1 -0
- package/dist/slider/Slider.js +70 -0
- package/dist/slider/Slider.js.map +1 -0
- package/dist/slider/Slider.module.js +20 -0
- package/dist/slider/Slider.module.js.map +1 -0
- package/dist/tags-input/TagsInput.css +60 -0
- package/dist/tags-input/TagsInput.d.ts +32 -0
- package/dist/tags-input/TagsInput.d.ts.map +1 -0
- package/dist/tags-input/TagsInput.js +160 -0
- package/dist/tags-input/TagsInput.js.map +1 -0
- package/dist/tags-input/TagsInput.module.js +20 -0
- package/dist/tags-input/TagsInput.module.js.map +1 -0
- package/dist/text-input/TextInput.d.ts.map +1 -1
- package/dist/text-input/TextInput.js +2 -0
- package/dist/text-input/TextInput.js.map +1 -1
- package/dist/theme/components.d.ts +7 -3
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +8 -0
- package/dist/theme/components.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineComponentTokens } from "../theme/componentTokens.js";
|
|
2
|
+
//#region src/pill-trigger/tokens.ts
|
|
3
|
+
/** Tokens of PillTrigger. */
|
|
4
|
+
var pillTriggerTokens = defineComponentTokens("pill-trigger", {
|
|
5
|
+
/** Background. */
|
|
6
|
+
bg: "var(--panneau-color-surface-sunken)",
|
|
7
|
+
/** Background of a hovered, pressed or open trigger. */
|
|
8
|
+
"bg-hover": "color-mix(in srgb, var(--panneau-color-text) 8%, var(--panneau-color-surface-sunken))",
|
|
9
|
+
/** Color of the value. */
|
|
10
|
+
color: "var(--panneau-color-text)",
|
|
11
|
+
/** Color of the border: none by default. */
|
|
12
|
+
"border-color": "transparent",
|
|
13
|
+
/** Corner radius. */
|
|
14
|
+
radius: "var(--panneau-radius-full)",
|
|
15
|
+
/** Space between the media, the value and the chevron. */
|
|
16
|
+
gap: "var(--panneau-space-2)",
|
|
17
|
+
/** Horizontal padding. */
|
|
18
|
+
"padding-x": "var(--panneau-space-3)",
|
|
19
|
+
/** Horizontal padding of the small size. */
|
|
20
|
+
"padding-x-sm": "var(--panneau-space-2)",
|
|
21
|
+
/** Font size of the value. */
|
|
22
|
+
"font-size": "var(--panneau-font-size-md)",
|
|
23
|
+
/** Font size of the value, small size. */
|
|
24
|
+
"font-size-sm": "var(--panneau-font-size-sm)",
|
|
25
|
+
/** Font weight of the value. */
|
|
26
|
+
"font-weight": "var(--panneau-font-weight-medium)",
|
|
27
|
+
/** Size of the leading media. */
|
|
28
|
+
"media-size": "1.5rem",
|
|
29
|
+
/** Size of the leading media, small size. */
|
|
30
|
+
"media-size-sm": "1.25rem",
|
|
31
|
+
/** Corner radius of the leading media: its content is clipped to it. */
|
|
32
|
+
"media-radius": "var(--panneau-radius-full)"
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { pillTriggerTokens };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/pill-trigger/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of PillTrigger. */\nexport const pillTriggerTokens = defineComponentTokens('pill-trigger', {\n /** Background. */\n bg: 'var(--panneau-color-surface-sunken)',\n /** Background of a hovered, pressed or open trigger. */\n 'bg-hover':\n 'color-mix(in srgb, var(--panneau-color-text) 8%, var(--panneau-color-surface-sunken))',\n /** Color of the value. */\n color: 'var(--panneau-color-text)',\n /** Color of the border: none by default. */\n 'border-color': 'transparent',\n /** Corner radius. */\n radius: 'var(--panneau-radius-full)',\n /** Space between the media, the value and the chevron. */\n gap: 'var(--panneau-space-2)',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-3)',\n /** Horizontal padding of the small size. */\n 'padding-x-sm': 'var(--panneau-space-2)',\n /** Font size of the value. */\n 'font-size': 'var(--panneau-font-size-md)',\n /** Font size of the value, small size. */\n 'font-size-sm': 'var(--panneau-font-size-sm)',\n /** Font weight of the value. */\n 'font-weight': 'var(--panneau-font-weight-medium)',\n /** Size of the leading media. */\n 'media-size': '1.5rem',\n /** Size of the leading media, small size. */\n 'media-size-sm': '1.25rem',\n /** Corner radius of the leading media: its content is clipped to it. */\n 'media-radius': 'var(--panneau-radius-full)',\n});\n"],"mappings":";;;AAGA,IAAa,oBAAoB,sBAAsB,gBAAgB;;CAEnE,IAAI;;CAEJ,YACI;;CAEJ,OAAO;;CAEP,gBAAgB;;CAEhB,QAAQ;;CAER,KAAK;;CAEL,aAAa;;CAEb,gBAAgB;;CAEhB,aAAa;;CAEb,gBAAgB;;CAEhB,eAAe;;CAEf,cAAc;;CAEd,iBAAiB;;CAEjB,gBAAgB;AACpB,CAAC"}
|
|
@@ -67,11 +67,101 @@
|
|
|
67
67
|
min-width: 0;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
.panneau-radio-group-option-label {
|
|
71
|
+
overflow-wrap: anywhere;
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
.panneau-radio-group-description {
|
|
71
75
|
font-size: var(--panneau-font-size-sm);
|
|
72
76
|
color: var(--panneau-color-text-muted);
|
|
73
77
|
}
|
|
74
78
|
|
|
79
|
+
/* Leading media of an option, between the radio and the label. */
|
|
80
|
+
.panneau-radio-group-media {
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
flex: 0 0 auto;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
width: var(--panneau-radio-media-size, 2rem);
|
|
86
|
+
height: var(--panneau-radio-media-size, 2rem);
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
border-radius: var(--panneau-radio-media-radius, var(--panneau-radius-full));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.panneau-radio-group-media > :is(img, svg, video, picture) {
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
object-fit: cover;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
* Cards: the options in a grid of --_panneau-radio-group-columns columns, inside a size container
|
|
99
|
+
* of their own, so that they become a single column when the group is narrow, wherever it is.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
.panneau-radio-group-grid {
|
|
103
|
+
container-type: inline-size;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.panneau-radio-group-cards .panneau-radio-group-options {
|
|
107
|
+
display: grid;
|
|
108
|
+
grid-template-columns: repeat(var(--_panneau-radio-group-columns, 2), minmax(0, 1fr));
|
|
109
|
+
gap: var(--panneau-radio-card-gap, var(--panneau-space-2));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@container (max-width: 28rem) {
|
|
113
|
+
.panneau-radio-group-cards .panneau-radio-group-options {
|
|
114
|
+
grid-template-columns: minmax(0, 1fr);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.panneau-radio-group-card {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: var(--panneau-space-3);
|
|
122
|
+
padding: var(--panneau-radio-card-padding, var(--panneau-space-3));
|
|
123
|
+
background-color: var(--panneau-radio-card-bg, var(--panneau-color-surface));
|
|
124
|
+
border: var(--panneau-border-width) solid
|
|
125
|
+
var(--panneau-radio-card-border-color, var(--panneau-color-border));
|
|
126
|
+
border-radius: var(--panneau-radio-card-radius, var(--panneau-radius-md));
|
|
127
|
+
transition:
|
|
128
|
+
border-color var(--panneau-duration),
|
|
129
|
+
box-shadow var(--panneau-duration);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.panneau-radio-group-card .panneau-radio-group-circle {
|
|
133
|
+
margin-top: 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.panneau-radio-group-card .panneau-radio-group-option-label {
|
|
137
|
+
font-weight: var(--panneau-radio-card-label-font-weight, var(--panneau-font-weight-medium));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.panneau-radio-group-card[data-hovered] {
|
|
141
|
+
border-color: var(--panneau-radio-card-border-color-hover, var(--panneau-color-border-control));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* The selected card: a border of twice the width, drawn inside so that nothing moves. */
|
|
145
|
+
.panneau-radio-group-card[data-selected] {
|
|
146
|
+
border-color: var(--panneau-radio-card-border-color-selected, var(--panneau-color-accent));
|
|
147
|
+
box-shadow: inset 0 0 0 var(--panneau-border-width)
|
|
148
|
+
var(--panneau-radio-card-border-color-selected, var(--panneau-color-accent));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.panneau-radio-group-card[data-invalid] {
|
|
152
|
+
border-color: var(--panneau-color-danger);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* A card shows the focus ring around itself, instead of around its radio. */
|
|
156
|
+
.panneau-radio-group-card[data-focus-visible] {
|
|
157
|
+
outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
|
|
158
|
+
outline-offset: 2px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.panneau-radio-group-card[data-focus-visible] .panneau-radio-group-circle {
|
|
162
|
+
outline: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
75
165
|
@media (pointer: coarse) {
|
|
76
166
|
.panneau-radio-group-radio {
|
|
77
167
|
min-height: 2.75rem;
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import { type RadioGroupProps as AriaRadioGroupProps } from 'react-aria-components';
|
|
2
3
|
import { type FieldChromeProps } from '../field/FieldParts';
|
|
3
4
|
import type { OptionValue, SelectOption } from '../select/Select';
|
|
5
|
+
/** An option of a `RadioGroup`: a `SelectOption`, with an optional leading media. */
|
|
6
|
+
export interface RadioGroupOption extends SelectOption {
|
|
7
|
+
/** Leading media, such as an avatar or an image, between the radio and the label. */
|
|
8
|
+
media?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** How a `RadioGroup` shows its options: a list of radios, or bordered cards in a grid. */
|
|
11
|
+
export type RadioGroupAppearance = 'list' | 'cards';
|
|
4
12
|
export interface RadioGroupProps extends Omit<AriaRadioGroupProps, 'className' | 'style' | 'children' | 'isInvalid' | 'validate' | 'value' | 'defaultValue' | 'onChange'>, FieldChromeProps {
|
|
5
|
-
options: readonly
|
|
13
|
+
options: readonly RadioGroupOption[];
|
|
6
14
|
value?: OptionValue | null;
|
|
7
15
|
onChange?: (value: OptionValue) => void;
|
|
16
|
+
/**
|
|
17
|
+
* `list` (default) shows the options as radios, one under the other or side by side with
|
|
18
|
+
* `orientation="horizontal"`. `cards` shows them as bordered cards in a grid of `columns`, which
|
|
19
|
+
* becomes a single column in a narrow container. The selected card has a stronger border.
|
|
20
|
+
*/
|
|
21
|
+
appearance?: RadioGroupAppearance;
|
|
22
|
+
/** Columns of cards, with `appearance="cards"`. Defaults to 2. */
|
|
23
|
+
columns?: number;
|
|
8
24
|
radioClassName?: string;
|
|
9
25
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
26
|
+
/**
|
|
27
|
+
* A set of options where one can be picked, all visible at once, as a list of radios or as cards
|
|
28
|
+
* (`appearance="cards"`). Arrow keys move between options in both appearances.
|
|
29
|
+
*/
|
|
30
|
+
export declare function RadioGroup({ options, value, onChange, label, description, errors, orientation, appearance, columns, isRequired, className, labelClassName, descriptionClassName, errorsClassName, radioClassName, ...props }: RadioGroupProps): import("react").JSX.Element;
|
|
12
31
|
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/radio-group/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,eAAe,IAAI,mBAAmB,EAE9C,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACH,KAAK,gBAAgB,EAKxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIlE,MAAM,WAAW,eACb,SACI,IAAI,CACA,mBAAmB,EACjB,WAAW,GACX,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,OAAO,GACP,cAAc,GACd,UAAU,CACf,EACD,gBAAgB;IACpB,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/radio-group/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAEH,KAAK,eAAe,IAAI,mBAAmB,EAE9C,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACH,KAAK,gBAAgB,EAKxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIlE,qFAAqF;AACrF,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IAClD,qFAAqF;IACrF,KAAK,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,2FAA2F;AAC3F,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD,MAAM,WAAW,eACb,SACI,IAAI,CACA,mBAAmB,EACjB,WAAW,GACX,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,OAAO,GACP,cAAc,GACd,UAAU,CACf,EACD,gBAAgB;IACpB,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACvB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,WAAW,EACX,MAAW,EACX,WAAwB,EACxB,UAAmB,EACnB,OAAW,EACX,UAAU,EACV,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,GAAG,KAAK,EACX,EAAE,eAAe,+BA0EjB"}
|
|
@@ -5,8 +5,36 @@ import RadioGroup_module_default from "./RadioGroup.module.js";
|
|
|
5
5
|
import { Radio, RadioGroup } from "react-aria-components";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/radio-group/RadioGroup.tsx
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A set of options where one can be picked, all visible at once, as a list of radios or as cards
|
|
10
|
+
* (`appearance="cards"`). Arrow keys move between options in both appearances.
|
|
11
|
+
*/
|
|
12
|
+
function RadioGroup$1({ options, value, onChange, label, description, errors = [], orientation = "vertical", appearance = "list", columns = 2, isRequired, className, labelClassName, descriptionClassName, errorsClassName, radioClassName, ...props }) {
|
|
13
|
+
const radios = options.map((option, position) => /* @__PURE__ */ jsxs(Radio, {
|
|
14
|
+
value: String(position),
|
|
15
|
+
isDisabled: option.disabled,
|
|
16
|
+
className: cx("panneau-radio", RadioGroup_module_default.radio, appearance === "cards" && RadioGroup_module_default.card, radioClassName),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx("span", {
|
|
19
|
+
className: RadioGroup_module_default.circle,
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}),
|
|
22
|
+
option.media !== void 0 && option.media !== null ? /* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: RadioGroup_module_default.media,
|
|
24
|
+
children: option.media
|
|
25
|
+
}) : null,
|
|
26
|
+
/* @__PURE__ */ jsxs("span", {
|
|
27
|
+
className: RadioGroup_module_default.text,
|
|
28
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: RadioGroup_module_default.optionLabel,
|
|
30
|
+
children: option.label
|
|
31
|
+
}), option.description !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
32
|
+
className: RadioGroup_module_default.description,
|
|
33
|
+
children: option.description
|
|
34
|
+
}) : null]
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}, position));
|
|
10
38
|
const index = value === void 0 ? void 0 : options.findIndex((o) => o.value === value);
|
|
11
39
|
return /* @__PURE__ */ jsxs(RadioGroup, {
|
|
12
40
|
...props,
|
|
@@ -14,35 +42,28 @@ function RadioGroup$1({ options, value, onChange, label, description, errors = [
|
|
|
14
42
|
isRequired,
|
|
15
43
|
value: index === void 0 ? void 0 : index === -1 ? null : String(index),
|
|
16
44
|
onChange: (key) => {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
45
|
+
const option_0 = options[Number(key)];
|
|
46
|
+
if (option_0 !== void 0) onChange?.(option_0.value);
|
|
19
47
|
},
|
|
20
48
|
isInvalid: errors.length > 0,
|
|
21
49
|
validationBehavior: "aria",
|
|
22
|
-
className: cx("panneau-radio-group", Field_module_default.field, orientation === "horizontal" && RadioGroup_module_default.horizontal, className),
|
|
50
|
+
className: cx("panneau-radio-group", Field_module_default.field, appearance === "cards" ? RadioGroup_module_default.cards : orientation === "horizontal" && RadioGroup_module_default.horizontal, className),
|
|
23
51
|
children: [
|
|
24
52
|
/* @__PURE__ */ jsx(FieldLabel, {
|
|
25
53
|
isRequired,
|
|
26
54
|
className: labelClassName,
|
|
27
55
|
children: label
|
|
28
56
|
}),
|
|
29
|
-
/* @__PURE__ */ jsx("div", {
|
|
57
|
+
appearance === "cards" ? /* @__PURE__ */ jsx("div", {
|
|
58
|
+
className: RadioGroup_module_default.grid,
|
|
59
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: RadioGroup_module_default.options,
|
|
61
|
+
style: { "--_panneau-radio-group-columns": String(Math.max(1, Math.floor(columns))) },
|
|
62
|
+
children: radios
|
|
63
|
+
})
|
|
64
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
30
65
|
className: RadioGroup_module_default.options,
|
|
31
|
-
children:
|
|
32
|
-
value: String(position),
|
|
33
|
-
isDisabled: option_0.disabled,
|
|
34
|
-
className: cx("panneau-radio", RadioGroup_module_default.radio, radioClassName),
|
|
35
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
36
|
-
className: RadioGroup_module_default.circle,
|
|
37
|
-
"aria-hidden": "true"
|
|
38
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
39
|
-
className: RadioGroup_module_default.text,
|
|
40
|
-
children: [/* @__PURE__ */ jsx("span", { children: option_0.label }), option_0.description !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
41
|
-
className: RadioGroup_module_default.description,
|
|
42
|
-
children: option_0.description
|
|
43
|
-
}) : null]
|
|
44
|
-
})]
|
|
45
|
-
}, position))
|
|
66
|
+
children: radios
|
|
46
67
|
}),
|
|
47
68
|
/* @__PURE__ */ jsx(FieldDescription, {
|
|
48
69
|
className: descriptionClassName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","names":["option","RadioGroup","
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","names":["option","RadioGroup","styles","AriaRadioGroup","fieldStyles"],"sources":["../../src/radio-group/RadioGroup.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport {\n RadioGroup as AriaRadioGroup,\n type RadioGroupProps as AriaRadioGroupProps,\n Radio,\n} from 'react-aria-components';\n\nimport {\n type FieldChromeProps,\n FieldDescription,\n FieldErrors,\n FieldLabel,\n fieldStyles,\n} from '../field/FieldParts';\nimport type { OptionValue, SelectOption } from '../select/Select';\nimport { cx } from '../utils/cx';\nimport styles from './RadioGroup.module.css';\n\n/** An option of a `RadioGroup`: a `SelectOption`, with an optional leading media. */\nexport interface RadioGroupOption extends SelectOption {\n /** Leading media, such as an avatar or an image, between the radio and the label. */\n media?: ReactNode;\n}\n\n/** How a `RadioGroup` shows its options: a list of radios, or bordered cards in a grid. */\nexport type RadioGroupAppearance = 'list' | 'cards';\n\nexport interface RadioGroupProps\n extends\n Omit<\n AriaRadioGroupProps,\n | 'className'\n | 'style'\n | 'children'\n | 'isInvalid'\n | 'validate'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n >,\n FieldChromeProps {\n options: readonly RadioGroupOption[];\n value?: OptionValue | null;\n onChange?: (value: OptionValue) => void;\n /**\n * `list` (default) shows the options as radios, one under the other or side by side with\n * `orientation=\"horizontal\"`. `cards` shows them as bordered cards in a grid of `columns`, which\n * becomes a single column in a narrow container. The selected card has a stronger border.\n */\n appearance?: RadioGroupAppearance;\n /** Columns of cards, with `appearance=\"cards\"`. Defaults to 2. */\n columns?: number;\n radioClassName?: string;\n}\n\n/**\n * A set of options where one can be picked, all visible at once, as a list of radios or as cards\n * (`appearance=\"cards\"`). Arrow keys move between options in both appearances.\n */\nexport function RadioGroup({\n options,\n value,\n onChange,\n label,\n description,\n errors = [],\n orientation = 'vertical',\n appearance = 'list',\n columns = 2,\n isRequired,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n radioClassName,\n ...props\n}: RadioGroupProps) {\n const radios = options.map((option, position) => (\n <Radio\n key={position}\n value={String(position)}\n isDisabled={option.disabled}\n className={cx(\n 'panneau-radio',\n styles.radio,\n appearance === 'cards' && styles.card,\n radioClassName,\n )}\n >\n <span className={styles.circle} aria-hidden=\"true\" />\n {option.media !== undefined && option.media !== null ? (\n <span className={styles.media}>{option.media}</span>\n ) : null}\n <span className={styles.text}>\n <span className={styles.optionLabel}>{option.label}</span>\n {option.description !== undefined ? (\n <span className={styles.description}>{option.description}</span>\n ) : null}\n </span>\n </Radio>\n ));\n const index = value === undefined ? undefined : options.findIndex((o) => o.value === value);\n return (\n <AriaRadioGroup\n {...props}\n orientation={orientation}\n isRequired={isRequired}\n value={index === undefined ? undefined : index === -1 ? null : String(index)}\n onChange={(key) => {\n const option = options[Number(key)];\n if (option !== undefined) {\n onChange?.(option.value);\n }\n }}\n isInvalid={errors.length > 0}\n validationBehavior=\"aria\"\n className={cx(\n 'panneau-radio-group',\n fieldStyles.field,\n appearance === 'cards'\n ? styles.cards\n : orientation === 'horizontal' && styles.horizontal,\n className,\n )}\n >\n <FieldLabel isRequired={isRequired} className={labelClassName}>\n {label}\n </FieldLabel>\n {appearance === 'cards' ? (\n <div className={styles.grid}>\n <div\n className={styles.options}\n style={\n {\n '--_panneau-radio-group-columns': String(\n Math.max(1, Math.floor(columns)),\n ),\n } as CSSProperties\n }\n >\n {radios}\n </div>\n </div>\n ) : (\n <div className={styles.options}>{radios}</div>\n )}\n <FieldDescription className={descriptionClassName}>{description}</FieldDescription>\n <FieldErrors errors={errors} className={errorsClassName} />\n </AriaRadioGroup>\n );\n}\n"],"mappings":";;;;;;;;;;;AA2DA,SAAgBC,aAAW,EACvB,SACA,OACA,UACA,OACA,aACA,SAAS,CAAA,GACT,cAAc,YACd,aAAa,QACb,UAAU,GACV,YACA,WACA,gBACA,sBACA,iBACA,gBACA,GAAG,SACa;CAChB,MAAM,SAAS,QAAQ,KAAK,QAAQ,aAChC,qBAAC,OAAD;EAEI,OAAO,OAAO,QAAQ;EACtB,YAAY,OAAO;EACnB,WAAW,GACP,iBACAC,0BAAO,OACP,eAAe,WAAWA,0BAAO,MACjC,cACJ;EATJ,UAAA;GAWI,oBAAC,QAAD;IAAM,WAAWA,0BAAO;IAAQ,eAAY;GAAM,CAAA;GACjD,OAAO,UAAU,KAAA,KAAa,OAAO,UAAU,OAC5C,oBAAC,QAAD;IAAM,WAAWA,0BAAO;IAAQ,UAAA,OAAO;GAAY,CAAA,IACnD;GACJ,qBAAC,QAAD;IAAM,WAAWA,0BAAO;IAAxB,UAAA,CACI,oBAAC,QAAD;KAAM,WAAWA,0BAAO;KAAc,UAAA,OAAO;IAAY,CAAA,GACxD,OAAO,gBAAgB,KAAA,IACpB,oBAAC,QAAD;KAAM,WAAWA,0BAAO;KAAc,UAAA,OAAO;IAAkB,CAAA,IAC/D,IACF;;EACH;CApBE,GAAA,QAoBF,CACV;CACD,MAAM,QAAQ,UAAU,KAAA,IAAY,KAAA,IAAY,QAAQ,WAAW,MAAM,EAAE,UAAU,KAAK;CAC1F,OACI,qBAACC,YAAD;EACI,GAAI;EACS;EACD;EACZ,OAAO,UAAU,KAAA,IAAY,KAAA,IAAY,UAAU,KAAK,OAAO,OAAO,KAAK;EAC3E,WAAW,QAAQ;GACf,MAAMH,WAAS,QAAQ,OAAO,GAAG;GACjC,IAAIA,aAAW,KAAA,GACX,WAAWA,SAAO,KAAK;EAE/B;EACA,WAAW,OAAO,SAAS;EAC3B,oBAAmB;EACnB,WAAW,GACP,uBACAI,qBAAY,OACZ,eAAe,UACTF,0BAAO,QACP,gBAAgB,gBAAgBA,0BAAO,YAC7C,SACJ;EApBJ,UAAA;GAsBI,oBAAC,YAAD;IAAwB;IAAY,WAAW;IAC1C,UAAA;GACO,CAAA;GACX,eAAe,UACZ,oBAAC,OAAD;IAAK,WAAWA,0BAAO;IACnB,UAAA,oBAAC,OAAD;KACI,WAAWA,0BAAO;KAClB,OACI,EACI,kCAAkC,OAC9B,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,CAAC,CACnC,EACJ;KAGH,UAAA;IACA,CAAA;GACJ,CAAA,IAEL,oBAAC,OAAD;IAAK,WAAWA,0BAAO;IAAU,UAAA;GAAY,CAAA;GAEjD,oBAAC,kBAAD;IAAkB,WAAW;IAAuB,UAAA;GAA8B,CAAA;GAClF,oBAAC,aAAD;IAAqB;IAAQ,WAAW;GAAgB,CAAA;EAC5C;;AAExB"}
|
|
@@ -5,16 +5,26 @@ var horizontal = "panneau-radio-group-horizontal";
|
|
|
5
5
|
var radio = "panneau-radio-group-radio";
|
|
6
6
|
var circle = "panneau-radio-group-circle";
|
|
7
7
|
var text = "panneau-radio-group-text";
|
|
8
|
+
var optionLabel = "panneau-radio-group-option-label";
|
|
8
9
|
var description = "panneau-radio-group-description";
|
|
10
|
+
var media = "panneau-radio-group-media";
|
|
11
|
+
var grid = "panneau-radio-group-grid";
|
|
12
|
+
var cards = "panneau-radio-group-cards";
|
|
13
|
+
var card = "panneau-radio-group-card";
|
|
9
14
|
var RadioGroup_module_default = {
|
|
10
15
|
options,
|
|
11
16
|
horizontal,
|
|
12
17
|
radio,
|
|
13
18
|
circle,
|
|
14
19
|
text,
|
|
15
|
-
|
|
20
|
+
optionLabel,
|
|
21
|
+
description,
|
|
22
|
+
media,
|
|
23
|
+
grid,
|
|
24
|
+
cards,
|
|
25
|
+
card
|
|
16
26
|
};
|
|
17
27
|
//#endregion
|
|
18
|
-
export { circle, RadioGroup_module_default as default, description, horizontal, options, radio, text };
|
|
28
|
+
export { card, cards, circle, RadioGroup_module_default as default, description, grid, horizontal, media, optionLabel, options, radio, text };
|
|
19
29
|
|
|
20
30
|
//# sourceMappingURL=RadioGroup.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.module.js","names":[],"sources":["../../src/radio-group/RadioGroup.module.css"],"sourcesContent":[".options {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-1);\n}\n\n.horizontal .options {\n flex-flow: row wrap;\n gap: var(--panneau-space-1) var(--panneau-space-4);\n}\n\n.radio {\n display: inline-flex;\n align-items: flex-start;\n gap: var(--panneau-space-2);\n min-height: 1.5rem;\n font-size: var(--panneau-font-size-md);\n color: var(--panneau-color-text);\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n}\n\n.radio[data-disabled] {\n cursor: not-allowed;\n opacity: 0.55;\n}\n\n.radio[data-readonly] {\n cursor: default;\n}\n\n.circle {\n flex: 0 0 auto;\n width: var(--panneau-radio-size, 1.125rem);\n height: var(--panneau-radio-size, 1.125rem);\n margin-top: 0.125rem;\n background-color: var(--panneau-radio-bg, var(--panneau-color-surface));\n border: var(--panneau-border-width) solid\n var(--panneau-radio-border-color, var(--panneau-color-border-control));\n border-radius: var(--panneau-radius-full);\n transition:\n border-color var(--panneau-duration),\n border-width var(--panneau-duration);\n}\n\n.radio[data-hovered] .circle {\n border-color: var(--panneau-color-text-muted);\n}\n\n.radio[data-selected] .circle {\n border-color: var(--panneau-radio-checked-color, var(--panneau-color-accent));\n border-width: var(--panneau-radio-checked-border-width, 0.3125rem);\n}\n\n.radio[data-invalid] .circle {\n border-color: var(--panneau-color-danger);\n}\n\n.radio[data-focus-visible] .circle {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 2px;\n}\n\n.text {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.description {\n font-size: var(--panneau-font-size-sm);\n color: var(--panneau-color-text-muted);\n}\n\n@media (pointer: coarse) {\n .radio {\n min-height: 2.75rem;\n align-items: center;\n }\n\n .circle {\n margin-top: 0;\n }\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"RadioGroup.module.js","names":[],"sources":["../../src/radio-group/RadioGroup.module.css"],"sourcesContent":[".options {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-1);\n}\n\n.horizontal .options {\n flex-flow: row wrap;\n gap: var(--panneau-space-1) var(--panneau-space-4);\n}\n\n.radio {\n display: inline-flex;\n align-items: flex-start;\n gap: var(--panneau-space-2);\n min-height: 1.5rem;\n font-size: var(--panneau-font-size-md);\n color: var(--panneau-color-text);\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n}\n\n.radio[data-disabled] {\n cursor: not-allowed;\n opacity: 0.55;\n}\n\n.radio[data-readonly] {\n cursor: default;\n}\n\n.circle {\n flex: 0 0 auto;\n width: var(--panneau-radio-size, 1.125rem);\n height: var(--panneau-radio-size, 1.125rem);\n margin-top: 0.125rem;\n background-color: var(--panneau-radio-bg, var(--panneau-color-surface));\n border: var(--panneau-border-width) solid\n var(--panneau-radio-border-color, var(--panneau-color-border-control));\n border-radius: var(--panneau-radius-full);\n transition:\n border-color var(--panneau-duration),\n border-width var(--panneau-duration);\n}\n\n.radio[data-hovered] .circle {\n border-color: var(--panneau-color-text-muted);\n}\n\n.radio[data-selected] .circle {\n border-color: var(--panneau-radio-checked-color, var(--panneau-color-accent));\n border-width: var(--panneau-radio-checked-border-width, 0.3125rem);\n}\n\n.radio[data-invalid] .circle {\n border-color: var(--panneau-color-danger);\n}\n\n.radio[data-focus-visible] .circle {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 2px;\n}\n\n.text {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.optionLabel {\n overflow-wrap: anywhere;\n}\n\n.description {\n font-size: var(--panneau-font-size-sm);\n color: var(--panneau-color-text-muted);\n}\n\n/* Leading media of an option, between the radio and the label. */\n.media {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n width: var(--panneau-radio-media-size, 2rem);\n height: var(--panneau-radio-media-size, 2rem);\n overflow: hidden;\n border-radius: var(--panneau-radio-media-radius, var(--panneau-radius-full));\n}\n\n.media > :is(img, svg, video, picture) {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n/*\n * Cards: the options in a grid of --_panneau-radio-group-columns columns, inside a size container\n * of their own, so that they become a single column when the group is narrow, wherever it is.\n */\n\n.grid {\n container-type: inline-size;\n}\n\n.cards .options {\n display: grid;\n grid-template-columns: repeat(var(--_panneau-radio-group-columns, 2), minmax(0, 1fr));\n gap: var(--panneau-radio-card-gap, var(--panneau-space-2));\n}\n\n@container (max-width: 28rem) {\n .cards .options {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n\n.card {\n display: flex;\n align-items: center;\n gap: var(--panneau-space-3);\n padding: var(--panneau-radio-card-padding, var(--panneau-space-3));\n background-color: var(--panneau-radio-card-bg, var(--panneau-color-surface));\n border: var(--panneau-border-width) solid\n var(--panneau-radio-card-border-color, var(--panneau-color-border));\n border-radius: var(--panneau-radio-card-radius, var(--panneau-radius-md));\n transition:\n border-color var(--panneau-duration),\n box-shadow var(--panneau-duration);\n}\n\n.card .circle {\n margin-top: 0;\n}\n\n.card .optionLabel {\n font-weight: var(--panneau-radio-card-label-font-weight, var(--panneau-font-weight-medium));\n}\n\n.card[data-hovered] {\n border-color: var(--panneau-radio-card-border-color-hover, var(--panneau-color-border-control));\n}\n\n/* The selected card: a border of twice the width, drawn inside so that nothing moves. */\n.card[data-selected] {\n border-color: var(--panneau-radio-card-border-color-selected, var(--panneau-color-accent));\n box-shadow: inset 0 0 0 var(--panneau-border-width)\n var(--panneau-radio-card-border-color-selected, var(--panneau-color-accent));\n}\n\n.card[data-invalid] {\n border-color: var(--panneau-color-danger);\n}\n\n/* A card shows the focus ring around itself, instead of around its radio. */\n.card[data-focus-visible] {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 2px;\n}\n\n.card[data-focus-visible] .circle {\n outline: none;\n}\n\n@media (pointer: coarse) {\n .radio {\n min-height: 2.75rem;\n align-items: center;\n }\n\n .circle {\n margin-top: 0;\n }\n}\n"],"mappings":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** Tokens of RadioGroup. */
|
|
2
|
-
export declare const radioTokens: import("..").ComponentTokens<"radio", "panneau-radio-size" | "panneau-radio-bg" | "panneau-radio-border-color" | "panneau-radio-checked-color" | "panneau-radio-checked-border-width">;
|
|
1
|
+
/** Tokens of RadioGroup: its radios, the media of its options, and its cards. */
|
|
2
|
+
export declare const radioTokens: import("..").ComponentTokens<"radio", "panneau-radio-size" | "panneau-radio-bg" | "panneau-radio-border-color" | "panneau-radio-checked-color" | "panneau-radio-media-size" | "panneau-radio-media-radius" | "panneau-radio-checked-border-width" | "panneau-radio-card-gap" | "panneau-radio-card-padding" | "panneau-radio-card-bg" | "panneau-radio-card-border-color" | "panneau-radio-card-border-color-hover" | "panneau-radio-card-border-color-selected" | "panneau-radio-card-radius" | "panneau-radio-card-label-font-weight">;
|
|
3
3
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/radio-group/tokens.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/radio-group/tokens.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,eAAO,MAAM,WAAW,0gBA+BtB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponentTokens } from "../theme/componentTokens.js";
|
|
2
2
|
//#region src/radio-group/tokens.ts
|
|
3
|
-
/** Tokens of RadioGroup. */
|
|
3
|
+
/** Tokens of RadioGroup: its radios, the media of its options, and its cards. */
|
|
4
4
|
var radioTokens = defineComponentTokens("radio", {
|
|
5
5
|
/** Size of the circle. */
|
|
6
6
|
size: "1.125rem",
|
|
@@ -11,7 +11,27 @@ var radioTokens = defineComponentTokens("radio", {
|
|
|
11
11
|
/** Color of a selected circle. */
|
|
12
12
|
"checked-color": "var(--panneau-color-accent)",
|
|
13
13
|
/** Border width of a selected circle, which draws the dot. */
|
|
14
|
-
"checked-border-width": "0.3125rem"
|
|
14
|
+
"checked-border-width": "0.3125rem",
|
|
15
|
+
/** Size of the leading media of an option. */
|
|
16
|
+
"media-size": "2rem",
|
|
17
|
+
/** Corner radius of the leading media of an option: its content is clipped to it. */
|
|
18
|
+
"media-radius": "var(--panneau-radius-full)",
|
|
19
|
+
/** Space between the cards, with `appearance="cards"`. */
|
|
20
|
+
"card-gap": "var(--panneau-space-2)",
|
|
21
|
+
/** Padding of a card. */
|
|
22
|
+
"card-padding": "var(--panneau-space-3)",
|
|
23
|
+
/** Background of a card. */
|
|
24
|
+
"card-bg": "var(--panneau-color-surface)",
|
|
25
|
+
/** Border color of a card. */
|
|
26
|
+
"card-border-color": "var(--panneau-color-border)",
|
|
27
|
+
/** Border color of a hovered card. */
|
|
28
|
+
"card-border-color-hover": "var(--panneau-color-border-control)",
|
|
29
|
+
/** Border color of the selected card, which is twice as wide. */
|
|
30
|
+
"card-border-color-selected": "var(--panneau-color-accent)",
|
|
31
|
+
/** Corner radius of a card. */
|
|
32
|
+
"card-radius": "var(--panneau-radius-md)",
|
|
33
|
+
/** Font weight of the label of a card. */
|
|
34
|
+
"card-label-font-weight": "var(--panneau-font-weight-medium)"
|
|
15
35
|
});
|
|
16
36
|
//#endregion
|
|
17
37
|
export { radioTokens };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/radio-group/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of RadioGroup. */\nexport const radioTokens = defineComponentTokens('radio', {\n /** Size of the circle. */\n size: '1.125rem',\n /** Background of the circle. */\n bg: 'var(--panneau-color-surface)',\n /** Border color of the circle. */\n 'border-color': 'var(--panneau-color-border-control)',\n /** Color of a selected circle. */\n 'checked-color': 'var(--panneau-color-accent)',\n /** Border width of a selected circle, which draws the dot. */\n 'checked-border-width': '0.3125rem',\n});\n"],"mappings":";;;AAGA,IAAa,cAAc,sBAAsB,SAAS;;CAEtD,MAAM;;CAEN,IAAI;;CAEJ,gBAAgB;;CAEhB,iBAAiB;;CAEjB,wBAAwB;
|
|
1
|
+
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/radio-group/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of RadioGroup: its radios, the media of its options, and its cards. */\nexport const radioTokens = defineComponentTokens('radio', {\n /** Size of the circle. */\n size: '1.125rem',\n /** Background of the circle. */\n bg: 'var(--panneau-color-surface)',\n /** Border color of the circle. */\n 'border-color': 'var(--panneau-color-border-control)',\n /** Color of a selected circle. */\n 'checked-color': 'var(--panneau-color-accent)',\n /** Border width of a selected circle, which draws the dot. */\n 'checked-border-width': '0.3125rem',\n /** Size of the leading media of an option. */\n 'media-size': '2rem',\n /** Corner radius of the leading media of an option: its content is clipped to it. */\n 'media-radius': 'var(--panneau-radius-full)',\n /** Space between the cards, with `appearance=\"cards\"`. */\n 'card-gap': 'var(--panneau-space-2)',\n /** Padding of a card. */\n 'card-padding': 'var(--panneau-space-3)',\n /** Background of a card. */\n 'card-bg': 'var(--panneau-color-surface)',\n /** Border color of a card. */\n 'card-border-color': 'var(--panneau-color-border)',\n /** Border color of a hovered card. */\n 'card-border-color-hover': 'var(--panneau-color-border-control)',\n /** Border color of the selected card, which is twice as wide. */\n 'card-border-color-selected': 'var(--panneau-color-accent)',\n /** Corner radius of a card. */\n 'card-radius': 'var(--panneau-radius-md)',\n /** Font weight of the label of a card. */\n 'card-label-font-weight': 'var(--panneau-font-weight-medium)',\n});\n"],"mappings":";;;AAGA,IAAa,cAAc,sBAAsB,SAAS;;CAEtD,MAAM;;CAEN,IAAI;;CAEJ,gBAAgB;;CAEhB,iBAAiB;;CAEjB,wBAAwB;;CAExB,cAAc;;CAEd,gBAAgB;;CAEhB,YAAY;;CAEZ,gBAAgB;;CAEhB,WAAW;;CAEX,qBAAqB;;CAErB,2BAA2B;;CAE3B,8BAA8B;;CAE9B,eAAe;;CAEf,0BAA0B;AAC9B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.panneau-segmented-control-group {
|
|
2
|
+
--segmented-control-height: var(--panneau-control-height);
|
|
3
|
+
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
gap: 2px;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
padding: var(--panneau-segmented-control-padding, 2px);
|
|
8
|
+
background-color: var(--panneau-segmented-control-bg, var(--panneau-color-surface-sunken));
|
|
9
|
+
border: var(--panneau-border-width) solid
|
|
10
|
+
var(--panneau-segmented-control-border-color, var(--panneau-color-border));
|
|
11
|
+
border-radius: var(--panneau-segmented-control-radius, var(--panneau-radius-md));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.panneau-segmented-control-sm {
|
|
15
|
+
--segmented-control-height: var(--panneau-control-height-sm);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.panneau-segmented-control-full-width {
|
|
19
|
+
display: flex;
|
|
20
|
+
width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.panneau-segmented-control-segment {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
flex: 0 1 auto;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
gap: var(--panneau-space-2);
|
|
29
|
+
min-width: 0;
|
|
30
|
+
min-height: calc(
|
|
31
|
+
var(--segmented-control-height) - 2 * var(--panneau-segmented-control-padding, 2px) - 2 *
|
|
32
|
+
var(--panneau-border-width)
|
|
33
|
+
);
|
|
34
|
+
padding: 0 var(--panneau-segmented-control-segment-padding-x, var(--panneau-space-3));
|
|
35
|
+
font: inherit;
|
|
36
|
+
font-size: var(--panneau-font-size-control);
|
|
37
|
+
font-weight: var(
|
|
38
|
+
--panneau-segmented-control-segment-font-weight,
|
|
39
|
+
var(--panneau-font-weight-medium)
|
|
40
|
+
);
|
|
41
|
+
line-height: var(--panneau-line-height-tight);
|
|
42
|
+
color: var(--panneau-segmented-control-segment-color, var(--panneau-color-text-muted));
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
background: transparent;
|
|
46
|
+
border: 0;
|
|
47
|
+
border-radius: calc(
|
|
48
|
+
var(--panneau-segmented-control-radius, var(--panneau-radius-md)) -
|
|
49
|
+
var(--panneau-segmented-control-padding, 2px)
|
|
50
|
+
);
|
|
51
|
+
outline: none;
|
|
52
|
+
transition:
|
|
53
|
+
background-color var(--panneau-duration),
|
|
54
|
+
color var(--panneau-duration);
|
|
55
|
+
-webkit-tap-highlight-color: transparent;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.panneau-segmented-control-full-width .panneau-segmented-control-segment {
|
|
59
|
+
flex: 1 1 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.panneau-segmented-control-segment[data-hovered],
|
|
63
|
+
.panneau-segmented-control-segment[data-selected] {
|
|
64
|
+
color: var(--panneau-segmented-control-segment-color-selected, var(--panneau-color-text));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.panneau-segmented-control-segment[data-selected] {
|
|
68
|
+
background-color: var(
|
|
69
|
+
--panneau-segmented-control-segment-bg-selected,
|
|
70
|
+
var(--panneau-color-surface-raised)
|
|
71
|
+
);
|
|
72
|
+
box-shadow: var(--panneau-segmented-control-segment-shadow-selected, var(--panneau-shadow-sm));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.panneau-segmented-control-segment[data-focus-visible] {
|
|
76
|
+
outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
|
|
77
|
+
outline-offset: 1px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.panneau-segmented-control-segment[data-disabled] {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
opacity: 0.5;
|
|
83
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type IconComponent } from '../icon/Icon';
|
|
3
|
+
/** One choice of a segmented control. */
|
|
4
|
+
export interface SegmentedControlOption {
|
|
5
|
+
value: string;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/** Text for typeahead and assistive technologies, when `label` isn't a string. */
|
|
8
|
+
textValue?: string;
|
|
9
|
+
icon?: IconComponent;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SegmentedControlProps {
|
|
13
|
+
options: readonly SegmentedControlOption[];
|
|
14
|
+
/** The selected option. Controlled with `onChange`. */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** The option selected first, when uncontrolled. Defaults to the first one. */
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
/** Accessible name of the group. Without a visible label, it is required. */
|
|
20
|
+
'aria-label'?: string;
|
|
21
|
+
'aria-labelledby'?: string;
|
|
22
|
+
size?: 'sm' | 'md';
|
|
23
|
+
/** Takes the width of its container, with segments of equal width. */
|
|
24
|
+
fullWidth?: boolean;
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
segmentClassName?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A row of a few choices, one of which is always selected: a view, a mode, a library. For more
|
|
31
|
+
* than four or five choices, or long labels, use a `Select`. It is a radio group for assistive
|
|
32
|
+
* technologies, moved through with the arrow keys.
|
|
33
|
+
*/
|
|
34
|
+
export declare function SegmentedControl({ options, value, defaultValue, onChange, size, fullWidth, isDisabled, className, segmentClassName, ...props }: SegmentedControlProps): import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=SegmentedControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../src/segmented-control/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAIxD,yCAAyC;AACzC,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,IAAW,EACX,SAAiB,EACjB,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,GAAG,KAAK,EACX,EAAE,qBAAqB,+BA6CvB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cx } from "../utils/cx.js";
|
|
2
|
+
import { Icon } from "../icon/Icon.js";
|
|
3
|
+
import SegmentedControl_module_default from "./SegmentedControl.module.js";
|
|
4
|
+
import { ToggleButton, ToggleButtonGroup } from "react-aria-components";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
//#region src/segmented-control/SegmentedControl.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A row of a few choices, one of which is always selected: a view, a mode, a library. For more
|
|
10
|
+
* than four or five choices, or long labels, use a `Select`. It is a radio group for assistive
|
|
11
|
+
* technologies, moved through with the arrow keys.
|
|
12
|
+
*/
|
|
13
|
+
function SegmentedControl({ options, value, defaultValue, onChange, size = "md", fullWidth = false, isDisabled, className, segmentClassName, ...props }) {
|
|
14
|
+
const [uncontrolled, setUncontrolled] = useState(() => defaultValue ?? options.find((option) => option.isDisabled !== true)?.value);
|
|
15
|
+
const selected = value ?? uncontrolled;
|
|
16
|
+
return /* @__PURE__ */ jsx(ToggleButtonGroup, {
|
|
17
|
+
...props,
|
|
18
|
+
selectionMode: "single",
|
|
19
|
+
disallowEmptySelection: true,
|
|
20
|
+
isDisabled,
|
|
21
|
+
selectedKeys: selected !== void 0 ? [selected] : [],
|
|
22
|
+
onSelectionChange: (keys) => {
|
|
23
|
+
const [key] = [...keys];
|
|
24
|
+
if (key === void 0 || String(key) === selected) return;
|
|
25
|
+
setUncontrolled(String(key));
|
|
26
|
+
onChange?.(String(key));
|
|
27
|
+
},
|
|
28
|
+
className: cx("panneau-segmented-control", SegmentedControl_module_default.group, SegmentedControl_module_default[size], fullWidth && SegmentedControl_module_default.fullWidth, className),
|
|
29
|
+
children: options.map((option_0) => /* @__PURE__ */ jsxs(ToggleButton, {
|
|
30
|
+
id: option_0.value,
|
|
31
|
+
isDisabled: option_0.isDisabled,
|
|
32
|
+
...option_0.textValue !== void 0 ? { "aria-label": option_0.textValue } : {},
|
|
33
|
+
className: cx("panneau-segment", SegmentedControl_module_default.segment, segmentClassName),
|
|
34
|
+
children: [option_0.icon !== void 0 ? /* @__PURE__ */ jsx(Icon, {
|
|
35
|
+
icon: option_0.icon,
|
|
36
|
+
size: size === "sm" ? "sm" : "md"
|
|
37
|
+
}) : null, option_0.label]
|
|
38
|
+
}, option_0.value))
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { SegmentedControl };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","names":["option","styles"],"sources":["../../src/segmented-control/SegmentedControl.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { ToggleButton, ToggleButtonGroup } from 'react-aria-components';\n\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { cx } from '../utils/cx';\nimport styles from './SegmentedControl.module.css';\n\n/** One choice of a segmented control. */\nexport interface SegmentedControlOption {\n value: string;\n label: ReactNode;\n /** Text for typeahead and assistive technologies, when `label` isn't a string. */\n textValue?: string;\n icon?: IconComponent;\n isDisabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n options: readonly SegmentedControlOption[];\n /** The selected option. Controlled with `onChange`. */\n value?: string;\n /** The option selected first, when uncontrolled. Defaults to the first one. */\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Accessible name of the group. Without a visible label, it is required. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n size?: 'sm' | 'md';\n /** Takes the width of its container, with segments of equal width. */\n fullWidth?: boolean;\n isDisabled?: boolean;\n className?: string;\n segmentClassName?: string;\n}\n\n/**\n * A row of a few choices, one of which is always selected: a view, a mode, a library. For more\n * than four or five choices, or long labels, use a `Select`. It is a radio group for assistive\n * technologies, moved through with the arrow keys.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onChange,\n size = 'md',\n fullWidth = false,\n isDisabled,\n className,\n segmentClassName,\n ...props\n}: SegmentedControlProps) {\n const [uncontrolled, setUncontrolled] = useState(\n () => defaultValue ?? options.find((option) => option.isDisabled !== true)?.value,\n );\n const selected = value ?? uncontrolled;\n return (\n <ToggleButtonGroup\n {...props}\n selectionMode=\"single\"\n disallowEmptySelection\n isDisabled={isDisabled}\n selectedKeys={selected !== undefined ? [selected] : []}\n onSelectionChange={(keys) => {\n const [key] = [...keys];\n // React Aria reports the selected segment again when it is pressed.\n if (key === undefined || String(key) === selected) {\n return;\n }\n setUncontrolled(String(key));\n onChange?.(String(key));\n }}\n className={cx(\n 'panneau-segmented-control',\n styles.group,\n styles[size],\n fullWidth && styles.fullWidth,\n className,\n )}\n >\n {options.map((option) => (\n <ToggleButton\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n {...(option.textValue !== undefined ? { 'aria-label': option.textValue } : {})}\n className={cx('panneau-segment', styles.segment, segmentClassName)}\n >\n {option.icon !== undefined ? (\n <Icon icon={option.icon} size={size === 'sm' ? 'sm' : 'md'} />\n ) : null}\n {option.label}\n </ToggleButton>\n ))}\n </ToggleButtonGroup>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAwCA,SAAgB,iBAAiB,EAC7B,SACA,OACA,cACA,UACA,OAAO,MACP,YAAY,OACZ,YACA,WACA,kBACA,GAAG,SACmB;CACtB,MAAM,CAAC,cAAc,mBAAmB,eAC9B,gBAAgB,QAAQ,MAAM,WAAW,OAAO,eAAe,IAAI,CAAC,EAAE,KAChF;CACA,MAAM,WAAW,SAAS;CAC1B,OACI,oBAAC,mBAAD;EACI,GAAI;EACJ,eAAc;EACd,wBAAA;EACY;EACZ,cAAc,aAAa,KAAA,IAAY,CAAC,QAAQ,IAAI,CAAA;EACpD,oBAAoB,SAAS;GACzB,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI;GAEtB,IAAI,QAAQ,KAAA,KAAa,OAAO,GAAG,MAAM,UACrC;GAEJ,gBAAgB,OAAO,GAAG,CAAC;GAC3B,WAAW,OAAO,GAAG,CAAC;EAC1B;EACA,WAAW,GACP,6BACAC,gCAAO,OACPA,gCAAO,OACP,aAAaA,gCAAO,WACpB,SACJ;EAEC,UAAA,QAAQ,KAAKD,aACV,qBAAC,cAAD;GAEI,IAAIA,SAAO;GACX,YAAYA,SAAO;GACnB,GAAKA,SAAO,cAAc,KAAA,IAAY,EAAE,cAAcA,SAAO,UAAU,IAAI,CAAC;GAC5E,WAAW,GAAG,mBAAmBC,gCAAO,SAAS,gBAAgB;GALrE,UAAA,CAOKD,SAAO,SAAS,KAAA,IACb,oBAAC,MAAD;IAAM,MAAMA,SAAO;IAAM,MAAM,SAAS,OAAO,OAAO;GAAK,CAAA,IAC3D,MACHA,SAAO,KACE;EAVLA,GAAAA,SAAO,KAUF,CACjB;CACc,CAAA;AAE3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./SegmentedControl.css";
|
|
2
|
+
//#region src/segmented-control/SegmentedControl.module.css
|
|
3
|
+
var group = "panneau-segmented-control-group";
|
|
4
|
+
var sm = "panneau-segmented-control-sm";
|
|
5
|
+
var fullWidth = "panneau-segmented-control-full-width";
|
|
6
|
+
var segment = "panneau-segmented-control-segment";
|
|
7
|
+
var SegmentedControl_module_default = {
|
|
8
|
+
group,
|
|
9
|
+
sm,
|
|
10
|
+
fullWidth,
|
|
11
|
+
segment
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SegmentedControl_module_default as default, fullWidth, group, segment, sm };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=SegmentedControl.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.module.js","names":[],"sources":["../../src/segmented-control/SegmentedControl.module.css"],"sourcesContent":[".group {\n --segmented-control-height: var(--panneau-control-height);\n\n display: inline-flex;\n gap: 2px;\n max-width: 100%;\n padding: var(--panneau-segmented-control-padding, 2px);\n background-color: var(--panneau-segmented-control-bg, var(--panneau-color-surface-sunken));\n border: var(--panneau-border-width) solid\n var(--panneau-segmented-control-border-color, var(--panneau-color-border));\n border-radius: var(--panneau-segmented-control-radius, var(--panneau-radius-md));\n}\n\n.sm {\n --segmented-control-height: var(--panneau-control-height-sm);\n}\n\n.fullWidth {\n display: flex;\n width: 100%;\n}\n\n.segment {\n display: inline-flex;\n flex: 0 1 auto;\n align-items: center;\n justify-content: center;\n gap: var(--panneau-space-2);\n min-width: 0;\n min-height: calc(\n var(--segmented-control-height) - 2 * var(--panneau-segmented-control-padding, 2px) - 2 *\n var(--panneau-border-width)\n );\n padding: 0 var(--panneau-segmented-control-segment-padding-x, var(--panneau-space-3));\n font: inherit;\n font-size: var(--panneau-font-size-control);\n font-weight: var(\n --panneau-segmented-control-segment-font-weight,\n var(--panneau-font-weight-medium)\n );\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-segmented-control-segment-color, var(--panneau-color-text-muted));\n white-space: nowrap;\n cursor: pointer;\n background: transparent;\n border: 0;\n border-radius: calc(\n var(--panneau-segmented-control-radius, var(--panneau-radius-md)) -\n var(--panneau-segmented-control-padding, 2px)\n );\n outline: none;\n transition:\n background-color var(--panneau-duration),\n color var(--panneau-duration);\n -webkit-tap-highlight-color: transparent;\n}\n\n.fullWidth .segment {\n flex: 1 1 0;\n}\n\n.segment[data-hovered],\n.segment[data-selected] {\n color: var(--panneau-segmented-control-segment-color-selected, var(--panneau-color-text));\n}\n\n.segment[data-selected] {\n background-color: var(\n --panneau-segmented-control-segment-bg-selected,\n var(--panneau-color-surface-raised)\n );\n box-shadow: var(--panneau-segmented-control-segment-shadow-selected, var(--panneau-shadow-sm));\n}\n\n.segment[data-focus-visible] {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 1px;\n}\n\n.segment[data-disabled] {\n cursor: not-allowed;\n opacity: 0.5;\n}\n"],"mappings":""}
|