@scattered-light/loomiere-mojave 0.2.0 → 0.3.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 +56 -1
- package/dist/exports/catalog.json +2 -0
- package/dist/exports/design-system/README.md +56 -1
- package/dist/exports/design-system/components/Button/README.md +1 -1
- package/dist/exports/design-system/components/IconButton/README.md +31 -0
- package/dist/exports/design-system/components/IconButton/preview.html +19 -0
- package/dist/exports/design-system/components/Popover/README.md +2 -2
- package/dist/exports/design-system/components/Popover/preview.html +1 -1
- package/dist/exports/design-system/components/bundle.css +120 -47
- package/dist/exports/design-system/components/bundle.js +5 -5
- package/dist/exports/design-system/components/index.d.ts +13 -2
- package/dist/exports/tokens.dtcg.json +3 -3
- package/dist/tokens.css +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/tokens.js +1 -1
- package/dist/tokens.json +5 -4
- package/package.json +2 -2
package/dist/exports/AGENTS.md
CHANGED
|
@@ -144,7 +144,62 @@ Light and dark: `data-theme="light|dark"` on the root, or the system setting whe
|
|
|
144
144
|
|
|
145
145
|
### Components
|
|
146
146
|
|
|
147
|
-
The components are [Base UI](https://base-ui.com) parts styled by class name: `Accordion`, `AlertDialog`, `Autocomplete`, `Avatar`, `Button`, `Checkbox`, `CheckboxGroup`, `Collapsible`, `Combobox`, `ContextMenu`, `Dialog`, `Drawer`, `Field`, `Fieldset`, `Form`, `Input`, `Menu`, `Menubar`, `Meter`, `NavigationMenu`, `NumberField`, `OTPField`, `Popover`, `PreviewCard`, `Progress`, `Radio`, `ScrollArea`, `Select`, `Separator`, `Slider`, `Switch`, `Tabs`, `Toast`, `Toggle`, `ToggleGroup`, `Toolbar`, `Tooltip`. Each component's README lists the classes its parts take and the data attributes they answer to (`data-size="sm|lg"`, `data-emphasis`, `data-color`).
|
|
147
|
+
The components are [Base UI](https://base-ui.com) parts styled by class name: `Accordion`, `AlertDialog`, `Autocomplete`, `Avatar`, `Button`, `Checkbox`, `CheckboxGroup`, `Collapsible`, `Combobox`, `ContextMenu`, `Dialog`, `Drawer`, `Field`, `Fieldset`, `Form`, `IconButton`, `Input`, `Menu`, `Menubar`, `Meter`, `NavigationMenu`, `NumberField`, `OTPField`, `Popover`, `PreviewCard`, `Progress`, `Radio`, `ScrollArea`, `Select`, `Separator`, `Slider`, `Switch`, `Tabs`, `Toast`, `Toggle`, `ToggleGroup`, `Toolbar`, `Tooltip`. Each component's README lists the classes its parts take and the data attributes they answer to (`data-size="sm|lg"`, `data-emphasis`, `data-color`).
|
|
148
148
|
|
|
149
149
|
Icons are Material Symbols Outlined by ligature name (`<span class="material-symbols-outlined">search</span>`, or `Loomiere.MaterialSymbol name="search"`), sized by the `.icon-<tier>` utilities to match the text beside them.
|
|
150
150
|
|
|
151
|
+
#### Using the components in a page or design
|
|
152
|
+
|
|
153
|
+
Load three things, in this order:
|
|
154
|
+
|
|
155
|
+
1. `components/bundle.css`: the whole theme in one sheet. It holds every token (light, dark, high contrast and color vision modes), the text style, icon and focus utilities, the brand pairs, and every component's styles, and it imports the brand fonts and Material Symbols from Google Fonts itself. Nothing else is needed for styling; `tokens.json` is the same tokens as data for the Design System page.
|
|
156
|
+
2. React 18 and ReactDOM 18 as the `window.React` and `window.ReactDOM` globals. A design canvas or the preview frame already has them.
|
|
157
|
+
3. `components/bundle.js`: one classic script that sets `window.Loomiere`.
|
|
158
|
+
|
|
159
|
+
`window.Loomiere` holds two kinds of component:
|
|
160
|
+
|
|
161
|
+
- **Wrappers** put their own classes on, so use them bare: `Loomiere.Button`, `Loomiere.IconButton`, `Loomiere.Input`, `Loomiere.Field`, `Loomiere.Fieldset`, `Loomiere.Form`, `Loomiere.NavigationMenu`. `Loomiere.Button` also takes `emphasis` (`bold|standard|subtle|quiet`) and `palette` props, and a Button holding only an icon draws itself square (it sets `data-icon-only`). A plain `.Button`, such as a Popover or Toolbar trigger, is drawn square when it has an `aria-label` and a single icon inside, or when you set `data-icon-only` on it.
|
|
162
|
+
- **Everything else is the bare Base UI part** under its usual name (`Loomiere.Popover.Popup`, `Loomiere.ToggleGroup`). It draws nothing until you give each part its class, which is the component and part names joined: `<Loomiere.Popover.Popup className="PopoverPopup">`, `<Loomiere.Toggle className="Toggle">`. The component READMEs list every class.
|
|
163
|
+
|
|
164
|
+
`Loomiere.Base` holds the bare Base UI parts for the wrappers too (`Loomiere.Base.Button`), for when you need the part without its classes.
|
|
165
|
+
|
|
166
|
+
#### Choosing a component
|
|
167
|
+
|
|
168
|
+
Pick by what the person is doing, not by look:
|
|
169
|
+
|
|
170
|
+
| Component | Use it to |
|
|
171
|
+
|---|---|
|
|
172
|
+
| `Button` | Run one action. Set its emphasis by how much the action matters. |
|
|
173
|
+
| `IconButton` | Run a small, frequent action shown as an icon alone, where a Button would be too loud: calendar arrows, row actions, a clear button. Always give it an aria-label. |
|
|
174
|
+
| `Switch` | Turn one setting on or off, taking effect at once. |
|
|
175
|
+
| `Checkbox` | Turn one option on or off inside a form that is submitted later. |
|
|
176
|
+
| `Toggle` | A tool that stays pressed, such as Bold in a toolbar. |
|
|
177
|
+
| `ToggleGroup` | Switch between 2 to 5 short modes or views that apply at once (Single date / Date range, List / Grid). |
|
|
178
|
+
| `Tabs` | Switch between panels of content in the same place. |
|
|
179
|
+
| `Radio` | Choose one of 2 to 6 options in a form, where each option can carry a label and description. |
|
|
180
|
+
| `CheckboxGroup` | Choose any number of a few visible options. |
|
|
181
|
+
| `Select` | Choose one of a fixed list too long to show (about 6 to 15 items). |
|
|
182
|
+
| `Combobox` | Choose one or more from a long list by typing to filter it. |
|
|
183
|
+
| `Autocomplete` | Type free text, with suggestions to speed it up. |
|
|
184
|
+
| `NumberField` | Enter an exact number, with steppers. |
|
|
185
|
+
| `Slider` | Set a value in a range where roughly is good enough. |
|
|
186
|
+
| `OTPField` | Enter a one-time code. |
|
|
187
|
+
| `Menu` | Offer commands from a button. Menus run actions; they don't hold a value. |
|
|
188
|
+
| `ContextMenu` | Offer commands on right-click or long press. |
|
|
189
|
+
| `Menubar` | An app's top row of menus. |
|
|
190
|
+
| `Toolbar` | A row of buttons, toggles and fields that act on one thing. |
|
|
191
|
+
| `NavigationMenu` | Site navigation, with panels of links. |
|
|
192
|
+
| `Tooltip` | Name an icon-only control. Never put anything you can click inside one. |
|
|
193
|
+
| `PreviewCard` | Preview what a link leads to on hover. |
|
|
194
|
+
| `Popover` | Show interactive content beside its trigger: a picker, a short form, filters. |
|
|
195
|
+
| `Dialog` | A task that needs full attention before the page goes on. |
|
|
196
|
+
| `AlertDialog` | Confirm a destructive or hard-to-undo action. |
|
|
197
|
+
| `Drawer` | A side task or detail panel that keeps the page in view. |
|
|
198
|
+
| `Accordion` | Several sections where only some need to be open. |
|
|
199
|
+
| `Collapsible` | One section to show or hide. |
|
|
200
|
+
| `Toast` | Report the result of an action, briefly. |
|
|
201
|
+
| `Progress` | Show how far a task has got. |
|
|
202
|
+
| `Meter` | Show a measured amount within known limits, such as storage used. |
|
|
203
|
+
|
|
204
|
+
A list of choices that stays on screen inside a panel, one of them selected (quick picks, saved filters, presets), has no Base UI part. Make each row a `<button aria-pressed>` drawn from the item concept: `--sl-item-padding-block`, `-padding-inline`, `-radius` and `-gap`, `--sl-item-background-hover` and `-color-hover` on hover, `--sl-item-background-selected` and `-color-selected` with the `-selected` text style when chosen. These are the same rows menus and selects use. When the choice is a form value, use Radio instead.
|
|
205
|
+
|
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
"design-system/components/Fieldset/preview.html",
|
|
126
126
|
"design-system/components/Form/README.md",
|
|
127
127
|
"design-system/components/Form/preview.html",
|
|
128
|
+
"design-system/components/IconButton/README.md",
|
|
129
|
+
"design-system/components/IconButton/preview.html",
|
|
128
130
|
"design-system/components/Input/README.md",
|
|
129
131
|
"design-system/components/Input/preview.html",
|
|
130
132
|
"design-system/components/Menu/README.md",
|
|
@@ -136,7 +136,62 @@ Light and dark: `data-theme="light|dark"` on the root, or the system setting whe
|
|
|
136
136
|
|
|
137
137
|
## Components
|
|
138
138
|
|
|
139
|
-
The components are [Base UI](https://base-ui.com) parts styled by class name: `Accordion`, `AlertDialog`, `Autocomplete`, `Avatar`, `Button`, `Checkbox`, `CheckboxGroup`, `Collapsible`, `Combobox`, `ContextMenu`, `Dialog`, `Drawer`, `Field`, `Fieldset`, `Form`, `Input`, `Menu`, `Menubar`, `Meter`, `NavigationMenu`, `NumberField`, `OTPField`, `Popover`, `PreviewCard`, `Progress`, `Radio`, `ScrollArea`, `Select`, `Separator`, `Slider`, `Switch`, `Tabs`, `Toast`, `Toggle`, `ToggleGroup`, `Toolbar`, `Tooltip`. Each component's README lists the classes its parts take and the data attributes they answer to (`data-size="sm|lg"`, `data-emphasis`, `data-color`).
|
|
139
|
+
The components are [Base UI](https://base-ui.com) parts styled by class name: `Accordion`, `AlertDialog`, `Autocomplete`, `Avatar`, `Button`, `Checkbox`, `CheckboxGroup`, `Collapsible`, `Combobox`, `ContextMenu`, `Dialog`, `Drawer`, `Field`, `Fieldset`, `Form`, `IconButton`, `Input`, `Menu`, `Menubar`, `Meter`, `NavigationMenu`, `NumberField`, `OTPField`, `Popover`, `PreviewCard`, `Progress`, `Radio`, `ScrollArea`, `Select`, `Separator`, `Slider`, `Switch`, `Tabs`, `Toast`, `Toggle`, `ToggleGroup`, `Toolbar`, `Tooltip`. Each component's README lists the classes its parts take and the data attributes they answer to (`data-size="sm|lg"`, `data-emphasis`, `data-color`).
|
|
140
140
|
|
|
141
141
|
Icons are Material Symbols Outlined by ligature name (`<span class="material-symbols-outlined">search</span>`, or `Loomiere.MaterialSymbol name="search"`), sized by the `.icon-<tier>` utilities to match the text beside them.
|
|
142
142
|
|
|
143
|
+
### Using the components in a page or design
|
|
144
|
+
|
|
145
|
+
Load three things, in this order:
|
|
146
|
+
|
|
147
|
+
1. `components/bundle.css`: the whole theme in one sheet. It holds every token (light, dark, high contrast and color vision modes), the text style, icon and focus utilities, the brand pairs, and every component's styles, and it imports the brand fonts and Material Symbols from Google Fonts itself. Nothing else is needed for styling; `tokens.json` is the same tokens as data for the Design System page.
|
|
148
|
+
2. React 18 and ReactDOM 18 as the `window.React` and `window.ReactDOM` globals. A design canvas or the preview frame already has them.
|
|
149
|
+
3. `components/bundle.js`: one classic script that sets `window.Loomiere`.
|
|
150
|
+
|
|
151
|
+
`window.Loomiere` holds two kinds of component:
|
|
152
|
+
|
|
153
|
+
- **Wrappers** put their own classes on, so use them bare: `Loomiere.Button`, `Loomiere.IconButton`, `Loomiere.Input`, `Loomiere.Field`, `Loomiere.Fieldset`, `Loomiere.Form`, `Loomiere.NavigationMenu`. `Loomiere.Button` also takes `emphasis` (`bold|standard|subtle|quiet`) and `palette` props, and a Button holding only an icon draws itself square (it sets `data-icon-only`). A plain `.Button`, such as a Popover or Toolbar trigger, is drawn square when it has an `aria-label` and a single icon inside, or when you set `data-icon-only` on it.
|
|
154
|
+
- **Everything else is the bare Base UI part** under its usual name (`Loomiere.Popover.Popup`, `Loomiere.ToggleGroup`). It draws nothing until you give each part its class, which is the component and part names joined: `<Loomiere.Popover.Popup className="PopoverPopup">`, `<Loomiere.Toggle className="Toggle">`. The component READMEs list every class.
|
|
155
|
+
|
|
156
|
+
`Loomiere.Base` holds the bare Base UI parts for the wrappers too (`Loomiere.Base.Button`), for when you need the part without its classes.
|
|
157
|
+
|
|
158
|
+
### Choosing a component
|
|
159
|
+
|
|
160
|
+
Pick by what the person is doing, not by look:
|
|
161
|
+
|
|
162
|
+
| Component | Use it to |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `Button` | Run one action. Set its emphasis by how much the action matters. |
|
|
165
|
+
| `IconButton` | Run a small, frequent action shown as an icon alone, where a Button would be too loud: calendar arrows, row actions, a clear button. Always give it an aria-label. |
|
|
166
|
+
| `Switch` | Turn one setting on or off, taking effect at once. |
|
|
167
|
+
| `Checkbox` | Turn one option on or off inside a form that is submitted later. |
|
|
168
|
+
| `Toggle` | A tool that stays pressed, such as Bold in a toolbar. |
|
|
169
|
+
| `ToggleGroup` | Switch between 2 to 5 short modes or views that apply at once (Single date / Date range, List / Grid). |
|
|
170
|
+
| `Tabs` | Switch between panels of content in the same place. |
|
|
171
|
+
| `Radio` | Choose one of 2 to 6 options in a form, where each option can carry a label and description. |
|
|
172
|
+
| `CheckboxGroup` | Choose any number of a few visible options. |
|
|
173
|
+
| `Select` | Choose one of a fixed list too long to show (about 6 to 15 items). |
|
|
174
|
+
| `Combobox` | Choose one or more from a long list by typing to filter it. |
|
|
175
|
+
| `Autocomplete` | Type free text, with suggestions to speed it up. |
|
|
176
|
+
| `NumberField` | Enter an exact number, with steppers. |
|
|
177
|
+
| `Slider` | Set a value in a range where roughly is good enough. |
|
|
178
|
+
| `OTPField` | Enter a one-time code. |
|
|
179
|
+
| `Menu` | Offer commands from a button. Menus run actions; they don't hold a value. |
|
|
180
|
+
| `ContextMenu` | Offer commands on right-click or long press. |
|
|
181
|
+
| `Menubar` | An app's top row of menus. |
|
|
182
|
+
| `Toolbar` | A row of buttons, toggles and fields that act on one thing. |
|
|
183
|
+
| `NavigationMenu` | Site navigation, with panels of links. |
|
|
184
|
+
| `Tooltip` | Name an icon-only control. Never put anything you can click inside one. |
|
|
185
|
+
| `PreviewCard` | Preview what a link leads to on hover. |
|
|
186
|
+
| `Popover` | Show interactive content beside its trigger: a picker, a short form, filters. |
|
|
187
|
+
| `Dialog` | A task that needs full attention before the page goes on. |
|
|
188
|
+
| `AlertDialog` | Confirm a destructive or hard-to-undo action. |
|
|
189
|
+
| `Drawer` | A side task or detail panel that keeps the page in view. |
|
|
190
|
+
| `Accordion` | Several sections where only some need to be open. |
|
|
191
|
+
| `Collapsible` | One section to show or hide. |
|
|
192
|
+
| `Toast` | Report the result of an action, briefly. |
|
|
193
|
+
| `Progress` | Show how far a task has got. |
|
|
194
|
+
| `Meter` | Show a measured amount within known limits, such as storage used. |
|
|
195
|
+
|
|
196
|
+
A list of choices that stays on screen inside a panel, one of them selected (quick picks, saved filters, presets), has no Base UI part. Make each row a `<button aria-pressed>` drawn from the item concept: `--sl-item-padding-block`, `-padding-inline`, `-radius` and `-gap`, `--sl-item-background-hover` and `-color-hover` on hover, `--sl-item-background-selected` and `-color-selected` with the `-selected` text style when chosen. These are the same rows menus and selects use. When the choice is a form value, use Radio instead.
|
|
197
|
+
|
|
@@ -10,7 +10,7 @@ Base UI docs: https://base-ui.com/react/components/button
|
|
|
10
10
|
|
|
11
11
|
| Class | Data attributes it answers to |
|
|
12
12
|
|---|---|
|
|
13
|
-
| `Button` | `data-size`: `xs`, `sm`, `lg` |
|
|
13
|
+
| `Button` | `data-icon-only`; `data-size`: `xs`, `sm`, `lg` |
|
|
14
14
|
|
|
15
15
|
Base UI sets the state attributes (`data-checked`, `data-open`, `data-disabled`...) itself. Set `data-size`, `data-emphasis`, `data-variant` and `data-color` yourself; `data-color` takes any palette name (`primary`, `secondary`, `error`...) and repaints the part in it.
|
|
16
16
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# IconButton
|
|
2
|
+
|
|
3
|
+
The Base UI Button styled by the theme. A small, quiet icon-only button: the icon-button concept (tokens/semantic/icon-button.json), the same look as the X that closes a dialog or toast, as a part of its own. For calendar arrows, row actions and clear buttons, where a Button would be too loud. No component tokens.
|
|
4
|
+
|
|
5
|
+
Use `Loomiere.IconButton`, this package's wrapper: it puts the class names on for you (`import { IconButton } from '@scattered-light/loomiere-base-ui'` in an app). The bare Base UI part is `Loomiere.Base.Button`.
|
|
6
|
+
|
|
7
|
+
Base UI docs: https://base-ui.com/react/components/button
|
|
8
|
+
|
|
9
|
+
## Classes
|
|
10
|
+
|
|
11
|
+
| Class | Data attributes it answers to |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `IconButton` | |
|
|
14
|
+
|
|
15
|
+
Base UI sets the state attributes (`data-checked`, `data-open`, `data-disabled`...) itself. Set `data-size`, `data-emphasis`, `data-variant` and `data-color` yourself; `data-color` takes any palette name (`primary`, `secondary`, `error`...) and repaints the part in it.
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
From the IconButton stories (`Default`):
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<IconButton type="button" aria-label="Next month">
|
|
25
|
+
<Icon name="chevron_right" />
|
|
26
|
+
</IconButton>
|
|
27
|
+
),
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The preview also shows `CalendarHeader`, `RowActions`, `Disabled`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- @dsCard group="Actions" height=480 subtitle="Default / CalendarHeader / RowActions / Disabled" -->
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<style>
|
|
7
|
+
body { margin: 0; padding: var(--sl-space-4, 16px); background: var(--sl-surface-canvas); color: var(--sl-text-primary); }
|
|
8
|
+
#root { display: grid; gap: var(--sl-space-5, 20px); }
|
|
9
|
+
.ds-story-name { margin: 0 0 var(--sl-space-2, 8px); font: var(--sl-font-minimize-label-font, 500 10px sans-serif); color: var(--sl-text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="root"></div>
|
|
14
|
+
<script>
|
|
15
|
+
(()=>{var x=Object.create;var m=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),v=(e,t)=>{for(var o in t)m(e,o,{get:t[o],enumerable:!0})},E=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of g(t))!w.call(e,a)&&a!==o&&m(e,a,{get:()=>t[a],enumerable:!(s=f(t,a))||s.enumerable});return e};var B=(e,t,o)=>(o=e!=null?x(h(e)):{},E(t||!e||!e.__esModule?m(o,"default",{value:e,enumerable:!0}):o,e));var u=I((F,y)=>{y.exports=window.Loomiere});var p={};v(p,{CalendarHeader:()=>N,Default:()=>D,Disabled:()=>A,RowActions:()=>R,default:()=>d});var r=B(u(),1);var i=window.React;function n(e,t,o){let{children:s,...a}=t||{};return o!==void 0&&(a.key=o),s===void 0?i.createElement(e,a):Array.isArray(s)?i.createElement(e,a,...s):i.createElement(e,a,s)}var M=i.Fragment;var S={title:"Components/Lib/IconButton",component:r.IconButton,parameters:{layout:"centered"},tags:["autodocs","ds:lib"]},d=S,c=({name:e})=>n("span",{className:"material-symbols-outlined","aria-hidden":"true",children:e}),D={render:()=>n(r.IconButton,{type:"button","aria-label":"Next month",children:n(c,{name:"chevron_right"})})},N={render:()=>n("div",{style:{display:"flex",alignItems:"center",gap:"var(--sl-space-2)",width:"280px"},children:[n(r.IconButton,{type:"button","aria-label":"Previous month",children:n(c,{name:"chevron_left"})}),n("span",{className:"text-style-base-subtitle",style:{flexGrow:1,textAlign:"center"},children:"October 2026"}),n(r.IconButton,{type:"button","aria-label":"Next month",children:n(c,{name:"chevron_right"})})]})},R={render:()=>n("div",{style:{display:"flex",gap:"var(--sl-space-1)"},children:[n(r.IconButton,{type:"button","aria-label":"Edit",children:n(c,{name:"edit"})}),n(r.IconButton,{type:"button","aria-label":"Duplicate",children:n(c,{name:"content_copy"})}),n(r.IconButton,{type:"button","aria-label":"Delete",children:n(c,{name:"delete"})})]})},A={render:()=>n(r.IconButton,{type:"button","aria-label":"Next month",disabled:!0,children:n(c,{name:"chevron_right"})})};var l=window.React,b=d||{},_=["Default","CalendarHeader","RowActions","Disabled"];function j({id:e}){let t=p[e],o={...b.args||{},...t.args||{}};return(t.render||(a=>l.createElement(b.component,a)))(o,{args:o,id:e,name:e})}var O=_.map(e=>l.createElement("section",{key:e,className:"ds-story"},l.createElement("p",{className:"ds-story-name"},e.replace(/([a-z])([A-Z])/g,"$1 $2")),l.createElement("div",{className:"ds-story-body"},l.createElement(j,{id:e}))));window.ReactDOM.createRoot(document.getElementById("root")).render(l.createElement(l.Fragment,null,O));})();
|
|
16
|
+
|
|
17
|
+
</script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -32,8 +32,8 @@ From the Popover stories (`Default`):
|
|
|
32
32
|
export const Default: Story = {
|
|
33
33
|
render: () => (
|
|
34
34
|
<Popover.Root>
|
|
35
|
-
<Popover.Trigger className="PopoverTrigger Button">
|
|
36
|
-
<BellIcon aria-
|
|
35
|
+
<Popover.Trigger className="PopoverTrigger Button" aria-label="Notifications">
|
|
36
|
+
<BellIcon aria-hidden="true" />
|
|
37
37
|
</Popover.Trigger>
|
|
38
38
|
<Popover.Portal>
|
|
39
39
|
<Popover.Positioner className="PopoverPositioner" sideOffset={8}>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
14
14
|
<script>
|
|
15
|
-
(()=>{var y=Object.create;var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var d=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),R=(r,t)=>{for(var s in t)c(r,s,{get:t[s],enumerable:!0})},b=(r,t,s,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!L.call(r,a)&&a!==s&&c(r,a,{get:()=>t[a],enumerable:!(p=h(t,a))||p.enumerable});return r};var u=(r,t,s)=>(s=r!=null?y(T(r)):{},b(t||!r||!r.__esModule?c(s,"default",{value:r,enumerable:!0}):s,r));var w=d((W,g)=>{g.exports=window.React});var C=d((Z,f)=>{f.exports=window.Loomiere.Base});var m={};R(m,{Default:()=>B,Placement:()=>M,WithBackdrop:()=>O,WithCloseButton:()=>S,WithForm:()=>E,default:()=>v});var P=u(w(),1),e=u(C(),1);var l=window.React;function o(r,t,s){let{children:p,...a}=t||{};return s!==void 0&&(a.key=s),p===void 0?l.createElement(r,a):Array.isArray(p)?l.createElement(r,a,...p):l.createElement(r,a,p)}var V=l.Fragment;var A={title:"Components/Popover",component:e.Popover.Root,parameters:{layout:"centered"},tags:["autodocs"]},v=A;function n(r){return o("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...r,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 D(r){return o("svg",{fill:"currentcolor",width:"20",height:"20",viewBox:"0 0 16 16",...r,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 k(r){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",...r,children:o("path",{d:"M18 6L6 18M6 6l12 12"})})}var B={render:()=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"PopoverTrigger Button",children:o(D,{"aria-
|
|
15
|
+
(()=>{var y=Object.create;var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var d=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),R=(r,t)=>{for(var s in t)c(r,s,{get:t[s],enumerable:!0})},b=(r,t,s,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!L.call(r,a)&&a!==s&&c(r,a,{get:()=>t[a],enumerable:!(p=h(t,a))||p.enumerable});return r};var u=(r,t,s)=>(s=r!=null?y(T(r)):{},b(t||!r||!r.__esModule?c(s,"default",{value:r,enumerable:!0}):s,r));var w=d((W,g)=>{g.exports=window.React});var C=d((Z,f)=>{f.exports=window.Loomiere.Base});var m={};R(m,{Default:()=>B,Placement:()=>M,WithBackdrop:()=>O,WithCloseButton:()=>S,WithForm:()=>E,default:()=>v});var P=u(w(),1),e=u(C(),1);var l=window.React;function o(r,t,s){let{children:p,...a}=t||{};return s!==void 0&&(a.key=s),p===void 0?l.createElement(r,a):Array.isArray(p)?l.createElement(r,a,...p):l.createElement(r,a,p)}var V=l.Fragment;var A={title:"Components/Popover",component:e.Popover.Root,parameters:{layout:"centered"},tags:["autodocs"]},v=A;function n(r){return o("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...r,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 D(r){return o("svg",{fill:"currentcolor",width:"20",height:"20",viewBox:"0 0 16 16",...r,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 k(r){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",...r,children:o("path",{d:"M18 6L6 18M6 6l12 12"})})}var B={render:()=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"PopoverTrigger Button","aria-label":"Notifications",children:o(D,{"aria-hidden":"true"})}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{className:"PopoverPositioner",sideOffset:8,children:o(e.Popover.Popup,{className:"PopoverPopup",children:[o(e.Popover.Arrow,{className:"PopoverArrow",children:o(n,{})}),o(e.Popover.Title,{className:"PopoverTitle",children:"Notifications"}),o(e.Popover.Description,{className:"PopoverDescription",children:"You are all caught up. Good job!"})]})})})]})},S={render:()=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"PopoverTrigger Button",children:"Open settings"}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{className:"PopoverPositioner",sideOffset:8,children:o(e.Popover.Popup,{className:"PopoverPopup",children:[o(e.Popover.Close,{className:"PopoverClose","aria-label":"Close",children:o(k,{})}),o(e.Popover.Arrow,{className:"PopoverArrow",children:o(n,{})}),o(e.Popover.Title,{className:"PopoverTitle",children:"Settings"}),o(e.Popover.Description,{className:"PopoverDescription",children:"Adjust your preferences and account settings here."})]})})})]})},E={render:()=>{let r=P.useId(),t=P.useId();return o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"PopoverTrigger Button",children:"Contact form"}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{className:"PopoverPositioner",sideOffset:8,children:o(e.Popover.Popup,{className:"PopoverPopup",children:[o(e.Popover.Arrow,{className:"PopoverArrow",children:o(n,{})}),o(e.Popover.Title,{className:"PopoverTitle",children:"Get in touch"}),o(e.Popover.Description,{className:"PopoverDescription",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:r,style:{display:"block",fontSize:"14px",marginBottom:"4px"},children:"Name"}),o("input",{id:r,type:"text",className:"Input",placeholder:"Your name",style:{width:"100%"}})]}),o("div",{children:[o("label",{htmlFor:t,style:{display:"block",fontSize:"14px",marginBottom:"4px"},children:"Email"}),o("input",{id:t,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(r=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"PopoverTrigger Button",children:r}),o(e.Popover.Portal,{children:o(e.Popover.Positioner,{className:"PopoverPositioner",side:r,sideOffset:8,children:o(e.Popover.Popup,{className:"PopoverPopup",children:[o(e.Popover.Arrow,{className:"PopoverArrow",children:o(n,{})}),o(e.Popover.Description,{className:"PopoverDescription",children:["Popover on the ",r]})]})})})]},r))})},O={render:()=>o(e.Popover.Root,{children:[o(e.Popover.Trigger,{className:"PopoverTrigger Button",children:"Open with backdrop"}),o(e.Popover.Portal,{children:[o(e.Popover.Backdrop,{className:"PopoverBackdrop",style:{background:"rgba(0, 0, 0, 0.3)"}}),o(e.Popover.Positioner,{className:"PopoverPositioner",sideOffset:8,children:o(e.Popover.Popup,{className:"PopoverPopup",children:[o(e.Popover.Arrow,{className:"PopoverArrow",children:o(n,{})}),o(e.Popover.Title,{className:"PopoverTitle",children:"Modal-like popover"}),o(e.Popover.Description,{className:"PopoverDescription",children:"This popover has a backdrop to focus attention."})]})})]})]})};var i=window.React,N=v||{},I=["Default","WithCloseButton","WithForm","Placement"];function F({id:r}){let t=m[r],s={...N.args||{},...t.args||{}};return(t.render||(a=>i.createElement(N.component,a)))(s,{args:s,id:r,name:r})}var j=I.map(r=>i.createElement("section",{key:r,className:"ds-story"},i.createElement("p",{className:"ds-story-name"},r.replace(/([a-z])([A-Z])/g,"$1 $2")),i.createElement("div",{className:"ds-story-body"},i.createElement(F,{id:r}))));window.ReactDOM.createRoot(document.getElementById("root")).render(i.createElement(i.Fragment,null,j));})();
|
|
16
16
|
|
|
17
17
|
</script>
|
|
18
18
|
</body>
|