@scattered-light/loomiere-mojave 0.5.3 → 0.7.0
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/exports/AGENTS.md +24 -8
- package/dist/exports/catalog.json +21 -0
- package/dist/exports/chakra.js +333 -0
- package/dist/exports/design-system/README.md +23 -7
- package/dist/exports/design-system/components/Accordion/README.md +20 -20
- package/dist/exports/design-system/components/Accordion/preview.html +1 -1
- package/dist/exports/design-system/components/AlertDialog/README.md +8 -8
- package/dist/exports/design-system/components/AlertDialog/preview.html +1 -1
- package/dist/exports/design-system/components/Autocomplete/README.md +9 -9
- package/dist/exports/design-system/components/Autocomplete/preview.html +1 -1
- package/dist/exports/design-system/components/Avatar/README.md +3 -4
- package/dist/exports/design-system/components/Avatar/preview.html +1 -1
- package/dist/exports/design-system/components/Badge/README.md +35 -0
- package/dist/exports/design-system/components/Badge/preview.html +19 -0
- package/dist/exports/design-system/components/Checkbox/README.md +5 -5
- package/dist/exports/design-system/components/Checkbox/preview.html +1 -1
- package/dist/exports/design-system/components/CheckboxGroup/README.md +14 -14
- package/dist/exports/design-system/components/CheckboxGroup/preview.html +1 -1
- package/dist/exports/design-system/components/Collapsible/README.md +6 -6
- package/dist/exports/design-system/components/Collapsible/preview.html +1 -1
- package/dist/exports/design-system/components/Collection/README.md +14 -0
- package/dist/exports/design-system/components/CollectionPagination/README.md +15 -0
- package/dist/exports/design-system/components/CollectionToolbar/README.md +24 -0
- package/dist/exports/design-system/components/Combobox/README.md +11 -11
- package/dist/exports/design-system/components/Combobox/preview.html +1 -1
- package/dist/exports/design-system/components/ContextMenu/README.md +9 -9
- package/dist/exports/design-system/components/ContextMenu/preview.html +1 -1
- package/dist/exports/design-system/components/DataList/README.md +39 -0
- package/dist/exports/design-system/components/DataList/preview.html +475 -0
- package/dist/exports/design-system/components/DataTable/README.md +41 -0
- package/dist/exports/design-system/components/DataTable/preview.html +475 -0
- package/dist/exports/design-system/components/DatePicker/README.md +55 -0
- package/dist/exports/design-system/components/DatePicker/preview.html +475 -0
- package/dist/exports/design-system/components/Dialog/README.md +6 -6
- package/dist/exports/design-system/components/Dialog/preview.html +1 -1
- package/dist/exports/design-system/components/Drawer/README.md +1 -1
- package/dist/exports/design-system/components/Drawer/preview.html +1 -1
- package/dist/exports/design-system/components/EditableList/README.md +33 -0
- package/dist/exports/design-system/components/EditableList/preview.html +475 -0
- package/dist/exports/design-system/components/EmptyState/README.md +60 -0
- package/dist/exports/design-system/components/EmptyState/preview.html +475 -0
- package/dist/exports/design-system/components/ListDetail/README.md +43 -0
- package/dist/exports/design-system/components/ListDetail/preview.html +475 -0
- package/dist/exports/design-system/components/Menu/README.md +11 -11
- package/dist/exports/design-system/components/Menu/preview.html +1 -1
- package/dist/exports/design-system/components/Menubar/README.md +32 -32
- package/dist/exports/design-system/components/Menubar/preview.html +1 -1
- package/dist/exports/design-system/components/Meter/README.md +9 -8
- package/dist/exports/design-system/components/Meter/preview.html +1 -1
- package/dist/exports/design-system/components/MoneyField/README.md +52 -0
- package/dist/exports/design-system/components/MoneyField/preview.html +475 -0
- package/dist/exports/design-system/components/NumberField/README.md +10 -10
- package/dist/exports/design-system/components/NumberField/preview.html +1 -1
- package/dist/exports/design-system/components/OTPField/README.md +5 -5
- package/dist/exports/design-system/components/OTPField/preview.html +1 -1
- package/dist/exports/design-system/components/Popover/README.md +7 -7
- package/dist/exports/design-system/components/Popover/preview.html +1 -1
- package/dist/exports/design-system/components/PreviewCard/README.md +9 -11
- package/dist/exports/design-system/components/PreviewCard/preview.html +1 -1
- package/dist/exports/design-system/components/Progress/README.md +8 -8
- package/dist/exports/design-system/components/Progress/preview.html +1 -1
- package/dist/exports/design-system/components/Radio/README.md +16 -23
- package/dist/exports/design-system/components/Radio/preview.html +1 -1
- package/dist/exports/design-system/components/ScrollArea/README.md +6 -6
- package/dist/exports/design-system/components/ScrollArea/preview.html +2 -2
- package/dist/exports/design-system/components/Select/README.md +13 -12
- package/dist/exports/design-system/components/Select/preview.html +1 -1
- package/dist/exports/design-system/components/Separator/README.md +2 -2
- package/dist/exports/design-system/components/Separator/preview.html +1 -1
- package/dist/exports/design-system/components/Slider/README.md +6 -6
- package/dist/exports/design-system/components/Slider/preview.html +1 -1
- package/dist/exports/design-system/components/Splitter/README.md +42 -0
- package/dist/exports/design-system/components/Splitter/preview.html +475 -0
- package/dist/exports/design-system/components/Switch/README.md +3 -3
- package/dist/exports/design-system/components/Switch/preview.html +1 -1
- package/dist/exports/design-system/components/Table/README.md +2 -1
- package/dist/exports/design-system/components/Table/preview.html +1 -1
- package/dist/exports/design-system/components/Tabs/README.md +9 -9
- package/dist/exports/design-system/components/Tabs/preview.html +1 -1
- package/dist/exports/design-system/components/Toast/README.md +7 -7
- package/dist/exports/design-system/components/Toast/preview.html +1 -1
- package/dist/exports/design-system/components/Toggle/README.md +2 -2
- package/dist/exports/design-system/components/Toggle/preview.html +1 -1
- package/dist/exports/design-system/components/ToggleGroup/README.md +5 -5
- package/dist/exports/design-system/components/ToggleGroup/preview.html +1 -1
- package/dist/exports/design-system/components/Toolbar/README.md +11 -11
- package/dist/exports/design-system/components/Toolbar/preview.html +1 -1
- package/dist/exports/design-system/components/Tooltip/README.md +4 -4
- package/dist/exports/design-system/components/Tooltip/preview.html +1 -1
- package/dist/exports/design-system/components/bundle.css +2394 -193
- package/dist/exports/design-system/components/bundle.js +7 -5
- package/dist/exports/design-system/components/index.d.ts +627 -29
- package/dist/exports/design-system/tokens.json +15 -0
- package/dist/exports/figma.json +1 -1
- package/dist/exports/mui.js +727 -0
- package/dist/exports/tailwind.css +36 -0
- package/dist/exports/tokens.dtcg.json +316 -2
- package/dist/tokens.css +111 -4
- package/dist/tokens.d.ts +93 -0
- package/dist/tokens.js +94 -1
- package/dist/tokens.json +572 -2
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Base UI NumberField styled by the theme. No component tokens. The input is Input (Input.css) and the label, description and error are Field's parts (Field.css). Only the stepper buttons are drawn here: two stacked halves of the field's height, as wide as the smallest control.
|
|
4
4
|
|
|
5
|
-
Use `Loomiere.NumberField
|
|
5
|
+
Use `Loomiere.NumberField`, this package's wrapper: it puts the class names on for you (`import { NumberField } from '@scattered-light/loomiere-base-ui'` in an app). The bare Base UI part is `Loomiere.Base.NumberField`.
|
|
6
6
|
|
|
7
7
|
Base UI docs: https://base-ui.com/react/components/number-field
|
|
8
8
|
|
|
@@ -29,22 +29,22 @@ export const Default: Story = {
|
|
|
29
29
|
const id = React.useId();
|
|
30
30
|
return (
|
|
31
31
|
<div style={{ width: '200px' }}>
|
|
32
|
-
<NumberField.Root id={id} defaultValue={100}
|
|
33
|
-
<NumberField.ScrubArea
|
|
34
|
-
<
|
|
32
|
+
<NumberField.Root id={id} defaultValue={100}>
|
|
33
|
+
<NumberField.ScrubArea>
|
|
34
|
+
<NumberField.Label htmlFor={id}>
|
|
35
35
|
Amount
|
|
36
|
-
</
|
|
37
|
-
<NumberField.ScrubAreaCursor
|
|
36
|
+
</NumberField.Label>
|
|
37
|
+
<NumberField.ScrubAreaCursor>
|
|
38
38
|
<CursorGrowIcon />
|
|
39
39
|
</NumberField.ScrubAreaCursor>
|
|
40
40
|
</NumberField.ScrubArea>
|
|
41
41
|
|
|
42
|
-
<NumberField.Group
|
|
43
|
-
<NumberField.Decrement
|
|
42
|
+
<NumberField.Group>
|
|
43
|
+
<NumberField.Decrement>
|
|
44
44
|
<MinusIcon />
|
|
45
45
|
</NumberField.Decrement>
|
|
46
|
-
<NumberField.Input
|
|
47
|
-
<NumberField.Increment
|
|
46
|
+
<NumberField.Input />
|
|
47
|
+
<NumberField.Increment>
|
|
48
48
|
<PlusIcon />
|
|
49
49
|
</NumberField.Increment>
|
|
50
50
|
</NumberField.Group>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
14
14
|
<script>
|
|
15
|
-
(()=>{var
|
|
15
|
+
(()=>{var A=Object.create;var b=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var N=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports),L=(t,o)=>{for(var u in o)b(t,u,{get:o[u],enumerable:!0})},D=(t,o,u,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of x(o))!g.call(t,n)&&n!==u&&b(t,n,{get:()=>o[n],enumerable:!(i=v(o,n))||i.enumerable});return t};var S=(t,o,u)=>(u=t!=null?A(f(t)):{},D(o||!t||!t.__esModule?b(u,"default",{value:t,enumerable:!0}):u,t));var R=N(($,h)=>{h.exports=window.React});var y=N((z,w)=>{w.exports=window.Loomiere});var F={};L(F,{Default:()=>G,Disabled:()=>W,LargeStep:()=>O,ReadOnly:()=>B,WithDecimals:()=>E,WithMinMax:()=>V,WithStep:()=>M,WithoutScrubArea:()=>k,default:()=>p});var d=S(R(),1),r=S(y(),1);var s=window.React;function e(t,o,u){let{children:i,...n}=o||{};return u!==void 0&&(n.key=u),i===void 0?s.createElement(t,n):Array.isArray(i)?s.createElement(t,n,...i):s.createElement(t,n,i)}var q=s.Fragment;var C={title:"Components/Lib/NumberField",component:r.NumberField.Root,parameters:{layout:"centered"},tags:["autodocs","ds:lib"]},p=C;function a(t){return e("svg",{width:"26",height:"14",viewBox:"0 0 24 14",fill:"black",stroke:"white",xmlns:"http://www.w3.org/2000/svg",...t,children:e("path",{d:"M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z"})})}function l(t){return e("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentcolor",strokeWidth:"1.6",xmlns:"http://www.w3.org/2000/svg",...t,children:e("path",{d:"M0 5H5M10 5H5M5 5V0M5 5V10"})})}function m(t){return e("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentcolor",strokeWidth:"1.6",xmlns:"http://www.w3.org/2000/svg",...t,children:e("path",{d:"M0 5H10"})})}var G={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:100,children:[e(r.NumberField.ScrubArea,{children:[e(r.NumberField.Label,{htmlFor:t,children:"Amount"}),e(r.NumberField.ScrubAreaCursor,{children:e(a,{})})]}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}},V={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:5,min:0,max:10,children:[e(r.NumberField.ScrubArea,{children:[e(r.NumberField.Label,{htmlFor:t,children:"Rating (0-10)"}),e(r.NumberField.ScrubAreaCursor,{children:e(a,{})})]}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}},M={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:0,step:5,children:[e(r.NumberField.ScrubArea,{children:[e(r.NumberField.Label,{htmlFor:t,children:"Amount (increments of 5)"}),e(r.NumberField.ScrubAreaCursor,{children:e(a,{})})]}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}},E={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:0,step:.1,children:[e(r.NumberField.ScrubArea,{children:[e(r.NumberField.Label,{htmlFor:t,children:"Price"}),e(r.NumberField.ScrubAreaCursor,{children:e(a,{})})]}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}},W={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:5,disabled:!0,children:[e(r.NumberField.ScrubArea,{children:[e(r.NumberField.Label,{htmlFor:t,children:"Disabled field"}),e(r.NumberField.ScrubAreaCursor,{children:e(a,{})})]}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}},k={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:50,children:[e(r.NumberField.Label,{htmlFor:t,children:"Volume"}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}},B={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:100,readOnly:!0,children:[e(r.NumberField.ScrubArea,{children:[e(r.NumberField.Label,{htmlFor:t,children:"Read-only value"}),e(r.NumberField.ScrubAreaCursor,{children:e(a,{})})]}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}},O={render:()=>{let t=d.useId();return e("div",{style:{width:"200px"},children:e(r.NumberField.Root,{id:t,defaultValue:0,step:100,children:[e(r.NumberField.ScrubArea,{children:[e(r.NumberField.Label,{htmlFor:t,children:"Budget (hundreds)"}),e(r.NumberField.ScrubAreaCursor,{children:e(a,{})})]}),e(r.NumberField.Group,{children:[e(r.NumberField.Decrement,{children:e(m,{})}),e(r.NumberField.Input,{}),e(r.NumberField.Increment,{children:e(l,{})})]})]})})}};var c=window.React,I=p||{},P=["Default","WithMinMax","WithStep","WithDecimals"];function j({id:t}){let o=F[t],u={...I.args||{},...o.args||{}};return(o.render||(n=>c.createElement(I.component,n)))(u,{args:u,id:t,name:t})}var H=P.map(t=>c.createElement("section",{key:t,className:"ds-story"},c.createElement("p",{className:"ds-story-name"},t.replace(/([a-z])([A-Z])/g,"$1 $2")),c.createElement("div",{className:"ds-story-body"},c.createElement(j,{id:t}))));window.ReactDOM.createRoot(document.getElementById("root")).render(c.createElement(c.Fragment,null,H));})();
|
|
16
16
|
|
|
17
17
|
</script>
|
|
18
18
|
</body>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Base UI OTPField styled by the theme. One-time code entry: a row of single-character inputs. Each slot is the same control as Input (Input.css styles .OTPFieldInput with the field pattern, hover, focus, disabled and error), cut into a square as tall as a control of the same size. data-size on the root picks the control size and the text tier of the same name, as on Input. No component tokens.
|
|
4
4
|
|
|
5
|
-
Use `Loomiere.OTPField
|
|
5
|
+
Use `Loomiere.OTPField`, this package's wrapper: it puts the class names on for you (`import { OTPField } from '@scattered-light/loomiere-base-ui'` in an app). The bare Base UI part is `Loomiere.Base.OTPField`.
|
|
6
6
|
|
|
7
7
|
Base UI docs: https://base-ui.com/react/components/otpfield
|
|
8
8
|
|
|
@@ -23,12 +23,12 @@ From the OTPField stories (`Default`):
|
|
|
23
23
|
```tsx
|
|
24
24
|
export const Default: Story = {
|
|
25
25
|
render: () => (
|
|
26
|
-
<Field.Root
|
|
27
|
-
<Field.Label
|
|
28
|
-
<OTPField.Root length={6}
|
|
26
|
+
<Field.Root>
|
|
27
|
+
<Field.Label>Verification code</Field.Label>
|
|
28
|
+
<OTPField.Root length={6}>
|
|
29
29
|
<Slots length={6} />
|
|
30
30
|
</OTPField.Root>
|
|
31
|
-
<Field.Description
|
|
31
|
+
<Field.Description>
|
|
32
32
|
Enter the 6-digit code we sent to your phone.
|
|
33
33
|
</Field.Description>
|
|
34
34
|
</Field.Root>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
14
14
|
<script>
|
|
15
|
-
(()=>{var
|
|
15
|
+
(()=>{var S=Object.create;var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var R=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports),w=(t,o)=>{for(var n in o)s(t,n,{get:o[n],enumerable:!0})},P=(t,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of L(o))!O.call(t,l)&&l!==n&&s(t,l,{get:()=>o[l],enumerable:!(a=x(o,l))||a.enumerable});return t};var u=(t,o,n)=>(n=t!=null?S(E(t)):{},P(o||!t||!t.__esModule?s(n,"default",{value:t,enumerable:!0}):n,t));var h=R((N,g)=>{g.exports=window.React});var f=R((B,y)=>{y.exports=window.Loomiere});var p={};w(p,{Controlled:()=>$,Default:()=>D,Disabled:()=>A,Grouped:()=>V,Invalid:()=>k,PlaceholderHints:()=>v,Sizes:()=>C,default:()=>m});var F=u(h(),1),r=u(f(),1);var c=window.React;function e(t,o,n){let{children:a,...l}=o||{};return n!==void 0&&(l.key=n),a===void 0?c.createElement(t,l):Array.isArray(a)?c.createElement(t,l,...a):c.createElement(t,l,a)}var G=c.Fragment;var T={title:"Components/Lib/OTPField",component:r.OTPField.Root,args:{length:6},parameters:{layout:"centered"},tags:["autodocs","ds:lib"]},m=T;function d({length:t,from:o=0}){return Array.from({length:t},(n,a)=>e(r.OTPField.Input,{"aria-label":o+a===0?void 0:`Character ${o+a+1}`},o+a))}var D={render:()=>e(r.Field.Root,{children:[e(r.Field.Label,{children:"Verification code"}),e(r.OTPField.Root,{length:6,children:e(d,{length:6})}),e(r.Field.Description,{children:"Enter the 6-digit code we sent to your phone."})]})},V={render:()=>e(r.Field.Root,{children:[e(r.Field.Label,{children:"Backup code"}),e(r.OTPField.Root,{length:6,children:[e(d,{length:3}),e(r.OTPField.Separator,{}),e(d,{length:3,from:3})]})]})},v={render:()=>e(r.Field.Root,{children:[e(r.Field.Label,{children:"Verification code"}),e(r.OTPField.Root,{length:4,children:Array.from({length:4},(t,o)=>e(r.OTPField.Input,{placeholder:"\u2022","aria-label":o===0?void 0:`Character ${o+1}`},o))})]})},C={render:()=>e("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sl-space-6)"},children:["sm","md","lg"].map(t=>e(r.Field.Root,{children:[e(r.Field.Label,{children:["Size ",t]}),e(r.OTPField.Root,{length:4,"data-size":t,children:e(d,{length:4})})]},t))})},k={render:()=>e(r.Field.Root,{invalid:!0,children:[e(r.Field.Label,{children:"Verification code"}),e(r.OTPField.Root,{length:6,defaultValue:"482",children:e(d,{length:6})}),e(r.Field.Error,{match:!0,children:"That code didn't match. Check the message and try again."})]})},A={render:()=>e(r.Field.Root,{disabled:!0,children:[e(r.Field.Label,{children:"Verification code"}),e(r.OTPField.Root,{length:6,defaultValue:"4821",children:e(d,{length:6})})]})},$={render:function(){let[o,n]=F.useState("");return e(r.Field.Root,{children:[e(r.Field.Label,{children:"Verification code"}),e(r.OTPField.Root,{length:6,value:o,onValueChange:n,children:e(d,{length:6})}),e(r.Field.Description,{children:o.length===6?"Code complete.":`${6-o.length} characters left.`})]})}};var i=window.React,b=m||{},j=["Default","Grouped","PlaceholderHints","Sizes"];function I({id:t}){let o=p[t],n={...b.args||{},...o.args||{}};return(o.render||(l=>i.createElement(b.component,l)))(n,{args:n,id:t,name:t})}var z=j.map(t=>i.createElement("section",{key:t,className:"ds-story"},i.createElement("p",{className:"ds-story-name"},t.replace(/([a-z])([A-Z])/g,"$1 $2")),i.createElement("div",{className:"ds-story-body"},i.createElement(I,{id:t}))));window.ReactDOM.createRoot(document.getElementById("root")).render(i.createElement(i.Fragment,null,z));})();
|
|
16
16
|
|
|
17
17
|
</script>
|
|
18
18
|
</body>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Base UI Popover styled by the theme.
|
|
4
4
|
|
|
5
|
-
Use `Loomiere.Popover
|
|
5
|
+
Use `Loomiere.Popover`, this package's wrapper: it puts the class names on for you (`import { Popover } from '@scattered-light/loomiere-base-ui'` in an app). The bare Base UI part is `Loomiere.Base.Popover`.
|
|
6
6
|
|
|
7
7
|
Base UI docs: https://base-ui.com/react/components/popover
|
|
8
8
|
|
|
@@ -32,17 +32,17 @@ From the Popover stories (`Default`):
|
|
|
32
32
|
export const Default: Story = {
|
|
33
33
|
render: () => (
|
|
34
34
|
<Popover.Root>
|
|
35
|
-
<Popover.Trigger className="
|
|
35
|
+
<Popover.Trigger className="Button" aria-label="Notifications">
|
|
36
36
|
<BellIcon aria-hidden="true" />
|
|
37
37
|
</Popover.Trigger>
|
|
38
38
|
<Popover.Portal>
|
|
39
|
-
<Popover.Positioner
|
|
40
|
-
<Popover.Popup
|
|
41
|
-
<Popover.Arrow
|
|
39
|
+
<Popover.Positioner sideOffset={8}>
|
|
40
|
+
<Popover.Popup>
|
|
41
|
+
<Popover.Arrow>
|
|
42
42
|
<ArrowSvg />
|
|
43
43
|
</Popover.Arrow>
|
|
44
|
-
<Popover.Title
|
|
45
|
-
<Popover.Description
|
|
44
|
+
<Popover.Title>Notifications</Popover.Title>
|
|
45
|
+
<Popover.Description>
|
|
46
46
|
You are all caught up. Good job!
|
|
47
47
|
</Popover.Description>
|
|
48
48
|
</Popover.Popup>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
14
14
|
<script>
|
|
15
|
-
(()=>{var
|
|
15
|
+
(()=>{var h=Object.create;var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var v=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),T=(t,r)=>{for(var n in r)c(t,n,{get:r[n],enumerable:!0})},k=(t,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of L(r))!R.call(t,s)&&s!==n&&c(t,s,{get:()=>r[s],enumerable:!(i=x(r,s))||i.enumerable});return t};var u=(t,r,n)=>(n=t!=null?h(b(t)):{},k(r||!t||!t.__esModule?c(n,"default",{value:t,enumerable:!0}):n,t));var f=v((W,g)=>{g.exports=window.React});var w=v((Z,C)=>{C.exports=window.Loomiere});var d={};T(d,{Default:()=>N,Placement:()=>M,WithBackdrop:()=>O,WithCloseButton:()=>D,WithForm:()=>E,default:()=>m});var P=u(f(),1),e=u(w(),1);var l=window.React;function o(t,r,n){let{children:i,...s}=r||{};return n!==void 0&&(s.key=n),i===void 0?l.createElement(t,s):Array.isArray(i)?l.createElement(t,s,...i):l.createElement(t,s,i)}var V=l.Fragment;var A={title:"Components/Lib/Popover",component:e.Popover.Root,parameters:{layout:"centered"},tags:["autodocs","ds:lib"]},m=A;function a(t){return o("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...t,children:[o("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"PopoverArrowFill"}),o("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"PopoverArrowOuterStroke"}),o("path",{d:"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z",className:"PopoverArrowInnerStroke"})]})}function S(t){return o("svg",{fill:"currentcolor",width:"20",height:"20",viewBox:"0 0 16 16",...t,children:o("path",{d:"M 8 1 C 7.453125 1 7 1.453125 7 2 L 7 3.140625 C 5.28125 3.589844 4 5.144531 4 7 L 4 10.984375 C 4 10.984375 3.984375 11.261719 3.851563 11.519531 C 3.71875 11.78125 3.558594 12 3 12 L 3 13 L 13 13 L 13 12 C 12.40625 12 12.253906 11.78125 12.128906 11.53125 C 12.003906 11.277344 12 11.003906 12 11.003906 L 12 7 C 12 5.144531 10.71875 3.589844 9 3.140625 L 9 2 C 9 1.453125 8.546875 1 8 1 Z M 8 13 C 7.449219 13 7 13.449219 7 14 C 7 14.550781 7.449219 15 8 15 C 8.550781 15 9 14.550781 9 14 C 9 13.449219 8.550781 13 8 13 Z M 8 4 C 9.664063 4 11 5.335938 11 7 L 11 10.996094 C 11 10.996094 10.988281 11.472656 11.234375 11.96875 C 11.238281 11.980469 11.246094 11.988281 11.25 12 L 4.726563 12 C 4.730469 11.992188 4.738281 11.984375 4.742188 11.980469 C 4.992188 11.488281 5 11.015625 5 11.015625 L 5 7 C 5 5.335938 6.335938 4 8 4 Z"})})}function B(t){return o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16",...t,children:o("path",{d:"M18 6L6 18M6 6l12 12"})})}var N={render:()=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"Button","aria-label":"Notifications",children:o(S,{"aria-hidden":"true"})}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{sideOffset:8,children:o(e.Popover.Popup,{children:[o(e.Popover.Arrow,{children:o(a,{})}),o(e.Popover.Title,{children:"Notifications"}),o(e.Popover.Description,{children:"You are all caught up. Good job!"})]})})})]})},D={render:()=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"Button",children:"Open settings"}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{sideOffset:8,children:o(e.Popover.Popup,{children:[o(e.Popover.Close,{"aria-label":"Close",children:o(B,{})}),o(e.Popover.Arrow,{children:o(a,{})}),o(e.Popover.Title,{children:"Settings"}),o(e.Popover.Description,{children:"Adjust your preferences and account settings here."})]})})})]})},E={render:()=>{let t=P.useId(),r=P.useId();return o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"Button",children:"Contact form"}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{sideOffset:8,children:o(e.Popover.Popup,{children:[o(e.Popover.Arrow,{children:o(a,{})}),o(e.Popover.Title,{children:"Get in touch"}),o(e.Popover.Description,{children:"Fill out the form below and we'll get back to you."}),o("div",{style:{marginTop:"16px",display:"flex",flexDirection:"column",gap:"12px"},children:[o("div",{children:[o("label",{htmlFor:t,style:{display:"block",fontSize:"14px",marginBottom:"4px"},children:"Name"}),o("input",{id:t,type:"text",className:"Input",placeholder:"Your name",style:{width:"100%"}})]}),o("div",{children:[o("label",{htmlFor:r,style:{display:"block",fontSize:"14px",marginBottom:"4px"},children:"Email"}),o("input",{id:r,type:"email",className:"Input",placeholder:"you@example.com",style:{width:"100%"}})]}),o("button",{className:"Button",style:{marginTop:"8px"},children:"Submit"})]})]})})})]})}},M={render:()=>o("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:["top","right","bottom","left"].map(t=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"Button",children:t}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{side:t,sideOffset:8,children:o(e.Popover.Popup,{children:[o(e.Popover.Arrow,{children:o(a,{})}),o(e.Popover.Description,{children:["Popover on the ",t]})]})})})]},t))})},O={render:()=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"Button",children:"Open with backdrop"}),o(e.Popover.Portal,{children:[o(e.Popover.Backdrop,{style:{background:"rgba(0, 0, 0, 0.3)"}}),o(e.Popover.Positioner,{sideOffset:8,children:o(e.Popover.Popup,{children:[o(e.Popover.Arrow,{children:o(a,{})}),o(e.Popover.Title,{children:"Modal-like popover"}),o(e.Popover.Description,{children:"This popover has a backdrop to focus attention."})]})})]})]})};var p=window.React,y=m||{},I=["Default","WithCloseButton","WithForm","Placement"];function F({id:t}){let r=d[t],n={...y.args||{},...r.args||{}};return(r.render||(s=>p.createElement(y.component,s)))(n,{args:n,id:t,name:t})}var j=I.map(t=>p.createElement("section",{key:t,className:"ds-story"},p.createElement("p",{className:"ds-story-name"},t.replace(/([a-z])([A-Z])/g,"$1 $2")),p.createElement("div",{className:"ds-story-body"},p.createElement(F,{id:t}))));window.ReactDOM.createRoot(document.getElementById("root")).render(p.createElement(p.Fragment,null,j));})();
|
|
16
16
|
|
|
17
17
|
</script>
|
|
18
18
|
</body>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Base UI PreviewCard styled by the theme. The popup concept (surface, arrow, motion) with a title-magnify title and condense description. Only its min and max width are its own (tokens/component/preview-card.json).
|
|
4
4
|
|
|
5
|
-
Use `Loomiere.PreviewCard
|
|
5
|
+
Use `Loomiere.PreviewCard`, this package's wrapper: it puts the class names on for you (`import { PreviewCard } from '@scattered-light/loomiere-base-ui'` in an app). The bare Base UI part is `Loomiere.Base.PreviewCard`.
|
|
6
6
|
|
|
7
7
|
Base UI docs: https://base-ui.com/react/components/preview-card
|
|
8
8
|
|
|
@@ -36,30 +36,28 @@ export const Default: Story = {
|
|
|
36
36
|
The principles of good{' '}
|
|
37
37
|
<PreviewCard.Root>
|
|
38
38
|
<PreviewCard.Trigger
|
|
39
|
-
className="PreviewCardTrigger"
|
|
40
39
|
href="https://en.wikipedia.org/wiki/Typography"
|
|
41
40
|
>
|
|
42
41
|
typography
|
|
43
42
|
</PreviewCard.Trigger>
|
|
44
43
|
<PreviewCard.Portal>
|
|
45
|
-
<PreviewCard.Positioner
|
|
46
|
-
<PreviewCard.Popup
|
|
47
|
-
<PreviewCard.Arrow
|
|
44
|
+
<PreviewCard.Positioner sideOffset={8}>
|
|
45
|
+
<PreviewCard.Popup>
|
|
46
|
+
<PreviewCard.Arrow>
|
|
48
47
|
<ArrowSvg />
|
|
49
48
|
</PreviewCard.Arrow>
|
|
50
|
-
<
|
|
49
|
+
<PreviewCard.Image
|
|
51
50
|
width="448"
|
|
52
51
|
height="300"
|
|
53
|
-
className="PreviewCardImage"
|
|
54
52
|
src="https://images.unsplash.com/photo-1619615391095-dfa29e1672ef?q=80&w=448&h=300"
|
|
55
53
|
alt="Station Hofplein signage in Rotterdam, Netherlands"
|
|
56
54
|
/>
|
|
57
|
-
<
|
|
58
|
-
<
|
|
55
|
+
<PreviewCard.Content>
|
|
56
|
+
<PreviewCard.Description>
|
|
59
57
|
<strong>Typography</strong> is the art and science of arranging type to make written
|
|
60
58
|
language clear, visually appealing, and effective in communication.
|
|
61
|
-
</
|
|
62
|
-
</
|
|
59
|
+
</PreviewCard.Description>
|
|
60
|
+
</PreviewCard.Content>
|
|
63
61
|
</PreviewCard.Popup>
|
|
64
62
|
</PreviewCard.Positioner>
|
|
65
63
|
</PreviewCard.Portal>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
14
14
|
<script>
|
|
15
|
-
(()=>{var
|
|
15
|
+
(()=>{var g=Object.create;var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var y=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports),x=(t,i)=>{for(var o in i)l(t,o,{get:i[o],enumerable:!0})},T=(t,i,o,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of h(i))!u.call(t,a)&&a!==o&&l(t,a,{get:()=>i[a],enumerable:!(n=m(i,a))||n.enumerable});return t};var S=(t,i,o)=>(o=t!=null?g(f(t)):{},T(i||!t||!t.__esModule?l(o,"default",{value:t,enumerable:!0}):o,t));var c=y((W,C)=>{C.exports=window.Loomiere});var P={};x(P,{Default:()=>A,DifferentPlacements:()=>b,MultipleLinks:()=>L,TextOnly:()=>k,WithTitle:()=>D,default:()=>w});var r=S(c(),1);var p=window.React;function e(t,i,o){let{children:n,...a}=i||{};return o!==void 0&&(a.key=o),n===void 0?p.createElement(t,a):Array.isArray(n)?p.createElement(t,a,...n):p.createElement(t,a,n)}var z=p.Fragment;var R={title:"Components/Lib/PreviewCard",component:r.PreviewCard.Root,parameters:{layout:"centered"},tags:["autodocs","ds:lib"]},w=R;function s(t){return e("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...t,children:[e("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"PreviewCardArrowFill"}),e("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"PreviewCardArrowOuterStroke"}),e("path",{d:"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z",className:"PreviewCardArrowInnerStroke"})]})}var A={render:()=>e("div",{style:{padding:"100px"},children:e("p",{style:{fontSize:"16px",lineHeight:"1.6",maxWidth:"600px"},children:["The principles of good"," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://en.wikipedia.org/wiki/Typography",children:"typography"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Image,{width:"448",height:"300",src:"https://images.unsplash.com/photo-1619615391095-dfa29e1672ef?q=80&w=448&h=300",alt:"Station Hofplein signage in Rotterdam, Netherlands"}),e(r.PreviewCard.Content,{children:e(r.PreviewCard.Description,{children:[e("strong",{children:"Typography"})," is the art and science of arranging type to make written language clear, visually appealing, and effective in communication."]})})]})})})]})," ","remain into the digital age."]})})},D={render:()=>e("div",{style:{padding:"100px"},children:e("p",{style:{fontSize:"16px",lineHeight:"1.6",maxWidth:"600px"},children:["Learn more about"," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://en.wikipedia.org/wiki/Design",children:"design principles"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Image,{width:"448",height:"300",src:"https://images.unsplash.com/photo-1561070791-2526d30994b5?q=80&w=448&h=300",alt:"Design workspace"}),e(r.PreviewCard.Content,{children:[e(r.PreviewCard.Title,{children:"Design Principles"}),e(r.PreviewCard.Description,{children:"Fundamental guidelines that help designers create effective, aesthetically pleasing, and functional designs across various mediums."})]})]})})})]})," ","in modern web development."]})})},k={render:()=>e("div",{style:{padding:"100px"},children:e("p",{style:{fontSize:"16px",lineHeight:"1.6",maxWidth:"600px"},children:["Check out our"," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://example.com/documentation",children:"documentation"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Content,{children:[e(r.PreviewCard.Title,{children:"Documentation"}),e(r.PreviewCard.Description,{children:"Comprehensive guides and API references to help you build with our platform. Includes tutorials, examples, and best practices."})]})]})})})]})," ","for more information."]})})},L={render:()=>e("div",{style:{padding:"100px"},children:e("p",{style:{fontSize:"16px",lineHeight:"1.6",maxWidth:"600px"},children:["Modern web development involves understanding"," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://en.wikipedia.org/wiki/HTML",children:"HTML"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Content,{children:[e(r.PreviewCard.Title,{children:"HTML"}),e(r.PreviewCard.Description,{children:"HyperText Markup Language is the standard markup language for documents designed to be displayed in a web browser."})]})]})})})]}),","," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://en.wikipedia.org/wiki/CSS",children:"CSS"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Content,{children:[e(r.PreviewCard.Title,{children:"CSS"}),e(r.PreviewCard.Description,{children:"Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in HTML."})]})]})})})]}),", and"," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://en.wikipedia.org/wiki/JavaScript",children:"JavaScript"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Content,{children:[e(r.PreviewCard.Title,{children:"JavaScript"}),e(r.PreviewCard.Description,{children:"A high-level, interpreted programming language that conforms to the ECMAScript specification. It's a core technology of the World Wide Web."})]})]})})})]}),"."]})})},b={render:()=>e("div",{style:{padding:"100px",display:"flex",flexDirection:"column",gap:"40px"},children:[e("p",{style:{fontSize:"16px",lineHeight:"1.6"},children:["Preview on top:"," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://example.com",children:"hover me"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{side:"top",sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Content,{children:e(r.PreviewCard.Description,{children:"This preview appears above the link."})})]})})})]})]}),e("p",{style:{fontSize:"16px",lineHeight:"1.6"},children:["Preview on bottom:"," ",e(r.PreviewCard.Root,{children:[e(r.PreviewCard.Trigger,{href:"https://example.com",children:"hover me"}),e(r.PreviewCard.Portal,{children:e(r.PreviewCard.Positioner,{side:"bottom",sideOffset:8,children:e(r.PreviewCard.Popup,{children:[e(r.PreviewCard.Arrow,{children:e(s,{})}),e(r.PreviewCard.Content,{children:e(r.PreviewCard.Description,{children:"This preview appears below the link."})})]})})})]})]})]})};var d=window.React,v=w||{},H=["Default","WithTitle","TextOnly","MultipleLinks"];function M({id:t}){let i=P[t],o={...v.args||{},...i.args||{}};return(i.render||(a=>d.createElement(v.component,a)))(o,{args:o,id:t,name:t})}var O=H.map(t=>d.createElement("section",{key:t,className:"ds-story"},d.createElement("p",{className:"ds-story-name"},t.replace(/([a-z])([A-Z])/g,"$1 $2")),d.createElement("div",{className:"ds-story-body"},d.createElement(M,{id:t}))));window.ReactDOM.createRoot(document.getElementById("root")).render(d.createElement(d.Fragment,null,O));})();
|
|
16
16
|
|
|
17
17
|
</script>
|
|
18
18
|
</body>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Base UI Progress styled by the theme. A gauge (tokens/semantic/gauge.json), the same bar as Meter. The fill is the solid color of the scope around it: the accent by default, or set data-color on the root (success, warning, error, any palette).
|
|
4
4
|
|
|
5
|
-
Use `Loomiere.Progress
|
|
5
|
+
Use `Loomiere.Progress`, this package's wrapper: it puts the class names on for you (`import { Progress } from '@scattered-light/loomiere-base-ui'` in an app). The bare Base UI part is `Loomiere.Base.Progress`.
|
|
6
6
|
|
|
7
7
|
Base UI docs: https://base-ui.com/react/components/progress
|
|
8
8
|
|
|
@@ -40,13 +40,13 @@ export const Default: Story = {
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<div style={{ width: '400px' }}>
|
|
43
|
-
<Progress.Root
|
|
44
|
-
<
|
|
45
|
-
<Progress.Label
|
|
46
|
-
<Progress.Value
|
|
47
|
-
</
|
|
48
|
-
<Progress.Track
|
|
49
|
-
<Progress.Indicator
|
|
43
|
+
<Progress.Root value={value}>
|
|
44
|
+
<Progress.Header>
|
|
45
|
+
<Progress.Label>Export data</Progress.Label>
|
|
46
|
+
<Progress.Value />
|
|
47
|
+
</Progress.Header>
|
|
48
|
+
<Progress.Track>
|
|
49
|
+
<Progress.Indicator />
|
|
50
50
|
</Progress.Track>
|
|
51
51
|
</Progress.Root>
|
|
52
52
|
</div>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
14
14
|
<script>
|
|
15
|
-
(()=>{var b=Object.create;var
|
|
15
|
+
(()=>{var b=Object.create;var i=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var u=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports),w=(t,o)=>{for(var a in o)i(t,a,{get:o[a],enumerable:!0})},T=(t,o,a,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of L(o))!f.call(t,s)&&s!==a&&i(t,s,{get:()=>o[s],enumerable:!(n=S(o,s))||n.enumerable});return t};var m=(t,o,a)=>(a=t!=null?b(k(t)):{},T(o||!t||!t.__esModule?i(a,"default",{value:t,enumerable:!0}):a,t));var v=u((B,P)=>{P.exports=window.React});var x=u((U,y)=>{y.exports=window.Loomiere});var p={};w(p,{Default:()=>I,ErrorVariant:()=>A,Indeterminate:()=>E,LargeSize:()=>j,MultipleProgress:()=>F,SmallSize:()=>D,Static:()=>H,SuccessVariant:()=>z,WarningVariant:()=>W,WithoutLabel:()=>V,WithoutValue:()=>M,default:()=>g});var c=m(v(),1),r=m(x(),1);var l=window.React;function e(t,o,a){let{children:n,...s}=o||{};return a!==void 0&&(s.key=a),n===void 0?l.createElement(t,s):Array.isArray(n)?l.createElement(t,s,...n):l.createElement(t,s,n)}var Z=l.Fragment;var h={title:"Components/Lib/Progress",parameters:{layout:"centered"},tags:["autodocs","ds:lib"]},g=h,I={render:()=>{let[t,o]=c.useState(20);return c.useEffect(()=>{let a=setInterval(()=>{o(n=>{let s=n+Math.random()*25;return s>=100?100:Math.round(s)})},1e3);return()=>clearInterval(a)},[]),e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:t,children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:"Export data"}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})}},H={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:65,children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:"Upload progress"}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},E={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:null,children:[e(r.Progress.Header,{children:e(r.Progress.Label,{children:"Loading..."})}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},V={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:45,children:e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})})})},M={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:75,children:[e(r.Progress.Label,{children:"Installation progress"}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},D={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:60,"data-size":"sm",children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:"Small progress"}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},j={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:80,"data-size":"lg",children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:"Large progress"}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},z={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:100,"data-color":"success",children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:"Complete!"}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},W={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:85,"data-color":"warning",children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:"Storage almost full"}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},A={render:()=>e("div",{style:{width:"400px"},children:e(r.Progress.Root,{value:95,"data-color":"error",children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:"Storage critical"}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]})})},F={render:()=>{let[t,o]=c.useState([{id:1,name:"Document.pdf",progress:45},{id:2,name:"Image.jpg",progress:78},{id:3,name:"Video.mp4",progress:12}]);return c.useEffect(()=>{let a=setInterval(()=>{o(n=>n.map(s=>({...s,progress:Math.min(100,s.progress+Math.random()*15)})))},800);return()=>clearInterval(a)},[]),e("div",{style:{width:"400px",display:"flex",flexDirection:"column",gap:"16px"},children:t.map(a=>e(r.Progress.Root,{value:a.progress,children:[e(r.Progress.Header,{children:[e(r.Progress.Label,{children:a.name}),e(r.Progress.Value,{})]}),e(r.Progress.Track,{children:e(r.Progress.Indicator,{})})]},a.id))})}};var d=window.React,R=g||{},N=["Default","Static","Indeterminate","WithoutLabel"];function O({id:t}){let o=p[t],a={...R.args||{},...o.args||{}};return(o.render||(s=>d.createElement(R.component,s)))(a,{args:a,id:t,name:t})}var C=N.map(t=>d.createElement("section",{key:t,className:"ds-story"},d.createElement("p",{className:"ds-story-name"},t.replace(/([a-z])([A-Z])/g,"$1 $2")),d.createElement("div",{className:"ds-story-body"},d.createElement(O,{id:t}))));window.ReactDOM.createRoot(document.getElementById("root")).render(d.createElement(d.Fragment,null,C));})();
|
|
16
16
|
|
|
17
17
|
</script>
|
|
18
18
|
</body>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Base UI Radio styled by the theme. Same box as Checkbox, always round. Sizes follow the label the same way, and the dot is a share of the circle (check.dot-scale).
|
|
4
4
|
|
|
5
|
-
Use `Loomiere.Radio
|
|
5
|
+
Use `Loomiere.Radio`, this package's wrapper: it puts the class names on for you (`import { Radio } from '@scattered-light/loomiere-base-ui'` in an app). The bare Base UI part is `Loomiere.Base.Radio`.
|
|
6
6
|
|
|
7
7
|
Base UI docs: https://base-ui.com/react/components/radio
|
|
8
8
|
|
|
@@ -30,7 +30,6 @@ export const Default: Story = {
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<RadioGroup
|
|
33
|
-
className="RadioGroup"
|
|
34
33
|
value={value}
|
|
35
34
|
onValueChange={setValue}
|
|
36
35
|
aria-labelledby={id}
|
|
@@ -39,32 +38,26 @@ export const Default: Story = {
|
|
|
39
38
|
Choose a fruit
|
|
40
39
|
</div>
|
|
41
40
|
|
|
42
|
-
<
|
|
43
|
-
<Radio.Root value="apple"
|
|
44
|
-
<Radio.Indicator
|
|
45
|
-
<span className="RadioIcon" />
|
|
46
|
-
</Radio.Indicator>
|
|
41
|
+
<Radio.Row>
|
|
42
|
+
<Radio.Root value="apple">
|
|
43
|
+
<Radio.Indicator />
|
|
47
44
|
</Radio.Root>
|
|
48
|
-
<
|
|
49
|
-
</
|
|
45
|
+
<Radio.Label>Apple</Radio.Label>
|
|
46
|
+
</Radio.Row>
|
|
50
47
|
|
|
51
|
-
<
|
|
52
|
-
<Radio.Root value="banana"
|
|
53
|
-
<Radio.Indicator
|
|
54
|
-
<span className="RadioIcon" />
|
|
55
|
-
</Radio.Indicator>
|
|
48
|
+
<Radio.Row>
|
|
49
|
+
<Radio.Root value="banana">
|
|
50
|
+
<Radio.Indicator />
|
|
56
51
|
</Radio.Root>
|
|
57
|
-
<
|
|
58
|
-
</
|
|
52
|
+
<Radio.Label>Banana</Radio.Label>
|
|
53
|
+
</Radio.Row>
|
|
59
54
|
|
|
60
|
-
<
|
|
61
|
-
<Radio.Root value="cherry"
|
|
62
|
-
<Radio.Indicator
|
|
63
|
-
<span className="RadioIcon" />
|
|
64
|
-
</Radio.Indicator>
|
|
55
|
+
<Radio.Row>
|
|
56
|
+
<Radio.Root value="cherry">
|
|
57
|
+
<Radio.Indicator />
|
|
65
58
|
</Radio.Root>
|
|
66
|
-
<
|
|
67
|
-
</
|
|
59
|
+
<Radio.Label>Cherry</Radio.Label>
|
|
60
|
+
</Radio.Row>
|
|
68
61
|
</RadioGroup>
|
|
69
62
|
);
|
|
70
63
|
},
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
14
14
|
<script>
|
|
15
|
-
(()=>{var B=Object.create;var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var p=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports),V=(e,s)=>{for(var t in s)m(e,t,{get:s[t],enumerable:!0})},C=(e,s,t,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of L(s))!G.call(e,d)&&d!==t&&m(e,d,{get:()=>s[d],enumerable:!(l=h(s,d))||l.enumerable});return e};var u=(e,s,t)=>(t=e!=null?B(z(e)):{},C(s||!e||!e.__esModule?m(t,"default",{value:e,enumerable:!0}):t,e));var v=p((Y,I)=>{I.exports=window.React});var g=p((Z,y)=>{y.exports=window.Loomiere.Base});var f=p((q,x)=>{x.exports=window.Loomiere.Base});var b={};V(b,{Default:()=>D,FormExample:()=>j,HorizontalLayout:()=>A,LargeSize:()=>O,SmallSize:()=>F,Uncontrolled:()=>E,WithDescriptions:()=>M,WithDisabled:()=>W,WithoutLabels:()=>P,default:()=>N});var i=u(v(),1),o=u(g(),1),n=u(f(),1);var r=window.React;function a(e,s,t){let{children:l,...d}=s||{};return t!==void 0&&(d.key=t),l===void 0?r.createElement(e,d):Array.isArray(l)?r.createElement(e,d,...l):r.createElement(e,d,l)}var J=r.Fragment;var w={title:"Components/Radio",parameters:{layout:"centered"},tags:["autodocs"]},N=w,D={render:()=>{let e=i.useId(),[s,t]=i.useState("apple");return a(n.RadioGroup,{className:"RadioGroup",value:s,onValueChange:t,"aria-labelledby":e,children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600},children:"Choose a fruit"}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"apple",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Apple"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"banana",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Banana"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"cherry",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Cherry"})]})]})}},E={render:()=>{let e=i.useId();return a(n.RadioGroup,{className:"RadioGroup",defaultValue:"medium","aria-labelledby":e,children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600},children:"Select size"}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"small",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Small"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"medium",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Medium"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"large",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Large"})]})]})}},W={render:()=>{let e=i.useId(),[s,t]=i.useState("option1");return a(n.RadioGroup,{className:"RadioGroup",value:s,onValueChange:t,"aria-labelledby":e,children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600},children:"Choose an option"}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"option1",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Available option"})]}),a("label",{className:"RadioRoot","data-disabled":!0,children:[a(o.Radio.Root,{value:"option2",className:"RadioButton",disabled:!0,children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Disabled option"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"option3",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Another available option"})]})]})}},F={render:()=>{let e=i.useId(),[s,t]=i.useState("email");return a(n.RadioGroup,{className:"RadioGroup",value:s,onValueChange:t,"aria-labelledby":e,children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600,fontSize:"14px"},children:"Notification method"}),a("label",{className:"RadioRoot","data-size":"sm",children:[a(o.Radio.Root,{value:"email",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Email"})]}),a("label",{className:"RadioRoot","data-size":"sm",children:[a(o.Radio.Root,{value:"sms",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"SMS"})]}),a("label",{className:"RadioRoot","data-size":"sm",children:[a(o.Radio.Root,{value:"push",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Push notification"})]})]})}},O={render:()=>{let e=i.useId(),[s,t]=i.useState("credit");return a(n.RadioGroup,{className:"RadioGroup",value:s,onValueChange:t,"aria-labelledby":e,children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600,fontSize:"18px"},children:"Payment method"}),a("label",{className:"RadioRoot","data-size":"lg",children:[a(o.Radio.Root,{value:"credit",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Credit card"})]}),a("label",{className:"RadioRoot","data-size":"lg",children:[a(o.Radio.Root,{value:"debit",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Debit card"})]}),a("label",{className:"RadioRoot","data-size":"lg",children:[a(o.Radio.Root,{value:"paypal",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"PayPal"})]})]})}},A={render:()=>{let e=i.useId(),[s,t]=i.useState("yes");return a("div",{children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600},children:"Do you agree?"}),a(n.RadioGroup,{className:"RadioGroup",value:s,onValueChange:t,"aria-labelledby":e,style:{flexDirection:"row",gap:"24px"},children:[a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"yes",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Yes"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"no",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"No"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"maybe",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Maybe"})]})]})]})}},M={render:()=>{let e=i.useId(),[s,t]=i.useState("starter");return a(n.RadioGroup,{className:"RadioGroup",value:s,onValueChange:t,"aria-labelledby":e,children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600},children:"Choose a plan"}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"starter",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("div",{children:[a("span",{className:"RadioLabel",children:"Starter"}),a("div",{style:{fontSize:"14px",color:"var(--sl-text-secondary)",marginTop:"4px"},children:"Perfect for individuals and small projects"})]})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"professional",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("div",{children:[a("span",{className:"RadioLabel",children:"Professional"}),a("div",{style:{fontSize:"14px",color:"var(--sl-text-secondary)",marginTop:"4px"},children:"For growing teams and businesses"})]})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"enterprise",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("div",{children:[a("span",{className:"RadioLabel",children:"Enterprise"}),a("div",{style:{fontSize:"14px",color:"var(--sl-text-secondary)",marginTop:"4px"},children:"Advanced features for large organizations"})]})]})]})}},P={render:()=>{let e=i.useId(),[s,t]=i.useState("1");return a("div",{children:[a("div",{id:e,style:{marginBottom:"12px",fontWeight:600},children:"Select option"}),a(n.RadioGroup,{className:"RadioGroup",value:s,onValueChange:t,"aria-labelledby":e,style:{flexDirection:"row",gap:"16px"},children:[a("label",{className:"RadioRoot",children:a(o.Radio.Root,{value:"1",className:"RadioButton","aria-label":"Option 1",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})})}),a("label",{className:"RadioRoot",children:a(o.Radio.Root,{value:"2",className:"RadioButton","aria-label":"Option 2",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})})}),a("label",{className:"RadioRoot",children:a(o.Radio.Root,{value:"3",className:"RadioButton","aria-label":"Option 3",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})})})]})]})}},j={render:()=>{let e=i.useId(),s=i.useId(),t=i.useId(),[l,d]=i.useState({size:"medium",color:"blue",delivery:"standard"});return a("form",{onSubmit:c=>{c.preventDefault(),console.log("Form submitted:",l),alert(`Selected: Size ${l.size}, Color ${l.color}, Delivery ${l.delivery}`)},style:{width:"300px"},children:[a("div",{style:{marginBottom:"24px"},children:a(n.RadioGroup,{className:"RadioGroup",value:l.size,onValueChange:c=>d({...l,size:c}),"aria-labelledby":e,children:[a("h3",{id:e,style:{margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Size"}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"small",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Small"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"medium",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Medium"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"large",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Large"})]})]})}),a("div",{style:{marginBottom:"24px"},children:a(n.RadioGroup,{className:"RadioGroup",value:l.color,onValueChange:c=>d({...l,color:c}),"aria-labelledby":s,children:[a("h3",{id:s,style:{margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Color"}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"blue",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Blue"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"red",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Red"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"green",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Green"})]})]})}),a("div",{style:{marginBottom:"24px"},children:a(n.RadioGroup,{className:"RadioGroup",value:l.delivery,onValueChange:c=>d({...l,delivery:c}),"aria-labelledby":t,children:[a("h3",{id:t,style:{margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Delivery"}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"standard",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Standard (5-7 days)"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"express",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Express (2-3 days)"})]}),a("label",{className:"RadioRoot",children:[a(o.Radio.Root,{value:"overnight",className:"RadioButton",children:a(o.Radio.Indicator,{className:"RadioIndicator",children:a("span",{className:"RadioIcon"})})}),a("span",{className:"RadioLabel",children:"Overnight"})]})]})}),a("button",{type:"submit",className:"Button",children:"Submit Order"})]})}};var R=window.React,S=N||{},$=["Default","Uncontrolled","WithDisabled","SmallSize"];function T({id:e}){let s=b[e],t={...S.args||{},...s.args||{}};return(s.render||(d=>R.createElement(S.component,d)))(t,{args:t,id:e,name:e})}var k=$.map(e=>R.createElement("section",{key:e,className:"ds-story"},R.createElement("p",{className:"ds-story-name"},e.replace(/([a-z])([A-Z])/g,"$1 $2")),R.createElement("div",{className:"ds-story-body"},R.createElement(T,{id:e}))));window.ReactDOM.createRoot(document.getElementById("root")).render(R.createElement(R.Fragment,null,k));})();
|
|
15
|
+
(()=>{var x=Object.create;var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var m=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),z=(a,t)=>{for(var i in t)c(a,i,{get:t[i],enumerable:!0})},V=(a,t,i,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!I.call(a,r)&&r!==i&&c(a,r,{get:()=>t[r],enumerable:!(l=S(t,r))||l.enumerable});return a};var v=(a,t,i)=>(i=a!=null?x(h(a)):{},V(t||!a||!a.__esModule?c(i,"default",{value:a,enumerable:!0}):i,a));var w=m((k,p)=>{p.exports=window.React});var L=m((U,y)=>{y.exports=window.Loomiere});var b={};z(b,{Default:()=>D,FormExample:()=>M,HorizontalLayout:()=>F,LargeSize:()=>G,SmallSize:()=>W,Uncontrolled:()=>E,WithDescriptions:()=>O,WithDisabled:()=>B,WithoutLabels:()=>A,default:()=>u});var d=v(w(),1),e=v(L(),1);var s=window.React;function o(a,t,i){let{children:l,...r}=t||{};return i!==void 0&&(r.key=i),l===void 0?s.createElement(a,r):Array.isArray(l)?s.createElement(a,r,...l):s.createElement(a,r,l)}var H=s.Fragment;var C={title:"Components/Lib/Radio",parameters:{layout:"centered"},tags:["autodocs","ds:lib"]},u=C,D={render:()=>{let a=d.useId(),[t,i]=d.useState("apple");return o(e.RadioGroup,{value:t,onValueChange:i,"aria-labelledby":a,children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600},children:"Choose a fruit"}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"apple",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Apple"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"banana",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Banana"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"cherry",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Cherry"})]})]})}},E={render:()=>{let a=d.useId();return o(e.RadioGroup,{defaultValue:"medium","aria-labelledby":a,children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600},children:"Select size"}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"small",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Small"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"medium",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Medium"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"large",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Large"})]})]})}},B={render:()=>{let a=d.useId(),[t,i]=d.useState("option1");return o(e.RadioGroup,{value:t,onValueChange:i,"aria-labelledby":a,children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600},children:"Choose an option"}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"option1",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Available option"})]}),o(e.Radio.Row,{"data-disabled":!0,children:[o(e.Radio.Root,{value:"option2",disabled:!0,children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Disabled option"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"option3",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Another available option"})]})]})}},W={render:()=>{let a=d.useId(),[t,i]=d.useState("email");return o(e.RadioGroup,{value:t,onValueChange:i,"aria-labelledby":a,children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600,fontSize:"14px"},children:"Notification method"}),o(e.Radio.Row,{"data-size":"sm",children:[o(e.Radio.Root,{value:"email",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Email"})]}),o(e.Radio.Row,{"data-size":"sm",children:[o(e.Radio.Root,{value:"sms",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"SMS"})]}),o(e.Radio.Row,{"data-size":"sm",children:[o(e.Radio.Root,{value:"push",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Push notification"})]})]})}},G={render:()=>{let a=d.useId(),[t,i]=d.useState("credit");return o(e.RadioGroup,{value:t,onValueChange:i,"aria-labelledby":a,children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600,fontSize:"18px"},children:"Payment method"}),o(e.Radio.Row,{"data-size":"lg",children:[o(e.Radio.Root,{value:"credit",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Credit card"})]}),o(e.Radio.Row,{"data-size":"lg",children:[o(e.Radio.Root,{value:"debit",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Debit card"})]}),o(e.Radio.Row,{"data-size":"lg",children:[o(e.Radio.Root,{value:"paypal",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"PayPal"})]})]})}},F={render:()=>{let a=d.useId(),[t,i]=d.useState("yes");return o("div",{children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600},children:"Do you agree?"}),o(e.RadioGroup,{value:t,onValueChange:i,"aria-labelledby":a,style:{flexDirection:"row",gap:"24px"},children:[o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"yes",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Yes"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"no",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"No"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"maybe",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Maybe"})]})]})]})}},O={render:()=>{let a=d.useId(),[t,i]=d.useState("starter");return o(e.RadioGroup,{value:t,onValueChange:i,"aria-labelledby":a,children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600},children:"Choose a plan"}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"starter",children:o(e.Radio.Indicator,{})}),o("div",{children:[o(e.Radio.Label,{children:"Starter"}),o("div",{style:{fontSize:"14px",color:"var(--sl-text-secondary)",marginTop:"4px"},children:"Perfect for individuals and small projects"})]})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"professional",children:o(e.Radio.Indicator,{})}),o("div",{children:[o(e.Radio.Label,{children:"Professional"}),o("div",{style:{fontSize:"14px",color:"var(--sl-text-secondary)",marginTop:"4px"},children:"For growing teams and businesses"})]})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"enterprise",children:o(e.Radio.Indicator,{})}),o("div",{children:[o(e.Radio.Label,{children:"Enterprise"}),o("div",{style:{fontSize:"14px",color:"var(--sl-text-secondary)",marginTop:"4px"},children:"Advanced features for large organizations"})]})]})]})}},A={render:()=>{let a=d.useId(),[t,i]=d.useState("1");return o("div",{children:[o("div",{id:a,style:{marginBottom:"12px",fontWeight:600},children:"Select option"}),o(e.RadioGroup,{value:t,onValueChange:i,"aria-labelledby":a,style:{flexDirection:"row",gap:"16px"},children:[o(e.Radio.Row,{children:o(e.Radio.Root,{value:"1","aria-label":"Option 1",children:o(e.Radio.Indicator,{})})}),o(e.Radio.Row,{children:o(e.Radio.Root,{value:"2","aria-label":"Option 2",children:o(e.Radio.Indicator,{})})}),o(e.Radio.Row,{children:o(e.Radio.Root,{value:"3","aria-label":"Option 3",children:o(e.Radio.Indicator,{})})})]})]})}},M={render:()=>{let a=d.useId(),t=d.useId(),i=d.useId(),[l,r]=d.useState({size:"medium",color:"blue",delivery:"standard"});return o("form",{onSubmit:R=>{R.preventDefault(),console.log("Form submitted:",l),alert(`Selected: Size ${l.size}, Color ${l.color}, Delivery ${l.delivery}`)},style:{width:"300px"},children:[o("div",{style:{marginBottom:"24px"},children:o(e.RadioGroup,{value:l.size,onValueChange:R=>r({...l,size:R}),"aria-labelledby":a,children:[o("h3",{id:a,style:{margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Size"}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"small",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Small"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"medium",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Medium"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"large",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Large"})]})]})}),o("div",{style:{marginBottom:"24px"},children:o(e.RadioGroup,{value:l.color,onValueChange:R=>r({...l,color:R}),"aria-labelledby":t,children:[o("h3",{id:t,style:{margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Color"}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"blue",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Blue"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"red",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Red"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"green",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Green"})]})]})}),o("div",{style:{marginBottom:"24px"},children:o(e.RadioGroup,{value:l.delivery,onValueChange:R=>r({...l,delivery:R}),"aria-labelledby":i,children:[o("h3",{id:i,style:{margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Delivery"}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"standard",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Standard (5-7 days)"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"express",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Express (2-3 days)"})]}),o(e.Radio.Row,{children:[o(e.Radio.Root,{value:"overnight",children:o(e.Radio.Indicator,{})}),o(e.Radio.Label,{children:"Overnight"})]})]})}),o("button",{type:"submit",className:"Button",children:"Submit Order"})]})}};var n=window.React,g=u||{},N=["Default","Uncontrolled","WithDisabled","SmallSize"];function P({id:a}){let t=b[a],i={...g.args||{},...t.args||{}};return(t.render||(r=>n.createElement(g.component,r)))(i,{args:i,id:a,name:a})}var j=N.map(a=>n.createElement("section",{key:a,className:"ds-story"},n.createElement("p",{className:"ds-story-name"},a.replace(/([a-z])([A-Z])/g,"$1 $2")),n.createElement("div",{className:"ds-story-body"},n.createElement(P,{id:a}))));window.ReactDOM.createRoot(document.getElementById("root")).render(n.createElement(n.Fragment,null,j));})();
|
|
16
16
|
|
|
17
17
|
</script>
|
|
18
18
|
</body>
|