@caseparts-org/caseblocks 0.0.295 → 0.0.296

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.
@@ -0,0 +1 @@
1
+ ._control_v4pp3_1{display:inline-flex;border:1px solid var(--border-border-primary);border-radius:999px;padding:2px}._segments_v4pp3_8{position:relative;display:grid;flex:1 1 auto;min-width:0;grid-template-columns:repeat(var(--segment-count),minmax(0,1fr))}._indicator_v4pp3_16{position:absolute;inset-block:0;inset-inline-start:0;width:calc(100% / var(--segment-count));border-radius:999px;background:var(--surface-surface-primary-btn-focus);transform:translate(calc(var(--selected-index) * 100%));transition:transform .18s ease}._indicator_v4pp3_16:dir(rtl){transform:translate(calc(var(--selected-index) * -100%))}@media (prefers-reduced-motion: reduce){._indicator_v4pp3_16{transition:none}}._option_v4pp3_35{position:relative;border:0;border-radius:999px;background:transparent;color:var(--text-text-primary);padding:var(--spacing-spacing-4xs) var(--spacing-spacing-2xs);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:inherit;font-size:var(--font-size-xs);cursor:pointer;transition:color .18s ease}._option_v4pp3_35[aria-pressed=true]{color:var(--text-text-invert)}@media (forced-colors: active){._option_v4pp3_35[aria-pressed=true]{outline:2px solid Highlight;outline-offset:-2px}}._option_v4pp3_35:focus-visible{outline:2px solid var(--surface-surface-primary-btn);outline-offset:2px;z-index:1}._option_v4pp3_35:disabled{cursor:not-allowed;opacity:.6}@media (prefers-reduced-motion: reduce){._option_v4pp3_35{transition:none}}
@@ -20,6 +20,8 @@ export { Account } from './molecules/Account/Account';
20
20
  export type { AccountProps } from './molecules/Account/Account';
21
21
  export { Chip } from './molecules/Chip/Chip';
22
22
  export type { ChipProps } from './molecules/Chip/Chip';
23
+ export { SegmentedControl } from './molecules/SegmentedControl/SegmentedControl';
24
+ export type { SegmentedControlOption, SegmentedControlProps, } from './molecules/SegmentedControl/SegmentedControl';
23
25
  export { ProgressTracker } from './molecules/ProgressTracker/ProgressTracker';
24
26
  export type { ProgressTrackerProps, Step, } from './molecules/ProgressTracker/ProgressTracker';
25
27
  export { ToggleView } from './molecules/ToggleView/ToggleView';
@@ -6,7 +6,7 @@ import { Head as l } from "./atoms/Root/Head.js";
6
6
  import { Icon as u } from "./atoms/Icon/Icon.js";
7
7
  import { Root as c } from "./atoms/Root/Root.js";
8
8
  import { Separator as C } from "./atoms/Separator/Separator.js";
9
- import { Text as S } from "./atoms/Text/Text.js";
9
+ import { Text as A } from "./atoms/Text/Text.js";
10
10
  import { ToggleSwitch as I } from "./atoms/ToggleSwitch/ToggleSwitch.js";
11
11
  import { Link as B } from "./atoms/Link/Link.js";
12
12
  import { linkClassName as h } from "./atoms/Link/linkClassName.js";
@@ -32,7 +32,7 @@ import { CustomWizardBadge as io } from "./molecules/CustomWizardBadge/CustomWiz
32
32
  import { extractAdmonitions as uo } from "./molecules/Markdown/remarkAdmonition.js";
33
33
  import { NotFound as co } from "./organisms/NotFound/NotFound.js";
34
34
  import { StatusPage as Co } from "./organisms/StatusPage/StatusPage.js";
35
- import { HorizontalScroll as So } from "./atoms/HorizontalScroll/HorizontalScroll.js";
35
+ import { HorizontalScroll as Ao } from "./atoms/HorizontalScroll/HorizontalScroll.js";
36
36
  import { SlideInPanel as Io } from "./atoms/SlideInPanel/SlideInPanel.js";
37
37
  import { DropdownButton as Bo } from "./atoms/DropdownButton/DropdownButton.js";
38
38
  import { Input as ho } from "./atoms/Input/Input.js";
@@ -43,84 +43,86 @@ import { Popover as Mo } from "./atoms/Popover/Popover.js";
43
43
  import { Accordion as bo } from "./molecules/Accordion/Accordion.js";
44
44
  import { Account as Eo } from "./molecules/Account/Account.js";
45
45
  import { Chip as zo } from "./molecules/Chip/Chip.js";
46
- import { ProgressTracker as _o } from "./molecules/ProgressTracker/ProgressTracker.js";
47
- import { ToggleView as Qo } from "./molecules/ToggleView/ToggleView.js";
48
- import { CartPart as Wo } from "./molecules/Cart/CartPart.js";
49
- import { AddToCartPart as jo } from "./molecules/AddToCartPart/AddToCartPart.js";
50
- import { CartSlideInPanel as Jo } from "./molecules/Cart/CartSlideInPanel.js";
51
- import { StatefulButton as Xo } from "./molecules/StatefulButton/StatefulButton.js";
52
- import { AnimatedCheckMark as $o } from "./molecules/StatefulButton/AnimatedCheckmark.js";
53
- import { AddToCart as rr } from "./molecules/AddToCart/AddToCart.js";
54
- import { Modal as er } from "./molecules/Modal/Modal.js";
55
- import { ImageViewer as pr } from "./molecules/ImageViewer/ImageViewer.js";
56
- import { T as xr } from "./Table-_UT9976g.js";
57
- import { Error as nr } from "./molecules/Error/Error.js";
58
- import { MainNav as lr } from "./organisms/MainNav/MainNav.js";
59
- import { ChipSelector as ur } from "./organisms/ChipSelector/ChipSelector.js";
60
- import { SuggestionDropdown as cr } from "./organisms/SuggestionDropdown/SuggestionDropdown.js";
61
- import { Product as Cr } from "./organisms/Product/Product.js";
62
- import { Carousel as Sr } from "./organisms/Carousel/Carousel.js";
63
- import { Footer as Ir } from "./organisms/Footer/Footer.js";
64
- import { default as Br } from "./organisms/SpinZoomViewer/SpinZoomViewer.js";
46
+ import { SegmentedControl as _o } from "./molecules/SegmentedControl/SegmentedControl.js";
47
+ import { ProgressTracker as Qo } from "./molecules/ProgressTracker/ProgressTracker.js";
48
+ import { ToggleView as Wo } from "./molecules/ToggleView/ToggleView.js";
49
+ import { CartPart as jo } from "./molecules/Cart/CartPart.js";
50
+ import { AddToCartPart as Jo } from "./molecules/AddToCartPart/AddToCartPart.js";
51
+ import { CartSlideInPanel as Xo } from "./molecules/Cart/CartSlideInPanel.js";
52
+ import { StatefulButton as $o } from "./molecules/StatefulButton/StatefulButton.js";
53
+ import { AnimatedCheckMark as rr } from "./molecules/StatefulButton/AnimatedCheckmark.js";
54
+ import { AddToCart as er } from "./molecules/AddToCart/AddToCart.js";
55
+ import { Modal as pr } from "./molecules/Modal/Modal.js";
56
+ import { ImageViewer as xr } from "./molecules/ImageViewer/ImageViewer.js";
57
+ import { T as nr } from "./Table-_UT9976g.js";
58
+ import { Error as lr } from "./molecules/Error/Error.js";
59
+ import { MainNav as ur } from "./organisms/MainNav/MainNav.js";
60
+ import { ChipSelector as cr } from "./organisms/ChipSelector/ChipSelector.js";
61
+ import { SuggestionDropdown as Cr } from "./organisms/SuggestionDropdown/SuggestionDropdown.js";
62
+ import { Product as Ar } from "./organisms/Product/Product.js";
63
+ import { Carousel as Ir } from "./organisms/Carousel/Carousel.js";
64
+ import { Footer as Br } from "./organisms/Footer/Footer.js";
65
+ import { default as hr } from "./organisms/SpinZoomViewer/SpinZoomViewer.js";
65
66
  export {
66
67
  fo as ADMONITION_DEFAULT_ICONS,
67
68
  bo as Accordion,
68
69
  Eo as Account,
69
- rr as AddToCart,
70
- jo as AddToCartPart,
70
+ er as AddToCart,
71
+ Jo as AddToCartPart,
71
72
  mo as Admonition,
72
- $o as AnimatedCheckMark,
73
+ rr as AnimatedCheckMark,
73
74
  Z as Availability,
74
75
  q as Avatar,
75
76
  K as BannerCard,
76
77
  oo as Breadcrumbs,
77
78
  t as Button,
78
79
  Y as CardLink,
79
- Sr as Carousel,
80
- Wo as CartPart,
81
- Jo as CartSlideInPanel,
80
+ Ir as Carousel,
81
+ jo as CartPart,
82
+ Xo as CartSlideInPanel,
82
83
  zo as Chip,
83
- ur as ChipSelector,
84
+ cr as ChipSelector,
84
85
  f as Column,
85
86
  io as CustomWizardBadge,
86
87
  to as Disclaimer,
87
88
  Bo as DropdownButton,
88
- nr as Error,
89
+ lr as Error,
89
90
  m as Flex,
90
- Ir as Footer,
91
+ Br as Footer,
91
92
  x as Grid,
92
93
  l as Head,
93
94
  n as HighlightedText,
94
- So as HorizontalScroll,
95
+ Ao as HorizontalScroll,
95
96
  u as Icon,
96
- pr as ImageViewer,
97
+ xr as ImageViewer,
97
98
  ho as Input,
98
99
  Lo as InputEndAdornmentButton,
99
100
  B as Link,
100
101
  D as LinkButton,
101
102
  V as Logo,
102
- lr as MainNav,
103
- er as Modal,
103
+ ur as MainNav,
104
+ pr as Modal,
104
105
  co as NotFound,
105
106
  H as Pill,
106
107
  Mo as Popover,
107
108
  G as Pricing,
108
- Cr as Product,
109
+ Ar as Product,
109
110
  R as ProgressBar,
110
- _o as ProgressTracker,
111
+ Qo as ProgressTracker,
111
112
  U as QuantityInput,
112
113
  c as Root,
114
+ _o as SegmentedControl,
113
115
  vo as Select,
114
116
  C as Separator,
115
117
  Io as SlideInPanel,
116
- Br as SpinZoomViewer,
117
- Xo as StatefulButton,
118
+ hr as SpinZoomViewer,
119
+ $o as StatefulButton,
118
120
  Co as StatusPage,
119
- cr as SuggestionDropdown,
120
- xr as Table,
121
- S as Text,
121
+ Cr as SuggestionDropdown,
122
+ nr as Table,
123
+ A as Text,
122
124
  I as ToggleSwitch,
123
- Qo as ToggleView,
125
+ Wo as ToggleView,
124
126
  Fo as Tooltip,
125
127
  ao as Upsell,
126
128
  O as configureImage,
package/dist/main.d.ts CHANGED
@@ -23,6 +23,8 @@ export { Avatar } from './molecules/Avatar/Avatar';
23
23
  export type { AvatarProps } from './molecules/Avatar/Avatar';
24
24
  export { Chip } from './molecules/Chip/Chip';
25
25
  export type { ChipProps } from './molecules/Chip/Chip';
26
+ export { SegmentedControl } from './molecules/SegmentedControl/SegmentedControl';
27
+ export type { SegmentedControlOption, SegmentedControlProps, } from './molecules/SegmentedControl/SegmentedControl';
26
28
  export { Logo } from './molecules/Logo/Logo';
27
29
  export { Error } from './molecules/Error/Error';
28
30
  export type { ErrorProps, ErrorMessageProps, ErrorDetailsProps, } from './molecules/Error/Error';
package/dist/main.js CHANGED
@@ -2,46 +2,48 @@ import { Button as t } from "./atoms/Button/Button.js";
2
2
  import { Flex as p } from "./atoms/Flex/Flex.js";
3
3
  import { Column as x, Grid as f } from "./atoms/Grid/Grid.js";
4
4
  import { Head as i } from "./atoms/Root/Head.js";
5
- import { Icon as u } from "./atoms/Icon/Icon.js";
6
- import { Root as A } from "./atoms/Root/Root.js";
7
- import { Separator as c } from "./atoms/Separator/Separator.js";
8
- import { Text as l } from "./atoms/Text/Text.js";
5
+ import { Icon as d } from "./atoms/Icon/Icon.js";
6
+ import { Root as g } from "./atoms/Root/Root.js";
7
+ import { Separator as A } from "./atoms/Separator/Separator.js";
8
+ import { Text as S } from "./atoms/Text/Text.js";
9
9
  import { Input as C } from "./atoms/Input/Input.js";
10
10
  import { InputEndAdornmentButton as T } from "./atoms/InputEndAdornmentButton/InputEndAdornmentButton.js";
11
11
  import { Select as E } from "./atoms/Select/Select.js";
12
12
  import { Account as h } from "./molecules/Account/Account.js";
13
13
  import { Avatar as w } from "./molecules/Avatar/Avatar.js";
14
14
  import { Chip as F } from "./molecules/Chip/Chip.js";
15
- import { Logo as M } from "./molecules/Logo/Logo.js";
16
- import { Error as s } from "./molecules/Error/Error.js";
17
- import { Admonition as H } from "./molecules/Admonition/Admonition.js";
18
- import { ADMONITION_DEFAULT_ICONS as U } from "./molecules/Admonition/admonitionTokens.js";
19
- import { ToggleView as b } from "./molecules/ToggleView/ToggleView.js";
20
- import { MainNav as k } from "./organisms/MainNav/MainNav.js";
21
- import { ChipSelector as y } from "./organisms/ChipSelector/ChipSelector.js";
22
- import { SuggestionDropdown as J } from "./organisms/SuggestionDropdown/SuggestionDropdown.js";
15
+ import { SegmentedControl as M } from "./molecules/SegmentedControl/SegmentedControl.js";
16
+ import { Logo as s } from "./molecules/Logo/Logo.js";
17
+ import { Error as H } from "./molecules/Error/Error.js";
18
+ import { Admonition as U } from "./molecules/Admonition/Admonition.js";
19
+ import { ADMONITION_DEFAULT_ICONS as b } from "./molecules/Admonition/admonitionTokens.js";
20
+ import { ToggleView as k } from "./molecules/ToggleView/ToggleView.js";
21
+ import { MainNav as y } from "./organisms/MainNav/MainNav.js";
22
+ import { ChipSelector as J } from "./organisms/ChipSelector/ChipSelector.js";
23
+ import { SuggestionDropdown as P } from "./organisms/SuggestionDropdown/SuggestionDropdown.js";
23
24
  export {
24
- U as ADMONITION_DEFAULT_ICONS,
25
+ b as ADMONITION_DEFAULT_ICONS,
25
26
  h as Account,
26
- H as Admonition,
27
+ U as Admonition,
27
28
  w as Avatar,
28
29
  t as Button,
29
30
  F as Chip,
30
- y as ChipSelector,
31
+ J as ChipSelector,
31
32
  x as Column,
32
- s as Error,
33
+ H as Error,
33
34
  p as Flex,
34
35
  f as Grid,
35
36
  i as Head,
36
- u as Icon,
37
+ d as Icon,
37
38
  C as Input,
38
39
  T as InputEndAdornmentButton,
39
- M as Logo,
40
- k as MainNav,
41
- A as Root,
40
+ s as Logo,
41
+ y as MainNav,
42
+ g as Root,
43
+ M as SegmentedControl,
42
44
  E as Select,
43
- c as Separator,
44
- J as SuggestionDropdown,
45
- l as Text,
46
- b as ToggleView
45
+ A as Separator,
46
+ P as SuggestionDropdown,
47
+ S as Text,
48
+ k as ToggleView
47
49
  };
@@ -0,0 +1,17 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { HideAtProps } from '../../atoms/HideAt';
3
+ export interface SegmentedControlOption {
4
+ value: string;
5
+ label: string;
6
+ disabled?: boolean;
7
+ }
8
+ export interface SegmentedControlProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "children">, HideAtProps {
9
+ /** Accessible name for the group of choices. */
10
+ "aria-label": string;
11
+ /** Options must have unique values. */
12
+ options: readonly SegmentedControlOption[];
13
+ value: string;
14
+ onChange: (_value: string) => void;
15
+ disabled?: boolean;
16
+ }
17
+ export declare function SegmentedControl({ options, value, onChange, disabled, hideAt, className, ...otherProps }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,60 @@
1
+ import { jsx as n, jsxs as m } from "react/jsx-runtime";
2
+ import { c as p } from "../../clsx-OuTLNxxd.js";
3
+ import { getHideAtStyles as _ } from "../../atoms/HideAt.js";
4
+ import '../../assets/SegmentedControl.css';const u = "_control_v4pp3_1", g = "_segments_v4pp3_8", v = "_indicator_v4pp3_16", x = "_option_v4pp3_35", t = {
5
+ control: u,
6
+ segments: g,
7
+ indicator: v,
8
+ option: x
9
+ };
10
+ function y({
11
+ options: s,
12
+ value: o,
13
+ onChange: c,
14
+ disabled: r,
15
+ hideAt: a,
16
+ className: d,
17
+ ...i
18
+ }) {
19
+ const l = s.findIndex((e) => e.value === o);
20
+ return /* @__PURE__ */ n(
21
+ "div",
22
+ {
23
+ ...i,
24
+ role: "group",
25
+ className: p(t.control, _(a), d),
26
+ children: /* @__PURE__ */ m(
27
+ "div",
28
+ {
29
+ className: t.segments,
30
+ style: { "--segment-count": s.length },
31
+ children: [
32
+ l !== -1 && /* @__PURE__ */ n(
33
+ "span",
34
+ {
35
+ "aria-hidden": "true",
36
+ className: t.indicator,
37
+ style: { "--selected-index": l }
38
+ }
39
+ ),
40
+ s.map((e) => /* @__PURE__ */ n(
41
+ "button",
42
+ {
43
+ type: "button",
44
+ className: t.option,
45
+ "aria-pressed": e.value === o,
46
+ disabled: r || e.disabled,
47
+ onClick: () => c(e.value),
48
+ children: e.label
49
+ },
50
+ e.value
51
+ ))
52
+ ]
53
+ }
54
+ )
55
+ }
56
+ );
57
+ }
58
+ export {
59
+ y as SegmentedControl
60
+ };
@@ -0,0 +1,26 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ import { SegmentedControl, SegmentedControlProps } from './SegmentedControl';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof SegmentedControl;
6
+ parameters: {
7
+ layout: string;
8
+ };
9
+ tags: string[];
10
+ render: (args: SegmentedControlProps) => import("react/jsx-runtime").JSX.Element;
11
+ args: {
12
+ "aria-label": string;
13
+ options: {
14
+ value: string;
15
+ label: string;
16
+ }[];
17
+ value: string;
18
+ onChange: () => void;
19
+ };
20
+ };
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+ export declare const Default: Story;
24
+ export declare const MultipleOptions: Story;
25
+ export declare const DisabledOption: Story;
26
+ export declare const Disabled: Story;
@@ -0,0 +1,54 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useState as n } from "react";
3
+ import { SegmentedControl as t } from "./SegmentedControl.js";
4
+ function r(e) {
5
+ const [l, o] = n(e.value);
6
+ return /* @__PURE__ */ a(t, { ...e, value: l, onChange: o });
7
+ }
8
+ const m = {
9
+ title: "Case Parts/Molecules/SegmentedControl",
10
+ component: t,
11
+ parameters: {
12
+ layout: "centered"
13
+ },
14
+ tags: ["autodocs"],
15
+ render: (e) => /* @__PURE__ */ a(r, { ...e }),
16
+ args: {
17
+ "aria-label": "Request mode",
18
+ options: [
19
+ { value: "chat", label: "Chat" },
20
+ { value: "form", label: "Form" }
21
+ ],
22
+ value: "chat",
23
+ onChange: () => {
24
+ }
25
+ }
26
+ }, d = {}, c = {
27
+ args: {
28
+ "aria-label": "Display period",
29
+ options: [
30
+ { value: "day", label: "Day" },
31
+ { value: "week", label: "This week" },
32
+ { value: "month", label: "Month" }
33
+ ],
34
+ value: "week"
35
+ }
36
+ }, p = {
37
+ args: {
38
+ options: [
39
+ { value: "chat", label: "Chat" },
40
+ { value: "form", label: "Form", disabled: !0 }
41
+ ]
42
+ }
43
+ }, b = {
44
+ args: {
45
+ disabled: !0
46
+ }
47
+ };
48
+ export {
49
+ d as Default,
50
+ b as Disabled,
51
+ p as DisabledOption,
52
+ c as MultipleOptions,
53
+ m as default
54
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.295",
4
+ "version": "0.0.296",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",