@insymetri/styleguide 0.1.82 → 0.1.84

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.
@@ -3,6 +3,7 @@
3
3
  import {Checkbox} from 'bits-ui'
4
4
  import {IIIcon} from '../IIIcon'
5
5
  import {cn} from '../utils/cn'
6
+ import {buttonReset} from '../utils/button-reset'
6
7
 
7
8
  type Props = {
8
9
  checked: boolean
@@ -33,7 +34,7 @@
33
34
 
34
35
  <label class={cn('flex items-center gap-8', className)}>
35
36
  <Checkbox.Root
36
- class="peer [all:unset] cursor-default shrink-0 inline-block data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
37
+ class={cn('peer', buttonReset, 'cursor-default shrink-0 inline-block data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50')}
37
38
  bind:checked
38
39
  {onCheckedChange}
39
40
  {disabled}
@@ -4,6 +4,7 @@
4
4
  import IIBadge from '../IIBadge/IIBadge.svelte'
5
5
  import type {BadgeVariant} from '../IIBadge/IIBadge.types'
6
6
  import {cn} from '../utils/cn'
7
+ import {buttonReset} from '../utils/button-reset'
7
8
 
8
9
  type Item = {
9
10
  value: string
@@ -50,7 +51,7 @@
50
51
  </script>
51
52
 
52
53
  <Popover.Root>
53
- <Popover.Trigger class="[all:unset] flex items-center gap-4 flex-wrap cursor-default">
54
+ <Popover.Trigger class={cn(buttonReset, 'flex items-center gap-4 flex-wrap cursor-default')}>
54
55
  {#if selectedItems.length === 0}
55
56
  <IIBadge variant="grey">{emptyText}</IIBadge>
56
57
  {:else}
@@ -72,7 +73,8 @@
72
73
  <button
73
74
  type="button"
74
75
  class={cn(
75
- '[all:unset] flex items-center justify-between px-12 py-8 border rounded-4 bg-background cursor-default transition-all duration-fast text-small text-body hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed',
76
+ buttonReset,
77
+ 'flex items-center justify-between px-12 py-8 border rounded-4 bg-background cursor-default transition-all duration-fast text-small text-body hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed',
76
78
  isSelected && 'border-2',
77
79
  optionVariantClasses[variant]
78
80
  )}
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import {cn} from '../utils/cn'
3
+ import {buttonReset} from '../utils/button-reset'
3
4
 
4
5
  type Props = {
5
6
  value: string
@@ -132,7 +133,8 @@
132
133
  <button
133
134
  type="button"
134
135
  class={cn(
135
- '[all:unset] cursor-text block w-full py-4 border-b-2 border-transparent transition-all duration-fast text-left hover:border-b-primary focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2 focus-visible:rounded-4',
136
+ buttonReset,
137
+ 'cursor-text block w-full py-4 border-b-2 border-transparent transition-all duration-fast text-left hover:border-b-primary focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2 focus-visible:rounded-4',
136
138
  disabled && 'cursor-not-allowed opacity-60'
137
139
  )}
138
140
  onclick={startEditing}
@@ -3,6 +3,7 @@
3
3
  import {createAttachmentKey} from 'svelte/attachments'
4
4
  import {fly} from 'svelte/transition'
5
5
  import {cn} from '../utils/cn'
6
+ import {buttonReset} from '../utils/button-reset'
6
7
  import {IIIcon} from '../IIIcon'
7
8
  import {createMenuSearch, getSelectableItems, isItem, isGroup, isSub, isSeparator, menuStyles, menuItemClass, type MenuItem, type MenuEntry, type SubEntry} from '../utils/menu'
8
9
  import {useFloating, portal, clickOutside} from '../utils/menu'
@@ -283,7 +284,10 @@
283
284
  return -1
284
285
  }
285
286
 
286
- const defaultTriggerClass = '[all:unset] cursor-default inline-flex items-center justify-center p-4 rounded-4 text-secondary transition-all duration-fast hover:bg-background hover:text-body data-[state=open]:bg-background data-[state=open]:text-body motion-reduce:transition-none'
287
+ // Children triggers own their content layout; default to an inline-flex row so a
288
+ // value + caret sit on one line even when the consumer passes no display class.
289
+ const childrenTriggerClass = `${buttonReset} inline-flex items-center text-left cursor-default`
290
+ const defaultTriggerClass = `${buttonReset} inline-flex items-center justify-center p-4 rounded-4 text-secondary cursor-default transition-all duration-fast hover:bg-background hover:text-body data-[state=open]:bg-background data-[state=open]:text-body motion-reduce:transition-none`
287
291
  </script>
288
292
 
289
293
  {#snippet itemContent(item: MenuItem)}
@@ -427,7 +431,7 @@
427
431
  aria-haspopup="menu"
428
432
  aria-expanded={open}
429
433
  data-state={open ? 'open' : 'closed'}
430
- class={cn(children ? '[all:unset] cursor-default' : defaultTriggerClass, triggerClass, className)}
434
+ class={cn(children ? childrenTriggerClass : defaultTriggerClass, triggerClass, className)}
431
435
  onclick={toggle}
432
436
  onkeydown={handleTriggerKeydown}
433
437
  >
@@ -3,6 +3,7 @@
3
3
  import {DropdownMenu} from 'bits-ui'
4
4
  import {IIButton} from '../IIButton'
5
5
  import {cn} from '../utils/cn'
6
+ import {buttonReset} from '../utils/button-reset'
6
7
  import {IIIcon} from '../IIIcon'
7
8
 
8
9
  type Action = {
@@ -67,7 +68,7 @@
67
68
  {#if overflowing}
68
69
  <DropdownMenu.Root bind:open={kebabOpen}>
69
70
  <DropdownMenu.Trigger
70
- class="[all:unset] cursor-default inline-flex items-center justify-center p-4 rounded-4 text-secondary text-h3 transition-all duration-fast hover:bg-background hover:text-body data-[state=open]:bg-background data-[state=open]:text-body motion-reduce:transition-none"
71
+ class={cn(buttonReset, 'cursor-default inline-flex items-center justify-center p-4 rounded-4 text-secondary text-h3 transition-all duration-fast hover:bg-background hover:text-body data-[state=open]:bg-background data-[state=open]:text-body motion-reduce:transition-none')}
71
72
  >
72
73
  <IIIcon iconName="dots-three-vertical" size="inherit" />
73
74
  </DropdownMenu.Trigger>
@@ -2,6 +2,7 @@
2
2
  import type {Snippet} from 'svelte'
3
3
  import {Popover} from 'bits-ui'
4
4
  import {cn} from '../utils/cn'
5
+ import {buttonReset} from '../utils/button-reset'
5
6
 
6
7
  type Props = {
7
8
  open?: boolean
@@ -52,7 +53,7 @@
52
53
  {/snippet}
53
54
  </Popover.Trigger>
54
55
  {:else}
55
- <Popover.Trigger class={cn('[all:unset] cursor-default', triggerClass)}>
56
+ <Popover.Trigger class={cn(buttonReset, 'cursor-default', triggerClass)}>
56
57
  {@render trigger?.()}
57
58
  </Popover.Trigger>
58
59
  {/if}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { buttonReset } from './utils/button-reset';
1
2
  export { default as DensityProvider } from './DensityProvider/DensityProvider.svelte';
2
3
  export { useDensity, type Density } from './density';
3
4
  export { default as StepIndicator } from './MobileOnboarding/StepIndicator.svelte';
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  // @insymetri/styleguide
2
+ // Utilities
3
+ export { buttonReset } from './utils/button-reset';
2
4
  // Density
3
5
  export { default as DensityProvider } from './DensityProvider/DensityProvider.svelte';
4
6
  export { useDensity } from './density';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Named-utility reset for bare `<button>` (and `Popover.Trigger`) elements.
3
+ *
4
+ * Replaces the `[all:unset]` idiom. In Tailwind v4 `[all:unset]` is an arbitrary
5
+ * property that sorts *after* named utilities in the generated stylesheet, so it
6
+ * wins the cascade over any layout classes a consumer passes on the same element
7
+ * (silently clobbering `display`, padding, etc.). That is why e.g. a trigger's
8
+ * `flex` was ignored and its caret wrapped onto a new line.
9
+ *
10
+ * These named utilities participate in the cascade normally, so a consumer's
11
+ * `flex` / `inline-flex` / `grid` and any real padding win predictably (no
12
+ * `!important` needed).
13
+ *
14
+ * Deliberately minimal — it only includes resets that are never in tension with
15
+ * a component's own styling:
16
+ * - `appearance-none` strips native control chrome (mainly Safari).
17
+ * - `p-0 m-0` drops the UA button box; a component's real padding (`p-4`,
18
+ * `px-12`, …) still wins via Tailwind's canonical utility ordering.
19
+ * - `outline-none` preserves the prior `[all:unset]` behaviour of no default
20
+ * focus ring; components that want one add a `focus-visible:` outline.
21
+ *
22
+ * Everything else `[all:unset]` used to reset (border-width, background, and
23
+ * inherited color/font) is already handled by Tailwind's Preflight on form
24
+ * controls, so it is intentionally left out to avoid fighting components that
25
+ * set a real `border` / `bg-*` / `text-*` (e.g. IIEditableBadges option rows).
26
+ *
27
+ * Does NOT set `display` or `cursor` — each consumer picks those.
28
+ */
29
+ export declare const buttonReset = "appearance-none p-0 m-0 outline-none";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Named-utility reset for bare `<button>` (and `Popover.Trigger`) elements.
3
+ *
4
+ * Replaces the `[all:unset]` idiom. In Tailwind v4 `[all:unset]` is an arbitrary
5
+ * property that sorts *after* named utilities in the generated stylesheet, so it
6
+ * wins the cascade over any layout classes a consumer passes on the same element
7
+ * (silently clobbering `display`, padding, etc.). That is why e.g. a trigger's
8
+ * `flex` was ignored and its caret wrapped onto a new line.
9
+ *
10
+ * These named utilities participate in the cascade normally, so a consumer's
11
+ * `flex` / `inline-flex` / `grid` and any real padding win predictably (no
12
+ * `!important` needed).
13
+ *
14
+ * Deliberately minimal — it only includes resets that are never in tension with
15
+ * a component's own styling:
16
+ * - `appearance-none` strips native control chrome (mainly Safari).
17
+ * - `p-0 m-0` drops the UA button box; a component's real padding (`p-4`,
18
+ * `px-12`, …) still wins via Tailwind's canonical utility ordering.
19
+ * - `outline-none` preserves the prior `[all:unset]` behaviour of no default
20
+ * focus ring; components that want one add a `focus-visible:` outline.
21
+ *
22
+ * Everything else `[all:unset]` used to reset (border-width, background, and
23
+ * inherited color/font) is already handled by Tailwind's Preflight on form
24
+ * controls, so it is intentionally left out to avoid fighting components that
25
+ * set a real `border` / `bg-*` / `text-*` (e.g. IIEditableBadges option rows).
26
+ *
27
+ * Does NOT set `display` or `cursor` — each consumer picks those.
28
+ */
29
+ export const buttonReset = 'appearance-none p-0 m-0 outline-none';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insymetri/styleguide",
3
- "version": "0.1.82",
3
+ "version": "0.1.84",
4
4
  "description": "Insymetri shared UI component library built with Svelte 5",
5
5
  "type": "module",
6
6
  "scripts": {